Pārlūkot izejas kodu

温附一无输血或使用血液制品知情同意书规则更新

wangsy 3 gadi atpakaļ
vecāks
revīzija
faac907b0f

+ 120 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/wenfuyi/clinicalblood/CLI0301.java

@@ -0,0 +1,120 @@
+package com.lantone.qc.kernel.catalogue.hospital.wenfuyi.clinicalblood;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+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.*;
+import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : CLI0301
+ * @Description : 无输血或使用血液制品知情同意书
+ * @Author : cy
+ * @Date: 2021-04-18 14:49
+ */
+@Component
+public class CLI0301 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        boolean flag = false;
+        List<ClinicalBloodDoc> clinicalBloodDocs = inputInfo.getClinicalBloodDocs();
+        List<DoctorAdviceDoc> doctorAdviceDocs = inputInfo.getDoctorAdviceDocs();
+        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+        /**
+         *是否输血了
+         */
+        //输血记录
+        if (ListUtil.isNotEmpty(clinicalBloodDocs)) {
+            flag = true;
+        }
+        //血费
+        FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
+        if (firstPageRecordDoc != null && firstPageRecordDoc.getStructureMap() != null) {
+            String bloodFee = firstPageRecordDoc.getStructureMap().get("血费");
+            if (StringUtil.isNotEmpty(bloodFee) && !bloodFee.equals("0")) {
+                double blood = Double.parseDouble(bloodFee);
+                if (blood > 0) {
+                    flag = true;
+                }
+            }
+        }
+        //医嘱
+        if (ListUtil.isNotEmpty(doctorAdviceDocs)) {
+            for (DoctorAdviceDoc doctorAdviceDoc : doctorAdviceDocs) {
+                Map<String, String> doctorAdviceDocStrMap = doctorAdviceDoc.getStructureMap();
+                String daStatus = doctorAdviceDocStrMap.get(Content.doctorAdviceState);
+                if (StringUtil.isNotEmpty(daStatus)) {
+                    if (!Content.cancellationOrderList.contains(daStatus)) {
+                        //取临时医嘱
+                        String doctorAsks = doctorAdviceDocStrMap.get(Content.doctorAdviceType);
+                        if (StringUtil.isEmpty(doctorAsks)) {
+                            continue;
+                        }
+                        if (Content.statOrder.equals(doctorAsks)) {
+                            String daItemName = doctorAdviceDocStrMap.get(Content.medicalOrderName);
+                            if (StringUtil.isNotEmpty(daItemName)) {
+                                if (dateStr(daItemName)) {
+                                    flag = true;
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+//判断是否含有知情同意书
+        if (flag) {
+            status.set("-1");
+            List<InformedConsentDoc> informedConsentDocList = inputInfo.getInformedConsentDoc();
+            if (ListUtil.isNotEmpty(informedConsentDocList)) {
+                for (InformedConsentDoc informedConsentDoc : informedConsentDocList) {
+                    String str = informedConsentDoc.getStructureMap().get("标题");
+                    if (StringUtil.isBlank(str)) {
+                        continue;
+                    }
+                    String rex = "[\\s\\S]*(?=输血)[^,;,;。]{0,10}(?=知情同意书)[\\s\\S]*";
+                    if (str.matches(rex)) {
+                        status.set("0");
+                        return;
+                    }
+                }
+            }
+        }
+    }
+
+    private boolean dateStr(String str) {
+        if (StringUtil.isEmpty(str)) {
+            return false;
+        }
+        str = str.replaceAll("\\*", "\\\\*");
+        str = str.replaceAll("\\)", "\\\\)");
+        str = str.replaceAll("\\.", "\\\\.");
+        str = str.replaceAll("\\?", "\\\\?");
+        str = str.replaceAll("\\+", "\\\\+");
+        str = str.replaceAll("\\$", "\\\\$");
+        str = str.replaceAll("\\^", "\\\\^");
+        str = str.replaceAll("\\[", "\\\\[");
+        str = str.replaceAll("\\]", "\\\\]");
+        str = str.replaceAll("\\(", "\\\\(");
+        str = str.replaceAll("\\{", "\\\\{");
+        str = str.replaceAll("\\}", "\\\\}");
+        str = str.replaceAll("\\|", "\\\\|");
+        str = str.replaceAll("\\/", "\\\\/");
+        String rex1 = "[\\s\\S]*(?=输)[^,;,;。]{0,6}(?=血)[\\s\\S]*";
+        String rex2 = "[\\s\\S]*(?=输)[^,;,;。]{0,6}(?=红细胞)[\\s\\S]*";
+        String rex3 = "[\\s\\S]*(?=输)[^,;,;。]{0,6}(?=血小板)[\\s\\S]*";
+        String rex4 = "[\\s\\S]*(?=输)[^,;,;。]{0,6}(?=血浆)[\\s\\S]*";
+        String rex5 = "[\\s\\S]*(?=输)[^,;,;。]{0,6}(?=冷沉淀因子)[\\s\\S]*";
+        if (str.matches(rex1) || str.matches(rex2) || str.matches(rex3) || str.matches(rex4) || str.matches(rex5)) {
+            return true;
+        }
+        return false;
+    }
+}