Selaa lähdekoodia

恩泽:crf输血治疗同意书后结构化更新

wangsy 4 vuotta sitten
vanhempi
commit
c0fc550b8d

+ 3 - 0
structure-center/src/main/java/com/lantone/structure/facade/StructureFacade.java

@@ -83,6 +83,9 @@ public class StructureFacade {
             case "其他知情告知同意书":
                 targetTran = new InformedConsentTran();
                 break;
+            case "输血治疗同意书":
+                targetTran = new ClinicBloodConsentDocTran();
+                break;
             default:
                 break;
         }

+ 77 - 0
structure-center/src/main/java/com/lantone/structure/facade/tran/ClinicBloodConsentDocTran.java

@@ -0,0 +1,77 @@
+package com.lantone.structure.facade.tran;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.lantone.structure.facade.tran.util.CommonAnalysisUtil;
+import com.lantone.structure.util.MapUtil;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 输血治疗同意书
+ * @author: wsy
+ * @time: 2021/3/09 14:49
+ */
+@Slf4j
+public class ClinicBloodConsentDocTran extends TargetTran {
+    @Override
+    public Map<String, String> convert(String text) {
+        Map<String, String> structureMap = cutWord(text);
+        Map<String, String> retMap = new HashMap<String, String>();
+        CommonAnalysisUtil.mapKeyContrastCommon(structureMap, keyContrasts, retMap);
+        return retMap;
+    }
+
+    private Map<String, String> cutWord(String text) {
+        Map<String, String> sourceMap = Maps.newHashMap();
+        String dataStr = "";
+        List<String> titles = CommonAnalysisUtil.sortTitles(
+                Lists.newArrayList("姓名", "性别", "年龄", "床号", "病历号", "疾病介绍和治疗建议", "1.患者基本情况", "诊断", "输血前检查", "2.拟使用的血液制品","2.我理解此治疗可能发生的风险",
+                        "医护人员陈述"),
+                text
+        );
+        CommonAnalysisUtil.cutByTitles(text, titles, 0, sourceMap);
+        if (sourceMap != null) {
+            if (sourceMap.containsKey("医护人员陈述")) {
+                dataStr = sourceMap.get("医护人员陈述");
+                sourceMap.put("医护人员陈述", dataStr.substring(0, Math.max(0, dataStr.indexOf("医生签名"))));
+            }
+            List<String> listTitle = Lists.newArrayList(
+                    "医生签名", "患者/患者授权委托人签名", "患者、患者家属或患者的法定监护人、授权委托人意见", "患者/患者授权委托人签名", "患者/患者授权委托人签名"
+            );
+            CommonAnalysisUtil.cutByTitlesNoColon(dataStr, listTitle, 0, sourceMap);
+            CommonAnalysisUtil.removeKey(sourceMap, "病情概要", "主要抢救措施");
+            disDate(sourceMap, "医生签名", "签名日期");
+            disDate(sourceMap, "患者/患者授权委托人签名", "签名日期");
+        }
+        return sourceMap;
+    }
+
+    private void disDate(Map sourceMap, String... args) {
+        Map<String, String> sourceMap_ = MapUtil.copyMap(sourceMap);
+        if(sourceMap.containsKey(args[0]) && sourceMap_.get(args[0]).contains(args[1])){
+            int index = sourceMap_.get(args[0]).indexOf(args[1]);
+            sourceMap.put(args[0],sourceMap_.get(args[0]).substring(0,index));
+            sourceMap.put(args[0]+args[1],sourceMap_.get(args[0]).substring(index).replace(args[1],"").replaceAll("[::]",""));
+        }
+    }
+
+
+    private List<String> keyContrasts = Lists.newArrayList(
+            "病历号=住院号",
+            "姓名=患者姓名",
+            "年龄=年龄(岁)",
+            "床号=病床号",
+            "输血前检查=输血前有关检查项目及结果",
+            "2.我理解此治疗可能发生的风险=输血风险及可能发生的不良后果",
+            "医护人员陈述=医疗机构意见",
+            "患者、患者家属或患者的法定监护人、授权委托人意见=患者/法定代理人意见",
+            "医生签名=医师签名",
+            "医生签名签名日期=医师签名日期时间",
+            "患者/患者授权委托人签名=患者/法定代理人签名",
+            "患者/患者授权委托人签名签名日期=患者/法定代理人签名日期时间"
+    );
+}