浏览代码

Merge remote-tracking branch 'origin/hb/beilun' into hb/beilun

攻心小虫 2 年之前
父节点
当前提交
bc19e291f3

+ 6 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0163.java

@@ -25,11 +25,16 @@ public class FIRP0163 extends QCCatalogue {
         }
         if (inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
-            String nationality = firstpageStructureMap.get(Content.nationality);
+            String nationality = firstpageStructureMap.get(Content.nationality);//国籍
             if (StringUtil.isNotBlank(nationality) && !"中国".equals(nationality)) {
                 status.set("0");
                 return;
             }
+            String age = firstpageStructureMap.get(Content.age);//年龄
+            if (StringUtil.isBlank(age) || age.contains("天") || age.contains("月")) {
+                status.set("0");
+                return;
+            }
             String idNumber = firstpageStructureMap.get(Content.idNumber);
             if (!CatalogueUtil.isEmpty(idNumber)) {
                 status.set("0");

+ 24 - 10
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0199.java

@@ -1,6 +1,7 @@
 package com.lantone.qc.kernel.catalogue.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;
@@ -8,6 +9,8 @@ import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * @ClassName : FIRP0199
@@ -21,17 +24,28 @@ public class FIRP0199 extends QCCatalogue {
         status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
-            /*
-            String infantAgeMonths = firstpageStructureMap.get(Content.newbornAgeMonths);
-            String infantAgeDays = firstpageStructureMap.get(Content.newbornAgeDays);
-            if (CatalogueUtil.isEmpty(infantAgeMonths) && CatalogueUtil.isEmpty(infantAgeDays)) {
-                return;
-            }
 
-             */
-            String newbornWeight = firstpageStructureMap.get(Content.newbornWeight);
-            if (StringUtil.isBlank(newbornWeight)) {
-                status.set("-1");
+            if (firstpageStructureMap.get(Content.age) == null || firstpageStructureMap.get(Content.age) == ""){
+                status.set("0");
+            }
+            if (firstpageStructureMap.get(Content.age) != null || firstpageStructureMap.get(Content.age) != ""){
+                String newbornAge = firstpageStructureMap.get(Content.age);
+                if (newbornAge.contains("周") || newbornAge.contains("天")){
+                    String regEx = "[^0-9]";
+                    Pattern pattern = Pattern.compile(regEx);
+                    Matcher matcher = pattern.matcher(newbornAge);
+                    int ageNum = Integer.valueOf(matcher.replaceAll("").trim());
+                    if (ageNum <= 28){
+                        String newbornAdmisWeight = firstpageStructureMap.get(Content.newbornWeight);
+                        if (CatalogueUtil.isEmpty(newbornAdmisWeight)){
+                            status.set("-1");
+                        }
+                    }else {
+                        status.set("0");
+                    }
+                }else {
+                    status.set("0");
+                }
             }
         }
     }

+ 19 - 6
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0200.java

@@ -8,6 +8,8 @@ import com.lantone.qc.pub.model.OutputInfo;
 import org.springframework.stereotype.Component;
 
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * @ClassName : FIRP0200
@@ -25,12 +27,23 @@ public class FIRP0200 extends QCCatalogue {
             if (CatalogueUtil.isEmpty(newbornWeightStr) || !CatalogueUtil.numbersOnly(newbornWeightStr)) {
                 return;
             }
-            double newbornWeight = Double.parseDouble(newbornWeightStr);
-            if (newbornWeight / 1000 >= 1) {
-                newbornWeight = newbornWeight / 1000;
-            }
-            if (newbornWeight <= 1 || newbornWeight >= 10) {
-                status.set("-1");
+            if (firstpageStructureMap.get(Content.age) != null || firstpageStructureMap.get(Content.age) != "") {
+                String newbornAge = firstpageStructureMap.get(Content.age);
+                if (newbornAge.contains("周") || newbornAge.contains("天")) {
+                    String regEx = "[^0-9]";
+                    Pattern pattern = Pattern.compile(regEx);
+                    Matcher matcher = pattern.matcher(newbornAge);
+                    int ageNum = Integer.valueOf(matcher.replaceAll("").trim());
+                    if (ageNum <= 28) {
+                        double newbornWeight = Double.parseDouble(newbornWeightStr);
+                        if (newbornWeight / 1000 >= 1) {
+                            newbornWeight = newbornWeight / 1000;
+                        }
+                        if (newbornWeight <= 1 || newbornWeight >= 10) {
+                            status.set("-1");
+                        }
+                    }
+                }
             }
         }
     }

+ 19 - 6
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0202.java

@@ -8,6 +8,8 @@ import com.lantone.qc.pub.model.OutputInfo;
 import org.springframework.stereotype.Component;
 
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * @ClassName : FIRP0202
@@ -25,12 +27,23 @@ public class FIRP0202 extends QCCatalogue {
             if (CatalogueUtil.isEmpty(newbornAdmisWeightStr) || !CatalogueUtil.numbersOnly(newbornAdmisWeightStr)) {
                 return;
             }
-            double newbornAdmisWeight = Double.parseDouble(newbornAdmisWeightStr);
-            if (newbornAdmisWeight / 1000 >= 1) {
-                newbornAdmisWeight = newbornAdmisWeight / 1000;
-            }
-            if (newbornAdmisWeight <= 1 || newbornAdmisWeight >= 10) {
-                status.set("-1");
+            if (firstpageStructureMap.get(Content.age) != null || firstpageStructureMap.get(Content.age) != "") {
+                String newbornAge = firstpageStructureMap.get(Content.age);
+                if (newbornAge.contains("周") || newbornAge.contains("天")) {
+                    String regEx = "[^0-9]";
+                    Pattern pattern = Pattern.compile(regEx);
+                    Matcher matcher = pattern.matcher(newbornAge);
+                    int ageNum = Integer.valueOf(matcher.replaceAll("").trim());
+                    if (ageNum <= 28) {
+                        double newbornAdmisWeight = Double.parseDouble(newbornAdmisWeightStr);
+                        if (newbornAdmisWeight / 1000 >= 1) {
+                            newbornAdmisWeight = newbornAdmisWeight / 1000;
+                        }
+                        if (newbornAdmisWeight <= 1 || newbornAdmisWeight >= 10) {
+                            status.set("-1");
+                        }
+                    }
+                }
             }
         }
     }

+ 128 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/wenfuyi/clinicalblood/CLI03063.java

@@ -0,0 +1,128 @@
+package com.lantone.qc.kernel.catalogue.hospital.wenfuyi.clinicalblood;
+
+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.ClinicBloodEffectDoc;
+import com.lantone.qc.pub.model.doc.ClinicalBloodDoc;
+import com.lantone.qc.pub.util.DateUtil;
+import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @ClassName : CLI0309
+ * @Description : 输血后效果评价未在输注结束后48小时内完成
+ * @Author : 王宇
+ * @Date: 2020-08-14 10:18
+ */
+@Component
+public class CLI03063 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        List<ClinicalBloodDoc> clinicalBloodDocs = inputInfo.getClinicalBloodDocs();//输血记录
+        List<ClinicBloodEffectDoc> clinicBloodEffectDocs = inputInfo.getClinicBloodEffectDocs();//输血效果评价
+        if (ListUtil.isEmpty(clinicalBloodDocs)) {
+            return;
+        }
+        Iterator<ClinicalBloodDoc> clinicalBloodDocIterator = clinicalBloodDocs.iterator();
+        Iterator<ClinicBloodEffectDoc> clinicBloodEffectDocIterator = clinicBloodEffectDocs.iterator();
+        String key = getKeyByHospitalId();
+        while (clinicalBloodDocIterator.hasNext()) {
+            if (!CatalogueUtil.compareTime(
+                    StringUtil.parseDateTime(clinicalBloodDocIterator.next().getStructureMap().get(key)),
+                    StringUtil.parseDateTime(DateUtil.nowString()),
+                    Long.valueOf(48 * 60))) {//如果接收未超过48小时,规则不判断
+                continue;
+            }
+        }
+        while (clinicBloodEffectDocIterator.hasNext()) {
+            if (!CatalogueUtil.compareTime(
+                    StringUtil.parseDateTime(clinicBloodEffectDocIterator.next().getStructureMap().get(key)),
+                    StringUtil.parseDateTime(DateUtil.nowString()),
+                    Long.valueOf(48 * 60))) {//如果接收未超过48小时,规则不判断
+                continue;
+            }
+        }
+        Collections.sort(clinicalBloodDocs, new Comparator<ClinicalBloodDoc>() {
+            public int compare(ClinicalBloodDoc o1, ClinicalBloodDoc o2) {
+                return o1.getStructureMap().get(key)
+                        .compareTo(o2.getStructureMap().get(key));
+            }
+        });
+        Collections.sort(clinicBloodEffectDocs, new Comparator<ClinicBloodEffectDoc>() {
+            public int compare(ClinicBloodEffectDoc o1, ClinicBloodEffectDoc o2) {
+                return o1.getStructureMap().get(key)
+                        .compareTo(o2.getStructureMap().get(key));
+            }
+        });
+        if (clinicalBloodDocs.size() > clinicBloodEffectDocs.size()) {
+            status.set("-1");
+            return;
+        }
+
+        for (int i = 0; i < clinicalBloodDocs.size(); i++) {
+            if (CatalogueUtil.compareTime(
+                    StringUtil.parseDateTime(clinicalBloodDocs.get(i).getStructureMap().get(key)),
+                    StringUtil.parseDateTime(clinicBloodEffectDocs.get(i).getStructureMap().get(key)),
+                    Long.valueOf(1))) {//结果单时间要比申请单大的
+                if (CatalogueUtil.compareTime(
+                        StringUtil.parseDateTime(clinicalBloodDocs.get(i).getStructureMap().get(key)),
+                        StringUtil.parseDateTime(clinicBloodEffectDocs.get(i).getStructureMap().get(key)),
+                        Long.valueOf(48 * 60))) {//未超过48小时
+                    status.set("-1");
+                    return;
+                }
+            }
+        }
+
+
+//        for (ClinicalBloodDoc clinicalBloodDoc : clinicalBloodDocs) {
+//            for (ClinicBloodEffectDoc clinicBloodEffectDoc : clinicBloodEffectDocs) {
+//                if (CatalogueUtil.compareTime(
+//                        StringUtil.parseDateTime(clinicalBloodDoc.getStructureMap().get(key)),
+//                        StringUtil.parseDateTime(clinicBloodEffectDoc.getStructureMap().get(key)),
+//                        Long.valueOf(1))) {//结果单时间要比申请单大的
+//                    if (CatalogueUtil.compareTime(
+//                            StringUtil.parseDateTime(clinicalBloodDoc.getStructureMap().get(key)),
+//                            StringUtil.parseDateTime(clinicBloodEffectDoc.getStructureMap().get(key)),
+//                            Long.valueOf(24 * 60))) {//未超过24小时
+//                        status.set("-1");
+//                        return;
+//                    }
+//                }
+//            }
+//        }
+        /*
+        if (clinicalBloodDocs != null && clinicalBloodDocs.size() > 0) {
+            for (ClinicBloodEffectDoc cliB : clinicBloodEffectDocs) {
+                Map<String, String> cliBStructureMap = cliB.getStructureMap();
+                if (StringUtils.isEmpty(cliBStructureMap.get("输注后效果评价"))) {
+                    status.set("-1");
+                    break;
+                }
+            }
+        }
+
+         */
+    }
+
+    private String getKeyByHospitalId() {
+        switch (Content.hospital_Id) {
+            case "7":               //厦门
+            case "20":
+            case "35":
+            case "13":
+                return "病历日期";
+            default:
+                return "记录时间";
+        }
+    }
+}

+ 0 - 39
kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/wenfuyi/operationdiscussion/OPE0348.java

@@ -1,39 +0,0 @@
-package com.lantone.qc.kernel.catalogue.hospital.wenfuyi.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.util.StringUtil;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-/**
- * @ClassName : OPE0348
- * @Description : 缺手术知情同意书
- * @Author : 贺聪聪
- * @Date: 2022-07-07 14:25
- */
-@Component
-public class OPE0348 extends QCCatalogue {
-    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        status.set("0");
-        //先判断有无手术记录
-        List<OperationDoc> operationDocs = inputInfo.getOperationDocs();//获取手术记录
-        long count_oper =0;
-        long count_info =0;
-        long count_title =0;
-        if(operationDocs != null && operationDocs.size()>0){
-            count_oper = operationDocs.stream().map(i -> i.getOperationRecordDoc()).filter(i -> i != null).count();
-
-            count_info = operationDocs.stream().map(i -> i.getOperationInformedConsentDoc()).filter(i -> i != null).count();
-
-            count_title = operationDocs.stream().map(i -> i.getPreoperativeDiscussionDoc()).filter(
-                    i -> i != null && StringUtil.isNotBlank(i.getStructureMap().get("标题")) && i.getStructureMap().get("标题").contains("手术知情同意书")).count();
-            if(count_oper>0 && (count_info ==0 || count_title == 0)){
-                status.set("-1");
-            }
-        }
-    }
-}

