Commit fb48c807 authored by zhangch's avatar zhangch

接口提交

parent 1a2db239
package com.hungraim.ltc.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganListVo;
import com.hungraim.ltc.service.SrvOrganService;
import com.hungraim.ltc.util.Result;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api.apply/srvOrgan")
@AllArgsConstructor
public class SrvOrganController {
private final SrvOrganService srvOrganService;
/**
* 分页查询护理机构列表
*
* @param pageNum 分页参数
* @param pageSize 分页参数
* @param organId 适用机构id
* @param isInvolveChild 是否包含下层机构
* @param creditCode 统一社会信用代码
* @param srvOrganName 护理机构名称
* @return 返回护理机构列表
*/
@GetMapping("/list")
public Result<Page<SrvOrganListVo>> getSrvOrganList(Integer pageNum, Integer pageSize, Long organId, Boolean isInvolveChild, String creditCode, String srvOrganName) {
Page<SrvOrganListVo> page = new Page<>(pageNum, pageSize);
page = srvOrganService.getSrvOrganList(page, organId, isInvolveChild, creditCode, srvOrganName);
return Result.success(page);
}
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.SysConfig.ChCfgSrvMode;
import com.hungraim.ltc.pojo.vo.disable.SrvModeVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
......@@ -14,7 +15,16 @@ public interface SrvModeMapper extends BaseMapper<ChCfgSrvMode> {
/**
* 查询全部服务方式
*
* @return 返回所有服务方式
*/
List<SrvModeVo> selectAll();
/**
* 查询对应id的数据
*
* @param modeIds id集合字符串,英文逗号分割
* @return 返回集合
*/
List<SrvModeVo> selectByModeIds(@Param("modeIds") List<Integer> modeIds);
}
\ No newline at end of file
package com.hungraim.ltc.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.entity.disable.ChSrvOrgan;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 护理机构Mapper
*
......@@ -15,4 +19,15 @@ import org.springframework.stereotype.Repository;
@Repository
public interface SrvOrganMapper extends BaseMapper<ChSrvOrgan> {
/**
* 分页查询护理机构列表
*
* @param page 分页对象
* @param organIds 适用机构id集合
* @param creditCode 统一社会信用代码
* @param srvOrganName 护理机构名称
* @return 返回护理机构列表
*/
Page<SrvOrganListVo> getSrvOrganList(Page<SrvOrganListVo> page, @Param("organIds") List<Long> organIds, @Param("creditCode") String creditCode, @Param("srvOrganName") String srvOrganName);
}
package com.hungraim.ltc.service;
import java.util.List;
public interface OrganService {
/**
* 根据organId以及isInvolveChild返回一个organIds集合
* 返回一个好办organId的ids集合,如果isInvolveChild的值为true,则包含organId的下层机构,如果为false,就只返回只存在organId的ids集合
*
* @param organId 适用机构id
* @param isInvolveChild 是否包含下层机构
* @return 返回一个ids集合
*/
List<Long> getOrganIds(Long organId, Boolean isInvolveChild);
}
package com.hungraim.ltc.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganListVo;
public interface SrvOrganService {
/**
* 分页查询护理机构列表
*
* @param page 分页对象
* @param organId 适用机构id
* @param isInvolveChild 是否包含下层机构
* @param creditCode 统一社会信用代码
* @param srvOrganName 护理机构名称
* @return 返回护理机构列表
*/
Page<SrvOrganListVo> getSrvOrganList(Page<SrvOrganListVo> page, Long organId, Boolean isInvolveChild, String creditCode, String srvOrganName);
}
......@@ -223,7 +223,7 @@ public class DisableServiceImpl implements DisableService {
@Override
public List<ChSrvOrgan> srvOrganList(String organId) {
return srvOrganMapper.selectList(new QueryWrapper<ChSrvOrgan>().eq("organ_id", organId));
return srvOrganMapper.selectList(new QueryWrapper<ChSrvOrgan>().eq("organ_id", organId).eq("STATUS", (short) 0));
}
@Override
......
package com.hungraim.ltc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hungraim.ltc.dao.FndOrganMapper;
import com.hungraim.ltc.pojo.entity.disable.ChFndOrgan;
import com.hungraim.ltc.service.OrganService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
@AllArgsConstructor
public class OrganServiceImpl implements OrganService {
private final FndOrganMapper fndOrganMapper;
@Override
public List<Long> getOrganIds(Long organId, Boolean isInvolveChild) {
List<Long> organIds = new ArrayList<>();
if (isInvolveChild) {
if (organId != null) {
organIds.add(organId);
QueryWrapper<ChFndOrgan> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("PARENT_ID", organId);
queryWrapper.eq("STATUS", "1");
List<ChFndOrgan> chFndOrgans = fndOrganMapper.selectList(queryWrapper);
if (chFndOrgans != null) {
for (ChFndOrgan chFndOrgan : chFndOrgans) {
organIds.add(Long.valueOf(chFndOrgan.getOrganId()));
}
}
}
}
return organIds;
}
}
package com.hungraim.ltc.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.dao.SrvModeMapper;
import com.hungraim.ltc.dao.SrvOrganMapper;
import com.hungraim.ltc.pojo.vo.disable.SrvModeVo;
import com.hungraim.ltc.pojo.vo.disable.SrvOrganListVo;
import com.hungraim.ltc.service.OrganService;
import com.hungraim.ltc.service.SrvOrganService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
@AllArgsConstructor
public class SrvOrganServiceImpl implements SrvOrganService {
private final SrvOrganMapper srvOrganMapper;
private final OrganService organService;
private final SrvModeMapper srvModeMapper;
@Override
public Page<SrvOrganListVo> getSrvOrganList(Page<SrvOrganListVo> page, Long organId, Boolean isInvolveChild, String creditCode, String srvOrganName) {
List<Long> organIds = organService.getOrganIds(organId, isInvolveChild);
Page<SrvOrganListVo> srvOrganList = srvOrganMapper.getSrvOrganList(page, organIds, creditCode, srvOrganName);
List<SrvOrganListVo> records = srvOrganList.getRecords();
if (records != null && records.size() > 0) {
for (SrvOrganListVo srvOrganListVo : records) {
String srvType = srvOrganListVo.getSrvType();
if (StrUtil.isNotBlank(srvType)) {
String[] split = srvType.split(",");
List<Integer> modeIds = new ArrayList<>();
for (String s : split) {
modeIds.add(Integer.parseInt(s));
}
// 去查询对应的服务方式
List<SrvModeVo> srvModeVos = srvModeMapper.selectByModeIds(modeIds);
srvOrganListVo.setSrvModeVos(srvModeVos);
}
}
}
return srvOrganList;
}
}
......@@ -9,4 +9,15 @@
REMARK remark
FROM CH_CFG_SRV_MODE
</select>
<select id="selectByModeIds" resultType="com.hungraim.ltc.pojo.vo.disable.SrvModeVo">
SELECT MODE_ID srvModeId,
MODE_NAME srvModeName,
REMARK remark
FROM CH_CFG_SRV_MODE
WHERE MODE_ID IN
<foreach collection="modeIds" item="modeId" open="(" close=")" separator=",">
#{modeId}
</foreach>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hungraim.ltc.dao.SrvOrganMapper">
<resultMap id="srvOrganListMap" type="com.hungraim.ltc.pojo.vo.disable.SrvOrganListVo">
<id column="SRV_ORGAN_ID" property="srvOrganId"/>
<result column="ORGAN_ID" property="organId"/>
<result column="ORGAN_NAME" property="organName"/>
<result column="DISTRICT_PROVINCIAL" property="districtProvince"/>
<result column="DISTRICT_CITY" property="districtCity"/>
<result column="DISTRICT_AREA" property="districtArea"/>
<result column="ADRESS_DETAIL" property="addressDetail"/>
<result column="SRV_ORGAN_NAME" property="srvOrganName"/>
<result column="ORGAN_TYPE_ID" property="organTypeId"/>
<result column="ORGAN_TYPE_NAME" property="organTypeName"/>
<result column="UNIFIED_SOCIAL_CREDIT_CODE" property="unifiedSocialCreditCode"/>
<result column="LINK_NAME" property="linkName"/>
<result column="LINK_TEL" property="linkTel"/>
<result column="BUNK" property="bunk"/>
<result column="SRV_TYPE" property="srvType" />
</resultMap>
<select id="getSrvOrganList" resultMap="srvOrganListMap">
SELECT T1.SRV_ORGAN_ID,
T1.ORGAN_ID,
T2.ORGAN_NAME,
T1.DISTRICT_PROVINCIAL,
T1.DISTRICT_CITY,
T1.DISTRICT_AREA,
T1.ADRESS_DETAIL,
T1.SRV_ORGAN_NAME,
T1.ORGAN_TYPE_ID,
T3.ORGAN_TYPE_NAME,
T1.UNIFIED_SOCIAL_CREDIT_CODE,
T1.SRV_TYPE,
T1.LINK_NAME,
T1.LINK_TEL,
T1.BUNK
FROM CH_SRV_ORGAN T1
LEFT JOIN CH_FND_ORGAN T2 on T1.ORGAN_ID = T2.ORGAN_ID
LEFT JOIN CH_CFG_SRV_ORGAN_TYPE T3 ON T1.ORGAN_TYPE_ID = T3.ORGAN_TYPE_ID
WHERE T1.STATUS = 0
<if test="organIds != null and organIds.size() > 0">
AND T1.ORGAN_ID IN
<foreach collection="organIds" separator="," open="(" close=")" item="organId">
#{organId}
</foreach>
</if>
<if test="creditCode != null and creditCode != ''">
AND T1.UNIFIED_SOCIAL_CREDIT_CODE = #{creditCode}
</if>
<if test="srvOrganName != null and srvOrganName != ''">
AND T1.SRV_ORGAN_NAME LIKE CONCAT('%',CONCAT(#{srvOrganName},'%'))
</if>
</select>
</mapper>
\ No newline at end of file
package com.hungraim.ltc.pojo.vo.disable;
import lombok.Data;
import java.util.List;
/**
* 护理机构列表vo类
*/
@Data
public class SrvOrganListVo {
/**
* 护理机构id
*/
private Long srvOrganId;
/**
* 适用机构id
*/
private Long organId;
/**
* 适用机构名称
*/
private String organName;
/**
* 所在省市地址
*/
private String districtProvince;
private String districtCity;
private String districtArea;
private String addressDetail;
/**
* 护理机构名称
*/
private String srvOrganName;
/**
* 机构类型id
*/
private Long organTypeId;
/**
* 机构类型名称
*/
private String organTypeName;
/**
* 统一社会信用代码
*/
private String unifiedSocialCreditCode;
/**
* 提供的服务方式(服务方式id集合,英文逗号分割)
*/
private String srvType;
/**
* 提供服务方式
*/
private List<SrvModeVo> srvModeVos;
/**
* 联系人姓名
*/
private String linkName;
/**
* 联系人电话
*/
private String linkTel;
/**
* 提供长护床位数
*/
private Long bunk;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment