Преглед изворни кода

Merge remote-tracking branch 'origin/dev-1.2' into dev

hujing пре 5 година
родитељ
комит
fd4628b12b

+ 20 - 12
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0002.java

@@ -75,22 +75,30 @@ public class BEH0002 extends QCCatalogue {
             if (map != null && map.size() > 0) {
                 symptoms = (List<String>) map.get("symptoms");
             }
+            if (symptoms == null){
+                status.set("0");
+                return;
+            }
             List<Clinical> clinicals = inputInfo.getBeHospitalizedDoc().getChiefLabel().getClinicals();
             if (clinicals != null && clinicals.size() > 0) {
-                for (Clinical clinical : clinicals) {
-                    String clinicalName = clinical.getName();
-                    if (symptoms != null && !symptoms.contains(clinicalName)) {
-                        if (StringUtils.isEmpty(info.get())) {
-                            info.set(clinicalName);
-                        } else {
-                            info.set(info.get() + "," + clinicalName);
-                        }
-                    }
+                String firstClinical = clinicals.get(0).getName();
+                if (symptoms.contains(firstClinical)) {
+                    status.set("0");
                 }
+//                for (Clinical clinical : clinicals) {
+//                    String clinicalName = clinical.getName();
+//                    if (symptoms != null && !symptoms.contains(clinicalName)) {
+//                        if (StringUtils.isEmpty(info.get())) {
+//                            info.set(clinicalName);
+//                        } else {
+//                            info.set(info.get() + "," + clinicalName);
+//                        }
+//                    }
+//                }
             }
-            if (StringUtils.isEmpty(info.get())) {
-                status.set("0");
-            }
+//            if (StringUtils.isEmpty(info.get())) {
+            //                status.set("0");
+            //            }
         }
     }
 }

+ 19 - 12
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0014.java

@@ -5,10 +5,11 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.entity.Cause;
 import com.lantone.qc.pub.model.entity.Clinical;
+import com.lantone.qc.pub.model.label.PresentLabel;
+import com.lantone.qc.pub.util.ListUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
 import java.util.List;
 
 
@@ -36,23 +37,29 @@ public class BEH0014 extends QCCatalogue {
                 status.set("0");
             }
         }*/
