浏览代码

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

wangsy 3 年之前
父节点
当前提交
584b382ffe

+ 17 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC03230.java

@@ -5,6 +5,7 @@ import com.lantone.qc.kernel.util.RegexUtil;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
@@ -26,6 +27,7 @@ public class FIRC03230 extends QCCatalogue {
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
+        FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
         if (firstCourseRecordDoc == null) {
             status.set("0");
             return;
@@ -35,6 +37,20 @@ public class FIRC03230 extends QCCatalogue {
         String diagnoseText = firstCourseRecordDoc.getStructureMap() != null
                 ? firstCourseRecordDoc.getStructureMap().get("诊断依据")
                 : "";
+        String diagText2 = firstCourseRecordDoc.getStructureMap() != null
+                ? firstCourseRecordDoc.getStructureMap().get("初步诊断")
+                : "";
+        String firstPageDiagText = firstPageRecordDoc == null ? ""
+                : (firstPageRecordDoc.getStructureMap() != null
+                ? firstPageRecordDoc.getStructureMap().get("中医门急诊诊断")
+                : "");
+
+        //先判断是否下了中医诊断,没有则通过 或 判断病案首页门急诊诊断是否下诊断,"-"为空,没有则通过
+        if ((StringUtil.isBlank(diagText2) || !diagText2.contains("中医诊断"))
+                && (StringUtil.isBlank(firstPageDiagText) || !RegexUtil.getRegexRes(firstPageDiagText, "[\\u4E00-\\u9FA5]+"))) {
+            status.set("0");
+            return;
+        }
 
         if (StringUtil.isBlank(text) && StringUtil.isBlank(diagnoseText)) {
             status.set("0");
@@ -53,4 +69,4 @@ public class FIRC03230 extends QCCatalogue {
         }
 
     }
-}
+}

+ 9 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC03231.java

@@ -6,6 +6,7 @@ import com.lantone.qc.kernel.util.RegexUtil;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
@@ -26,6 +27,7 @@ public class FIRC03231 extends QCCatalogue {
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
+        FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
         if (firstCourseRecordDoc == null) {
             status.set("0");
             return;
@@ -38,9 +40,14 @@ public class FIRC03231 extends QCCatalogue {
         String diagText2 = firstCourseRecordDoc.getStructureMap() != null
                 ? firstCourseRecordDoc.getStructureMap().get("初步诊断")
                 : "";
+        String firstPageDiagText = firstPageRecordDoc == null ? ""
+                : (firstPageRecordDoc.getStructureMap() != null
+                ? firstPageRecordDoc.getStructureMap().get("中医门急诊诊断")
+                : "");
 
-        //先判断是否下了中医诊断,没有则通过
-        if (StringUtil.isBlank(diagText2) || !diagText2.contains("中医诊断")) {
+        //先判断是否下了中医诊断,没有则通过 或 判断病案首页门急诊诊断是否下诊断,"-"为空,没有则通过
+        if ((StringUtil.isBlank(diagText2) || !diagText2.contains("中医诊断"))
+                && (StringUtil.isBlank(firstPageDiagText) || !RegexUtil.getRegexRes(firstPageDiagText, "[\\u4E00-\\u9FA5]+"))) {
             status.set("0");
             return;
         }

+ 17 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC03232.java

@@ -6,6 +6,7 @@ import com.lantone.qc.kernel.util.RegexUtil;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
 import com.lantone.qc.pub.model.label.CaseCharacteristicLabel;
 import com.lantone.qc.pub.model.label.DiagnosisLabel;
 import com.lantone.qc.pub.util.StringUtil;
@@ -30,6 +31,7 @@ public class FIRC03232 extends QCCatalogue {
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
+        FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
         if (firstCourseRecordDoc == null) {
             status.set("0");
             return;
@@ -42,6 +44,20 @@ public class FIRC03232 extends QCCatalogue {
         String caseCharacteristicText = firstCourseRecordDoc.getStructureMap() != null
                 ? firstCourseRecordDoc.getStructureMap().get("病例特点")
                 : "";
+        String diagText2 = firstCourseRecordDoc.getStructureMap() != null
+                ? firstCourseRecordDoc.getStructureMap().get("初步诊断")
+                : "";
+        String firstPageDiagText = firstPageRecordDoc == null ? ""
+                : (firstPageRecordDoc.getStructureMap() != null
+                ? firstPageRecordDoc.getStructureMap().get("中医门急诊诊断")
+                : "");
+
+        //先判断是否下了中医诊断,没有则通过 或 判断病案首页门急诊诊断是否下诊断,"-"为空,没有则通过
+        if ((StringUtil.isBlank(diagText2) || !diagText2.contains("中医诊断"))
+                && (StringUtil.isBlank(firstPageDiagText) || !RegexUtil.getRegexRes(firstPageDiagText, "[\\u4E00-\\u9FA5]+"))) {
+            status.set("0");
+            return;
+        }
 
         //病历特点
         CaseCharacteristicLabel caseCharacteristicLabel = firstCourseRecordDoc.getCaseCharacteristicLabel();
@@ -73,4 +89,4 @@ public class FIRC03232 extends QCCatalogue {
         }
 
     }
-}
+}

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

@@ -20,7 +20,7 @@ import java.util.Map;
 @Component
 public class FIRP0209 extends QCCatalogue {
 
-    private List<String> containList = Arrays.asList("退(离)休人员","农民", "家务", "自由职业者", "个体经营者", "无业人员", "儿童");
+    private List<String> containList = Arrays.asList("退(离)休人员","退(离)休人员","农民", "家务", "自由职业者", "个体经营者", "无业人员", "儿童","学生");
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
@@ -41,4 +41,4 @@ public class FIRP0209 extends QCCatalogue {
             }
         }
     }
-}
+}

+ 212 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/hospital/ningbozhenhai/crisisvaluereport/CRI0382.java

@@ -0,0 +1,212 @@
+package com.lantone.qc.kernel.catalogue.hospital.ningbozhenhai.crisisvaluereport;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.client.SimilarityServiceClient;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.CrisisInfoDoc;
+import com.lantone.qc.pub.model.doc.CrisisValueReportDoc;
+import com.lantone.qc.pub.model.entity.Annotation;
+import com.lantone.qc.pub.model.vo.SimilarityVo;
+import com.lantone.qc.pub.util.DateUtil;
+import com.lantone.qc.pub.util.StringUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @Description : 危急值记录未在接到危急值报告后6小时内完成
+ * @Author : zhaops
+ * @Date 2022/8/2 13:36
+ */
+@Component
+public class CRI0382 extends QCCatalogue {
+    @Autowired
+    SimilarityServiceClient similarityServiceClient;
+
+    @Override
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        //无危急值结构化信息
+        List<CrisisInfoDoc> crisisInfoDocs = inputInfo.getCrisisInfoDocs();
+        if (crisisInfoDocs == null || crisisInfoDocs.size() == 0) {
+            return;
+        }
+        //有结构化信息但无危急值文书,如果报告时间都未超过6小时 允许无文书
+        boolean isOutTime = false;
+        Date currentDate = new Date();
+        int timeCha = 21600000;
+        String[] dateFormats = new String[] { "yyyy年MM月dd日HH时mm分", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm" };
+        for (CrisisInfoDoc crisisInfoDoc : crisisInfoDocs) {
+            String reptTime = crisisInfoDoc.getStructureMap().get("报告时间");
+            if (StringUtils.isNotEmpty(reptTime)) {
+                if (currentDate.getTime() - StringUtil.parseDateTime(reptTime, dateFormats).getTime() > timeCha) {
+                    isOutTime = true;
+                }
+            }
+        }
+        ;
+        if (isOutTime == false) {   //所有文书都未超过6小时,规则直接通过
+            return;
+        }
+
+        List<CrisisValueReportDoc> crisisValueReportDocs = inputInfo.getCrisisValueReportDocs();
+        //如果有危急值结构化数据 但无文书则直接提醒无危急值报告
+        if (crisisValueReportDocs == null || crisisValueReportDocs.size() == 0) {
+            status.set("-1");
+            return;
+        }
+        List<String> findCrisises = new ArrayList<>();
+        List<String> allCrisises = new ArrayList<>();
+        crisisInfoDocs.forEach(crisisInfoDoc -> {
+            String reptTime = crisisInfoDoc.getStructureMap().get("报告时间");
+            String crisisName = crisisInfoDoc.getStructureMap().get("危急结果值");
+            String crisisNm = "";
+            String companyNum = "";
+            /*if (crisisName.contains("项目为")) {
+                crisisName = crisisName.substring(crisisName.indexOf("项目为") + 3);
+            }
+            if (crisisName.contains(",结果:")) {
+                crisisNm = crisisName.split(",结果:")[0];
+                companyNum = crisisName.split(",结果:")[1];
+                if (StringUtil.isNotBlank(companyNum) && companyNum.contains("单位:")) {
+                    companyNum = companyNum.replaceAll("单位:", "");
+                }
+            }
+            if (crisisName.matches("[\\s\\S]*[(?==)][^,;,;。]{0,8}(?=秒)[\\s\\S]*")) {
+                crisisName = crisisName.split("=")[0];
+            }*/
+
+            //匹配文书检验结果书写格式
+            crisisName = StringUtil.removeBlank(crisisName)
+                    .replaceAll("(\\|(R|r)ange:\\d+(\\.\\d+)?(-|-)\\d+(\\.\\d+)?(;|;))", ",")
+                    .replaceAll("=", ":");
+            allCrisises.add(reptTime);
+            if (StringUtils.isNotEmpty(reptTime)) {
+                //当前时间和报告时间未超过6小时,规则通过
+                if (currentDate.getTime() - StringUtil.parseDateTime(reptTime, dateFormats).getTime() < timeCha) {
+                    findCrisises.add(reptTime);
+                } else {
+                    for (CrisisValueReportDoc crisisValueReportDoc : crisisValueReportDocs) {
+                        String recordTimeStr = crisisValueReportDoc.getStructureMap().get("病历日期");
+                        String docReptContent = crisisValueReportDoc.getStructureMap().get("病情分析及处理");
+                        String pattern = "\\d{4}年\\d{1,2}月\\d{1,2}日\\d{1,2}时\\d{1,2}分";
+                        Pattern r = Pattern.compile(pattern);
+                        Matcher m = r.matcher(docReptContent);
+                        Date reptDate = StringUtil.parseDateTime(reptTime, dateFormats);
+
+                        Boolean reptTimeMatch = false;
+                        while (m.find()) {
+                            if (DateUtil.getFirstTimeOfMinute(reptDate).getTime() == StringUtil.parseDateTime(m.group()).getTime()) {
+                                reptTimeMatch = true;
+                            }
+                        }
+                        //超声:添加文本相似度去比较病情分析及处理
+                        boolean flag = getLikeRate(submitContent(StringUtil.removeBlank(docReptContent))
+                                , StringUtil.removeBlank(crisisName));
+                        if ((StringUtil.parseDateTime(recordTimeStr, dateFormats).getTime() - StringUtil.parseDateTime(reptTime, dateFormats).getTime()) < timeCha
+                                && reptTimeMatch
+                                && (StringUtil.removeBlank(docReptContent).contains(StringUtil.removeBlank(crisisName)))
+                                || flag) {
+                            findCrisises.add(reptTime);
+                            break;
+                        }
+                    }
+                }
+            }
+        });
+
+        if (findCrisises.size() != allCrisises.size()) {
+            status.set("-1");
+            allCrisises.forEach(reptTime -> {
+                String criticalValueName = "";
+                if (!findCrisises.contains(reptTime) && !info.get().contains(reptTime)) {
+                    for (CrisisInfoDoc crisisInfoDoc : crisisInfoDocs) {
+                        if (reptTime.equals(crisisInfoDoc.getStructureMap().get("报告时间"))) {
+                            criticalValueName = crisisInfoDoc.getStructureMap().get("危急值名称");
+                        }
+                    }
+                    if (StringUtils.isEmpty(info.get())) {
+                        info.set(reptTime + " 危急值名称(" + criticalValueName + ")");
+                    } else {
+                        info.set(info.get() + "; " + reptTime + " 危急值名称(" + criticalValueName + ")");
+                    }
+                }
+            });
+        }
+    }
+
+    /**
+     * @Author songxl
+     * @Description 内容截取
+     * @Date 2021/3/29
+     * @Param [content]
+     * @Return java.lang.String
+     * @MethodName submitContent
+     */
+    private String submitContent(String content) {
+        if (StringUtil.isNotBlank(content)) {
+            if (content.contains("具体为")) {
+                content = content.split("具体为")[1];
+            }
+            if (content.contains("处理意见")) {
+                content = content.split("处理意见")[0];
+            }
+        }
+        return content;
+
+    }
+
+    /**
+     * @Author songxl
+     * @Description 获取文本相似度
+     * @Date 2021/3/29
+     * @Param [text_1, text_2]
+     * @Return boolean
+     * @MethodName getFlag
+     */
+    private boolean getLikeRate(String text_1, String text_2) {
+        if (text_1.contains("超声")) {
+            JSONArray similarContent = new JSONArray();
+            JSONObject detailContent = new JSONObject();
+            detailContent.put("text_1", text_1);
+            detailContent.put("text_2", text_2);
+            similarContent.add(detailContent);
+            //存储CRF完整所需结构数据
+            SimilarityVo similarityVo = new SimilarityVo();
+            similarityVo.setData(similarContent);
+            //获取CRF模型返回数据
+            JSONArray data = getAnnotation(similarityServiceClient, similarityVo).getData();
+            double likeRate = 0d;
+            if (data.size() > 0) {
+                JSONObject dataContent = data.getJSONObject(0);
+                likeRate = dataContent.getDoubleValue("like_rate");
+            }
+            if (likeRate > 0.8) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private Annotation getAnnotation(SimilarityServiceClient similarityServiceClient, SimilarityVo similarityVo) {
+        Annotation annotation = new Annotation();
+        try {
+            String annotation_str = similarityServiceClient.getAnnotation(similarityVo);
+            annotation = JSON.parseObject(annotation_str, Annotation.class);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+            return annotation;
+        }
+    }
+}

+ 22 - 20
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03112.java

@@ -42,7 +42,7 @@ public class THR03112 extends QCCatalogue {
                             String daItemName = doctorAdviceDocStructureMap.get(Content.medicalOrderName);
                             String nameSs = doctorAdviceDocStructureMap.get("医嘱处方类型");
                             if (StringUtil.isNotEmpty(daItemName) && StringUtil.isNotEmpty(nameSs)) {
-                                if (dateStr(daItemName) && (nameSs.equals("检查")||nameSs.equals("RAD")|| nameSs.equals("放射医嘱"))) {
+                                if (dateStr(daItemName) && (nameSs.equals("检查") || nameSs.equals("RAD") || nameSs.equals("放射医嘱"))) {
                                     flag = true;
                                     status.set("-1");
                                 }
@@ -52,7 +52,7 @@ public class THR03112 extends QCCatalogue {
                 }
             }
         }
-        if(flag) {
+        if (flag) {
             List<PacsDoc> pacsDocs = inputInfo.getPacsDocs();
             if (ListUtil.isNotEmpty(pacsDocs)) {
                 for (PacsDoc pacsDoc : pacsDocs) {
@@ -62,7 +62,8 @@ public class THR03112 extends QCCatalogue {
                     String str2 = structureMap.get("报告名称");
                     String str3 = structureMap.get("观察记录");
                     String str4 = structureMap.get("检查结果诊断");
-                    if (dateStrBg(str) || dateStrBg(str1) || dateStrBg(str2) || dateStrBg(str3) || dateStrBg(str4)) {
+                    String str5 = structureMap.get("检查类型名称");
+                    if (dateStrBg(str) || dateStrBg(str1) || dateStrBg(str2) || dateStrBg(str3) || dateStrBg(str4) || dateStrBg(str5)) {
                         status.set("0");
                         return;
                     }
@@ -71,30 +72,31 @@ public class THR03112 extends QCCatalogue {
         }
     }
 
-    private boolean dateStr(String str){
-        if(StringUtil.isEmpty(str)){
+    private boolean dateStr(String str) {
+        if (StringUtil.isEmpty(str)) {
             return false;
         }
-        if (str.contains("MR") || str.contains("磁共振")||str.contains("核磁")) {
+        if (str.contains("MR") || str.contains("磁共振") || str.contains("核磁")) {
             List<String> notMRList = Content.notMRList;
             for (String list : notMRList) {
-                if(!str.contains(list)){
+                if (!str.contains(list)) {
                     return true;
                 }
             }
         }
         return false;
     }
-    private boolean dateStrBg(String str){
-        if(StringUtil.isEmpty(str)){
+
+    private boolean dateStrBg(String str) {
+        if (StringUtil.isEmpty(str)) {
             return false;
         }
-        boolean MrCf=false;
-        boolean jsj=false;
+        boolean MrCf = false;
+        boolean jsj = false;
         ArrayList<String> cfStrings = new ArrayList<>();
-        String rex2="[\\s\\S]{0,5}(?=MR)[\\s\\S]{1,10}";
+        String rex2 = "[\\s\\S]{0,5}(?=MR)[\\s\\S]{1,10}";
         //需要判断同时存在MR和MRS等情况的发生
-        if(str.contains("MR")) {
+        if (str.contains("MR")) {
             Matcher matcher = Pattern.compile(rex2).matcher(str);
             while (matcher.find()) {
                 String group = matcher.group();
@@ -105,24 +107,24 @@ public class THR03112 extends QCCatalogue {
                 for (String notCT : notMRList) {
                     for (int i = 0; i < cfStrings.size(); i++) {
                         String cfStr = cfStrings.get(i);
-                        if(cfStr.contains(notCT)){
+                        if (cfStr.contains(notCT)) {
                             cfStrings.remove(i);
                             continue;
                         }
                     }
                 }
-                if(cfStrings.size()>0){
-                    MrCf=true;
+                if (cfStrings.size() > 0) {
+                    MrCf = true;
                 }
             }
 
         }
-        if ( str.contains("磁共振")||str.contains("核磁")) {
-            jsj= true;
+        if (str.contains("磁共振") || str.contains("核磁")) {
+            jsj = true;
         }
-        if(jsj||MrCf){
+        if (jsj || MrCf) {
             return true;
         }
         return false;
     }
-}
+}

+ 62 - 53
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03233.java

@@ -11,7 +11,6 @@ import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
 import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
 import com.lantone.qc.pub.model.doc.LeaveHospitalDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
-import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.DateUtil;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
@@ -94,74 +93,84 @@ public class THR03233 extends QCCatalogue {
             return;
         }
 
-        List<Date> dateList = date.stream().map(i -> StringUtil.parseDateTime(i))
+        List<Date> dateList = date.stream().map(i -> DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i)))
                 .filter(Objects::nonNull)
+                .distinct()
                 .sorted(Comparator.comparing(i -> i))
                 .collect(Collectors.toList());
 
-        Date startDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(dateList.get(0), -1));
-        Date endDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(dateList.get(dateList.size() - 1), 2));
-
         String regex = "四诊|神色|神态|面色|形态|语声|气息|舌象|舌|苔|脉|血虚|气血";
 
-        //首次诊疗计划
-        if (null != firstCourseRecordDoc) {
-            String treatPlan = firstCourseRecordDoc.getStructureMap().get("诊疗计划");
-            Date treatPlanDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("病历日期")));
-            if (StringUtil.isNotBlank(treatPlan)
-                    && (!treatPlanDate.after(startDate)
-                    || !treatPlanDate.before(endDate))
-                    && RegexUtil.getRegexRes(treatPlan, regex, 2)) {
-                status.set("0");
-                return;
-            }
-            if (null != firstCourseRecordDoc.getTreatPlanLabel()
-                    && firstCourseRecordDoc.getTreatPlanLabel().getText().contains("四诊")) {
-                status.set("0");
-                return;
-            }
+        if (ListUtil.isEmpty(dateList)) {
+            status.set("0");
+            return;
         }
+        for (Date daDate : dateList) {
+            Date startDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(daDate, -1));
+            Date endDate = DateUtil.getLastTimeOfDay(DateUtil.addDate(daDate, 2));
+            Boolean exist = false;
+
+            //首次诊疗计划
+            if (null != firstCourseRecordDoc) {
+                String treatPlan = firstCourseRecordDoc.getStructureMap().get("诊疗计划");
+                Date treatPlanDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("病历日期")));
+                if (StringUtil.isNotBlank(treatPlan)
+                        && (treatPlanDate.getTime() >= startDate.getTime() && treatPlanDate.getTime() <= endDate.getTime())
+                        && RegexUtil.getRegexRes(treatPlan, regex, 2)) {
+                    exist = true;
+                    continue;
+                }
+                if (null != firstCourseRecordDoc.getTreatPlanLabel()
+                        && firstCourseRecordDoc.getTreatPlanLabel().getText().contains("四诊")) {
+                    exist = true;
+                    continue;
+                }
+            }
 
-        //查房记录
-        if (ListUtil.isNotEmpty(threeLevelWardDocs)) {
-            threeLevelWardDocs = threeLevelWardDocs.stream()
-                    .filter(Objects::nonNull)
-                    .filter(i -> i.getStructureMap().containsKey("查房日期") && i.getStructureMap().containsKey("病情记录"))
-                    .filter(i -> !DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))).after(startDate)
-                            || !DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))).before(endDate))
-                    .collect(Collectors.toList());
+            //查房记录
             if (ListUtil.isNotEmpty(threeLevelWardDocs)) {
-                for (ThreeLevelWardDoc item : threeLevelWardDocs) {
-                    if (RegexUtil.getRegexRes(item.getStructureMap().get("病情记录"), regex, 2)) {
-                        status.set("0");
-                        return;
-                    }
-
-                    //todo 模型记录四诊(暂不处理)
-                    List<ThreeLevelWardLabel> threeLevelWardLabel = item.getThreeLevelWardLabel();
+                List<ThreeLevelWardDoc> threeLevelWardDocs_match = threeLevelWardDocs.stream()
+                        .filter(Objects::nonNull)
+                        .filter(i -> ListUtil.isNotEmpty(i.getAllDoctorWradDocs()))
+                        .flatMap(i -> i.getAllDoctorWradDocs().stream())
+                        .distinct()
+                        .filter(i -> i.getStructureMap().containsKey("查房日期") && i.getStructureMap().containsKey("病情记录"))
+                        .filter(i -> StringUtil.parseDateTime(i.getStructureMap().get("查房日期")).getTime() >= startDate.getTime()
+                                && StringUtil.parseDateTime(i.getStructureMap().get("查房日期")).getTime() <= endDate.getTime())
+                        .filter(i -> RegexUtil.getRegexRes(i.getStructureMap().get("病情记录"), regex, 2))
+                        .collect(Collectors.toList());
+                if (ListUtil.isNotEmpty(threeLevelWardDocs_match)) {
+                    exist = true;
+                    continue;
                 }
+
+                //todo 模型记录四诊(暂不处理)
+                //List<ThreeLevelWardLabel> threeLevelWardLabel = item.getThreeLevelWardLabel();
             }
-        }
 
-        //出院小结
-        if (null != leaveHospitalDoc) {
-            String leaveHosText = leaveHospitalDoc.getStructureMap().get("出院医嘱");
-            Date leaveHospitalDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("出院日期")));
-            if (StringUtil.isNotBlank(leaveHosText)
-                    && (!leaveHospitalDate.after(startDate)
-                    || !leaveHospitalDate.before(endDate))
-                    && RegexUtil.getRegexRes(leaveHosText, regex, 2)) {
-                status.set("0");
-                return;
+            //出院小结
+            if (null != leaveHospitalDoc) {
+                String leaveHosText = leaveHospitalDoc.getStructureMap().get("出院医嘱");
+                Date leaveHospitalDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(leaveHospitalDoc.getStructureMap().get("日期")));
+                if (StringUtil.isNotBlank(leaveHosText)
+                        && (leaveHospitalDate.getTime() >= startDate.getTime() && leaveHospitalDate.getTime() <= endDate.getTime())
+                        && RegexUtil.getRegexRes(leaveHosText, regex, 2)) {
+                    exist = true;
+                    continue;
+                }
+                if (null != leaveHospitalDoc.getLeaveHospitalDoctorAdviceLabel()
+                        && leaveHospitalDoc.getLeaveHospitalDoctorAdviceLabel().getText().contains("四诊")) {
+                    exist = true;
+                    continue;
+                }
             }
-            if (null != leaveHospitalDoc.getLeaveHospitalDoctorAdviceLabel()
-                    && leaveHospitalDoc.getLeaveHospitalDoctorAdviceLabel().getText().contains("四诊")) {
-                status.set("0");
+
+            if (!exist) {
+                status.set("-1");
                 return;
             }
         }
-
-        status.set("-1");
+        status.set("0");
         return;
     }
 }

+ 67 - 46
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03234.java

@@ -4,7 +4,6 @@ package com.lantone.qc.kernel.catalogue.threelevelward;
 import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.kernel.util.RegexUtil;
-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.DoctorAdviceDoc;
@@ -16,10 +15,9 @@ import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -61,9 +59,21 @@ public class THR03234 extends QCCatalogue {
             return;
         }
 
+        List<String> chinesemedicineyinpian = Lists.newArrayList();
+        Properties properties = new Properties();
+        InputStream in = Thread.currentThread().getContextClassLoader()
+                .getResourceAsStream("medicine.properties");
+        try {
+            properties.load(new InputStreamReader(in, "UTF-8"));
+        } catch (Exception e) {
+
+        }
+        String medicineStr = properties.getProperty("chinesemedicineyinpian");
+        if (StringUtil.isNotBlank(medicineStr)) {
+            chinesemedicineyinpian = Arrays.stream(medicineStr.split(",")).collect(Collectors.toList());
+        }
         Boolean isRecord = false;
         List<DoctorAdviceDoc> recordList = Lists.newLinkedList();
-        List<String> chinesemedicineyinpian = Content.CHINESEMEDICINEYINPIAN;
         for (DoctorAdviceDoc item : doctorAdviceDocs) {
             if (null != item.getStructureMap()) {
                 if (RegexUtil.getRegexListRes(item.getStructureMap().get("医嘱项目名称"), chinesemedicineyinpian)) {
@@ -91,61 +101,72 @@ public class THR03234 extends QCCatalogue {
             return;
         }
 
-        List<Date> dateList = date.stream().map(i -> StringUtil.parseDateTime(i))
+        List<Date> dateList = date.stream().map(i -> DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i)))
                 .filter(Objects::nonNull)
+                .distinct()
                 .sorted(Comparator.comparing(i -> i))
                 .collect(Collectors.toList());
 
-        Date startDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(dateList.get(0), -1));
-        Date endDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(dateList.get(dateList.size() - 1), 2));
 
         String regex = "中医辨病辨证依据|中医辩证";
 
-        //首次诊疗计划
-        if (null != firstCourseRecordDoc) {
-            String treatPlan = firstCourseRecordDoc.getStructureMap().get("诊疗计划");
-            Date treatPlanDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("病历日期")));
-            if (StringUtil.isNotBlank(treatPlan)
-                    && (!treatPlanDate.after(startDate)
-                    || !treatPlanDate.before(endDate))
-                    && RegexUtil.getRegexRes(treatPlan, regex, 2)) {
-                status.set("0");
-                return;
-            }
+        if (ListUtil.isEmpty(dateList)) {
+            status.set("0");
+            return;
         }
+        for (Date daDate : dateList) {
+            Date startDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(daDate, -1));
+            Date endDate = DateUtil.getLastTimeOfDay(DateUtil.addDate(daDate, 2));
+            Boolean exist = false;
+
+            //首次诊疗计划
+            if (null != firstCourseRecordDoc) {
+                String treatPlan = firstCourseRecordDoc.getStructureMap().get("诊疗计划");
+                Date treatPlanDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("病历日期")));
+                if (StringUtil.isNotBlank(treatPlan)
+                        && (treatPlanDate.getTime() >= startDate.getTime() && treatPlanDate.getTime() <= endDate.getTime())
+                        && RegexUtil.getRegexRes(treatPlan, regex)) {
+                    exist = true;
+                    continue;
+                }
+            }
 
-        //查房记录
-        if (ListUtil.isNotEmpty(threeLevelWardDocs)) {
-            threeLevelWardDocs = threeLevelWardDocs.stream()
-                    .filter(Objects::nonNull)
-                    .filter(i -> i.getStructureMap().containsKey("查房日期") && i.getStructureMap().containsKey("病情记录"))
-                    .filter(i -> !DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))).after(startDate)
-                            || !DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))).before(endDate))
-                    .collect(Collectors.toList());
+            //查房记录
             if (ListUtil.isNotEmpty(threeLevelWardDocs)) {
-                for (ThreeLevelWardDoc item : threeLevelWardDocs) {
-                    if (RegexUtil.getRegexRes(item.getStructureMap().get("病情记录"), regex, 2)) {
-                        status.set("0");
-                        return;
-                    }
+                List<ThreeLevelWardDoc> threeLevelWardDocs_match = threeLevelWardDocs.stream()
+                        .filter(Objects::nonNull)
+                        .filter(i -> ListUtil.isNotEmpty(i.getAllDoctorWradDocs()))
+                        .flatMap(i -> i.getAllDoctorWradDocs().stream())
+                        .distinct()
+                        .filter(i -> i.getStructureMap().containsKey("查房日期") && i.getStructureMap().containsKey("病情记录"))
+                        .filter(i -> StringUtil.parseDateTime(i.getStructureMap().get("查房日期")).getTime() >= startDate.getTime()
+                                && StringUtil.parseDateTime(i.getStructureMap().get("查房日期")).getTime() <= endDate.getTime())
+                        .filter(i -> RegexUtil.getRegexRes(i.getStructureMap().get("病情记录"), regex))
+                        .collect(Collectors.toList());
+                if (ListUtil.isNotEmpty(threeLevelWardDocs_match)) {
+                    exist = true;
+                    continue;
                 }
             }
-        }
 
