Browse Source

Merge branch 'hb/beilun' of http://192.168.2.236:10080/louhr/qc into hb/beilun

江豪迪 3 years ago
parent
commit
eb6b34b156
61 changed files with 1538 additions and 647 deletions
  1. 1 1
      dbanaly/src/main/resources/application-debug.yml
  2. 3 3
      dbanaly/src/main/resources/application-local.yml
  3. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0009.java
  4. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0010.java
  5. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0030.java
  6. 2 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0372.java
  7. 3 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0342.java
  8. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0344.java
  9. 6 6
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/difficultcasediscuss/DIF0118.java
  10. 3 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/difficultcasediscuss/DIF0119.java
  11. 2 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0162.java
  12. 68 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/xszyy/firstpagerecord/FIRP0190.java
  13. 45 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/xszyy/firstpagerecord/FIRP0220.java
  14. 74 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/xszyy/operationdiscussion/OPE03142.java
  15. 64 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/xszyy/operationdiscussion/OPE03143.java
  16. 36 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/xszyy/threelevelward/THR0685.java
  17. 22 9
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE03143.java
  18. 3 3
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/preoperativediscussion/PRE0329.java
  19. 1 1
      kernel/src/main/resources/bootstrap.yml
  20. 1 1
      trans/src/main/java/com/lantone/qc/trans/shaoyf/ShaoyfThreeLevelWardDocTrans.java
  21. 14 6
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunBeHospitalizedDocTrans.java
  22. 3 3
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunClinicalBloodDocTrans.java
  23. 2 5
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunConsultationDocTrans.java
  24. 2 1
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunCrisisValueReportDocTrans.java
  25. 4 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunCriticallyIllNoticeDocTrans.java
  26. 4 4
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunDeathCaseDiscussDocTrans.java
  27. 3 1
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunDeathRecordDocTrans.java
  28. 6 3
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunDifficultCaseDiscussDocTrans.java
  29. 2 4
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunFirstCourseRecordDocTrans.java
  30. 2 18
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunLeaveHospitalDocTrans.java
  31. 20 33
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunOperationDocTrans.java
  32. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunRescueDocTrans.java
  33. 3 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunStagesSummaryDocTrans.java
  34. 1 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunThreeLevelWardDocTrans.java
  35. 4 4
      trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunTransferRecordDocTrans.java
  36. 93 107
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunBeHospitalizedHtmlAnalysis.java
  37. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunClinicBloodEffectHtmlAnalysis.java
  38. 19 35
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunClinicalBloodHtmlAnalysis.java
  39. 3 3
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunConsultationHtmlAnalysis.java
  40. 15 21
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunConsultationRecordHtmlAnalysis.java
  41. 16 20
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunCrisisValueReportHtmlAnalysis.java
  42. 26 8
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunCriticallyIllNoticeHtmlAnalysis.java
  43. 27 13
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunDeathCaseDiscussHtmlAnalysis.java
  44. 12 9
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunDeathRecordHtmlAnalysis.java
  45. 8 17
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunDifficultCaseDiscussHtmlAnalysis.java
  46. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunDutyShiftSystemHtmlAnalysis.java
  47. 11 44
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunFirstCourseRecordHtmlAnalysis.java
  48. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunInformedHtmlAnalysis.java
  49. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunInvasiveOperationHtmlAnalysis.java
  50. 12 19
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunLeaveHospitalHtmlAnalysis.java
  51. 27 5
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunOperationHtmlAnalysis.java
  52. 2 2
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunOperationInformedHtmlAnalysis.java
  53. 22 50
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunOperationRecordHtmlAnalysis.java
  54. 23 58
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunPreoperativeHtmlAnalysis.java
  55. 17 20
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunRescueHtmlAnalysis.java
  56. 14 20
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunStagesSummaryHtmlAnalysis.java
  57. 18 12
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunThreeLevelWardHtmlAnalysis.java
  58. 15 20
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunTransferIntoHtmlAnalysis.java
  59. 15 29
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunTransferOutHtmlAnalysis.java
  60. 1 1
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunHtmlAnalysisUtil.java
  61. 724 0
      trans/src/main/java/com/lantone/qc/trans/xszyy/util/comsis/XszyyCommonAnalysisUtil.java

+ 1 - 1
dbanaly/src/main/resources/application-debug.yml

@@ -5,7 +5,7 @@ spring:
     druid:
       lantone:
         driver-class-name: com.mysql.jdbc.Driver
-        url: jdbc:mysql://192.168.2.237:3307/qc?useUnicode=true&characterEncoding=utf8&useSSL=false
+        url: jdbc:mysql://192.168.2.237:3307/qc_xszyy?useUnicode=true&characterEncoding=utf8&useSSL=false
         username: root
         password: lantone
         initial-size: 8

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

@@ -28,9 +28,9 @@ spring:
     database:
       cache: 10 # cache索引
       token: 10 # Token索引
-    host: 127.0.0.1  #Redis服务器地址
-    port: 6379 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
-    password:  # Redis服务器连接密码(默认为空)
+    host: 192.168.2.237 #Redis服务器地址
+    port: 63791 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
+    password: emrais # Redis服务器连接密码(默认为空)
     lettuce:
       pool:
         max-active: 8 # 连接池最大连接数(使用负值表示没有限制)

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0009.java

@@ -22,7 +22,7 @@ import java.util.List;
 @Component
 public class BEH0009 extends QCCatalogue {
     private List<String> containList = Arrays.asList("检查", "术后", "药物", "发现", "误服", "确诊", "经", "异常", "诊断"
-            , "示", "超", "伤", "术", "复查", "体检", "血透", "血液透析", "孕", "农药", "呻吟");
+            , "示", "超", "伤", "术", "复查", "体检", "血透", "血液透析", "孕", "农药", "呻吟", "颈椎");
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         if (inputInfo.getBeHospitalizedDoc() == null) {

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0010.java

@@ -21,7 +21,7 @@ import java.util.List;
 @Component
 public class BEH0010 extends QCCatalogue {
     private List<String> containList = Arrays.asList("癌", "瘤", "复诊", "术后", "化疗后", "发现", "体检", "检查", "确诊"
-            , "诊断", "复查", "复发", "示", "超", "CT", "血透", "血液透析", "治疗后");
+            , "诊断", "复查", "复发", "示", "超", "CT", "血透", "血液透析", "治疗后", "痛");
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0030.java

@@ -47,7 +47,7 @@ public class BEH0030 extends QCCatalogue {
             status.set("0");
         }
         String pastText = pastLabel.getText();
-        if (pastText.contains("肝炎") || pastText.contains("结核") || pastText.contains("详见原病历")
+        if (pastText.contains("肝炎") || pastText.contains("传染病") || pastText.contains("结核") || pastText.contains("详见原病历")
                 || pastText.contains("见旧病历") || pastText.contains("见既往病历") || pastText.contains("乙肝")) {
             status.set("0");
         }

+ 2 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0372.java

@@ -29,7 +29,7 @@ public class BEH0372 extends QCCatalogue {
             bhbasicInfoStatus = inputInfo.getBeHospitalizedDoc().getStructureMap().get("婚姻");
         }
         if (StringUtil.isBlank(basicInfoStatus) || basicInfoStatus.contains("详见")
-                || basicInfoStatus.contains("见旧病历")|| basicInfoStatus.contains("见既往病历")|| StringUtil.isBlank(bhbasicInfoStatus)) {
+                || basicInfoStatus.contains("见旧病历") || basicInfoStatus.contains("见既往病历") || StringUtil.isBlank(bhbasicInfoStatus)) {
             status.set("0");
             return;
         }
@@ -58,7 +58,7 @@ public class BEH0372 extends QCCatalogue {
         }
 
         if (bhbasicInfoStatus.equals("已婚") && (basicInfoStatus.contains("结婚") || basicInfoStatus.contains("再婚")
-                || basicInfoStatus.contains("育有") || basicInfoStatus.contains("已婚"))) {
+                || basicInfoStatus.contains("育有") || basicInfoStatus.contains("已婚") || basicInfoStatus.contains("婚育"))) {
             status.set("0");
             return;
         }

+ 3 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0342.java

@@ -27,13 +27,14 @@ public class DEAR0342 extends QCCatalogue {
             }
         }
     }
+
     private String getKeyByHospitalId() {
-        switch (Content.hospital_Id)
-        {
+        switch (Content.hospital_Id) {
             case "1":               //长兴
             case "2":
             case "5":
             case "35":
+            case "11":
                 return "诊疗经过";
             default:
                 return "诊疗经过(重点记录病情演变、抢救经过)";

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/deathrecord/DEAR0344.java

@@ -24,7 +24,7 @@ public class DEAR0344 extends QCCatalogue {
             if (CatalogueUtil.isEmpty(diagnosisTreatmentProcess)) {
                 return;
             }
-            if (!diagnosisTreatmentProcess.contains("抢救")) {
+            if (!diagnosisTreatmentProcess.contains("抢救") && !diagnosisTreatmentProcess.contains("胸外按压") && !diagnosisTreatmentProcess.contains("心肺复苏")) {
                 status.set("-1");
             }
         }

+ 6 - 6
kernel/src/main/java/com/lantone/qc/kernel/catalogue/difficultcasediscuss/DIF0118.java

@@ -23,15 +23,15 @@ public class DIF0118 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
         List<DifficultCaseDiscussDoc> difficultCaseDiscussDocs = inputInfo.getDifficultCaseDiscussDocs();
-        if(ListUtil.isEmpty(difficultCaseDiscussDocs)){
+        if (ListUtil.isEmpty(difficultCaseDiscussDocs)) {
             return;
         }
-        if(difficultCaseDiscussDocs != null && difficultCaseDiscussDocs.size()>0){
-            for (DifficultCaseDiscussDoc dcdd:difficultCaseDiscussDocs) {
+        if (difficultCaseDiscussDocs != null && difficultCaseDiscussDocs.size() > 0) {
+            for (DifficultCaseDiscussDoc dcdd : difficultCaseDiscussDocs) {
                 Map<String, String> dcddStructureMap = dcdd.getStructureMap();
                 String key = getKeyByHospitalId();
                 String diisDate = dcddStructureMap.get(key);
-                if(CatalogueUtil.isEmpty(diisDate)){
+                if (CatalogueUtil.isEmpty(diisDate)) {
                     status.set("-1");
                     break;
                 }
@@ -40,10 +40,10 @@ public class DIF0118 extends QCCatalogue {
     }
 
     private String getKeyByHospitalId() {
-        switch (Content.hospital_Id)
-        {
+        switch (Content.hospital_Id) {
             case "1":               //长兴
             case "2":
+            case "11":
                 return "主持人";
             default:
                 return "主持人姓名及专业技术职务";

+ 3 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/difficultcasediscuss/DIF0119.java

@@ -38,10 +38,11 @@ public class DIF0119 extends QCCatalogue {
             }
         }
     }
+
     private String getKeyByHospitalId() {
-        switch (Content.hospital_Id)
-        {
+        switch (Content.hospital_Id) {
             case "5":
+            case "11":
                 return "参加人员的姓名及专业技术职务";
             case "20":
                 return "参加人员的姓名及专业技术职务";

+ 2 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0162.java

@@ -19,14 +19,14 @@ import java.util.Map;
  */
 @Component
 public class FIRP0162 extends QCCatalogue {
-    private List<String> containList = Arrays.asList("-", "—", "拒", "无", "不详", "未上户口","提供");
+    private List<String> containList = Arrays.asList("-", "—", "拒", "无", "不详", "未上户口", "提供");
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
             String nationality = firstpageStructureMap.get(Content.nationality);
-            if(StringUtil.isNotBlank(nationality) && !"中国".equals(nationality)){
+            if (StringUtil.isNotBlank(nationality) && !"中国".equals(nationality)) {
                 return;
             }
             String idNumber = firstpageStructureMap.get(Content.idNumber);

+ 68 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/xszyy/firstpagerecord/FIRP0190.java

@@ -0,0 +1,68 @@
+package com.lantone.qc.kernel.catalogue.hospital.xszyy.firstpagerecord;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.util.CatalogueUtil;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.ClinicalBloodDoc;
+import com.lantone.qc.pub.util.StringUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : FIRP0190
+ * @Description :Rh填写错误
+ * @Author : 胡敬
+ * @Date: 2020-03-18 13:35
+ */
+@Component
+public class FIRP0190 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        if (inputInfo.getFirstPageRecordDoc() == null || inputInfo.getFirstPageRecordDoc().getStructureMap() == null
+                || inputInfo.getClinicalBloodDocs().size() == 0) {
+            return;
+        }
+        Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
+        List<ClinicalBloodDoc> clinicalBloodDocList = inputInfo.getClinicalBloodDocs();
+        String rhFactor = firstpageStructureMap.get(Content.rhFactor);
+        if (CatalogueUtil.isEmpty(rhFactor)) {
+            return;
+        }
+        int matchSum = 0, noRhSum = 0;
+        for (ClinicalBloodDoc clinicalBloodDoc : clinicalBloodDocList) {
+            String bloodType = clinicalBloodDoc.getText();
+            if (StringUtil.isBlank(bloodType)) {
+                // 台州无“输注种类、血型、数量”,匹配“Rh血型”
+                bloodType = clinicalBloodDoc.getStructureMap().get("Rh血型");
+            }
+            if (StringUtils.isEmpty(bloodType)) {
+                continue;
+            }
+            if (!bloodType.contains("阴") && !bloodType.contains("阳")) {
+                noRhSum++;
+            }
+            if (bloodType.contains("白蛋白") || bloodType.contains("凝血酶原复合物")) {
+                continue;
+            }
+            bloodType = bloodType.toUpperCase();
+            String rh = Content.rhFactor.toUpperCase();
+            if (bloodType.contains(rh) ||
+                    bloodType.contains(CatalogueUtil.removeSpecialChar(rhFactor))) {
+                matchSum++;
+                return;
+            }
+        }
+        /* 如果所有输血记录都没有rh记录(阴、阳),则不报错 */
+        if (noRhSum == clinicalBloodDocList.size()) {
+            return;
+        }
+        if (matchSum == 0) {
+            status.set("-1");
+        }
+    }
+}

+ 45 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/xszyy/firstpagerecord/FIRP0220.java

@@ -0,0 +1,45 @@
+package com.lantone.qc.kernel.catalogue.hospital.xszyy.firstpagerecord;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * @ClassName : FIRP0220
+ * @Description : 入院时间与入院记录时间不一致
+ * @Author : 胡敬
+ * @Date: 2020-03-14 17:10
+ */
+@Component
+public class FIRP0220 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        if (inputInfo.getFirstPageRecordDoc() == null || inputInfo.getBeHospitalizedDoc() == null) {
+            status.set("0");
+            return;
+        }
+        Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
+        Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
+        String firstAdmissionDate = firstpageStructureMap.get(Content.admisTime);
+        String admissionDate = beHospitalStructureMap.get(Content.admisDate);
+        if (StringUtil.isEmpty(firstAdmissionDate) || StringUtil.isEmpty(admissionDate)) {
+            status.set("0");
+            return;
+        }
+        String[] dateFormats = new String[]{"yyyy年MM月dd日HH时mm分ss", "yyyy年MM月dd日HH时mm分","yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm"};
+        Date firstDate = StringUtil.parseDateTime(firstAdmissionDate);
+        Date admisDate = StringUtil.parseDateTime(admissionDate, dateFormats);
+        if (firstDate != null && admisDate != null) {
+            if (firstDate.getYear() == admisDate.getYear() &&
+                    firstDate.getMonth() == admisDate.getMonth() &&
+                    firstDate.getDay() == admisDate.getDay()) {
+                status.set("0");
+            }
+        }
+    }
+}

+ 74 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/xszyy/operationdiscussion/OPE03142.java

@@ -0,0 +1,74 @@
+package com.lantone.qc.kernel.catalogue.hospital.xszyy.operationdiscussion;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.operation.OperationDoc;
+import com.lantone.qc.pub.model.doc.operation.OperationRecordDoc;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 手术记录出血情况未填写
+ * @author: kwz
+ * @time: 2020/06/29 11:22
+ */
+@Component
+public class OPE03142 extends QCCatalogue {
+    /**
+     * 1.手术记录中包含文本形式【失血/出血】
+     * 或2.标题形式包含【失血/出血】判断是否为空
+     *
+     * @param inputInfo
+     * @param outputInfo
+     */
+
+    @Override
+    protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        int operationNum = 0;
+        int bleedingNum = 0;
+        //先判断有无手术记录
+        List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
+        if (operationDocs != null && operationDocs.size() > 0) {
+            ss:
+            for (OperationDoc operationDoc : operationDocs) {
+                if (operationDoc == null) {
+                    continue;
+                }
+                OperationRecordDoc operationRecordDoc = operationDoc.getOperationRecordDoc();
+                if (operationRecordDoc != null) {
+                    operationNum++;
+                    Map<String, String> structureMap = operationRecordDoc.getStructureMap();
+                    if (structureMap == null) {
+                        continue;
+                    }
+                    String lossOfBlood = structureMap.get("失血");
+                    String bleeding = structureMap.get("出血");
+                    if (StringUtil.isNotBlank(lossOfBlood) || StringUtil.isNotBlank(bleeding)) {
+                        bleedingNum++;
+                        break ss;
+                    }
+                    String afterOperation = structureMap.get("手术经过及处理");
+                    List<String> bleedingRecordList = Content.bleedingRecordList;
+                    if (StringUtil.isNotBlank(afterOperation)) {
+                        for (String bleedingRecord : bleedingRecordList) {
+                            if (afterOperation.contains(bleedingRecord)) {
+                                bleedingNum++;
+                                break ss;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        if (operationNum != bleedingNum) {
+            status.set("-1");
+            return;
+        }
+    }
+}

+ 64 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/xszyy/operationdiscussion/OPE03143.java

@@ -0,0 +1,64 @@
+package com.lantone.qc.kernel.catalogue.hospital.xszyy.operationdiscussion;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.operation.OperationDoc;
+import com.lantone.qc.pub.model.doc.operation.OperationRecordDoc;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 手术记录输血情况未填写
+ * @author: kwz
+ * @time: 2020/06/29 11:22
+ */
+@Component
+public class OPE03143 extends QCCatalogue {
+    /**
+     * 标题形式包含【输血】判断是否为空
+     *
+     * @param inputInfo
+     * @param outputInfo
+     */
+    @Override
+    protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        boolean flag = true;
+        //先判断有无手术记录
+        List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
+        if (operationDocs != null && operationDocs.size() > 0) {
+            for (OperationDoc operationDoc : operationDocs) {
+                if (operationDoc == null) {
+                    continue;
+                }
+                OperationRecordDoc operationRecordDoc = operationDoc.getOperationRecordDoc();
+                if (operationRecordDoc != null) {
+                    Map<String, String> structureMap = operationRecordDoc.getStructureMap();
+                    if (structureMap == null) {
+                        continue;
+                    }
+                    String bloodTransfusion = structureMap.get("输血情况");
+                    if (StringUtil.isNotBlank(bloodTransfusion)) {
+                        flag = false;
+                    }
+
+                    String afterOperation = structureMap.get("手术经过及处理");
+                    if (StringUtil.isNotBlank(afterOperation)) {
+                        if (afterOperation.contains("输血")) {
+                            flag = false;
+                        }
+                    }
+                }
+            }
+        }
+
+        if (flag) {
+            status.set("-1");
+            return;
+        }
+    }
+}

+ 36 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/xszyy/threelevelward/THR0685.java

@@ -0,0 +1,36 @@
+package com.lantone.qc.kernel.catalogue.hospital.xszyy.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.util.CatalogueUtil;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.RescueDoc;
+import com.lantone.qc.pub.util.ListUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : THR0685
+ * @Description : 抢救记录未记录参加抢救医务人员姓名及职称
+ * @Author : 胡敬
+ * @Date: 2020-03-30 13:15
+ */
+@Component
+public class THR0685 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        List<RescueDoc> rescueDocs = inputInfo.getRescueDocs();
+        if (ListUtil.isEmpty(rescueDocs)) {
+            return;
+        }
+        for (RescueDoc rescueDoc : rescueDocs) {
+            Map<String, String> rescueStructureMap = rescueDoc.getStructureMap();
+            if (CatalogueUtil.isEmpty(rescueStructureMap.get("参加抢救的医务人员姓名及专业技术职称"))) {
+                status.set("-1");
+                return;
+            }
+        }
+    }
+}

+ 22 - 9
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE03143.java

@@ -22,32 +22,45 @@ import java.util.Map;
 public class OPE03143 extends QCCatalogue {
     /**
      * 标题形式包含【输血】判断是否为空
+     *
      * @param inputInfo
      * @param outputInfo
      */
     @Override
-    protected void start(InputInfo inputInfo, OutputInfo outputInfo){
+    protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        boolean flag = true;
         //先判断有无手术记录
         List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
-        if(operationDocs != null && operationDocs.size()>0){
-           for (OperationDoc operationDoc : operationDocs) {
-                if(operationDoc==null){
+        if (operationDocs != null && operationDocs.size() > 0) {
+            for (OperationDoc operationDoc : operationDocs) {
+                if (operationDoc == null) {
                     continue;
                 }
                 OperationRecordDoc operationRecordDoc = operationDoc.getOperationRecordDoc();
-                if(operationRecordDoc!=null){
+                if (operationRecordDoc != null) {
                     Map<String, String> structureMap = operationRecordDoc.getStructureMap();
-                    if(structureMap==null){
+                    if (structureMap == null) {
                         continue;
                     }
                     String bloodTransfusion = structureMap.get("输血情况");
-                    if(StringUtil.isBlank(bloodTransfusion)){
-                        status.set("-1");
-                        return;
+                    if (StringUtil.isNotBlank(bloodTransfusion)) {
+                        flag = false;
+                    }
+
+                    String afterOperation = structureMap.get("手术经过");
+                    if (StringUtil.isNotBlank(afterOperation)) {
+                        if (afterOperation.contains("输血")) {
+                            flag = false;
+                        }
                     }
                 }
             }
         }
+
+        if (flag) {
+            status.set("-1");
+            return;
+        }
     }
 }

+ 3 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/preoperativediscussion/PRE0329.java

@@ -24,7 +24,7 @@ public class PRE0329 extends QCCatalogue {
         status.set("0");
         boolean isOperativePatient = true;//是手术患者(暂时默认是)
         List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
-        if(operationDocs == null || operationDocs.size()== 0){
+        if (operationDocs == null || operationDocs.size() == 0) {
             return;
         }
         String key = getKeyByHospitalId();
@@ -37,9 +37,9 @@ public class PRE0329 extends QCCatalogue {
     }
 
     private String getKeyByHospitalId() {
-        switch (Content.hospital_Id)
-        {
+        switch (Content.hospital_Id) {
             case "2":
+            case "11":
                 return "手术指征";
             default:
                 return "手术指征与禁忌";

+ 1 - 1
kernel/src/main/resources/bootstrap.yml

@@ -21,7 +21,7 @@ spring:
     active: dev
 
 qc:
-  hospital_id: 1,2,3,4,5,6,7,8,10,11,13,15,20,21,22,23,24,34,35,36
+  hospital_id: 1,2,3,4,5,6,7,8,10,11,13,15,20,34,35,36
 
 logging:          # 日志
   config: classpath:logback-spring.xml

+ 1 - 1
trans/src/main/java/com/lantone/qc/trans/shaoyf/ShaoyfThreeLevelWardDocTrans.java

@@ -54,7 +54,7 @@ public class ShaoyfThreeLevelWardDocTrans extends ModelDocTrans {
     }
 
     private void classifyThreeLevelWardDoc(ThreeLevelWardDoc result, Map<String, Object> contentMap) {
-        String content = contentMap.get("xmlText").toString();
+        String content = contentMap.get("xmlText").toString().replace("&amp;amp;nbsp;", "");
         Map<String, String> sourceMap = ShaoyfXmlUtil.getXmlToMap(content);
         sourceMap.put("mode_id=" + contentMap.get("modeId").toString(), "");
         String recTitle = contentMap.get("recTitle").toString();

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

@@ -62,12 +62,20 @@ public class BeiLunBeHospitalizedDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "联系人(关系)=联系人",
-            "入院时间=入院日期",
-            "医生签名=记录医生",
-            "医生签名时间=记录时间",
-            "疼痛评估=疼痛",
-            "代诉=主诉"
+            "姓 名=姓名",
+            "职 业=职业",
+            "性 别=性别",
+            "年 龄=年龄",
+            "婚 姻=婚姻",
+            "出生地=籍贯",
+            "专项 评估=专项评估",
+            "主 诉=主诉",
+            "体 格 检 查=体格检查",
+            "体 格 检 查 表 ( 一 )=体格检查",
+            "补充及专科检查=专科检查",
+            "辅 助 检 查=辅助检查",
+            "入 院 诊 断=入院诊断",
+            "初步诊断=入院诊断"
     );
 
 }

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

@@ -68,9 +68,9 @@ public class BeiLunClinicalBloodDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "输注成分=输注种类、血型、数量",
-            "输血过程=输注过程",
-            "病情记录=病历内容"
+            "病历标题=标题",
+            "病情记录=病历内容",
+            "书写医师=记录医生"
     );
 
 }

+ 2 - 5
trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunConsultationDocTrans.java

@@ -116,11 +116,8 @@ public class BeiLunConsultationDocTrans extends ModelDocTrans {
     }
 
     private List<String> consultationRecord_keyContrasts = Lists.newArrayList(
-            "执行情况=会诊情况",
-            "记录日期=会诊申请日期",
-            "签名++++=签名",
-            "病情记录=简要病情",
-            "医师签名=签名"
+            "会诊的目的=会诊目的",
+            "申请会诊医师签名=申请医生"
     );
 
 

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

@@ -66,7 +66,8 @@ public class BeiLunCrisisValueReportDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "病情记录=病情分析及处理"
+            "病情记录=病历内容",
+            "书写医师=记录医生"
     );
 
 }

+ 4 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunCriticallyIllNoticeDocTrans.java

@@ -68,8 +68,10 @@ public class BeiLunCriticallyIllNoticeDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "临床诊断=当前诊断",
-            "患方签名=患者签名"
+            "尊敬的患者家属或患者的法定监护人、授权委托人=尊敬的患者家属或患者的法定监护人授权委托人",
+            "虽经医护人员积极救治,但目前患者病情危重,并且病情有可能进一步恶化,随时会出现以下一种或多种危及患者生命的并发症=并发症",
+            "患者监护人或授权家属签名=患方签名",
+            "经治医师签名=告知医师签名"
     );
 
 }

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

@@ -54,11 +54,11 @@ public class BeiLunDeathCaseDiscussDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "医生签名时间=记录时间",
+            "讨论日期=讨论时间",
+            "参加人员姓名及专业技术职称=参加人员",
+            "讨论意见=病史简介",
             "主持人小结意见=主持人小结",
-            "具体讨论意见=讨论内容",
-            "记录者签名=记录医生",
-            "主持人(签名)=主持人签名"
+            "记录者签名=记录医生"
     );
 
 }

+ 3 - 1
trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunDeathRecordDocTrans.java

@@ -56,7 +56,9 @@ public class BeiLunDeathRecordDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "签名时间=记录时间"
+            "入院时基本情况=入院情况",
+            "诊治经过=诊疗经过",
+            "医生签名=记录医生"
     );
 
 }

+ 6 - 3
trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunDifficultCaseDiscussDocTrans.java

@@ -82,9 +82,12 @@ public class BeiLunDifficultCaseDiscussDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "主持人=主持人姓名及专业技术职务",
-            "参加人员=参加人员的姓名及专业技术职务",
-            "主持人小结意见/讨论结论=主持人小结"
+            "主 持 人=主持人",
+            "参加人员姓名及专业技术职称=参加人员的姓名及专业技术职务",
+            "报告病史=汇报病史",
+            "讨论意见内容记录=具体讨论意见",
+            "主持人小结意见=主持人小结",
+            "记录者签名=记录医生"
     );
 
 }

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

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

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

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

+ 20 - 33
trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunOperationDocTrans.java

@@ -13,6 +13,7 @@ import com.lantone.qc.trans.xszyy.util.*;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
 import com.lantone.qc.trans.comsis.ModelDocGenerate;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
+import com.lantone.qc.trans.xszyy.util.XszyyHtmlAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.MapUtils;
 import org.jsoup.Jsoup;
@@ -119,7 +120,7 @@ public class BeiLunOperationDocTrans extends ModelDocTrans {
             }
             if (MapUtils.isNotEmpty(structureMap)) {
                 operationDiscussionDoc = ModelDocGenerate.operationDiscussionDocGen(structureMap);
-                String text = BeiLunHtmlAnalysisUtil.blockDivToStr(Jsoup.parse(content).selectFirst("body").child(0), true);
+                String text = XszyyHtmlAnalysisUtil.blockDivToStr(Jsoup.parse(content).selectFirst("body").child(0), true);
                 operationDiscussionDoc.setText(text);
                 operationDiscussionDoc.setPageData((Map) structureMap);
                 return operationDiscussionDoc;
@@ -130,13 +131,10 @@ public class BeiLunOperationDocTrans extends ModelDocTrans {
     }
 
     private List<String> operationDiscussion_keyContrasts = Lists.newArrayList(
-            "手术简要经过(包括手术方式、术中所见、过程是否顺利、有无并发症等)=手术简要经过",
+            "主刀医师=记录医生",
+            "医师签名=记录医生",
             "病情记录=手术简要经过",
-            "术后诊断=术中后诊断",
-            "患者手术后情况=患者术后情况",
-            "术后应当特别注意观察的事项:=术后注意事项",
-            "术后治疗计划(包括术后应当特别注意观察的事项)=术后注意事项",
-            "医师签名=医生签名"
+            "病历标题=标题"
     );
 
 
@@ -207,13 +205,13 @@ public class BeiLunOperationDocTrans extends ModelDocTrans {
     }
 
     private List<String> operationRecord_keyContrasts = Lists.newArrayList(
-            "手术经过=手术经过及处理",
             "术后诊断=术中后诊断",
-            "主刀=主刀医师",
-            "记录者=记录医生",
-            "患者手术后情况=患者术后情况",
-            "麻醉方法=麻醉方式",
-            "时间=记录时间"
+            "麻醉人员=麻醉医师",
+            "手术经过=手术经过及处理",
+            "主刀医师签名=主刀医师",
+            "记录医师签名=记录医生",
+            "记录医师=记录医生",
+            "手术时间=手术日期"
     );
 
 
@@ -301,26 +299,15 @@ public class BeiLunOperationDocTrans extends ModelDocTrans {
     }
 
     private List<String> preoperativeDiscussion_keyContrasts = Lists.newArrayList(
-            "1.术前诊断=术前诊断",
-            "2.手术指征与禁忌征=手术指征与禁忌",
-            "3.可替代方案=可替代的方案",
-            "4.拟施手术方式(名称)及可能的变更方案=拟施手术方式、名称及可能的变更与禁忌症",
-            "5.计划性多次手术=计划性多次手术",
-            "6.拟施麻醉方式=拟施麻醉方式",
-            "5.拟施麻醉方式=拟施麻醉方式",
-            "5.本次手术是否属于计划性多次手术=计划性多次手术",
-            "6.术前特殊准备=术前准备",
-            "7.术前特殊准备=术前准备",
-            "7.主要术中、术后风险及防范措施=风险及防范措施",
-            "8.主要术中、术后风险及防范措施=风险及防范措施",
-            "9.术中、术后注意事项(含护理事项)=术中术后注意事项",
-            "8.术中、术后注意事项(含护理事项)=术中术后注意事项",
-            //"术中、术后注意事项(含护理事项)=术后注意事项",
-            //"拟施手术方式(名称)及可能的变更方案=拟施手术方式、名称及可能的变更与禁忌症",
-            //"术前特殊准备=术前准备",
-            //"手术指征与禁忌征=手术指征与禁忌",
-            "经治医生签字时间=记录时间",
-            "签字时间=记录时间"
+            "书写医师=记录医生",
+            "讨论日期=讨论时间",
+            "主 持 人=主持人",
+            "参加人员姓名及专业技术职称=参加人员",
+            "报告病史=简要病情",
+            "讨论意见内容记录=具体讨论意见",
+            "记录者签名=记录医生",
+            "记录者签名=记录医生"
+
     );
 
     /**********************************************手术知情同意书****************************************************/

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

@@ -66,8 +66,8 @@ public class BeiLunRescueDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "病历标题=标题",
-            "病情记录=抢救内容"
+            "病情变化情况及抢救过程=抢救内容",
+            "书写医师=记录医生"
     );
 
 }

+ 3 - 2
trans/src/main/java/com/lantone/qc/trans/xszyy/BeiLunStagesSummaryDocTrans.java

@@ -66,8 +66,9 @@ public class BeiLunStagesSummaryDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "病历标题=标题",
-            "病情记录=病历内容"
+            "主 诉=主诉",
+            "下一步诊疗计划=诊疗计划",
+            "书写医师=记录医生"
     );
 
 }

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

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

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

@@ -296,10 +296,10 @@ public class BeiLunTransferRecordDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "医师签名=记录医生",
-            "病历标题=标题",
-            "病情记录=病历内容",
-            "签名时间=记录时间"
+            "主 诉=主诉",
+            "目前情况=目前病情",
+            "转入诊疗计划=诊疗计划",
+            "书写医师=记录医生"
     );
 
 }

+ 93 - 107
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunBeHospitalizedHtmlAnalysis.java

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

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

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

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

@@ -2,9 +2,12 @@ package com.lantone.qc.trans.xszyy.util;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 
 import java.util.List;
@@ -23,50 +26,31 @@ public class BeiLunClinicalBloodHtmlAnalysis implements BeiLunHtmlAnalysis {
 
     @Override
     public Map<String, String> analysis(String... args) {
-        List<String> titles = Lists.newArrayList("输血前症状", "输血前实验室指标", "输血目的", "输注成分", "输血时间",
-                "开始时间", "结束时间", "输血过程");
         Map<String, String> map = Maps.newLinkedHashMap();
         try {
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];
-            Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
-            analysisGeneral(recTitle,bigDivElement, map);
-            if (map.containsKey("病情记录")) {
-                String content = map.get("病情记录");
-                CommonAnalysisUtil.cutByTitles(content, titles, 0, map);
+            Document doc = Jsoup.parse(html);
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+            if (StringUtil.isNotBlank(htmlContent)) {
+                XszyyCommonAnalysisUtil.xszyyCommonlyExtractWardInfo(recTitle, htmlContent, map);
+                //病情记录存在副主任医师和书写医师字段
+                if(map.containsKey("病情记录")){
+                    String bqtext = map.get("病情记录");
+
+                    //无冒号版本
+                    List<String> titles = Lists.newArrayList("书写医师"
+                    );
+                    XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,bqtext,map);
+                    map.put("病情记录",bqtext.substring(0,bqtext.lastIndexOf("书写医师")));
+                }
             }
-            if (titles.size() > 6) {
-                titles.remove(5);
-            }
-            titles.forEach(i -> {
-                        if (map.get(i).length() > 2) {
-                            map.put(i, map.get(i).substring(0, map.get(i).length() - 2));
-                        }
-                    }
-            );
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
         return map;
     }
-
-    private void analysisGeneral(String recTitle,Element bigDivElement, Map<String, String> map) {
-        if (bigDivElement.childNodeSize() == 1) {
-            bigDivElement = bigDivElement.child(0);
-        }
-        if (bigDivElement.selectFirst("hr") != null) {
-            bigDivElement.selectFirst("hr").previousElementSiblings().remove();
-        }
-        String text = BeiLunHtmlAnalysisUtil.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);
-    }
-
 }

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

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

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

@@ -2,9 +2,12 @@ package com.lantone.qc.trans.xszyy.util;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 
 import java.util.List;
@@ -27,30 +30,21 @@ public class BeiLunConsultationRecordHtmlAnalysis implements BeiLunHtmlAnalysis
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];
-            Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
-            analysisGeneral(recTitle,bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            Document doc = Jsoup.parse(html);
+            List<String> titles = Lists.newArrayList("姓名","科别","床号","住院号",
+                    "请求会诊日期","简要病情及诊疗经过","患者目前存在主要问题","会诊的目的","申请会诊医师签名","会 诊 记 录",
+                    "会诊时间","会诊情况及处理意见","会诊医师签名"
+            );
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+            if (StringUtil.isNotBlank(htmlContent)) {
+                //无冒号版本
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,map);
+            }
+
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
         return map;
     }
-
-    private void analysisGeneral(String recTitle,Element bigDivElement, Map<String, String> map) {
-        if (bigDivElement.childNodeSize() == 1) {
-            bigDivElement = bigDivElement.child(0);
-        }
-        if (bigDivElement.selectFirst("hr") != null) {
-            bigDivElement.selectFirst("hr").previousElementSiblings().remove();
-        }
-        String text = BeiLunHtmlAnalysisUtil.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);
-    }
-
 }

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

@@ -3,8 +3,10 @@ package com.lantone.qc.trans.xszyy.util;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 
 import java.util.List;
@@ -27,30 +29,24 @@ public class BeiLunCrisisValueReportHtmlAnalysis implements BeiLunHtmlAnalysis {
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];
-            Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
-            analysisGeneral(recTitle,bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            Document doc = Jsoup.parse(html);
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+            XszyyCommonAnalysisUtil.xszyyCommonlyExtractWardInfo(recTitle, htmlContent, map);
+            //病情记录存在副主任医师和书写医师字段
+            if(map.containsKey("病情记录")){
+                String bqtext = map.get("病情记录");
+                //无冒号版本
+                List<String> titles = Lists.newArrayList("书写医师"
+                );
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,bqtext,map);
+                map.put("病情记录",bqtext.substring(0,bqtext.lastIndexOf("书写医师")));
+            }
+
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
         return map;
     }
 
-    private void analysisGeneral(String recTitle,Element bigDivElement, Map<String, String> map) {
-        if (bigDivElement.childNodeSize() == 1) {
-            bigDivElement = bigDivElement.child(0);
-        }
-        if (bigDivElement.selectFirst("hr") != null) {
-            bigDivElement.selectFirst("hr").previousElementSiblings().remove();
-        }
-        String text = BeiLunHtmlAnalysisUtil.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);
-    }
-
 }

