rengb 4 роки тому
батько
коміт
5b30d35cdb

+ 12 - 63
trans/src/main/java/com/lantone/qc/trans/beilun/BeiLunOperationDocTrans.java

@@ -16,6 +16,7 @@ import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.ModelDocTrans;
 import com.lantone.qc.trans.beilun.util.BeiLunHtmlAnalysis;
 import com.lantone.qc.trans.beilun.util.BeiLunOperationHtmlAnalysis;
+import com.lantone.qc.trans.beilun.util.BeiLunOperationRecordHtmlAnalysis;
 import com.lantone.qc.trans.beilun.util.BeiLunPreoperativeHtmlAnalysis;
 import com.lantone.qc.trans.comsis.ModelDocGenerate;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
@@ -42,14 +43,14 @@ public class BeiLunOperationDocTrans extends ModelDocTrans {
         }
 
         Map<String, OperationDiscussionDoc> operationDiscussionDocMap = getOperationDiscussionDocMap((List) contentMap.get("术后首次病程及谈话记录"));
-        //Map<String, OperationRecordDoc> operationRecordDocMap = getOperationRecordDocMap((List) contentMap.get("手术记录"));
+        Map<String, OperationRecordDoc> operationRecordDocMap = getOperationRecordDocMap((List) contentMap.get("手术记录"));
         Map<String, PreoperativeDiscussionDoc> preoperativeDiscussionDocMap = getPreoperativeDiscussionDocMap((List) contentMap.get("术前讨论、术前小结"));
         //Map<String, OperationInformedConsentDoc> operationInformedConsentDocMap = getOperationInformedConsentDocMap((List) contentMap.get("手术知情同意书"));
         //Map<String, OperationSafetyChecklistDoc> operationSafetyChecklistDocMap = getOperationSafetyChecklistDocMap((List) contentMap.get("手术安全核查表"));
 
         Set<String> operationNameSet = Sets.newHashSet();
         operationNameSet.addAll(operationDiscussionDocMap.keySet());
-        //operationNameSet.addAll(operationRecordDocMap.keySet());
+        operationNameSet.addAll(operationRecordDocMap.keySet());
         operationNameSet.addAll(preoperativeDiscussionDocMap.keySet());
         //operationNameSet.addAll(operationInformedConsentDocMap.keySet());
         //operationNameSet.addAll(operationSafetyChecklistDocMap.keySet());
