소스 검색

Merge remote-tracking branch 'origin/master'

zhoutg 5 년 전
부모
커밋
2cebc3509b

+ 8 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0002.java

@@ -10,6 +10,7 @@ import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.entity.Clinical;
 import com.lantone.qc.pub.model.entity.Diag;
 import com.lantone.qc.pub.model.entity.PD;
+import com.sun.org.apache.xpath.internal.operations.Bool;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -30,6 +31,7 @@ public class BEH0002 extends QCCatalogue {
     private RedisUtil redisUtil;
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        Boolean bool = false;
         List<Diag> chiefDiags = inputInfo.getBeHospitalizedDoc().getChiefLabel().getDiags();
         List<Diag> diags = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel().getDiags();
         if(chiefDiags.size()>0){
@@ -39,9 +41,14 @@ public class BEH0002 extends QCCatalogue {
                         hospitalDiagName.contains("瘤") || hospitalDiagName.contains("复诊")){
                     status.set("0");
                     break;
+                }{
+                    bool = true;
                 }
             }
         }else {
+            bool = true;
+        }
+        if(bool){
             String mainDiag = diags.get(0).getName();
             List<String> symptoms=null;
             Map<String, Map<String, Object>> diagMap = redisUtil.getJsonStringValue(KernelConstants.CONCEPT_DIAG_PROPERTY_MAP);
@@ -49,7 +56,7 @@ public class BEH0002 extends QCCatalogue {
             if(map != null && map.size() >0){
                 symptoms = (List<String>) map.get("symptoms");
             }
-            List<Clinical> clinicals = inputInfo.getBeHospitalizedDoc().getPresentLabel().getClinicals();
+            List<Clinical> clinicals = inputInfo.getBeHospitalizedDoc().getChiefLabel().getClinicals();
             if(clinicals != null && clinicals.size()>0){
                 for (Clinical clinical:clinicals) {
                     String clinicalName = clinical.getName();
@@ -66,6 +73,5 @@ public class BEH0002 extends QCCatalogue {
                 status.set("0");
             }
         }
-
     }
 }

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0200.java

@@ -21,7 +21,7 @@ public class FIRP0200 extends QCCatalogue {
         status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
-            String newbornWeightStr = firstpageStructureMap.get(Content.newbornWeight);
+            String newbornWeightStr = firstpageStructureMap.get(Content.newbornWeight).replace("-","");
             if (!CatalogueUtil.isEmpty(newbornWeightStr)) {
                 int newbornWeight = Integer.parseInt(newbornWeightStr);
                 if (newbornWeight <= 1 || newbornWeight >= 10) {

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0202.java

@@ -21,7 +21,7 @@ public class FIRP0202 extends QCCatalogue {
         status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
-            String newbornAdmisWeightStr = firstpageStructureMap.get(Content.newbornAdmisWeight);
+            String newbornAdmisWeightStr = firstpageStructureMap.get(Content.newbornAdmisWeight).replace("-","");
             if (!CatalogueUtil.isEmpty(newbornAdmisWeightStr)) {
                 int newbornAdmisWeight = Integer.parseInt(newbornAdmisWeightStr);
                 if (newbornAdmisWeight <= 1 || newbornAdmisWeight >= 10) {

+ 27 - 4
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0127.java

@@ -7,13 +7,17 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.util.DateUtil;
+import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * @ClassName : THR0127
@@ -33,6 +37,10 @@ public class THR0127 extends QCCatalogue {
                 return;
             }
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            Date maxRecordDate = getMaxRecordDate(threeLevelWardDocs);
+            if (maxRecordDate == null) {
+                return;
+            }
             int hoursPerWeek = 7 * 24 * 60;
             String roundRecordThisWeek = "";
             List<String> roundRecordEveryWeek = new ArrayList<>();
@@ -41,7 +49,7 @@ public class THR0127 extends QCCatalogue {
             int i = 1;
             //每周的病历记录
             while (i >= 1) {
-                roundRecordThisWeek = extractWardRecord(threeLevelWardDocs, beginDate, hoursPerWeek);
+                roundRecordThisWeek = extractWardRecord(threeLevelWardDocs, beginDate, hoursPerWeek, maxRecordDate);
                 if (CatalogueUtil.isEmpty(roundRecordThisWeek)) {
                     break;
                 }
@@ -49,7 +57,7 @@ public class THR0127 extends QCCatalogue {
                 beginDate = DateUtil.addDate(beginDate, 7);
                 i++;
             }
-            if (roundRecordEveryWeek.size() == 0){
+            if (roundRecordEveryWeek.size() == 0) {
                 status.set("0");
                 return;
             }
@@ -65,6 +73,21 @@ public class THR0127 extends QCCatalogue {
         }
     }
 
+    private Date getMaxRecordDate(List<ThreeLevelWardDoc> threeLevelWardDocs) {
+        List<Date> recordTime = new ArrayList<>();
+        threeLevelWardDocs.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("查房日期")))
+                .forEach(i -> recordTime.add(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))));
+        List<Date> sortRecordTime = recordTime.stream()
+                .filter(Objects::nonNull)
+                .sorted(Comparator.reverseOrder())
+                .collect(Collectors.toList());
+        if (ListUtil.isNotEmpty(sortRecordTime) && sortRecordTime.size() > 0) {
+            return sortRecordTime.get(0);
+        }
+        return null;
+    }
+
     /**
      * 抽取duration分钟内所有查房标题
      * 抽取一周内所有查房标题,若一周内记录少于6天,则返回""
@@ -74,7 +97,7 @@ public class THR0127 extends QCCatalogue {
      * @param duration
      * @return
      */
-    private static String extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs, Date admisDate, int duration) {
+    private static String extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs, Date admisDate, int duration, Date maxRecordDate) {
         String recordTime = "", recordTitle = "";
         List<Date> dateList = new ArrayList();
         for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
@@ -92,7 +115,7 @@ public class THR0127 extends QCCatalogue {
         }
         if (dateList.size() > 0) {
             dateList.sort(Date::compareTo);
-            if (CatalogueUtil.compareTime(admisDate, dateList.get(dateList.size() - 1), Long.valueOf(6 * 24 * 60))) {
+            if (!maxRecordDate.equals(dateList.get(dateList.size() - 1)) || CatalogueUtil.compareTime(admisDate, dateList.get(dateList.size() - 1), Long.valueOf(6 * 24 * 60))) {
                 return recordTitle;
             }
         }

+ 27 - 4
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0128.java

@@ -7,13 +7,17 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.util.DateUtil;
+import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * @ClassName : THR0128
@@ -33,6 +37,10 @@ public class THR0128 extends QCCatalogue {
                 return;
             }
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            Date maxRecordDate = getMaxRecordDate(threeLevelWardDocs);
+            if (maxRecordDate == null) {
+                return;
+            }
             int hoursPerWeek = 7 * 24 * 60;
             String roundRecordThisWeek = "";
             List<String> roundRecordEveryWeek = new ArrayList<>();
@@ -41,7 +49,7 @@ public class THR0128 extends QCCatalogue {
             int i = 1;
             //每周的病历记录
             while (i >= 1) {
-                roundRecordThisWeek = extractWardRecord(threeLevelWardDocs, beginDate, hoursPerWeek);
+                roundRecordThisWeek = extractWardRecord(threeLevelWardDocs, beginDate, hoursPerWeek, maxRecordDate);
                 if (CatalogueUtil.isEmpty(roundRecordThisWeek)) {
                     break;
                 }
@@ -49,7 +57,7 @@ public class THR0128 extends QCCatalogue {
                 beginDate = DateUtil.addDate(beginDate, 7);
                 i++;
             }
-            if (roundRecordEveryWeek.size() == 0){
+            if (roundRecordEveryWeek.size() == 0) {
                 status.set("0");
                 return;
             }
@@ -64,6 +72,21 @@ public class THR0128 extends QCCatalogue {
         }
     }
 
+    private Date getMaxRecordDate(List<ThreeLevelWardDoc> threeLevelWardDocs) {
+        List<Date> recordTime = new ArrayList<>();
+        threeLevelWardDocs.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("查房日期")))
+                .forEach(i -> recordTime.add(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))));
+        List<Date> sortRecordTime = recordTime.stream()
+                .filter(Objects::nonNull)
+                .sorted(Comparator.reverseOrder())
+                .collect(Collectors.toList());
+        if (ListUtil.isNotEmpty(sortRecordTime) && sortRecordTime.size() > 0) {
+            return sortRecordTime.get(0);
+        }
+        return null;
+    }
+
     /**
      * 抽取duration分钟内所有查房标题
      * 抽取一周内所有查房标题,若一周内记录少于6天,则返回""
@@ -73,7 +96,7 @@ public class THR0128 extends QCCatalogue {
      * @param duration
      * @return
      */
-    private static String extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs, Date admisDate, int duration) {
+    private static String extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs, Date admisDate, int duration, Date maxRecordDate) {
         String recordTime = "", recordTitle = "";
         List<Date> dateList = new ArrayList();
         for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
@@ -91,7 +114,7 @@ public class THR0128 extends QCCatalogue {
         }
         if (dateList.size() > 0) {
             dateList.sort(Date::compareTo);
-            if (CatalogueUtil.compareTime(admisDate, dateList.get(dateList.size() - 1), Long.valueOf(6 * 24 * 60))) {
+            if (!maxRecordDate.equals(dateList.get(dateList.size() - 1)) || CatalogueUtil.compareTime(admisDate, dateList.get(dateList.size() - 1), Long.valueOf(6 * 24 * 60))) {
                 return recordTitle;
             }
         }