+ 13 - 12
kernel/src/main/java/com/lantone/qc/kernel/catalogue/operationdiscussion/OPE0650.java

@@ -1,15 +1,14 @@
 package com.lantone.qc.kernel.catalogue.operationdiscussion;
 
 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.operation.OperationDiscussionDoc;
 import com.lantone.qc.pub.model.doc.operation.OperationDoc;
+import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  * @ClassName : OPE0650
@@ -28,17 +27,19 @@ public class OPE0650 extends QCCatalogue {
             status.set("0");
             return;
         }
-        for (OperationDoc operationDoc : operationDocs) {
-            OperationDiscussionDoc operationDiscussionDoc = operationDoc.getOperationDiscussionDoc();
-            if (operationDiscussionDoc == null) {
-                continue;
-            }
-            Map<String, String> operationDiscussionStructureMap = operationDiscussionDoc.getStructureMap();
-            if (CatalogueUtil.isEmpty(operationDiscussionStructureMap.get("手术名称"))) {
+        if (ListUtil.isNotEmpty(operationDocs)) {
+            long count = operationDocs.stream().filter(operationDoc -> {
+                boolean flag = false;
+                if (operationDoc.getOperationDiscussionDoc() != null
+                        && StringUtil.isBlank(operationDoc.getOperationDiscussionDoc().getStructureMap().get("手术名称"))
+                        && StringUtil.isBlank(operationDoc.getOperationDiscussionDoc().getStructureMap().get("手术方式"))) {
+                    flag = true;
+                }
+                return flag;
+            }).count();
+            if (count > 0) {
                 status.set("-1");
-                return;
             }
         }
-//        }
     }
 }

