陈昶聿
3 小时以前 a9d3da5b62ed78a9e4d50e774672b3f0f658fd4a
【丽水】getSpecialSfStatistics 获取专病随访统计比例
已修改8个文件
236 ■■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtask.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java 66 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -559,6 +559,31 @@
    }
    /**
     * 获取专病随访统计比例
     */
    @ApiOperation("获取专病随访统计比例")
    @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid")
    @PostMapping("/getSpecialSfStatistics")
    public Map<String, Object> getSpecialSfStatistics(@RequestBody ServiceSubtaskCountReq serviceSubtaskCountReq) {
        if (CollectionUtils.isEmpty(serviceSubtaskCountReq.getServiceType())) {
            return error("服务类型不能为空");
        }
        Integer offset = PageUtils.getOffset(serviceSubtaskCountReq.getPageNum(), serviceSubtaskCountReq.getPageSize());
        serviceSubtaskCountReq.setPageNum(offset);
        String followUpCountStyle = configService.selectConfigByKey("followUpCountStyle", serviceSubtaskCountReq.getOrgid());
        if (ObjectUtils.isNotEmpty(followUpCountStyle)) {
            serviceSubtaskCountReq.setFollowUpCountStyle(followUpCountStyle);
        } else {
            serviceSubtaskCountReq.setFollowUpCountStyle("1");
        }
        serviceSubtaskCountReq.setPageNum(null);
        serviceSubtaskCountReq.setPageSize(null);
        List<ServiceSubtaskStatistic> sfStatistics = serviceSubtaskService.getSpecialSfStatistics(serviceSubtaskCountReq);
        return getDataTable4(CollectionUtils.isEmpty(sfStatistics) ? sfStatistics.size() : 0, serviceSubtaskService.getSpecialSfStatistics(serviceSubtaskCountReq));
    }
    /**
     * 获取随访统计比例
     */
    @ApiOperation("获取随访满意度统计")
smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
@@ -680,4 +680,11 @@
    @ApiModelProperty(value = "手术记录id 对应pat_med_operation_item.id")
    private Long operationItemId;
    /**
     * 疾病病种
     */
    @ApiModelProperty(value = "疾病病种")
    @Excel(name = " 疾病病种")
    private String diagType;
}
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java
@@ -57,7 +57,7 @@
    @ApiModelProperty(value = "子任务Id集合")
    private List<Long> subTaskIds;
    @ApiModelProperty(value = "科室病区:1,病区统计  2,科室统计")
    @ApiModelProperty(value = "科室病区:1,病区统计  2,科室统计  3. 病种统计")
    private Integer statisticaltype;
    private String visitDeptCode;
smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java
@@ -126,6 +126,8 @@
    public List<ServiceSubtask> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq);
    public List<ServiceSubtaskStatistic> getSpecialSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq);
    public List<ServiceSubtask> getSfStatisticsHyperlink(ServiceSubtaskCountReq serviceSubtaskCountReq);
    public List<String> getSfStatisticsGroupKey(ServiceSubtaskCountReq serviceSubtaskCountReq);
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
@@ -141,6 +141,8 @@
    public List<ServiceSubtaskStatistic> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq);
    public List<ServiceSubtaskStatistic> getSpecialSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq);
    //导出随访
    public List<ServiceSubtaskStatistic> getSfStatisticsExport(ServiceSubtaskCountReq serviceSubtaskCountReq);
smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -702,6 +702,7 @@
                //说明该患者是被过滤的,不用再执行了
                serviceSubtask.setCreateBy(serviceTask.getCreateBy());
                serviceSubtask.setCreateTime(new Date());
                serviceSubtask.setSendstate(4L);
                i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
            } else {
                if (StringUtils.isEmpty(serviceSubtask.getPhone())) {
@@ -848,6 +849,7 @@
                //说明该患者是被过滤的,不用再执行了
                serviceSubtask.setCreateBy(serviceTask.getCreateBy());
                serviceSubtask.setCreateTime(new Date());
                serviceSubtask.setSendstate(4L);
                i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
            } else {
                if (StringUtils.isEmpty(serviceSubtask.getPhone())) {
@@ -1204,7 +1206,7 @@
                e.printStackTrace();
                log.error("人员手术处理出异常了:{}", e.getMessage());
                opItem.setOpercheckFlag("2");
                opItem.setLongTaskReason("人员手术处理异常:" + e.getMessage());
                opItem.setLongTaskReason("人员手术处理异常");
                patMedOperationItemMapper.updatePatMedOperationItem(opItem);
            }
        }
@@ -1295,7 +1297,7 @@
                e.printStackTrace();
                log.error("人员疾病处理出异常了:{}", e.getMessage());
                pmiJB.setDiagcheckFlag("2");
                pmiJB.setLongTaskReason("人员疾病处理异常:" + e.getMessage());
                pmiJB.setLongTaskReason("人员疾病处理异常");
                patMedInhospMapper.updatePatMedInhosp(pmiJB);
            }
        }
@@ -1364,7 +1366,7 @@
                e.printStackTrace();
                log.error("人员病区处理出异常了:{}", e.getMessage());
                pmiBQ1.setWardcheckFlag("2");
                pmiBQ1.setLongTaskReason("人员病区处理异常:" + e.getMessage());
                pmiBQ1.setLongTaskReason("人员病区处理异常");
                patMedInhospMapper.updatePatMedInhosp(pmiBQ1);
            }
        }
@@ -1424,7 +1426,7 @@
                e.printStackTrace();
                log.error("人员科室处理出异常了:{}", e.getMessage());
                patMedInhosp1.setDeptcheckFlag("2");
                patMedInhosp1.setLongTaskReason("人员科室处理异常:" + e.getMessage());
                patMedInhosp1.setLongTaskReason("人员科室处理异常");
                patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
            }
        }
@@ -1629,7 +1631,7 @@
                e.printStackTrace();
                log.error("【基于规则】患者{}处理异常:{}", patMedInhosp1.getInhospid(), e.getMessage());
                patMedInhosp1.setDeptcheckFlag("2");
                patMedInhosp1.setLongTaskReason("基于规则处理异常:" + e.getMessage());
                patMedInhosp1.setLongTaskReason("基于规则处理异常");
                patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
            }
        }
@@ -1669,7 +1671,7 @@
            e.printStackTrace();
            log.error("【科室任务】患者{}处理异常:{}", patMedInhosp1.getInhospid(), e.getMessage());
            patMedInhosp1.setDeptcheckFlag("2");
            patMedInhosp1.setLongTaskReason("科室任务处理异常:" + e.getMessage());
            patMedInhosp1.setLongTaskReason("科室任务处理异常");
            patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
        }
        return generatedCount;
@@ -1717,7 +1719,7 @@
            e.printStackTrace();
            log.error("【病区任务】患者{}处理异常:{}", patMedInhosp1.getInhospid(), e.getMessage());
            patMedInhosp1.setWardcheckFlag("2");
            patMedInhosp1.setLongTaskReason("病区任务处理异常:" + e.getMessage());
            patMedInhosp1.setLongTaskReason("病区任务处理异常");
            patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
        }
        return generatedCount;