-        //出院小结
-        if (null != leaveHospitalDoc) {
-            String leaveHosText = leaveHospitalDoc.getStructureMap().get("出院医嘱");
-            Date leaveHospitalDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("出院日期")));
-            if (StringUtil.isNotBlank(leaveHosText)
-                    && (!leaveHospitalDate.after(startDate)
-                    || !leaveHospitalDate.before(endDate))
-                    && RegexUtil.getRegexRes(leaveHosText, regex, 2)) {
-                status.set("0");
+            //出院小结
+            if (null != leaveHospitalDoc) {
+                String leaveHosText = leaveHospitalDoc.getStructureMap().get("出院医嘱");
+                Date leaveHospitalDate = StringUtil.parseDateTime(leaveHospitalDoc.getStructureMap().get("日期"));
+                if (StringUtil.isNotBlank(leaveHosText)
+                        && (leaveHospitalDate.getTime() >= startDate.getTime() && leaveHospitalDate.getTime() <= endDate.getTime())
+                        && RegexUtil.getRegexRes(leaveHosText, regex)) {
+                    exist = true;
+                    continue;
+                }
+            }
+
+            if (!exist) {
+                status.set("-1");
                 return;
             }
         }
-
-        status.set("-1");
+        status.set("0");
         return;
     }
