浏览代码

手术记录中手术经过未填写 切词处理

chengyao 3 年之前
父节点
当前提交
d1f3302bcd

+ 28 - 1
trans/src/main/java/com/lantone/qc/trans/changshaxy/util/XyOperationRecordHtmlAnalysis.java

@@ -2,6 +2,7 @@ package com.lantone.qc.trans.changshaxy.util;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.changshaxy.util.comsis.XyCommonAnalysisUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -40,7 +41,7 @@ public class XyOperationRecordHtmlAnalysis implements XyHtmlAnalysis {
     }
 
     private void analysisGeneral(Element bigDivElement, Map<String, String> map) {
-        String text = XyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+            String text = XyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         text = text.replaceAll("第1页", "")
                 .replace("(包括体位、切口处理经过,病灶所见及手术步骤等):", "")
                 .replace("&nbsp", "")
@@ -67,6 +68,32 @@ public class XyOperationRecordHtmlAnalysis implements XyHtmlAnalysis {
         );
         titles = XyCommonAnalysisUtil.sortTitles(titles, text);
         XyCommonAnalysisUtil.cutByTitles(text, titles, 0, map);
+        List<String> cutTitles = Lists.newArrayList(
+                "二助","一助","术者"
+        );
+        String cutStr = "";
+        for (String cutTitle : cutTitles) {
+           if(map.containsKey(cutTitle)){
+               cutStr = cutTitle;
+               break;
+           }
+        }
+        if(map.containsKey("实施手术") && map.containsKey(cutStr)){
+            String opStr = text.split("实施手术")[1];
+            opStr = opStr.split(cutStr)[1].split("\n")[0];
+            map.put(cutStr,opStr);
+        }
+
+        if(!map.containsKey("手术过程") && map.containsKey(cutStr)){
+            String opStr =  text.substring(text.lastIndexOf(cutStr)).split("\n")[1];
+            opStr = text.substring(text.lastIndexOf(opStr));
+            if(opStr.contains("手术医师签名")){
+                opStr =  opStr.substring(0,opStr.lastIndexOf("手术医师签名"));
+            }
+            if(StringUtil.isNotBlank(opStr)){
+                map.put("手术过程",opStr);
+            }
+        }
         if (map.containsKey("手术医师签名")) {
             String name = map.get("手术医师签名");
             String date = XyCommonAnalysisUtil.extractDate(name);