Browse Source

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

rengb 5 năm trước cách đây
mục cha
commit
c3420f6aef

+ 38 - 17
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0195.java

@@ -1,15 +1,20 @@
 package com.lantone.qc.kernel.catalogue.firstpagerecord;
 
 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;
 import com.lantone.qc.pub.model.doc.DeathCaseDiscussDoc;
 import com.lantone.qc.pub.model.doc.DeathRecordDoc;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 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;
+import java.util.regex.Pattern;
 
 /**
  * @ClassName : FIRP0195
@@ -41,29 +46,45 @@ public class FIRP0195 extends QCCatalogue {
             }
         }
 
-        /*
-        if (threeLevelWardDocs.size() > 0) {
-            List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
-            ThreeLevelWardDoc lastWardDoc = allDoctorWradDocs.get(allDoctorWradDocs.size() - 1);
-            List<ThreeLevelWardLabel> threeLevelWardLabels = lastWardDoc.getThreeLevelWardLabel();
-            if (threeLevelWardLabels.size() > 0) {
-                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardLabels.get(0);
-                if (threeLevelWardLabel != null) {
-                    wardOutWay = threeLevelWardLabel.getDischargeMode();
-                    if (StringUtil.isNotBlank(wardOutWay)) {
-                        if (!match(outWay, wardOutWay)) {
-                            status.set("-1");
-                        }
-                    }
-                }
+        List<ThreeLevelWardDoc> allDoctorWradDocs = inputInfo.getThreeLevelWardDocs().get(0).getAllDoctorWradDocs();
+        if (allDoctorWradDocs.size() == 0) {
+            status.set("0");
+            return;
+        }
+        int j = 0; //最后两次查房记录
+        for (int i = allDoctorWradDocs.size() - 1; i >= 0 && j < 2; i--) {
+            j++;
+            ThreeLevelWardDoc lastWardDoc = allDoctorWradDocs.get(i);
+            Map<String, String> structureMap = lastWardDoc.getStructureMap();
+            String conditionRecord = structureMap.get("病情记录");
+            String treatmentPlan = structureMap.get("治疗计划和措施");
+            String title = structureMap.get("查房标题");
+            if (title.contains("病理报告")) {
+                continue;
+            }
+            conditionRecord = StringUtil.isBlank(conditionRecord) ? "" : conditionRecord;
+            treatmentPlan = StringUtil.isBlank(treatmentPlan) ? "" : treatmentPlan;
+            if ((conditionRecord.contains("出院") || treatmentPlan.contains("出院"))
+                    && !outWay.equals("医嘱离院")) {
+                status.set("-1");
+                return;
+            }
+            if ((leave_method(conditionRecord) || leave_method(treatmentPlan)) && !outWay.equals("医嘱转院")) {
+                status.set("-1");
+                return;
             }
         }
-         */
-
 
     }
 
     private boolean match(String str1, String str2) {
         return str1.equals(str2) || str1.contains(str2) || str2.contains(str1);
     }
+
+    public boolean leave_method(String content){
+        String compile = "(?<=转)(.+)(?=院)";
+        Pattern p = Pattern.compile(compile);
+        boolean b = p.matcher(content).find();
+        return b;
+    }
 }