Browse Source

萧山中医院:入院记录、首次病程录、查房记录、出院小结文书解析

licy 3 years ago
parent
commit
abdbfc006c
31 changed files with 877 additions and 242 deletions
  1. 13 6
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunBeHospitalizedDocTrans.java
  2. 3 4
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunFirstCourseRecordDocTrans.java
  3. 3 18
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunLeaveHospitalDocTrans.java
  4. 2 1
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunOperationDocTrans.java
  5. 1 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunThreeLevelWardDocTrans.java
  6. 74 90
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunBeHospitalizedHtmlAnalysis.java
  7. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunClinicBloodEffectHtmlAnalysis.java
  8. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunClinicalBloodHtmlAnalysis.java
  9. 3 3
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunConsultationHtmlAnalysis.java
  10. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunConsultationRecordHtmlAnalysis.java
  11. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunCrisisValueReportHtmlAnalysis.java
  12. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunCriticallyIllNoticeHtmlAnalysis.java
  13. 4 4
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunDeathCaseDiscussHtmlAnalysis.java
  14. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunDeathRecordHtmlAnalysis.java
  15. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunDifficultCaseDiscussHtmlAnalysis.java
  16. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunDutyShiftSystemHtmlAnalysis.java
  17. 12 44
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunFirstCourseRecordHtmlAnalysis.java
  18. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunInformedHtmlAnalysis.java
  19. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunInvasiveOperationHtmlAnalysis.java
  20. 12 19
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunLeaveHospitalHtmlAnalysis.java
  21. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunOperationHtmlAnalysis.java
  22. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunOperationInformedHtmlAnalysis.java
  23. 3 3
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunOperationRecordHtmlAnalysis.java
  24. 3 3
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunPreoperativeHtmlAnalysis.java
  25. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunRescueHtmlAnalysis.java
  26. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunStagesSummaryHtmlAnalysis.java
  27. 16 12
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunThreeLevelWardHtmlAnalysis.java
  28. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunTransferIntoHtmlAnalysis.java
  29. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunTransferOutHtmlAnalysis.java
  30. 1 1
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunHtmlAnalysisUtil.java
  31. 695 0
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/comsis/XszyyCommonAnalysisUtil.java

+ 13 - 6
trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunBeHospitalizedDocTrans.java

@@ -62,12 +62,19 @@ public class BeiLunBeHospitalizedDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "联系人(关系)=联系人",
-            "入院时间=入院日期",
-            "医生签名=记录医生",
-            "医生签名时间=记录时间",
-            "疼痛评估=疼痛",
-            "代诉=主诉"
+            "姓 名=姓名",
+            "出生地=籍贯",
+            "性 别=性别",
+            "单位或住址=住址",
+            "年 龄=年龄",
+            "婚 姻=婚姻",
+            "民 族=民族",
+            "发病节气=病史采集时间",
+            "职 业=职业",
+            "补充及专科检查=专科检查",
+            "辅 助 检 查=辅助检查",
+            "入 院 诊 断=入院诊断",
+            "初步诊断=入院诊断"
     );
 
 }

+ 3 - 4
trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunFirstCourseRecordDocTrans.java

@@ -74,10 +74,9 @@ public class BeiLunFirstCourseRecordDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "时间=病历日期",
-            "病历特点=病例特点",
-            "入院查体=查体",
-            "辅助检查=辅检"
+            "拟诊讨论=诊断依据",
+            "诊疗方案=诊疗计划",
+            "医师签名=记录医生"
     );
 
 }

+ 3 - 18
trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunLeaveHospitalDocTrans.java

@@ -64,25 +64,10 @@ public class BeiLunLeaveHospitalDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "患者姓名=姓名",
-            "性别=",
-            "床号=",
-            "年龄=",
-            "科室=科别",
-            "入院诊断=入院诊断",
-            "出院诊断=出院诊断",
-            "实际住院天数=住院天数",
-            "入院情况=入院情况",
-            "诊疗经过=诊治经过",
-            "出院情况=",
-            "出院医嘱=",
-            "随访计划=",
+            "入院时间=入院日期",
+            "出院时间=出院日期",
             "医师签名=记录医生",
-            "时间=记录时间",
-            "治疗结果=诊疗结果",
-            "其它=其他",
-            "出生年月=出生日期",
-            "床位=床号"
+            "日期=记录时间"
     );
 
 }

+ 2 - 1
trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunOperationDocTrans.java

@@ -13,6 +13,7 @@ import com.lantone.qc.trans.xszyy.util.*;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
 import com.lantone.qc.trans.comsis.ModelDocGenerate;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
+import com.lantone.qc.trans.xszyy.util.XszyyHtmlAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.MapUtils;
 import org.jsoup.Jsoup;