-}
+}

+ 68 - 48
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03235.java

@@ -4,7 +4,6 @@ package com.lantone.qc.kernel.catalogue.threelevelward;
 import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.kernel.util.RegexUtil;
-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.DoctorAdviceDoc;
@@ -16,10 +15,9 @@ import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -61,12 +59,25 @@ public class THR03235 extends QCCatalogue {
             return;
         }
 
-        List<String> chineseMedicineyinpian = Content.CHINESEMEDICINEYINPIAN;
+        List<String> chinesemedicineyinpian = Lists.newArrayList();
+        Properties properties = new Properties();
+        InputStream in = Thread.currentThread().getContextClassLoader()
+                .getResourceAsStream("medicine.properties");
+        try {
+            properties.load(new InputStreamReader(in, "UTF-8"));
+        } catch (Exception e) {
+
+        }
+        String medicineStr = properties.getProperty("chinesemedicineyinpian");
+        if (StringUtil.isNotBlank(medicineStr)) {
+            chinesemedicineyinpian = Arrays.stream(medicineStr.split(",")).collect(Collectors.toList());
+        }
+
         Boolean isRecord = false;
         List<DoctorAdviceDoc> recordList = Lists.newLinkedList();
         for (DoctorAdviceDoc item : doctorAdviceDocs) {
             if (null != item.getStructureMap()) {
-                if (RegexUtil.getRegexListRes(item.getStructureMap().get("医嘱项目名称"), chineseMedicineyinpian)) {
+                if (RegexUtil.getRegexListRes(item.getStructureMap().get("医嘱项目名称"), chinesemedicineyinpian)) {
                     if (!recordList.contains(item)) {
                         recordList.add(item);
                     }
@@ -91,61 +102,70 @@ public class THR03235 extends QCCatalogue {
             return;
         }
 
-        List<Date> dateList = date.stream().map(i -> StringUtil.parseDateTime(i))
+        List<Date> dateList = date.stream().map(i -> DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i)))
                 .filter(Objects::nonNull)
+                .distinct()
                 .sorted(Comparator.comparing(i -> i))
                 .collect(Collectors.toList());
 
-        Date startDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(dateList.get(0), -1));
-        Date endDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(dateList.get(dateList.size() - 1), 2));
-
         String regex = "治则|治为则|治法";