+ 18 - 18
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/BeHospitalizedAI.java

@@ -82,23 +82,23 @@ public class BeHospitalizedAI extends ModelAI {
                 putContent(crfContent, medicalTextType.get(1), pastText, Content.past);
             }
             /* 月经史文本需从个人史截取一部分文本拼接 */
-            String concatMenstrual = "";
+//            String concatMenstrual = "";
             /* 个人史 */
-            if (beHospitalizedDoc.getPersonalLabel() != null && beHospitalizedDoc.getPersonalLabel().isCrfLabel()) {
-                String personalText = beHospitalizedDoc.getPersonalLabel().getText();
-                putContent(crfContent, medicalTextType.get(2), personalText, Content.personal);
-                concatMenstrual = getConcatMenstrual(concatMenstrual, personalText);
-            }
-            /* 婚育史 */
-            if (beHospitalizedDoc.getMaritalLabel() != null && beHospitalizedDoc.getMaritalLabel().isCrfLabel()) {
-                String maritalText = beHospitalizedDoc.getMaritalLabel().getText();
-                putContent(crfContent, medicalTextType.get(2), maritalText, Content.marriage);
-            }
+//            if (beHospitalizedDoc.getPersonalLabel() != null && beHospitalizedDoc.getPersonalLabel().isCrfLabel()) {
+//                String personalText = beHospitalizedDoc.getPersonalLabel().getText();
+//                putContent(crfContent, medicalTextType.get(2), personalText, Content.personal);
+////                concatMenstrual = getConcatMenstrual(concatMenstrual, personalText);
+//            }
+//            /* 婚育史 */
+//            if (beHospitalizedDoc.getMaritalLabel() != null && beHospitalizedDoc.getMaritalLabel().isCrfLabel()) {
+//                String maritalText = beHospitalizedDoc.getMaritalLabel().getText();
+//                putContent(crfContent, medicalTextType.get(2), maritalText, Content.marriage);
+//            }
             /* 月经史 */
