江豪迪 3 years ago
parent
commit
71c0284a60
33 changed files with 1420 additions and 276 deletions
  1. 2 2
      dbanaly/src/main/resources/application-local.yml
  2. 7 16
      trans/src/main/java/com/lantone/qc/trans/beilun/util/BeiLunInvasiveOperationHtmlAnalysis.java
  3. 1 1
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/BeHospitalizedDocTrans.java
  4. 2 2
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/ConsultationDocTrans.java
  5. 1 1
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/CrisisValueReportDocTrans.java
  6. 1 1
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/DifficultCaseDiscussDocTrans.java
  7. 1 1
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/DutyShiftSystemDocTrans.java
  8. 4 3
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/FirstCourseRecordDocTrans.java
  9. 7 1
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/HangzhoufubaoDocTrans.java
  10. 75 0
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/InvasiveOperationDocTrans.java
  11. 3 3
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/LeaveHospitalDocTrans.java
  12. 8 8
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/OperationDocTrans.java
  13. 1 1
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/RescueDocTrans.java
  14. 3 3
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/ThreeLevelWardDocTrans.java
  15. 4 4
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/TransferRecordDocTrans.java
  16. 28 107
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/BeHospitalizedHtmlAnalysis.java
  17. 4 5
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/ConsultationRecordHtmlAnalysis.java
  18. 4 9
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/CrisisValueReportHtmlAnalysis.java
  19. 3 9
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/DifficultCaseDiscussHtmlAnalysis.java
  20. 1 1
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/DutyShiftSystemHtmlAnalysis.java
  21. 1 2
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/FirstCourseRecordHtmlAnalysis.java
  22. 641 0
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/HangzhoufubaoCommonAnalysisUtil.java
  23. 56 0
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/HangzhoufubaoFirstCourseRecordHtmlAnalysis.java
  24. 137 0
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/HangzhoufubaoTranUtils.java
  25. 12 33
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/LeaveHospitalHtmlAnalysis.java
  26. 47 7
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/OperationHtmlAnalysis.java
  27. 8 11
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/OperationRecordHtmlAnalysis.java
  28. 9 14
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/PreoperativeHtmlAnalysis.java
  29. 8 10
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/RescueHtmlAnalysis.java
  30. 36 1
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/ThreeLevelWardHtmlAnalysis.java
  31. 2 5
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/TransferIntoHtmlAnalysis.java
  32. 11 15
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/TransferOutHtmlAnalysis.java
  33. 292 0
      trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/hangzhoufubaoHtmlAnalysisUtil.java

+ 2 - 2
dbanaly/src/main/resources/application-local.yml

@@ -5,7 +5,7 @@ spring:
     druid:
     druid:
       lantone:
       lantone:
         driver-class-name: com.mysql.jdbc.Driver
         driver-class-name: com.mysql.jdbc.Driver
-        url: jdbc:mysql://10.68.24.21:3306/qc?useUnicode=true&characterEncoding=utf8&useSSL=false
+        url: jdbc:mysql://192.168.2.237:3307/qc?useUnicode=true&characterEncoding=utf8&useSSL=false
         username: root
         username: root
         password: lantone
         password: lantone
         initial-size: 8
         initial-size: 8
@@ -30,7 +30,7 @@ spring:
       token: 10 # Token索引
       token: 10 # Token索引
     host: 127.0.0.1  #Redis服务器地址
     host: 127.0.0.1  #Redis服务器地址
     port: 6379 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
     port: 6379 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
-    password: lantone # Redis服务器连接密码(默认为空)
+    password:  # Redis服务器连接密码(默认为空)
     lettuce:
     lettuce:
       pool:
       pool:
         max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
         max-active: 8 # 连接池最大连接数(使用负值表示没有限制)

+ 7 - 16
trans/src/main/java/com/lantone/qc/trans/beilun/util/BeiLunInvasiveOperationHtmlAnalysis.java