-
-        //首次诊疗计划
-        if (null != firstCourseRecordDoc) {
-            String treatPlan = firstCourseRecordDoc.getStructureMap().get("诊疗计划");
-            Date treatPlanDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("病历日期")));
-            if (StringUtil.isNotBlank(treatPlan)
-                    && (!treatPlanDate.after(startDate)
-                    || !treatPlanDate.before(endDate))
-                    && RegexUtil.getRegexRes(treatPlan, regex, 2)) {
-                status.set("0");
-                return;
-            }
+        if (ListUtil.isEmpty(dateList)) {
+            status.set("0");
+            return;
         }
+        for (Date daDate : dateList) {
+            Date startDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(daDate, -1));
+            Date endDate = DateUtil.getLastTimeOfDay(DateUtil.addDate(daDate, 2));
+            Boolean exist = false;
+
+            //首次诊疗计划
+            if (null != firstCourseRecordDoc) {
+                String treatPlan = firstCourseRecordDoc.getStructureMap().get("诊疗计划");
+                Date treatPlanDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("病历日期")));
+                if (StringUtil.isNotBlank(treatPlan)
+                        && (treatPlanDate.getTime() >= startDate.getTime() && treatPlanDate.getTime() <= endDate.getTime())
+                        && RegexUtil.getRegexRes(treatPlan, regex)) {
+                    exist = true;
+                    continue;
+                }
+            }
 