@@ -1783,7 +1785,7 @@
            e.printStackTrace();
            log.error("【疾病任务】患者{}处理异常:{}", patMedInhosp1.getInhospid(), e.getMessage());
            patMedInhosp1.setDiagcheckFlag("2");
            patMedInhosp1.setLongTaskReason("疾病任务处理异常:" + e.getMessage());
            patMedInhosp1.setLongTaskReason("疾病任务处理异常");
            patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
        }
        return generatedCount;
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -329,18 +329,41 @@
            }
            //获取该患者所有的执行状态
            List<ServiceSubtaskPreachform> serviceSubtaskPreachformList = serviceSubtaskPreachformLists.stream().filter((item -> item.getSubid().equals(serviceSubtask1.getId()) && item.getTaskid().equals(serviceTask.getTaskid()))).collect(Collectors.toList());
            List<Map<String, Object>> resultList = serviceSubtaskPreachformList.stream().map(item -> {
                Map<String, Object> map = new HashMap<>();
                map.put("sort", item.getSort());
                map.put("preachform", item.getPreachform());
                map.put("compensateTime", item.getCompensateTime());
                return map;
            }).collect(Collectors.toList());
            serviceTaskVO.setPreachformList(resultList);
//            List<ServiceSubtaskPreachform> serviceSubtaskPreachformList = serviceSubtaskPreachformLists.stream().filter((item -> item.getSubid().equals(serviceSubtask1.getId()) && item.getTaskid().equals(serviceTask.getTaskid()))).collect(Collectors.toList());
//            List<Map<String, Object>> resultList = serviceSubtaskPreachformList.stream().map(item -> {
//                Map<String, Object> map = new HashMap<>();
//                map.put("sort", item.getSort());
//                map.put("preachform", item.getPreachform());
//                map.put("compensateTime", item.getCompensateTime());
//                return map;
//            }).collect(Collectors.toList());
//            serviceTaskVO.setPreachformList(resultList);
//            String result = resultList.stream().map(mapList1 -> mapList1.get("preachform")).map(String::valueOf).collect(Collectors.joining(","));
//            serviceTaskVO.setPreachform(result);
        }
        if(StringUtils.isNotEmpty(serviceTaskVO.getPreachformDesc())){
            //直接通过PreachformDesc生成List返回
            try {
                List<Map<String, Object>> mapList = objectMapper.readValue(serviceTaskVO.getPreachformDesc(), List.class);
                serviceTaskVO.setPreachformList(mapList);
            }catch (Exception e) {
            }
        }else {
            if(CollectionUtils.isNotEmpty(list)){
                //获取该患者所有的执行状态
                List<ServiceSubtaskPreachform> serviceSubtaskPreachformList = serviceSubtaskPreachformLists.stream()
                        .filter((item -> item.getSubid().equals(list.get(0).getId()) && item.getTaskid().equals(serviceTask.getTaskid()))).collect(Collectors.toList());
                List<Map<String, Object>> resultList = serviceSubtaskPreachformList.stream().map(item -> {
                    Map<String, Object> map = new HashMap<>();
                    map.put("sort", item.getSort());
                    map.put("preachform", item.getPreachform());
                    map.put("compensateTime", item.getCompensateTime());
                    return map;
                }).collect(Collectors.toList());
                serviceTaskVO.setPreachformList(resultList);
            }
        }
        serviceTaskVO.setPatTaskRelevances(patTaskRelevances);
        return serviceTaskVO;