File diff suppressed because it is too large
+ 26 - 8
trans/src/main/java/com/lantone/qc/trans/xszyy/util/BeiLunCriticallyIllNoticeHtmlAnalysis.java


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

@@ -2,7 +2,9 @@ package com.lantone.qc.trans.xszyy.util;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
@@ -28,19 +30,31 @@ public class BeiLunDeathCaseDiscussHtmlAnalysis implements BeiLunHtmlAnalysis {
             String html = args[0];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
-            Element bigDivElement = doc.selectFirst("body").child(0);
-
-            bigDivElement.child(0).lastElementSibling().remove();
-            map.put("医生签名时间", BeiLunHtmlAnalysisUtil.elementLayer1ToStr(bigDivElement.child(0).lastElementSibling(), false));
-            bigDivElement.child(0).lastElementSibling().remove();
-
-            String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, false);
-            List<String> titles = Lists.newArrayList("姓名", "性别", "出生日期", "科别", "病区", "床号", "住院号",
-                    "入院诊断", "死亡诊断", "尸检结果", "讨论时间", "讨论地点",
-                    "主 持 人", "参加人员", "具体讨论意见", "主持人小结意见", "主持人(签名)", "记录者签名");
-            CommonAnalysisUtil.cutByTitlesNoColon(text, titles, 0, map);
-            BeiLunHtmlAnalysisUtil.mapValueRemoveStartColon(map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            List<String> titles = Lists.newArrayList("姓名","病区","床号","住院号",
+                    "讨论日期","讨论地点","主持人","参加人员姓名及专业技术职称",
+                    "讨论意见","死亡原因","死亡诊断",
+                    "主持人小结意见","记录者签名"
+            );
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+
+            if (StringUtil.isNotBlank(htmlContent)) {
+                //无冒号版本
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,map);
+                //死亡诊断包含医师发言
+                if(map.containsKey("死亡诊断")&&map.get("死亡诊断").contains("主任医师")){
+                    String swzd = map.get("死亡诊断");
+                    map.put("死亡诊断",swzd.substring(0,swzd.indexOf("主任医师")));
+                    map.put("医师发言",swzd.substring(swzd.indexOf("主任医师")));
+                }
+                //住院号包含死亡病例讨论记录
+                if(map.containsKey("住院号")&&map.get("住院号").contains("死亡病例讨论记录")){
+                    String zyh = map.get("住院号");
+                    map.put("住院号",zyh.substring(0,zyh.indexOf("死亡病例讨论记录")));
+                }
+            }
+
+
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

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