-        //查房记录
-        if (ListUtil.isNotEmpty(threeLevelWardDocs)) {
-            threeLevelWardDocs = threeLevelWardDocs.stream()
-                    .filter(Objects::nonNull)
-                    .filter(i -> i.getStructureMap().containsKey("查房日期") && i.getStructureMap().containsKey("病情记录"))
-                    .filter(i -> !DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))).after(startDate)
-                            || !DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))).before(endDate))
-                    .collect(Collectors.toList());
+            //查房记录
             if (ListUtil.isNotEmpty(threeLevelWardDocs)) {
-                for (ThreeLevelWardDoc item : threeLevelWardDocs) {
-                    if (RegexUtil.getRegexRes(item.getStructureMap().get("病情记录"), regex, 2)) {
-                        status.set("0");
-                        return;
-                    }
+                List<ThreeLevelWardDoc> threeLevelWardDocs_match = threeLevelWardDocs.stream()
+                        .filter(Objects::nonNull)
+                        .filter(i -> ListUtil.isNotEmpty(i.getAllDoctorWradDocs()))
+                        .flatMap(i -> i.getAllDoctorWradDocs().stream())
+                        .distinct()
+                        .filter(i -> i.getStructureMap().containsKey("查房日期") && i.getStructureMap().containsKey("病情记录"))
+                        .filter(i -> StringUtil.parseDateTime(i.getStructureMap().get("查房日期")).getTime() >= startDate.getTime()
+                                && StringUtil.parseDateTime(i.getStructureMap().get("查房日期")).getTime() <= endDate.getTime())
+                        .filter(i -> RegexUtil.getRegexRes(i.getStructureMap().get("病情记录"), regex))
+                        .collect(Collectors.toList());
+                if (ListUtil.isNotEmpty(threeLevelWardDocs_match)) {
+                    exist = true;
+                    continue;
                 }
             }
-        }
 
