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

Merge branch 'dev/20210326_2.0.2' into test

# Conflicts:
#	src/main/java/com/diagbot/facade/ConsoleFacade.java
chengyao 4 роки тому
батько
коміт
79d357fe3e

+ 77 - 0
src/main/java/com/diagbot/entity/MedIndexRelevance.java

@@ -0,0 +1,77 @@
+package com.diagbot.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2021-04-30
+ */
+@Data
+public class MedIndexRelevance implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 主缓存表id
+     */
+    private Integer indexResultId;
+
+    /**
+     * 病历条目关联表type
+     */
+    private Integer relevanceType;
+
+    /**
+     * 医院ID
+     */
+    private String hospitalId;
+
+    /**
+     * 病人病历号
+     */
+    private String behospitalCode;
+
+    private String startDate;
+
+    private String endDate;
+
+    /**
+     * 是否删除,N:未删除,Y:删除
+     */
+    private String isDeleted;
+
+    /**
+     * 记录创建时间
+     */
+    private Date gmtCreate;
+
+    /**
+     * 记录修改时间,如果时间是1970年则表示纪录未修改
+     */
+    private Date gmtModified;
+
+    /**
+     * 创建人,0表示无创建人值
+     */
+    private String creator;
+
+    /**
+     * 修改人,如果为0则表示纪录未修改
+     */
+    private String modifier;
+
+
+}

+ 1 - 0
src/main/java/com/diagbot/enums/QualityContent.java