@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
@@ -23,24 +24,26 @@ public class BeiLunDeathRecordHtmlAnalysis implements BeiLunHtmlAnalysis {
 
     @Override
     public Map<String, String> analysis(String... args) {
-        Map<String, String> structureMap = Maps.newLinkedHashMap();
+        Map<String, String> map = Maps.newLinkedHashMap();
         try {
-            List<String> titles = Lists.newArrayList("入院日期", "死亡时间", "入院情况", "入院诊断",
-                    "诊疗经过(重点记录病情演变、抢救经过)", "死亡原因", "死亡诊断", "医师签字", "记录时间");
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
-            String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
+            List<String> titles = Lists.newArrayList("姓名","病区","床号","住院号","死 亡 记 录",
+                    "入院日期","死亡日期","入院时基本情况","入院诊断","诊治经过","死亡原因","死亡诊断","医生签名"
+            );
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+
             if (StringUtil.isNotBlank(htmlContent)) {
-                htmlContent = htmlContent.replaceAll("[   ]", " ");
-                CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
+                //无冒号版本
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,map);
             }
-            CommonAnalysisUtil.extractDateByTitle(structureMap, "记录时间");
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
-        return structureMap;
+        return map;
     }
 }

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

@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
@@ -25,29 +26,19 @@ public class BeiLunDifficultCaseDiscussHtmlAnalysis implements BeiLunHtmlAnalysi
     public Map<String, String> analysis(String... args) {
         Map<String, String> structureMap = Maps.newLinkedHashMap();
         try {
-            List<String> titles = Lists.newArrayList("姓名", "性别", "出生日期", "科别", "病区", "床号",
-                    "住院号", "年龄", "床号", "住院号", "住址(单位)", "讨论日期", "讨论地点", "主持人", "参加人员", "具体讨论意见",
-                    "主持人小结意见", "主持人小结意见/讨论结论", "主持人签名", "记录医生签名");
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
-            String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
             if (StringUtil.isNotBlank(htmlContent)) {
-                htmlContent = htmlContent.replaceAll("[   ]", " ").replace("第一页","");
-                CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
+                //无冒号版本
+                List<String> titles = Lists.newArrayList("入院日期","讨论日期","讨论地点","主 持 人",
+                        "参加人员姓名及专业技术职称","报告病史","讨论意见内容记录","主持人小结意见","记录者签名","主持人签名"
+                );
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles, htmlContent, structureMap);
             }
-            CommonAnalysisUtil.extractDateByTitle(structureMap, "告知时间");
-            removeLast(structureMap);
-            if (structureMap.containsKey("住院号")) {
-                String date = CommonAnalysisUtil.extractDate(structureMap.get("住院号"));
-                if (StringUtil.isNotBlank(date)) {
-                    structureMap.put("时间", date);
-                    structureMap.put("住院号", structureMap.get("住院号").replace(date, "").replace("\n", ""));
-
-                }
-            }
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

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

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

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

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

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

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

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

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

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

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

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

@@ -2,9 +2,12 @@ package com.lantone.qc.trans.xszyy.util;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 
 import java.util.List;
@@ -27,10 +30,29 @@ public class BeiLunOperationHtmlAnalysis implements BeiLunHtmlAnalysis {
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];
-            Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
-            analysisGeneral(recTitle, bigDivElement, map);
-            CommonAnalysisUtil.makeEmpty(map, "医生签名");
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            Document doc = Jsoup.parse(html);
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+            if (StringUtil.isNotBlank(htmlContent)) {
+                XszyyCommonAnalysisUtil.xszyyCommonlyExtractWardInfo(recTitle, htmlContent, map);
+                //病情记录存在主刀医师和主刀医师字段
+                if(map.containsKey("病情记录")){
+                    String bqtext = map.get("病情记录");
+
+                    //无冒号版本
+                    List<String> titles = Lists.newArrayList("主刀医师","医师签名","书写医师"
+                    );
+                    XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,bqtext,map);
+                    if(map.containsKey("主刀医师")){
+                        map.put("病情记录",bqtext.substring(0,bqtext.lastIndexOf("主刀医师")));
+                    }
+                    if(map.containsKey("医师签名")){
+                        map.put("病情记录",bqtext.substring(0,bqtext.lastIndexOf("医师签名")));
+                    }
+
+                }
+            }
+
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
@@ -44,7 +66,7 @@ public class BeiLunOperationHtmlAnalysis implements BeiLunHtmlAnalysis {
         if (bigDivElement.selectFirst("hr") != null) {
             bigDivElement.selectFirst("hr").previousElementSiblings().remove();
         }
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
+        String text = XszyyHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
         CommonAnalysisUtil.extractWardInfo(recTitle, text, map);
         String bqjlText = "病情记录" + map.get("病情记录")
                 .replace("提醒:有创诊疗操作记录内容包括操作名称、时间、步骤、结果及患者的一般情况,记录操作过","")

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

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

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

@@ -4,8 +4,10 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 
 import java.util.List;
@@ -28,62 +30,32 @@ public class BeiLunOperationRecordHtmlAnalysis implements BeiLunHtmlAnalysis {
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];
-            Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
-            analysisGeneral(bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.mapValueRemoveStartColon(map);
-            String operatingCrew = null;
-            if (map.containsKey("手术人员")) {
-                operatingCrew = map.get("手术人员");
-            } else if (map.containsKey("手术者及助手名称")) {
-                operatingCrew = map.get("手术者及助手名称");
-            }
-            if (StringUtil.isNotBlank(operatingCrew)) {
-                CommonAnalysisUtil.cutByTitles(operatingCrew, Lists.newArrayList("主刀", "一助", "二助", "助手", "洗手护士"), 0, map);
-            }
-            if (map.containsKey("主刀")) {
-                map.put("主刀", map.get("主刀").replaceAll("[^\u4E00-\u9FA5]", ""));
-            }
-            if (map.containsKey("麻醉者")) {
-                String anesthetist = map.get("麻醉者").replace("麻醉医生:", "");
-                map.put("麻醉医师", anesthetist);
-                if (anesthetist.contains("1.")) {
-                    int index = anesthetist.indexOf("1.");
-                    map.put("麻醉医师", anesthetist.substring(0, index));
-                    map.put("手术经过", anesthetist.substring(index));
+            Document doc = Jsoup.parse(html);
+            List<String> titles = Lists.newArrayList("姓名","病区","床号","住院号","手 术 记 录 单",
+                    "手术日期","手术时间","开始时间","结束时间","术前诊断","手术名称","术后诊断","手术人员","麻醉方式","麻醉人员","手术经过",
+                    "记录医师签名","主刀医师签名","主刀医师","记录医师","科室意见","科主任"
+            );
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+
+            if (StringUtil.isNotBlank(htmlContent)) {
+                //无冒号版本
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,map);
+                //主刀医师签名存在记录时间
+                if(map.containsKey("主刀医师签名")&&XszyyCommonAnalysisUtil.extractDate(map.get("主刀医师签名"))!=null){
+                    map.put("记录时间",XszyyCommonAnalysisUtil.extractDate(map.get("主刀医师签名")));
+                    map.put("主刀医师签名",map.get("主刀医师签名").substring(0,map.get("主刀医师签名").indexOf(map.get("记录时间"))));
                 }
-            }
-            if (map.containsKey("手术日期")) {
-                String operatorDateStr = map.get("手术日期");
-                if (operatorDateStr.contains("--")) {
-                    String[] operatorDate = operatorDateStr.split("--");
-                    map.put("手术开始时间", operatorDate[0]);
-                    map.put("手术结束时间", operatorDate[1]);
+                //记录医师名存在记录时间
+                if(map.containsKey("记录医师")&&XszyyCommonAnalysisUtil.extractDate(map.get("记录医师"))!=null){
+                    map.put("记录时间",XszyyCommonAnalysisUtil.extractDate(map.get("记录医师")));
+                    map.put("记录医师",map.get("记录医师").substring(0,map.get("记录医师").indexOf(map.get("记录时间"))));
                 }
             }
-            CommonAnalysisUtil.makeEmpty(map, "医生签名");
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
         return map;
     }
-
-    private void analysisGeneral(Element bigDivElement, Map<String, String> map) {
-        /*if (bigDivElement.selectFirst("hr") != null) {
-            bigDivElement.selectFirst("hr").previousElementSiblings().remove();
-        }*/
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
-        text = text.replaceAll("第1页", "");
-        List<String> titles = Lists.newArrayList(
-                "姓名", "性别", "出生日期", "出生年月", "科别", "科室", "病区", "床号", "床位", "住院号",
-                "手术时间", "手术日期", "术前诊断", "手术指征", "手术人员", "麻醉方式", "麻醉人员", "麻 醉 者", "洗手护士", "本次手术是否属于非计划再次手术", "接生者",
-                "术前胎心", "手术名称", "术后诊断", "手术者及助手名称", "术中取病理标本", "麻醉方法", "诊断手术/操作简要经过(包括术中有无并发症及具体描述和处理)", "手术经过",
-                "医生签名", "记录时间", "时间", "手术/操作医生", "记录者", "术中输血", "术前宫颈准备日期", "药物名称及用法", "导管或其他", "插入深度",
-                "阴道填塞纱布条", "准备者", "取出日期", "手术方法", "术中特殊情况", "病理检查", "其他", "记录者", "手术者",
-                "检查子宫位置"
-        );
-        titles = CommonAnalysisUtil.sortTitles(titles, text);
-        CommonAnalysisUtil.cutByTitlesNoColon(text, titles, 0, map);
-    }
-
 }

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

@@ -4,8 +4,10 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 
 import java.util.List;
@@ -23,71 +25,34 @@ public class BeiLunPreoperativeHtmlAnalysis implements BeiLunHtmlAnalysis {
 
     @Override
     public Map<String, String> analysis(String... args) {
-        Map<String, String> map = Maps.newLinkedHashMap();
+        Map<String, String> structureMap = Maps.newLinkedHashMap();
         try {
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];
-            Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
-            analysisGeneral(bigDivElement, map);
-
-            BeiLunHtmlAnalysisUtil.mapValueRemoveStartColon(map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            Document doc = Jsoup.parse(html);
+            List<String> titles = Lists.newArrayList("简要病情","术前诊断","手术指征","拟施手术名称和方式","拟施麻醉方式",
+                    "注意事项","术者术前查房情况","书写医师",
+
+                    "入院日期","讨论日期","讨论地点","主 持 人","参加人员姓名及专业技术职称","报告病史", "讨论意见内容记录","主持人小结意见","记录者签名","记录者",
+                    "主持人签名"
+            );
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+
+            if (StringUtil.isNotBlank(htmlContent)) {
+                //无冒号版本
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,structureMap);
+                if(XszyyCommonAnalysisUtil.extractDate(htmlContent)!=null){
+                    structureMap.put("文书时间",XszyyCommonAnalysisUtil.extractDate(htmlContent));
+                }
+            }
+
+            structureMap.put("文书标题",recTitle);
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
-        return map;
-    }
-
-    private void analysisGeneral(Element bigDivElement, Map<String, String> map) {
-        /*if (bigDivElement.selectFirst("hr") != null) {
-            bigDivElement.selectFirst("hr").previousElementSiblings().remove();
-        }*/
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
-
-        int index1 = text.lastIndexOf("经治医生签名");
-        int index2 = text.lastIndexOf("主刀医生签名");
-        if (index1 != -1 && index2 != -1) {
-            text = text.substring(0, index1).replace("(如高血压病、冠心病、糖尿病、脑梗、心梗、心肺肝肾功能不全,口服抗凝药", "").replace("等)", "")
-                    .replace("(如腹腔镜可能改开腹等)", "").replace("(如腹腔镜可能改开腹", "").replace("皮瓣转移术可能的变更方案","")
-                    .replace("四级手术、疑难手术等必须填写以下“具体讨论意见”,作为科室三大讨论本留存资料", "")
-                    .replace("术后术后", "术后")
-                    + text.substring(index1, index2).replace("签字时间", "经治医生签字时间").replace("年月日时分", "")
-                    + text.substring(index2).replace("签字时间", "主刀医生签字时间").replace("年月日时分", "");
-        }
-        text = text.replace("术前讨论及术前小结", "").replace("讨论结论:", "").replace("年月日时\n" +
-                "分", "");
-        List<String> titles = Lists.newArrayList("姓名", "性别", "出生日期", "出生年月", "科别", "科室", "病区", "床号", "床位", "住院号",
-                "讨论时间", "讨论方式", "参加人员", "简要病情", "具体讨论意见",
-                "1.术前诊断", "2.手术指征与禁忌征", "3.可替代方案", "4.拟施手术方式(名称)及可能的变更方案", "5.计划性多次手术",
-                "5.本次手术是否属于计划性多次手术",
-                "5.拟施麻醉方式", "6.术前特殊准备", "7.主要术中、术后风险及防范措施", "8.术中、术后注意事项(含护理事项)",
-                "6.拟施麻醉方式", "7.术前特殊准备", "8.主要术中、术后风险及防范措施", "9.术中、术后注意事项(含护理事项)",
-                "术前诊断", "手术指征", "拟施手术名称及方式", "拟施麻醉方式", "其他术前相关情况", "注意事项",
-                "经治医生签名", "经治医生签字时间", "主刀医生签名", "医生签名", "主刀医生签字时间", "签字时间");
-        CommonAnalysisUtil.cutByTitles(text, titles, 0, map);
-        CommonAnalysisUtil.processType(map, "5.计划性多次手术");
-        CommonAnalysisUtil.processType(map, "5.本次手术是否属于计划性多次手术");
-        CommonAnalysisUtil.processType(map, "讨论方式");
-        CommonAnalysisUtil.makeEmpty(map, "主刀医生签名");
-        // 解决医生签名显示 年 月 日 时 分
-        signatureTime(map);
-    }
-
-    /**
-     * 解决医生签名时间显示 年 月 日 时 分
-     *
-     * @param map
-     */
-    private void signatureTime(Map<String, String> map) {
-        String goCureDoctor = map.get("经治医生签字时间");
-        String operateDoctor = map.get("主刀医生签字时间");
-        if (StringUtil.isNotBlank(goCureDoctor) && goCureDoctor.contains("年 月 日 时 分")) {
-            map.put("经治医生签字时间", goCureDoctor.replace("年 月 日 时 分", ""));
-        }
-        if (StringUtil.isNotBlank(operateDoctor) && operateDoctor.contains("年 月 日 时 分")) {
-            map.put("主刀医生签字时间", operateDoctor.replace("年 月 日 时 分", ""));
-        }
+        return structureMap;
     }
 
 }

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

@@ -2,9 +2,12 @@ package com.lantone.qc.trans.xszyy.util;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 
 import java.util.List;
@@ -27,30 +30,24 @@ public class BeiLunRescueHtmlAnalysis implements BeiLunHtmlAnalysis {
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];
-            Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
-            analysisGeneral(recTitle,bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            Document doc = Jsoup.parse(html);
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+            if (StringUtil.isNotBlank(htmlContent)) {
+                //无冒号版本
+                List<String> titles = Lists.newArrayList("患者姓名","性别","年龄","目前诊断",
+                        "参加抢救的医务人员姓名及专业技术职称","病情变化情况及抢救过程","书写医师"
+                );
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles, htmlContent, map);
+                if(XszyyCommonAnalysisUtil.extractDate(htmlContent)!=null){
+                    map.put("病历日期",XszyyCommonAnalysisUtil.extractDate(htmlContent));
+                }
+                map.put("标题",recTitle);
+            }
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
         return map;
     }
 
-    private void analysisGeneral(String recTitle,Element bigDivElement, Map<String, String> map) {
-        if (bigDivElement.childNodeSize() == 1) {
-            bigDivElement = bigDivElement.child(0);
-        }
-        if (bigDivElement.selectFirst("hr") != null) {
-            bigDivElement.selectFirst("hr").previousElementSiblings().remove();
-        }
-        String text = BeiLunHtmlAnalysisUtil.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);
-    }
-
 }

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