@@ -58,7 +59,7 @@ public class BeiLunOperationDocTrans extends ModelDocTrans {
             OperationDoc operationDoc = new OperationDoc();
             operationDoc.setOperationName(operationName);
             operationDoc.setOperationDiscussionDoc(operationDiscussionDocMap.get(operationName));
-            //operationDoc.setOperationRecordDoc(operationRecordDocMap.get(operationName));
+            operationDoc.setOperationRecordDoc(operationRecordDocMap.get(operationName));
             operationDoc.setPreoperativeDiscussionDoc(preoperativeDiscussionDocMap.get(operationName));
             //operationDoc.setOperationInformedConsentDoc(operationInformedConsentDocMap.get(operationName));
             //operationDoc.setOperationSafetyChecklistDoc(operationSafetyChecklistDocMap.get(operationName));
@@ -131,71 +132,19 @@ public class BeiLunOperationDocTrans extends ModelDocTrans {
 
     private OperationRecordDoc getOperationRecordDoc(Map<String, Object> contentMap) {
         String content = contentMap.get("xmlText").toString();
-        Map<String, String> xmlNodeValueMap = CxXmlUtil.firstLevelNodeValue(content);
-        xmlNodeValueMap.put("mode_id=" + contentMap.get("modeId").toString(), "");
-        xmlNodeValueMap.put("rec_title=" + contentMap.get("recTitle").toString(), "");
-        Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(xmlNodeValueMap, operationRecord_keyContrasts);
-        if (StringUtil.isNotBlank(structureMap.get("签名"))) {
-            structureMap.put("记录医师", structureMap.get("签名"));
-        }
-
-        String text = CxXmlUtil.getXmlText(content);
-        Map<String, String> cutWordMap = Preproc.getCutWordMap(true, operationRecord_sourceTitles, text);
-        cutWordMap.putAll(structureMap);
-
-        OperationRecordDoc operationRecordDoc = ModelDocGenerate.operationRecordDocGen(cutWordMap);
-        operationRecordDoc.setText(text);
-        operationRecordDoc.setPageData((Map) cutWordMap);
+        String recTitle = contentMap.get("recTitle").toString();
+        String recTypeId = contentMap.get("recTypeId").toString();
+        BeiLunHtmlAnalysis beiLunHtmlAnalysis = new BeiLunOperationRecordHtmlAnalysis();
+        Map<String, String> sourceMap = beiLunHtmlAnalysis.analysis(content, recTitle, recTypeId);
+        Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, operationRecord_keyContrasts);
 
+        OperationRecordDoc operationRecordDoc = ModelDocGenerate.operationRecordDocGen(structureMap);
+        operationRecordDoc.setPageData((Map) structureMap);
         return operationRecordDoc;
     }
 
-    private List<String> operationRecord_sourceTitles = Lists.newArrayList(
-            "记录医师",
-            "记录时间",
-            "手术名称",
-            "麻醉方式",
-            "术前诊断",
-            "术后诊断",
-            "手术经过"
-    );
-
     private List<String> operationRecord_keyContrasts = Lists.newArrayList(
-            "姓名++++患者姓名=",
-            "性别=",
-            "病区++++病区名称=",
-            "床号=",
-            "病案号++++住院号=",
-            "手术开始时间=",
-            "手术结束时间=",
-            "术前诊断=",
-            "手术名称=",
-            "术后诊断=",
-            "主刀医师=",
-            "一助=",
-            "二助=",
-            "器械护士=",
-            "麻醉方式=",
-            "麻醉医生=",
-            "清洁程度=",
-            "ASA分级++++麻醉ASA分级=",
-            "手术持续时间=",
-            "风险评估分值=",
-            "++++浅层组织手术=",
-            "++++深层组织手术=",
-            "++++器官手术=",
-            "++++空隙手术=",
-            //            "++++术中送检无=术中送检",
-            //            "++++术中送检有=术中送检",
-            "冰冻切片结果=",
-            "++++并发症无=手术并发症",
-            "++++并发症有=手术并发症",
-            "手术并发症=",
-            "失血量=",
-            "手术经过=",
-            "记录时间=",
-            "记录时间=",
-            "术(中)后诊断++++术后中诊断=术后诊断"
+
     );
 
 

+ 58 - 0
trans/src/main/java/com/lantone/qc/trans/beilun/util/BeiLunOperationRecordHtmlAnalysis.java

@@ -0,0 +1,58 @@
+package com.lantone.qc.trans.beilun.util;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.lantone.qc.pub.util.FileUtil;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Element;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2020/9/28 16:36
+ */
+public class BeiLunOperationRecordHtmlAnalysis implements BeiLunHtmlAnalysis {
+
+    @Override
+    public Map<String, String> analysis(String... args) {
+        Map<String, String> map = Maps.newLinkedHashMap();
+        String html = args[0];
+        String recTitle = args[1];
+        String recTypeId = args[2];
+        Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
+        analysisGeneral(bigDivElement, map);
+        BeiLunHtmlAnalysisUtil.mapValueRemoveStartColon(map);
+        return map;
+    }
+
+    private void analysisGeneral(Element bigDivElement, Map<String, String> map) {
+        if (bigDivElement.selectFirst("hr") != null) {
+            bigDivElement.selectFirst("hr").previousElementSiblings().remove();
+        }
+        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        text = text.replaceAll("第1页", "");
+        List<String> titles = Lists.newArrayList(
+                "手术时间", "手术日期", "术前诊断", "手术指征", "手术人员", "麻醉方式", "麻醉人员", "接生者",
+                "术前胎心", "手术名称", "术后诊断", "手术者及助手名称", "术中取病理标本", "麻醉方法", "麻 醉 者", "手术经过",
+                "医生签名", "记录时间", "时间", "记录者", "术中输血", "术前宫颈准备日期", "药物名称及用法", "导管或其他", "插入深度",
+                "阴道填塞纱布条", "准备者", "取出日期", "手术方法", "术中特殊情况", "病理检查", "其他", "记录者", "手术者",
+                "检查子宫位置"
+        );
+        titles = CommonAnalysisUtil.sortTitlesNoColon(titles, text);
+        CommonAnalysisUtil.cutByTitlesNoColon(text, titles, 0, map);
+    }
+
+    public static void main(String[] args) {
+        String html = FileUtil.fileRead("C:/Users/Administrator/Desktop/宁波/病例导出/计划生育手术记录-妇科住院-2261951.html");
+        String recTitle = "手术记录";
+        BeiLunOperationRecordHtmlAnalysis test = new BeiLunOperationRecordHtmlAnalysis();
+        Map<String, String> map = test.analysis(html, recTitle, "");
+        map.keySet().forEach(key -> {
+            System.out.println(key + "-----" + map.get(key).replaceAll("\n", ""));
+        });
+    }
+
+}