Commit 8a726e82 authored by zhangwanglin's avatar zhangwanglin

出院情况查询条件

parent 79815f56
...@@ -48,5 +48,5 @@ public interface BuildBedMapper extends BaseMapper<ChSrvBuildBed> { ...@@ -48,5 +48,5 @@ public interface BuildBedMapper extends BaseMapper<ChSrvBuildBed> {
int getRoleByUserId(@Param("userId") Integer userId,@Param("roleIds") List<String> roleIds ); int getRoleByUserId(@Param("userId") Integer userId,@Param("roleIds") List<String> roleIds );
int selectSrvSend(String disabInfoId);
} }
...@@ -99,17 +99,9 @@ public class BuildBedServiceImpl extends ServiceImpl<BuildBedMapper, ChSrvBuildB ...@@ -99,17 +99,9 @@ public class BuildBedServiceImpl extends ServiceImpl<BuildBedMapper, ChSrvBuildB
*/ */
@Override @Override
public Page<ChSrvTaskDetailVo> chSrvTaskDetailQuery(Page<ChSrvTaskDetailVo> page,ChSrvTaskDetailVo vo){ public Page<ChSrvTaskDetailVo> chSrvTaskDetailQuery(Page<ChSrvTaskDetailVo> page,ChSrvTaskDetailVo vo){
Page<ChSrvTaskDetailVo> chSrvTaskDetailVoPage = buildBedMapper.chSrvTaskDetailQuery(page, vo); Page<ChSrvTaskDetailVo> chSrvTaskDetailVoPage = buildBedMapper.chSrvTaskDetailQuery(page, vo);
chSrvTaskDetailVoPage.getRecords().stream().filter(chSrvTaskDetail -> { chSrvTaskDetailVoPage.getRecords().stream().filter(chSrvTaskDetail -> {
String disabInfoId = chSrvTaskDetail.getDisabInfoId();
String hospitalFlag = chSrvTaskDetail.getHospitalFlag();
if("1".equals(hospitalFlag)){
int count = buildBedMapper.selectSrvSend(disabInfoId);
if(count > 0) {
chSrvTaskDetail.setHospitalFlag("0");
}
}
if (null != chSrvTaskDetail.getSevStarTime()){ if (null != chSrvTaskDetail.getSevStarTime()){
chSrvTaskDetail.setSevStarTime(chSrvTaskDetail.getSevStarTime().substring(0,19)); chSrvTaskDetail.setSevStarTime(chSrvTaskDetail.getSevStarTime().substring(0,19));
} }
......
...@@ -28,8 +28,9 @@ ...@@ -28,8 +28,9 @@
<select id="chSrvTaskDetailQuery" parameterType="com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetailVo" <select id="chSrvTaskDetailQuery" parameterType="com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetailVo"
resultType="com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetailVo"> resultType="com.hungraim.ltc.pojo.vo.disable.ChSrvTaskDetailVo">
select A.* from ( select A.*,(case when A.exitReasonId = 4 and A.hospitalFlag1 = 0 then 0
select row_number()over(partition by info.CERTI_CODE order by program.PROGRAM_ID) rn, when A.exitReasonId = 4 and A.hospitalFlag1 > 0 then 1 else 2 end) hospitalFlag
from ( select row_number()over(partition by info.CERTI_CODE order by program.PROGRAM_ID) rn,
program.PROGRAM_ID taskDetailId, program.PROGRAM_ID taskDetailId,
mode1.MODE_NAME modeName, mode1.MODE_NAME modeName,
organ.SRV_ORGAN_NAME srvOrganName,--护理机构名称 organ.SRV_ORGAN_NAME srvOrganName,--护理机构名称
...@@ -37,7 +38,9 @@ ...@@ -37,7 +38,9 @@
info.CERTI_CODE certiCode,--失能人员身份证件号码 info.CERTI_CODE certiCode,--失能人员身份证件号码
program.PROGRAM_DATE sevStarTime,--服务开始时间 program.PROGRAM_DATE sevStarTime,--服务开始时间
program.PROGRAM_EDN_DATE sevEndTime,--服务结束时间 program.PROGRAM_EDN_DATE sevEndTime,--服务结束时间
(case when info.exit_time is null then 0 else 1 end) hospitalFlag, (select count(*) from CH_SRV_SEND t where t.DISAB_INFO_ID = info.DISAB_INFO_ID and
t.STATUS = 1) hospitalFlag1,
info.exit_reason_id exitReasonId,
info.DISAB_INFO_ID disabInfoId info.DISAB_INFO_ID disabInfoId
from ch_srv_program program from ch_srv_program program
LEFT JOIN ch_cfg_srv_mode mode1 ON program.srv_mode_id = mode1.mode_id --服务方式 LEFT JOIN ch_cfg_srv_mode mode1 ON program.srv_mode_id = mode1.mode_id --服务方式
...@@ -61,9 +64,7 @@ ...@@ -61,9 +64,7 @@
<if test="vo.certiCode != null and vo.certiCode != ''"> <if test="vo.certiCode != null and vo.certiCode != ''">
AND info.CERTI_CODE =#{vo.certiCode} AND info.CERTI_CODE =#{vo.certiCode}
</if> </if>
<if test="vo.hospitalFlag != null and vo.hospitalFlag != ''">
AND (case when info.exit_time is null then 0 else 1 end) =#{vo.hospitalFlag}
</if>
<if test="vo.sevStarTime != null and vo.sevStarTime != ''"> <if test="vo.sevStarTime != null and vo.sevStarTime != ''">
AND program.PROGRAM_DATE &gt;= TO_DATE (#{vo.sevStarTime}, 'yyyy-mm-dd') AND program.PROGRAM_DATE &gt;= TO_DATE (#{vo.sevStarTime}, 'yyyy-mm-dd')
</if> </if>
...@@ -72,12 +73,12 @@ ...@@ -72,12 +73,12 @@
</if> </if>
)A )A
where A.rn =1 where A.rn =1
<if test="vo.hospitalFlag != null and vo.hospitalFlag != ''">
AND (case when A.exitReasonId = 4 and A.hospitalFlag1 = 0 then 0
when A.exitReasonId = 4 and A.hospitalFlag1 > 0 then 1 else 2 end) = #{vo.hospitalFlag}
</if>
</select> </select>
<select id="selectSrvSend" resultType="java.lang.Integer">
select count(*) from CH_SRV_SEND t where t.DISAB_INFO_ID = #{disabInfoId} and
t.STATUS = 1
</select>
<select id="getsrvOrgan" resultType="com.hungraim.ltc.pojo.entity.account.ChPunchDetailsVO"> <select id="getsrvOrgan" resultType="com.hungraim.ltc.pojo.entity.account.ChPunchDetailsVO">
SELECT SELECT
......
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