-        //出院小结
-        if (null != leaveHospitalDoc) {
-            String leaveHosText = leaveHospitalDoc.getStructureMap().get("出院医嘱");
-            Date leaveHospitalDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("出院日期")));
-            if (StringUtil.isNotBlank(leaveHosText)
-                    && (!leaveHospitalDate.after(startDate)
-                    || !leaveHospitalDate.before(endDate))
-                    && RegexUtil.getRegexRes(leaveHosText, regex, 2)) {
-                status.set("0");
+            //出院小结
+            if (null != leaveHospitalDoc) {
+                String leaveHosText = leaveHospitalDoc.getStructureMap().get("出院医嘱");
+                Date leaveHospitalDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(leaveHospitalDoc.getStructureMap().get("日期")));
+                if (StringUtil.isNotBlank(leaveHosText)
+                        && (leaveHospitalDate.getTime() >= startDate.getTime() && leaveHospitalDate.getTime() <= endDate.getTime())
+                        && RegexUtil.getRegexRes(leaveHosText, regex)) {
+                    exist = true;
+                    continue;
+                }
+            }
+
+            if (!exist) {
+                status.set("-1");
                 return;
             }
         }
-
-        status.set("-1");
+        status.set("0");
         return;
 
     }

+ 53 - 44
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03236.java