@@ -2,9 +2,12 @@ package com.lantone.qc.trans.xszyy.util;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 
 import java.util.List;
@@ -27,30 +30,21 @@ public class BeiLunStagesSummaryHtmlAnalysis implements BeiLunHtmlAnalysis {
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];
-            Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
-            analysisGeneral(recTitle, bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            Document doc = Jsoup.parse(html);
+            List<String> titles = Lists.newArrayList("患者姓名","性别","年龄","入院日期","小结日期","主 诉","入院情况",
+                    "入院诊断","诊疗经过","目前情况","目前诊断","下一步诊疗计划","书写医师"
+            );
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+            if (StringUtil.isNotBlank(htmlContent)) {
+                //无冒号版本
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,map);
+                map.put("标题",recTitle);
+            }
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
         return map;
     }
 
-    private void analysisGeneral(String recTitle, Element bigDivElement, Map<String, String> map) {
-        if (bigDivElement.childNodeSize() == 1) {
-            bigDivElement = bigDivElement.child(0);
-        }
-        if (bigDivElement.selectFirst("hr") != null) {
-            bigDivElement.selectFirst("hr").previousElementSiblings().remove();
-        }
-        String text = BeiLunHtmlAnalysisUtil.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);
-    }
-
 }

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

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

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

@@ -2,9 +2,12 @@ package com.lantone.qc.trans.xszyy.util;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 
 import java.util.List;