-        //硬规则匹配 前30个字有"体检"或"发现"或"检查"字样
-        if (inputInfo.getBeHospitalizedDoc() != null) {
-            String present = inputInfo.getBeHospitalizedDoc().getPresentLabel().getText();
-            if (StringUtils.isNotEmpty(present)) {
-                if (present.length() > 30) {
-                    present = present.substring(0, 30);
-                }
-                if (present.contains("体检") || present.contains("发现") || present.contains("检查")) {
+        PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
+        List<Clinical> clinicals = presentLabel.getClinicals();
+        if (ListUtil.isNotEmpty(clinicals)) {
+            for (Clinical clinical : clinicals) {
+                if (clinical.getCause() != null) {
                     status.set("0");
                     return;
                 }
             }
-            List<Cause> causes = inputInfo.getBeHospitalizedDoc().getPresentLabel().getCauses();
-            if (causes != null && causes.size() > 0) {
+        }
+        //硬规则匹配 前30个字有"体检"或"发现"或"检查"字样
+        String present = presentLabel.getText();
+        if (StringUtils.isNotEmpty(present)) {
+            if (present.length() > 30) {
+                present = present.substring(0, 30);
+            }
+            if (present.contains("体检") || present.contains("发现") || present.contains("检查")) {
                 status.set("0");
+                return;
             }
-        } else {
+        }
+        List<Cause> causes = presentLabel.getCauses();
+        if (causes != null && causes.size() > 0) {
             status.set("0");
         }
     }

+ 18 - 9
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0017.java

@@ -5,6 +5,7 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.entity.Clinical;
 import com.lantone.qc.pub.model.entity.PD;
+import com.lantone.qc.pub.util.ListUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
@@ -20,20 +21,28 @@ import java.util.List;
 @Component
 public class BEH0017 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        if(inputInfo.getBeHospitalizedDoc() == null){
+        if (inputInfo.getBeHospitalizedDoc() == null) {
             status.set("0");
             return;
         }
         List<Clinical> clinicals = inputInfo.getBeHospitalizedDoc().getPresentLabel().getClinicals();
-        if(clinicals.size()>0){
-            Clinical clinical = clinicals.get(0);
-            List<PD> timestamp = clinical.getTimestamp();
-            if(timestamp == null){
-                info.set(clinical.getName());
-            }else {
-                status.set("0");
+        if (clinicals.size() > 0) {
+            for (Clinical clinical:clinicals) {
+                List<PD> timestamp = clinical.getTimestamp();
+                if (ListUtil.isNotEmpty(timestamp)){
+                    status.set("0");
+                    return;
+                }
             }
-        }else {
+            //现病史取第一个症状
+//            Clinical clinical = clinicals.get(0);
+//            List<PD> timestamp = clinical.getTimestamp();
+//            if (timestamp == null) {
+//                info.set(clinical.getName());
+//            } else {
+//                status.set("0");
+//            }
+        } else {
             status.set("0");
         }
     }

+ 10 - 4
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0043.java

@@ -4,6 +4,7 @@ import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.entity.Address;
+import com.lantone.qc.pub.model.label.PersonalLabel;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -34,12 +35,17 @@ public class BEH0043 extends QCCatalogue {
             return;
         }
 
-
-        String text = inputInfo.getBeHospitalizedDoc().getPersonalLabel().getText();
-        if (StringUtil.isBlank(text)) {
+        PersonalLabel personalLabel = inputInfo.getBeHospitalizedDoc().getPersonalLabel();
+        if (personalLabel == null){
+            status.set("0");
+            return;
+        }
+        String text = personalLabel.getText();
+        if (StringUtil.isBlank(text) || text.contains("居住") || text.contains("生长") || text.contains("生活")) {
+            status.set("0");
             return;
         }
-        List<Address> addresses = inputInfo.getBeHospitalizedDoc().getPersonalLabel().getAddresses();
+        List<Address> addresses = personalLabel.getAddresses();
         if (ListUtil.isNotEmpty(addresses)) {
             long count = addresses.stream().filter(i -> {
                 boolean flag = false;

+ 16 - 14
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0058.java

@@ -34,24 +34,26 @@ public class BEH0058 extends QCCatalogue {
         //硬规则 匹配未育
         String marry = beHospitalizedDoc.getStructureMap().get(Content.marry);
         MaritalLabel maritalLabel = beHospitalizedDoc.getMaritalLabel();
-        if (maritalLabel != null) {
-            String maritalLabelText = maritalLabel.getText();
-            if (StringUtil.isBlank(maritalLabelText)) {
-                status.set("0");
-                return;
-            } else {
-                String regex = ".*\\d?子\\d?女.*";
-                boolean flag = maritalLabelText.matches(regex);
-                if (flag) {
-                    status.set("0");
-                    return;
-                }
-            }
-            if (maritalLabelText.contains("未育") || maritalLabelText.contains("未婚") || "未婚".equals(marry)) {
+        if (maritalLabel == null) {
+            status.set("0");
+            return;
+        }
+        String maritalLabelText = maritalLabel.getText();
+        if (StringUtil.isBlank(maritalLabelText)) {
+            status.set("0");
+            return;
+        } else {
+            String regex = ".*\\d?子\\d?女.*";
+            boolean flag = maritalLabelText.matches(regex);
+            if (flag) {
                 status.set("0");
                 return;
             }
         }
+        if (maritalLabelText.contains("未育") || maritalLabelText.contains("未婚") || "未婚".equals(marry)) {
+            status.set("0");
+            return;
+        }
         Map<String, String> structureMap = beHospitalizedDoc.getStructureMap();
         String familyMembersHealth = structureMap.get("家庭成员健康情况");
         List<Family> familyList = Lists.newArrayList();

+ 11 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0376.java

@@ -46,12 +46,20 @@ public class BEH0376 extends QCCatalogue {
         }
         //硬规则 匹配未育
         String marry = structureMap_beh.get(Content.marry);
-        String maritalLabelText = maritalLabel.getText();
-        if ((StringUtil.isNotBlank(maritalLabelText) && (maritalLabelText.contains("未育") || maritalLabelText.contains("未婚") || maritalLabelText.contains("0子0女")))
-                || "未婚".equals(marry)) {
+        if ("未婚".equals(marry)) {
             status.set("0");
             return;
         }
+        String maritalText = maritalLabel.getText();
+        if (StringUtil.isNotBlank(maritalText)) {
+            List<String> words = Lists.newArrayList("未婚", "未育", "未婚育", "未生育", "未生","0子0女");
+            for (String word : words) {
+                if (maritalText.contains(word)) {
+                    status.set("0");
+                    return;
+                }
+            }
+        }
         //未婚 无子女
         if (maritalLabel.getMaritalStatus() != null && maritalLabel.getMaritalStatus().getName().contains("未婚")) {
             status.set("0");

+ 16 - 4
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0397.java

@@ -4,7 +4,10 @@ import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.entity.Family;
+import com.lantone.qc.pub.model.label.FamilyLabel;
+import com.lantone.qc.pub.model.label.MaritalLabel;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -29,15 +32,24 @@ public class BEH0397 extends QCCatalogue {
             status.set("0");
             return;
         }
-        Map<String, String> structureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
+        BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
+        Map<String, String> structureMap = beHospitalizedDoc.getStructureMap();
         if (StringUtils.isNotEmpty(structureMap.get("家庭成员健康情况"))) {
             status.set("0");
             return;
         }
-
+        FamilyLabel familyLabel = beHospitalizedDoc.getFamilyLabel();
+        MaritalLabel maritalLabel = beHospitalizedDoc.getMaritalLabel();
+        String familyText = familyLabel.getText();
+        String maritalText = maritalLabel.getText();
+        if ((StringUtil.isNotBlank(familyText) && familyText.contains("父母"))
+                || (StringUtil.isNotBlank(maritalText) && maritalText.contains("父母"))) {
+            status.set("0");
+            return;
+        }
         List<Family> familyList = Lists.newArrayList();
-        List<Family> familiesFl = inputInfo.getBeHospitalizedDoc().getFamilyLabel().getFamilies();
-        List<Family> familiesMl = inputInfo.getBeHospitalizedDoc().getMaritalLabel().getFamily();
+        List<Family> familiesFl = familyLabel.getFamilies();
+        List<Family> familiesMl = maritalLabel.getFamily();
         if (ListUtil.isNotEmpty(familiesFl)) {
             familyList.addAll(familiesFl);
         }

+ 6 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0398.java

@@ -6,7 +6,6 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.entity.Family;
 import com.lantone.qc.pub.model.label.FamilyLabel;
-import com.lantone.qc.pub.model.label.MaritalLabel;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -35,7 +34,7 @@ public class BEH0398 extends QCCatalogue {
         FamilyLabel familyLabel = inputInfo.getBeHospitalizedDoc().getFamilyLabel();
         if (familyLabel != null) {
             String familyLabelText = familyLabel.getText();
-            if(StringUtil.isNotBlank(familyLabelText)){
+            if (StringUtil.isNotBlank(familyLabelText)) {
                 if (familyLabelText.contains("独生子") || familyLabelText.contains("独生女")
                         || familyLabelText.contains("独子") || familyLabelText.contains("独女")) {
                     status.set("0");
@@ -48,7 +47,7 @@ public class BEH0398 extends QCCatalogue {
             status.set("0");
             return;
         }
-        if(StringUtils.isNotEmpty("兄弟姐妹健康状况")){
+        if (StringUtils.isNotEmpty("兄弟姐妹健康状况")) {
             status.set("0");
             return;
         }
@@ -70,6 +69,10 @@ public class BEH0398 extends QCCatalogue {
                                 && StringUtil.isNotBlank(i.getName())
                                 && p.matcher(i.getName()).find()).collect(Collectors.toList());
 
+        if (ListUtil.isEmpty(filterFamilies)) {
+            status.set("0");
+            return;
+        }
         for (Family family : filterFamilies) {
             if (family.getDead() != null) {
                 status.set("0");

+ 27 - 9
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0441.java

@@ -1,11 +1,14 @@
 package com.lantone.qc.kernel.catalogue.behospitalized;
 
+import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.entity.General;
 import com.lantone.qc.pub.model.entity.GeneralDesc;
+import com.lantone.qc.pub.model.label.PresentLabel;
 import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -24,20 +27,35 @@ public class BEH0441 extends QCCatalogue {
             status.set("0");
             return;
         }
-        List<GeneralDesc> generals = inputInfo.getBeHospitalizedDoc().getPresentLabel().getGenerals();
-        if(ListUtil.isNotEmpty(generals)){
-            for (GeneralDesc general:generals) {
-                if(general.getName().contains("纳")|| general.getName().contains("饮食")
-                        || general.getName().contains("进食")|| general.getName().contains("食欲")){
+        PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
+        if (presentLabel == null) {
+            status.set("0");
+            return;
+        }
+        String presentText = presentLabel.getText();
+        if (StringUtil.isNotBlank(presentText)) {
+            List<String> words = Lists.newArrayList("胃纳", "食纳", "食欲", "未纳", "纳眠", "饮食", "纳眠");
+            for (String word : words) {
+                if (presentText.contains(word)) {
+                    status.set("0");
+                    return;
+                }
+            }
+        }
+        List<GeneralDesc> generals = presentLabel.getGenerals();
+        if (ListUtil.isNotEmpty(generals)) {
+            for (GeneralDesc general : generals) {
+                if (general.getName().contains("纳") || general.getName().contains("饮食")
+                        || general.getName().contains("进食") || general.getName().contains("食欲")) {
                     status.set("0");
                     break;
                 }
             }
         }
-        List<General> gens = inputInfo.getBeHospitalizedDoc().getPresentLabel().getGens();
-        if(ListUtil.isNotEmpty(gens)){
-            for (General general:gens) {
-                if(general.getName().contains("纳") || general.getName().contains("饮食") || general.getName().contains("进食")){
+        List<General> gens = presentLabel.getGens();
+        if (ListUtil.isNotEmpty(gens)) {
+            for (General general : gens) {
+                if (general.getName().contains("纳") || general.getName().contains("饮食") || general.getName().contains("进食")) {
                     status.set("0");
                     break;
                 }

+ 21 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0442.java

@@ -1,11 +1,14 @@
 package com.lantone.qc.kernel.catalogue.behospitalized;
 
+import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.entity.General;
 import com.lantone.qc.pub.model.entity.GeneralDesc;
+import com.lantone.qc.pub.model.label.PresentLabel;
 import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -24,7 +27,23 @@ public class BEH0442 extends QCCatalogue {
             status.set("0");
             return;
         }
-        List<GeneralDesc> generals = inputInfo.getBeHospitalizedDoc().getPresentLabel().getGenerals();
+        PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
+        if (presentLabel == null) {
+            status.set("0");
+            return;
+        }
+        String presentText = presentLabel.getText();
+        if (StringUtil.isNotBlank(presentText)) {
+            List<String> words = Lists.newArrayList("二便", "大小便", "小便", "大便", "尿");
+            for (String word : words) {
+                if (presentText.contains(word)) {
+                    status.set("0");
+                    return;
+                }
+            }
+        }
+
+        List<GeneralDesc> generals = presentLabel.getGenerals();
         if (ListUtil.isNotEmpty(generals)) {
             for (GeneralDesc general : generals) {
                 if (general.getName().contains("便") || general.getName().contains("尿")) {
@@ -33,7 +52,7 @@ public class BEH0442 extends QCCatalogue {
                 }
             }
         }
-        List<General> gens = inputInfo.getBeHospitalizedDoc().getPresentLabel().getGens();
+        List<General> gens = presentLabel.getGens();
         if (ListUtil.isNotEmpty(gens)) {
             for (General general : gens) {
                 if (general.getName().contains("便") || general.getName().contains("尿")) {

+ 9 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0444.java

@@ -1,5 +1,6 @@
 package com.lantone.qc.kernel.catalogue.behospitalized;
 
+import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
@@ -30,10 +31,15 @@ public class BEH0444 extends QCCatalogue {
         }
         PresentLabel presentLabel = beHospitalizedDoc.getPresentLabel();
         if (presentLabel != null) {
+            List<String> words = Lists.newArrayList("神志", "神清", "神不清", "意识清", "意识不清", "昏迷","精神");
             String presentLabelText = presentLabel.getText();
-            if (StringUtil.isNotBlank(presentLabelText) && presentLabelText.contains("精神")) {
-                status.set("0");
-                return;
+            if (StringUtil.isNotBlank(presentLabelText)) {
+                for (String word : words) {
+                    if (presentLabelText.contains(word)) {
+                        status.set("0");
+                        return;
+                    }
+                }
             }
             List<GeneralDesc> generals = presentLabel.getGenerals();
             if (ListUtil.isNotEmpty(generals)) {

+ 20 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0445.java

@@ -1,12 +1,15 @@
 package com.lantone.qc.kernel.catalogue.behospitalized;
 
+import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.entity.General;
 import com.lantone.qc.pub.model.entity.GeneralDesc;
+import com.lantone.qc.pub.model.label.PresentLabel;
 import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -26,7 +29,22 @@ public class BEH0445 extends QCCatalogue {
             status.set("0");
             return;
         }
-        List<GeneralDesc> generals = inputInfo.getBeHospitalizedDoc().getPresentLabel().getGenerals();
+        PresentLabel presentLabel = beHospitalizedDoc.getPresentLabel();
+        if (presentLabel == null) {
+            status.set("0");
+            return;
+        }
+        String presentText = presentLabel.getText();
+        if (StringUtil.isNotBlank(presentText)) {
+            List<String> words = Lists.newArrayList("睡眠", "未眠", "未睡", "未入眠", "入睡", "纳眠");
+            for (String word : words) {
+                if (presentText.contains(word)) {
+                    status.set("0");
+                    return;
+                }
+            }
+        }
+        List<GeneralDesc> generals = presentLabel.getGenerals();
         if (ListUtil.isNotEmpty(generals)) {
             for (GeneralDesc general : generals) {
                 if (general.getName().contains("睡眠") || general.getName().contains("纳眠") || general.getName().contains("入睡")) {
@@ -35,7 +53,7 @@ public class BEH0445 extends QCCatalogue {
                 }
             }
         }
-        List<General> gens = inputInfo.getBeHospitalizedDoc().getPresentLabel().getGens();
+        List<General> gens = presentLabel.getGens();
         if (ListUtil.isNotEmpty(gens)) {
             for (General general : gens) {
                 if (general.getName().contains("睡眠") || general.getName().contains("纳眠") || general.getName().contains("入睡")) {

+ 38 - 18
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC0095.java

@@ -4,10 +4,10 @@ import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
-import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
 import com.lantone.qc.pub.model.entity.Diag;
 import com.lantone.qc.pub.model.label.DiagLabel;
-import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.model.label.PastLabel;
+import com.lantone.qc.pub.model.label.PresentLabel;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
@@ -24,32 +24,52 @@ import java.util.List;
 @Component
 public class FIRC0095 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
+        //        FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
         BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
-        if (firstCourseRecordDoc == null || beHospitalizedDoc == null) {
+        if (beHospitalizedDoc == null) {
             status.set("0");
             return;
         }
-        DiagLabel initialDiagLabel = firstCourseRecordDoc.getInitialDiagLabel();
-        DiagLabel initialDiagLabel1 = beHospitalizedDoc.getInitialDiagLabel();
-        if (initialDiagLabel != null && initialDiagLabel1 != null) {
-            List<Diag> diags = initialDiagLabel.getDiags();
-            List<Diag> diags1 = initialDiagLabel1.getDiags();
-            List<String> firstDiags = new ArrayList<>();
-            List<String> bhDiags = new ArrayList<>();
-            if (diags != null && diags.size() > 0) {
-                copyDiag(diags, firstDiags);
-                copyDiag(diags1, bhDiags);
-                if (ListUtil.equals(firstDiags, bhDiags)) {
-                    status.set("0");
-                }
-            }
+        //DiagLabel initialDiagLabel = firstCourseRecordDoc.getInitialDiagLabel();
+        PresentLabel presentLabel = beHospitalizedDoc.getPresentLabel();
+        PastLabel pastLabel = beHospitalizedDoc.getPastLabel();
+        DiagLabel initialDiagLabel = beHospitalizedDoc.getInitialDiagLabel();
+
+        if (initialDiagLabel == null) {
+            status.set("0");
+            return;
+        }
+        List<String> bhDiags = new ArrayList<>();
+        /* 现病史诊断 */
+        if (presentLabel != null && presentLabel.getDiags() != null) {
+            List<Diag> presentDiags = presentLabel.getDiags();
+            copyDiag(presentDiags, bhDiags);
+        }
+        /* 既往史诊断 */
+        if (pastLabel != null && pastLabel.getDiags() != null) {
+            List<Diag> pastDiags = pastLabel.getDiags();
+            copyDiag(pastDiags, bhDiags);
+        }
+        /* 初步诊断 */
+        List<Diag> diags = initialDiagLabel.getDiags();
+        List<String> initDiags = new ArrayList<>();
+        if (diags != null) {
+            copyDiag(diags, initDiags);
+        }
+
+        //List<Diag> diags1 = initialDiagLabel1.getDiags();
+        /* 初步诊断包含现病史诊断和既往史诊断 */
+        if (initDiags.containsAll(bhDiags)) {
+            status.set("0");
         }
     }
 
     private void copyDiag(List<Diag> diags, List<String> diagList) {
         String hospitalDiagName, name;
         for (Diag diag : diags) {
+            if (diag.getNegative() != null) {
+                continue;
+            }
             hospitalDiagName = diag.getHospitalDiagName();
             name = diag.getName();
             if (StringUtil.isNotBlank(hospitalDiagName)) {

+ 5 - 4
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA02901.java

@@ -32,10 +32,11 @@ public class LEA02901 extends QCCatalogue {
             Map<String, String> structureMap = leaveHospitalDoc.getStructureMap();
             String dischargeOrder = structureMap.get("出院医嘱");
             if (StringUtil.isNotBlank(dischargeOrder)) {
-                String words = "qd,bid,tid,qid,qh,q2h,q4h,q6h,q8h,qn,q3w,qod,biw,qw,prn,sos,ad lib,st" +
-                        ",stat,hs,am,po,ID,IH,IM,IV,OD,OL,OS,OU,ivgtt";
-                for (String word : words.split(",")) {
-                    if (dischargeOrder.contains(word)) {
+                List<String> words = Lists.newArrayList("qd","bid","tid","qid","qh","q2h","q4h","q6h","q8h",
+                        "qn","q3w","qod","biw","qw","prn","sos","ad","lib","st","stat","hs","am","po","ID","IH","IM",
+                        "IV","OD","OL","OS","OU","ivgtt","Q12H");
+                for (String word : words) {
+                    if (dischargeOrder.contains(word.toUpperCase()) || dischargeOrder.contains(word.toLowerCase())) {
                         status.set("-1");
                         return;
                     }

+ 29 - 6
trans/src/main/java/com/lantone/qc/trans/changx/ChangxThreeLevelWardDocTrans.java

@@ -59,7 +59,7 @@ public class ChangxThreeLevelWardDocTrans extends ModelDocTrans {
                         structureMap.put("记录医师", cutWordMap.get("医师签名"));
                     }
                 }
-                if(StringUtil.isNotEmpty(cutWordMap.get("记录医生"))){
+                if (StringUtil.isNotEmpty(cutWordMap.get("记录医生"))) {
                     Matcher m = p.matcher(cutWordMap.get("记录医生"));
                     if (!m.matches()) {
                         structureMap.put("记录医师", cutWordMap.get("记录医生"));
@@ -100,10 +100,10 @@ public class ChangxThreeLevelWardDocTrans extends ModelDocTrans {
      */
     private DirectorDoctorWardDoc findDirectorDoctorWardDoc(Map<String, String> structureMap) {
         String title = structureMap.get("查房标题");
-        title = subTitle(title);    //标题有代字
-
+        String content = structureMap.get("病情记录");
+        //标题有代字
         DirectorDoctorWardDoc directorDoctorWardDoc = null;
-        if (StringUtils.isNotEmpty(title) && title.contains("主任")) {
+        if ((StringUtils.isNotEmpty(subTitle(title)) && title.contains("主任")) || findDirector(title, content)) {
             directorDoctorWardDoc = new DirectorDoctorWardDoc();
             directorDoctorWardDoc.setStructureMap(structureMap);
             directorDoctorWardDoc.setPageData((Map) structureMap);
@@ -118,9 +118,10 @@ public class ChangxThreeLevelWardDocTrans extends ModelDocTrans {
      */
     private AttendingDoctorWardDoc findAttendingDoctorWardDoc(Map<String, String> structureMap) {
         String title = structureMap.get("查房标题");
-        title = subTitle(title);    //标题有代字
+        String content = structureMap.get("病情记录");
         AttendingDoctorWardDoc attendingDoctorWardDoc = null;
-        if (StringUtils.isNotEmpty(title) && title.contains("主治")) {
+        //标题有代字
+        if ((StringUtils.isNotEmpty(subTitle(title)) && title.contains("主治")) || findAttend(title, content)) {
             attendingDoctorWardDoc = new AttendingDoctorWardDoc();
             attendingDoctorWardDoc.setStructureMap(structureMap);
             attendingDoctorWardDoc.setPageData((Map) structureMap);
@@ -128,6 +129,28 @@ public class ChangxThreeLevelWardDocTrans extends ModelDocTrans {
         return attendingDoctorWardDoc;
     }
 
+    /**
+     * 共同照护讨论记录中找主任查房
+     *
+     * @param title
+     * @param content
+     * @return
+     */
+    private boolean findDirector(String title, String content) {
+        return title.contains("共同照护讨论记录") && content.contains("主任");
+    }
+
+    /**
+     * 共同照护讨论记录中找主治查房
+     *
+     * @param title
+     * @param content
+     * @return
+     */
+    private boolean findAttend(String title, String content) {
+        return title.contains("共同照护讨论记录") && content.contains("主治");
+    }
+
     private String subTitle(String srcText) {
         if (StringUtil.isNotBlank(srcText) && srcText.contains("代") && srcText.indexOf("代") != srcText.length() - 1) {
             srcText = srcText.substring(srcText.lastIndexOf("代") + 1);