Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

wangyu vor 5 Jahren
Ursprung
Commit
8fcfd19aac
34 geänderte Dateien mit 456 neuen und 73 gelöschten Zeilen
  1. 10 9
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0149.java
  2. 4 6
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0151.java
  3. 8 6
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0154.java
  4. 6 5
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0155.java
  5. 9 10
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0156.java
  6. 48 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0323.java
  7. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0350.java
  8. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0351.java
  9. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0352.java
  10. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0353.java
  11. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0355.java
  12. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0356.java
  13. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0357.java
  14. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0358.java
  15. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0359.java
  16. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0628.java
  17. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0629.java
  18. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0632.java
  19. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0634.java
  20. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0635.java
  21. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0636.java
  22. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0637.java
  23. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0638.java
  24. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0639.java
  25. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0640.java
  26. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0641.java
  27. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0643.java
  28. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0644.java
  29. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0646.java
  30. 50 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0648.java
  31. 2 2
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/BeHospitalizedAI.java
  32. 10 5
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java
  33. 275 0
      kernel/src/main/java/com/lantone/qc/kernel/util/ModelDataUtil.java
  34. 11 7
      kernel/src/main/java/com/lantone/qc/kernel/web/controller/QCTestController.java

+ 10 - 9
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0149.java

@@ -11,6 +11,7 @@ import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 出院记录内容缺主诉
@@ -22,16 +23,16 @@ 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");
+        try {
+            Map<String, String> lhStructureMap = inputInfo.getLeaveHospitalDoc().getStructureMap();
+            String bhChief = inputInfo.getBeHospitalizedDoc().getChiefLabel().getText();
+            String bhThings = lhStructureMap.get("入院情况");
+            if(bhThings.indexOf(bhChief)<0){
+                status.set("-1");
             }
+        }catch (Exception e){
+            e.printStackTrace();
         }
     }
-
 }

+ 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");
         }
     }
 

+ 8 - 6
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0154.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,13 +21,14 @@ 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");
+        try{
+            String text = inputInfo.getLeaveHospitalDoc().getLeaveDiagLabel().getText();
+            if(StringUtils.isBlank(text)){
+                status.set("-1");
             }
+        }catch (Exception e){
+            e.printStackTrace();
         }
     }
-
 }

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

@@ -8,6 +8,7 @@ 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;
@@ -23,13 +24,13 @@ 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())) {
+        try {
+            String leaveAdvice = inputInfo.getLeaveHospitalDoc().getStructureMap().get("出院医嘱");
+            if(StringUtils.isBlank(leaveAdvice)){
                 status.set("-1");
             }
+        }catch (Exception e){
+            e.printStackTrace();
         }
     }
-
 }

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

@@ -7,6 +7,7 @@ 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;
@@ -21,16 +22,14 @@ 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");
+        try {
+            String healthyEducation = inputInfo.getLeaveHospitalDoc().getStructureMap().get("健康教育");
+            if(StringUtils.isBlank(healthyEducation)){
+                status.set("-1");
             }
+        }catch (Exception e){
+            e.printStackTrace();
+        }
         }
     }
-
-}

+ 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 - 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));
-        }
+        }*/
     }
 
     /**

+ 10 - 5
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<>();
         //疑难患者副高及以上查房记录
@@ -132,7 +134,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 +197,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 +283,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 +303,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);
     }
 }

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

@@ -0,0 +1,275 @@
+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.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 = "TRUNCATE qc_model_input_info";
+        try {
+            connect = mysqlJdbc.connect();
+            pst = connect.prepareStatement(sql);
+            pst.execute();
+
+            sql = "INSERT INTO qc_model_input_info(case_number,title,sub_title,text) VALUES(?,?,?,?)";
+            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() - 1) {
+                        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();
+            }
+        }
+    }
+
+    /**
+     * 入院记录
+     *
+     * @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);
+        //主任医师最后一次查房记录
+        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 (CatalogueUtil.isEmpty(content)) {
+            return;
+        }
+        if (title.contains("、")) {
+            title = title.split("、")[1];
+        }
+        if (changxDoc.containsKey(title)) {
+            logger.info(title + "已存在");
+            return;
+        }
+        changxDoc.put(title, content);
+    }
+}

+ 11 - 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,6 +58,7 @@ 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);
 
@@ -64,6 +66,7 @@ public class QCTestController {
         List<Map<String, Object>> wheres = new ArrayList<>();
         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 +138,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 +241,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 +325,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 +370,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 +405,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");