@@ -493,6 +516,7 @@
        if (patMedInhospList.size() > 0) {
            serviceSubtask1.setIsVisitAgain(2);
            serviceSubtask1.setRemark(StringUtils.isNotEmpty(serviceSubtask.getRemark()) ? serviceSubtask.getRemark() + ";患者再入院了" : "患者再入院了");
            serviceSubtask1.setSendstate(4L);
            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
            return "无需再次随访,患者再入院了";
        } else if (serviceSubtask1.getSendstate() == 4L) {
@@ -2521,6 +2545,29 @@
    }
    /**
     * 获取专病随访统计比例
     *
     * @param serviceSubtaskCountReq
     * @return
     */
    @Override
    @Cacheable(value = "specialSfStatistics", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()")
    public List<ServiceSubtaskStatistic> getSpecialSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq) {
        log.info("getSpecialSfStatistics的入参为:{}", serviceSubtaskCountReq);
        String groupKey = "drcode";
        if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
            groupKey = "drcode";
        } else {
            groupKey = "task_name";
        }
        List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
        serviceSubtaskCountReq.setGroupKey(groupKey);
        serviceSubtaskStatistics = serviceSubtaskMapper.getSpecialSfStatistics(serviceSubtaskCountReq);
        return serviceSubtaskStatistics;
    }
    /**
     * 随访统计-及时率统计
     *
     * @param serviceSubtaskCountReq
@@ -2996,7 +3043,6 @@
        }
        return serviceSubtaskStatistic;
    }
    /**
     * 首次随访统计
     *
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -121,6 +121,25 @@
        <result property="options" column="options"/>
    </resultMap>
    <resultMap type="com.smartor.domain.ServiceSubtaskStatistic" id="ServiceSubtaskStatisticResult">
        <result property="dischargeCount" column="discharge_count"/>
        <result property="nonFollowUp" column="non_follow_up"/>
        <result property="filterCount" column="filter_count"/>
        <result property="followUpNeeded" column="follow_up_needed"/>
        <result property="needFollowUp" column="need_follow_up"/>
        <result property="pendingFollowUp" column="pending_follow_up"/>
        <result property="followUpFail" column="follow_up_fail"/>
        <result property="manual" column="manual"/>
        <result property="voice" column="voice"/>
        <result property="sms" column="sms"/>
        <result property="weChat" column="we_chat"/>
        <result property="taskSituation1" column="task_situation1"/>
        <result property="taskSituation2" column="task_situation2"/>
        <result property="taskSituation3" column="task_situation3"/>
        <result property="taskSituation4" column="task_situation4"/>
        <result property="taskSituation5" column="task_situation5"/>
        <result property="taskSituation6" column="task_situation6"/>
    </resultMap>
    <sql id="selectServiceSubtaskVo">
        select id,
               hosp_type,
@@ -1485,6 +1504,92 @@
            </foreach>
        </if>
    </select>
    <select id="getSpecialSfStatistics" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
            resultMap="ServiceSubtaskStatisticResult">
        select
        COUNT(1) AS discharge_count,
        SUM(CASE WHEN b.sendstate = 4 THEN 1 ELSE 0 END) AS non_follow_up,
        SUM(CASE WHEN b.sendstate = 4 and b.task_situation = 6 THEN 1 ELSE 0 END) AS filter_count,
        SUM(CASE WHEN b.sendstate != 4 THEN 1 ELSE 0 END) AS follow_up_needed,
        SUM(CASE WHEN b.sendstate != 4 THEN 1 ELSE 0 END) AS need_follow_up,
        SUM(CASE WHEN b.sendstate = 2 THEN 1 ELSE 0 END) AS pending_follow_up,
        SUM(CASE WHEN b.sendstate = 5 or b.sendstate = 7 THEN 1 ELSE 0 END) AS follow_up_fail,
        SUM(CASE WHEN b.current_preachform = '1' THEN 1 ELSE 0 END) AS manual,
        SUM(CASE WHEN b.current_preachform = '3' THEN 1 ELSE 0 END) AS voice,
        SUM(CASE WHEN b.current_preachform = '4' THEN 1 ELSE 0 END) AS sms,
        SUM(CASE WHEN b.current_preachform = '5' THEN 1 ELSE 0 END) AS we_chat,
        SUM(CASE WHEN b.task_situation = 1 THEN 1 ELSE 0 END) AS task_situation1,
        SUM(CASE WHEN b.task_situation = 2 THEN 1 ELSE 0 END) AS task_situation2,
        SUM(CASE WHEN b.task_situation = 3 THEN 1 ELSE 0 END) AS task_situation3,
        SUM(CASE WHEN b.task_situation = 4 THEN 1 ELSE 0 END) AS task_situation4,
        SUM(CASE WHEN b.task_situation = 5 THEN 1 ELSE 0 END) AS task_situation5,
        SUM(CASE WHEN b.task_situation = 7 THEN 1 ELSE 0 END) AS task_situation7
        from service_task a
        JOIN service_subtask b on a.taskid = b.taskid
        where 1=1
        and a.del_flag = '0'
        and b.del_flag = '0'
        and a.appltype = '3'
        <if test="orgid != null and orgid != ''">
            and a.orgid = #{orgid}
        </if>
        <if test="taskId != null">
            and a.task_id = #{taskId}
        </if>
        <if test="taskName != null and taskName != ''">
            and a.task_name like concat('%', #{taskName}, '%')
        </if>
        <if test="diagType != null and diagType != ''">
            and a.diag_type = #{diagType}
        </if>
        <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            AND b.leavehospitaldistrictcode IN
            <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
                     close=")">
                #{leavehospitaldistrictcode}
            </foreach>
        </if>
        <if test="deptcodes != null and deptcodes.size() > 0">
            AND b.deptcode IN
            <foreach collection="deptcodes" item="deptcode" open="(" separator=","
                     close=")">
                #{deptcode}
            </foreach>
        </if>
        <if test="serviceType != null and serviceType.size() > 0">
            AND b.service_type IN
            <foreach collection="serviceType" item="serviceType" open="(" separator=","
                     close=")">
                #{serviceType}
            </foreach>
        </if>
        <if test="startTime != null and endTime!=null">
            AND b.visit_time >= DATE(#{startTime})
            AND b.visit_time &lt; DATE_ADD(DATE(#{endTime}), INTERVAL 1 DAY)
        </if>
        <if test="visitDeptCode != null">and b.visit_dept_code = #{visitDeptCode}</if>
        <if test="visitDeptName != null">and b.visit_dept_name = #{visitDeptName}</if>
        <if test="isabnormal != null">and b.isabnormal = #{isabnormal}</if>
        <if test="continueFlag != null ">and b.continue_flag = #{continueFlag}</if>
        <if test="continueTimeNow != null ">and b.continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
        <if test="continueCount != null ">and b.continue_count = #{continueCount}</if>
        <if test="continueTimeNext != null ">and b.continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP}</if>
        <!-- 目前只统计语音和问卷 -->
        <if test="type != null">
            and b.type = #{type}
        </if>
        <if test="visitCount != null and visitCount == 1">
            AND b.visit_count = 1
        </if>
        <if test="visitCount != null and visitCount > 1">
            AND b.visit_count > 1
        </if>
        <if test="groupKey != null and groupKey != ''">
            GROUP BY ${groupKey}
        </if>
    </select>
    <select id="getSfStatisticsGroupKey" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
            resultType="String">
        select
@@ -2111,8 +2216,10 @@
        SELECT deptname,
        count(1) AS rc
        FROM service_subtask
        WHERE DATE_FORMAT(finishtime, '%Y-%m-%d') >= #{startDate}
        AND DATE_FORMAT(finishtime, '%Y-%m-%d') &lt;= #{endDate}
        WHERE DATE_FORMAT(visit_time, '%Y-%m-%d') >= #{startDate}
        AND DATE_FORMAT(visit_time, '%Y-%m-%d') &lt;= #{endDate}
        AND service_type IN (2, 13)
        AND del_flag = '0'
        <if test="orgid != null">
            AND orgid = #{orgid}
        </if>
@@ -2154,6 +2261,7 @@
        FROM service_subtask
        WHERE
        del_flag = '0'
        AND service_type IN (2, 13)
        <if test="startDate != null and endDate != null">
            AND visit_time >= #{startDate}
            AND visit_time &lt;= DATE_ADD(#{endDate}, INTERVAL 1 DAY)
@@ -2215,7 +2323,7 @@
            AND endtime >= #{startDate}
            AND endtime &lt;= DATE_ADD(#{endDate}, INTERVAL 1 DAY)
        </if>
        AND service_type IN (2, 13)
        AND inhospstate=1
        <if test="orgid != null">
            AND orgid = #{orgid}