@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Maps;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
+import com.lantone.qc.trans.hangzhoufubao.util.HangzhoufubaoTranUtils;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -30,28 +31,18 @@ public class BeiLunInvasiveOperationHtmlAnalysis implements BeiLunHtmlAnalysis {
         Map<String, String> structureMap = Maps.newLinkedHashMap();
         Map<String, String> structureMap = Maps.newLinkedHashMap();
         try {
         try {
             List<String> titles = Lists.newArrayList(
             List<String> titles = Lists.newArrayList(
-                    "操作时间",
-                    "操作医生",
-                    "麻醉方法",
                     "操作名称",
                     "操作名称",
-                    "操作简要经过(包括术中有无并发症及具体描述和处理)",
-                    "标本送检",
+                    "操作时间",
+                    "操作人员",
+                    "操作过程、结果及患者一般情况",
                     "术后注意事项",
                     "术后注意事项",
-                    "记录者签名");
+                    "操作医师签名");
             String html = args[0];
             String html = args[0];
             String recTitle = args[1];
             String recTitle = args[1];
             String recTypeId = args[2];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
             Document doc = Jsoup.parse(html);
-            String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
-                CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
-            if (MapUtils.isNotEmpty(structureMap)) {
-                structureMap = OrdinaryAssistant.mapKeyContrast(structureMap, keyContrasts);
-            }
-            String cases = getKeyCut(structureMap.get("术后注意"));
-            if(StringUtils.isNotBlank(cases)){
-                structureMap.put("术后注意",cases);
-            }
-            structureMap = preSolve(htmlContent, structureMap);
+            String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
+            HangzhoufubaoTranUtils.getStructureMapSplitCommonCutByList(structureMap, htmlContent, recTitle, titles);
             BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
             BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             log.error(e.getMessage(), e);

+ 1 - 1
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/BeHospitalizedDocTrans.java

@@ -28,7 +28,7 @@ public class BeHospitalizedDocTrans extends ModelDocTrans {
         BeHospitalizedDoc beHospitalizedDoc = null;
         BeHospitalizedDoc beHospitalizedDoc = null;
         try {
         try {
             Map<String, Object> contentMap = ((List<Map>) medrecVo.getContent().get("content")).get(0);
             Map<String, Object> contentMap = ((List<Map>) medrecVo.getContent().get("content")).get(0);
-            String content = contentMap.get("xmlText").toString();
+            String content = contentMap.get("htmlText").toString();
             Map<String, String> structureMap = null;
             Map<String, String> structureMap = null;
             if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
             if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
                 structureMap = (Map) FastJsonUtils.getJsonToMap(content);
                 structureMap = (Map) FastJsonUtils.getJsonToMap(content);

+ 2 - 2
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/ConsultationDocTrans.java

@@ -72,7 +72,7 @@ public class ConsultationDocTrans extends ModelDocTrans {
         int index = 1;
         int index = 1;
         String consultationName = null;
         String consultationName = null;
         for (Map<String, Object> contentMap : contentMaps) {
         for (Map<String, Object> contentMap : contentMaps) {
-            if (contentMap.get("xmlText") == null || StringUtil.isBlank(contentMap.get("xmlText").toString())) {
+            if (contentMap.get("htmlText") == null || StringUtil.isBlank(contentMap.get("htmlText").toString())) {
                 continue;
                 continue;
             }
             }
             try {
             try {
@@ -91,7 +91,7 @@ public class ConsultationDocTrans extends ModelDocTrans {
     }
     }
 
 
     private ConsultationRecordDoc getConsultationRecordDoc(Map<String, Object> contentMap) {
     private ConsultationRecordDoc getConsultationRecordDoc(Map<String, Object> contentMap) {
-        String content = contentMap.get("xmlText").toString();
+        String content = contentMap.get("htmlText").toString();
         Map<String, String> structureMap = null;
         Map<String, String> structureMap = null;
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);

+ 1 - 1
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/CrisisValueReportDocTrans.java

@@ -41,7 +41,7 @@ public class CrisisValueReportDocTrans extends ModelDocTrans {
     }
     }
 
 
     private CrisisValueReportDoc getCrisisValueReportDoc(Map<String, Object> contentMap) {
     private CrisisValueReportDoc getCrisisValueReportDoc(Map<String, Object> contentMap) {
-        String content = contentMap.get("xmlText").toString();
+        String content = contentMap.get("htmlText").toString();
         Map<String, String> structureMap = null;
         Map<String, String> structureMap = null;
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);

+ 1 - 1
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/DifficultCaseDiscussDocTrans.java

@@ -41,7 +41,7 @@ public class DifficultCaseDiscussDocTrans extends ModelDocTrans {
     }
     }
 
 
     private DifficultCaseDiscussDoc getDifficultCaseDiscussDoc(Map<String, Object> contentMap) {
     private DifficultCaseDiscussDoc getDifficultCaseDiscussDoc(Map<String, Object> contentMap) {
-        String content = contentMap.get("xmlText").toString();
+        String content = contentMap.get("htmlText").toString();
         Map<String, String> structureMap = null;
         Map<String, String> structureMap = null;
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);

+ 1 - 1
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/DutyShiftSystemDocTrans.java

@@ -41,7 +41,7 @@ public class DutyShiftSystemDocTrans extends ModelDocTrans {
     }
     }
 
 
     private DutyShiftSystemDoc getDutyShiftSystemDoc(Map<String, Object> contentMap) {
     private DutyShiftSystemDoc getDutyShiftSystemDoc(Map<String, Object> contentMap) {
-        String content = contentMap.get("xmlText").toString();
+        String content = contentMap.get("htmlText").toString();
         Map<String, String> structureMap = null;
         Map<String, String> structureMap = null;
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);

+ 4 - 3
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/FirstCourseRecordDocTrans.java

@@ -11,6 +11,7 @@ import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
 import com.lantone.qc.trans.comsis.ModelDocGenerate;
 import com.lantone.qc.trans.comsis.ModelDocGenerate;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
 import com.lantone.qc.trans.hangzhoufubao.util.FirstCourseRecordHtmlAnalysis;
 import com.lantone.qc.trans.hangzhoufubao.util.FirstCourseRecordHtmlAnalysis;
+import com.lantone.qc.trans.hangzhoufubao.util.HangzhoufubaoFirstCourseRecordHtmlAnalysis;
 import com.lantone.qc.trans.hangzhoufubao.util.HtmlAnalysis;
 import com.lantone.qc.trans.hangzhoufubao.util.HtmlAnalysis;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.collections.MapUtils;
@@ -33,15 +34,15 @@ public class FirstCourseRecordDocTrans extends ModelDocTrans {
         FirstCourseRecordDoc firstCourseRecordDoc = null;
         FirstCourseRecordDoc firstCourseRecordDoc = null;
         try {
         try {
             Map<String, Object> contentMap = ((List<Map>) medrecVo.getContent().get("content")).get(0);
             Map<String, Object> contentMap = ((List<Map>) medrecVo.getContent().get("content")).get(0);
-            String content = contentMap.get("xmlText").toString();
+            String content = contentMap.get("htmlText").toString();
             Map<String, String> structureMap = null;
             Map<String, String> structureMap = null;
             if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
             if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
                 structureMap = (Map) FastJsonUtils.getJsonToMap(content);
                 structureMap = (Map) FastJsonUtils.getJsonToMap(content);
             } else {
             } else {
                 String recTitle = contentMap.get("recTitle").toString();
                 String recTitle = contentMap.get("recTitle").toString();
                 String recTypeId = contentMap.get("recTypeId").toString();
                 String recTypeId = contentMap.get("recTypeId").toString();
-                HtmlAnalysis ningBoZhongYiHtmlAnalysis = new FirstCourseRecordHtmlAnalysis();
-                Map<String, String> sourceMap = ningBoZhongYiHtmlAnalysis.analysis(content, recTitle, recTypeId);
+                HtmlAnalysis hangzhoufubaoHtmlAnalysis = new HangzhoufubaoFirstCourseRecordHtmlAnalysis();
+                Map<String, String> sourceMap = hangzhoufubaoHtmlAnalysis.analysis(content, recTitle, recTypeId);
                 if (MapUtils.isNotEmpty(sourceMap)) {
                 if (MapUtils.isNotEmpty(sourceMap)) {
                     sourceMap = removeSerialNumber(sourceMap);
                     sourceMap = removeSerialNumber(sourceMap);
                     structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
                     structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);

+ 7 - 1
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/HangzhoufubaoDocTrans.java

@@ -2,6 +2,7 @@ package com.lantone.qc.trans.hangzhoufubao;
 
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.doc.InvasiveOperationDoc;
 import com.lantone.qc.pub.model.vo.MedrecVo;
 import com.lantone.qc.pub.model.vo.MedrecVo;
 import com.lantone.qc.pub.model.vo.QueryVo;
 import com.lantone.qc.pub.model.vo.QueryVo;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.ListUtil;
@@ -78,7 +79,7 @@ public class HangzhoufubaoDocTrans extends com.lantone.qc.trans.DocTrans {
                     DoctorAdviceDocTrans doctorAdviceDocTrans = new DoctorAdviceDocTrans();
                     DoctorAdviceDocTrans doctorAdviceDocTrans = new DoctorAdviceDocTrans();
                     inputInfo.setDoctorAdviceDocs(doctorAdviceDocTrans.extract(i));
                     inputInfo.setDoctorAdviceDocs(doctorAdviceDocTrans.extract(i));
                 }
                 }
-                if (i.getTitle().equals("值班交接制度")) {
+                if (i.getTitle().equals("交接班记录")) {
                     DutyShiftSystemDocTrans dutyShiftSystemDocTrans = new DutyShiftSystemDocTrans();
                     DutyShiftSystemDocTrans dutyShiftSystemDocTrans = new DutyShiftSystemDocTrans();
                     inputInfo.setDutyShiftSystemDocs(dutyShiftSystemDocTrans.extract(i));
                     inputInfo.setDutyShiftSystemDocs(dutyShiftSystemDocTrans.extract(i));
                 }
                 }
@@ -138,6 +139,11 @@ public class HangzhoufubaoDocTrans extends com.lantone.qc.trans.DocTrans {
                     AnesthesiaRecordDocTrans anesthesiaRecordDocTrans= new AnesthesiaRecordDocTrans();
                     AnesthesiaRecordDocTrans anesthesiaRecordDocTrans= new AnesthesiaRecordDocTrans();
                     inputInfo.setAnesthesiaRecordDocs(anesthesiaRecordDocTrans.extract(i));
                     inputInfo.setAnesthesiaRecordDocs(anesthesiaRecordDocTrans.extract(i));
                 }
                 }
+                /*******************************有创操作 trans解析*****************************************/
+                if (i.getTitle().equals("有创操作")) {
+                    InvasiveOperationDocTrans invasiveOperationDoc= new InvasiveOperationDocTrans();
+                    inputInfo.setInvasiveOperationDocs(invasiveOperationDoc.extract(i));
+                }
             }
             }
         }
         }
         pageDataHandle(inputInfo);
         pageDataHandle(inputInfo);

+ 75 - 0
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/InvasiveOperationDocTrans.java

@@ -0,0 +1,75 @@
+package com.lantone.qc.trans.hangzhoufubao;
+
+import com.google.common.collect.Lists;
+import com.lantone.qc.pub.model.doc.InvasiveOperationDoc;
+import com.lantone.qc.pub.model.vo.MedrecVo;
+import com.lantone.qc.pub.util.FastJsonUtils;
+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.BeiLunInvasiveOperationHtmlAnalysis;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.MapUtils;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 有创操作
+ * @author: cy
+ * @time: 2021/8/27 16:12
+ */
+@Slf4j
+public class InvasiveOperationDocTrans extends ModelDocTrans {
+    @Override
+    public List<InvasiveOperationDoc> extract(MedrecVo medrecVo) {
+        List<InvasiveOperationDoc> retList = Lists.newArrayList();
+        List<Map<String, Object>> contentMaps = (List) medrecVo.getContent().get("content");
+        contentMaps.forEach(contentMap -> {
+            retList.add(getInvasiveOperationDoc(contentMap));
+        });
+        return retList;
+
+    }
+
+    private InvasiveOperationDoc getInvasiveOperationDoc(Map<String, Object> contentMap) {
+        InvasiveOperationDoc invasiveOperationDoc = new InvasiveOperationDoc();
+        if (MapUtils.isEmpty(contentMap)) {
+            return invasiveOperationDoc;
+        }
+        if(contentMap.get("htmlText") == null && contentMap.get("htmlText") != null){
+            contentMap.put("htmlText",contentMap.get("htmlText"));
+        }
+            if (contentMap.get("htmlText") == null || StringUtil.isBlank(contentMap.get("htmlText").toString())) {
+                return invasiveOperationDoc;
+            }
+            try {
+                String content = contentMap.get("htmlText").toString();
+                Map<String, String> structureMap = null;
+                if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
+                    structureMap = (Map) FastJsonUtils.getJsonToMap(content);
+                } else {
+                    String recTitle = contentMap.get("recTitle").toString();
+                    String recTypeId = contentMap.get("recTypeId").toString();
+                    BeiLunHtmlAnalysis beiLunHtmlAnalysis = new BeiLunInvasiveOperationHtmlAnalysis();
+                    Map<String, String> sourceMap = beiLunHtmlAnalysis.analysis(content, recTitle, recTypeId);
+                    if (MapUtils.isNotEmpty(sourceMap)) {
+                        structureMap.put("记录编号", contentMap.get("recId").toString());
+                        structureMap.put("标题", recTitle);
+                        structureMap.put("病历号", contentMap.get("behospitalCode") == null ? null : contentMap.get("behospitalCode").toString());
+                    }
+                }
+                if (MapUtils.isNotEmpty(structureMap)) {
+                    invasiveOperationDoc.setStructureMap(structureMap);
+                    invasiveOperationDoc.setPageData((Map) structureMap);
+                }
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+            }
+
+        return invasiveOperationDoc;
+    }
+
+
+
+}

+ 3 - 3
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/LeaveHospitalDocTrans.java

@@ -31,15 +31,15 @@ public class LeaveHospitalDocTrans extends ModelDocTrans {
         LeaveHospitalDoc leaveHospitalDoc = null;
         LeaveHospitalDoc leaveHospitalDoc = null;
         try {
         try {
             Map<String, Object> contentMap = ((List<Map>) medrecVo.getContent().get("content")).get(0);
             Map<String, Object> contentMap = ((List<Map>) medrecVo.getContent().get("content")).get(0);
-            String content = contentMap.get("xmlText").toString();
+            String content = contentMap.get("htmlText").toString();
             Map<String, String> structureMap = null;
             Map<String, String> structureMap = null;
             if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
             if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
                 structureMap = (Map) FastJsonUtils.getJsonToMap(content);
                 structureMap = (Map) FastJsonUtils.getJsonToMap(content);
             } else {
             } else {
                 String recTitle = contentMap.get("recTitle").toString();
                 String recTitle = contentMap.get("recTitle").toString();
                 String recTypeId = contentMap.get("recTypeId").toString();
                 String recTypeId = contentMap.get("recTypeId").toString();
-                HtmlAnalysis ningBoZhongYiHtmlAnalysis = new LeaveHospitalHtmlAnalysis();
-                Map<String, String> sourceMap = ningBoZhongYiHtmlAnalysis.analysis(content, recTitle, recTypeId);
+                HtmlAnalysis hangzhoufubaoHtmlAnalysis = new LeaveHospitalHtmlAnalysis();
+                Map<String, String> sourceMap = hangzhoufubaoHtmlAnalysis.analysis(content, recTitle, recTypeId);
                 if (MapUtils.isNotEmpty(sourceMap)) {
                 if (MapUtils.isNotEmpty(sourceMap)) {
                     structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
                     structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
                     structureMap.put("记录编号", contentMap.get("recId").toString());
                     structureMap.put("记录编号", contentMap.get("recId").toString());

+ 8 - 8
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/OperationDocTrans.java

@@ -72,7 +72,7 @@ public class OperationDocTrans extends ModelDocTrans {
         int index = 1;
         int index = 1;
         String operationName = null;
         String operationName = null;
         for (Map<String, Object> contentMap : contentMaps) {
         for (Map<String, Object> contentMap : contentMaps) {
-            if (contentMap.get("xmlText") == null || StringUtil.isBlank(contentMap.get("xmlText").toString())) {
+            if (contentMap.get("htmlText") == null || StringUtil.isBlank(contentMap.get("htmlText").toString())) {
                 continue;
                 continue;
             }
             }
             try {
             try {
@@ -91,7 +91,7 @@ public class OperationDocTrans extends ModelDocTrans {
     }
     }
 
 
     private OperationDiscussionDoc getOperationDiscussionDoc(Map<String, Object> contentMap) {
     private OperationDiscussionDoc getOperationDiscussionDoc(Map<String, Object> contentMap) {
-        String content = contentMap.get("xmlText").toString();
+        String content = contentMap.get("htmlText").toString();
         Map<String, String> structureMap = null;
         Map<String, String> structureMap = null;
         OperationDiscussionDoc operationDiscussionDoc = new OperationDiscussionDoc();
         OperationDiscussionDoc operationDiscussionDoc = new OperationDiscussionDoc();
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
@@ -141,7 +141,7 @@ public class OperationDocTrans extends ModelDocTrans {
         int index = 1;
         int index = 1;
         String operationName = null;
         String operationName = null;
         for (Map<String, Object> contentMap : contentMaps) {
         for (Map<String, Object> contentMap : contentMaps) {
-            if (contentMap.get("xmlText") == null || StringUtil.isBlank(contentMap.get("xmlText").toString())) {
+            if (contentMap.get("htmlText") == null || StringUtil.isBlank(contentMap.get("htmlText").toString())) {
                 continue;
                 continue;
             }
             }
             try {
             try {
@@ -160,7 +160,7 @@ public class OperationDocTrans extends ModelDocTrans {
     }
     }
 
 
     private OperationRecordDoc getOperationRecordDoc(Map<String, Object> contentMap) {
     private OperationRecordDoc getOperationRecordDoc(Map<String, Object> contentMap) {
-        String content = contentMap.get("xmlText").toString();
+        String content = contentMap.get("htmlText").toString();
         Map<String, String> structureMap = null;
         Map<String, String> structureMap = null;
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
@@ -204,7 +204,7 @@ public class OperationDocTrans extends ModelDocTrans {
         int index = 1;
         int index = 1;
         String operationName = null;
         String operationName = null;
         for (Map<String, Object> contentMap : contentMaps) {
         for (Map<String, Object> contentMap : contentMaps) {
-            if (contentMap.get("xmlText") == null || StringUtil.isBlank(contentMap.get("xmlText").toString())) {
+            if (contentMap.get("htmlText") == null || StringUtil.isBlank(contentMap.get("htmlText").toString())) {
                 continue;
                 continue;
             }
             }
             try {
             try {
@@ -223,15 +223,15 @@ public class OperationDocTrans extends ModelDocTrans {
     }
     }
 
 
     private PreoperativeDiscussionDoc getPreoperativeDiscussionDoc(Map<String, Object> contentMap) {
     private PreoperativeDiscussionDoc getPreoperativeDiscussionDoc(Map<String, Object> contentMap) {
-        String content = contentMap.get("xmlText").toString();
+        String content = contentMap.get("htmlText").toString();
         Map<String, String> structureMap = null;
         Map<String, String> structureMap = null;
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
         } else {
         } else {
             String recTitle = contentMap.get("recTitle").toString();
             String recTitle = contentMap.get("recTitle").toString();
             String recTypeId = contentMap.get("recTypeId").toString();
             String recTypeId = contentMap.get("recTypeId").toString();
-            HtmlAnalysis ningBoZhongYiHtmlAnalysis = new PreoperativeHtmlAnalysis();
-            Map<String, String> sourceMap = ningBoZhongYiHtmlAnalysis.analysis(content, recTitle, recTypeId);
+            HtmlAnalysis hangzhoufubaoHtmlAnalysis = new PreoperativeHtmlAnalysis();
+            Map<String, String> sourceMap = hangzhoufubaoHtmlAnalysis.analysis(content, recTitle, recTypeId);
             if (MapUtils.isNotEmpty(sourceMap)) {
             if (MapUtils.isNotEmpty(sourceMap)) {
                 structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, preoperativeDiscussion_keyContrasts);
                 structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, preoperativeDiscussion_keyContrasts);
                 structureMap.put("记录编号", contentMap.get("recId").toString());
                 structureMap.put("记录编号", contentMap.get("recId").toString());

+ 1 - 1
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/RescueDocTrans.java

@@ -41,7 +41,7 @@ public class RescueDocTrans extends ModelDocTrans {
     }
     }
 
 
     private RescueDoc getRescueDoc(Map<String, Object> contentMap) {
     private RescueDoc getRescueDoc(Map<String, Object> contentMap) {
-        String content = contentMap.get("xmlText").toString();
+        String content = contentMap.get("htmlText").toString();
         Map<String, String> structureMap = null;
         Map<String, String> structureMap = null;
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);

+ 3 - 3
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/ThreeLevelWardDocTrans.java

@@ -55,7 +55,7 @@ public class ThreeLevelWardDocTrans extends ModelDocTrans {
     }
     }
 
 
     private void classifyThreeLevelWardDoc(ThreeLevelWardDoc threeLevelWardDoc, Map<String, Object> contentMap) {
     private void classifyThreeLevelWardDoc(ThreeLevelWardDoc threeLevelWardDoc, Map<String, Object> contentMap) {
-        String content = contentMap.get("xmlText").toString();
+        String content = contentMap.get("htmlText").toString();
         Map<String, String> structureMap = null;
         Map<String, String> structureMap = null;
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
@@ -68,8 +68,8 @@ public class ThreeLevelWardDocTrans extends ModelDocTrans {
             if (contentMap.containsKey("recTypeId") && StringUtil.isNotBlank(contentMap.get("recTypeId").toString())) {
             if (contentMap.containsKey("recTypeId") && StringUtil.isNotBlank(contentMap.get("recTypeId").toString())) {
                 recTypeId = contentMap.get("recTypeId").toString();
                 recTypeId = contentMap.get("recTypeId").toString();
             }
             }
-            HtmlAnalysis ningBoZhongYiHtmlAnalysis = new ThreeLevelWardHtmlAnalysis();
-            Map<String, String> sourceMap = ningBoZhongYiHtmlAnalysis.analysis(content, recTitle, recTypeId);
+            HtmlAnalysis hangzhoufubaoHtmlAnalysis = new ThreeLevelWardHtmlAnalysis();
+            Map<String, String> sourceMap = hangzhoufubaoHtmlAnalysis.analysis(content, recTitle, recTypeId);
             if (MapUtils.isNotEmpty(sourceMap)) {
             if (MapUtils.isNotEmpty(sourceMap)) {
                 structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
                 structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
                 structureMap.put("记录编号", contentMap.get("recId").toString());
                 structureMap.put("记录编号", contentMap.get("recId").toString());

+ 4 - 4
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/TransferRecordDocTrans.java

@@ -129,7 +129,7 @@ public class TransferRecordDocTrans extends ModelDocTrans {
         int index = 1;
         int index = 1;
         String transferRecordName = null;
         String transferRecordName = null;
         for (Map<String, Object> contentMap : contentMaps) {
         for (Map<String, Object> contentMap : contentMaps) {
-            if (contentMap.get("xmlText") == null || StringUtil.isBlank(contentMap.get("xmlText").toString())) {
+            if (contentMap.get("htmlText") == null || StringUtil.isBlank(contentMap.get("htmlText").toString())) {
                 continue;
                 continue;
             }
             }
             try {
             try {
@@ -148,7 +148,7 @@ public class TransferRecordDocTrans extends ModelDocTrans {
     }
     }
 
 
     private TransferIntoDoc getTransferIntoDoc(Map<String, Object> contentMap) {
     private TransferIntoDoc getTransferIntoDoc(Map<String, Object> contentMap) {
-        String content = contentMap.get("xmlText").toString();
+        String content = contentMap.get("htmlText").toString();
         Map<String, String> structureMap = new HashMap<>();
         Map<String, String> structureMap = new HashMap<>();
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
@@ -242,7 +242,7 @@ public class TransferRecordDocTrans extends ModelDocTrans {
         int index = 1;
         int index = 1;
         String transferRecordName = null;
         String transferRecordName = null;
         for (Map<String, Object> contentMap : contentMaps) {
         for (Map<String, Object> contentMap : contentMaps) {
-            if (contentMap.get("xmlText") == null || StringUtil.isBlank(contentMap.get("xmlText").toString())) {
+            if (contentMap.get("htmlText") == null || StringUtil.isBlank(contentMap.get("htmlText").toString())) {
                 continue;
                 continue;
             }
             }
             try {
             try {
@@ -261,7 +261,7 @@ public class TransferRecordDocTrans extends ModelDocTrans {
     }
     }
 
 
     private TransferOutDoc getTransferOutDoc(Map<String, Object> contentMap) {
     private TransferOutDoc getTransferOutDoc(Map<String, Object> contentMap) {
-        String content = contentMap.get("xmlText").toString();
+        String content = contentMap.get("htmlText").toString();
         Map<String, String> structureMap = new HashMap<>();
         Map<String, String> structureMap = new HashMap<>();
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);
             structureMap = (Map) FastJsonUtils.getJsonToMap(content);

+ 28 - 107
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/BeHospitalizedHtmlAnalysis.java

@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Maps;
 import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.yuhangsy.util.comsis.YuhangsyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Document;
@@ -47,119 +48,39 @@ public class BeHospitalizedHtmlAnalysis implements HtmlAnalysis {
 
 
     //一般模板
     //一般模板
     private void analysisGeneral(Document doc, String recTitle, Map<String, String> map) {
     private void analysisGeneral(Document doc, String recTitle, Map<String, String> map) {
-        //个人基础信息table解析
-        String[] patInfoTableElementIds = {"table2", "table2_0"};
-        for (String table : patInfoTableElementIds) {
-            HtmlAnalysisUtil.tableStyle1InsertMap(doc.getElementById(table), map);
-        }
-        if (map.containsKey("家庭地址")) {
-            map.put("家庭地址", map.get("家庭地址").replace("\n", ""));
-        }
-        //主诉、现病史等table解析
-        HtmlAnalysisUtil.tableStyle2InsertMap(doc.getElementById("table3"), map);
-        if (StringUtil.isNotBlank(map.get("婚育史月经史")) && map.get("婚育史月经史").contains("月经史")) {
-            map.put("月经史", map.get("婚育史月经史").substring(map.get("婚育史月经史").indexOf("月经史") + 4));
-            map.put("婚育史", map.get("婚育史月经史").substring(0, map.get("婚育史月经史").indexOf("月经史")));
-        }
-        if (StringUtil.isNotBlank(map.get("婚育史")) && map.get("婚育史").contains("月经史")) {
-            map.put("月经史", map.get("婚育史").substring(map.get("婚育史").indexOf("月经史") + 4));
-            map.put("婚育史", map.get("婚育史").substring(0, map.get("婚育史").indexOf("月经史")));
-        }
-//
 
 
-        if (map.get("性别") != null && map.get("性别").equals("女")) {
-            if (StringUtil.isNotBlank(map.get("婚育史"))) {
-                if (map.get("婚育史").contains("月经史")) {
-                    map.put("月经史", map.get("婚育史").substring(map.get("婚育史").indexOf("月经史") + 4));
-                    map.put("婚育史", map.get("婚育史").substring(0, map.get("婚育史").indexOf("月经史")));
-                }
-            }
-        }
-        if (map.get("性别") != null && map.get("性别").equals("男")) {
-            if (StringUtil.isNotBlank(map.get("月经史"))) {
-                map.put("婚育史", map.get("月经史"));
+        List<String> titles = Lists.newArrayList("姓  名", "性   别", "出生日期", "出 生 地", "职 业", "民 族", "宗教信仰", "婚 姻",
+                "联系地址", "联系电话", "入院日期", "记录日期", "身份证号码", "病史陈述者", "病史可靠程度", "产前检查", "丈夫姓名",
+                "主 诉", "现病史", "既往史", "个人史", "月经史", "婚姻史", "生育史", "家族史", "体格检查","一般体格检查一般情况","一般体格检查一般状况","辅助检查", "妇科检查","产科检查","实验室检查", "特殊检查",
+                "初步诊断", "康复需求","营养需求","医生签名", "医师签名", "签名时间", "记录时间", "补充诊断", "修正诊断","其    他");
+        //个人基础信息table解析
+        String htmlContent = HangzhoufubaoCommonAnalysisUtil.html2String(doc.toString());
+        if (StringUtil.isNotBlank(htmlContent)) {
+            HangzhoufubaoCommonAnalysisUtil.html2StructureMap(titles,htmlContent,map);
+        }
+        //去掉生育史里面的表格jj
+        String reproductiveHistory = map.get("生育史");
+        if (StringUtil.isNotBlank(reproductiveHistory)) {
+            int index = reproductiveHistory.indexOf("孕次生产年月流产早产足月产");
+            map.put("生育史", reproductiveHistory.substring(0, index));
+        }
+
+
+        //拆分产科检查里面的辅助检查
+        String obstetricExamination = map.get("产科检查");
+        if (StringUtil.isNotBlank(obstetricExamination)) {
+            String str = "辅助检查";
+            int i = obstetricExamination.indexOf(str);
+            if (i > 0) {
+                map.put("产科检查",obstetricExamination.substring(0,i));
+                String substring = obstetricExamination.substring(i, obstetricExamination.length() - 1);
+                String replace = substring.replace("辅助检查", "");
+                map.put(str, "时间:" + replace);
             }
             }
         }
         }
 
 
-        //体 格 检 查 表(一) table解析
-        Element tgjcTableElement = doc.getElementById("table4");
-        HtmlAnalysisUtil.tableStyle2InsertMap(tgjcTableElement, map);
-
-        //诊断 table解析
-        String disTableElementId = null;
-        Element disTableElement = null;
-        String[] disTableElementIds = {"table5", "table5_1", "table5_2"};
-        for (String eid : disTableElementIds) {
-            disTableElement = doc.getElementById(eid);
-            if (disTableElement != null) {
-                disTableElementId = eid;
-                break;
-            }
-        }
 
 
-        HtmlAnalysisUtil.tableStyle1InsertMap(disTableElement, map);
-//        disHandleExt(map);
 
 
-        if (!StringUtil.isNotBlank(map.get("初步诊断"))) {
-            if (StringUtil.isNotBlank(map.get("中医诊断"))) {
-                map.put("初步诊断", "中医诊断" + map.get("中医诊断").replace("\n", ""));
-            }
-            if (StringUtil.isNotBlank(map.get("西医诊断"))) {
-                map.put("初步诊断", "西医诊断:" + map.get("西医诊断").replace("\n", ""));
-            }
-        }
-        if (StringUtil.isNotBlank(map.get("补充诊断"))) {
-            map.put("补充诊断", map.get("补充诊断").replace(" ", "").replace("\n", " "));
-            map.put("初步诊断", map.get("初步诊断") + " 补充诊断:" + map.get("补充诊断"));
-        }
-        if (StringUtil.isNotBlank(map.get("最后诊断"))) {
-            map.put("最后诊断", map.get("最后诊断").replace(" ", "").replace("\n", " "));
-            map.put("初步诊断", map.get("初步诊断") + " 最后诊断:" + map.get("最后诊断").replace("null", ""));
-        }
-
-        //医生签名、医生签名时间
-        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("医生签名", "暂无");
-        }
-        if (docSignTimeElement != null) {
-            String date = CommonAnalysisUtil.extractDate(HtmlAnalysisUtil.elementLayer1ToStr(docSignTimeElement, false).trim());
-            map.put("医生签名时间", date);
-        }
-
-        //专科检查、辅助检查
-        Element yuElement = new Element("div");
-        if (tgjcTableElement != null) {
-            for (Element tgjcTableElementNt : tgjcTableElement.parent().nextElementSiblings()) {
-                if (StringUtil.isNotBlank(disTableElementId) && tgjcTableElementNt.id().contains(disTableElementId)) {
-                    break;
-                }
-                /*if (tgjcTableElementNt.tagName().equals("table")) {
-                    continue;
-                }*/
-                tgjcTableElementNt.appendTo(yuElement);
-            }
-        }
-        String yuText = HtmlAnalysisUtil.blockDivToStr(yuElement, true).replace("请在下面表格中右键添加诊断", "")
-                /*.replace("体  格  检  查  表 (二)", "")
-                .replace("(补充及专科情况)", "")
-                .replace("辅  助  检  查", "辅助检查:")
-                .replace("诊断:", "")
-                .replace("补充专科情况", "补充专科情况:")
-                .trim()*/;
-        CommonAnalysisUtil.cutByTitles(yuText, Lists.newArrayList("专科检查", "辅助检查"), 0, map);
-        if (StringUtil.isNotBlank(map.get("辅助检查"))) {
-            map.put("辅助检查", map.get("辅助检查").replace("初步诊断:", ""));
-        }
 
 
     }
     }
 
 

+ 4 - 5
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/ConsultationRecordHtmlAnalysis.java

@@ -27,7 +27,6 @@ public class ConsultationRecordHtmlAnalysis implements HtmlAnalysis {
             String html = args[0];
             String html = args[0];
             String recTitle = args[1];
             String recTitle = args[1];
             String recTypeId = args[2];
             String recTypeId = args[2];
-            HtmlAnalysisUtil.tableStyle1InsertMap(Jsoup.parse(html).getElementById("table1_1"), map);
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
             analysisGeneral(recTitle,bigDivElement, map);
             analysisGeneral(recTitle,bigDivElement, map);
             HtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
             HtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
@@ -46,12 +45,12 @@ public class ConsultationRecordHtmlAnalysis implements HtmlAnalysis {
         }
         }
         String text = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         String text = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         CommonAnalysisUtil.extractWardInfo(recTitle,text, map);
         CommonAnalysisUtil.extractWardInfo(recTitle,text, map);
-        String bqjlText = "病情记录" + map.get("病情记录").replace("请在此填写会诊处理意见","").replace("会诊回复时间","");
+    //    String bqjlText = "病情记录" + map.get("病情记录").replace("请在此填写会诊处理意见","").replace("会诊回复时间","");
         List<String> titles = Lists.newArrayList(
         List<String> titles = Lists.newArrayList(
-                "病情记录","答复","日期时间"
+                "会诊意见","会诊意见执行情况","记录医师"
         );
         );
-        titles = CommonAnalysisUtil.sortTitlesNoColon(titles, bqjlText);
-        CommonAnalysisUtil.cutByTitlesNoColon(bqjlText, titles, 0, map);
+        titles = CommonAnalysisUtil.sortTitlesNoColon(titles, text);
+        CommonAnalysisUtil.cutByTitlesNoColon(text, titles, 0, map);
     }
     }
 
 
 }
 }

+ 4 - 9
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/CrisisValueReportHtmlAnalysis.java

@@ -2,12 +2,11 @@ package com.lantone.qc.trans.hangzhoufubao.util;
 
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Maps;
-import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Element;
 import org.jsoup.nodes.Element;
 
 
-import java.util.List;
+import java.util.ArrayList;
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
@@ -43,14 +42,10 @@ public class CrisisValueReportHtmlAnalysis implements HtmlAnalysis {
         if (bigDivElement.selectFirst("hr") != null) {
         if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
         }
+
         String text = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         String text = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
-        CommonAnalysisUtil.extractWardInfo(recTitle,text, map);
-        String bqjlText = "病情记录" + map.get("病情记录");
-        List<String> titles = Lists.newArrayList(
-                "病情记录"
-        );
-        titles = CommonAnalysisUtil.sortTitlesNoColon(titles, bqjlText);
-        CommonAnalysisUtil.cutByTitlesNoColon(bqjlText, titles, 0, map);
+        ArrayList<String> strings = Lists.newArrayList("报告时间", "报告内容", "处理情况", "记录医师");
+        HangzhoufubaoTranUtils.getStructureMapSplitCommonCutByList(map, text, recTitle, strings);
     }
     }
 
 
 }
 }

+ 3 - 9
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/DifficultCaseDiscussHtmlAnalysis.java

@@ -25,21 +25,15 @@ public class DifficultCaseDiscussHtmlAnalysis implements HtmlAnalysis {
     public Map<String, String> analysis(String... args) {
     public Map<String, String> analysis(String... args) {
         Map<String, String> structureMap = Maps.newLinkedHashMap();
         Map<String, String> structureMap = Maps.newLinkedHashMap();
         try {
         try {
-            List<String> titles = Lists.newArrayList("姓名", "性别", "出生日期", "科别", "病区", "床号",
-                    "住院号", "年龄", "床位", "住院号", "住址(单位)", "住址(或单位)", "讨论日期", "讨论地点",
-                    "讨论主持人", "参加人员", "参加讨论人", "病史简要", "讨论目的", "讨论意见", "主持人小结", "下一步方案",
-                    "具体讨论意见", "主持人小结意见", "主持人小结意见/讨论结论", "主持人签名", "记录医生签名", "记录者(签名)", "科主任(签名)");
+            List<String> titles = Lists.newArrayList("记录时间", "讨论时间", "讨论地点", "主持人", "参加人员", "病例介绍",
+                    "讨论目的", "讨论意见", "主持人小结", "记录医师");
             String html = args[0];
             String html = args[0];
             String recTitle = args[1];
             String recTitle = args[1];
             String recTypeId = args[2];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
             Document doc = Jsoup.parse(html);
-            HtmlAnalysisUtil.tableStyle1InsertMap(doc.getElementById("table1"), structureMap);
-            if (doc.selectFirst("body").child(0).getElementById("table1") != null) {
-                doc.selectFirst("body").child(0).getElementById("table1").remove();
-            }
             String htmlContent = HtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
             String htmlContent = HtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
             if (StringUtil.isNotBlank(htmlContent)) {
             if (StringUtil.isNotBlank(htmlContent)) {
-                htmlContent = htmlContent.replaceAll("[   ]", " ").replace("第一页", "").replace("发言记录(包括病史简要、讨论意见及结论):", "");
+                htmlContent = htmlContent.replaceAll("[   ]", " ").replace("第一页", "");
                 CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
                 CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
             }
             }
             CommonAnalysisUtil.extractDateByTitle(structureMap, "告知时间");
             CommonAnalysisUtil.extractDateByTitle(structureMap, "告知时间");

+ 1 - 1
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/DutyShiftSystemHtmlAnalysis.java

@@ -47,7 +47,7 @@ public class DutyShiftSystemHtmlAnalysis implements HtmlAnalysis {
         CommonAnalysisUtil.extractWardInfo(recTitle,text, map);
         CommonAnalysisUtil.extractWardInfo(recTitle,text, map);
         String bqjlText = "病情记录" + map.get("病情记录");
         String bqjlText = "病情记录" + map.get("病情记录");
         List<String> titles = Lists.newArrayList(
         List<String> titles = Lists.newArrayList(
-                "病情记录"
+                "病情记录","记录医师"
         );
         );
         titles = CommonAnalysisUtil.sortTitlesNoColon(titles, bqjlText);
         titles = CommonAnalysisUtil.sortTitlesNoColon(titles, bqjlText);
         CommonAnalysisUtil.cutByTitlesNoColon(bqjlText, titles, 0, map);
         CommonAnalysisUtil.cutByTitlesNoColon(bqjlText, titles, 0, map);

+ 1 - 2
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/FirstCourseRecordHtmlAnalysis.java

@@ -25,8 +25,7 @@ public class FirstCourseRecordHtmlAnalysis implements HtmlAnalysis {
     public Map<String, String> analysis(String... args) {
     public Map<String, String> analysis(String... args) {
         Map<String, String> structureMap = Maps.newLinkedHashMap();
         Map<String, String> structureMap = Maps.newLinkedHashMap();
         try {
         try {
-            List<String> titles = Lists.newArrayList("病例特点", "拟诊讨论", "中医辨病辨证依据", "中医鉴别诊断", "西医鉴别诊断",
-                    "鉴别诊断", "西医诊断依据", "诊断依据", "初步诊断", "病情评估", "诊疗计划", "医生签名");
+            List<String> titles = Lists.newArrayList("病史特点", "初步诊断", "诊断依据", "鉴别诊断","治疗目标","诊疗计划","医生签名");
             String html = args[0];
             String html = args[0];
             String recTitle = args[1];
             String recTitle = args[1];
             Document doc = Jsoup.parse(html);
             Document doc = Jsoup.parse(html);

+ 641 - 0
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/HangzhoufubaoCommonAnalysisUtil.java

@@ -0,0 +1,641 @@
+package com.lantone.qc.trans.hangzhoufubao.util;
+
+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 HangzhoufubaoCommonAnalysisUtil {
+
+    /**
+     * 取文书中全部文本
+     *
+     * @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();
+            }
+        }
+    }
+}

+ 56 - 0
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/HangzhoufubaoFirstCourseRecordHtmlAnalysis.java

@@ -0,0 +1,56 @@
+package com.lantone.qc.trans.hangzhoufubao.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.yuhangsy.util.YuhangsyHtmlAnalysis;
+import com.lantone.qc.trans.yuhangsy.util.YuhangsyHtmlAnalysisUtil;
+import com.lantone.qc.trans.yuhangsy.util.comsis.YuhangsyCommonAnalysisUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+
+import java.util.*;
+
+/**
+ * @Description:
+ * @author: HUJING
+ * @time: 2020/9/9 11:24
+ */
+@Slf4j
+public class HangzhoufubaoFirstCourseRecordHtmlAnalysis implements HtmlAnalysis {
+
+    private String modeId = "2";
+
+    @Override
+    public Map<String, String> analysis(String... args) {
+        List<String> strings = Arrays.asList("一、", "二、", "三、", "四、", "五、", "六、", "七、", "八、");
+        Map<String, String> structureMap = Maps.newLinkedHashMap();
+        try {
+            String html = args[0];
+            String recTitle = args[1];
+            String recTypeId = args[2];
+            Document doc = Jsoup.parse(html);
+            List<String> titles = Lists.newArrayList("记录时间","一般情况","病史特点", "初步诊断", "诊断依据", "鉴别诊断","治疗目标","诊疗计划","医生签名");
+            String htmlContent = hangzhoufubaoHtmlAnalysisUtil.blockDivToStr2(doc.selectFirst("body").child(0), true);
+            if (StringUtil.isNotBlank(htmlContent)) {
+                HangzhoufubaoCommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
+            }
+            for (Map.Entry<String, String> stringStringEntry : structureMap.entrySet()) {
+                for (String string : strings) {
+                    String value = stringStringEntry.getValue();
+                    if (value.endsWith(string)) {
+                        structureMap.put(stringStringEntry.getKey(),value.substring(0, value.length() - string.length()));
+                        break;
+                    }
+                }
+            }
+
+            YuhangsyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+        return structureMap;
+    }
+
+}

+ 137 - 0
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/HangzhoufubaoTranUtils.java

@@ -0,0 +1,137 @@
+package com.lantone.qc.trans.hangzhoufubao.util;
+
+import com.google.common.collect.Lists;
+import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author 10185
+ * @create 2022/4/15 11:51
+ */
+public class HangzhoufubaoTranUtils {
+    public static void extractedDate(Map<String, String> structureMap, String htmlText) {
+        Pattern p1 = Pattern.compile("[0-9]{4}年[0-9]+月[0-9]+日[0-9]+时[0-9]+分");
+        Matcher m1 = p1.matcher(htmlText);
+        if (m1.find()) {
+            String date = m1.group(0);
+            structureMap.put("病历日期", date);
+        }
+    }
+
+    public static void getStructureMap(Map<String, String> structureMap, String htmlText, String recTitle) {
+        extractedDate(structureMap, htmlText);
+        String[] split = htmlText.split("\n");
+        if (split.length > 1) {
+            if (structureMap.get("病历日期") != null) {
+                String date = structureMap.get("病历日期");
+                String title = split[0].replace(date, "");
+                structureMap.put("文书标题", title);
+            }
+            structureMap.put("病历标题", recTitle);
+            String content = htmlText.substring(split[0].length(), htmlText.length()).trim().replace("\n", "").replace(" ", "");
+            String str = "记录医师";
+            int index = content.indexOf(str + ":");
+            if (index == -1) {
+                index = content.indexOf(str + ":");
+            }
+            if (index > 0) {
+                structureMap.put("病情记录", content.substring(0, index));
+                structureMap.put("记录医师", content.substring(index + str.length() + 1, content.length()));
+            }
+        }
+    }
+    public static void getStructureMapSplitByLineCutByList(Map<String, String> structureMap, String htmlText, String recTitle, List<String> titles) {
+        extractedDate(structureMap, htmlText);
+        String[] split = htmlText.split("\n");
+        if (split.length > 1) {
+            if (structureMap.get("病历日期") != null) {
+                String date = structureMap.get("病历日期");
+                String title = split[0].replace(date, "");
+                structureMap.put("文书标题", title);
+            }
+            structureMap.put("病历标题", recTitle);
+            String content = htmlText.substring(split[0].length(), htmlText.length()).trim().replace("\n", "").replace(" ", "");
+            String str = "记录医师";
+            int index = content.indexOf(str + ":");
+            if (index == -1) {
+                index = content.indexOf(str + ":");
+            }
+            if (index > 0) {
+                structureMap.put("病情记录", content.substring(0, index));
+              //  structureMap.put("记录医师", content.substring(index + str.length() + 1, content.length()));
+            }
+            //同时记录别的内容
+
+            titles = CommonAnalysisUtil.sortTitlesNoColon(titles, content);
+            CommonAnalysisUtil.cutByTitlesNoColon(content, titles, 0, structureMap);
+        }
+    }
+    public static void getStructureMapSplitByBlankCutByList(Map<String, String> structureMap, String htmlText, String recTitle, List<String> titles) {
+        extractedDate(structureMap, htmlText);
+        String[] split = htmlText.split(" ");
+        if (split.length > 1) {
+            if (structureMap.get("病历日期") != null) {
+                String date = structureMap.get("病历日期");
+                String title = split[0].replace(date, "");
+                structureMap.put("文书标题", split[1]);
+            }
+            structureMap.put("病历标题", recTitle);
+            String content = htmlText.substring(split[0].length(), htmlText.length()).trim().replace("\n", "").replace(" ", "");
+            String str = "记录医师";
+            int index = content.indexOf(str + ":");
+            if (index == -1) {
+                index = content.indexOf(str + ":");
+            }
+            if (index > 0) {
+                structureMap.put("病情记录", content.substring(0, index));
+                //  structureMap.put("记录医师", content.substring(index + str.length() + 1, content.length()));
+            }
+            //同时记录别的内容
+
+            titles = CommonAnalysisUtil.sortTitlesNoColon(titles, content);
+            CommonAnalysisUtil.cutByTitlesNoColon(content, titles, 0, structureMap);
+        }
+    }
+
+    public static void getStructureMapSplitCommonCutByList(Map<String, String> structureMap, String htmlText, String recTitle, List<String> titles) {
+        boolean flag = false;
+        extractedDate(structureMap, htmlText);
+        String[] split = htmlText.split("\n");
+        if (split.length <= 1) {
+            split = htmlText.split(" ");
+            flag = true;
+        }
+        if (split.length > 1) {
+            if (structureMap.get("病历日期") != null) {
+                String date = structureMap.get("病历日期");
+                String title = split[0].replace(date, "");
+                structureMap.put("文书标题", flag ? split[1] : title);
+            }
+            structureMap.put("病历标题", recTitle);
+            String content = htmlText.substring(split[0].length(), htmlText.length()).trim().replace("\n", "").replace(" ", "");
+            String str = "记录医师";
+            int index = content.indexOf(str + ":");
+            if (index == -1) {
+                index = content.indexOf(str + ":");
+            }
+            if (index == -1) {
+                index = content.indexOf("医师签名" + ":");
+            }
+            if (index == -1) {
+                index = content.indexOf("操作医师签名" + ":");
+            }
+            if (index > 0) {
+                structureMap.put("病情记录", content.substring(0, index));
+                //  structureMap.put("记录医师", content.substring(index + str.length() + 1, content.length()));
+            }
+            //同时记录别的内容
+
+            titles = CommonAnalysisUtil.sortTitlesNoColon(titles, content);
+            CommonAnalysisUtil.cutByTitlesNoColon(content, titles, 0, structureMap);
+        }
+    }
+}

+ 12 - 33
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/LeaveHospitalHtmlAnalysis.java

@@ -25,53 +25,32 @@ public class LeaveHospitalHtmlAnalysis implements HtmlAnalysis {
     public Map<String, String> analysis(String... args) {
     public Map<String, String> analysis(String... args) {
         Map<String, String> structureMap = Maps.newLinkedHashMap();
         Map<String, String> structureMap = Maps.newLinkedHashMap();
         try {
         try {
-            List<String> titles = Lists.newArrayList("姓名", "性别", "年龄 ", "科室", "床号", "住院号", "地址 ",
-                    "入院时间", "出院日期", "入院诊断", "出院诊断", "入院情况", "辅助检查", "诊治经过", "住院重要检查化验结果",
-                    "出院情况", "治疗效果", "出院医嘱", "特殊检查资料号", "医生签名", "日期", "专家门诊时间", "专科门诊时间", "健康宣教",
+            List<String> titles = Lists.newArrayList("姓名", "性别","出生年月","主诊医师",
+                    "入院日期", "出院日期", "入院诊断", "出院诊断","疗效评价", "住院天数","入院情况", "住院诊治经过(包括重要发现和结论、接受手术和操作、药物和其它治疗)","辅助检查"
+                    ,"出院情况","出院去向", "出院带药","出院指导","复诊", "健康宣教",
+                    "可能需要的紧急医疗", "出院交通需求", "监护人意见", "监护人签名",
                     "健康指导");
                     "健康指导");
             String html = args[0];
             String html = args[0];
             String recTitle = args[1];
             String recTitle = args[1];
             String recTypeId = args[2];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
             Document doc = Jsoup.parse(html);
-            HtmlAnalysisUtil.tableStyle1InsertMap(doc.getElementById("table1"), structureMap);
-            if (doc.selectFirst("body").child(0).getElementById("table1") != null) {
-                doc.selectFirst("body").child(0).getElementById("table1").remove();
-            }
-            String htmlContent = HtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
+            //个人基础信息table解析
+            String htmlContent = HangzhoufubaoCommonAnalysisUtil.html2String(doc.toString());
             if (StringUtil.isNotBlank(htmlContent)) {
             if (StringUtil.isNotBlank(htmlContent)) {
-                htmlContent = htmlContent.replace("患者如有需要,可于出院十日后(工作日),携带(身份证、社保卡、户口簿)等有效身份证到病案室(茗\n" +
-                        "园楼3楼)复印住院病历等资料。如委托他人办理,需携带委托人(患者)及被委托人有效身份证明前来办\n" +
-                        "理。", "")
-                        .replace("患者如有需要,可于出院十日后,携带(身份证、社保卡、户口簿等)有效身份证明到病案室(茗园楼\n" +
-                                "三楼)复印住院病历资料。如委托他人办理,需携带委托人(患者)及被委托人有效身份证明前来办理。", "")
-                        .replace("特殊检查资料号", "特殊检查资料号:");
-                List<String> sortTitles = CommonAnalysisUtil.sortTitles(titles, htmlContent);
-
-                try {
-                    CommonAnalysisUtil.cutByTitles(htmlContent, sortTitles, 0, structureMap);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                    log.error("报错html :" + htmlContent);
-                }
+                HangzhoufubaoCommonAnalysisUtil.html2StructureMap(titles,htmlContent,structureMap);
             }
             }
-            if (StringUtil.isNotBlank(CommonAnalysisUtil.extractDate(structureMap.get("出院日期")))) {
+/*            if (StringUtil.isNotBlank(CommonAnalysisUtil.extractDate(structureMap.get("出院日期")))) {
                 structureMap.put("住院天数", structureMap.get("出院日期").replace(CommonAnalysisUtil.extractDate(structureMap.get("出院日期")), ""));
                 structureMap.put("住院天数", structureMap.get("出院日期").replace(CommonAnalysisUtil.extractDate(structureMap.get("出院日期")), ""));
-                structureMap.put("出院日期", CommonAnalysisUtil.extractDate(structureMap.get("出院日期")));
-            }
-            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));
-            }
-            if (structureMap.containsKey("医生签名")) {
+                structureMap.put("出院日期", CommonAnalysisUtil.extractDate(structureMap.get("出院日期")));*/
+
+           /* if (structureMap.containsKey("医生签名")) {
                 if (structureMap.get("医生签名").indexOf("SignControl") != -1) {
                 if (structureMap.get("医生签名").indexOf("SignControl") != -1) {
                     structureMap.put("医生签名", structureMap.get("医生签名").substring(0, structureMap.get("医生签名").indexOf("SignControl")));
                     structureMap.put("医生签名", structureMap.get("医生签名").substring(0, structureMap.get("医生签名").indexOf("SignControl")));
                 }
                 }
             }
             }
             if (structureMap.containsKey("日期")) {
             if (structureMap.containsKey("日期")) {
                 structureMap.put("日期", CommonAnalysisUtil.extractDate(structureMap.get("日期")));
                 structureMap.put("日期", CommonAnalysisUtil.extractDate(structureMap.get("日期")));
-            }
+            }*/
             HtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
             HtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
         } catch (Exception e) {
             log.error(e.getMessage(), e + "html=" + args[0]);
             log.error(e.getMessage(), e + "html=" + args[0]);

+ 47 - 7
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/OperationHtmlAnalysis.java

@@ -9,6 +9,8 @@ import org.jsoup.nodes.Element;
 
 
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 
 /**
 /**
  * @Description:
  * @Description:
@@ -22,19 +24,57 @@ public class OperationHtmlAnalysis implements HtmlAnalysis {
 
 
     @Override
     @Override
     public Map<String, String> analysis(String... args) {
     public Map<String, String> analysis(String... args) {
-        Map<String, String> map = Maps.newLinkedHashMap();
+        Map<String, String> structureMap = Maps.newLinkedHashMap();
         try {
         try {
-            String html = args[0];
+            String htmlText = args[0];
             String recTitle = args[1];
             String recTitle = args[1];
             String recTypeId = args[2];
             String recTypeId = args[2];
-            Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
-            analysisGeneral(recTitle, bigDivElement, map);
-            CommonAnalysisUtil.makeEmpty(map, "医生签名");
-            HtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            Element bigDivElement = Jsoup.parse(htmlText).selectFirst("body").child(0);
+            htmlText = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+          /*  analysisGeneral(recTitle, bigDivElement, map);
+            CommonAnalysisUtil.makeEmpty(map, "医生签名");*/
+
+            getStructureMap(structureMap, htmlText, recTitle);
+
+            //  structureMap.put("记录医生")
+            HtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+
         } catch (Exception e) {
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             log.error(e.getMessage(), e);
         }
         }
-        return map;
+        return structureMap;
+    }
+
+    private void getStructureMap(Map<String, String> structureMap, String htmlText, String recTitle) {
+        extractedDate(structureMap, htmlText);
+        String[] split = htmlText.split("\n");
+        if (split.length > 1) {
+            if (structureMap.get("病历日期") != null) {
+                String date = structureMap.get("病历日期");
+                String title = split[0].replace(date, "");
+                structureMap.put("文书标题", title);
+            }
+            structureMap.put("病历标题", recTitle);
+            String content = htmlText.substring(split[0].length(), htmlText.length()).trim().replace("\n", "").replace(" ", "");
+            String str = "记录医师";
+            int index = content.indexOf(str + ":");
+            if (index == -1) {
+                index = content.indexOf(str + ":");
+            }
+            if (index > 0) {
+                structureMap.put("病情记录", content.substring(0, index));
+                structureMap.put("记录医师", content.substring(index + str.length() + 1, content.length()));
+            }
+        }
+    }
+
+    private void extractedDate(Map<String, String> structureMap, String htmlText) {
+        Pattern p1 = Pattern.compile("[0-9]{4}年[0-9]+月[0-9]+日[0-9]+时[0-9]+分");
+        Matcher m1 = p1.matcher(htmlText);
+        if (m1.find()) {
+            String date = m1.group(0);
+            structureMap.put("病历日期", date);
+        }
     }
     }
 
 
     private void analysisGeneral(String recTitle, Element bigDivElement, Map<String, String> map) {
     private void analysisGeneral(String recTitle, Element bigDivElement, Map<String, String> map) {

+ 8 - 11
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/OperationRecordHtmlAnalysis.java

@@ -41,32 +41,29 @@ public class OperationRecordHtmlAnalysis implements HtmlAnalysis {
 
 
     private void analysisGeneral(Element bigDivElement, Map<String, String> map) {
     private void analysisGeneral(Element bigDivElement, Map<String, String> map) {
         String text = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         String text = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
-        text = text.replaceAll("第1页", "").replace(" ", "")
+        text = text.replaceAll("第1页", "")
                 .replace("(包括体位、切口处理经过,病灶所见及手术步骤等):", "");
                 .replace("(包括体位、切口处理经过,病灶所见及手术步骤等):", "");
         List<String> titles = Lists.newArrayList(
         List<String> titles = Lists.newArrayList(
-                "姓名", "病区", "科室", "床号", "床位", "住院号", "手术开始时间", "手术结束时间", "术前诊断", "术 前 诊  断",
-                "手术名称", "手 术 名  称", "术中诊断", "术(中)后诊断", "手术人员", "手术主刀医师", "手 术 主 刀 医 师", "一助", "二助", "麻醉方式",
-                "麻 醉 方  式", "麻醉人员", "麻 醉 医  师", "手术风险评估(可选)", "NNIS分级", "手术类别(可选)", "手术标本", "冰冻切片结果",
-                "术中并发症", "术中失血量", "手术经过", "手术经过及处理(包括患者的体位、切口处理、病灶所见及手术步骤等)", "记录者签字", "主刀签字", "主刀医师签名",
-                "记录日期", "日期", "时间"
-        );
+                "手术开始时间", "手术结束时间", "手术全程时间", "术前诊断", "手术名称", "手术指征", "术后诊断", "主刀医师", "麻醉人员", "器械护士",
+                "儿科医生", "护婴人", "指导人", "麻醉方式", "麻醉体位", "麻醉效果", "手术经过", "术中并发症", "冰冻切片诊断", "送检手术标本",
+                "失血量", "输入血/血制品", "植入物", "手术医生签名", "日 期");
         titles = CommonAnalysisUtil.sortTitles(titles, text);
         titles = CommonAnalysisUtil.sortTitles(titles, text);
         CommonAnalysisUtil.cutByTitles(text, titles, 0, map);
         CommonAnalysisUtil.cutByTitles(text, titles, 0, map);
-        CommonAnalysisUtil.processTypeRight(map, "NNIS分级");
+/*        CommonAnalysisUtil.processTypeRight(map, "NNIS分级");
         CommonAnalysisUtil.processTypeRight(map, "手术类别(可选)");
         CommonAnalysisUtil.processTypeRight(map, "手术类别(可选)");
         CommonAnalysisUtil.processType(map, "手术标本");
         CommonAnalysisUtil.processType(map, "手术标本");
         CommonAnalysisUtil.processType(map, "术中并发症");
         CommonAnalysisUtil.processType(map, "术中并发症");
         if (StringUtil.isNotBlank(map.get("NNIS分级"))) {
         if (StringUtil.isNotBlank(map.get("NNIS分级"))) {
             map.put("NNIS分级", map.get("NNIS分级").replace("-", ""));
             map.put("NNIS分级", map.get("NNIS分级").replace("-", ""));
-        }
-        if (map.containsKey("记录日期") && StringUtil.isNotBlank(map.get("记录日期"))) {
+        }*/
+       /* if (map.containsKey("记录日期") && StringUtil.isNotBlank(map.get("记录日期"))) {
             StringBuffer sb = new StringBuffer();
             StringBuffer sb = new StringBuffer();
             sb.append(map.get("记录日期"));
             sb.append(map.get("记录日期"));
             if (map.containsKey("时间") && StringUtil.isNotBlank(map.get("时间"))) {
             if (map.containsKey("时间") && StringUtil.isNotBlank(map.get("时间"))) {
                 sb.append(map.get("时间"));
                 sb.append(map.get("时间"));
             }
             }
             map.put("日期", sb.toString());
             map.put("日期", sb.toString());
-        }
+        }*/
         /*if (map.containsKey("手术主刀医师") && StringUtil.isNotBlank(map.get("手术主刀医师"))) {
         /*if (map.containsKey("手术主刀医师") && StringUtil.isNotBlank(map.get("手术主刀医师"))) {
             StringBuffer sb1 = new StringBuffer();
             StringBuffer sb1 = new StringBuffer();
             sb1.append("手术主刀医师:" + map.get("手术主刀医师"));
             sb1.append("手术主刀医师:" + map.get("手术主刀医师"));

+ 9 - 14
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/PreoperativeHtmlAnalysis.java

@@ -45,32 +45,27 @@ public class PreoperativeHtmlAnalysis implements HtmlAnalysis {
         }*/
         }*/
         String text = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true).replace("·", "");
         String text = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true).replace("·", "");
 
 
-        int index1 = text.lastIndexOf("经治医师签名");
+      /*  int index1 = text.lastIndexOf("经治医师签名");
         int index2 = text.lastIndexOf("主刀医师签名");
         int index2 = text.lastIndexOf("主刀医师签名");
         if (index1 != -1 && index2 != -1) {
         if (index1 != -1 && index2 != -1) {
             text = text.substring(0, index1)
             text = text.substring(0, index1)
                     + text.substring(index1, index2).replace("签字时间", "经治医师签字时间:")
                     + text.substring(index1, index2).replace("签字时间", "经治医师签字时间:")
                     + text.substring(index2).replace("签字时间", "主刀医师签字时间:");
                     + text.substring(index2).replace("签字时间", "主刀医师签字时间:");
-        }
-        text = text.replace("(", "(")
+        }*/
+/*        text = text.replace("(", "(")
                 .replace(")", ")")
                 .replace(")", ")")
                 .replace("术前讨论及术前小结", "")
                 .replace("术前讨论及术前小结", "")
                 .replace("二、讨论结论:", "")
                 .replace("二、讨论结论:", "")
                 .replace("(如腹腔镜可能改开腹等)", "")
                 .replace("(如腹腔镜可能改开腹等)", "")
                 .replace("(如高血压病、冠心病、糖尿病、脑梗、心梗、心肺肝肾功能不全、口服抗凝药等)", "")
                 .replace("(如高血压病、冠心病、糖尿病、脑梗、心梗、心肺肝肾功能不全、口服抗凝药等)", "")
                 .replace("年月日时\n" + "分", "")
                 .replace("年月日时\n" + "分", "")
-                .replace("一、简要病情", "简要病情");
-        List<String> titles = Lists.newArrayList("姓名", "科别", "床号", "住院号", "讨论时间", "讨论方式", "参加人员", "简要病情",
-                "术前诊断", "手术指征与禁忌征", "拟施手术方式、名称及可能的变更", "计划性多次手术", "拟施麻醉方式", "术前特殊准备",
-                "主要术中、术后风险及防范措施", "术中、术后注意事项(含护理事项)",
-                "经治医师签名", "经治医师签字时间", "主刀医师签名", "主刀医师签字时间");
+                .replace("一、简要病情", "简要病情");*/
+        text = text.replace("参加人员(姓名及专业技术职务) ", "参加人员");
+        List<String> titles = Lists.newArrayList("记录时间", "术前讨论时间", "讨论方式", "参加人员", "简要病情", "术前诊断", "手术指征"
+                ,  "术前诊断", "手术指征", "术前准备", "手术禁忌证", "患者目前心理状态/文化需求", "拟行手术方案",
+                "拟施麻醉", "手术目标",
+                "手术中注意点", "术后注意点", "出院后潜在的医疗与康复需求", "主刀医师意见与手术安排","医生签名");
         CommonAnalysisUtil.cutByTitles(text, titles, 0, map);
         CommonAnalysisUtil.cutByTitles(text, titles, 0, map);
-        CommonAnalysisUtil.repKey(map, "经治医师签名", "医生签名");
-        CommonAnalysisUtil.repKey(map, "主刀医师签名", "医生签名");
-        CommonAnalysisUtil.processType(map, "计划性多次手术");
-        CommonAnalysisUtil.processType(map, "讨论方式");
-        // 解决医生签名显示 年 月 日 时 分
-        signatureTime(map);
     }
     }
 
 
     /**
     /**

+ 8 - 10
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/RescueHtmlAnalysis.java

@@ -2,7 +2,6 @@ package com.lantone.qc.trans.hangzhoufubao.util;
 
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Maps;
-import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Element;
 import org.jsoup.nodes.Element;
@@ -28,7 +27,7 @@ public class RescueHtmlAnalysis implements HtmlAnalysis {
             String recTitle = args[1];
             String recTitle = args[1];
             String recTypeId = args[2];
             String recTypeId = args[2];
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
             Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
-            analysisGeneral(recTitle,bigDivElement, map);
+            analysisGeneral(recTitle, bigDivElement, map);
             HtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
             HtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             log.error(e.getMessage(), e);
@@ -36,21 +35,20 @@ public class RescueHtmlAnalysis implements HtmlAnalysis {
         return map;
         return map;
     }
     }
 
 
-    private void analysisGeneral(String recTitle, Element bigDivElement, Map<String, String> map) {
+    private void analysisGeneral(String recTitle, Element bigDivElement, Map<String, String> structureMap) {
         if (bigDivElement.childNodeSize() == 1) {
         if (bigDivElement.childNodeSize() == 1) {
             bigDivElement = bigDivElement.child(0);
             bigDivElement = bigDivElement.child(0);
         }
         }
         if (bigDivElement.selectFirst("hr") != null) {
         if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
         }
-        String text = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
-        CommonAnalysisUtil.extractWardInfo(recTitle,text, map);
-        String bqjlText = "病情记录" + map.get("病情记录");
+        String htmlText = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         List<String> titles = Lists.newArrayList(
         List<String> titles = Lists.newArrayList(
-                "病情记录"
+                "抢救时间", "抢救内容", "参加人员", "记录医师"
         );
         );
-        titles = CommonAnalysisUtil.sortTitlesNoColon(titles, bqjlText);
-        CommonAnalysisUtil.cutByTitlesNoColon(bqjlText, titles, 0, map);
+        HangzhoufubaoTranUtils.getStructureMapSplitByLineCutByList(structureMap, htmlText, recTitle, titles);
+
     }
     }
 
 
-}
+}
+

+ 36 - 1
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/ThreeLevelWardHtmlAnalysis.java

@@ -2,6 +2,7 @@ package com.lantone.qc.trans.hangzhoufubao.util;
 
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 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.comsis.CommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
 import org.jsoup.Jsoup;
@@ -12,6 +13,8 @@ import org.jsoup.select.Elements;
 
 
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 
 /**
 /**
  * @Description: 自定义病程记录html解析
  * @Description: 自定义病程记录html解析
@@ -48,7 +51,30 @@ public class ThreeLevelWardHtmlAnalysis implements HtmlAnalysis {
 
 
             /*htmlText = htmlText.replace("注意:上级医师查房主要记 录:患者病情、诊断、鉴别诊断、当前治疗措施和疗效的分析及下一步诊疗意见等,能反应上级医 师的水平。", "")
             /*htmlText = htmlText.replace("注意:上级医师查房主要记 录:患者病情、诊断、鉴别诊断、当前治疗措施和疗效的分析及下一步诊疗意见等,能反应上级医 师的水平。", "")
                     .replace("提醒:有创诊疗操作记录内容包括操作名称、时间、步骤、结果及患者的一般情况,记录操作过 程是否顺利,有无不良反应,术后注意事项,操作医师签名、记录时间等。 手术室完成的、治疗性质的及全麻下完成的有创诊疗操作参照手术管理。(包括介入治疗、胃肠镜 下肿瘤切除/粘膜下肿瘤剥除等)", "");*/
                     .replace("提醒:有创诊疗操作记录内容包括操作名称、时间、步骤、结果及患者的一般情况,记录操作过 程是否顺利,有无不良反应,术后注意事项,操作医师签名、记录时间等。 手术室完成的、治疗性质的及全麻下完成的有创诊疗操作参照手术管理。(包括介入治疗、胃肠镜 下肿瘤切除/粘膜下肿瘤剥除等)", "");*/
-            CommonAnalysisUtil.extractWardInfo(recTitle, htmlText, structureMap);
+           //CommonAnalysisUtil.extractWardInfo(recTitle, htmlText, structureMap);
+            //提取文本中的时间
+            //提取文本中的记录医师
+            extractedDate(structureMap, htmlText);
+            String[] split = htmlText.split("\n");
+            if (split.length > 1) {
+                if (structureMap.get("病历日期") != null) {
+                    String date = structureMap.get("病历日期");
+                   String  title = split[0].replace(date, "");
+                    structureMap.put("文书标题", title);}
+                    structureMap.put("病历标题", recTitle);
+                String content = htmlText.substring(split[0].length(), htmlText.length()).trim().replace("\n","").replace(" ","");
+                String str = "记录医师";
+                int index = content.indexOf(str+":");
+                if (index == -1) {
+                    index = content.indexOf(str+":");
+                }
+                if (index > 0) {
+                    structureMap.put("病情记录", content.substring(0, index));
+                    structureMap.put("记录医师", content.substring(index + str.length() + 1, content.length()));
+                }
+            }
+
+            //  structureMap.put("记录医生")
             HtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
             HtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             log.error(e.getMessage(), e);
@@ -56,6 +82,15 @@ public class ThreeLevelWardHtmlAnalysis implements HtmlAnalysis {
         return structureMap;
         return structureMap;
     }
     }
 
 
+    private void extractedDate(Map<String, String> structureMap, String htmlText) {
+        Pattern p1 = Pattern.compile("[0-9]{4}年[0-9]+月[0-9]+日[0-9]+时[0-9]+分");
+        Matcher m1 = p1.matcher(htmlText);
+        if (m1.find()) {
+           String  date = m1.group(0);
+            structureMap.put("病历日期", date);
+        }
+    }
+
     /**
     /**
      * 将html内容以行为单位存进list,从<hr>之后开始处理
      * 将html内容以行为单位存进list,从<hr>之后开始处理
      *
      *

+ 2 - 5
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/TransferIntoHtmlAnalysis.java

@@ -44,13 +44,10 @@ public class TransferIntoHtmlAnalysis implements HtmlAnalysis {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
         }
         String text = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         String text = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
-        CommonAnalysisUtil.extractWardInfo(recTitle, text, map);
-        String bqjlText = "病情记录" + map.get("病情记录");
         List<String> titles = Lists.newArrayList(
         List<String> titles = Lists.newArrayList(
-                "病情记录", "医师签名", "医师签字"
+                "入院情况", "入院诊断", "诊疗经过", "目前情况", "目前诊断", "转科目的", "诊疗计划", "医师签名", "时间"
         );
         );
-        titles = CommonAnalysisUtil.sortTitlesNoColon(titles, bqjlText);
-        CommonAnalysisUtil.cutByTitlesNoColon(bqjlText, titles, 0, map);
+        HangzhoufubaoTranUtils.getStructureMapSplitCommonCutByList(map, text, recTitle, titles);
     }
     }
 
 
 }
 }

+ 11 - 15
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/TransferOutHtmlAnalysis.java

@@ -44,22 +44,18 @@ public class TransferOutHtmlAnalysis implements HtmlAnalysis {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
         }
         String text = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         String text = HtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
-        CommonAnalysisUtil.extractWardInfo(recTitle, text, map);
-        String bqjlText = "病情记录" + map.get("病情记录").replace("年   月   日   时   分 ","");
         List<String> titles = Lists.newArrayList(
         List<String> titles = Lists.newArrayList(
-                "病情记录",
-                "医生签名",
-                "签名时间",
-                "患者签名",
-                "签名时间"
+                "入院情况",
+                "入院诊断",
+                "诊疗经过",
+                "目前情况",
+                "目前诊断",
+                "转科目的",
+                "注意事项",
+                "医师签名",
+                "时间"
         );
         );
-        titles = CommonAnalysisUtil.sortTitlesNoColon(titles, bqjlText);
-        CommonAnalysisUtil.cutByTitlesNoColon(bqjlText, titles, 0, map);
-        List<String> tits = Lists.newArrayList(
-                "签名时间",
-                "患者签名"
-        );
-        tits = CommonAnalysisUtil.sortTitlesNoColon(tits, text);
-        CommonAnalysisUtil.cutByTitlesNoColon(text, tits, 0, map);
+        HangzhoufubaoTranUtils.getStructureMapSplitCommonCutByList(map, text, recTitle, titles);
+
     }
     }
 }
 }

+ 292 - 0
trans/src/main/java/com/lantone/qc/trans/hangzhoufubao/util/hangzhoufubaoHtmlAnalysisUtil.java

@@ -0,0 +1,292 @@
+package com.lantone.qc.trans.hangzhoufubao.util;
+
+import com.google.common.collect.Lists;
+import com.lantone.qc.dbanaly.util.ModuleMappingUtil;
+import com.lantone.qc.pub.util.StringUtil;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:
+ * @author: rengb
+ * @time: 2020/9/15 16:31
+ */
+public class hangzhoufubaoHtmlAnalysisUtil {
+
+    /**
+     * table样式:key和value在同一个td中,以冒号分开;保留换行
+     *
+     * @param tableElement
+     * @param map
+     */
+    public static void tableStyle1InsertMap(Element tableElement, Map<String, String> map) {
+        if (tableElement == null || map == null) {
+            return;
+        }
+        List<Element> tdElements = Lists.newArrayList();
+        tableElement.selectFirst("tbody").children().forEach(trElement -> {
+            trElement.children().forEach(tdElement -> {
+                tdElements.add(tdElement);
+            });
+        });
+        String tdText = null;
+        int tdMhIndex = 0;
+        for (Element tdElement : tdElements) {
+            if (tdElement.childNodeSize() == 0) {
+                continue;
+            }
+            tdText = blockDivToStr(tdElement.child(0), true);
+            if (tdText.endsWith("\n")) {
+                tdText = tdText.substring(0, tdText.length() - 1);
+            }
+            if (StringUtil.isBlank(tdText)) {
+                continue;
+            }
+            tdMhIndex = tdText.indexOf(":");
+            if (tdMhIndex == -1) {
+                tdMhIndex = tdText.indexOf(":");
+            }
+            if (tdMhIndex < 1) {
+                continue;
+            }
+            if (tdText.contains("姓    名") && tdText.contains("年    龄")) {
+                multiColonResolve(tdMhIndex, tdText, "年    龄", map);
+            } else if (tdText.contains("姓    名") && tdText.contains("年   龄")) {
+                multiColonResolve(tdMhIndex, tdText, "年   龄", map);
+            } else if (tdText.contains("姓    名") && tdText.contains("年  龄")) {
+                multiColonResolve(tdMhIndex, tdText, "年  龄", map);
+            } else if (tdText.contains("姓    名") && tdText.contains("年 龄")) {
+                multiColonResolve(tdMhIndex, tdText, "年 龄", map);
+            } else if (tdText.contains("产前检查") && tdText.contains("孕/产次")) {
+                multiColonResolve(tdMhIndex, tdText, "孕/产次", map);
+            } else if (tdText.contains("末次月经") && tdText.contains("预产期")) {
+                multiColonResolve(tdMhIndex, tdText, "预产期", map);
+            } else {
+                map.put(
+                        StringUtil.removeBlank(tdText.substring(0, tdMhIndex)),
+                        tdText.length() - 1 <= tdMhIndex ? "" : tdText.substring(tdMhIndex + 1)
+                );
+            }
+        }
+    }
+
+    /**
+     * 取得多个字段时,分别存储
+     *
+     * @param tdText
+     * @param text
+     */
+    public static void multiColonResolve(int tdMhIndex, String tdText, String text, Map<String, String> map) {
+        String firstText = tdText.split(text)[0];
+        map.put(
+                StringUtil.removeBlank(firstText.substring(0, tdMhIndex)),
+                firstText.length() - 1 <= tdMhIndex ? "" : firstText.substring(tdMhIndex + 1)
+        );
+        String secondText = tdText.split(text)[1];
+        secondText = secondText.replace(":", "");
+        secondText = secondText.replace(":", "");
+        map.put(StringUtil.removeBlank(text), secondText);
+    }
+
+    /**
+     * table样式:td两两配对,一个key,一个value;不保留换行
+     *
+     * @param tableElement
+     * @param map
+     */
+    public static void tableStyle2InsertMap(Element tableElement, Map<String, String> map) {
+        if (tableElement == null || map == null) {
+            return;
+        }
+        List<Element> tdElements = Lists.newArrayList();
+        tableElement.selectFirst("tbody").children().forEach(trElement -> {
+            if (trElement.childNodeSize() != 2) {
+                return;
+            }
+            trElement.children().forEach(tdElement -> {
+                tdElements.add(tdElement);
+            });
+        });
+        int index = 0;
+        String key = null, value = null, text = null;
+        for (Element tdElement : tdElements) {
+            if (tdElement.childNodeSize() == 0) {
+                text = "";
+            } else {
+                text = blockDivToStr(tdElement.child(0), false);
+            }
+            if (index % 2 == 0) {
+                key = text.replaceAll("[:: ]", "");
+            }
+            if (index % 2 == 1) {
+                value = text;
+                if (StringUtil.isNotBlank(key)) {
+                    map.put(key, value);
+                }
+            }
+            index++;
+        }
+    }
+
+    /**
+     * 一个大的块状div下包含很多行行状div
+     *
+     * @param divElement
+     * @param isLineBreak 是否保留换行
+     * @return
+     */
+    public static String blockDivToStr(Element divElement, boolean isLineBreak) {
+        if (divElement == null) {
+            return "";
+        }
+        StringBuffer sbf = new StringBuffer();
+        for (Element childElement : divElement.children()) {
+            if (isLineBreak) {
+                sbf.append(elementLayer1ToStr(childElement, false)).append("\n");
+            } else {
+                sbf.append(elementLayer1ToStr(childElement, false).trim());
+            }
+        }
+        return sbf.toString();
+    }
+
+    /**
+     * 标签仅遍历第一子层级后转字符串
+     *
+     * @param element
+     * @param isLineBreak 是否保留换行
+     * @return
+     */
+    public static String elementLayer1ToStr(Element element, boolean isLineBreak) {
+        if (element == null) {
+            return "";
+        }
+        StringBuffer sbf = new StringBuffer();
+        List<Element> elements = Lists.newArrayList();
+        Elements childElements = element.children();
+        if (childElements.size() == 0) {
+            elements.add(element);
+        }
+        for (Element childElement : childElements) {
+            elements.add(childElement);
+        }
+        for (Element childElement : elements) {
+            if (childElement.tagName().equals("img") || childElement.tagName().equals("image")) {
+                //                sbf.append(childElement.outerHtml());
+                sbf.append("—");
+            } else {
+                sbf.append(childElement.text());
+            }
+            if (isLineBreak) {
+                sbf.append("\n");
+            }
+        }
+        String sbfString = removeSex(sbf.toString().replaceAll(" ", " "));
+        return sbfString;
+    }
+
+    /**
+     * 查询并插入页面模板id
+     *
+     * @param modeId
+     * @param recTitle
+     * @param map
+     */
+    public static void insertModuleId(String modeId, String recTitle, Map<String, String> map) {
+        if ((StringUtil.isBlank(modeId) && StringUtil.isBlank(recTitle)) || map == null) {
+            return;
+        }
+        String moduleId = ModuleMappingUtil.getHtmlDataTypeModuleId(recTitle);
+        if (StringUtil.isBlank(moduleId)) {
+            moduleId = ModuleMappingUtil.getStandardModuleId(modeId);
+        }
+        map.put("mode_id", moduleId);
+    }
+
+    /**
+     * map中有的value以冒号开头,用此方法来去掉冒号
+     *
+     * @param map
+     */
+    public static void mapValueRemoveStartColon(Map<String, String> map) {
+        if (map == null) {
+            return;
+        }
+        map.keySet().forEach(key -> {
+            if (map.get(key).startsWith(":") || map.get(key).startsWith(":")) {
+                map.put(key, map.get(key).replaceFirst("[::]", ""));
+            }
+        });
+    }
+
+    /**
+     * 北仑:入院记录中性别取得去除"性"
+     * e.g.(性    别:男性 ->性    别:男)
+     *
+     * @param sbfString
+     */
+    public static String removeSex(String sbfString) {
+        if (sbfString.contains("性    别:")) {
+            sbfString = sbfString.substring(0, sbfString.length() - 1);
+        }
+        return sbfString;
+    }
+
+    /**
+     * 杭州妇保自定义xml解析模板(入院记录)
+     * @param divElement
+     * @param isLineBreak 是否保留换行
+     * @return
+     */
+    public static String blockDivToStr2(Element divElement, boolean isLineBreak) {
+        if (divElement == null) {
+            return "";
+        }
+        StringBuffer sbf = new StringBuffer();
+        for (Element childElement : divElement.children()) {
+            if (isLineBreak) {
+                sbf.append(elementLayer1ToStr2(childElement, false)).append("\n");
+            } else {
+                sbf.append(elementLayer1ToStr2(childElement, false).trim());
+            }
+        }
+        return sbf.toString();
+    }
+
+    /**
+     * 余杭三院自定义xml解析模板(入院记录)
+     * @param element
+     * @param isLineBreak 是否保留换行
+     * @return
+     */
+    public static String elementLayer1ToStr2(Element element, boolean isLineBreak) {
+        if (element == null) {
+            return "";
+        }
+        StringBuffer sbf = new StringBuffer();
+        List<Element> elements = Lists.newArrayList();
+        Elements childElements = element.children();
+        if (childElements.size() == 0) {
+            elements.add(element);
+        }
+        for (Element childElement : childElements) {
+            elements.add(childElement);
+        }
+        for (Element childElement : elements) {
+            if (childElement.tagName().equals("img") || childElement.tagName().equals("image")) {
+                //                sbf.append(childElement.outerHtml());
+                sbf.append("—");
+            } else {
+                sbf.append(childElement.text());
+            }
+            if (isLineBreak) {
+                sbf.append("\n");
+            }
+        }
+        String sbfString = removeSex(sbf.toString().replaceAll(" ", " "));
+        return sbfString;
+    }
+}