浏览代码

北仑死亡记录修改trans

huj 4 年之前
父节点
当前提交
0a301dbab9

+ 12 - 12
trans/src/main/java/com/lantone/qc/trans/beilun/BeiLunDeathRecordDocTrans.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.DeathRecordDoc;
 import com.lantone.qc.pub.model.vo.MedrecVo;
 import com.lantone.qc.trans.ModelDocTrans;
+import com.lantone.qc.trans.beilun.util.BeiLunDeathRecordHtmlAnalysis;
+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;
@@ -23,20 +24,19 @@ public class BeiLunDeathRecordDocTrans extends ModelDocTrans {
     public DeathRecordDoc extract(MedrecVo medrecVo) {
         Map<String, Object> contentMap = ((List<Map>) medrecVo.getContent().get("content")).get(0);
         String content = contentMap.get("xmlText").toString();
+        String recTitle = contentMap.get("recTitle").toString();
+        String recTypeId = contentMap.get("recTypeId").toString();
+        BeiLunHtmlAnalysis beiLunHtmlAnalysis = new BeiLunDeathRecordHtmlAnalysis();
+        Map<String, String> sourceMap = beiLunHtmlAnalysis.analysis(content, recTitle, recTypeId);
+        Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
 
-        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);
+        DeathRecordDoc deathRecordDoc = ModelDocGenerate.deathRecordDocGen(structureMap);
+        deathRecordDoc.setPageData((Map) structureMap);
 
-        String text = CxXmlUtil.getXmlText(content);
-        Map<String, String> cutWordMap = Preproc.getCutWordMap(true, sourceTitles, text);
-        cutWordMap.putAll(structureMap);
+        String text = CommonAnalysisUtil.html2String(content);
 
-        DeathRecordDoc deathRecordDoc = ModelDocGenerate.deathRecordDocGen(cutWordMap);
         deathRecordDoc.setText(text);
-        deathRecordDoc.setPageData((Map) cutWordMap);
-
+        deathRecordDoc.setPageData((Map) structureMap);
         return deathRecordDoc;
     }
 

+ 6 - 1
trans/src/main/java/com/lantone/qc/trans/beilun/util/BeiLunDeathRecordHtmlAnalysis.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,12 +22,15 @@ public class BeiLunDeathRecordHtmlAnalysis 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), false);
         if (StringUtil.isNotBlank(htmlContent)) {
             htmlContent = htmlContent.replaceAll("[   ]", " ");
             CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
         }
+        CommonAnalysisUtil.extractDateByTitle(structureMap,"记录时间");
 //        structureMap.put("rec_title=", "5254");
         BeiLunHtmlAnalysisUtil.insertModuleId(recTitle, structureMap);
         return structureMap;