瀏覽代碼

北仑trans层病危通知书修改

huj 4 年之前
父節點
當前提交
1a24719e58

+ 11 - 12
trans/src/main/java/com/lantone/qc/trans/beilun/BeiLunCriticallyIllNoticeDocTrans.java

@@ -1,13 +1,14 @@
 package com.lantone.qc.trans.beilun;
 
 import com.google.common.collect.Lists;
-import com.lantone.qc.dbanaly.facade.changx.CxXmlUtil;
 import com.lantone.qc.pub.model.doc.CriticallyIllNoticeDoc;
 import com.lantone.qc.pub.model.vo.MedrecVo;
 import com.lantone.qc.trans.ModelDocTrans;
+import com.lantone.qc.trans.beilun.util.BeiLunCriticallyIllNoticeHtmlAnalysis;
+import com.lantone.qc.trans.beilun.util.BeiLunHtmlAnalysis;
+import com.lantone.qc.trans.beilun.util.CommonAnalysisUtil;
 import com.lantone.qc.trans.comsis.ModelDocGenerate;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
-import com.lantone.qc.trans.comsis.Preproc;
 
 import java.util.List;
 import java.util.Map;
@@ -31,18 +32,16 @@ public class BeiLunCriticallyIllNoticeDocTrans extends ModelDocTrans {
 
     private CriticallyIllNoticeDoc getCriticallyIllNoticeDoc(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, keyContrasts);
+        String recTitle = contentMap.get("recTitle").toString();
+        String recTypeId = contentMap.get("recTypeId").toString();
+        BeiLunHtmlAnalysis beiLunHtmlAnalysis = new BeiLunCriticallyIllNoticeHtmlAnalysis();
+        Map<String, String> sourceMap = beiLunHtmlAnalysis.analysis(content, recTitle, recTypeId);
+        Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
 
-        String text = CxXmlUtil.getXmlText(content);
-        Map<String, String> cutWordMap = Preproc.getCutWordMap(true, sourceTitles, text);
-        cutWordMap.putAll(structureMap);
-
-        CriticallyIllNoticeDoc criticallyIllNoticeDoc = ModelDocGenerate.criticallyIllNoticeDocGen(cutWordMap);
+        String text = CommonAnalysisUtil.html2String(content);
+        CriticallyIllNoticeDoc criticallyIllNoticeDoc = ModelDocGenerate.criticallyIllNoticeDocGen(structureMap);
         criticallyIllNoticeDoc.setText(text);
-        criticallyIllNoticeDoc.setPageData((Map) cutWordMap);
+        criticallyIllNoticeDoc.setPageData((Map) structureMap);
 
         return criticallyIllNoticeDoc;
     }

+ 6 - 2
trans/src/main/java/com/lantone/qc/trans/beilun/util/BeiLunCriticallyIllNoticeHtmlAnalysis.java

@@ -3,6 +3,8 @@ 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.StringUtil;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
 
 import java.util.List;
 import java.util.Map;
@@ -20,15 +22,17 @@ public class BeiLunCriticallyIllNoticeHtmlAnalysis implements BeiLunHtmlAnalysis
                 "告知时间", "患方意见", "患方签名", "手印说明", "与患者关系", "签字时间");
         String html = args[0];
         String recTitle = args[1];
+        String recTypeId = args[2];
         Map<String, String> structureMap = Maps.newLinkedHashMap();
-        String htmlContent = CommonAnalysisUtil.html2String(html);
+        Document doc = Jsoup.parse(html);
+        String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
         if (StringUtil.isNotBlank(htmlContent)) {
             htmlContent = htmlContent.replaceAll("[   ]", " ");
             CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
         }
         CommonAnalysisUtil.extractDateByTitle(structureMap, "告知时间");
 //        structureMap.put("rec_title=", "405");
-        BeiLunHtmlAnalysisUtil.insertModuleId(recTitle, structureMap);
+        BeiLunHtmlAnalysisUtil.insertModuleId(recTypeId, structureMap);
         return structureMap;
     }