소스 검색

code去重

zhanghang 4 년 전
부모
커밋
13c6a855d5
2개의 변경된 파일24개의 추가작업 그리고 26개의 파일을 삭제
  1. 18 20
      src/main/java/com/diagbot/facade/ConsoleFacade.java
  2. 6 6
      src/main/resources/mapper/BehospitalInfoMapper.xml

+ 18 - 20
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -594,7 +594,6 @@ public class ConsoleFacade {
         return true;
     }
 
-
     /**
      * 病案指标数据保存
      *
@@ -604,7 +603,6 @@ public class ConsoleFacade {
     public void getMedicaIndicator(FilterVO filterVO){
         MedIndexResult medIndexResult = new MedIndexResult();
        List<Map<String, String>> selectOperationNumMap = behospitalInfoFacade.selectOperationNum(filterVO);
-        if(ListUtil.isNotEmpty(selectOperationNumMap)) {
             Set<String> outHospitalCode = new CopyOnWriteArraySet<>();
             Set<String> operationCode = new CopyOnWriteArraySet<>();
             Set<String> operationPathologyCode = new CopyOnWriteArraySet<>();
@@ -614,23 +612,25 @@ public class ConsoleFacade {
             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);
-                    }
+        if(ListUtil.isNotEmpty(selectOperationNumMap)) {
+            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);
+                }
+            }
+        }
                 if(ListUtil.isNotEmpty(adviceVerify)){
                     for (String code : adviceVerify) {
                         outHospitalCode.add(code);
@@ -854,9 +854,7 @@ public class ConsoleFacade {
                     medIndexRelevanceFacade.save(medIndexRelevance);
                 }
             }
-            System.out.println(operationPathologyCode.size());
         }
-    }
     /**
      * 两数据相除得到百分比
      * @param i

+ 6 - 6
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -724,7 +724,7 @@
         f3.sixWorkNum,
         f4.sevenWorkNum
         from (
-        SELECT  count(*)  as firWorkNum
+        SELECT count(DISTINCT a.behospital_code)  as firWorkNum
         FROM
         med_behospital_info a
         WHERE
@@ -740,7 +740,7 @@
         <if test="endDate != null and endDate != ''">
             <![CDATA[ AND a.leave_hospital_date <= #{lastEndDate}]]>
         </if>)f1,
-            ( SELECT count(*) AS secWorkNum
+            ( SELECT count(DISTINCT a.behospital_code) AS secWorkNum
         FROM
         med_outpatient_info a
         WHERE
@@ -755,10 +755,10 @@
             AND a.hospital_id = #{hospitalId}
         </if>)f2,(
            select
-        count(case when  <![CDATA[m.behospital_date >= #{startDate}]]>  and  <![CDATA[m.behospital_date <= #{endDate}]]>
+        count(DISTINCT case when  <![CDATA[m.behospital_date >= #{startDate}]]>  and  <![CDATA[m.behospital_date <= #{endDate}]]>
         and m.is_placefile = 0 then m.behospital_code else null end) as thrWorkNum,
-        count(case when  <![CDATA[m.leave_hospital_date >= #{startDate}]]>  and  <![CDATA[m.leave_hospital_date <= #{endDate}]]>  and m.is_placefile = 1 then m.behospital_code else null end) as forWorkNum,
-        count(case when  <![CDATA[m.leave_hospital_date >= #{startDate}]]> and <![CDATA[m.leave_hospital_date <= #{endDate}]]> and m.is_placefile = 1 and m.level = '甲' then m.behospital_code else null end) as sixWorkNum
+        count(DISTINCT case when  <![CDATA[m.leave_hospital_date >= #{startDate}]]>  and  <![CDATA[m.leave_hospital_date <= #{endDate}]]>  and m.is_placefile = 1 then m.behospital_code else null end) as forWorkNum,
+        count(DISTINCT case when  <![CDATA[m.leave_hospital_date >= #{startDate}]]> and <![CDATA[m.leave_hospital_date <= #{endDate}]]> and m.is_placefile = 1 and m.level = '甲' then m.behospital_code else null end) as sixWorkNum
            from(
            SELECT DISTINCT a.*,b.level
             FROM
@@ -774,7 +774,7 @@
             AND a.hospital_id = #{hospitalId}
         </if>)m
             )f3,(
-        SELECT  count(*)  as sevenWorkNum
+        SELECT count(DISTINCT a.behospital_code)  as sevenWorkNum
         FROM
         med_behospital_info a
         WHERE