-            if (beHospitalizedDoc.getMenstrualLabel() != null && beHospitalizedDoc.getMenstrualLabel().isCrfLabel()) {
-                String menstrualText = beHospitalizedDoc.getMenstrualLabel().getText();
-                putContent(crfContent, medicalTextType.get(2), concatMenstrual, menstrualText, Content.menses);
-            }
+//            if (beHospitalizedDoc.getMenstrualLabel() != null && beHospitalizedDoc.getMenstrualLabel().isCrfLabel()) {
+//                String menstrualText = beHospitalizedDoc.getMenstrualLabel().getText();
+//                putContent(crfContent, medicalTextType.get(2), concatMenstrual, menstrualText, Content.menses);
+//            }
             /* 家族史 */
             if (beHospitalizedDoc.getFamilyLabel() != null && beHospitalizedDoc.getFamilyLabel().isCrfLabel()) {
                 String familyText = beHospitalizedDoc.getFamilyLabel().getText();
@@ -165,9 +165,9 @@ public class BeHospitalizedAI extends ModelAI {
                 putPersonalCrfData(midData.getJSONObject(Content.personal), inputInfo);
             }
             /* 处理月经史 */
-            if (beHospitalizedDoc.getMenstrualLabel() != null && beHospitalizedDoc.getMenstrualLabel().isCrfLabel()) {
-                putMensesCrfData(midData.getJSONObject(Content.menses), inputInfo);
-            }
+//            if (beHospitalizedDoc.getMenstrualLabel() != null && beHospitalizedDoc.getMenstrualLabel().isCrfLabel()) {
+//                putMensesCrfData(midData.getJSONObject(Content.menses), inputInfo);
+//            }
             /* 处理家族史 */
             if (beHospitalizedDoc.getFamilyLabel() != null && beHospitalizedDoc.getFamilyLabel().isCrfLabel()) {
                 putFamilyCrfData(midData.getJSONObject(Content.family), inputInfo);

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

@@ -74,7 +74,7 @@ public class FirstCourseRecordDocTrans extends ModelDocTrans {
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "病历特点=病例特点",
+            "病例特点=病史特点",
             "入院查体=查体",
             "辅助检查=辅检"
     );

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

@@ -32,7 +32,7 @@ public class FirstCourseRecordHtmlAnalysis implements HtmlAnalysis {
             String recTitle = args[1];
             String recTypeId = args[2];
             Document doc = Jsoup.parse(html);
-            List<String> titles = Lists.newArrayList("记录时间","一般情况","一、病史特点", "二、初步诊断", "三、诊断依据", "四、鉴别诊断","五、治疗目标","六、诊疗计划","医生签名");
+            List<String> titles = Lists.newArrayList("记录时间","一般情况","一、病史特点","一、病例特点","二、初步诊断", "三、诊断依据", "四、鉴别诊断","五、治疗目标","六、诊疗计划","医生签名");
             String htmlContent = HtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
             if (StringUtil.isNotBlank(htmlContent)) {
                 CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);

+ 91 - 0
trans/src/main/java/com/lantone/qc/trans/wenfuyi/InformedConsentDocTrans.java

@@ -0,0 +1,91 @@
+package com.lantone.qc.trans.wenfuyi;
+
+import com.google.common.collect.Lists;
+import com.lantone.qc.pub.model.doc.InformedConsentDoc;
+import com.lantone.qc.pub.model.vo.MedrecVo;
+import com.lantone.qc.pub.util.FastJsonUtils;
+import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
+import com.lantone.qc.trans.ModelDocTrans;
+import com.lantone.qc.trans.beilun.util.BeiLunHtmlAnalysis;
+import com.lantone.qc.trans.beilun.util.BeiLunInformedHtmlAnalysis;
+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.wenfuyi.util.InformedHtmlAnalysis;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.MapUtils;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 知情同意书
+ * @author: cy
+ * @time: 2021/4/18 17:48
+ */
+@Slf4j
+public class InformedConsentDocTrans extends ModelDocTrans {
+    @Override
+    public List<InformedConsentDoc> extract(MedrecVo medrecVo) {
+        List<InformedConsentDoc> retList = Lists.newArrayList();
+        Map<String, List<String>> contentMap = (Map) medrecVo.getContent().get("content");
+        if (contentMap == null) {
+            return retList;
+        }
+        for (Map.Entry<String, List<String>> entry : contentMap.entrySet()) {
+            InformedConsentDoc informedConsentDoc = getInformedConsentDoc((List) entry.getValue());
+            retList.add(informedConsentDoc);
+        }
+        return retList;
+
+    }
+
+    private InformedConsentDoc getInformedConsentDoc(List<Map<String, Object>> contentMaps) {
+        InformedConsentDoc informedConsentDoc = new InformedConsentDoc();
+        if (ListUtil.isEmpty(contentMaps)) {
+            return informedConsentDoc;
+        }
+        for (Map<String, Object> contentMap : contentMaps) {
+            if (contentMap.get("htmlText") == null || StringUtil.isBlank(contentMap.get("htmlText").toString())) {
+                continue;
+            }
+            try {
+                String content = contentMap.get("htmlText").toString();
+                Map<String, String> structureMap = null;
+                if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
+                    structureMap = (Map) FastJsonUtils.getJsonToMap(content);
+                } else {
+                    String recTitle = contentMap.get("recTitle").toString();
+                    String recTypeId = contentMap.get("recTypeId").toString();
+                    InformedHtmlAnalysis htmlAnalysis = new InformedHtmlAnalysis();
+                    Map<String, String> sourceMap = htmlAnalysis.analysis(content, recTitle, recTypeId);
+                    if (MapUtils.isNotEmpty(sourceMap)) {
+                        structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
+                        structureMap.put("记录编号", contentMap.get("recId").toString());
+                        structureMap.put("标题", recTitle);
+                        structureMap.put("病历号", contentMap.get("behospitalCode") == null ? null : contentMap.get("behospitalCode").toString());
+                    }
+                }
+                if (MapUtils.isNotEmpty(structureMap)) {
+                    informedConsentDoc = ModelDocGenerate.informedConsentDocGen(structureMap);
+//                    informedConsentDoc.setText(CommonAnalysisUtil.html2String(content));
+                    informedConsentDoc.setPageData((Map) structureMap);
+                }
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+            }
+        }
+        return informedConsentDoc;
+    }
+
+
+    private List<String> keyContrasts = Lists.newArrayList(
+            "患者签名=患方签名",
+            "患方手写意见=患方签名",
+            "患方手写意见患方签名=患方签名",
+            "患方或受托代理人签名=患方或受托代理人签名",
+            "代理人签名=被授权人签名",
+            "被授权人签名=被授权人签名"
+    );
+}

+ 5 - 0
trans/src/main/java/com/lantone/qc/trans/wenfuyi/WenfuyiDocTrans.java

@@ -6,6 +6,7 @@ import com.lantone.qc.pub.model.vo.MedrecVo;
 import com.lantone.qc.pub.model.vo.QueryVo;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.trans.DocTrans;
+import com.lantone.qc.trans.beilun.BeilunInformedConsentDocTrans;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
 import lombok.extern.slf4j.Slf4j;
 
@@ -124,6 +125,10 @@ public class WenfuyiDocTrans extends DocTrans {
                     OutDepDocTrans outDepDocTrans = new OutDepDocTrans();
                     inputInfo.setBeHospitalizedDoc(outDepDocTrans.extract(i));
                 }
+                if (i.getTitle().equals("知情同意书")) {
+                    InformedConsentDocTrans informedConsentDocTrans = new InformedConsentDocTrans();
+                    inputInfo.setInformedConsentDoc(informedConsentDocTrans.extract(i));
+                }
                 /*******************************VTE评分 trans解析*****************************************/
                 if (i.getTitle().equals("VTE评分")) {
                     VTEGradeDocTrans vteGradeDocTrans = new VTEGradeDocTrans();

+ 130 - 0
trans/src/main/java/com/lantone/qc/trans/wenfuyi/util/InformedHtmlAnalysis.java

@@ -0,0 +1,130 @@
+package com.lantone.qc.trans.wenfuyi.util;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.lantone.qc.pub.util.MapUtil;
+import com.lantone.qc.pub.util.StringUtil;
+import com.lantone.qc.trans.beilun.util.BeiLunHtmlAnalysis;
+import com.lantone.qc.trans.beilun.util.BeiLunHtmlAnalysisUtil;
+import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.MapUtils;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 知情同意书html解析
+ * @author: HUJING
+ * @time: 2020/9/14 15:41
+ */
+@Slf4j
+public class InformedHtmlAnalysis implements BeiLunHtmlAnalysis {
+
+    private String modeId = "53";
+
+    @Override
+    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];
+            if (StringUtil.isNotBlank(html)) {
+                structureMap.put("html", html);
+            }
+            if (StringUtil.isNotBlank(recTitle)) {
+                structureMap.put("标题", recTitle);
+            }
+//            Document doc = Jsoup.parse(html);
+//            String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
+//            if (StringUtil.isNotBlank(recTitle) && recTitle.contains("知情选择授权书")) {
+//                structureMap.put("标题", recTitle);
+//                return structureMap;
+//            } else if ("自费服务项目、药品、材料使用知情同意书".equals(recTitle)) {
+//                if (html.contains("自费服务项目、药品、材料使用知情同意书") && html.split("自费服务项目、药品、材料使用知情同意书")[1].contains("<img")) {
+//                    structureMap.put("谈话医生", "<img");
+//                    return structureMap;
+//                }
+//            }
+//
+//            if (StringUtil.isNotBlank(htmlContent)) {
+//                htmlContent = htmlContent.replaceAll("[   ]", " ")
+//                        .replace("手印说明(\uF06F右食指 \uF06F左食指)", "")
+//                        .replace("手印说明:(\uF06F右食指 \uF06F左食指)其他手印备注", "")
+//                        .replace("第1页", "");
+//                CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
+//            }
+//            CommonAnalysisUtil.extractDateByTitle(structureMap, "记录时间");
+//            for (String ignoreContrast : ignoreContrasts) {
+//                if (structureMap.containsKey(ignoreContrast)) {
+//                    structureMap.remove(ignoreContrast);
+//                }
+//            }
+//
+//            resultHandle(structureMap);
+//            disDate(structureMap, "医师签名", "签名时间");
+            BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+        return structureMap;
+    }
+
+    private List<String> ignoreContrasts = Lists.newArrayList(
+            "其他",
+            "与患者关系",
+            "手印备注与患者关系",
+            "身份证号码",
+            "九、患者知情同意",
+            "患方意见"
+    );
+
+    private void resultHandle(Map<String, String> result) {
+        if (MapUtils.isEmpty(result)) {
+            return;
+        }
+        if (result.containsKey("代理人签名")) {
+            String signName = result.get("代理人签名");
+
+            if (signName.contains("手印备注")) {
+                signName = signName.split("手印备注")[0];
+                result.put("代理人签名", signName);
+            }
+        }
+        result.forEach((key, value) -> {
+            if (StringUtil.isNotBlank(value)) {
+                value = StringUtil.trim(value);
+                if (value.endsWith(";") || value.endsWith(";")) {
+                    value = value.substring(0, value.length() - 1);
+                }
+                result.put(key, value);
+            }
+        });
+    }
+
+    private void disDate(Map sourceMap, String... args) {
+        Map<String, String> sourceMap_ = MapUtil.copyMap(sourceMap);
+        if (sourceMap.containsKey(args[0]) && sourceMap_.get(args[0]).contains(args[1])) {
+            int index = sourceMap_.get(args[0]).indexOf(args[1]);
+            sourceMap.put(args[0], sourceMap_.get(args[0]).substring(0, index));
+            sourceMap.put(args[0] + args[1], sourceMap_.get(args[0]).substring(index).replace(args[1], "").replaceAll("[::]", ""));
+        }
+    }
+
+}