Переглянути джерело

门诊统筹统计明细增加,指标报表维护更新分组类型维护

hsh 2 роки тому
батько
коміт
b15aae3e01

+ 10 - 0
src/main/java/thyyxxk/webserver/controller/targetmanagement/TargetManagementController.java

@@ -139,4 +139,14 @@ public class TargetManagementController {
         return service.saveReportBaseInfo(info);
     }
 
+    @PostMapping("/saveTableGroupInfo")
+    public ResultVo<Map<String, Object>> saveTableGroupInfo(@RequestBody @Validated TableGroupInfo info){
+        return service.saveTableGroupInfo(info);
+    }
+
+    @GetMapping("/selectReportLevelDict")
+    public ResultVo<List<Map<String, Object>>> selectReportLevelDict() {
+        return service.selectReportLevelDict();
+    }
+
 }

+ 15 - 0
src/main/java/thyyxxk/webserver/dao/his/highreport/HighReportDao.java

@@ -148,4 +148,19 @@ public interface HighReportDao {
             "</script>")
     int saveReportBaseInfo(ReportBaseInfo info);
 
+    @Select("<script>" +
+            " select * from table_group_info where flag = 'Y' " +
+            " and report_id = #{reportId} " +
+            " <if test=\"level != null and level != '' \"> " +
+            " and level_id = #{level} " +
+            " </if> " +
+            "</script>")
+    TableGroupInfo selectTableGroupInfo(@Param("reportId") String reportId, @Param("level") String level);
+
+    @Delete("<script>" +
+            " delete from table_group_info " +
+            " where report_id = #{reportId} " +
+            "</script>")
+    void deleteTableGroupInfoById(@Param("reportId") String reportId);
+
 }

+ 17 - 0
src/main/java/thyyxxk/webserver/dao/his/targetmanagement/TableGroupInfoDao.java

@@ -0,0 +1,17 @@
+package thyyxxk.webserver.dao.his.targetmanagement;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.highreport.TableGroupInfo;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface TableGroupInfoDao extends BaseMapper<TableGroupInfo> {
+
+    @Select(" select report_id as reportId, level_id as levelId, level_name as levelName, report_id + '^' + level_id as id from table_group_info where flag = 'Y' ")
+    List<Map<String, Object>> selectReportLevelDict();
+
+}

+ 35 - 0
src/main/java/thyyxxk/webserver/dao/his/ybkf/OutpatientCoordinationDao.java

@@ -59,4 +59,39 @@ public interface OutpatientCoordinationDao {
             " group by tt.rq, tt.code, tt.dept ")
     List<Map<String, String>> selectUsedOutpatientCoordinationDeptPeople(@Param("month") String month);
 
+    @Select("<script>" +
+            "select tt.* from (\n" +
+            "select \n" +
+            "t2.doctor_code as doctorId, \n" +
+            "(select rtrim(a.name) from a_employee_mi a WHERE a.code = t2.doctor_code) as doctor, \n" +
+            "t2.unit_code as deptId, \n" +
+            "(select d.name from zd_unit_code d WHERE d.code = t2.unit_code ) as dept, \n" +
+            "(select rtrim(a.name) from a_employee_mi a WHERE a.code = t2.op_id) as czr, \n" +
+            "(select d.code from a_employee_mi a, zd_unit_code d WHERE a.code = t1.staff_id and d.code = a.dept_code ) as deptCode, \n" +
+            "(select d.name from a_employee_mi a, zd_unit_code d WHERE a.code = t1.staff_id and d.code = a.dept_code ) as deptName, \n" +
+            "t1.pat_no as patNo, \n" +
+            "t1.times, \n" +
+            "t1.setl_time as rq, \n" +
+            "(select name from t_si_admdvs z where z.code = t1.insuplc_admdvs) as cbd, \n" +
+            "t1.psn_name as psnName, \n" +
+            "t3.icd_text as zd  \n" +
+            "from \n" +
+            "(select pat_no, convert(varchar(100), setl_time, 112) rq1, setl_time, staff_id, times, psn_name, insuplc_admdvs \n" +
+            "from t_si_setlinfo where med_type='11' and insutype='310' and revoked=0 \n" +
+            "and convert(varchar(6), setl_time, 112) = #{month} ) t1, \n" +
+            "(select distinct patient_id, CONVERT(varchar(100), request_day, 112) rq2, isnull(doctor_code, visit_doctor) as doctor_code, op_id, unit_code \n" +
+            "from mzy_reqrec with(nolock) \n" +
+            "where cancel_mark=0 \n" +
+            "and convert(varchar(6), request_day, 112) = #{month} ) t2, \n" +
+            "(select distinct patient_id, times, isnull(icd_text_new, icd_text) as icd_text from mz_visit_table) t3 \n" +
+            "where t1.pat_no = t2.patient_id \n" +
+            "and t1.rq1 = t2.rq2 \n" +
+            "and t1.pat_no = t3.patient_id \n" +
+            "and t1.times = t3.times \n" +
+            ") tt\n" +
+            "where tt.deptName = #{dept} \n" +
+            "order by tt.rq \n" +
+            "</script>")
+    List<Map<String, String>> selectUsedOutpatientCoordinationDeptPeopleForDept(@Param("month") String month, @Param("dept") String dept);
+
 }

+ 50 - 2
src/main/java/thyyxxk/webserver/service/targetmanagement/TargetManagementService.java

@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.dao.his.highreport.HighReportDao;
+import thyyxxk.webserver.dao.his.targetmanagement.TableGroupInfoDao;
 import thyyxxk.webserver.dao.his.targetmanagement.TargetManagementDao;
 import thyyxxk.webserver.dao.his.targetmanagement.ZbZdBaseInfoDao;
 import thyyxxk.webserver.entity.ResultVo;
