Переглянути джерело

无术前小结修改逻辑

hujing 5 роки тому
батько
коміт
30cec0d57c

+ 2 - 5
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0370.java

@@ -43,12 +43,9 @@ public class OPE0370 extends QCCatalogue {
                 j++;
             }
         }
-        /* 如果首次病程录的诊疗计划里有急诊手术,则手术记录的数量减一 */
+        /* 如果首次病程录的诊疗计划里有急诊手术,则术前小结的数量加一 */
         if (emergencyOperation) {
-            i--;
-        }
-        if (i < 0) {
-            i = 0;
+            j++;
         }
         /* 手术记录数量和术前小结数量不一致则报错 */
         if (i != j) {

+ 40 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/preoperativediscussion/PRE0328.java

@@ -3,7 +3,10 @@ package com.lantone.qc.kernel.catalogue.preoperativediscussion;
 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.FirstCourseRecordDoc;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.doc.operation.OperationDoc;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.text.ParseException;
@@ -29,6 +32,9 @@ public class PRE0328 extends QCCatalogue {
                 && inputInfo.getBeHospitalizedDoc().getStructureMap().get("现病史").contains("急诊手术")) {
             return;
         }
+        boolean emergencyOperation = findEmergencyOperation(inputInfo);
+        boolean emergencyOperationFromWardRecord = findEmergencyOperationFromWardRecord(inputInfo);
+
         int i = 0, j = 0;
         for (OperationDoc operationDoc : operationDocs) {
             if (operationDoc.getOperationRecordDoc() != null) {
@@ -38,10 +44,44 @@ public class PRE0328 extends QCCatalogue {
                 j++;
             }
         }
+        /* 如果首次病程录的诊疗计划里有急诊手术,则术前小结的数量加一 */
+        if (emergencyOperation || emergencyOperationFromWardRecord) {
+            j++;
+        }
         if (i > 0 && i != j) {
             status.set("-1");
             info.set("手术记录不一致");
         }
     }
 
+    private boolean findEmergencyOperation(InputInfo inputInfo) {
+        FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
+        if (firstCourseRecordDoc != null) {
+            String treatPlan = firstCourseRecordDoc.getStructureMap().get("诊疗计划");
+            if (StringUtil.isNotBlank(treatPlan)) {
+                String regex = ".*急诊.*术.*";
+                return treatPlan.matches(regex);
+            }
+        }
+        return false;
+    }
+
+    private boolean findEmergencyOperationFromWardRecord(InputInfo inputInfo) {
+        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+        if (threeLevelWardDocs.size() == 0) {
+            return false;
+        }
+        List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
+        for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
+            String content = threeLevelWardDoc.getStructureMap().get("病情记录");
+            if (StringUtil.isNotBlank(content)) {
+                String regex = ".*急诊.*术.*";
+                if (content.matches(regex)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
 }