@@ -4,7 +4,6 @@ package com.lantone.qc.kernel.catalogue.threelevelward;
 import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.kernel.util.RegexUtil;
-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.DoctorAdviceDoc;
@@ -60,8 +59,8 @@ public class THR03236 extends QCCatalogue {
 
 
         String regex1 = "口服|静滴|静推";
-        List<String> chineseMedicine = Content.CHINESEMEDICINE;
-        /*Lists.newArrayList();
+        List<String> chineseMedicine = Lists.newArrayList();//Content.CHINESEMEDICINE;
+
         Properties properties = new Properties();
         InputStream in = Thread.currentThread().getContextClassLoader()
                 .getResourceAsStream("medicine.properties");
@@ -74,7 +73,7 @@ public class THR03236 extends QCCatalogue {
         if (StringUtil.isNotBlank(medicineStr)) {
             chineseMedicine = Arrays.stream(medicineStr.split(",")).collect(Collectors.toList());
         }
-        */
+
 
         Boolean isRecord = false;
         List<DoctorAdviceDoc> recordList = Lists.newLinkedList();
@@ -108,61 +107,71 @@ public class THR03236 extends QCCatalogue {
             return;
         }
 
-        List<Date> dateList = date.stream().map(i -> StringUtil.parseDateTime(i))
+        List<Date> dateList = date.stream().map(i -> DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i)))
                 .filter(Objects::nonNull)
+                .distinct()
                 .sorted(Comparator.comparing(i -> i))
                 .collect(Collectors.toList());
 
-        Date startDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(dateList.get(0), -1));
-        Date endDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(dateList.get(dateList.size() - 1), 2));
-
         String regex = "中医辨病辨证依据|中医辩证";
 
-        //首次诊疗计划
-        if (null != firstCourseRecordDoc) {
-            String treatPlan = firstCourseRecordDoc.getStructureMap().get("诊疗计划");
-            Date treatPlanDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("病历日期")));
-            if (StringUtil.isNotBlank(treatPlan)
-                    && (!treatPlanDate.after(startDate)
-                    || !treatPlanDate.before(endDate))
-                    && RegexUtil.getRegexRes(treatPlan, regex, 2)) {
-                status.set("0");
-                return;
-            }
+        if (ListUtil.isEmpty(dateList)) {
+            status.set("0");
+            return;
         }