@@ -119,7 +120,7 @@ public class BeiLunOperationDocTrans extends ModelDocTrans {
             }
             if (MapUtils.isNotEmpty(structureMap)) {
                 operationDiscussionDoc = ModelDocGenerate.operationDiscussionDocGen(structureMap);
-                String text = BeiLunHtmlAnalysisUtil.blockDivToStr(Jsoup.parse(content).selectFirst("body").child(0), true);
+                String text = XszyyHtmlAnalysisUtil.blockDivToStr(Jsoup.parse(content).selectFirst("body").child(0), true);
                 operationDiscussionDoc.setText(text);
                 operationDiscussionDoc.setPageData((Map) structureMap);
                 return operationDiscussionDoc;

+ 1 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunThreeLevelWardDocTrans.java

@@ -270,8 +270,7 @@ public class BeiLunThreeLevelWardDocTrans extends ModelDocTrans {
     private List<String> keyContrasts = Lists.newArrayList(
             "病历日期=查房日期",
             "病历标题=查房标题",
-            "科主任=三级医师",
-            "记录日期=记录时间"
+            "书写医师=记录医生"
     );
 
     /**

+ 74 - 90
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunBeHospitalizedHtmlAnalysis.java

@@ -3,11 +3,10 @@ package com.lantone.qc.trans.xszyy.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.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
-import org.jsoup.nodes.Element;
 
 import java.util.List;
 import java.util.Map;
@@ -38,7 +37,7 @@ public class BeiLunBeHospitalizedHtmlAnalysis implements BeiLunHtmlAnalysis {
             } else {
                 analysisGeneral(doc, recTitle, map);
             }
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -47,110 +46,95 @@ public class BeiLunBeHospitalizedHtmlAnalysis implements BeiLunHtmlAnalysis {
 
     //一般模板
     private void analysisGeneral(Document doc, String recTitle, Map<String, String> map) {
-        //个人基础信息table解析
-        BeiLunHtmlAnalysisUtil.tableStyle1InsertMap(doc.getElementById("table1"), map);
-        //主诉、现病史等table解析
-        BeiLunHtmlAnalysisUtil.tableStyle2InsertMap(doc.getElementById("table6"), map);
-        if (StringUtil.isNotBlank(map.get("婚育史月经史")) && map.get("婚育史月经史").contains("经期")) {
-            map.put("婚育史", map.get("婚育史月经史").substring(0, map.get("婚育史月经史").indexOf("经期")));
-        }
-        //体 格 检 查 表(一) table解析
-        Element tgjcTableElement = doc.getElementById("table3");
-        BeiLunHtmlAnalysisUtil.tableStyle2InsertMap(tgjcTableElement, map);
-
-        //诊断 table解析
-        String disTableElementId = null;
-        Element disTableElement = null;
-        String[] disTableElementIds = {"table7_2_0_0_1_1_2_0_1_4_5_6_7_0_1_37", "table7_2_0_0_1_1_2_0_1_4_5_6_7_0_1", "table7_2_0_0_1_1_2_0_1_4_5_6_7", "table7_2_0_0_1_1_2_0_1_4_5_6_7_0_1_5_2_3_1_2", "table7_2_0_0_1_1_2_0_1_4_5_6_7_0_1_5_2_3", "table7_2_0_0_1_1_2_0_1_4_5_6_7_0_1_5_2_3_1_2_27", "table7_2_0_0_1_1_2_0_1_4_5_6_7_0_1_5_2_3_1"};
-        for (String eid : disTableElementIds) {
-            disTableElement = doc.getElementById(eid);
-            if (disTableElement != null) {
-                disTableElementId = eid;
-                break;
-            }
+        List<String> titles = Lists.newArrayList("姓 名", "职 业", "性 别", "入院日期","年 龄", "记录日期", "婚 姻","病史陈述者", "出生地","可靠程度",
+                "民 族","身份证号码","发病节气","病案号","单位或住址","主 诉","现病史","既往史","个人史","婚育史","家族史",
+                "专项 评估","专项评估","当前用药","VAS疼痛评分","康复需求","心理状态","营养状况(NRS-2002营养风险筛查表)","VTE 风险","其他评估(如宗教信仰)",
+                "体 格 检 查","体 格 检 查 表 ( 一 )","体 格 检 查 表 (二)","补充及专科检查","辅 助 检 查", "入 院 诊 断","初步诊断",
+                "书写医生","医师签名","书写医师","修正诊断"
+        );
+        String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+        if (StringUtil.isNotBlank(htmlContent)) {
+            //有冒号版本
+//            XszyyCommonAnalysisUtil.html2StructureMap(titles,htmlContent,map);
+            //无冒号版本
+            XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,map);
         }
 
-        BeiLunHtmlAnalysisUtil.tableStyle1InsertMap(disTableElement, map);
-        disHandleExt(map);
-
-        //医生签名、医生签名时间
-        Element docSignElement = null, docSignTimeElement = null;
-        if (disTableElement != null) {
-            for (Element disTableElementNt : disTableElement.nextElementSiblings()) {
-                docSignElement = disTableElementNt.selectFirst("image,img");
-                if (docSignElement != null) {
-                    docSignTimeElement = disTableElementNt.nextElementSibling();
-                    break;
-                }
-            }
-        }
-        if (docSignElement != null) {
-//            map.put("医生签名", docSignElement.outerHtml());
-            map.put("医生签名", "暂无");
+        if(map.containsKey("书写医生")&&XszyyCommonAnalysisUtil.extractDate(map.get("书写医生"))!=null){
+            map.put("记录时间",XszyyCommonAnalysisUtil.extractDate(map.get("书写医生")));
+            map.put("记录医生",map.get("书写医生").substring(0,map.get("书写医生").indexOf(map.get("记录时间"))));
         }
-        if (docSignTimeElement != null) {
-            map.put("医生签名时间", BeiLunHtmlAnalysisUtil.elementLayer1ToStr(docSignTimeElement, false).trim());
+        if(map.containsKey("医师签名")&&XszyyCommonAnalysisUtil.extractDate(map.get("医师签名"))!=null){
+            map.put("记录时间",XszyyCommonAnalysisUtil.extractDate(map.get("医师签名")));
+            map.put("记录医生",map.get("医师签名").substring(0,map.get("医师签名").indexOf(map.get("记录时间"))));
         }
-
-        //专科检查、辅助检查
-        Element yuElement = new Element("div");
-        if (tgjcTableElement != null) {
-            for (Element tgjcTableElementNt : tgjcTableElement.nextElementSiblings()) {
-                if (StringUtil.isNotBlank(disTableElementId) && tgjcTableElementNt.id().contains(disTableElementId)) {
-                    break;
-                }
-                if (tgjcTableElementNt.tagName().equals("table")) {
-                    continue;
-                }
-                tgjcTableElementNt.appendTo(yuElement);
-            }
+        if(map.containsKey("书写医师")&&XszyyCommonAnalysisUtil.extractDate(map.get("书写医师"))!=null){
+            map.put("记录时间",XszyyCommonAnalysisUtil.extractDate(map.get("书写医师")));
+            map.put("记录医生",map.get("书写医师").substring(0,map.get("书写医师").indexOf(map.get("记录时间"))));
         }
-        String yuText = BeiLunHtmlAnalysisUtil.blockDivToStr(yuElement, true)
-                .replace("体  格  检  查  表 (二)", "")
-                .replace("(补充及专科情况)", "")
-                .replace("辅  助  检  查", "辅助检查:")
-                .replace("诊断:", "")
-                .replace("补充专科情况", "补充专科情况:")
-                .trim();
-        CommonAnalysisUtil.cutByTitles(yuText, Lists.newArrayList("专科检查", "辅助检查"), 0, map);
 
     }
 
     //24小时出入院记录、24小时出入院记录(全院)、24小时入出院记录(全院通用)、24小时内入院死亡记录(全院通用)
     private void analysis24h(Document doc, Map<String, String> map) {
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
-        text = text.substring(text.lastIndexOf("24小时入出院记录姓    名")).replaceFirst("第1页", "");
-        List<String> titles = Lists.newArrayList("姓    名", "家庭住址", "性    别", "工作单位", "年    龄", "身份证号码", "民    族",
-                "联系人(关系)", "职    业", "入院时间", "婚    姻", "死亡时间", "记录时间", "出 生 地", "病史陈述者", "主    诉", "入院情况", "心理评估",
-                "疼痛评估", "营养评估", "功能评估", "入院诊断", "诊疗经过", "死亡原因", "死亡诊断", "出院情况", "出院诊断", "出院计划", "出院医嘱",
-                "出院去向", "医师签名", "书写时间");
-
-        CommonAnalysisUtil.cutByTitles(text, titles, 0, map);
-        CommonAnalysisUtil.processType(map, "出院去向");
+        List<String> titles = Lists.newArrayList("姓 名", "职 业", "性 别", "入院日期","年 龄", "记录日期", "婚 姻","病史陈述者", "出生地","可靠程度",
+                "民 族","身份证号码","发病节气","病案号","单位或住址","主 诉","现病史","既往史","个人史","婚育史","家族史",
+                "专项 评估","专项评估","当前用药","VAS疼痛评分","康复需求","心理状态","营养状况(NRS-2002营养风险筛查表)","VTE 风险","其他评估(如宗教信仰)",
+                "体 格 检 查","体 格 检 查 表 ( 一 )","体 格 检 查 表 (二)","补充及专科检查","辅 助 检 查", "入 院 诊 断","初步诊断",
+                "书写医生","医师签名","书写医师","修正诊断"
+        );
+        String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+        if (StringUtil.isNotBlank(htmlContent)) {
+            //有冒号版本
+//            XszyyCommonAnalysisUtil.html2StructureMap(titles,htmlContent,map);
+            //无冒号版本
+            XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,map);
+        }
+
+        if(map.containsKey("书写医生")&&XszyyCommonAnalysisUtil.extractDate(map.get("书写医生"))!=null){
+            map.put("记录时间",XszyyCommonAnalysisUtil.extractDate(map.get("书写医生")));
+            map.put("记录医生",map.get("书写医生").substring(0,map.get("书写医生").indexOf(map.get("记录时间"))));
+        }
+        if(map.containsKey("医师签名")&&XszyyCommonAnalysisUtil.extractDate(map.get("医师签名"))!=null){
+            map.put("记录时间",XszyyCommonAnalysisUtil.extractDate(map.get("医师签名")));
+            map.put("记录医生",map.get("医师签名").substring(0,map.get("医师签名").indexOf(map.get("记录时间"))));
+        }
+        if(map.containsKey("书写医师")&&XszyyCommonAnalysisUtil.extractDate(map.get("书写医师"))!=null){
+            map.put("记录时间",XszyyCommonAnalysisUtil.extractDate(map.get("书写医师")));
+            map.put("记录医生",map.get("书写医师").substring(0,map.get("书写医师").indexOf(map.get("记录时间"))));
+        }
+
     }
 
     //原-日间病历入出院记录、日间病历-性早熟
     private void analysisDay(Document doc, Map<String, String> map) {
-        //个人基础信息table解析
-        BeiLunHtmlAnalysisUtil.tableStyle1InsertMap(doc.getElementById("table1"), map);
-        //主诉、入院情况等table解析
-        BeiLunHtmlAnalysisUtil.tableStyle2InsertMap(doc.getElementById("table6"), map);
-        //医生签名、医生签名时间
-        Element docSignElement = null, docSignTimeElement = null;
-        for (Element table6ElementNt : doc.getElementById("table6").parent().nextElementSiblings()) {
-            docSignElement = table6ElementNt.selectFirst("image,img");
-            if (docSignElement != null) {
-                docSignTimeElement = table6ElementNt.nextElementSibling();
-                break;
-            }
+        List<String> titles = Lists.newArrayList("姓 名", "职 业", "性 别", "入院日期","年 龄", "记录日期", "婚 姻","病史陈述者", "出生地","可靠程度",
+                "民 族","身份证号码","发病节气","病案号","单位或住址","主 诉","现病史","既往史","个人史","婚育史","家族史",
+                "专项 评估","专项评估","当前用药","VAS疼痛评分","康复需求","心理状态","营养状况(NRS-2002营养风险筛查表)","VTE 风险","其他评估(如宗教信仰)",
+                "体 格 检 查","体 格 检 查 表 ( 一 )","体 格 检 查 表 (二)","补充及专科检查","辅 助 检 查", "入 院 诊 断","初步诊断",
+                "书写医生","医师签名","书写医师","修正诊断"
+        );
+        String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+        if (StringUtil.isNotBlank(htmlContent)) {
+            //有冒号版本
+//            XszyyCommonAnalysisUtil.html2StructureMap(titles,htmlContent,map);
+            //无冒号版本
+            XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,map);
+        }
+
+        if(map.containsKey("书写医生")&&XszyyCommonAnalysisUtil.extractDate(map.get("书写医生"))!=null){
+            map.put("记录时间",XszyyCommonAnalysisUtil.extractDate(map.get("书写医生")));
+            map.put("记录医生",map.get("书写医生").substring(0,map.get("书写医生").indexOf(map.get("记录时间"))));
         }
-        if (docSignElement != null) {
-//            map.put("医生签名", docSignElement.outerHtml());
-            map.put("医生签名", "暂无");
+        if(map.containsKey("医师签名")&&XszyyCommonAnalysisUtil.extractDate(map.get("医师签名"))!=null){
+            map.put("记录时间",XszyyCommonAnalysisUtil.extractDate(map.get("医师签名")));
+            map.put("记录医生",map.get("医师签名").substring(0,map.get("医师签名").indexOf(map.get("记录时间"))));
         }
-        if (docSignTimeElement != null) {
-            map.put("医生签名时间", BeiLunHtmlAnalysisUtil.elementLayer1ToStr(docSignTimeElement, false).trim());
+        if(map.containsKey("书写医师")&&XszyyCommonAnalysisUtil.extractDate(map.get("书写医师"))!=null){
+            map.put("记录时间",XszyyCommonAnalysisUtil.extractDate(map.get("书写医师")));
+            map.put("记录医生",map.get("书写医师").substring(0,map.get("书写医师").indexOf(map.get("记录时间"))));
         }
+
     }
 
     private void disHandleExt(Map<String, String> map) {

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunClinicBloodEffectHtmlAnalysis.java

@@ -44,7 +44,7 @@ public class BeiLunClinicBloodEffectHtmlAnalysis implements BeiLunHtmlAnalysis {
         );
 
          */
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -58,7 +58,7 @@ public class BeiLunClinicBloodEffectHtmlAnalysis implements BeiLunHtmlAnalysis {
         if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         CommonAnalysisUtil.extractWardInfo(recTitle,text, map);
         String bqjlText = "病情记录" + map.get("病情记录");
         List<String> titles = Lists.newArrayList(

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunClinicalBloodHtmlAnalysis.java

@@ -45,7 +45,7 @@ public class BeiLunClinicalBloodHtmlAnalysis implements BeiLunHtmlAnalysis {
                         }
                     }
             );
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -59,7 +59,7 @@ public class BeiLunClinicalBloodHtmlAnalysis implements BeiLunHtmlAnalysis {
         if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         CommonAnalysisUtil.extractWardInfo(recTitle,text, map);
         String bqjlText = "病情记录" + map.get("病情记录");
         List<String> titles = Lists.newArrayList(

+ 3 - 3
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunConsultationHtmlAnalysis.java

@@ -43,7 +43,7 @@ public class BeiLunConsultationHtmlAnalysis implements BeiLunHtmlAnalysis {
                     CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
                 }
             } else if ("协定方会诊".equals(recTitle)) {
-                htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
+                htmlContent = XszyyHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
                 if (StringUtil.isNotBlank(htmlContent)) {
                     htmlContent = htmlContent.replaceAll("[   ]", " ").replace("第1页", "");
                     CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
@@ -95,7 +95,7 @@ public class BeiLunConsultationHtmlAnalysis implements BeiLunHtmlAnalysis {
                 }
 
             } else {
-                htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
+                htmlContent = XszyyHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
                 //htmlContent = CommonAnalysisUtil.html2String(html);
                 if (StringUtil.isNotBlank(htmlContent)) {
                     htmlContent = htmlContent.replaceAll("[   ]", " ").replace("第1页", "");
@@ -110,7 +110,7 @@ public class BeiLunConsultationHtmlAnalysis implements BeiLunHtmlAnalysis {
                 }
             }
             CommonAnalysisUtil.processType(structureMap, "会诊类型");
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunConsultationRecordHtmlAnalysis.java

@@ -29,7 +29,7 @@ public class BeiLunConsultationRecordHtmlAnalysis implements BeiLunHtmlAnalysis
             String recTypeId = args[2];
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
             analysisGeneral(recTitle,bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -43,7 +43,7 @@ public class BeiLunConsultationRecordHtmlAnalysis implements BeiLunHtmlAnalysis
         if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         CommonAnalysisUtil.extractWardInfo(recTitle,text, map);
         String bqjlText = "病情记录" + map.get("病情记录");
         List<String> titles = Lists.newArrayList(

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunCrisisValueReportHtmlAnalysis.java

@@ -29,7 +29,7 @@ public class BeiLunCrisisValueReportHtmlAnalysis implements BeiLunHtmlAnalysis {
             String recTypeId = args[2];
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
             analysisGeneral(recTitle,bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -43,7 +43,7 @@ public class BeiLunCrisisValueReportHtmlAnalysis implements BeiLunHtmlAnalysis {
         if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         CommonAnalysisUtil.extractWardInfo(recTitle,text, map);
         String bqjlText = "病情记录" + map.get("病情记录");
         List<String> titles = Lists.newArrayList(

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

@@ -33,13 +33,13 @@ public class BeiLunCriticallyIllNoticeHtmlAnalysis implements BeiLunHtmlAnalysis
             String recTitle = args[1];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
-            String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
+            String htmlContent = XszyyHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
             if (StringUtil.isNotBlank(htmlContent)) {
                 htmlContent = htmlContent.replaceAll("[   ]", " ");
                 CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
             }
             CommonAnalysisUtil.extractDateByTitle(structureMap, "告知时间");
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

+ 4 - 4
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunDeathCaseDiscussHtmlAnalysis.java

@@ -31,16 +31,16 @@ public class BeiLunDeathCaseDiscussHtmlAnalysis implements BeiLunHtmlAnalysis {
             Element bigDivElement = doc.selectFirst("body").child(0);
 
             bigDivElement.child(0).lastElementSibling().remove();
-            map.put("医生签名时间", BeiLunHtmlAnalysisUtil.elementLayer1ToStr(bigDivElement.child(0).lastElementSibling(), false));
+            map.put("医生签名时间", XszyyHtmlAnalysisUtil.elementLayer1ToStr(bigDivElement.child(0).lastElementSibling(), false));
             bigDivElement.child(0).lastElementSibling().remove();
 
-            String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, false);
+            String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, false);
             List<String> titles = Lists.newArrayList("姓名", "性别", "出生日期", "科别", "病区", "床号", "住院号",
                     "入院诊断", "死亡诊断", "尸检结果", "讨论时间", "讨论地点",
                     "主 持 人", "参加人员", "具体讨论意见", "主持人小结意见", "主持人(签名)", "记录者签名");
             CommonAnalysisUtil.cutByTitlesNoColon(text, titles, 0, map);
-            BeiLunHtmlAnalysisUtil.mapValueRemoveStartColon(map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.mapValueRemoveStartColon(map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunDeathRecordHtmlAnalysis.java

@@ -31,13 +31,13 @@ public class BeiLunDeathRecordHtmlAnalysis implements BeiLunHtmlAnalysis {
             String recTitle = args[1];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
-            String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
+            String htmlContent = XszyyHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
             if (StringUtil.isNotBlank(htmlContent)) {
                 htmlContent = htmlContent.replaceAll("[   ]", " ");
                 CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
             }
             CommonAnalysisUtil.extractDateByTitle(structureMap, "记录时间");
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunDifficultCaseDiscussHtmlAnalysis.java

@@ -32,7 +32,7 @@ public class BeiLunDifficultCaseDiscussHtmlAnalysis implements BeiLunHtmlAnalysi
             String recTitle = args[1];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
-            String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
+            String htmlContent = XszyyHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
             if (StringUtil.isNotBlank(htmlContent)) {
                 htmlContent = htmlContent.replaceAll("[   ]", " ").replace("第一页","");
                 CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
@@ -47,7 +47,7 @@ public class BeiLunDifficultCaseDiscussHtmlAnalysis implements BeiLunHtmlAnalysi
 
                 }
             }
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunDutyShiftSystemHtmlAnalysis.java

@@ -29,7 +29,7 @@ public class BeiLunDutyShiftSystemHtmlAnalysis implements BeiLunHtmlAnalysis {
             String recTypeId = args[2];
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
             analysisGeneral(recTitle,bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -43,7 +43,7 @@ public class BeiLunDutyShiftSystemHtmlAnalysis implements BeiLunHtmlAnalysis {
         if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         CommonAnalysisUtil.extractWardInfo(recTitle,text, map);
         String bqjlText = "病情记录" + map.get("病情记录");
         List<String> titles = Lists.newArrayList(

+ 12 - 44
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunFirstCourseRecordHtmlAnalysis.java

@@ -3,7 +3,8 @@ package com.lantone.qc.trans.xszyy.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.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
+import com.lantone.qc.trans.yuhangsy.util.YuhangsyHtmlAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
@@ -25,55 +26,22 @@ public class BeiLunFirstCourseRecordHtmlAnalysis implements BeiLunHtmlAnalysis {
     public Map<String, String> analysis(String... args) {
         Map<String, String> structureMap = Maps.newLinkedHashMap();
         try {
-            List<String> titles = Lists.newArrayList("(一)病历特点", "(二)诊断依据", "(三)鉴别诊断",
-                    "(四)初步诊断", "(五)诊疗计划", "(二)拟诊讨论", "初步诊断", "诊断依据", "鉴别诊断", "(三)诊疗计划", "心理治疗", "(五)疼痛评估",
-                    "疼痛治疗", "营养治疗", "康复治疗", "VTE预防", "医生签名", "(六)诊疗计划");
             String html = args[0];
             String recTitle = args[1];
+            String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
-            String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
+            List<String> titles = Lists.newArrayList("病例特点","拟诊讨论","初步诊断","诊疗方案","医师签名"
+            );
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
             if (StringUtil.isNotBlank(htmlContent)) {
-                htmlContent = htmlContent.replace("—/—", "")
-                        .replace("第1页", "")
-                        .replace("建议先书写大病", "")
-                        .replace("历,并对导入的既往史和现病史进行归纳", "")
-                        .replace("若书写者为诊疗组长本人,以下签名框中可只签一个名字", "");
-                String[] lines = htmlContent.split("\n\n");
-                String text = "";
-                if (lines.length > 1) {
-                    if (lines[0].contains("宁波市北仑区人民医院")) {
-                        for (int i = 1; i < lines.length; i++) {
-                            text += lines[i];
-                        }
-                    } else {
-                        for (int i = 0; i < lines.length; i++) {
-                            text += lines[i];
-                        }
-                    }
-                    //htmlContent = lines[1];
-                } else if (lines.length == 1) {
-                    text = lines[0];
-                }
-                if (StringUtil.isNotBlank(text)) {
-                    String date = CommonAnalysisUtil.extractDate(text);
-                    if (StringUtil.isNotBlank(date)) {
-                        structureMap.put("时间", date);
-                        text = text.replace(date, "");
-                    }
-                    text = text.replaceAll("[   ]", " ");
-                    CommonAnalysisUtil.html2StructureMap(titles, text, structureMap);
-                }
-            }
-            if (structureMap.containsKey("(一)病历特点")) {
-                CommonAnalysisUtil.cutByTitles(structureMap.get("(一)病历特点"), Lists.newArrayList("入院查体", "辅助检查"), 0, structureMap);
-                if (structureMap.containsKey("入院查体")) {
-                    structureMap.put("(一)病历特点", structureMap.get("(一)病历特点").split("入院查体")[0]);
+                //无冒号版本
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,structureMap);
+                if(XszyyCommonAnalysisUtil.extractDate(htmlContent)!=null){
+                    structureMap.put("病历日期",XszyyCommonAnalysisUtil.extractDate(htmlContent));
                 }
             }
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, args[2], structureMap);
-            //        CommonAnalysisUtil.extractDateByTitle(structureMap, "时间");
-            //        structureMap.forEach((k,v)-> System.out.println(k + "------" + v));
-            //        structureMap.put("rec_title=", "107");
+            structureMap.put("标题",recTitle);
+            YuhangsyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunInformedHtmlAnalysis.java

@@ -44,7 +44,7 @@ public class BeiLunInformedHtmlAnalysis implements BeiLunHtmlAnalysis {
             String recTitle = args[1];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
-            String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
+            String htmlContent = XszyyHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
             if (StringUtil.isNotBlank(recTitle) && recTitle.contains("知情选择授权书")) {
                 structureMap.put("标题", recTitle);
                 return structureMap;
@@ -71,7 +71,7 @@ public class BeiLunInformedHtmlAnalysis implements BeiLunHtmlAnalysis {
 
             resultHandle(structureMap);
             disDate(structureMap, "医师签名", "签名时间");
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunInvasiveOperationHtmlAnalysis.java

@@ -42,7 +42,7 @@ public class BeiLunInvasiveOperationHtmlAnalysis implements BeiLunHtmlAnalysis {
             String recTitle = args[1];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
-            String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
+            String htmlContent = XszyyHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
                 CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
             if (MapUtils.isNotEmpty(structureMap)) {
                 structureMap = OrdinaryAssistant.mapKeyContrast(structureMap, keyContrasts);
@@ -52,7 +52,7 @@ public class BeiLunInvasiveOperationHtmlAnalysis implements BeiLunHtmlAnalysis {
                 structureMap.put("术后注意",cases);
             }
             structureMap = preSolve(htmlContent, structureMap);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

+ 12 - 19
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunLeaveHospitalHtmlAnalysis.java

@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
@@ -25,31 +26,23 @@ public class BeiLunLeaveHospitalHtmlAnalysis implements BeiLunHtmlAnalysis {
     public Map<String, String> analysis(String... args) {
         Map<String, String> structureMap = Maps.newLinkedHashMap();
         try {
-            List<String> titles = Lists.newArrayList("姓名", "出生年月", "性别", "年龄", "出生日期", "科室", "病区", "床位", "床号", "住院号 ", "住院号",
-                    "入院日期", "出院日期", "地址", "住院天数", "婚姻", "入院诊断", "出院诊断", "分娩日期", "分娩方式", "手术指征",
-                    "入院情况", "诊治经过", "入院后检查化验结果", "入院后化验检查结果", "诊疗经过", "治疗结果", "出院计划", "病理检查结果", "出院情况", "婴儿情况",
-                    "治疗效果", "出院医嘱", "医师签名", "日期", "病理号", "X片号", "MR号", "CT号", "其它", "主治医师", "住院医师");
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
-            String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
+
+            List<String> titles = Lists.newArrayList("姓名","病区","床号","住院号","出 院 记 录",
+                    "入院时间","出院时间","住院天数","入院情况","入院诊断","诊治经过","出院情况","出院诊断","出院医嘱",
+                    "患者或其授权人签字","医师签名","日期","出院温馨提示"
+            );
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
             if (StringUtil.isNotBlank(htmlContent)) {
-                htmlContent = htmlContent.replace("下拉选择无或右键调用临床数据", "");
-                htmlContent = htmlContent.replaceAll("[   ]", " ").replace("第1页", "");
-                htmlContent = htmlContent.replace("\n", "");
-                List<String> sortTitles = CommonAnalysisUtil.sortTitles(titles, htmlContent.replace("复诊时间", ""));
-                sortTitles.add("时间");
-                CommonAnalysisUtil.cutByTitles(htmlContent, sortTitles, 0, structureMap);
-            }
-            if (structureMap.containsKey("出院诊断") && structureMap.get("出院诊断").contains("入院情况")) {
-                String discharge = structureMap.get("出院诊断");
-                int index = discharge.indexOf("入院情况");
-                structureMap.put("出院诊断", discharge.substring(0, index));
-                structureMap.put("入院情况", discharge.substring(index + 4));
+                //无冒号版本
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,structureMap);
             }
-            CommonAnalysisUtil.extractDateByTitle(structureMap, "时间");
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+
+
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunOperationHtmlAnalysis.java

@@ -30,7 +30,7 @@ public class BeiLunOperationHtmlAnalysis implements BeiLunHtmlAnalysis {
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
             analysisGeneral(recTitle, bigDivElement, map);
             CommonAnalysisUtil.makeEmpty(map, "医生签名");
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -44,7 +44,7 @@ public class BeiLunOperationHtmlAnalysis implements BeiLunHtmlAnalysis {
         if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         CommonAnalysisUtil.extractWardInfo(recTitle, text, map);
         String bqjlText = "病情记录" + map.get("病情记录")
                 .replace("提醒:有创诊疗操作记录内容包括操作名称、时间、步骤、结果及患者的一般情况,记录操作过","")

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunOperationInformedHtmlAnalysis.java

@@ -38,7 +38,7 @@ public class BeiLunOperationInformedHtmlAnalysis implements BeiLunHtmlAnalysis {
             String recTitle = args[1];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
-            String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
+            String htmlContent = XszyyHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
             if (StringUtil.isNotBlank(htmlContent)) {
                 htmlContent = htmlContent.replaceAll("[   ]", " ");
                 CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
@@ -52,7 +52,7 @@ public class BeiLunOperationInformedHtmlAnalysis implements BeiLunHtmlAnalysis {
 
             resultHandle(structureMap);
             parseMethod(structureMap);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

+ 3 - 3
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunOperationRecordHtmlAnalysis.java

@@ -30,7 +30,7 @@ public class BeiLunOperationRecordHtmlAnalysis implements BeiLunHtmlAnalysis {
             String recTypeId = args[2];
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
             analysisGeneral(bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.mapValueRemoveStartColon(map);
+            XszyyHtmlAnalysisUtil.mapValueRemoveStartColon(map);
             String operatingCrew = null;
             if (map.containsKey("手术人员")) {
                 operatingCrew = map.get("手术人员");
@@ -61,7 +61,7 @@ public class BeiLunOperationRecordHtmlAnalysis implements BeiLunHtmlAnalysis {
                 }
             }
             CommonAnalysisUtil.makeEmpty(map, "医生签名");
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -72,7 +72,7 @@ public class BeiLunOperationRecordHtmlAnalysis implements BeiLunHtmlAnalysis {
         /*if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }*/
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         text = text.replaceAll("第1页", "");
         List<String> titles = Lists.newArrayList(
                 "姓名", "性别", "出生日期", "出生年月", "科别", "科室", "病区", "床号", "床位", "住院号",

+ 3 - 3
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunPreoperativeHtmlAnalysis.java

@@ -31,8 +31,8 @@ public class BeiLunPreoperativeHtmlAnalysis implements BeiLunHtmlAnalysis {
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
             analysisGeneral(bigDivElement, map);
 
-            BeiLunHtmlAnalysisUtil.mapValueRemoveStartColon(map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.mapValueRemoveStartColon(map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -43,7 +43,7 @@ public class BeiLunPreoperativeHtmlAnalysis implements BeiLunHtmlAnalysis {
         /*if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }*/
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
 
         int index1 = text.lastIndexOf("经治医生签名");
         int index2 = text.lastIndexOf("主刀医生签名");

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunRescueHtmlAnalysis.java

@@ -29,7 +29,7 @@ public class BeiLunRescueHtmlAnalysis implements BeiLunHtmlAnalysis {
             String recTypeId = args[2];
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
             analysisGeneral(recTitle,bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -43,7 +43,7 @@ public class BeiLunRescueHtmlAnalysis implements BeiLunHtmlAnalysis {
         if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         CommonAnalysisUtil.extractWardInfo(recTitle,text, map);
         String bqjlText = "病情记录" + map.get("病情记录");
         List<String> titles = Lists.newArrayList(

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunStagesSummaryHtmlAnalysis.java

@@ -29,7 +29,7 @@ public class BeiLunStagesSummaryHtmlAnalysis implements BeiLunHtmlAnalysis {
             String recTypeId = args[2];
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
             analysisGeneral(recTitle, bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -43,7 +43,7 @@ public class BeiLunStagesSummaryHtmlAnalysis implements BeiLunHtmlAnalysis {
         if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         CommonAnalysisUtil.extractWardInfo(recTitle, text, map);
         String bqjlText = "病情记录" + map.get("病情记录");
         List<String> titles = Lists.newArrayList(

+ 16 - 12
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunThreeLevelWardHtmlAnalysis.java

@@ -2,7 +2,7 @@ package com.lantone.qc.trans.xszyy.util;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
-import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
@@ -31,18 +31,22 @@ public class BeiLunThreeLevelWardHtmlAnalysis implements BeiLunHtmlAnalysis {
             String recTitle = args[1];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
-            Element bigDivElement = doc.selectFirst("body").child(0);
-            if (bigDivElement.childNodeSize() == 1) {
-                bigDivElement = bigDivElement.child(0);
-            }
-            if (bigDivElement.selectFirst("hr") != null) {
-                bigDivElement.selectFirst("hr").previousElementSiblings().remove();
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+            XszyyCommonAnalysisUtil.xszyyExtractWardInfo(recTitle, htmlContent, structureMap);
+
+            //病情记录存在副主任医师和书写医师字段
+            if(structureMap.containsKey("病情记录")){
+                String bqtext = structureMap.get("病情记录");
+
+                //无冒号版本
+                List<String> titles = Lists.newArrayList("副主任医师:","/","书写医师"
+                );
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,bqtext,structureMap);
+                structureMap.put("病情记录",bqtext.substring(0,bqtext.lastIndexOf("副主任医师")));
             }
-            String htmlText = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
-            htmlText = htmlText.replace("注意:上级医师查房主要记 录:患者病情、诊断、鉴别诊断、当前治疗措施和疗效的分析及下一步诊疗意见等,能反应上级医 师的水平。", "")
-                    .replace("提醒:有创诊疗操作记录内容包括操作名称、时间、步骤、结果及患者的一般情况,记录操作过 程是否顺利,有无不良反应,术后注意事项,操作医师签名、记录时间等。 手术室完成的、治疗性质的及全麻下完成的有创诊疗操作参照手术管理。(包括介入治疗、胃肠镜 下肿瘤切除/粘膜下肿瘤剥除等)", "");
-            CommonAnalysisUtil.extractWardInfo(recTitle, htmlText, structureMap);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+
+
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunTransferIntoHtmlAnalysis.java

@@ -29,7 +29,7 @@ public class BeiLunTransferIntoHtmlAnalysis implements BeiLunHtmlAnalysis {
             String recTypeId = args[2];
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
             analysisGeneral(recTitle, bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -43,7 +43,7 @@ public class BeiLunTransferIntoHtmlAnalysis implements BeiLunHtmlAnalysis {
         if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         CommonAnalysisUtil.extractWardInfo(recTitle, text, map);
         String bqjlText = "病情记录" + map.get("病情记录");
         List<String> titles = Lists.newArrayList(

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunTransferOutHtmlAnalysis.java

@@ -29,7 +29,7 @@ public class BeiLunTransferOutHtmlAnalysis implements BeiLunHtmlAnalysis {
             String recTypeId = args[2];
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
             analysisGeneral(recTitle, bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -43,7 +43,7 @@ public class BeiLunTransferOutHtmlAnalysis implements BeiLunHtmlAnalysis {
         if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         CommonAnalysisUtil.extractWardInfo(recTitle, text, map);
         String bqjlText = "病情记录" + map.get("病情记录").replace("年   月   日   时   分 ","");
         List<String> titles = Lists.newArrayList(

+ 1 - 1
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunHtmlAnalysisUtil.java

@@ -14,7 +14,7 @@ import java.util.Map;
  * @author: rengb
  * @time: 2020/9/15 16:31
  */
-public class BeiLunHtmlAnalysisUtil {
+public class XszyyHtmlAnalysisUtil {
 
     /**
      * table样式:key和value在同一个td中,以冒号分开;保留换行

+ 695 - 0
trans/src/main/java/com/lantone/qc/trans/xszyy/util/comsis/XszyyCommonAnalysisUtil.java

@@ -0,0 +1,695 @@
+package com.lantone.qc.trans.xszyy.util.comsis;
+
+import com.google.common.collect.Lists;
+import com.lantone.qc.pub.util.StringUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.nodes.Node;
+import org.jsoup.select.Elements;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @Description :余杭三院自定义
+ * @Author : HUJING
+ * @Date: 2020/9/10 13:48
+ */
+@Slf4j
+public class XszyyCommonAnalysisUtil {
+
+    /**
+     * 取文书中全部文本
+     *
+     * @param html
+     * @return
+     */
+    public static String html2String(String html) {
+        try {
+            Document document = Jsoup.parse(html);
+            Element body = document.select("body").first();
+            List<Node> nodes = body.childNodes();
+            Node node = nodes.get(0);
+            if (" ".equals(node.toString())) {
+                node = nodes.get(1);
+            }
+            String htmlContent = null;
+            if (node instanceof Element) {
+                Element element = (Element) node;
+                htmlContent = element.text();
+            }
+            return htmlContent;
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            return "";
+        }
+    }
+
+    public static void html2StructureMap(List<String> titles, String htmlText, Map<String, String> structureMap) {
+        List<String> sortTitles = sortTitles(titles, htmlText);
+        cutByTitles(htmlText, sortTitles, 0, structureMap);
+    }
+
+    /**
+     * 将html内容以行为单位存进list,从<hr>之后开始处理
+     *
+     * @param html 原始html内容
+     * @return
+     */
+    public List<String> html2List(String html, boolean existHr) {
+        List<String> htmlText = Lists.newArrayList();
+        Document document = Jsoup.parse(html);
+        Element body = document.select("body").first();
+        List<Node> nodes = body.childNodes();
+        List<Node> subNodes = nodes.get(0).childNodes();
+        boolean findNode = false;
+        for (Node node : subNodes) {
+            if ("hr".equals(node.nodeName())) {
+                findNode = true;
+                continue;
+            }
+            if (findNode || !existHr) {
+                Element element = (Element) node;
+                Elements elements = element.select("div");
+                for (Element e : elements) {
+                    String text = e.text();
+                    if (text.length() > 150) {
+                        continue;
+                    }
+                    htmlText.add(text);
+                }
+            }
+        }
+        if (htmlText.get(0).length() > 200) {
+            htmlText.remove(0);
+        }
+        return htmlText;
+    }
+
+    /**
+     * 将html内容以table的格式存进list
+     *
+     * @param html 原始html内容
+     * @return
+     */
+    public void html2ListByTable(String html, List<String> htmlText) {
+        Elements trs = Jsoup.parse(html).select("table").select("tr");
+        for (int i = 0; i < trs.size(); i++) {
+            Elements tds = trs.get(i).select("td");
+            for (int j = 0; j < tds.size(); j++) {
+                String text = tds.get(j).text();
+                htmlText.add(text);
+            }
+        }
+    }
+
+    /**
+     * 将list中html内容转换成structureMap
+     *
+     * @param titles       文书各标题
+     * @param htmlText     html内容以行的形式存储list
+     * @param structureMap
+     * @return
+     */
+    public void html2StructureMap(List<String> titles, List<String> htmlText, Map<String, String> structureMap) {
+        StringBuffer sb = new StringBuffer();
+        for (String line : htmlText) {
+            String text = line.replaceAll("[   ]", " ");
+            if (text.length() == 0) {
+                continue;
+            }
+            sb.append(text).append("\n");
+        }
+        html2StructureMap(titles, sb.toString(), structureMap);
+    }
+
+    /**
+     * 根据文书各标题截取相应文本,存入structmap中
+     *
+     * @param line         原始文本
+     * @param titles       文书各标题
+     * @param depth        递归深度,也就是titles取值时的下标值
+     * @param structureMap 存储结构化数据
+     */
+    public static void cutByTitles(String line, List<String> titles, int depth, Map<String, String> structureMap) {
+        if (depth > titles.size() || titles.size() == 0) {
+            return;
+        }
+        String beforeTitle = null, title = null, newTitle = null, value = null;
+        beforeTitle = StringUtil.removeBlank(titles.get(Math.max(depth - 1, 0)));
+        title = titles.get(Math.min(depth, titles.size() - 1));
+        if (depth == titles.size()) {
+            /*if (line.contains("\n")) {
+                line = line.split("\n")[0];
+            }
+            */
+            value = line.replace("\n", "");
+            if (StringUtil.isBlank(structureMap.get(beforeTitle))) {
+                structureMap.put(beforeTitle, StringUtil.trim(value));
+            }
+            return;
+        }
+        if (line.contains(title + ":") || line.contains(title + ":")) {
+            if (line.contains(title + ":")) {
+                newTitle = title + ":";
+            } else {
+                newTitle = title + ":";
+            }
+            if (depth > 0) {
+                value = line.substring(0, line.indexOf(newTitle));
+                if (StringUtil.isBlank(structureMap.get(beforeTitle))) {
+                    structureMap.put(beforeTitle, StringUtil.trim(value).replace("\n", ""));
+                }
+            }
+            line = line.substring(line.indexOf(newTitle) + newTitle.length());
+            depth++;
+        } else {
+            titles.remove(depth);
+        }
+        cutByTitles(line, titles, depth, structureMap);
+    }
+
+    /**
+     * 将title根据在文本中的位置排序
+     *
+     * @param titles
+     * @param content
+     * @return
+     */
+    public static List<String> sortTitles(List<String> titles, String content) {
+        Map<Integer, String> titleIndex = new TreeMap<>();
+        int index, index_1, index_2;
+        for (String title : titles) {
+            index_1 = content.indexOf(title + ":");
+            index_2 = content.indexOf(title + ":");
+            index = Math.max(index_1, index_2);
+            if (index != -1) {
+                titleIndex.put(index, title);
+                StringBuffer sb = new StringBuffer(title.length());
+                for (int i = 0; i < title.length(); i++) {
+                    sb.append('*');
+                }
+                content = content.substring(0, index) + sb.toString() + content.substring(index + title.length() + 1);
+                //                content = content.substring(0, index) + content.substring(index + title.length() + 1);
+            }
+        }
+        titles = Lists.newArrayList(titleIndex.values());
+        return titles;
+    }
+
+    /**
+     * 标题没有冒号版本
+     */
+    public static void html2StructureMapNoColon(List<String> titles, String htmlText, Map<String, String> structureMap) {
+        List<String> sortTitlesNoColon = sortTitlesNoColon(titles, htmlText);
+        cutByTitlesNoColon(htmlText, sortTitlesNoColon, 0, structureMap);
+    }
+
+    /**
+     * 标题没有冒号版本
+     */
+    public static void cutByTitlesNoColon(String line, List<String> titles, int depth, Map<String, String> structureMap) {
+        if (depth > titles.size() || titles.size() == 0) {
+            return;
+        }
+        String beforeTitle = null, title = null, newTitle = null, value = null;
+        beforeTitle = StringUtil.removeBlank(titles.get(Math.max(depth - 1, 0)));
+        title = titles.get(Math.min(depth, titles.size() - 1));
+        if (depth == titles.size()) {
+            value = line;
+            value = value.trim();
+            if (value.startsWith(":") || value.startsWith(":")) {
+                value = value.replaceFirst("[::]", "");
+            }
+            if (StringUtil.isBlank(structureMap.get(beforeTitle))) {
+                structureMap.put(beforeTitle, StringUtil.trim(value).replace("\n", ""));
+            }
+            return;
+        }
+        if (line.contains(title)) {
+            newTitle = title;
+            if (depth > 0) {
+                value = line.substring(0, line.indexOf(newTitle));
+                value = value.trim();
+                if (value.startsWith(":") || value.startsWith(":")) {
+                    value = value.replaceFirst("[::]", "");
+                }
+                if (StringUtil.isBlank(structureMap.get(beforeTitle))) {
+                    structureMap.put(beforeTitle, StringUtil.trim(value).replace("\n", ""));
+                }
+            }
+            line = line.substring(line.indexOf(newTitle) + newTitle.length());
+            depth++;
+        } else {
+            titles.remove(depth);
+        }
+        cutByTitlesNoColon(line, titles, depth, structureMap);
+    }
+
+    /**
+     * 标题没有冒号版本
+     */
+    public static List<String> sortTitlesNoColon(List<String> titles, String content) {
+        Map<Integer, String> titleIndex = new TreeMap<>();
+        int index;
+        for (String title : titles) {
+            index = content.indexOf(title);
+            if (index != -1) {
+                titleIndex.put(index, title);
+                content = content.replace(title, "");
+            }
+        }
+        titles = Lists.newArrayList(titleIndex.values());
+        return titles;
+    }
+
+    /**
+     * 抽取文本中的第一个时间(余杭三院)
+     *
+     * @param top
+     * @return
+     */
+    public static String extractDate(String top) {
+        Pattern pattern = Pattern.compile("[0-9]{4}[-][0-9]{1,2}[-][0-9]{1,2}([ ][0-9]{1,2}[:][0-9]{1,2}([:][0-9]{1,2})?)?");
+        Pattern pattern2 = Pattern.compile("[0-9]{4}[年][0-9]{1,2}[月][0-9]{1,2}[日]([ ])?([0-9]{1,2}[时]?[:]?)?([0-9]{1,2}[分]?[:]?)?([0-9]{1,2}[秒]?)?");
+        Matcher matcher = pattern.matcher(top);
+        Matcher matcher2 = pattern2.matcher(top);
+        if (matcher2.find()) {
+            return matcher2.group(0);
+        } else if (matcher.find()) {
+            return matcher.group(0);
+        } else {
+            Pattern p1 = Pattern.compile("[0-9]{4}年[0-9]+月[0-9]+日[0-9]+时[0-9]+分");
+            Matcher m1 = p1.matcher(top);
+            if (m1.find()) {
+                return m1.group(0);
+            } else {
+                Pattern p2 = Pattern.compile("[0-9]{4}年[0-9]+月[0-9]+日 [0-9]+:[0-9]+ | [0-9]{4}年[0-9]+月[0-9]+日[0-9]+:[0-9]+ ");
+                Matcher m2 = p2.matcher(top);
+                if (m2.find()) {
+                    return m2.group(0);
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 宁波中医院抽取文本中的第一个时间
+     *
+     * @param top
+     * @return
+     */
+    public static String NBZYExtractDate(String top) {
+        Pattern p1 = Pattern.compile("[0-9]{4}年[0-9]+月[0-9]+日");
+        Matcher m1 = p1.matcher(top);
+        if (m1.find()) {
+            return m1.group(0);
+        }
+        return null;
+    }
+
+    /**
+     * 温附一抽取文本中的第一个时间
+     *
+     * @param top
+     * @return
+     */
+    public static String WFYExtractDate(String top) {
+        Pattern p1 = Pattern.compile("[0-9]+月[0-9]+日[0-9]+时[0-9]+分");
+        Matcher m1 = p1.matcher(top);
+        if (m1.find()) {
+            return m1.group(0);
+        }
+        return null;
+    }
+
+    /**
+     * 宁海医院抽取文本中的第一个时间
+     *
+     * @param top
+     * @return
+     */
+    public static String NHExtractDate(String top) {
+        Pattern pattern = Pattern.compile("[0-9]{4}年[0-9]+月[0-9]+日 [0-9]+:[0-9]+ | [0-9]{4}年[0-9]+月[0-9]+日[0-9]+:[0-9]+");
+        Matcher matcher = pattern.matcher(top);
+        if (matcher.find()) {
+            return matcher.group(0);
+        } else {
+            Pattern p1 = Pattern.compile("[0-9]{4}年[0-9]+月[0-9]+日[0-9]+时[0-9]+分");
+            Matcher m1 = p1.matcher(top);
+            if (m1.find()) {
+                return m1.group(0);
+            } else {
+                Pattern p2 = Pattern.compile("[0-9]{4}[-][0-9]{1,2}[-][0-9]{1,2}([ ][0-9]{1,2}[:][0-9]{1,2}([:][0-9]{1,2})?)?");
+                Matcher m2 = p2.matcher(top);
+                if (m2.find()) {
+                    return m2.group(0);
+                }
+            }
+            Pattern pattern3 = Pattern.compile("[0-9]{4}年[0-9]+月[0-9]+日 [0-9]+:[0-9]+|[0-9]{4}年[0-9]+月[0-9]+日[0-9]+:[0-9]+");
+            Matcher matcher3 = pattern3.matcher(top);
+            if (matcher3.find()) {
+                return matcher3.group(0);
+            }
+
+        }
+        return null;
+    }
+
+    /**
+     * 根据title重新存放时间
+     *
+     * @param structmap
+     * @param title
+     */
+    public static void extractDateByTitle(Map<String, String> structmap, String title) {
+        if (structmap.containsKey(title)) {
+            String date = extractDate(structmap.get(title));
+            if (StringUtil.isNotBlank(date)) {
+                structmap.put(title, date);
+            }
+        }
+    }
+
+    /**
+     * 若内容中是包含选择框(会诊类型:     急会诊       普通会诊         请院外会诊),特殊处理
+     *
+     * @param structureMap
+     */
+    public static void processType(Map<String, String> structureMap, String title) {
+        if (structureMap.containsKey(title)) {
+            String type = structureMap.get(title);
+            type = type.replace(" ", "").replace("\uF06F", " \uF06F")
+                    .replace("\uF0FE", " \uF0FE");
+            String[] types = type.split(" ");
+            String s = "";
+            for (String t : types) {
+                if (t.contains("\uF0FE")) {
+                    s += t;
+                }
+            }
+            s = s.replace("\uF0FE", "");
+            structureMap.put(title, s);
+        }
+    }
+
+    /**
+     * 若内容中是包含选择框(会诊类型:     急会诊       普通会诊         请院外会诊),特殊处理
+     *
+     * @param structureMap
+     */
+    public static void processTypeRight(Map<String, String> structureMap, String title) {
+        if (structureMap.containsKey(title)) {
+            String type = structureMap.get(title);
+            String[] types = type.split(" ");
+            String s = "";
+            for (String t : types) {
+                if (t.contains("\uF0FE")) {
+                    s += t;
+                }
+            }
+            s = s.replace("\uF0FE", "");
+            structureMap.put(title, s);
+        }
+    }
+
+    /**
+     * 若list中其中一个元素包含之后第二个、第三个元素的文本,则把这个元素删除
+     *
+     * @param htmlList
+     */
+    public static void removeRepeat(List<String> htmlList) {
+        List<Integer> index = Lists.newArrayList();
+        if (htmlList.size() < 3) {
+            return;
+        }
+        String str1 = null, str2 = null, str3 = null;
+        for (int i = 0; i < htmlList.size() - 2; i++) {
+            str1 = htmlList.get(i);
+            str2 = htmlList.get(i + 1);
+            str3 = htmlList.get(i + 2);
+            if (str1.contains(str2) && str1.contains(str3)) {
+                index.add(i);
+            }
+        }
+
+        for (int i = 0; i < index.size(); i++) {
+            htmlList.remove(index.get(i) - i);
+        }
+    }
+
+    /**
+     * 宁海用抽取自定义病程录信息
+     *
+     * @param htmlText
+     * @param structureMap
+     */
+    public static void NHExtractWardInfo(String recTitle, String htmlText, Map<String, String> structureMap) {
+        if (StringUtil.isNotBlank(htmlText)) {
+            htmlText = htmlText.replaceAll("[   \n]", " ").replace("第1页", "")
+                    .replace("\n", " ");
+            String date = NHExtractDate(htmlText);
+            if (date != null) {
+                structureMap.put("病历日期", date);
+                htmlText = htmlText.replace(date, "").trim();
+            }
+            List<String> titleContent = Lists.newArrayList(htmlText.split(" "));
+            String title = titleContent.get(0);
+            String jointTitle = titleContent.get(1);
+            if (StringUtil.isNotBlank(title) && StringUtil.isNotBlank(jointTitle) && jointTitle.contains("医师查房记录")) {
+                structureMap.put("病历标题", title + jointTitle);
+                titleContent.remove(0);
+                titleContent.remove(0);
+            } else {
+                structureMap.put("病历标题", recTitle);
+                titleContent.remove(0);
+            }
+            StringBuffer sb = new StringBuffer();
+            for (String text : titleContent) {
+                sb.append(text).append(" ");
+            }
+            String content = sb.toString();
+            if (content.contains("<img")) {
+                String[] contentDoctor = content.split("<img");
+                structureMap.put("病情记录", contentDoctor[0]);
+                structureMap.put("记录医生", "<img" + contentDoctor[1]);
+            } else {
+                structureMap.put("病情记录", content);
+            }
+//            if (structureMap.containsKey("病情记录")) {
+//                String info = structureMap.get("病情记录");
+//                if (info.contains("医生签名")) {
+//                    structureMap.put("病情记录", info.substring(0, info.lastIndexOf("医生签名")));
+//                    structureMap.put("记录医生", "");
+//                } else if (info.contains("医师签名")) {
+//                    structureMap.put("病情记录", info.substring(0, info.lastIndexOf("医师签名")));
+//                    structureMap.put("记录医生", "");
+//                }
+//            }
+        }
+    }
+
+    /**
+     * 抽取自定义病程录信息
+     *
+     * @param htmlText
+     * @param structureMap
+     */
+    public static void extractWardInfo(String recTitle, String htmlText, Map<String, String> structureMap) {
+        if (StringUtil.isNotBlank(htmlText)) {
+            htmlText = htmlText.replaceAll("[   \n]", " ").replace("第1页", "")
+                    .replace("\n", " ");
+            String date = extractDate(htmlText);
+            if (date != null) {
+                structureMap.put("病历日期", date);
+                htmlText = htmlText.replace(date, "").trim();
+            }
+            List<String> titleContent = Lists.newArrayList(htmlText.split(" "));
+            String title = titleContent.get(0);
+            if (StringUtil.isNotBlank(title) && title.equals(recTitle)) {
+                structureMap.put("病历标题", title);
+                titleContent.remove(0);
+            } else {
+                structureMap.put("病历标题", recTitle);
+                structureMap.put("文书标题", title);
+                if (titleContent.size() > 2) {
+                    titleContent.remove(0);
+                    titleContent.remove(0);
+                }
+            }
+            StringBuffer sb = new StringBuffer();
+            for (String text : titleContent) {
+                sb.append(text).append(" ");
+            }
+            String content = sb.toString();
+            if (content.contains("<img")) {
+                String[] contentDoctor = content.split("<img");
+                structureMap.put("病情记录", contentDoctor[0]);
+                structureMap.put("记录医生", "<img" + contentDoctor[1]);
+            } else {
+                structureMap.put("病情记录", content);
+            }
+            if (structureMap.containsKey("病情记录")) {
+                String info = structureMap.get("病情记录");
+                if (info.contains("医生签名")) {
+                    structureMap.put("病情记录", info.substring(0, info.lastIndexOf("医生签名")));
+                    structureMap.put("记录医生", "");
+                } else if (info.contains("医师签名")) {
+                    structureMap.put("病情记录", info.substring(0, info.lastIndexOf("医师签名")));
+                    structureMap.put("记录医生", "");
+                }
+            }
+        }
+    }
+
+    /**
+     * 抽取自定义病程录信息(余杭三院)
+     *
+     * @param htmlText
+     * @param structureMap
+     */
+    public static void extractWardInfo2(String recTitle, String htmlText, Map<String, String> structureMap) {
+        if (StringUtil.isNotBlank(htmlText)) {
+            htmlText = htmlText.replaceAll("[   \n]", " ").replace("第1页", "")
+                    .replace("\n", " ");
+            String date = extractDate(htmlText);
+            if (date != null) {
+                structureMap.put("病历日期", date);
+                htmlText = htmlText.replaceFirst(date, "").trim();
+            }
+            List<String> titleContent = Lists.newArrayList(htmlText.split(" "));
+            String title = titleContent.get(0);
+            if (StringUtil.isNotBlank(title) && title.equals(recTitle)) {
+                structureMap.put("病历标题", title);
+                titleContent.remove(0);
+            } else {
+                structureMap.put("病历标题", recTitle);
+                if (title.contains(recTitle)) {
+                    titleContent.set(0, title.substring(title.indexOf(recTitle) + recTitle.length()));
+                }
+            }
+            StringBuffer sb = new StringBuffer();
+            for (String text : titleContent) {
+                sb.append(text).append(" ");
+            }
+            structureMap.put("病情记录", sb.toString());
+            if (structureMap.containsKey("病情记录")) {
+                String info = structureMap.get("病情记录");
+                if (info.contains("记录医师")) {
+                    structureMap.put("病情记录", info.substring(0, info.lastIndexOf("记录医师")));
+                    structureMap.put("记录医师", info.substring(info.lastIndexOf("记录医师") + "记录医师:".length()));
+                } else if (info.contains("医师签名")) {
+                    structureMap.put("病情记录", info.substring(0, info.lastIndexOf("医师签名")));
+                    structureMap.put("医师签名", info.substring(info.lastIndexOf("医师签名") + "医师签名:".length()));
+                }
+            }
+        }
+    }
+
+    /**
+     * 替换值
+     *
+     * @param map
+     * @param key
+     * @param afterKey
+     */
+    public static void repKey(Map<String, String> map, String key, String afterKey) {
+        if (StringUtil.isNotBlank(map.get(key))) {
+            map.put(key, map.get(key).replaceAll(afterKey, ""));
+        }
+    }
+
+    public static void makeEmpty(Map<String, String> structureMap, String... key) {
+        for (String k : key) {
+            if (structureMap.containsKey(k)) {
+                structureMap.put(k, "");
+            }
+        }
+    }
+
+    /**
+     * 格式时间从yyyy年MM月dd日HH时mm分到yyyy-MM-dd HH:mm
+     *
+     * @param map
+     */
+    public static void signatureTime1(String changeCame, Map<String, String> map) {
+        String goCureDoctor = map.get(changeCame);
+        if (StringUtil.isNotBlank(goCureDoctor)) {
+            try {
+                Pattern pattern2 = Pattern.compile("[0-9]{4}[年][0-9]{1,2}[月][0-9]{1,2}[日][0-9]{1,2}[时][0-9]{1,2}[分]");
+                Matcher matcher2 = pattern2.matcher(goCureDoctor);
+                if (!matcher2.find()) {
+                    return;
+                }
+                Date parse = new SimpleDateFormat("yyyy年MM月dd日HH时mm分").parse(goCureDoctor);
+                String format = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(parse);
+                map.put(changeCame, format);
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * 萧山中医院抽取自定义病程录信息(查房记录)
+     *
+     * @param htmlText
+     * @param structureMap
+     */
+    public static void xszyyExtractWardInfo(String recTitle, String htmlText, Map<String, String> structureMap) {
+        if (StringUtil.isNotBlank(htmlText)) {
+            htmlText = htmlText.replaceAll("[   \n]", " ").replace("第1页", "")
+                    .replace("\n", " ");
+            String date = extractDate(htmlText);
+            if (date != null) {
+                structureMap.put("病历日期", date);
+                htmlText = htmlText.replace(date, "").trim();
+            }
+            List<String> titleContent = Lists.newArrayList(htmlText.split(" "));
+            String title1 = titleContent.get(0);
+            String title2 = titleContent.get(1);
+            if (StringUtil.isNotBlank(title1) && StringUtil.isNotBlank(title2) && recTitle.equals(title1+title2)) {
+                structureMap.put("病历标题", recTitle);
+            } else {
+                structureMap.put("病历标题", title1+title2);
+            }
+            if (titleContent.size() > 2) {
+                titleContent.remove(0);
+                titleContent.remove(0);
+            }else{
+                titleContent.remove(0);
+            }
+            StringBuffer sb = new StringBuffer();
+            for (String text : titleContent) {
+                sb.append(text).append(" ");
+            }
+            String content = sb.toString();
+            if (content.contains("<img")) {
+                String[] contentDoctor = content.split("<img");
+                structureMap.put("病情记录", contentDoctor[0]);
+                structureMap.put("记录医生", "<img" + contentDoctor[1]);
+            } else {
+                structureMap.put("病情记录", content);
+            }
+            if (structureMap.containsKey("病情记录")) {
+                String info = structureMap.get("病情记录");
+                if (info.contains("记录医师")) {
+                    structureMap.put("病情记录", info.substring(0, info.lastIndexOf("记录医师")));
+                    structureMap.put("记录医师", info.substring(info.lastIndexOf("记录医师") + "记录医师:".length()));
+                } else if (info.contains("医师签名")) {
+                    structureMap.put("病情记录", info.substring(0, info.lastIndexOf("医师签名")));
+                    structureMap.put("医师签名", info.substring(info.lastIndexOf("医师签名") + "医师签名:".length()));
+                }
+            }
+        }
+    }
+}