@@ -27,30 +30,22 @@ public class BeiLunTransferIntoHtmlAnalysis implements BeiLunHtmlAnalysis {
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];
-            Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
-            analysisGeneral(recTitle, bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            Document doc = Jsoup.parse(html);
+            List<String> titles = Lists.newArrayList("患者姓名","性别","年龄","入院日期","转入日期","转出科室","主 诉","入院情况",
+                    "入院诊断","诊疗经过","目前情况","目前诊断","转科目的","转入诊疗计划","书写医师"
+            );
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+            if (StringUtil.isNotBlank(htmlContent)) {
+                //无冒号版本
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,map);
+                map.put("标题",recTitle);
+            }
+
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
         return map;
     }
 
-    private void analysisGeneral(String recTitle, Element bigDivElement, Map<String, String> map) {
-        if (bigDivElement.childNodeSize() == 1) {
-            bigDivElement = bigDivElement.child(0);
-        }
-        if (bigDivElement.selectFirst("hr") != null) {
-            bigDivElement.selectFirst("hr").previousElementSiblings().remove();
-        }
-        String text = BeiLunHtmlAnalysisUtil.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);
-    }
-
 }

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

@@ -2,9 +2,12 @@ package com.lantone.qc.trans.xszyy.util;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 
 import java.util.List;
