Browse Source

Merge remote-tracking branch 'origin/master'

rengb 5 years ago
parent
commit
95cc9d7d3a
66 changed files with 629 additions and 131 deletions
  1. 2 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0032.java
  2. 2 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/clinicalblood/CLI0306.java
  3. 2 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/clinicalblood/CLI0308.java
  4. 3 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0157.java
  5. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0158.java
  6. 5 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0161.java
  7. 3 3
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0162.java
  8. 2 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0163.java
  9. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0166.java
  10. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0168.java
  11. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0256.java
  12. 9 3
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0273.java
  13. 5 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0274.java
  14. 16 8
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0149.java
  15. 4 6
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0151.java
  16. 12 6
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0154.java
  17. 10 6
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0155.java
  18. 11 9
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0156.java
  19. 48 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0323.java
  20. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0350.java
  21. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0351.java
  22. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0352.java
  23. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0353.java
  24. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0355.java
  25. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0356.java
  26. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0357.java
  27. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0358.java
  28. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0359.java
  29. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0628.java
  30. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0629.java
  31. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0632.java
  32. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0634.java
  33. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0635.java
  34. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0636.java
  35. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0637.java
  36. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0638.java
  37. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0639.java
  38. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0640.java
  39. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0641.java
  40. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0643.java
  41. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0644.java
  42. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0646.java
  43. 50 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0648.java
  44. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0130.java
  45. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0131.java
  46. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0132.java
  47. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0133.java
  48. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0134.java
  49. 2 6
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0135.java
  50. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0136.java
  51. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0137.java
  52. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0138.java
  53. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0139.java
  54. 6 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0429.java
  55. 6 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0430.java
  56. 6 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0431.java
  57. 6 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0432.java
  58. 6 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0433.java
  59. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0435.java
  60. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0436.java
  61. 2 2
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/BeHospitalizedAI.java
  62. 36 10
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java
  63. 8 9
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessThreeLevelWard.java
  64. 300 0
      kernel/src/main/java/com/lantone/qc/kernel/util/ModelDataUtil.java
  65. 12 7
      kernel/src/main/java/com/lantone/qc/kernel/web/controller/QCTestController.java
  66. 5 4
      public/src/main/java/com/lantone/qc/pub/Content.java

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

@@ -30,8 +30,8 @@ public class BEH0032 extends QCCatalogue {
             return;
         }
         List<String> wtDiagNames = CatalogueUtil.noInQuotes(
-                diags.stream().map(i -> i.getHospitalDiagName()).filter(i -> StringUtil.isNotBlank(i)).distinct().collect(Collectors.toList()),
-                pastLabel.getText()
+                diags.stream().filter(diag -> diag.getNegative() == null).map(i -> i.getHospitalDiagName()).filter(i -> StringUtil.isNotEmpty(i)).distinct().collect(Collectors.toList()),
+                pastLabel.getText().replace("“","\"").replace("”","\"")
         );
         if (ListUtil.isNotEmpty(wtDiagNames)) {
             status.set("-1");

+ 2 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/clinicalblood/CLI0306.java

@@ -37,6 +37,8 @@ public class CLI0306 extends QCCatalogue {
 
                 }
             }
+        }else {
+            status.set("0");
         }
 
     }

+ 2 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/clinicalblood/CLI0308.java

@@ -29,6 +29,8 @@ public class CLI0308 extends QCCatalogue {
                     break;
                 }
             }
+        }else {
+            status.set("0");
         }
 
     }

+ 3 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0157.java

@@ -19,11 +19,12 @@ import java.util.Map;
 @Component
 public class FIRP0157 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
             String name = firstpageStructureMap.get(Content.name);
-            if (!CatalogueUtil.isEmpty(name)){
-                status.set("0");
+            if (CatalogueUtil.isEmpty(name)){
+                status.set("-1");
             }
         }
     }

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