+        for (Date daDate : dateList) {
+            Date startDate = DateUtil.getFirstTimeOfDay(DateUtil.addDate(daDate, -1));
+            Date endDate = DateUtil.getLastTimeOfDay(DateUtil.addDate(daDate, 2));
+            Boolean exist = false;
+
+            //首次诊疗计划
+            if (null != firstCourseRecordDoc) {
+                String treatPlan = firstCourseRecordDoc.getStructureMap().get("诊疗计划");
+                Date treatPlanDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("病历日期")));
+                if (StringUtil.isNotBlank(treatPlan)
+                        && (treatPlanDate.getTime() >= startDate.getTime() && treatPlanDate.getTime() <= endDate.getTime())
+                        && RegexUtil.getRegexRes(treatPlan, regex)) {
+                    exist = true;
+                    continue;
+                }
+            }
 
-        //查房记录
-        if (ListUtil.isNotEmpty(threeLevelWardDocs)) {
-            threeLevelWardDocs = threeLevelWardDocs.stream()
-                    .filter(Objects::nonNull)
-                    .filter(i -> i.getStructureMap().containsKey("查房日期") && i.getStructureMap().containsKey("病情记录"))
-                    .filter(i -> !DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))).after(startDate)
-                            || !DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("查房日期"))).before(endDate))
-                    .collect(Collectors.toList());
+            //查房记录
             if (ListUtil.isNotEmpty(threeLevelWardDocs)) {
-                for (ThreeLevelWardDoc item : threeLevelWardDocs) {
-                    if (RegexUtil.getRegexRes(item.getStructureMap().get("病情记录"), regex, 2)) {
-                        status.set("0");
-                        return;
-                    }
+                List<ThreeLevelWardDoc> threeLevelWardDocs_match = threeLevelWardDocs.stream()
+                        .filter(Objects::nonNull)
+                        .filter(i -> ListUtil.isNotEmpty(i.getAllDoctorWradDocs()))
+                        .flatMap(i -> i.getAllDoctorWradDocs().stream())
+                        .distinct()
+                        .filter(i -> i.getStructureMap().containsKey("查房日期") && i.getStructureMap().containsKey("病情记录"))
+                        .filter(i -> StringUtil.parseDateTime(i.getStructureMap().get("查房日期")).getTime() >= startDate.getTime()
+                                && StringUtil.parseDateTime(i.getStructureMap().get("查房日期")).getTime() <= endDate.getTime())
+                        .filter(i -> RegexUtil.getRegexRes(i.getStructureMap().get("病情记录"), regex))
+                        .collect(Collectors.toList());
+                if (ListUtil.isNotEmpty(threeLevelWardDocs_match)) {
+                    exist = true;
+                    continue;
                 }
             }
-        }
 
-        //出院小结
-        if (null != leaveHospitalDoc) {
-            String leaveHosText = leaveHospitalDoc.getStructureMap().get("出院医嘱");
-            Date leaveHospitalDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(firstCourseRecordDoc.getStructureMap().get("出院日期")));
-            if (StringUtil.isNotBlank(leaveHosText)
-                    && (!leaveHospitalDate.after(startDate)
-                    || !leaveHospitalDate.before(endDate))
-                    && RegexUtil.getRegexRes(leaveHosText, regex, 2)) {
-                status.set("0");
+            //出院小结
+            if (null != leaveHospitalDoc) {
+                String leaveHosText = leaveHospitalDoc.getStructureMap().get("出院医嘱");
+                Date leaveHospitalDate = DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(leaveHospitalDoc.getStructureMap().get("日期")));
+                if (StringUtil.isNotBlank(leaveHosText)
+                        && (leaveHospitalDate.getTime() >= startDate.getTime() && leaveHospitalDate.getTime() <= endDate.getTime())
+                        && RegexUtil.getRegexRes(leaveHosText, regex)) {
+                    exist = true;
+                    continue;
+                }
+            }
+
+            if (!exist) {
+                status.set("-1");
                 return;
             }
         }
-
-        status.set("-1");
+        status.set("0");
         return;
     }
 }

文件差异内容过多而无法显示
+ 2 - 1
kernel/src/main/resources/medicine.properties


+ 13 - 0
public/src/main/java/com/lantone/qc/pub/util/DateUtil.java

@@ -485,6 +485,19 @@ public class DateUtil {
         return cal.getTime();
     }
 
+    /**
+     * 获取某一分钟的0秒的时间
+     *
+     * @param date 输入日期
+     * @return 返回加上0秒的时间
+     */
+    public static Date getFirstTimeOfMinute(Date date) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.set(Calendar.SECOND, 0);
+        return cal.getTime();
+    }
+
     /**
      * 获取某一天的23时59分59秒的时间
      *

+ 2 - 1
trans/src/main/java/com/lantone/qc/trans/ningbozhenhai/DeathRecordDocTrans.java

@@ -59,7 +59,8 @@ public class DeathRecordDocTrans extends ModelDocTrans {
             "签名时间=记录时间",
             "科室=科别",
             "死亡时间=死亡日期",
-            "医生签名=记录医生"
+            "医生签名=记录医生",
+            "诊治经过=诊疗经过"
     );
 
 }

+ 1 - 1
trans/src/main/java/com/lantone/qc/trans/ningbozhenhai/util/DeathRecordHtmlAnalysis.java

@@ -26,7 +26,7 @@ public class DeathRecordHtmlAnalysis implements HtmlAnalysis {
         Map<String, String> structureMap = Maps.newLinkedHashMap();
         try {
             List<String> titles = Lists.newArrayList("性别", "年龄", "婚姻", "入院日期", "死亡时间", "入院情况", "入院诊断",
-                    "诊疗经过(重点记录病情演变、抢救经过)", "诊疗经过", "死亡原因", "死亡诊断", "医师签字", "医生签名", "记录时间");
+                    "诊疗经过(重点记录病情演变、抢救经过)", "诊疗经过","诊治经过", "死亡原因", "死亡诊断", "医师签字", "医生签名", "记录时间");
             String html = args[0];
             String recTitle = args[1];
             String recTypeId = args[2];