chengyao 4 лет назад
Родитель
Сommit
443b96ffc8

+ 5 - 7
src/main/java/com/diagbot/enums/QualityContent.java

@@ -16,17 +16,17 @@ public class QualityContent {
     /**
      * 是否需要用到医嘱的指标名称
      */
-    public static List<String> NO_MEDICAL_ADVICE = Arrays.asList("全部",
+    public static List<String> NO_MEDICAL_ADVICE = Arrays.asList("",
             "入院记录24小时内完成率","出院记录24小时内完成率","病案首页24小时内完成率"
     );
-    public static List<String> NEED_MEDICAL_ADVICE = Arrays.asList("全部",
-            "手术记录24小时内完成率","CT检查记录符合率","MRI检查记录符合率","病理检查记录符合率"
+    public static List<String> NEED_MEDICAL_ADVICE = Arrays.asList("",
+            "手术记录24小时内完成率","手术相关记录完成率","患者抢救记录及时完成率","临床用血相关记录符合率","CT检查记录符合率","MRI检查记录符合率","病理检查记录符合率"
     );
     /**
      * 所有指标名称
      */
 
-    public static final String QB = "全部";
+    public static final String QB = "";
     public static final String ZYBA_CYHZ = "住院病案管理人员月均负担出院患者病历数";
     public static final String BABM_CYHZ = "病案编码人员月均负担出院患者病历数";
     public static final String MZBA_CYHZ = "门诊病案管理人员月均负担门诊患者病历数";
@@ -140,9 +140,7 @@ public class QualityContent {
      *   临床用血
      */
     public static List<String> BLOODLIST = Arrays.asList(
-            "交叉配血","血交叉");
-
-
+            "交叉配血","血交叉","血常规");
 }
 
 

+ 144 - 100
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -38,6 +38,7 @@ import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CopyOnWriteArraySet;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ForkJoinPool;
 import java.util.stream.Collectors;
@@ -396,6 +397,7 @@ public class ConsoleFacade {
         filterFacade.filterVOSet(filterVO);
         String indexName = filterVO.getIndexName();
         List<Map<String, String>> hashMapArrayList = new ArrayList<>();
+        long zz = System.currentTimeMillis();
         Map<String, Long> selectOperationNumMap = behospitalInfoFacade.selectOperationNum(filterVO);
         //出院人数
         Long startCount = selectOperationNumMap.get(QualityContent.DISCHARGED_PATIENTS);
@@ -413,7 +415,7 @@ public class ConsoleFacade {
         Long ct = triggeringRulesMap.get("CT");
         //MR
         Long mr = triggeringRulesMap.get("MR");
-        if(StringUtil.isNotEmpty(indexName)) {
+        if(indexName!=null) {
             if(QualityContent.NO_MEDICAL_ADVICE.contains(indexName)){
                 //入院记录24小时完成率
                 //入院记录完成人数为
@@ -450,9 +452,11 @@ public class ConsoleFacade {
                     }
                 }
             }
+            Long operationFeeNum = 0L;
+            List<MedManageParamsDTO> doctorAdviceMedManageParams  = new ArrayList<>();
             if (QualityContent.NEED_MEDICAL_ADVICE.contains(indexName)) {
                 filterVO.setFlagStr("2");
-                List<MedManageParamsDTO> doctorAdviceMedManageParams = behospitalInfoFacade.getMedManageParams(filterVO);
+                 doctorAdviceMedManageParams = behospitalInfoFacade.getMedManageParams(filterVO);
                 Map<String, Long> adviceNum = null;
                 try {
                     adviceNum = getAdviceNum(filterVO,doctorAdviceMedManageParams);
@@ -462,7 +466,7 @@ public class ConsoleFacade {
                     e.printStackTrace();
                 }
                 //手术人数
-                Long operationFeeNum = selectOperationNumMap.get("operationFee");
+                 operationFeeNum = selectOperationNumMap.get("operationFee");
                 Long operation = adviceNum.get("operation");
                 operationFeeNum = operationFeeNum + operation;
                 //CT人数
@@ -515,7 +519,7 @@ public class ConsoleFacade {
                     }
                 }
             }
-        }
+
 
 
         //抗菌人数
@@ -534,34 +538,55 @@ public class ConsoleFacade {
         /**
          * =================================标示线========================================
          */
-/*        Map<String, Object> baseIndex = behospitalInfoFacade.getBaseIndex(filterVO);
+            long x1 = System.currentTimeMillis();
+            System.out.println("qian" + (zz-x1));
+            Map<String, Object> baseIndex = behospitalInfoFacade.getBaseIndex(filterVO);
         //指标一、二、三、二十七
-        List<Map<String, String>> retLists = ManageIndexMethod(hashMapArrayList, baseIndex, filterVO);
-        //指标十七 医师查房记录
-                                  retLists = WardRoundMethod(retLists, baseIndex, triggeringRulesMap);
-        //指标十八 抢救记录
-        filterVO.setFlagStr("0");
-        List<MedManageParamsDTO> medManageParams = behospitalInfoFacade.getMedManageParams(filterVO);
-        retLists = rescueMethod(medManageParams,retLists,triggeringRulesMap);
+                hashMapArrayList = ManageIndexMethod(indexName,hashMapArrayList, baseIndex, filterVO);
+            long x2 = System.currentTimeMillis();
+            System.out.println("指标一、二、三、二十七 = " + (x2-x1));
+            //指标十七 医师查房记录
+            if (indexName.equals(QualityContent.YSCF_JL_WCL)||indexName.equals(QualityContent.QB)) {
+                hashMapArrayList = WardRoundMethod(hashMapArrayList, baseIndex, triggeringRulesMap);
+            }
+            long x3 = System.currentTimeMillis();
+            System.out.println("指标十七 = " + (x3-x2));
+            //指标十八 抢救记录
+            if (indexName.equals(QualityContent.HZQJ_JLJS_WCL)||indexName.equals(QualityContent.QB)) {
+                hashMapArrayList = rescueMethod(doctorAdviceMedManageParams,hashMapArrayList,triggeringRulesMap);
+            }
+            long x4 = System.currentTimeMillis();
+            System.out.println("指标十八 = " + (x4-x3));
+
         //指标十九 出院患者病历2日归档
-        retLists = getfileSecAmount(filterVO,retLists, baseIndex);
+            if (indexName.equals(QualityContent.CCHZ_2DAY_GDL)||indexName.equals(QualityContent.QB)) {
+                hashMapArrayList = getfileSecAmount(filterVO,hashMapArrayList, baseIndex);
+            }
+            long x5 = System.currentTimeMillis();
+            System.out.println("指标十九 = " + (x5-x4));
+
         //指标十四 手术记录
-        retLists = operationMethod(retLists, operationFeeNum+"", triggeringRulesMap);
+            if (indexName.equals(QualityContent.SS_XGJL_WCL)||indexName.equals(QualityContent.QB)) {
+                hashMapArrayList = operationMethod(hashMapArrayList, operationFeeNum+"", triggeringRulesMap);
+            }
+            long x6 = System.currentTimeMillis();
+            System.out.println("指标十四  = " + (x6-x5));
+
         //指标十六  临床用血相关记录符合率
-        filterVO.setFlagStr("1");
-        medManageParams = behospitalInfoFacade.getMedManageParams(filterVO);
-        retLists = bloodMethod(retLists, medManageParams, triggeringRulesMap);
-
-         if(StringUtils.isNotEmpty(filterVO.getIndexName())){
-             List<Map<String, String>> retData = new ArrayList<>();
-             for (int i = 0; i < retLists.size(); i++) {
-                 if(retLists.get(i).containsValue(filterVO.getIndexName())){
-                     retData.add(retLists.get(i));
-                     break;
-                 }
-             }
-             return retData;
-         }*/
+            if (indexName.equals(QualityContent.SS_XGJL_WCL)||indexName.equals(QualityContent.QB)) {
+                filterVO.setFlagStr("1");
+                List<MedManageParamsDTO> medManageParams = behospitalInfoFacade.getMedManageParams(filterVO);
+                long x7 = System.currentTimeMillis();
+                System.out.println("lis查询 = " + (x7-x6));
+                hashMapArrayList = bloodMethod(hashMapArrayList,doctorAdviceMedManageParams, medManageParams, triggeringRulesMap);
+                long x9 = System.currentTimeMillis();
+                System.out.println("封装 = " + (x9-x7));
+            }
+            long x8 = System.currentTimeMillis();
+            System.out.println("指标十六 = " + (x8-x6));
+            System.out.println("总耗时 = " + (x8-x1));
+        }
+
 
         return hashMapArrayList;
     }
@@ -2714,22 +2739,31 @@ public class ConsoleFacade {
     }
 
     //指标十六  临床用血相关记录符合率
-    private  List<Map<String, String>> bloodMethod( List<Map<String, String>>retList,  List<MedManageParamsDTO> medManageParams, Map<String, Long> triggeringRulesMap){
-        List<MedManageParamsDTO> manageList= new ArrayList<>();
+    private  List<Map<String, String>> bloodMethod( List<Map<String, String>>retList,List<MedManageParamsDTO> doctorAdviceList, List<MedManageParamsDTO> medManageParams, Map<String, Long> triggeringRulesMap){
+        Set<String> manageList= new CopyOnWriteArraySet<>();
         List<String> blood_list = QualityContent.BLOODLIST;
-        for (MedManageParamsDTO medManageParam : medManageParams) {
-            String doctorAdviceType = medManageParam.getDoctorAdviceType();
-            String da_status = medManageParam.getDa_status();
-            String daItemName = medManageParam.getDaItemName();
-            String repName = medManageParam.getRepName();
-            for (String str : blood_list) {
-                if(StringUtils.isNotEmpty(daItemName) && daItemName.equals(str) && StringUtils.isNotEmpty(repName) && repName.equals(str) && StringUtils.isNotEmpty(doctorAdviceType) && doctorAdviceType.equals(QualityContent.STAT_ORDER) && (da_status == null || (StringUtils.isNotEmpty(da_status) && ! doctorAdviceType.equals(QualityContent.CANCELLATION_ORDER)))){
-                    manageList.add(medManageParam);
-                }
-            }
-        }
+        //lis项目存在用血住院病历号
+        long xx1 = System.currentTimeMillis();
+        List<String> beCode = medManageParams.stream()
+                .filter(obj -> StringUtils.isNotEmpty(obj.getRepName()) && blood_list.contains(obj.getRepName()))
+                .map(MedManageParamsDTO::getBehospitalCode).distinct()
+                .collect(Collectors.toList());
+        long xx2= System.currentTimeMillis();
+        System.out.println("lis项目存在用血住院病历号 = " + (xx2-xx1));
+        //advice体现lis项目存在用血的住院病历号
+        doctorAdviceList.parallelStream()
+              .filter(obj -> beCode.contains(obj.getBehospitalCode()) && obj.getDoctorAdviceType()
+                      .equals(QualityContent.STAT_ORDER) && blood_list.contains(obj.getDaItemName()) &&
+                      (obj.getDa_status() == null) || (StringUtils.isNotEmpty(obj.getDa_status()) && ! obj.getDa_status()
+                      .equals(QualityContent.CANCELLATION_ORDER)))
+                .distinct()
+              .map(obj -> manageList.add(obj.getBehospitalCode()))
+              .collect(Collectors.toList());
+        long xx3= System.currentTimeMillis();
+        System.out.println("advice体现lis项目存在用血的住院病历号 = " + (xx3-xx2));
+
             //临床用血的质控病历总数
-            double count = manageList.stream().map(MedManageParamsDTO::getBehospitalCode).distinct().count();
+            double count = manageList.size();
             String num = null;
             if(StringUtils.isNotEmpty(String.valueOf(count)) &&  count != 0d){
                 //指标十七
@@ -2825,7 +2859,7 @@ public class ConsoleFacade {
     }
 
 
-     private List<Map<String, String>> ManageIndexMethod(List<Map<String, String>> retList, Map<String, Object> baseIndex,FilterVO filterVO){
+     private List<Map<String, String>> ManageIndexMethod(String indexName,List<Map<String, String>> retList, Map<String, Object> baseIndex,FilterVO filterVO){
          FilterVO timeVo = new FilterVO();
          BeanUtils.copyProperties(filterVO,timeVo);
          QueryWrapper<MedManagementInfo> query = new QueryWrapper<>();
@@ -2841,71 +2875,81 @@ public class ConsoleFacade {
 
 
          List<MedManagementInfo> list = medManagementInfoService.list(query);
-         //单位时间同期门诊病案管理人员实际工作总月数  Double  =
-         Optional<Double> firOp = list.stream().filter(obj -> obj.getPositionId().equals("3")).map(MedManagementInfo::getWorkPerson).reduce(Double::sum);
-         Double firMouth = 0d;
-         if(firOp.isPresent()){
-              firMouth = firOp.get();
+         //单位时间同期门诊病案管理人员实际工作总月数
+         if(indexName.equals(QualityContent.MZBA_CYHZ)||indexName.equals(QualityContent.QB)) {
+             Optional<Double> firOp = list.stream().filter(obj -> obj.getPositionId().equals("3")).map(MedManagementInfo::getWorkPerson).reduce(Double::sum);
+             Double firMouth = 0d;
+             if(firOp.isPresent()){
+                 firMouth = firOp.get();
+             }
+             String num3= null;
+             if(firMouth != 0d && firMouth != null  && StringUtils.isNotEmpty( baseIndex.get("secWorkNum").toString())){
+                 //指标二
+                 num3 = String.valueOf(Math.ceil(Double.parseDouble(baseIndex.get("secWorkNum").toString())/firMouth));
+             }
+             LinkedHashMap<String, String> thrMap = new LinkedHashMap<>();
+             thrMap.put("name","门诊病案管理人员月均负担门诊患者病历数");
+             thrMap.put("num",num3);
+             retList.add(thrMap);
          }
+
          //单位时间同期住院病案管理人员实际工作总月数
-         Optional<Double> secOp = list.stream().filter(obj->obj.getPositionId().equals("1")).map(MedManagementInfo::getWorkPerson).reduce(Double::sum);
-         Double secMouth = 0d;
-         if(secOp.isPresent()){
-             secMouth = secOp.get();
+         if(indexName.equals(QualityContent.ZYBA_CYHZ)||indexName.equals(QualityContent.QB)) {
+             Optional<Double> secOp = list.stream().filter(obj->obj.getPositionId().equals("1")).map(MedManagementInfo::getWorkPerson).reduce(Double::sum);
+             Double secMouth = 0d;
+             if(secOp.isPresent()){
+                 secMouth = secOp.get();
+             }
+             //指标一
+             String num1 = null;
+             if(secMouth != 0d && secMouth != null && StringUtils.isNotEmpty( baseIndex.get("firWorkNum").toString())){
+                 num1 = String.valueOf(Math.ceil(Double.parseDouble(baseIndex.get("firWorkNum").toString()) / secMouth));
+             }
+             LinkedHashMap<String, String> firMap = new LinkedHashMap<>();
+             firMap.put("name","住院病案管理人员月均负担出院患者病历数");
+             firMap.put("num",num1);
+             retList.add(firMap);
          }
+
          //单位时间同期病案编码管理人员实际工作总月数
-         Optional<Double> thrOp = list.stream().filter(obj->obj.getPositionId().equals("2")).map(MedManagementInfo::getWorkPerson).reduce(Double::sum);
-         Double thrMouth = 0d;
-         if(thrOp.isPresent()){
-             thrMouth = thrOp.get();
-         }
-         Double firRecord = 0d;
+         if(indexName.equals(QualityContent.BABM_CYHZ)||indexName.equals(QualityContent.QB)) {
+             Optional<Double> thrOp = list.stream().filter(obj->obj.getPositionId().equals("2")).map(MedManagementInfo::getWorkPerson).reduce(Double::sum);
+             Double thrMouth = 0d;
+             if(thrOp.isPresent()){
+                 thrMouth = thrOp.get();
+             }
 
-         //指标一
-         String num1 = null;
-         if(secMouth != 0d && secMouth != null && StringUtils.isNotEmpty( baseIndex.get("firWorkNum").toString())){
-              num1 = String.valueOf(Math.ceil(Double.parseDouble(baseIndex.get("firWorkNum").toString()) / secMouth));
-         }
-         LinkedHashMap<String, String> firMap = new LinkedHashMap<>();
-         firMap.put("name","住院病案管理人员月均负担出院患者病历数");
-         firMap.put("num",num1);
-         retList.add(firMap);
-         //指标三
-         String num2 = null;
-         if(thrMouth != 0d && thrMouth != null && StringUtils.isNotEmpty( baseIndex.get("firWorkNum").toString())){
-              num2 = String.valueOf(Math.ceil(Double.parseDouble(baseIndex.get("firWorkNum").toString())/thrMouth));
+             //指标三
+             String num2 = null;
+             if(thrMouth != 0d && thrMouth != null && StringUtils.isNotEmpty( baseIndex.get("firWorkNum").toString())){
+                 num2 = String.valueOf(Math.ceil(Double.parseDouble(baseIndex.get("firWorkNum").toString())/thrMouth));
 
+             }
+             LinkedHashMap<String, String> secMap = new LinkedHashMap<>();
+             secMap.put("name","病案编码人员月均负担出院患者病历数");
+             secMap.put("num",num2);
+             retList.add(secMap);
          }
-         LinkedHashMap<String, String> secMap = new LinkedHashMap<>();
-         secMap.put("name","病案编码人员月均负担出院患者病历数");
-         secMap.put("num",num2);
-         retList.add(secMap);
-
-         String num3= null;
-         if(firMouth != 0d && firMouth != null  && StringUtils.isNotEmpty( baseIndex.get("secWorkNum").toString())){
-         //指标二
-                num3 = String.valueOf(Math.ceil(Double.parseDouble(baseIndex.get("secWorkNum").toString())/firMouth));
-         }
-         LinkedHashMap<String, String> thrMap = new LinkedHashMap<>();
-         thrMap.put("name","门诊病案管理人员月均负担门诊患者病历数");
-         thrMap.put("num",num3);
-         retList.add(thrMap);
-
-         //指标二十七 -甲级病历率
-         String num4= null;
-         if(StringUtils.isNotEmpty( baseIndex.get("forWorkNum").toString())){
-             firRecord =Double.parseDouble(baseIndex.get("forWorkNum").toString());
-         }
-         if( firRecord != 0d && StringUtils.isNotEmpty( baseIndex.get("sixWorkNum").toString()) ){
-             double retNum = Double.parseDouble(baseIndex.get("sixWorkNum").toString()) * 100 / firRecord;
-             double firGradeStr = Double.parseDouble(df.format(retNum));
-             num4 = String.valueOf(Math.ceil(firGradeStr));
+
+
+         if(indexName.equals(QualityContent.JJBLL)||indexName.equals(QualityContent.QB)) {
+             //指标二十七 -甲级病历率
+             Double firRecord = 0d;
+             String num4= null;
+             if(StringUtils.isNotEmpty( baseIndex.get("forWorkNum").toString())){
+                 firRecord =Double.parseDouble(baseIndex.get("forWorkNum").toString());
+             }
+             if( firRecord != 0d && StringUtils.isNotEmpty( baseIndex.get("sixWorkNum").toString()) ){
+                 double retNum = Double.parseDouble(baseIndex.get("sixWorkNum").toString()) * 100 / firRecord;
+                 double firGradeStr = Double.parseDouble(df.format(retNum));
+                 num4 = String.valueOf(Math.ceil(firGradeStr));
+             }
+             LinkedHashMap<String, String> fouMap = new LinkedHashMap<>();
+             fouMap.put("name","甲级病历率");
+             fouMap.put("notCopiedStr",StringUtils.isEmpty(num4)? null:(num4+"%"));
+             fouMap.put("num",num4);
+             retList.add(fouMap);
          }
-         LinkedHashMap<String, String> fouMap = new LinkedHashMap<>();
-         fouMap.put("name","甲级病历率");
-         fouMap.put("notCopiedStr",StringUtils.isEmpty(num4)? null:(num4+"%"));
-         fouMap.put("num",num4);
-         retList.add(fouMap);
          return retList;
      };
    private void timeTrans(FilterVO filterVO){

+ 5 - 2
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -782,9 +782,12 @@
         <if test="flagStr != null and flagStr == 1 ">
         f2.rep_name as repName,
         </if>
+        <if test="flagStr != null and flagStr == 2">
         f3.da_item_name as daItemName,
         f3.da_status AS daStatus,
-        f3.doctor_advice_type as doctorAdviceType
+        f3.doctor_advice_type as doctorAdviceType,
+        </if>
+        f1.hospitalId
         from(
         SELECT DISTINCT
         a.hospital_id as hospitalId,
@@ -17806,7 +17809,7 @@
         AND a.hospital_id = q.hospital_id
     </select>
 
-<!--    跟病案首页关联的无首页出院病历-->
+<!--    跟病案首页关联的出院病历-->
     <select id="getMedicalRecords" parameterType="com.diagbot.vo.FilterVO" resultType="java.util.Map">
      SELECT
 	d.behospital_code,