@@ -25,7 +25,7 @@ public class FIRP0158 extends QCCatalogue {
             Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
             String firstAdmissionName = firstpageStructureMap.get(Content.name);
             String admissionName = beHospitalStructureMap.get(Content.name);
-            if (!CatalogueUtil.compareToken(firstAdmissionName,admissionName)) {
+            if (!CatalogueUtil.compareToken(firstAdmissionName, admissionName)) {
                 status.set("-1");
             }
         }

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

@@ -5,6 +5,7 @@ import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.Map;
@@ -25,7 +26,10 @@ public class FIRP0161 extends QCCatalogue {
             Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
             String firstAdmissionAge = firstpageStructureMap.get(Content.age);
             String admissionAge = beHospitalStructureMap.get(Content.age);
-            if (!CatalogueUtil.compareToken(firstAdmissionAge,admissionAge)) {
+            if (StringUtil.isNotBlank(admissionAge) && admissionAge.contains("岁")) {
+                admissionAge = admissionAge.replace("岁", "");
+            }
+            if (!CatalogueUtil.compareToken(firstAdmissionAge, admissionAge)) {
                 status.set("-1");
             }
         }

+ 3 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0162.java

@@ -21,10 +21,10 @@ public class FIRP0162 extends QCCatalogue {
         status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
-            String idcardInfo = firstpageStructureMap.get(Content.idcardInfo);
-            if (!CatalogueUtil.isEmpty(idcardInfo)) {
+            String idNumber = firstpageStructureMap.get(Content.idNumber);
+            if (!CatalogueUtil.isEmpty(idNumber)) {
                 String regex = "\\d{15}|\\d{17}[\\dxX]";
-                if (!idcardInfo.matches(regex)) {
+                if (!idNumber.matches(regex)) {
                     status.set("-1");
                 }
             }

+ 2 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0163.java

@@ -20,8 +20,8 @@ public class FIRP0163 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
-            String idcardInfo = firstpageStructureMap.get(Content.idcardInfo);
-            if (!CatalogueUtil.isEmpty(idcardInfo)){
+            String idNumber = firstpageStructureMap.get(Content.idNumber);
+            if (!CatalogueUtil.isEmpty(idNumber)) {
                 status.set("0");
             }
         }

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

@@ -25,7 +25,7 @@ public class FIRP0166 extends QCCatalogue {
             Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
             String firstAdmissionMarry = firstpageStructureMap.get(Content.marry);
             String admissionMarry = beHospitalStructureMap.get(Content.marry);
-            if (!CatalogueUtil.compareToken(firstAdmissionMarry,admissionMarry)) {
+            if (!CatalogueUtil.compareToken(firstAdmissionMarry, admissionMarry)) {
                 status.set("-1");
             }
         }

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

@@ -21,7 +21,7 @@ public class FIRP0168 extends QCCatalogue {
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
             String admitPath = firstpageStructureMap.get(Content.admitPath);
-            if (!CatalogueUtil.isEmpty(admitPath)){
+            if (!CatalogueUtil.isEmpty(admitPath)) {
                 status.set("0");
             }
         }

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

@@ -45,7 +45,8 @@ public class FIRP0256 extends QCCatalogue {
             List<OutcomeCure> outcomeCures = new ArrayList<>();//转归情况-治愈
             List<PositiveFinding> positiveFindings = new ArrayList<>();//阳性表现
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (!threeLevelWardDoc.getThreeLevelWardLabel().getTitle().contains("最后一次")) {
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || !threeLevelWardDoc.getThreeLevelWardLabel().getTitle().contains("最后一次")) {
                     continue;
                 }
                 ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();

+ 9 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0273.java

@@ -5,6 +5,7 @@ import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.Map;
@@ -18,12 +19,17 @@ import java.util.Map;
 @Component
 public class FIRP0273 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
-            String newbornAge = firstpageStructureMap.get(Content.newbornAge);
-            if (!CatalogueUtil.isEmpty(newbornAge) && Integer.parseInt(newbornAge) <= 28){
+            String infantAgeMonths = firstpageStructureMap.get(Content.infantAgeMonths);
+            String infantAgeDays = firstpageStructureMap.get(Content.infantAgeDays);
+            if (StringUtil.isNotBlank(infantAgeMonths) && Integer.parseInt(infantAgeMonths) > 0) {
+                status.set("-1");
+            }
+            if (StringUtil.isNotBlank(infantAgeDays) && Integer.parseInt(infantAgeDays) > 28) {
                 //新生儿年龄单位为天,小于28天算通过
-                status.set("0");
+                status.set("-1");
             }
         }
     }

+ 5 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0274.java

@@ -22,8 +22,11 @@ public class FIRP0274 extends QCCatalogue {
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
             String age = firstpageStructureMap.get(Content.age);
-            String newbornAge = firstpageStructureMap.get(Content.newbornAge);
-            if (CatalogueUtil.isEmpty(age) && CatalogueUtil.isEmpty(newbornAge)) {
+            String infantAgeMonths = firstpageStructureMap.get(Content.infantAgeMonths);
+            String infantAgeDays = firstpageStructureMap.get(Content.infantAgeDays);
+            if (CatalogueUtil.isEmpty(age)
+                    && CatalogueUtil.isEmpty(infantAgeMonths)
+                    && CatalogueUtil.isEmpty(infantAgeDays)) {
                 status.set("-1");
             }
         }

+ 16 - 8
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0149.java

@@ -3,14 +3,19 @@ package com.lantone.qc.kernel.catalogue.leavehospital;
 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.LeaveHospitalDoc;
 import com.lantone.qc.pub.model.entity.Chief;
 import com.lantone.qc.pub.model.entity.General;
+import com.lantone.qc.pub.model.label.ChiefLabel;
 import com.lantone.qc.pub.model.label.LeaveHospitalLabel;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 出院记录内容缺主诉
@@ -22,16 +27,19 @@ public class LEA0149 extends QCCatalogue {
 
     @Override
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        LeaveHospitalLabel leaveHospitalLabel = inputInfo.getLeaveHospitalDoc().getLeaveHospitalLabel();
-        if (leaveHospitalLabel != null) {
-            List<Chief> chiefs = leaveHospitalLabel.getChiefs();
-            if (ListUtil.isNotEmpty(chiefs)) {
-                long count = chiefs.stream().filter(i -> i != null && StringUtil.isNotBlank(i.getName())).count();
-                if (count > 0) {
-                    status.set("0");
+        status.set("0");
+        LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
+        BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
+        if(leaveHospitalDoc != null && beHospitalizedDoc != null){
+            Map<String, String> lhStructureMap = leaveHospitalDoc.getStructureMap();
+            ChiefLabel chiefLabel = beHospitalizedDoc.getChiefLabel();
+            if(lhStructureMap != null && chiefLabel != null){
+                String bhChief = chiefLabel.getText();
+                String bhThings = lhStructureMap.get("入院情况");
+                if(bhThings.indexOf(bhChief)<0){
+                    status.set("-1");
                 }
             }
         }
     }
-
 }

+ 4 - 6
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0151.java

@@ -6,6 +6,7 @@ import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.entity.Diag;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -20,12 +21,9 @@ public class LEA0151 extends QCCatalogue {
 
     @Override
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        List<Diag> diags = inputInfo.getLeaveHospitalDoc().getBeHospitalizedLabel().getDiags();
-        if (ListUtil.isNotEmpty(diags)) {
-            long count = diags.stream().filter(i -> i != null && StringUtil.isNotBlank(i.getHospitalDiagName())).count();
-            if (count > 0) {
-                status.set("0");
-            }
+        String text = inputInfo.getLeaveHospitalDoc().getBeHospitalizedLabel().getText();
+        if(!StringUtils.isBlank(text)){
+            status.set("0");
         }
     }
 

+ 12 - 6
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0154.java

@@ -3,12 +3,16 @@ package com.lantone.qc.kernel.catalogue.leavehospital;
 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.LeaveHospitalDoc;
 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.util.StringUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 出院记录内容缺出院(死亡)诊断
@@ -20,13 +24,15 @@ public class LEA0154 extends QCCatalogue {
 
     @Override
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        List<Diag> diags = inputInfo.getLeaveHospitalDoc().getLeaveDiagLabel().getDiags();
-        if (ListUtil.isNotEmpty(diags)) {
-            long count = diags.stream().filter(i -> i != null && StringUtil.isNotBlank(i.getHospitalDiagName())).count();
-            if (count > 0) {
-                status.set("0");
+        status.set("0");
+        LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
+        if(leaveHospitalDoc != null){
+            DiagLabel leaveDiagLabel = leaveHospitalDoc.getLeaveDiagLabel();
+            if(leaveDiagLabel != null){
+                if(StringUtils.isBlank(leaveDiagLabel.getText())){
+                    status.set("-1");
+                }
             }
         }
     }
-
 }

+ 10 - 6
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0155.java

@@ -4,13 +4,16 @@ import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.LeaveHospitalDoc;
 import com.lantone.qc.pub.model.entity.DoctorAdvice;
 import com.lantone.qc.pub.model.label.LeaveHospitalLabel;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 出院记录内容缺出院医嘱
@@ -23,13 +26,14 @@ public class LEA0155 extends QCCatalogue {
     @Override
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
-        LeaveHospitalLabel leaveHospitalLabel = inputInfo.getLeaveHospitalDoc().getLeaveHospitalLabel();
-        if (leaveHospitalLabel != null) {
-            DoctorAdvice doctorAdvices = leaveHospitalLabel.getDoctorAdvices();
-            if (CatalogueUtil.isEmpty(doctorAdvices.getName())) {
-                status.set("-1");
+        LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
+        if(leaveHospitalDoc != null){
+            Map<String, String> structureMap = leaveHospitalDoc.getStructureMap();
+            if(structureMap != null){
+                if(StringUtils.isBlank(structureMap.get("出院医嘱"))){
+                    status.set("-1");
+                }
             }
         }
     }
-
 }

+ 11 - 9
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0156.java

@@ -3,13 +3,16 @@ package com.lantone.qc.kernel.catalogue.leavehospital;
 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.LeaveHospitalDoc;
 import com.lantone.qc.pub.model.entity.Notes;
 import com.lantone.qc.pub.model.label.LeaveHospitalLabel;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 出院记录内容缺出院注意事项
@@ -21,16 +24,15 @@ public class LEA0156 extends QCCatalogue {
 
     @Override
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        LeaveHospitalLabel leaveHospitalLabel = inputInfo.getLeaveHospitalDoc().getLeaveHospitalLabel();
-        if (leaveHospitalLabel != null) {
-            List<Notes> notes = leaveHospitalLabel.getNoteses();
-            if (ListUtil.isNotEmpty(notes)) {
-                long count = notes.stream().filter(i -> i != null && StringUtil.isNotBlank(i.getName())).count();
-                if (count > 0) {
-                    status.set("0");
+        status.set("0");
+        LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
+        if(leaveHospitalDoc != null){
+            Map<String, String> structureMap = leaveHospitalDoc.getStructureMap();
+            if(structureMap != null){
+                if(StringUtils.isBlank(structureMap.get("健康教育"))){
+                    status.set("-1");
                 }
             }
         }
     }
-
-}
+}

+ 48 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0323.java

@@ -0,0 +1,48 @@
+package com.lantone.qc.kernel.catalogue.operationdiscussion;
+
+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.operation.OperationDoc;
+import com.lantone.qc.pub.util.ListUtil;
+
+import java.text.ParseException;
+import java.util.List;
+
+/**
+ * @Description: 手术记录未由主刀或一助书写
+ * @author: Mark
+ * @time: 2020/04/04 11:22
+ */
+public class OPE0323 extends QCCatalogue {
+
+    @Override
+    protected void start(InputInfo inputInfo, OutputInfo outputInfo) throws ParseException {
+        status.set("0");
+        boolean isOperativePatient = true;//是手术患者(暂时默认是)
+        if (isOperativePatient) {
+            List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
+            if (ListUtil.isNotEmpty(operationDocs)) {
+                long count = operationDocs.stream().filter(operationDoc -> {
+                    boolean flag = false;
+                    if (operationDoc.getOperationRecordDoc() != null) {
+                        String surgeon = operationDoc.getOperationRecordDoc().getStructureMap().get("手术医师");
+                        String assist1 = operationDoc.getOperationRecordDoc().getStructureMap().get("助手I");
+                        String signature = operationDoc.getOperationRecordDoc().getStructureMap().get("主刀医师签名");
+
+                        String operator = surgeon + ", " + assist1;
+
+                        if (!operator.contains(signature)) {
+                            flag = true;
+                        }
+                    }
+                    return flag;
+                }).count();
+                if (count > 0) {
+                    status.set("-1");
+                }
+            }
+        }
+    }
+
+}

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0350.java

@@ -31,7 +31,7 @@ public class OPE0350 extends QCCatalogue {
                             || operationDoc.getOperationDiscussionDoc().getOperationDiscussionLabel().getOperativeFindings().length() < 30)) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0351.java

@@ -29,7 +29,7 @@ public class OPE0351 extends QCCatalogue {
                             && operationDoc.getOperationDiscussionDoc().getOperationDiscussionLabel().getVitals().size() == 0) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0352.java

@@ -30,7 +30,7 @@ public class OPE0352 extends QCCatalogue {
                             || operationDoc.getOperationDiscussionDoc().getOperationDiscussionLabel().getRiskAfterOp().length() < 10)) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0353.java

@@ -30,7 +30,7 @@ public class OPE0353 extends QCCatalogue {
                             || operationDoc.getOperationDiscussionDoc().getOperationDiscussionLabel().getMeasuresAfterOp().length() < 10)
                             || StringUtil.isBlank(operationDoc.getOperationDiscussionDoc().getOperationDiscussionLabel().getAttentionAfterOp())
                             || operationDoc.getOperationDiscussionDoc().getOperationDiscussionLabel().getAttentionAfterOp().length() < 10) {
-                        flag = true;
+                        flag = flag;
                     }
                     return true;
                 }).count();

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0355.java

@@ -30,7 +30,7 @@ public class OPE0355 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("手术名称"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0356.java

@@ -30,7 +30,7 @@ public class OPE0356 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("麻醉方式"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0357.java

@@ -30,7 +30,7 @@ public class OPE0357 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("术前诊断"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0358.java

@@ -30,7 +30,7 @@ public class OPE0358 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("术后诊断"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0359.java

@@ -30,7 +30,7 @@ public class OPE0359 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("手术经过"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0628.java

@@ -30,7 +30,7 @@ public class OPE0628 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("手术开始时间"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0629.java

@@ -30,7 +30,7 @@ public class OPE0629 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("手术结束时间"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0632.java

@@ -30,7 +30,7 @@ public class OPE0632 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("切口类别"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0634.java

@@ -30,7 +30,7 @@ public class OPE0634 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("术(中)后诊断"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0635.java

@@ -30,7 +30,7 @@ public class OPE0635 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("手术经过及处理(包括患者的体位、切口处理、病灶所见及手术步骤等)"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0636.java

@@ -30,7 +30,7 @@ public class OPE0636 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("手术医师"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0637.java

@@ -31,7 +31,7 @@ public class OPE0637 extends QCCatalogue {
                             || StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("助手II")))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0638.java

@@ -30,7 +30,7 @@ public class OPE0638 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("器械护士"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0639.java

@@ -30,7 +30,7 @@ public class OPE0639 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("巡回护士"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0640.java

@@ -30,7 +30,7 @@ public class OPE0640 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("麻醉医师"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0641.java

@@ -30,7 +30,7 @@ public class OPE0641 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("手术标本"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0643.java

@@ -30,7 +30,7 @@ public class OPE0643 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("冰冻切片结果"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0644.java

@@ -30,7 +30,7 @@ public class OPE0644 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("术中并发症"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0646.java

@@ -30,7 +30,7 @@ public class OPE0646 extends QCCatalogue {
                             && StringUtil.isBlank(operationDoc.getOperationRecordDoc().getStructureMap().get("输血情况"))) {
                         flag = true;
                     }
-                    return true;
+                    return flag;
                 }).count();
                 if (count > 0) {
                     status.set("-1");

+ 50 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0648.java

@@ -0,0 +1,50 @@
+package com.lantone.qc.kernel.catalogue.operationdiscussion;
+
+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.operation.OperationDoc;
+import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
+
+import java.text.ParseException;
+import java.util.List;
+
+/**
+ * @Description: 手术记录由非参加手术者书写
+ * @author: Mark
+ * @time: 2020/04/04 10:12
+ */
+public class OPE0648 extends QCCatalogue {
+
+    @Override
+    protected void start(InputInfo inputInfo, OutputInfo outputInfo) throws ParseException {
+        status.set("0");
+        boolean isOperativePatient = true;//是手术患者(暂时默认是)
+        if (isOperativePatient) {
+            List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
+            if (ListUtil.isNotEmpty(operationDocs)) {
+                long count = operationDocs.stream().filter(operationDoc -> {
+                    boolean flag = false;
+                    if (operationDoc.getOperationRecordDoc() != null) {
+                        String surgeon = operationDoc.getOperationRecordDoc().getStructureMap().get("手术医师");
+                        String assist1 = operationDoc.getOperationRecordDoc().getStructureMap().get("助手I");
+                        String asssit2 = operationDoc.getOperationRecordDoc().getStructureMap().get("助手II");
+                        String signature = operationDoc.getOperationRecordDoc().getStructureMap().get("主刀医师签名");
+
+                        String operator = surgeon + ", " + assist1 + ", " + asssit2;
+
+                        if (!operator.contains(signature)) {
+                            flag = true;
+                        }
+                    }
+                    return flag;
+                }).count();
+                if (count > 0) {
+                    status.set("-1");
+                }
+            }
+        }
+    }
+
+}

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0130.java

@@ -24,7 +24,8 @@ public class THR0130 extends QCCatalogue {
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
                         || !Content.indications.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
                     continue;
                 }

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0131.java

@@ -24,7 +24,8 @@ public class THR0131 extends QCCatalogue {
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
                         || !Content.indications.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
                     continue;
                 }

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0132.java

@@ -24,7 +24,8 @@ public class THR0132 extends QCCatalogue {
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
                         || !Content.indications.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
                     continue;
                 }

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0133.java

@@ -24,7 +24,8 @@ public class THR0133 extends QCCatalogue {
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
                         || !Content.indications.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
                     continue;
                 }

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0134.java

@@ -24,7 +24,8 @@ public class THR0134 extends QCCatalogue {
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
                         || !Content.indications.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
                     continue;
                 }

+ 2 - 6
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0135.java

@@ -1,7 +1,6 @@
 package com.lantone.qc.kernel.catalogue.threelevelward;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
-import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
@@ -10,11 +9,7 @@ import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * @ClassName : THR0135
@@ -29,7 +24,8 @@ public class THR0135 extends QCCatalogue {
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
                         || !Content.director.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
                     continue;
                 }

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0136.java

@@ -24,7 +24,8 @@ public class THR0136 extends QCCatalogue {
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
                         || !Content.director.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
                     continue;
                 }

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0137.java

@@ -24,7 +24,8 @@ public class THR0137 extends QCCatalogue {
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
                         || !Content.director.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
                     continue;
                 }

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0138.java

@@ -24,7 +24,8 @@ public class THR0138 extends QCCatalogue {
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
                         || !Content.director.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
                     continue;
                 }

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0139.java

@@ -24,7 +24,8 @@ public class THR0139 extends QCCatalogue {
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
                         || !Content.director.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
                     continue;
                 }

+ 6 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0429.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.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
@@ -20,10 +21,14 @@ import java.util.List;
 public class THR0429 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        if (ListUtil.isEmpty(inputInfo.getDifficultCaseDiscussDocs())) {
+            return;
+        }
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (threeLevelWardDoc.getThreeLevelWardLabel().getSerious() != 2) {
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || threeLevelWardDoc.getThreeLevelWardLabel().getSerious() != 2) {
                     continue;
                 }
                 ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();

+ 6 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0430.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.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
@@ -20,10 +21,14 @@ import java.util.List;
 public class THR0430 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        if (ListUtil.isEmpty(inputInfo.getRescueDocs())) {
+            return;
+        }
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (threeLevelWardDoc.getThreeLevelWardLabel().getSerious() != 3) {
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || threeLevelWardDoc.getThreeLevelWardLabel().getSerious() != 3) {
                     continue;
                 }
                 ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();

+ 6 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0431.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.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.ListUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -19,10 +20,14 @@ import java.util.List;
 public class THR0431 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        if (ListUtil.isEmpty(inputInfo.getSeriouslyIllNoticeDocs())) {
+            return;
+        }
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (threeLevelWardDoc.getThreeLevelWardLabel().getSerious() != 1) {
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || threeLevelWardDoc.getThreeLevelWardLabel().getSerious() != 1) {
                     continue;
                 }
                 ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();

+ 6 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0432.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.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.ListUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -19,10 +20,14 @@ import java.util.List;
 public class THR0432 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        if (ListUtil.isEmpty(inputInfo.getDifficultCaseDiscussDocs())) {
+            return;
+        }
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (threeLevelWardDoc.getThreeLevelWardLabel().getSerious() != 2) {
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || threeLevelWardDoc.getThreeLevelWardLabel().getSerious() != 2) {
                     continue;
                 }
                 ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();

+ 6 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0433.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.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.ListUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -19,10 +20,14 @@ import java.util.List;
 public class THR0433 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        if (ListUtil.isEmpty(inputInfo.getRescueDocs())) {
+            return;
+        }
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
-                if (threeLevelWardDoc.getThreeLevelWardLabel().getSerious() != 3) {
+                if (threeLevelWardDoc.getThreeLevelWardLabel() == null
+                        || threeLevelWardDoc.getThreeLevelWardLabel().getSerious() != 3) {
                     continue;
                 }
                 ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0435.java

@@ -7,6 +7,7 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.DifficultCaseDiscussDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
@@ -27,7 +28,7 @@ import java.util.TreeMap;
 public class THR0435 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
-        if (inputInfo.getDifficultCaseDiscussDocs().size() == 0 || inputInfo.getThreeLevelWardDocs().size() == 0) {
+        if (ListUtil.isEmpty(inputInfo.getDifficultCaseDiscussDocs()) || ListUtil.isEmpty(inputInfo.getThreeLevelWardDocs())) {
             return;
         }
         List<DifficultCaseDiscussDoc> difficultCaseDiscussDocs = inputInfo.getDifficultCaseDiscussDocs(); //疑难病例讨论记录

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0436.java

@@ -7,6 +7,7 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.RescueDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
@@ -27,7 +28,7 @@ import java.util.TreeMap;
 public class THR0436 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
-        if (inputInfo.getRescueDocs().size() == 0 || inputInfo.getThreeLevelWardDocs().size() == 0) {
+        if (ListUtil.isEmpty(inputInfo.getRescueDocs()) || ListUtil.isEmpty(inputInfo.getThreeLevelWardDocs())) {
             return;
         }
         List<RescueDoc> rescueDocs = inputInfo.getRescueDocs(); //抢救记录

+ 2 - 2
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/BeHospitalizedAI.java

@@ -333,11 +333,11 @@ public class BeHospitalizedAI extends ModelAI {
         inputInfo.getBeHospitalizedDoc().setRevisedDiagLabel(revisedDiagLabel);
 
         //替换初步诊断中的第一个诊断信息
-        DiagLabel initialDiagLabel = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel();
+       /* DiagLabel initialDiagLabel = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel();
         if (initialDiagLabel.getDiags().size() > 0 && diags.size() > 0) {
             initialDiagLabel.getDiags().remove(0);
             initialDiagLabel.getDiags().add(0, diags.get(0));
-        }
+        }*/
     }
 
     /**

+ 36 - 10
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java

@@ -54,8 +54,10 @@ public class ThreeLevelWardAI extends ModelAI {
             putContent(crfContent, medicalTextType.get(0), firstWardRecord.get(Content.director).get("病情记录"), Content.director);
         }
         Map<String, String> lastCourseRecord = getLastCourseRecord(threeLevelWardDocs);
-        //主任医师最后一次查房记录
-        putContent(crfContent, medicalTextType.get(1), lastCourseRecord.get("病情记录"), "最后一次" + Content.director);
+        if (lastCourseRecord != null && lastCourseRecord.containsKey("病情记录")) {
+            //主任医师最后一次查房记录
+            putContent(crfContent, medicalTextType.get(1), lastCourseRecord.get("病情记录"), Content.director + "最后一次");
+        }
 
         List<Map<String, String>> directorDifficultRecord = new ArrayList<>();
         //疑难患者副高及以上查房记录
@@ -84,7 +86,10 @@ public class ThreeLevelWardAI extends ModelAI {
         if (midData.get(Content.director) != null) {
             putWardRoundCrfData(midData.getJSONObject(Content.director), inputInfo, Content.director, 0);//查房记录
         }
-        putWardRoundCrfData(midData.getJSONObject("最后一次" + Content.director), inputInfo, "最后一次" + Content.director, 0);//最后一次查房记录
+        //主任医师最后一次查房记录模型输出
+        if (midData.get(Content.director + "最后一次") != null) {
+            putWardRoundCrfData(midData.getJSONObject(Content.director + "最后一次"), inputInfo, Content.director + "最后一次", 0);//最后一次查房记录
+        }
         //疑难患者副高及以上查房记录模型输出
         if (inputInfo.getDifficultCaseDiscussDocs().size() > 0 && ListUtil.isNotEmpty(directorDifficultRecord)) {
             for (int i = 0; i < directorDifficultRecord.size(); i++) {
@@ -106,6 +111,19 @@ public class ThreeLevelWardAI extends ModelAI {
 
     }
 
+    protected void putContent(JSONArray crfContent, String medicalTextType, String text, String sign) {
+        String move_text = CatalogueUtil.removeSpecialChar(text);
+        if (StringUtil.isEmpty(move_text)) {
+            return;
+        }
+        JSONObject detailContent = new JSONObject();
+        detailContent.put("medical_text_type", medicalTextType);
+        detailContent.put("content", move_text);
+        detailContent.put("detail_title", sign);
+        detailContent.put("originalText", text);
+        crfContent.add(detailContent);
+    }
+
     /**
      * 处理查房记录
      *
@@ -114,15 +132,20 @@ public class ThreeLevelWardAI extends ModelAI {
      */
     public void putWardRoundCrfData(JSONObject jsonObject, InputInfo inputInfo, String detailTitle, int serious) {
         JSONObject aiOut = loadEntity(jsonObject, entityRelationObject, outputs, content);
+        String originalText = jsonObject.getString("originalText");
         //使用现病史结构来处理病历特点
         EntityProcessThreeLevelWard entityProcessThreeLevelWard = new EntityProcessThreeLevelWard();
         ThreeLevelWardLabel threeLevelWardLabel = entityProcessThreeLevelWard.extractEntity(aiOut);
         threeLevelWardLabel.setTitle(detailTitle);
         threeLevelWardLabel.setSerious(serious);
-        ThreeLevelWardDoc threeLevelWardDoc = new ThreeLevelWardDoc();
-        threeLevelWardDoc.setThreeLevelWardLabel(threeLevelWardLabel);
-        //临床表现
-        inputInfo.getThreeLevelWardDocs().add(threeLevelWardDoc);
+        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+        for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+            String text = threeLevelWardDoc.getText();
+            if (StringUtil.isNotBlank(text) && StringUtil.isNotBlank(originalText) && text.equals(originalText)) {
+                threeLevelWardDoc.setThreeLevelWardLabel(threeLevelWardLabel);
+                break;
+            }
+        }
     }
 
     /**
@@ -132,7 +155,7 @@ public class ThreeLevelWardAI extends ModelAI {
      * @param threeLevelWardDocs
      * @return
      */
-    private List<Map<String, String>> putDirectorDifficultRecord(InputInfo inputInfo, List<ThreeLevelWardDoc> threeLevelWardDocs) {
+    public List<Map<String, String>> putDirectorDifficultRecord(InputInfo inputInfo, List<ThreeLevelWardDoc> threeLevelWardDocs) {
         List<Map<String, String>> record = new ArrayList<>();
         List<DifficultCaseDiscussDoc> difficultCaseDiscussDocs = inputInfo.getDifficultCaseDiscussDocs(); //疑难病例讨论记录
         Map<Date, Map<String, String>> dateRecord = new TreeMap<>(new Comparator<Date>() {
@@ -195,7 +218,7 @@ public class ThreeLevelWardAI extends ModelAI {
      * @param threeLevelWardDocs
      * @return
      */
-    private List<Map<String, String>> putDirectorRescueRecord(InputInfo inputInfo, List<ThreeLevelWardDoc> threeLevelWardDocs) {
+    public List<Map<String, String>> putDirectorRescueRecord(InputInfo inputInfo, List<ThreeLevelWardDoc> threeLevelWardDocs) {
         List<Map<String, String>> record = new ArrayList<>();
         List<RescueDoc> rescueDocs = inputInfo.getRescueDocs(); //抢救记录
         Map<Date, Map<String, String>> dateRecord = new TreeMap<>(new Comparator<Date>() {
@@ -281,7 +304,7 @@ public class ThreeLevelWardAI extends ModelAI {
      * @param threeLevelWardDocs
      * @return
      */
-    private Map<String, String> getLastCourseRecord(List<ThreeLevelWardDoc> threeLevelWardDocs) {
+    public Map<String, String> getLastCourseRecord(List<ThreeLevelWardDoc> threeLevelWardDocs) {
         Map<Date, Map<String, String>> dateRecord = new TreeMap<>(new Comparator<Date>() {
             @Override
             public int compare(Date o1, Date o2) {
@@ -301,6 +324,9 @@ public class ThreeLevelWardAI extends ModelAI {
             dateRecord.put(recordDate, rescueStructureMap);
         }
         List<Map<String, String>> dateRecordList = new ArrayList<>(dateRecord.values());
+        if (ListUtil.isEmpty(dateRecordList)) {
+            return null;
+        }
         return dateRecordList.get(0);
     }
 }

+ 8 - 9
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessThreeLevelWard.java

@@ -65,9 +65,8 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
             //补充诊断/初步诊断/修正诊断
             addDiag(threeLevelWardLabel, diffDiagSplit, diagLemmas);
             //添加鉴别诊断
-            List<Lemma> dieaseLemmas = createEntityTree(aiOut, EntityEnum.DIEASE.toString());
             List<Diag> diags = new ArrayList<>();
-            for (Lemma dieaseLemma : dieaseLemmas) {
+            for (Lemma dieaseLemma : diagLemmas) {
                 if (Integer.parseInt(dieaseLemma.getPosition()) < Integer.parseInt(diffDiagSplit[0])
                         || Integer.parseInt(dieaseLemma.getPosition()) > Integer.parseInt(diffDiagSplit[diffDiagSplit.length - 1])) {
                     continue;
@@ -173,25 +172,25 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
         String subContentIndex = "", title = "";
         for (int i = 0; i < lemmaList.size(); i++) {
             lemma = lemmaList.get(i);
-            if (!titleList.contains(lemma.getProperty()) && i != lemmaList.size() - 1) {
+            if (!titleList.contains(lemma.getProperty())) {
                 continue;
             }
             if (i != lemmaList.size() - 1) {
                 if (start == 0) {
                     start = Integer.parseInt(lemma.getPosition());
-                    title = lemma.getText();//截取的这一段文本的标题
+                    title = lemma.getProperty();//截取的这一段文本的标题
                 } else {
                     //subContent = content.substring(start + title.length(), Integer.parseInt(lemma.getPosition()));
-                    subContentIndex = start + title.length() + "," + Integer.parseInt(lemma.getPosition());
+                    subContentIndex = start + lemma.getText().length() + 1 + "," + Integer.parseInt(lemma.getPosition());
                     putSubContent(titleText, title, subContentIndex);
                     start = Integer.parseInt(lemma.getPosition());
-                    title = lemma.getText();//截取的这一段文本的标题
+                    title = lemma.getProperty();//截取的这一段文本的标题
                 }
             } else {
                 //如果是最后一个Lemma,文本就从start开始取,取到结束
                 //subContent = content.substring((start + lemma.getText().length()));
                 int lastIndex = content.length() - 1;
-                subContentIndex = start + title.length() + "," + lastIndex;
+                subContentIndex = start + lemma.getText().length() + "," + lastIndex;
                 putSubContent(titleText, title, subContentIndex);
             }
         }
@@ -220,7 +219,7 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
         List<Clinical> clinicals = new ArrayList<>();
         for (Lemma lemma : clinicalLemmas) {
             if (Integer.parseInt(lemma.getPosition()) > Integer.parseInt(indexArray[0])
-                    || Integer.parseInt(lemma.getPosition()) < Integer.parseInt(indexArray[indexArray.length - 1])) {
+                    && Integer.parseInt(lemma.getPosition()) < Integer.parseInt(indexArray[indexArray.length - 1])) {
                 continue;
             }
             Clinical clinical = new Clinical();
@@ -245,7 +244,7 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
         List<Diag> diags = new ArrayList<>();
         for (Lemma lemma : diagLemmas) {
             if (Integer.parseInt(lemma.getPosition()) > Integer.parseInt(indexArray[0])
-                    || Integer.parseInt(lemma.getPosition()) < Integer.parseInt(indexArray[indexArray.length - 1])) {
+                    && Integer.parseInt(lemma.getPosition()) < Integer.parseInt(indexArray[indexArray.length - 1])) {
                 continue;
             }
             Diag diag = new Diag();

+ 300 - 0
kernel/src/main/java/com/lantone/qc/kernel/util/ModelDataUtil.java

@@ -0,0 +1,300 @@
+package com.lantone.qc.kernel.util;
+
+import com.lantone.qc.kernel.structure.ai.ThreeLevelWardAI;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.jdbc.MysqlJdbc;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
+import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
+import com.lantone.qc.pub.model.doc.LeaveHospitalDoc;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.doc.operation.OperationDiscussionDoc;
+import com.lantone.qc.pub.model.doc.operation.OperationDoc;
+import com.lantone.qc.pub.model.vo.QueryVo;
+import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.PropertiesUtil;
+import com.lantone.qc.pub.util.StringUtil;
+import com.lantone.qc.trans.TransDispatch;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 长兴医院进模型数据
+ * @Author: HUJING
+ * @Date: 2020/4/1 17:23
+ */
+public class ModelDataUtil {
+    private Logger logger = LoggerFactory.getLogger(ModelDataUtil.class);
+
+    public void executor(String caseNumber, QueryVo queryVo) {
+        InputInfo inputInfo = TransDispatch.trans(queryVo);
+        if (inputInfo == null) {
+            return;
+        }
+        Map<String, Map<String, String>> changxDocs = new LinkedHashMap<>();
+        beHospitalized(inputInfo, changxDocs, "入院记录");
+        firstCourseRecord(inputInfo, changxDocs, "首次病程录");
+        operationDiscussion(inputInfo, changxDocs, "术后首次病程及谈话记录文档");
+        threeLevelWard(inputInfo, changxDocs, "三级查房记录");
+        //        leaveHospital(inputInfo, changxDocs, "出院小结");
+        insertDB(caseNumber, changxDocs);
+    }
+
+    public void insertDB(String caseNumber, Map<String, Map<String, String>> changxDocs) {
+        PropertiesUtil propertiesUtil = new PropertiesUtil("kernel.properties");
+        MysqlJdbc mysqlJdbc = new MysqlJdbc(propertiesUtil.getProperty("mysql.test.user"),
+                propertiesUtil.getProperty("mysql.test.password"),
+                propertiesUtil.getProperty("mysql.test.url"));
+        Connection connect = null;
+        PreparedStatement pst = null;
+        String sql = "INSERT INTO qc_model_input_info(case_number,title,sub_title,text) VALUES(?,?,?,?)";
+        try {
+            connect = mysqlJdbc.connect();
+            connect.setAutoCommit(false);
+            pst = connect.prepareStatement(sql);
+            for (Map.Entry<String, Map<String, String>> changxDoc : changxDocs.entrySet()) {
+                int i = 0;
+                String model = changxDoc.getKey();
+                for (Map.Entry<String, String> doc : changxDoc.getValue().entrySet()) {
+                    pst.setString(1, caseNumber);
+                    pst.setString(2, model);
+                    pst.setString(3, doc.getKey());
+                    pst.setString(4, doc.getValue());
+                    pst.addBatch();
+                    i++;
+                    if ((i != 0 && i % 1000 == 0) || i == changxDoc.getValue().size()) {
+                        pst.executeBatch();
+                        connect.commit();
+                        pst.clearBatch();
+                    }
+                }
+            }
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+        } finally {
+            try {
+                pst.close();
+                connect.close();
+            } catch (SQLException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public void truncateDB(String dbName) {
+        PropertiesUtil propertiesUtil = new PropertiesUtil("kernel.properties");
+        MysqlJdbc mysqlJdbc = new MysqlJdbc(propertiesUtil.getProperty("mysql.test.user"),
+                propertiesUtil.getProperty("mysql.test.password"),
+                propertiesUtil.getProperty("mysql.test.url"));
+        Connection connect = null;
+        PreparedStatement pst = null;
+        String sql = "TRUNCATE " + dbName;
+        try {
+            connect = mysqlJdbc.connect();
+            pst = connect.prepareStatement(sql);
+            pst.execute();
+            logger.info(dbName + "表已清空");
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+        } finally {
+            try {
+                pst.close();
+                connect.close();
+            } catch (SQLException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * 入院记录
+     *
+     * @param inputInfo
+     * @param changxDocs
+     * @param model
+     */
+    public void beHospitalized(InputInfo inputInfo, Map<String, Map<String, String>> changxDocs, String model) {
+        if (inputInfo == null) {
+            return;
+        }
+        BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
+        if (beHospitalizedDoc != null) {
+            Map<String, String> changxDoc = new LinkedHashMap<>();
+            String chiefText = beHospitalizedDoc.getChiefLabel().getText();
+            String presentText = beHospitalizedDoc.getPresentLabel().getText();
+            String pastText = beHospitalizedDoc.getPastLabel().getText();
+            String personalText = beHospitalizedDoc.getPersonalLabel().getText();
+            String familyText = beHospitalizedDoc.getFamilyLabel().getText();
+            String pacsText = beHospitalizedDoc.getPacsLabel().getText();
+            String initialDiagText = beHospitalizedDoc.getInitialDiagLabel().getText();   //初步诊断
+            String revisedDiagText = beHospitalizedDoc.getRevisedDiagLabel().getText();   //修正诊断
+            String suppleDiagText = beHospitalizedDoc.getSuppleDiagLabel().getText();    //补充诊断
+            String menstrualText = beHospitalizedDoc.getMenstrualLabel().getText();    //月经史
+            String maritalText = beHospitalizedDoc.getMaritalLabel().getText();    //婚育史
+            String vitalText = beHospitalizedDoc.getVitalLabel().getText();        //一般体格检查
+            String vitalSpecialText = beHospitalizedDoc.getVitalLabelSpecial().getText();  //专科体格检查
+            putDoc(changxDoc, Content.chief, chiefText);
+            putDoc(changxDoc, Content.present, presentText);
+            putDoc(changxDoc, Content.past, pastText);
+            putDoc(changxDoc, Content.personal, personalText);
+            putDoc(changxDoc, Content.family, familyText);
+            putDoc(changxDoc, Content.pacs, pacsText);
+            putDoc(changxDoc, Content.initial_diag, initialDiagText);
+            putDoc(changxDoc, Content.revised_diag, revisedDiagText);
+            putDoc(changxDoc, Content.supple_diag, suppleDiagText);
+            putDoc(changxDoc, Content.menses, menstrualText);
+            putDoc(changxDoc, Content.marriage, maritalText);
+            putDoc(changxDoc, Content.phys_exam, vitalText);
+            putDoc(changxDoc, Content.special_exam, vitalSpecialText);
+            changxDocs.put(model, changxDoc);
+        }
+    }
+
+    /**
+     * 首次病程录
+     *
+     * @param inputInfo
+     * @param changxDocs
+     * @param model
+     */
+    public void firstCourseRecord(InputInfo inputInfo, Map<String, Map<String, String>> changxDocs, String model) {
+        if (inputInfo == null) {
+            return;
+        }
+        FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
+        if (firstCourseRecordDoc != null) {
+            Map<String, String> changxDoc = new LinkedHashMap<>();
+            //病历特点
+            putDoc(changxDoc, Content.case_feature, firstCourseRecordDoc.getCaseCharacteristicLabel().getText());
+            //初步诊断
+            putDoc(changxDoc, Content.initial_diag, firstCourseRecordDoc.getInitialDiagLabel().getText());
+            //诊断依据
+            putDoc(changxDoc, Content.diag_basis, firstCourseRecordDoc.getDiagnosisLabel().getText());
+            //鉴别诊断
+            putDoc(changxDoc, Content.differential_diag_basis, firstCourseRecordDoc.getDifferentialDiagLabel().getText());
+            //诊疗计划
+            putDoc(changxDoc, Content.treat_plan, firstCourseRecordDoc.getTreatPlanLabel().getText());
+            changxDocs.put(model, changxDoc);
+        }
+    }
+
+    /**
+     * 术后首次病程及谈话记录文档
+     *
+     * @param inputInfo
+     * @param changxDocs
+     * @param model
+     */
+    public void operationDiscussion(InputInfo inputInfo, Map<String, Map<String, String>> changxDocs, String model) {
+        if (inputInfo == null) {
+            return;
+        }
+        List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
+        if (ListUtil.isEmpty(operationDocs)) {
+            return;
+        }
+        Map<String, String> changxDoc = new LinkedHashMap<>();
+        for (int i = 0; i < operationDocs.size(); i++) {
+            if (operationDocs.get(i).getOperationDiscussionDoc() == null) {
+                continue;
+            }
+            OperationDiscussionDoc operationDiscussionDoc = operationDocs.get(i).getOperationDiscussionDoc();
+            putDoc(changxDoc, Content.operation_Discussion + i, operationDiscussionDoc.getText());
+        }
+        changxDocs.put(model, changxDoc);
+    }
+
+    /**
+     * 查房记录
+     *
+     * @param inputInfo
+     * @param changxDocs
+     * @param model
+     */
+    public void threeLevelWard(InputInfo inputInfo, Map<String, Map<String, String>> changxDocs, String model) {
+        if (inputInfo == null) {
+            return;
+        }
+        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+        if (threeLevelWardDocs.size() == 0) {
+            return;
+        }
+        ThreeLevelWardAI threeLevelWardAI = new ThreeLevelWardAI();
+        Map<String, String> changxDoc = new LinkedHashMap<>();
+        //主治/主任首次查房记录
+        Map<String, Map<String, String>> firstWardRecord = CatalogueUtil.extractWardRecord(threeLevelWardDocs);
+        //主治医师首次查房记录
+        if (firstWardRecord.get(Content.indications) != null) {
+            putDoc(changxDoc, Content.indications + "首次查房记录", firstWardRecord.get(Content.indications).get("病情记录"));
+        }
+        //主任医师首次查房记录
+        if (firstWardRecord.get(Content.director) != null) {
+            putDoc(changxDoc, Content.director + "首次查房记录", firstWardRecord.get(Content.director).get("病情记录"));
+        }
+
+        Map<String, String> lastCourseRecord = threeLevelWardAI.getLastCourseRecord(threeLevelWardDocs);
+        if (lastCourseRecord != null && lastCourseRecord.containsKey("病情记录")) {
+            //主任医师最后一次查房记录
+            putDoc(changxDoc, Content.director + "末次查房记录", lastCourseRecord.get("病情记录"));
+        }
+
+        List<Map<String, String>> directorDifficultRecord = new ArrayList<>();
+        //疑难患者副高及以上查房记录
+        if (inputInfo.getDifficultCaseDiscussDocs().size() > 0) {
+            directorDifficultRecord = threeLevelWardAI.putDirectorDifficultRecord(inputInfo, threeLevelWardDocs);
+            for (int i = 0; i < directorDifficultRecord.size(); i++) {
+                putDoc(changxDoc, Content.difficultPatients + i, directorDifficultRecord.get(i).get("病情记录"));
+            }
+        }
+        List<Map<String, String>> directorRescueRecord = new ArrayList<>();
+        //抢救患者副高及以上查房记录
+        if (inputInfo.getRescueDocs().size() > 0) {
+            directorRescueRecord = threeLevelWardAI.putDirectorRescueRecord(inputInfo, threeLevelWardDocs);
+            for (int i = 0; i < directorRescueRecord.size(); i++) {
+                putDoc(changxDoc, Content.rescuingPatients + i, directorRescueRecord.get(i).get("病情记录"));
+            }
+        }
+        changxDocs.put(model, changxDoc);
+    }
+
+    /**
+     * 出院小结
+     *
+     * @param inputInfo
+     * @param changxDocs
+     * @param model
+     */
+    public void leaveHospital(InputInfo inputInfo, Map<String, Map<String, String>> changxDocs, String model) {
+        if (inputInfo == null) {
+            return;
+        }
+        LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
+        if (leaveHospitalDoc != null) {
+            Map<String, String> changxDoc = new LinkedHashMap<>();
+            putDoc(changxDoc, Content.discharge, leaveHospitalDoc.getText());
+            changxDocs.put(model, changxDoc);
+        }
+    }
+
+    private void putDoc(Map<String, String> changxDoc, String title, String content) {
+        if (StringUtil.isEmpty(content)) {
+            return;
+        }
+        if (title.contains("、")) {
+            title = title.split("、")[1];
+        }
+        if (changxDoc.containsKey(title)) {
+            logger.info(title + "已存在");
+            return;
+        }
+        changxDoc.put(title, content);
+    }
+}

+ 12 - 7
kernel/src/main/java/com/lantone/qc/kernel/web/controller/QCTestController.java

@@ -3,10 +3,10 @@ package com.lantone.qc.kernel.web.controller;
 import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.analysis.QCAnalysis;
 import com.lantone.qc.kernel.util.CacheFileManager;
+import com.lantone.qc.kernel.util.ModelDataUtil;
 import com.lantone.qc.kernel.util.KernelConstants;
 import com.lantone.qc.pub.jdbc.MysqlJdbc;
 import com.lantone.qc.pub.model.OutputInfo;
-import com.lantone.qc.pub.model.entity.Lis;
 import com.lantone.qc.pub.model.vo.MedrecVo;
 import com.lantone.qc.pub.model.vo.QueryVo;
 import com.lantone.qc.pub.res.Response;
@@ -41,6 +41,7 @@ public class QCTestController {
     private QCAnalysis qCAnalysis;
 
     private Map<String, List<String>> inputLabelMap = new HashMap<>();
+
     {
         inputLabelMap.put("入院记录", Lists.newArrayList("姓名", "性别", "年龄", "民族", "职业", "出生地", "婚姻", "联系地址", "病史陈述者", "出生日期", "户口地址", "电话", "入院日期", "记录日期", "主诉", "现病史", "既往史", "个人史", "婚育史", "月经史", "家族史", "体格检查(一)", "体格检查(二)", "辅助检查", "初步诊断", "修正诊断", "医师签名", "补充诊断"));
     }
@@ -57,13 +58,16 @@ public class QCTestController {
         }
         //key = 患者就诊号
         Map<String, QueryVo> queryVoMap = createQueryVo(cid, hospitalId, caseNumber);
+//        ModelDataUtil modelDataUtil = new ModelDataUtil();
         //key = 患者就诊号
         Map<String, Map<String, String>> inputCaseMappingMap = createInputCaseMapping(hospitalId, caseNumber);
 
         List<Map<String, Object>> updates = new ArrayList<>();
         List<Map<String, Object>> wheres = new ArrayList<>();
+//        modelDataUtil.truncateDB("qc_model_input_info");//清空表
         for (Map.Entry<String, QueryVo> entry : queryVoMap.entrySet()) {
             System.out.println("患者就诊号:" + entry.getKey() + "..........");
+//            modelDataUtil.executor(entry.getKey(), entry.getValue());//AI所需模块数据存入DB
             OutputInfo outputInfo = qCAnalysis.anlysis(entry.getValue());
 
             Map<String, String> passMap = inputCaseMappingMap.get(entry.getKey());
@@ -135,7 +139,7 @@ public class QCTestController {
                 r1 = rs.getString(1);
                 r2 = rs.getString(2);
                 Map<String, String> m = new HashMap<>();
-                m.put("precond","");
+                m.put("precond", "");
                 m.put("name", r2);
                 m.put("code", r1);
                 inputCatalogueMap.put(r1, m);
@@ -238,7 +242,7 @@ public class QCTestController {
             st = conn.createStatement();
             String sql = "SELECT qim.id, q.case_number, qc.code FROM qc_inputcases_mapping_all qim, qc_cases_number q, qc_cases_entry qc " +
                     "where qim.case_number_id = q.id and qim.cases_entry_id = qc.id and q.is_deleted = 'N' " +
-                    "and q.hospital_id = " + hospitalId ;
+                    "and q.hospital_id = " + hospitalId;
             if (StringUtils.isNotEmpty(caseNumber)) {
                 sql = sql + " and q.case_number = '" + caseNumber + "' ";
             }
@@ -322,8 +326,10 @@ public class QCTestController {
             List<String> caseList = new ArrayList<>();
             List<Map<String, String>> updateList = new ArrayList<>();
             List<String> textIdList = new ArrayList<>();
-            String textId = ""; int index = 0;
-            String text = ""; String caseName = "";
+            String textId = "";
+            int index = 0;
+            String text = "";
+            String caseName = "";
             while (rs.next()) {
                 r1 = rs.getString(1);
                 r2 = rs.getString(2);
@@ -365,7 +371,7 @@ public class QCTestController {
                 Map<String, Object> content = new HashMap<>();
                 content.put("content", textList.get(i));
                 medrecVo.setContent(content);
-                if (caseList.get(i).equals("入院记录")){
+                if (caseList.get(i).equals("入院记录")) {
                     medrecVo.setLabel(Lists.newArrayList("姓名", "性别", "年龄", "民族", "职业", "出生地", "婚姻", "联系地址", "病史陈述者", "出生日期", "户口地址", "电话", "入院日期", "记录日期", "主诉", "现病史", "既往史", "个人史", "婚育史", "月经史", "家族史", "体格检查(一)", "体格检查(二)", "辅助检查", "初步诊断", "修正诊断", "医师签名", "补充诊断"));
                 }
 
@@ -400,7 +406,6 @@ public class QCTestController {
             mysqlJdbc.update("qc_inputcases_mapping_all", updates, wheres);
 
 
-
             CacheFileManager cacheFileManager = new CacheFileManager();
             cacheFileManager.insertFeature(KernelConstants.clinicModificationList, "kl_modification", "name");
             cacheFileManager.insertFeature(KernelConstants.clinicNameList, "kl_clinic", "name");

+ 5 - 4
public/src/main/java/com/lantone/qc/pub/Content.java

@@ -128,13 +128,14 @@ public class Content {
     public static final String age = "年龄";
     public static final String nationality = "国籍";
     public static final String birth_date = "出生日期";
-    public static final String newbornAge = "不足1周岁年龄";
-    public static final String newbornWeight = "新生儿出生体重";
-    public static final String newbornAdmisWeight = "新生儿入院体重";
+    public static final String infantAgeMonths = "婴儿年龄月数";
+    public static final String infantAgeDays = "婴儿年龄天数";
+    public static final String newbornWeight = "婴儿出生体重";
+    public static final String newbornAdmisWeight = "婴儿入院体重";
     public static final String birth_address = "出生地";
     public static final String native_place = "籍贯";
     public static final String nation = "民族";
-    public static final String idcardInfo = "身份证号";
+    public static final String idNumber = "身份证号";
     public static final String job = "职业";
     public static final String marry = "婚姻";
     public static final String current_address = "现住址";