@@ -54,12 +55,15 @@ public class TargetManagementService {
 
     private final RedisLikeService redis;
 
+    private final TableGroupInfoDao tableDao;
+
     @Autowired
-    public TargetManagementService(TargetManagementDao dao, ZbZdBaseInfoDao zbZdDao, HighReportDao reportDao, RedisLikeService redis) {
+    public TargetManagementService(TargetManagementDao dao, ZbZdBaseInfoDao zbZdDao, HighReportDao reportDao, RedisLikeService redis, TableGroupInfoDao tableDao) {
         this.dao = dao;
         this.zbZdDao = zbZdDao;
         this.reportDao = reportDao;
         this.redis = redis;
+        this.tableDao = tableDao;
     }
 
     /**
@@ -658,7 +662,15 @@ public class TargetManagementService {
         TableGroupInfo info = reportDao.selectTableGroupInfoByLevel(dto.getReportId(), dto.getLevel());
         if(info == null){
             // 查不到给他默认报表分组类型
-            info = reportDao.selectTableGroupInfoByLevel(ReportType.GROUP_KS.getCode(), dto.getLevel());
+            if(ReportType.GROUP_KS.getCode().equals(dto.getLevel())) {
+                info = reportDao.selectTableGroupInfoByLevel(ReportType.GROUP_KS.getCode(), dto.getLevel());
+            } else if(ReportType.GROUP_ZB.getCode().equals(dto.getLevel())) {
+                info = reportDao.selectTableGroupInfoByLevel(ReportType.GROUP_ZB.getCode(), dto.getLevel());
+            }
+        }
+
+        if(null == info){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "指标分组配置不存在,请检查!");
         }
 
         return ResultVoUtil.success(info);
@@ -752,4 +764,40 @@ public class TargetManagementService {
         return ResultVoUtil.success(resultMap);
     }
 
+    /**
+     * @description: 保存/更新指标分组信息
+     * @author: hsh
+     * @date: 2023/9/26 16:19
+     * @param: [info]
+     * @return: ResultVo<Map<String,Object>>
+     **/
+    public ResultVo<Map<String, Object>> saveTableGroupInfo(TableGroupInfo info) {
+        Map<String, Object> resultMap = new HashMap<>();
+
+        if(info == null || StringUtil.isBlank(info.getReportId())){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "指标分组信息为空,保存指标分组信息失败!");
+        }
+
+        if(ReportType.GROUP_KS.getCode().equals(info.getReportId()) || ReportType.GROUP_ZB.getCode().equals(info.getReportId())){
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "指标固定分组信息不允许修改/删除!");
+        }
+
+        TableGroupInfo table = reportDao.selectTableGroupInfo(info.getReportId(), null);
+        if (table != null) {
+            reportDao.deleteTableGroupInfoById(info.getReportId());
+        }
+
+        int n = tableDao.insert(info);
+        if (n <= 0) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存指标分组信息失败!");
+        }
+
+        resultMap.put("cg", "保存指标详情成功!");
+        return ResultVoUtil.success(resultMap);
+    }
+
+    public ResultVo<List<Map<String, Object>>> selectReportLevelDict() {
+        List<Map<String, Object>> list = tableDao.selectReportLevelDict();
+        return ResultVoUtil.success(list);
+    }
 }

+ 30 - 0
src/main/java/thyyxxk/webserver/service/ybkf/OutpatientCoordinationService.java

@@ -44,6 +44,11 @@ public class OutpatientCoordinationService {
         List<Map<String, String>> deptList = dao.selectUsedOutpatientCoordinationDeptPeople(month);
         Map<String, List<Map<String, String>>> deptMap = deptList.stream().collect(Collectors.groupingBy(map -> map.get("dept")));
 
+        // 分别是医保办,信息中心,财务部统计的门诊统筹病人
+        List<Map<String, String>> ybbList = dao.selectUsedOutpatientCoordinationDeptPeopleForDept(month, YbTjConstant.MEDICAL_INSURANCE_DEPT_NAME);
+        List<Map<String, String>> xxkList = dao.selectUsedOutpatientCoordinationDeptPeopleForDept(month, YbTjConstant.INFO_CENTER_DEPT_NAME);
+        List<Map<String, String>> cwbList = dao.selectUsedOutpatientCoordinationDeptPeopleForDept(month, YbTjConstant.REGISTER_DEPT_NAME);
+
         List<String> list = DateUtil.getDayListOfMonth(month);
         assert list != null;
         Map<String, Object> head = new HashMap<>(list.size() + 2);
@@ -136,6 +141,31 @@ public class OutpatientCoordinationService {
         }
         resultList.add(ksMap);
 
+        // 组装科室数据
+        for(Map<String, Object> map : resultList){
+            String dept = String.valueOf(map.get("item"));
+            if(YbTjConstant.MEDICAL_INSURANCE_DEPT_NAME.equals(dept)){
+                if(ybbList.size() > 0){
+                    map.put("children", ybbList);
+                    map.put("childKey", "医保办");
+                    map.put("isDept", true);
+                }
+            } else if(YbTjConstant.INFO_CENTER_DEPT_NAME.equals(dept)){
+                if(xxkList.size() > 0){
+                    map.put("children", xxkList);
+                    map.put("childKey", "信息中心");
+                    map.put("isDept", true);
+                }
+            } else if(YbTjConstant.REGISTER_DEPT_NAME.equals(dept)){
+                if(cwbList.size() > 0){
+                    map.put("children", cwbList);
+                    map.put("childKey", "财务部");
+                    map.put("isDept", true);
+                }
+            }
+
+        }
+
         resultMap.put("headTitle", headTitle);
         resultMap.put("resultData", resultList);
         resultMap.put("deptData", ksList);