@@ -27,39 +30,22 @@ public class BeiLunTransferOutHtmlAnalysis implements BeiLunHtmlAnalysis {
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];
-            Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
-            analysisGeneral(recTitle, bigDivElement, map);
-            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
+            Document doc = Jsoup.parse(html);
+            List<String> titles = Lists.newArrayList("患者姓名","性别","年龄","入院日期","转出日期","转入科室","主 诉","入院情况",
+                    "入院诊断","诊疗经过","目前情况","目前诊断","转科目的及注意事项","书写医师"
+            );
+            String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
+            if (StringUtil.isNotBlank(htmlContent)) {
+                //无冒号版本
+                XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,map);
+                map.put("标题",recTitle);
+            }
+
+            XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
         return map;
     }
 
-    private void analysisGeneral(String recTitle, Element bigDivElement, Map<String, String> map) {
-        if (bigDivElement.childNodeSize() == 1) {
-            bigDivElement = bigDivElement.child(0);
-        }
-        if (bigDivElement.selectFirst("hr") != null) {
-            bigDivElement.selectFirst("hr").previousElementSiblings().remove();
-        }
-        String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
-        CommonAnalysisUtil.extractWardInfo(recTitle, text, map);
-        String bqjlText = "病情记录" + map.get("病情记录").replace("年   月   日   时   分 ","");
-        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);
-    }
 }

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

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

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

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