@@ -13,6 +13,7 @@ public class QualityContent {
     public static final String NUMBER_OF_HOSPITAL = "入院人数";
     public static final String NO_RECORD_OPERATION = "无病案首页手术患者";
     public static final String NO_RECORD_OPERATION_PATHOLOGY = "无病案首页手术病理患者";
+    public static final double pathologyFee = 68.00;
     /**
      * 是否需要用到医嘱的指标名称
      */

+ 1 - 2
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -729,7 +729,6 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         //使用sql进行关联优化数据查询
         List<MedPacsResultDTO> medPacsResultList = medPacsResultFacade.getMedPacsResultList(behospitalInfoList.get(0));
 
-
         /**
          * 结构化/文书数据兼容处理
          */
@@ -2325,7 +2324,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
      * @param filterVO
      * @return
      */
-    public Map<String,Long> selectOperationNum( FilterVO filterVO){
+    public List<Map<String, String>> selectOperationNum( FilterVO filterVO){
         return   baseMapper.selectOperationNum(filterVO);
     }
     /**

+ 221 - 103
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -21,6 +21,7 @@ import com.google.common.collect.Lists;
 import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
+import org.apache.poi.hssf.record.DVALRecord;
 import org.apache.poi.ss.formula.functions.Na;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -77,7 +78,8 @@ public class ConsoleFacade {
     private DoctorAdviceFacade doctorAdviceFacade;
     @Autowired
     private MedIndexResultFacade medIndexResultFacade;
-
+    @Autowired
+    private MedIndexRelevanceFacade medIndexRelevanceFacade;
     //region-----------------------聚合接口开始-------------------------------
 
     /**
@@ -443,11 +445,7 @@ public class ConsoleFacade {
             if (InHospitalRecords != null && startCount != null) {
                 Map<String, String> stringStringHashMap = new LinkedHashMap<>();
                 stringStringHashMap.put("name", QualityContent.RYJL_24H_WCL);
-                double num=startCount - InHospitalRecords;
-                if(num<0.0){
-                    num=0.0;
-                }
-                stringStringHashMap.put("notCopiedStr", getResult(num, startCount.doubleValue()));
+                stringStringHashMap.put("notCopiedStr", getResult(startCount - InHospitalRecords, startCount.doubleValue()));
                 stringStringHashMap.put("num", Double.valueOf(startCount).toString());
                 hashMapArrayList.add(stringStringHashMap);
             }
@@ -457,11 +455,7 @@ public class ConsoleFacade {
             if (operationFeeNum != null && operationCount != null) {
                 LinkedHashMap<String, String> stringStringHashMap = new LinkedHashMap<>();
                 stringStringHashMap.put("name", QualityContent.SSJL_24H_WCL);
-                double num=operationFeeNum - operationCount;
-                if(num<0.0){
-                    num=0.0;
-                }
-                stringStringHashMap.put("notCopiedStr", getResult(num, operationFeeNum));
+                stringStringHashMap.put("notCopiedStr", getResult(operationFeeNum - operationCount, operationFeeNum));
                 stringStringHashMap.put("num", operationFeeNum.toString());
                 hashMapArrayList.add(stringStringHashMap);
             }
@@ -471,11 +465,7 @@ public class ConsoleFacade {
             if (OutHospitalRecords != null && startCount != null) {
                 Map<String, String> stringStringHashMap = new LinkedHashMap<>();
                 stringStringHashMap.put("name", QualityContent.CYJL_24H_WCL);
-                double num=startCount - OutHospitalRecords;
-                if(num<0.0){
-                    num=0.0;
-                }
-                stringStringHashMap.put("notCopiedStr", getResult(num, startCount.doubleValue()));
+                stringStringHashMap.put("notCopiedStr", getResult(startCount - OutHospitalRecords, startCount.doubleValue()));
                 stringStringHashMap.put("num", Double.valueOf(startCount).toString());
                 hashMapArrayList.add(stringStringHashMap);
             }
@@ -485,11 +475,7 @@ public class ConsoleFacade {
             if (recordHomePage != null && startCount != null) {
                 Map<String, String> stringStringHashMap = new LinkedHashMap<>();
                 stringStringHashMap.put("name", QualityContent.BASY_24H_WCL);
-                double num=startCount - recordHomePage;
-                if(num<0.0){
-                    num=0.0;
-                }
-                stringStringHashMap.put("notCopiedStr", getResult(num, startCount.doubleValue()));
+                stringStringHashMap.put("notCopiedStr", getResult(startCount - recordHomePage, startCount.doubleValue()));
                 stringStringHashMap.put("num", Double.valueOf(startCount).toString());
                 hashMapArrayList.add(stringStringHashMap);
             }
@@ -499,11 +485,7 @@ public class ConsoleFacade {
             if (CTNum != null && ct != null) {
                 Map<String, String> stringStringHashMap = new LinkedHashMap<>();
                 stringStringHashMap.put("name", QualityContent.CT_JCJL_FHL);
-                double num=CTNum - ct;
-                if(num<0.0){
-                    num=0.0;
-                }
-                stringStringHashMap.put("notCopiedStr", getResult(num, CTNum));
+                stringStringHashMap.put("notCopiedStr", getResult(CTNum - ct, CTNum));
                 stringStringHashMap.put("num", CTNum.toString());
                 hashMapArrayList.add(stringStringHashMap);
             }
@@ -513,11 +495,7 @@ public class ConsoleFacade {
             if (MRNum != null && mr != null) {
                 Map<String, String> stringStringHashMap = new LinkedHashMap<>();
                 stringStringHashMap.put("name", QualityContent.MR_JCJL_FHL);
-                double num=MRNum - mr;
-                if(num<0.0){
-                    num=0.0;
-                }
-                stringStringHashMap.put("notCopiedStr", getResult(num, MRNum));
+                stringStringHashMap.put("notCopiedStr", getResult(MRNum - mr, MRNum));
                 stringStringHashMap.put("num", MRNum.toString());
                 hashMapArrayList.add(stringStringHashMap);
             }
@@ -527,11 +505,7 @@ public class ConsoleFacade {
             if (operationPathologyFeeNum != null && operationPathologyFee != null) {
                 Map<String, String> stringStringHashMap = new LinkedHashMap<>();
                 stringStringHashMap.put("name", QualityContent.BL_JCJL_FHL);
-                double num=operationPathologyFeeNum - operationPathologyFee;
-                if(num<0.0){
-                    num=0.0;
-                }
-                stringStringHashMap.put("notCopiedStr", getResult(num, operationPathologyFeeNum));
+                stringStringHashMap.put("notCopiedStr", getResult(operationPathologyFeeNum - operationPathologyFee, operationPathologyFeeNum));
                 stringStringHashMap.put("num", operationPathologyFeeNum.toString());
                 hashMapArrayList.add(stringStringHashMap);
             }
@@ -541,11 +515,7 @@ public class ConsoleFacade {
             if (antibiosisFeeNum != null && antibiosis != null) {
                 Map<String, String> stringStringHashMap = new LinkedHashMap<>();
                 stringStringHashMap.put("name", QualityContent.KJYW_SY_FHL);
-                double num=antibiosisFeeNum - antibiosis;
-                if(num<0.0){
-                    num=0.0;
-                }
-                stringStringHashMap.put("notCopiedStr", getResult(num, antibiosisFeeNum));
+                stringStringHashMap.put("notCopiedStr", getResult(antibiosisFeeNum - antibiosis, antibiosisFeeNum));
                 stringStringHashMap.put("num", antibiosisFeeNum.toString());
                 hashMapArrayList.add(stringStringHashMap);
             }
@@ -555,11 +525,7 @@ public class ConsoleFacade {
             if (chemotherapyMalignantTumorsNum != null && chemotherapyMalignantTumors != null) {
                 Map<String, String> stringStringHashMap = new LinkedHashMap<>();
                 stringStringHashMap.put("name", QualityContent.EXZL_HXZL_FHL);
-                double num=chemotherapyMalignantTumorsNum - chemotherapyMalignantTumors;
-                if(num<0.0){
-                    num=0.0;
-                }
-                stringStringHashMap.put("notCopiedStr", getResult(num, chemotherapyMalignantTumorsNum));
+                stringStringHashMap.put("notCopiedStr", getResult(chemotherapyMalignantTumorsNum - chemotherapyMalignantTumors, chemotherapyMalignantTumorsNum));
                 stringStringHashMap.put("num", chemotherapyMalignantTumorsNum.toString());
                 hashMapArrayList.add(stringStringHashMap);
             }
@@ -615,13 +581,17 @@ public class ConsoleFacade {
         qw.ge("start_date",filterVO.getStartDate()+" 00:00:00");
         qw.le("end_date", handleTime(filterVO.getEndDate()));
         medIndexResultFacade.remove(qw);
+        QueryWrapper<MedIndexRelevance> qwa = new QueryWrapper<>();
+        qwa.eq("hospital_id",filterVO.getHospitalId());
+        qwa.ge("start_date",filterVO.getStartDate()+" 00:00:00");
+        qwa.le("end_date", handleTime(filterVO.getEndDate()));
+        medIndexRelevanceFacade.remove(qwa);
         for (String startTime : timeList) {
             filterVO.setStartDate(startTime);
             filterVO.setEndDate( handleTime(startTime));
             getMedicaIndicator(filterVO);
         }
         return true;
-
     }
 
 
@@ -633,31 +603,87 @@ public class ConsoleFacade {
      */
     public void getMedicaIndicator(FilterVO filterVO){
         MedIndexResult medIndexResult = new MedIndexResult();
-        Map<String, Long> selectOperationNumMap = behospitalInfoFacade.selectOperationNum(filterVO);
-        //出院人数
-        Long startCount = selectOperationNumMap.get(QualityContent.DISCHARGED_PATIENTS);
-            Long operationFeeNum = 0L;
-                filterVO.setFlagStr("2");
-                 List<MedManageParamsDTO> doctorAdviceMedManageParams = behospitalInfoFacade.getMedManageParams(filterVO);
-                Map<String, Long> adviceNum = getAdviceNum(filterVO,doctorAdviceMedManageParams);
-                //手术人数
-                operationFeeNum = selectOperationNumMap.get("operationFee");
-                Long operation = adviceNum.get("operation");
-                operationFeeNum = operationFeeNum + operation;
+       List<Map<String, String>> selectOperationNumMap = behospitalInfoFacade.selectOperationNum(filterVO);
+        if(ListUtil.isNotEmpty(selectOperationNumMap)) {
+        CopyOnWriteArrayList<String> outHospitalCode = new CopyOnWriteArrayList<>();
+        CopyOnWriteArrayList<String> operationCode = new CopyOnWriteArrayList<>();
+        CopyOnWriteArrayList<String> operationPathologyCode = new CopyOnWriteArrayList<>();
+        CopyOnWriteArrayList<String> antibiosisCode = new CopyOnWriteArrayList<>();
+        Long operationFeeNum = 0L;
+            filterVO.setFlagStr("2");
+            List<MedManageParamsDTO> doctorAdviceMedManageParams = behospitalInfoFacade.getMedManageParams(filterVO);
+            Map<String, List<String>> adviceNum = getAdviceNum(filterVO, doctorAdviceMedManageParams);
+                for (Map<String, String> stringStringMap : selectOperationNumMap) {
+                    String behospitalCode = stringStringMap.get("behospitalCode");
+                    //出院code
+                         outHospitalCode.add(behospitalCode);
+                    if (Double.parseDouble(stringStringMap.get("operationFee"))>0){
+                        //手术code
+                        operationCode.add(behospitalCode);
+                    }
+                    if (Double.parseDouble(stringStringMap.get("operationFee"))>0 && Double.parseDouble(stringStringMap.get("pathologyFee"))>QualityContent.pathologyFee){
+                        //病理code
+                        operationPathologyCode.add(behospitalCode);
+                    }
+                    if (Double.parseDouble(stringStringMap.get("antibiosisFee"))>0){
+                        //抗菌code
+                        antibiosisCode.add(behospitalCode);
+                    }
+                }
+            Long startCount = Long.valueOf(outHospitalCode.size());
+            //手术人
+                List<String> operationList = adviceNum.get("operation");
+                if(ListUtil.isNotEmpty(operationList)){
+                    for (String s : operationList) {
+                        operationCode.add(s);
+                    }
+                }
+                if(ListUtil.isNotEmpty(operationCode)) {
+                    operationFeeNum = Long.valueOf(operationCode.size());
+                }else {
+                    operationFeeNum=0L;
+                }
                 //CT人数
-                Long CTNum = adviceNum.get("CT");
+                List<String> ctList = adviceNum.get("CT");
+                Long CTNum=0L;
+                if(ListUtil.isNotEmpty(ctList)) {
+                    CTNum = Long.valueOf(ctList.size());
+                }
                 //MR人数
-                Long MRNum = adviceNum.get("MR");
+                List<String> mrList = adviceNum.get("MR");
+                Long MRNum=0L;
+                if(ListUtil.isNotEmpty(mrList)) {
+                    MRNum = Long.valueOf(mrList.size());
+                }
                 //手术病理人数
-                Long operationPathologyFeeNum = selectOperationNumMap.get("operationPathologyFee");
-                Long operationPathology = adviceNum.get("operationPathology");
-                operationPathologyFeeNum = operationPathologyFeeNum + operationPathology;
+                List<String> operationPathologyList = adviceNum.get("operationPathology");
+                if(ListUtil.isNotEmpty(operationPathologyList)){
+                    for (String s : operationPathologyList) {
+                        operationPathologyCode.add(s);
+                    }
+                }
+                 Long operationPathologyFeeNum=0L;
+                if(ListUtil.isNotEmpty(operationPathologyCode)) {
+                    operationPathologyFeeNum = Long.valueOf(operationPathologyCode.size());
+                }
                 //抗菌药物人数
-                Long antibiosisFeeNum = selectOperationNumMap.get("antibiosisFee");
-                Long antibiosisNum = adviceNum.get("antibiosis");
-                antibiosisFeeNum = antibiosisFeeNum + antibiosisNum;
+
+                List<String> antibiosisList = adviceNum.get("antibiosis");
+                if(ListUtil.isNotEmpty(antibiosisList)) {
+                    for (String s : antibiosisList) {
+                        antibiosisCode.add(s);
+                    }
+                }
+                Long antibiosisFeeNum =0L;
+                if(ListUtil.isNotEmpty(antibiosisCode)) {
+                    antibiosisFeeNum = Long.valueOf(antibiosisCode.size());
+                }
                 //恶性肿瘤化学治疗人数
-                Long chemotherapyMalignantTumorsNum = adviceNum.get("chemotherapyMalignantTumors");
+                List<String> chemotherapyMalignantTumorsList = adviceNum.get("chemotherapyMalignantTumors");
+                Long chemotherapyMalignantTumorsNum =0L;
+                if(ListUtil.isNotEmpty(chemotherapyMalignantTumorsList)) {
+                    chemotherapyMalignantTumorsNum=   Long.valueOf(chemotherapyMalignantTumorsList.size());
+                }
                 //出院人数
                     if(startCount!=null){
                         medIndexResult.setAdmissionResult(Double.valueOf(startCount));
@@ -693,27 +719,101 @@ public class ConsoleFacade {
         MedIndexFilterVO timeVo = new MedIndexFilterVO();
         BeanUtils.copyProperties(filterVO,timeVo);
         timeTrans(timeVo);
-        Map<String, Object> baseIndex = behospitalInfoFacade.getBaseIndex(timeVo);
+            List<String> rescueCode = new CopyOnWriteArrayList<>();
+            List<String> bloodCode = new CopyOnWriteArrayList<>();
         //指标二十七
 
         //指标十七 医师查房记录
 
         //指标十八 抢救记录
-        rescueMethods(doctorAdviceMedManageParams,medIndexResult);
+        rescueMethods(doctorAdviceMedManageParams,medIndexResult,rescueCode);
         //指标十九 出院患者病历2日归档
-        getfileSecAmounts(filterVO,baseIndex,medIndexResult);
+        getfileSecAmounts(filterVO,medIndexResult);
         //指标十四 手术记录
         medIndexResult.setOperationCompleteResult(Double.parseDouble(operationFeeNum+""));
         //指标十六  临床用血相关记录符合率
         filterVO.setFlagStr("1");
         List<MedManageParamsDTO> medManageParams = behospitalInfoFacade.getMedManageParams(filterVO);
-        bloodMethods(doctorAdviceMedManageParams, medManageParams,medIndexResult);
+        bloodMethods(doctorAdviceMedManageParams, medManageParams,medIndexResult,bloodCode);
         medIndexResult.setHospitalId(filterVO.getHospitalId());
         medIndexResult.setStartDate(filterVO.getStartDate());
         medIndexResult.setEndDate(filterVO.getEndDate());
         medIndexResult.setGmtCreate(new Date());
         medIndexResultFacade.save(medIndexResult);
-
+        Integer id = medIndexResult.getId();
+        MedIndexRelevance medIndexRelevance = new MedIndexRelevance();
+        medIndexRelevance.setIndexResultId(id);
+        medIndexRelevance.setHospitalId(filterVO.getHospitalId());
+        medIndexRelevance.setStartDate(filterVO.getStartDate());
+        medIndexRelevance.setEndDate(filterVO.getEndDate());
+        medIndexRelevance.setGmtCreate(new Date());
+            if(ListUtil.isNotEmpty(outHospitalCode)) {
+                medIndexRelevance.setRelevanceType(4);
+                for (String Code : outHospitalCode) {
+                    medIndexRelevance.setBehospitalCode(Code);
+                    medIndexRelevanceFacade.save(medIndexRelevance);
+                }
+                medIndexRelevance.setRelevanceType(6);
+                for (String Code : outHospitalCode) {
+                    medIndexRelevance.setBehospitalCode(Code);
+                    medIndexRelevanceFacade.save(medIndexRelevance);
+                }
+                medIndexRelevance.setRelevanceType(7);
+                for (String Code : outHospitalCode) {
+                    medIndexRelevance.setBehospitalCode(Code);
+                    medIndexRelevanceFacade.save(medIndexRelevance);
+                }
+            }
+            if(ListUtil.isNotEmpty(operationCode)) {
+                medIndexRelevance.setRelevanceType(5);
+                for (String Code : operationCode) {
+                    medIndexRelevance.setBehospitalCode(Code);
+                    medIndexRelevanceFacade.save(medIndexRelevance);
+                }
+            }
+        if(ListUtil.isNotEmpty(ctList)) {
+            medIndexRelevance.setRelevanceType(8);
+            for (String CTCode : ctList) {
+                medIndexRelevance.setBehospitalCode(CTCode);
+                medIndexRelevanceFacade.save(medIndexRelevance);
+            }
+        }
+        if(ListUtil.isNotEmpty(mrList)) {
+            medIndexRelevance.setRelevanceType(9);
+            for (String MrCode : mrList) {
+                medIndexRelevance.setBehospitalCode(MrCode);
+                medIndexRelevanceFacade.save(medIndexRelevance);
+            }
+        }
+            if(ListUtil.isNotEmpty(operationPathologyCode)) {
+                medIndexRelevance.setRelevanceType(10);
+                for (String Code : operationPathologyCode) {
+                    medIndexRelevance.setBehospitalCode(Code);
+                    medIndexRelevanceFacade.save(medIndexRelevance);
+                }
+            }
+            if(ListUtil.isNotEmpty(operationCode)) {
+                medIndexRelevance.setRelevanceType(15);
+                for (String Code : operationCode) {
+                    medIndexRelevance.setBehospitalCode(Code);
+                    medIndexRelevanceFacade.save(medIndexRelevance);
+                }
+            }
+            if(ListUtil.isNotEmpty(bloodCode)) {
+                medIndexRelevance.setRelevanceType(17);
+                for (String Code : bloodCode) {
+                    medIndexRelevance.setBehospitalCode(Code);
+                    medIndexRelevanceFacade.save(medIndexRelevance);
+                }
+            }
+            if(ListUtil.isNotEmpty(rescueCode)) {
+                medIndexRelevance.setRelevanceType(19);
+                for (String Code : rescueCode) {
+                    medIndexRelevance.setBehospitalCode(Code);
+                    medIndexRelevanceFacade.save(medIndexRelevance);
+                }
+            }
+        }
     }
     /**
      * 两数据相除得到百分比
@@ -722,9 +822,6 @@ public class ConsoleFacade {
      * @return
      */
     public String getResult(double i , Double y){
-//        BigDecimal b = new BigDecimal((i * 100.00) / y);
-//        //保留2位小数
-//        double result = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
         DecimalFormat df = new DecimalFormat();
         df.setMaximumFractionDigits(2);
         df.setMinimumFractionDigits(2);
@@ -732,7 +829,6 @@ public class ConsoleFacade {
             return "0.00%";
         }
         String k= df.format((i * 100.00) / y) + "%";
-
         return k;
     }
     /**
@@ -798,10 +894,10 @@ public class ConsoleFacade {
     /**
      * 遍历医嘱信息存入相关数据
      */
-    public Map<String,Long> getAdviceNum(FilterVO filterVO,List<MedManageParamsDTO> doctorAdviceMedManageParamsList) {
+    public Map<String,List<String>> getAdviceNum(FilterVO filterVO, List<MedManageParamsDTO> doctorAdviceMedManageParamsList) {
         CopyOnWriteArrayList<MedManageParamsDTO> doctorAdviceMedManageParams = new CopyOnWriteArrayList<>(doctorAdviceMedManageParamsList);
         String indexName = filterVO.getIndexName();
-        Map map = new HashMap<String,Integer>();
+        Map mapCode = new HashMap<String,List<String>>();
         List<String> CTBehospitalCode = new CopyOnWriteArrayList<>();
         List<String> operationPathologyBehospitalCode = new CopyOnWriteArrayList<>();
         List<String> MRBehospitalCode = new CopyOnWriteArrayList<>();
@@ -933,44 +1029,53 @@ public class ConsoleFacade {
             myPool.shutdown();
 
             if(ListUtil.isEmpty(CTBehospitalCode)){
-                map.put("CT",Long.valueOf(0));
+         //       map.put("CT",Long.valueOf(0));
+                mapCode.put("CT",null);
             }else {
-                map.put("CT",Long.valueOf(CTBehospitalCode.size()));
+        //        map.put("CT",Long.valueOf(CTBehospitalCode.size()));
+                mapCode.put("CT",CTBehospitalCode);
             }
             if(ListUtil.isEmpty(MRBehospitalCode)){
-                map.put("MR",Long.valueOf(0));
+         //       map.put("MR",Long.valueOf(0));
+                mapCode.put("MR",null);
             }else {
-                map.put("MR",Long.valueOf(MRBehospitalCode.size()));
+       //         map.put("MR",Long.valueOf(MRBehospitalCode.size()));
+                mapCode.put("MR",MRBehospitalCode);
             }
             if(ListUtil.isEmpty(operationBehospitalCode)){
-                map.put("operation",Long.valueOf(0));
+       //         map.put("operation",Long.valueOf(0));
+                mapCode.put("operation",null);
             }else {
-                map.put("operation",Long.valueOf(operationBehospitalCode.size()));
+       //         map.put("operation",Long.valueOf(operationBehospitalCode.size()));
+                mapCode.put("operation",operationBehospitalCode);
             }
-            if(ListUtil.isEmpty(operationBehospitalCode)||ListUtil.isEmpty(pathologyBehospitalCode)){
-                map.put("operationPathology",Long.valueOf(0));
+            if(ListUtil.isEmpty(operationBehospitalCode)||ListUtil.isEmpty(operationPathologyBehospitalCode)){
+        //        map.put("operationPathology",Long.valueOf(0));
+                mapCode.put("operationPathology",null);
             }else {
                 for (String operation : operationBehospitalCode) {
-                    for (String pathology : pathologyBehospitalCode) {
-                        if(pathology.equals(operation)){
-                            operationPathologyBehospitalCode.add(operation);
-                        }
+                    if(pathologyBehospitalCode.contains(operation)){
+                        operationPathologyBehospitalCode.add(operation);
                     }
                 }
-                map.put("operationPathology",Long.valueOf(operationPathologyBehospitalCode.size()));
+           //     map.put("operationPathology",Long.valueOf(operationPathologyBehospitalCode.size()));
+                mapCode.put("operationPathology",operationBehospitalCode);
             }
             if(ListUtil.isEmpty(antibiosisBehospitalCode)){
-                map.put("antibiosis",Long.valueOf(0));
+        //        map.put("antibiosis",Long.valueOf(0));
+                mapCode.put("antibiosis",null);
             }else {
-                map.put("antibiosis",Long.valueOf(antibiosisBehospitalCode.size()));
+         //       map.put("antibiosis",Long.valueOf(antibiosisBehospitalCode.size()));
+                mapCode.put("antibiosis",antibiosisBehospitalCode);
             }
             if(ListUtil.isEmpty(chemotherapyMalignantTumorsBehospitalCode)){
-                map.put("chemotherapyMalignantTumors",Long.valueOf(0));
+          //      map.put("chemotherapyMalignantTumors",Long.valueOf(0));
+                mapCode.put("chemotherapyMalignantTumors",null);
             }else {
-                map.put("chemotherapyMalignantTumors",Long.valueOf(chemotherapyMalignantTumorsBehospitalCode.size()));
+       //         map.put("chemotherapyMalignantTumors",Long.valueOf(chemotherapyMalignantTumorsBehospitalCode.size()));
+                mapCode.put("chemotherapyMalignantTumors",antibiosisBehospitalCode);
             }
-
-            return map;
+            return mapCode;
         }
     }
     /**
@@ -2821,6 +2926,9 @@ public class ConsoleFacade {
         if(StringUtils.isNotEmpty(String.valueOf(count)) &&  count != 0d){
             double rescueDo = currencyCal(count, triggeringRulesMap.get("rescueNum"));
             num = String.valueOf(rescueDo);
+            if(rescueDo<0d){
+                num = null;
+            }
         };
         LinkedHashMap<String, String> firMap = new LinkedHashMap<>();
         firMap.put("name","患者抢救记录及时完成率");
@@ -2835,6 +2943,9 @@ public class ConsoleFacade {
         if( triggeringRulesMap.containsKey("WardRoundNum") && baseIndex.containsKey("forWorkNum") && !baseIndex.get("forWorkNum").toString().equals("0")){
             double wardRoundDo = currencyCal(baseIndex.get("forWorkNum"), triggeringRulesMap.get("WardRoundNum"));
             num = String.valueOf(wardRoundDo);
+            if(wardRoundDo<0d){
+                num = null;
+            }
         };
         LinkedHashMap<String, String> firMap = new LinkedHashMap<>();
         firMap.put("name","医师查房记录完成率");
@@ -2850,6 +2961,9 @@ public class ConsoleFacade {
         if( triggeringRulesMap.containsKey("operationRecordNum") && StringUtils.isNotEmpty(operationFeeNum) && ! operationFeeNum.equals("0")){
             double operationRecordDo = currencyCal(operationFeeNum, triggeringRulesMap.get("operationRecordNum"));
             num = String.valueOf(operationRecordDo);
+            if(operationRecordDo<0d){
+                num = null;
+            }
         };
         LinkedHashMap<String, String> firMap = new LinkedHashMap<>();
         firMap.put("name","手术相关记录完成率");
@@ -2865,8 +2979,11 @@ public class ConsoleFacade {
         String num = null;
         if(StringUtils.isNotEmpty(String.valueOf(count)) &&  count != 0d){
             //指标十七
-            double rescueDo = currencyCal(count, triggeringRulesMap.get("bloodNum"));
-            num = String.valueOf(rescueDo);
+            double bloodDo = currencyCal(count, triggeringRulesMap.get("bloodNum"));
+            num = String.valueOf(bloodDo);
+            if(bloodDo<0d){
+                num = null;
+            }
         }
         LinkedHashMap<String, String> firMap = new LinkedHashMap<>();
         firMap.put("name","临床用血相关记录符合率");
@@ -3002,7 +3119,7 @@ public class ConsoleFacade {
      * ==============================后台维护===============================
      */
     //指标十八 抢救记录
-    private  void rescueMethods(List<MedManageParamsDTO> medManageParams,MedIndexResult medIndexResult){
+    private  void rescueMethods(List<MedManageParamsDTO> medManageParams,MedIndexResult medIndexResult, List<String> rescueCode){
         List<MedManageParamsDTO> manageList= new ArrayList<>();
         List<String> rescueDrugList = QualityContent.RESCUEDRUGLIST;
         for (int i = 0; i < medManageParams.size(); i++) {
@@ -3012,6 +3129,7 @@ public class ConsoleFacade {
             for (String str : rescueDrugList) {
                 if(StringUtils.isNotEmpty(daItemName) && daItemName.contains(str) && StringUtils.isNotEmpty(doctorAdviceType) && doctorAdviceType.equals(QualityContent.STAT_ORDER) && (StringUtils.isEmpty(da_status) || (StringUtils.isNotEmpty(da_status) && ! da_status.equals(QualityContent.CANCELLATION_ORDER)))){
                     manageList.add(medManageParams.get(i));
+                    rescueCode.add(medManageParams.get(i).getBehospitalCode());
                 }
             }
         }
@@ -3024,7 +3142,7 @@ public class ConsoleFacade {
     }
 
     //指标十六  临床用血相关记录符合率
-    private void bloodMethods(List<MedManageParamsDTO> doctorAdviceList, List<MedManageParamsDTO> medManageParams,MedIndexResult medIndexResult){
+    private void bloodMethods(List<MedManageParamsDTO> doctorAdviceList, List<MedManageParamsDTO> medManageParams,MedIndexResult medIndexResult, List<String> bloodCode){
         Set<String> manageList= new CopyOnWriteArraySet<>();
         List<String> blood_list = QualityContent.BLOODLIST;
         //lis项目存在用血住院病历号
@@ -3042,7 +3160,7 @@ public class ConsoleFacade {
                         (StringUtils.isEmpty(obj.getDaStatus()) || (StringUtils.isNotEmpty(obj.getDaStatus()) && ! obj.getDaStatus()
                         .equals(QualityContent.CANCELLATION_ORDER))))
                 .distinct()
-                .map(obj -> manageList.add(obj.getBehospitalCode()))
+                .map(obj -> {manageList.add(obj.getBehospitalCode());return bloodCode.add(obj.getBehospitalCode());})
                 .collect(Collectors.toList());
         long xx3= System.currentTimeMillis();
         System.out.println("advice体现lis项目存在用血的住院病历号 = " + (xx3-xx2));
@@ -3057,7 +3175,7 @@ public class ConsoleFacade {
 
 
     //指标十九 出院患者病历2日归档
-    private void getfileSecAmounts(FilterVO filterVO,Map<String, Object> baseIndex,MedIndexResult medIndexResult){
+    private void getfileSecAmounts(FilterVO filterVO,MedIndexResult medIndexResult){
         QueryWrapper<BehospitalInfo> query = new QueryWrapper<>();
         DecimalFormat df = new DecimalFormat("#0.00");
         query.eq("hospital_id", filterVO.getHospitalId())

+ 14 - 0
src/main/java/com/diagbot/facade/MedIndexRelevanceFacade.java

@@ -0,0 +1,14 @@
+package com.diagbot.facade;
+import com.diagbot.service.impl.MedIndexRelevanceServiceImpl;
+
+import org.springframework.stereotype.Component;
+
+
+/**
+ * @Description:
+ * @author: zhoutg
+ * @time: 2020/4/12 11:39
+ */
+@Component
+public class MedIndexRelevanceFacade extends MedIndexRelevanceServiceImpl {
+}

+ 1 - 1
src/main/java/com/diagbot/mapper/BehospitalInfoMapper.java

@@ -707,7 +707,7 @@ public interface BehospitalInfoMapper extends BaseMapper<BehospitalInfo> {
      * @param filterVO
      * @return
      */
-    public Map<String,Long> selectOperationNum(@Param("filterVO") FilterVO filterVO);
+    public List<Map<String, String>> selectOperationNum(@Param("filterVO") FilterVO filterVO);
 
     /**
      * 病理CT/MR触发多规则人数

+ 16 - 0
src/main/java/com/diagbot/mapper/MedIndexRelevanceMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper;
+
+import com.diagbot.entity.MedIndexRelevance;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2021-04-30
+ */
+public interface MedIndexRelevanceMapper extends BaseMapper<MedIndexRelevance> {
+
+}

+ 1 - 1
src/main/java/com/diagbot/service/BehospitalInfoService.java

@@ -662,7 +662,7 @@ public interface BehospitalInfoService extends IService<BehospitalInfo> {
      * @param filterVO
      * @return
      */
-    public Map<String,Long> selectOperationNum(@Param("filterVO")FilterVO filterVO);
+    public List<Map<String, String>> selectOperationNum(@Param("filterVO")FilterVO filterVO);
 
     /**
      * 触发规则人数

+ 16 - 0
src/main/java/com/diagbot/service/MedIndexRelevanceService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service;
+
+import com.diagbot.entity.MedIndexRelevance;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2021-04-30
+ */
+public interface MedIndexRelevanceService extends IService<MedIndexRelevance> {
+
+}

+ 1 - 1
src/main/java/com/diagbot/service/impl/BehospitalInfoServiceImpl.java

@@ -1101,7 +1101,7 @@ public class BehospitalInfoServiceImpl extends ServiceImpl<BehospitalInfoMapper,
      * @param  filterVO
      * @return
      */
-    public Map<String,Long> selectOperationNum(@Param("filterVO")FilterVO filterVO){
+    public List<Map<String, String>> selectOperationNum(@Param("filterVO")FilterVO filterVO){
         return  baseMapper.selectOperationNum(filterVO);
 
     }

+ 20 - 0
src/main/java/com/diagbot/service/impl/MedIndexRelevanceServiceImpl.java

@@ -0,0 +1,20 @@
+package com.diagbot.service.impl;
+
+import com.diagbot.entity.MedIndexRelevance;
+import com.diagbot.mapper.MedIndexRelevanceMapper;
+import com.diagbot.service.MedIndexRelevanceService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2021-04-30
+ */
+@Service
+public class MedIndexRelevanceServiceImpl extends ServiceImpl<MedIndexRelevanceMapper, MedIndexRelevance> implements MedIndexRelevanceService {
+
+}

+ 1 - 1
src/main/java/com/diagbot/util/ExcelUtils.java

@@ -115,7 +115,7 @@ public class ExcelUtils {
 
     private static void userExport2(List<?> list, Class<?> pojoClass, String fileName, HttpServletResponse response,
                                     ExportParams exportParams, float height, Boolean havTitle) {
-        if(exportParams.getTitle().equals("病历质控报表")){
+        if(StringUtils.isNotEmpty(exportParams.getTitle()) && exportParams.getTitle().equals("病历质控报表")){
             exportParams.setTitleHeight(Short.valueOf("20"));
         };
         Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, list);

+ 27 - 62
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -17582,9 +17582,7 @@
         AND a.is_placefile = #{filterVO.isPlacefile}
         <if test="filterVO.startDate != null and  filterVO.endDate != null">
             <![CDATA[ and a.leave_hospital_date >= #{filterVO.startDate}]]>
-            <![CDATA[ AND a
-
-            .leave_hospital_date <= #{filterVO.endDate}]]>
+            <![CDATA[ AND a.leave_hospital_date <= #{filterVO.endDate}]]>
         </if>
         <![CDATA[ and  a.qc_type_id <>'0' ]]>
         AND a.behospital_code = c.behospital_code
@@ -17606,54 +17604,10 @@
     <!--  时间段出院,住院, 手术费,抗菌药物,手术和病理费等含有人数 -->
     <select id="selectOperationNum" parameterType="com.diagbot.vo.FilterVO" resultType="java.util.Map">
         select
-        <if test="filterVO.startDate != null and  filterVO.endDate != null">
-        count(
-        CASE
-        WHEN   <![CDATA[  d.leave_hospital_date >= #{filterVO.startDate}]]>
-            <![CDATA[ AND d.leave_hospital_date <= #{filterVO.endDate}]]> THEN
-        1
-        ELSE
-        NULL
-        END
-        )  AS '出院人数',
-        count(
-        CASE
-        WHEN   <![CDATA[  d.leave_hospital_date >= #{filterVO.startDate}]]>
-            <![CDATA[ AND d.leave_hospital_date <= #{filterVO.endDate}]]> THEN
-        1
-        ELSE
-        NULL
-        END
-        )  AS '入院人数',
-        </if>
-        count(
-        CASE
-        WHEN   b.operation_fee > 0
-        THEN
-        1
-        ELSE
-        NULL
-        END
-        ) AS 'operationFee',
-        count(
-        CASE
-        WHEN   b.antibiosis_fee > 0
-        THEN
-        1
-        ELSE
-        NULL
-        END
-        ) AS 'antibiosisFee',
-        count(
-        CASE
-        WHEN   b.operation_fee > 0
-        AND   b.pathology_fee > 0
-        THEN
-        1
-        ELSE
-        NULL
-        END
-        ) AS 'operationPathologyFee'
+        d.behospital_code behospitalCode,
+        b.operation_fee operationFee,
+        b.pathology_fee pathologyFee,
+        b.antibiosis_fee antibiosisFee
         FROM
         (
         SELECT
@@ -17687,7 +17641,7 @@
         count(
         DISTINCT
         CASE
-        WHEN q.type=5 THEN
+        WHEN a.type=5 THEN
         a.behospital_code
         ELSE
         NULL
@@ -17696,7 +17650,7 @@
         count(
         DISTINCT
         CASE
-        WHEN q.type = 4 THEN
+        WHEN a.type = 4 THEN
         a.behospital_code
         ELSE
         NULL
@@ -17705,7 +17659,7 @@
         count(
         DISTINCT
         CASE
-        WHEN q.type = 6 THEN
+        WHEN a.type = 6 THEN
         a.behospital_code
         ELSE
         NULL
@@ -17714,7 +17668,7 @@
         count(
         DISTINCT
         CASE
-        WHEN q.type = 7 THEN
+        WHEN a.type = 7 THEN
         a.behospital_code
         ELSE
         NULL
@@ -17723,7 +17677,7 @@
         count(
         DISTINCT
         CASE
-        WHEN q.type=8 THEN
+        WHEN a.type=8 THEN
         a.behospital_code
         ELSE
         NULL
@@ -17732,7 +17686,7 @@
         count(
         DISTINCT
         CASE
-        WHEN q.type = 9 THEN
+        WHEN a.type = 9 THEN
         a.behospital_code
         ELSE
         NULL
@@ -17741,7 +17695,7 @@
         count(
         DISTINCT
         CASE
-        WHEN q.type = 10 THEN
+        WHEN a.type = 10 THEN
         a.behospital_code
         ELSE
         NULL
@@ -17750,7 +17704,7 @@
         count(
         DISTINCT
         CASE
-        WHEN q.type = 15 THEN
+        WHEN a.type = 15 THEN
         a.behospital_code
         ELSE
         NULL
@@ -17759,7 +17713,7 @@
         count(
         DISTINCT
         CASE
-        WHEN q.type = 17 THEN
+        WHEN a.type = 17 THEN
         a.behospital_code
         ELSE
         NULL
@@ -17768,7 +17722,7 @@
         count(
         DISTINCT
         CASE
-        WHEN q.type = 18 THEN
+        WHEN a.type = 18 THEN
         a.behospital_code
         ELSE
         NULL
@@ -17777,7 +17731,7 @@
         count(
         DISTINCT
         CASE
-        WHEN q.type = 19 THEN
+        WHEN a.type = 19 THEN
         a.behospital_code
         ELSE
         NULL
@@ -17787,6 +17741,12 @@
         (
         SELECT
         a.behospital_code,
+        a.hospital_id,
+        q.type
+        FROM
+        (
+        SELECT
+        a.behospital_code,
         a.cases_entry_id,
         a.hospital_id
         FROM
@@ -17824,6 +17784,11 @@
         ) a
         JOIN qc_cases_relevance_entry q ON a.cases_entry_id = q.relevance_id
         AND a.hospital_id = q.hospital_id
+        ) a
+        JOIN med_index_relevance r ON r.behospital_code = a.behospital_code
+        AND r.relevance_type = a.type
+        AND r.is_deleted = 'N'
+        AND a.hospital_id = r.hospital_id
     </select>
 
 <!--    跟病案首页关联的出院病历-->

+ 21 - 0
src/main/resources/mapper/MedIndexRelevanceMapper.xml

@@ -0,0 +1,21 @@
+<?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.diagbot.mapper.MedIndexRelevanceMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.MedIndexRelevance">
+        <id column="id" property="id" />
+        <result column="index_result_id" property="indexResultId" />
+        <result column="relevance_type" property="relevanceType" />
+        <result column="hospital_id" property="hospitalId" />
+        <result column="behospital_code" property="behospitalCode" />
+        <result column="start_date" property="startDate" />
+        <result column="end_date" property="endDate" />
+        <result column="is_deleted" property="isDeleted" />
+        <result column="gmt_create" property="gmtCreate" />
+        <result column="gmt_modified" property="gmtModified" />
+        <result column="creator" property="creator" />
+        <result column="modifier" property="modifier" />
+    </resultMap>
+
+</mapper>