Browse Source

杭州七院:规则修改

wangsy 4 years ago
parent
commit
32adf24d7d

+ 37 - 23
kernel/src/main/java/com/lantone/qc/kernel/catalogue/clinicalblood/CLI0301.java

@@ -1,5 +1,6 @@
 
 package com.lantone.qc.kernel.catalogue.clinicalblood;
+
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
@@ -7,10 +8,10 @@ import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.ClinicalBloodDoc;
 import com.lantone.qc.pub.model.doc.InformedConsentDoc;
 import com.lantone.qc.pub.util.ListUtil;
-import org.apache.commons.lang3.StringUtils;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
+
 import java.util.List;
-import java.util.Map;
 import java.util.Objects;
 
 /**
@@ -24,34 +25,47 @@ public class CLI0301 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
         List<ClinicalBloodDoc> clinicalBloodDocs = inputInfo.getClinicalBloodDocs();
-        if(ListUtil.isEmpty(clinicalBloodDocs)){
+        if (ListUtil.isEmpty(clinicalBloodDocs)) {
             return;
         }
         long cou = inputInfo.getClinicalBloodDocs().stream().map(ClinicalBloodDoc::getStructureMap).filter(Objects::nonNull).count();
         long count = 0L;
-        InformedConsentDoc informedConsentDoc = inputInfo.getInformedConsentDoc();
-        if(informedConsentDoc != null){
-            int length = 1;
-            Map<String, String> structureMap = informedConsentDoc.getStructureMap();
-            for (String str : Content.BLOODRECORDLIST) {
-                if(structureMap.containsKey(str)){
-                    String recStr = structureMap.get(str);
-                    if(StringUtils.isNotEmpty(recStr)){
-                        if(recStr.contains("},")){
-                             length = recStr.split("},").length;
-                        }
-                        if(length==1){
-                            count++;
-                        }else{
-                            count = count + length;
-                        }
+        List<InformedConsentDoc> informedConsentDocList = inputInfo.getInformedConsentDoc();
 
+        count = informedConsentDocList.stream().filter(
+                informedConsentDoc -> {
+                    boolean flag = false;
+                    if (informedConsentDoc.getStructureMap() != null
+                            && StringUtil.isBlank(informedConsentDoc.getStructureMap().get("标题"))
+                            && Content.BLOODRECORDLIST.contains(informedConsentDoc.getStructureMap().get("标题"))) {
+                        flag = true;
                     }
-
+                    return flag;
                 }
-            }
-        }
-        if(count == 0L ||(cou != count && cou>count)){
+        ).count();
+
+//        if(informedConsentDoc != null){
+//            int length = 1;
+//            Map<String, String> structureMap = informedConsentDoc.getStructureMap();
+//            for (String str : Content.BLOODRECORDLIST) {
+//                if(structureMap.containsKey(str)){
+//                    String recStr = structureMap.get(str);
+//                    if(StringUtils.isNotEmpty(recStr)){
+//                        if(recStr.contains("},")){
+//                             length = recStr.split("},").length;
+//                        }
+//                        if(length==1){
+//                            count++;
+//                        }else{
+//                            count = count + length;
+//                        }
+//
+//                    }
+//
+//                }
+//            }
+//        }
+        if (count == 0L || (cou != count && cou > count)) {
             status.set("-1");
         }
     }

+ 8 - 6
kernel/src/main/java/com/lantone/qc/kernel/catalogue/medicalwriting/MEDI02889.java

@@ -6,10 +6,10 @@ import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.InformedConsentDoc;
 import org.springframework.stereotype.Component;
 
-import java.util.Map;
+import java.util.List;
 
 /**
- * @ClassName : NOT0719
+ * @ClassName : MEDI02889
  * @Description : 缺授权知情同意书
  * @Author : 胡敬
  * @Date: 2020-04-21 18:54
@@ -17,14 +17,16 @@ import java.util.Map;
 @Component
 public class MEDI02889 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        InformedConsentDoc informedConsentDoc = inputInfo.getInformedConsentDoc();
-        if (informedConsentDoc == null){
+        List<InformedConsentDoc> informedConsentDocList = inputInfo.getInformedConsentDoc();
+        if (informedConsentDocList.size() == 0) {
             status.set("0");
             return;
         }
-        Map<String, String> structureMap = informedConsentDoc.getStructureMap();
-        if (structureMap.containsKey("授权知情同意书")){
+
+        long count = informedConsentDocList.stream().filter(i -> i.getStructureMap() != null && "授权知情同意书".equals(i.getStructureMap().get("标题"))).count();
+        if (count > 0) {
             status.set("0");
+            return;
         }
     }
 }

+ 1 - 1
public/src/main/java/com/lantone/qc/pub/model/InputInfo.java

@@ -80,7 +80,7 @@ public class InputInfo {
     //查房记录
     private List<ThreeLevelWardDoc> threeLevelWardDocs = new ArrayList<>();
     //知情同意书
-    private InformedConsentDoc informedConsentDoc;
+    private List<InformedConsentDoc> informedConsentDoc;
     //谈话告知书
     private NoticeOfConversationDoc noticeOfConversationDoc;
     //麻醉相关

+ 5 - 2
trans/src/main/java/com/lantone/qc/trans/beilun/BeilunDocTrans.java

@@ -188,8 +188,11 @@ public class BeilunDocTrans extends DocTrans {
             inputInfo.getPageData().put("输血/血制品病程记录", inputInfo.getClinicalBloodDocs().stream().map(i -> i.getPageData()).collect(Collectors.toList()));
 //            inputInfo.setClinicalBloodDocs(inputInfo.getClinicalBloodDocs().stream().filter(i -> StringUtil.isNotBlank(i.getText()) && !i.getText().contains("输白蛋白")).collect(Collectors.toList()));
         }
-        if (inputInfo.getInformedConsentDoc() != null) {
-            inputInfo.getPageData().put("知情同意书", Lists.newArrayList(inputInfo.getInformedConsentDoc().getPageData()));
+//        if (inputInfo.getInformedConsentDoc() != null) {
+//            inputInfo.getPageData().put("知情同意书", Lists.newArrayList(inputInfo.getInformedConsentDoc().getPageData()));
+//        }
+        if (ListUtil.isNotEmpty(inputInfo.getInformedConsentDoc())) {
+            inputInfo.getPageData().put("知情同意书", inputInfo.getInformedConsentDoc().stream().map(i -> i.getPageData()).collect(Collectors.toList()));
         }
         if (ListUtil.isNotEmpty(inputInfo.getClinicBloodEffectDocs())) {
             inputInfo.getPageData().put(

+ 51 - 33
trans/src/main/java/com/lantone/qc/trans/beilun/BeilunInformedConsentDocTrans.java

@@ -1,12 +1,12 @@
 package com.lantone.qc.trans.beilun;
 
 import com.google.common.collect.Lists;
-import com.lantone.qc.pub.model.doc.DeathRecordDoc;
 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.BeiLunDeathRecordHtmlAnalysis;
 import com.lantone.qc.trans.beilun.util.BeiLunHtmlAnalysis;
 import com.lantone.qc.trans.beilun.util.BeiLunInformedHtmlAnalysis;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
@@ -14,6 +14,7 @@ import com.lantone.qc.trans.comsis.ModelDocGenerate;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.MapUtils;
+
 import java.util.List;
 import java.util.Map;
 
@@ -25,48 +26,65 @@ import java.util.Map;
 @Slf4j
 public class BeilunInformedConsentDocTrans extends ModelDocTrans {
     @Override
-    public InformedConsentDoc extract(MedrecVo medrecVo) {
-//        InformedConsentDoc informedConsentDoc = new InformedConsentDoc();
-//        Map<String, Object> content = medrecVo.getContent();
-//        if(content .size()>0){
-//            Map<String, String> structureMap = informedConsentDoc.getStructureMap();
-//            content.forEach((key,value)-> structureMap.put(key,value.toString()));
-//        }
-        InformedConsentDoc informedConsentDoc = null;
-        try {
-            Map<String, Object> contentMap = ((List<Map>) medrecVo.getContent().get("content")).get(0);
-            String content = contentMap.get("xmlText").toString();
-            Map<String, String> structureMap = null;
-            if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
-                structureMap = (Map) FastJsonUtils.getJsonToMap(content);
-            } else {
-                String recTitle = contentMap.get("recTitle").toString();
-                String recTypeId = contentMap.get("recTypeId").toString();
-                BeiLunHtmlAnalysis beiLunHtmlAnalysis = new BeiLunInformedHtmlAnalysis();
-                Map<String, String> sourceMap = beiLunHtmlAnalysis.analysis(content, recTitle, recTypeId);
-                if (MapUtils.isNotEmpty(sourceMap)) {
-                    structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
-                    structureMap.put("记录编号", contentMap.get("recId").toString());
-                    structureMap.put("病历号", contentMap.get("behospitalCode") == null ? null : contentMap.get("behospitalCode").toString());
-                }
+    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("xmlText") == null || StringUtil.isBlank(contentMap.get("xmlText").toString())) {
+                continue;
             }
-            if (MapUtils.isNotEmpty(structureMap)) {
-                informedConsentDoc = ModelDocGenerate.informedConsentDocGen(structureMap);
-                informedConsentDoc.setText(CommonAnalysisUtil.html2String(content));
-                informedConsentDoc.setPageData((Map) structureMap);
+            try {
+                String content = contentMap.get("xmlText").toString();
+                Map<String, String> structureMap = null;
+                if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
+                    structureMap = (Map) FastJsonUtils.getJsonToMap(content);
+                } else {
+                    String recTitle = contentMap.get("recTitle").toString();
+                    String recTypeId = contentMap.get("recTypeId").toString();
+                    BeiLunHtmlAnalysis beiLunHtmlAnalysis = new BeiLunInformedHtmlAnalysis();
+                    Map<String, String> sourceMap = beiLunHtmlAnalysis.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);
             }
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
         }
         return informedConsentDoc;
     }
 
+
     private List<String> keyContrasts = Lists.newArrayList(
             "患者签名=患方签名",
             "患方手写意见=患方签名",
             "患方手写意见患方签名=患方签名",
             "患方或受托代理人签名=患方或受托代理人签名",
-               "代理人签名=被授权人签名",
+            "代理人签名=被授权人签名",
             "被授权人签名=被授权人签名"
     );
 }

+ 38 - 8
trans/src/main/java/com/lantone/qc/trans/beilun/util/BeiLunInformedHtmlAnalysis.java

@@ -2,11 +2,11 @@ package com.lantone.qc.trans.beilun.util;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+import com.lantone.qc.pub.util.MapUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 
@@ -28,13 +28,16 @@ public class BeiLunInformedHtmlAnalysis implements BeiLunHtmlAnalysis {
         Map<String, String> structureMap = Maps.newLinkedHashMap();
         try {
             List<String> titles = Lists.newArrayList(
+                    "医师签名",
+                    "九、患者知情同意",
+                    "患方意见",
                     "患者签名",
+                    "患方签名",
                     "患方手写意见",
                     "患方手写意见患方签名",
                     "患方或受托代理人签名",
                     "代理人签名",
                     "被授权人签名",
-                    "手印备注与患者关系",
                     "与患者关系",
                     "其他");
             String html = args[0];
@@ -42,29 +45,46 @@ public class BeiLunInformedHtmlAnalysis implements BeiLunHtmlAnalysis {
             String recTypeId = args[2];
             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("其他:","").replace("被授权人签名","").replace("患者签名","").replace("患方签名","").replace("患者/法定代理人签名","").replace("手印说明(\uF06F右食指 \uF06F左食指)","");
+                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)){
+                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 List<String> ignoreContrasts = Lists.newArrayList(
             "其他",
             "与患者关系",
             "手印备注与患者关系",
-            "身份证号码"
+            "身份证号码",
+            "九、患者知情同意",
+            "患方意见"
     );
 
     private void resultHandle(Map<String, String> result) {
@@ -74,9 +94,9 @@ public class BeiLunInformedHtmlAnalysis implements BeiLunHtmlAnalysis {
         if (result.containsKey("代理人签名")) {
             String signName = result.get("代理人签名");
 
-            if ( signName.contains("手印备注")) {
+            if (signName.contains("手印备注")) {
                 signName = signName.split("手印备注")[0];
-                result.put("代理人签名",signName);
+                result.put("代理人签名", signName);
             }
         }
         result.forEach((key, value) -> {
@@ -89,4 +109,14 @@ public class BeiLunInformedHtmlAnalysis implements BeiLunHtmlAnalysis {
             }
         });
     }
+
+    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("[::]", ""));
+        }
+    }
+
 }

+ 7 - 2
trans/src/main/java/com/lantone/qc/trans/shaoyf/ShaoyfInformedConsentDocTrans.java

@@ -4,6 +4,9 @@ import com.lantone.qc.pub.model.doc.InformedConsentDoc;
 import com.lantone.qc.pub.model.vo.MedrecVo;
 import com.lantone.qc.trans.ModelDocTrans;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @Description: 知情同意书
  * @author: wangyu
@@ -11,8 +14,10 @@ import com.lantone.qc.trans.ModelDocTrans;
  */
 public class ShaoyfInformedConsentDocTrans extends ModelDocTrans {
     @Override
-    public InformedConsentDoc extract(MedrecVo medrecVo) {
+    public List<InformedConsentDoc> extract(MedrecVo medrecVo) {
+        List<InformedConsentDoc> retList = new ArrayList<>();
         InformedConsentDoc informedConsentDoc = new InformedConsentDoc();
-        return informedConsentDoc;
+        retList.add(informedConsentDoc);
+        return retList;
     }
 }

+ 7 - 2
trans/src/main/java/com/lantone/qc/trans/taizhou/TaizhouInformedConsentDocTrans.java

@@ -4,6 +4,9 @@ import com.lantone.qc.pub.model.doc.InformedConsentDoc;
 import com.lantone.qc.pub.model.vo.MedrecVo;
 import com.lantone.qc.trans.ModelDocTrans;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @Description: 知情同意书
  * @author: wangyu
@@ -11,8 +14,10 @@ import com.lantone.qc.trans.ModelDocTrans;
  */
 public class TaizhouInformedConsentDocTrans extends ModelDocTrans {
     @Override
-    public InformedConsentDoc extract(MedrecVo medrecVo) {
+    public List<InformedConsentDoc> extract(MedrecVo medrecVo) {
+        List<InformedConsentDoc> retList = new ArrayList<>();
         InformedConsentDoc informedConsentDoc = new InformedConsentDoc();
-        return informedConsentDoc;
+        retList.add(informedConsentDoc);
+        return retList;
     }
 }

+ 7 - 2
trans/src/main/java/com/lantone/qc/trans/yiwu/YiWuInformedConsentDocTrans.java

@@ -4,6 +4,9 @@ import com.lantone.qc.pub.model.doc.InformedConsentDoc;
 import com.lantone.qc.pub.model.vo.MedrecVo;
 import com.lantone.qc.trans.ModelDocTrans;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @Description: 知情同意书
  * @author: wangyu
@@ -11,8 +14,10 @@ import com.lantone.qc.trans.ModelDocTrans;
  */
 public class YiWuInformedConsentDocTrans extends ModelDocTrans {
     @Override
-    public InformedConsentDoc extract(MedrecVo medrecVo) {
+    public List<InformedConsentDoc> extract(MedrecVo medrecVo) {
+        List<InformedConsentDoc> retList = new ArrayList<>();
         InformedConsentDoc informedConsentDoc = new InformedConsentDoc();
-        return informedConsentDoc;
+        retList.add(informedConsentDoc);
+        return retList;
     }
 }

+ 7 - 2
trans/src/main/java/com/lantone/qc/trans/ywzxyy/YwzxyyInformedConsentDocTrans.java

@@ -4,6 +4,9 @@ import com.lantone.qc.pub.model.doc.InformedConsentDoc;
 import com.lantone.qc.pub.model.vo.MedrecVo;
 import com.lantone.qc.trans.ModelDocTrans;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @Description: 知情同意书
  * @author: wangyu
@@ -11,8 +14,10 @@ import com.lantone.qc.trans.ModelDocTrans;
  */
 public class YwzxyyInformedConsentDocTrans extends ModelDocTrans {
     @Override
-    public InformedConsentDoc extract(MedrecVo medrecVo) {
+    public List<InformedConsentDoc> extract(MedrecVo medrecVo) {
+        List<InformedConsentDoc> retList = new ArrayList<>();
         InformedConsentDoc informedConsentDoc = new InformedConsentDoc();
-        return informedConsentDoc;
+        retList.add(informedConsentDoc);
+        return retList;
     }
 }