fd105724994e7581f334fc7aad6510aa33661a9d..eb09fd02770127a349526447e879fcadfa387ee9
2025-12-29 陈昶聿
【景宁】景宁 出院首次(7天)随访一定要做
eb09fd 对比 | 目录
2025-12-29 陈昶聿
【景宁】获取随访比例接口数量对不上
a688a1 对比 | 目录
已修改2个文件
65 ■■■■ 文件已修改
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -550,6 +550,7 @@
    //将患者放到subtask中
    private void writeInSubTask(Long taskid, Boolean check, PatMedInhosp patMedInhosp1, PatArchive patArchive, Integer type, String config) {
        String longTaskReason = patMedInhosp1.getLongTaskReason();
        String orgId = patMedInhosp1.getOrgid();
        if (StringUtils.isEmpty(longTaskReason)) longTaskReason = "";
        ServiceTask st = new ServiceTask();
        st.setTaskid(taskid);
@@ -634,7 +635,15 @@
                                if (aBoolean) i = 1;
                                continue;
                            }
                            if (endTime1.before(endTime) && serviceSubtask1.getServiceType().equals("2")) {
                            //再入院逻辑
                            //景宁 出院首次(7天)随访一定要做
                            boolean firstVisit = false;
                            if (orgId.equals("47255004333112711A1001")
                                    && serviceSubtask1.getVisitCount() != null && serviceSubtask1.getVisitCount() == 1){
                                firstVisit = true;
                            }
                            if (endTime1.before(endTime) && serviceSubtask1.getServiceType().equals("2")
                                && !firstVisit) {
                                //如果当前循环的子任务的出院时间在“准备新增的子任务”的出院时间之前,则将循环的子任务停掉
                                serviceSubtask1.setSendstate(4L);
                                if (StringUtils.isNotEmpty(serviceSubtask.getRemark()))
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -1630,25 +1630,12 @@
    <!-- 优化的统计查询:直接在数据库层完成聚合计算 -->
    <select id="countByCondition" parameterType="com.smartor.domain.ServiceSubtaskVO" resultType="map">
        SELECT
            -- 未执行数量 (sendstate = 4)
            SUM(CASE WHEN sendstate = 4 THEN 1 ELSE 0 END) AS wzx,
            -- 已随访数量 (sendstate != 4 AND sendstate != 2)
            SUM(CASE WHEN sendstate != 4 AND sendstate != 2 THEN 1 ELSE 0 END) AS ysf,
            -- 发送失败数量 (sendstate = 5)
            SUM(CASE WHEN sendstate = 5 THEN 1 ELSE 0 END) AS fssb,
            -- 已发送数量 (sendstate >= 3 OR sendstate = 1)
            SUM(CASE WHEN sendstate >= 3 OR sendstate = 1 THEN 1 ELSE 0 END) AS yfs,
            -- 待随访数量 (sendstate = 2)
            SUM(CASE WHEN sendstate = 2 THEN 1 ELSE 0 END) AS dsf,
            -- 不理睬数量 (sendstate = 1)
            SUM(CASE WHEN sendstate = 1 THEN 1 ELSE 0 END) AS blq,
            -- 异常数量 (excep IS NOT NULL AND excep != '0')
            SUM(CASE WHEN excep IS NOT NULL AND excep != '0' THEN 1 ELSE 0 END) AS yc
        FROM service_subtask
        <where>
@@ -1659,8 +1646,39 @@
            <if test="phone != null and phone != ''">
                AND phone = #{phone}
            </if>
            <if test="leavehospitaldistrictcode != null and leavehospitaldistrictcode != ''">
                AND leavehospitaldistrictcode = #{leavehospitaldistrictcode}
            <if test="deptOrDistrict==1">
                <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
                    AND leavehospitaldistrictcode IN
                    <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
                             separator=","
                             close=")">
                        #{leavehospitaldistrictcode}
                    </foreach>
                </if>
                <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
                    AND deptcode IN
                    <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
                             close=")">
                        #{leaveldeptcode}
                    </foreach>
                </if>
            </if>
            <if test="deptOrDistrict==2">
                <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
                    AND (leavehospitaldistrictcode IN
                    <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
                             separator=","
                             close=")">
                        #{leavehospitaldistrictcode}
                    </foreach>
                </if>
                <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
                    OR deptcode IN
                    <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
                             close="))">
                        #{leaveldeptcode}
                    </foreach>
                </if>
            </if>
            <if test="leavehospitaldistrictname != null and leavehospitaldistrictname != ''">
                AND leavehospitaldistrictname = #{leavehospitaldistrictname}
@@ -1772,6 +1790,12 @@
            <if test="guid != null and guid != ''">
                AND guid = #{guid}
            </if>
            <if test="visitCount != null and visitCount == 1">
                AND visit_count = 1
            </if>
            <if test="visitCount != null and visitCount > 1">
                AND visit_count > 1
            </if>
        </where>
    </select>