Parcourir la source

Merge remote-tracking branch 'origin/shaoyf/dev' into shaoyf/master

wangsy il y a 4 ans
Parent
commit
608ced738c

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

@@ -54,8 +54,14 @@ public class BEH0011 extends QCCatalogue {
             status.set("0");
             return;
         }
+        //现病史
         PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
+        //初步诊断
         DiagLabel initialDiagLabel = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel();
+        //修正诊断
+        DiagLabel revisedDiagLabel = inputInfo.getBeHospitalizedDoc().getRevisedDiagLabel();
+        //补充诊断
+        DiagLabel suppleDiagLabel = inputInfo.getBeHospitalizedDoc().getSuppleDiagLabel();
         PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
         PacsLabel pacsLabel = inputInfo.getBeHospitalizedDoc().getPacsLabel();
         if (initialDiagLabel == null) {
@@ -129,12 +135,27 @@ public class BEH0011 extends QCCatalogue {
             }
         }
 
-
         /* 取初步诊断中疾病名称 */
         List<String> initDiags = new ArrayList<>();
         List<Diag> initialDiagDiags = initialDiagLabel.getDiags();
         addInitDiagHospitalName(initDiags, initialDiagDiags);
 
+        /* 取修正诊断中疾病名称 */
+        if (revisedDiagLabel != null) {
+            List<Diag> revisedDiagDiags = revisedDiagLabel.getDiags();
+            addInitDiagHospitalName(initDiags, revisedDiagDiags);
+        }
+
+        /* 取补充诊断中疾病名称 */
+        if (suppleDiagLabel != null) {
+            List<Diag> suppleDiagDiags = suppleDiagLabel.getDiags();
+            addInitDiagHospitalName(initDiags, suppleDiagDiags);
+        }
+
+        if (initDiags.size() > 0) {
+            initDiags = initDiags.stream().distinct().collect(Collectors.toList());
+        }
+
         String infoStr = "";
         /*先两两对比,能对上就删除,对不上的再走相似度模型*/
         Iterator<String> iterator = presentPastDiags.iterator();
@@ -143,6 +164,7 @@ public class BEH0011 extends QCCatalogue {
             for (String initDiag : initDiags) {
                 if (presentPastDiag.equals(initDiag) || presentPastDiag.contains(initDiag) || initDiag.contains(presentPastDiag)) {
                     iterator.remove();
+                    break;
                 }
             }
         }

+ 11 - 4
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0013.java

@@ -3,7 +3,9 @@ package com.lantone.qc.kernel.catalogue.behospitalized;
 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.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.entity.Clinical;
+import com.lantone.qc.pub.model.label.PastLabel;
 import com.lantone.qc.pub.model.label.PresentLabel;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
@@ -26,17 +28,22 @@ public class BEH0013 extends QCCatalogue {
                 || StringUtil.isBlank(inputInfo.getBeHospitalizedDoc().getChiefLabel().getText())) {
             return;
         }
-        PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
-        if (presentLabel == null) {
+        BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
+        //现病史
+        PresentLabel presentLabel = beHospitalizedDoc.getPresentLabel();
+        //既往史
+        PastLabel pastLabel = beHospitalizedDoc.getPastLabel();
+        if ((presentLabel == null || StringUtil.isBlank(presentLabel.getText())) && StringUtil.isBlank(pastLabel.getText())) {
             return;
         }
         String text = presentLabel.getText();
+        if("。".equals(text)){
+           return;
+        }
         if (StringUtil.isNotBlank(text)) {
             if ((text.contains("无") || text.contains("否认")) && !text.contains("诱因")) {
                 return;
             }
-        } else {
-            return;
         }
         List<Clinical> clinicalNegative = new ArrayList<>();
         List<Clinical> clinicals = presentLabel.getClinicals();

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

@@ -3,9 +3,11 @@ package com.lantone.qc.kernel.catalogue.behospitalized;
 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.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.entity.Cause;
 import com.lantone.qc.pub.model.entity.Clinical;
 import com.lantone.qc.pub.model.entity.Diag;
+import com.lantone.qc.pub.model.label.PastLabel;
 import com.lantone.qc.pub.model.label.PresentLabel;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
@@ -33,6 +35,7 @@ public class BEH0014 extends QCCatalogue {
             status.set("0");
             return;
         }
+        BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
         /*List<Clinical> clinicals = inputInfo.getBeHospitalizedDoc().getPresentLabel().getClinicals();
         if(clinicals.size()>0){
             Clinical clinical = clinicals.get(0);
@@ -45,7 +48,9 @@ public class BEH0014 extends QCCatalogue {
             }
         }*/
         PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
-        if (presentLabel == null || StringUtil.isBlank(presentLabel.getText())) {
+        //既往史
+        PastLabel pastLabel = beHospitalizedDoc.getPastLabel();
+        if ((presentLabel == null || StringUtil.isBlank(presentLabel.getText())) && StringUtil.isBlank(pastLabel.getText())) {
             status.set("0");
             return;
         }
@@ -60,6 +65,10 @@ public class BEH0014 extends QCCatalogue {
         }
         //硬规则匹配 前30个字有"体检"或"发现"或"检查"(containList)字样
         String present = presentLabel.getText();
+        if("。".equals(present)){
+            status.set("0");
+            return;
+        }
         if (StringUtils.isNotEmpty(present)) {
             if (present.length() > 30) {
                 present = present.substring(0, 30);

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

@@ -31,8 +31,7 @@ public class BEH02988 extends QCCatalogue {
         if (beHospitalizedDoc == null) {
             return;
         }
-        if (StringUtil.isBlank(chiefLabel.getText()) && StringUtil.isNotBlank(presentLabel.getText()) ||
-                StringUtil.isNotBlank(pastLabel.getText())) {
+        if (StringUtil.isBlank(chiefLabel.getText()) && (StringUtil.isNotBlank(presentLabel.getText()) || StringUtil.isNotBlank(pastLabel.getText()))) {
             status.set("-1");
             return;
         }

+ 7 - 4
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0192.java

@@ -50,9 +50,9 @@ public class FIRP0192 extends QCCatalogue {
                     operationName = operationDoc.getOperationDiscussionDoc().getStructureMap().get("手术名称");
                 }
                 if (StringUtil.isNotBlank(operationName)) {
-                    operationName = operationName.replaceAll("[\\p{Punct}\\pP]", "").replaceAll("\\s*","");
-                    oName = oName.replaceAll("[\\p{Punct}\\pP]", "").replaceAll("\\s*","");
-                    if(operationName.contains(oName)){
+                    String operationNm = operationName.replaceAll("[\\p{Punct}\\pP]", "").replaceAll("\\s*", "");
+                    oName = oName.replaceAll("[\\p{Punct}\\pP]", "").replaceAll("\\s*", "");
+                    if (operationNm.contains(oName)) {
                         return;
                     }
                     String[] operationNames = operationName.split("\\+");
@@ -66,9 +66,12 @@ public class FIRP0192 extends QCCatalogue {
                         if (likeRate < 0.85) {
                             status.set("-1");
                             return;
-                        }else {
+                        } else {
                             return;
                         }
+                    } else {
+                        status.set("-1");
+                        return;
                     }
                 }
             }

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR02985.java

@@ -303,7 +303,7 @@ public class THR02985 extends QCCatalogue {
                 }
                 drug = drug.replaceAll("[^\\u4e00-\\u9fa5]", "");
                 standardDrug = similarityUtil.getDrugStandardWord(drug);
-                if (content.contains(drug) || (StringUtil.isNotBlank(content) && content.contains(standardDrug))
+                if (content.contains(drug) || (StringUtil.isNotBlank(content) && StringUtil.isNotBlank(standardDrug) && content.contains(standardDrug))
                         || (existDrug.contains(drug) && (regexFind(content, "继续", "治疗") || regexFind(content, "维持", "治疗")
                         || regexFind(content, "继续", "抗感染") || regexFind(content, "治疗", "同前") || regexFind(content, "治疗同前")))) {
                     findDrug = true;

+ 20 - 4
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR02986.java

@@ -184,6 +184,7 @@ public class THR02986 extends QCCatalogue {
             /**********************************************先文本匹配************************************************/
             String missDrug = "";
             for (Map.Entry<String, Date> map : info.entrySet()) {
+                doctorAdviceDate = DateUtil.dateZeroClear(doctorAdviceDate);
                 missDrug = getMissDrug(map.getKey(), map.getValue(), doctorAdviceDate, splitDrugs, 2, missDrug, existDrug);
                 //当前激素药(drugs)在info中已找到,直接跳出当前循环
                 if (StringUtil.isBlank(missDrug)) {
@@ -216,8 +217,12 @@ public class THR02986 extends QCCatalogue {
                 }
             }
             if (StringUtil.isNotBlank(missDrug) && !modelFind && CatalogueUtil.compareTime(doctorAdviceDate, new Date(), 48 * 60L)) {
-                infoAppend(sb, drugs, DateUtil.formatDateTime(doctorAdviceDate));
-                data.put(doctorAdviceDate, splitDrugs.toString().replaceAll("[\\[\\]]", ""));
+                infoAppend(sb, drugs, DateUtil.formatDateTime(doctorAdviceDrug.getKey()));
+                String drugStandardWord = similarityUtil.getDrugStandardWord(drugs);
+                if (StringUtil.isNotBlank(drugStandardWord)) {
+                    drugs = drugStandardWord;
+                }
+                data.put(doctorAdviceDrug.getKey(), drugs);
             }
         }
         if (StringUtil.isNotBlank(sb.toString())) {
@@ -301,11 +306,14 @@ public class THR02986 extends QCCatalogue {
         if ((doctorAdviceDate.before(wardDate) && !CatalogueUtil.compareTime(doctorAdviceDate, wardDate, days * 24 * 60L))
                 || (wardDate.before(doctorAdviceDate) && !CatalogueUtil.compareTime(wardDate, doctorAdviceDate, 24 * 60L))) {
             boolean findDrug = false;
+            String standardDrug = null;
             for (String drug : drugs) {
                 if (StringUtil.isBlank(drug)) {
                     continue;
                 }
-                if (content.contains(drug.replaceAll("[^\\u4e00-\\u9fa5]", ""))
+                drug = drug.replaceAll("[^\\u4e00-\\u9fa5]", "");
+                standardDrug = similarityUtil.getDrugStandardWord(drug);
+                if (content.contains(drug) || (StringUtil.isNotBlank(content) && StringUtil.isNotBlank(standardDrug) && content.contains(standardDrug))
                         || (existDrug.contains(drug) && (regexFind(content, "继续", "治疗") || regexFind(content, "维持", "治疗")
                         || regexFind(content, "继续", "抗感染") || regexFind(content, "治疗", "同前")))) {
                     findDrug = true;
@@ -345,7 +353,15 @@ public class THR02986 extends QCCatalogue {
         s = s.substring(0, s.lastIndexOf(".*"));
         Pattern p = Pattern.compile(s);
         Matcher m = p.matcher(content);
-        return m.find();
+        if (m.find()) {
+            String group = m.group();
+            if (group.contains("亚胺培南西司他丁针")) {
+                return false;
+            }
+            return true;
+        } else {
+            return false;
+        }
     }
 
     /**

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03076.java

@@ -201,7 +201,7 @@ public class THR03076 extends QCCatalogue {
 
         if (sb.toString().length() > 0) {
             status.set("-1");
-            info.set("医嘱:" + sb.toString().substring(0, sb.toString().length() - 1));
+            info.set("医嘱" + sb.toString().substring(0, sb.toString().length() - 1));
         }
     }
 

+ 5 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03077.java

@@ -333,9 +333,11 @@ public class THR03077 extends QCCatalogue {
             }
             String wardDrug = drug.getName();
             int position = content.indexOf(wardDrug);
-            String keyword = content.substring(Math.max(0, position - 10), position);
-            if (keyword.contains("继续") || keyword.contains("停")) {
-                continue;
+            if(position != -1){
+                String keyword = content.substring(Math.max(0, position - 10), position);
+                if (keyword.contains("继续") || keyword.contains("停")) {
+                    continue;
+                }
             }
             wardDrug = removeBracket(wardDrug);
             String drugStandardWord = similarityUtil.getDrugStandardWord(wardDrug);

+ 145 - 59
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03079.java

@@ -24,10 +24,7 @@ import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
@@ -53,47 +50,62 @@ public class THR03079 extends QCCatalogue {
         if (doctorAdviceDocs.size() == 0 || threeLevelWardDocs.size() == 0) {
             return;
         }
-
+        List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
+        if (allDoctorWradDocs.size() == 0) {
+            return;
+        }
         Map<Date, String> extData = null;
-        if (outputInfo.getResult().get("THR02985") != null) {
-            extData = (Map<Date, String>) outputInfo.getResult().get("THR02985").get("extData");
+        if (outputInfo.getResult().get("THR02986") != null) {
+            extData = (Map<Date, String>) outputInfo.getResult().get("THR02986").get("extData");
         }
 
         List<Map<String, String>> docAdvStruct = doctorAdviceDocs
                 .stream()
                 .filter(Objects::nonNull)
                 .map(DoctorAdviceDoc::getStructureMap)
-                .filter(x -> StringUtil.isNotBlank(x.get("药品类型")) && x.get("药品类型").contains("激素") && StringUtil.isNotBlank(x.get("一次使用数量")))
+                .filter(x -> StringUtil.isNotBlank(x.get("药品类型")) && x.get("药品类型").contains("激素") && StringUtil.isNotBlank(x.get("医嘱单次剂量")))
                 .filter(x -> StringUtil.isNotBlank(x.get("医嘱状态判别")) && !x.get("医嘱状态判别").contains("已停止"))
                 .collect(Collectors.toList());
         docAdvStruct.removeIf(x -> StringUtil.isNotBlank(x.get("给药方式")) && !filterKey.contains(x.get("给药方式")));
 
-        //抗生素及开医嘱时间 <抗生素名,<抗生素用量,[抗生素使用时间...]>>
+        //激素及开医嘱时间 <激素名,<激素用量,[激素使用时间...]>>
         Map<String, Map<String, List<Double>>> antibioticInfo = Maps.newLinkedHashMap();
         Map<String, Map<Date, Integer>> antibioticDateTimes = Maps.newHashMap();
-        //记录同一抗生素同一天内是否开过多次,用于医嘱中需要处理的抗生素过滤(一天内同一抗生素开过多次的抗生素直接过滤)
+        //记录同一激素同一天内是否开过多次,用于医嘱中需要处理的激素过滤(一天内同一激素开过多次的激素直接过滤)
         getAntibioticTimes(docAdvStruct, antibioticDateTimes);
         String drugName = null, value = null, startDateStr = null;
         Date startDate = null;
         for (Map<String, String> structMap : docAdvStruct) {
             drugName = structMap.get("医嘱项目名称");
-            value = structMap.get("一次使用数量");
+            value = structMap.get("医嘱单次剂量");
             startDateStr = structMap.get("医嘱开始时间");
-            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+            startDate = DateUtil.parseDateTime(startDateStr);
+            drugName = removeBracket(drugName).replaceAll("[^\u4e00-\u9fa5]", "");
+            String drugStandardWord = similarityUtil.getDrugStandardWord(drugName);
+            if (StringUtil.isNotBlank(drugStandardWord)) {
+                drugName = drugStandardWord;
+            }
             if (extData != null && extData.containsKey(startDate) && extData.get(startDate).equals(drugName)) {
-                continue;   //THR02985  医嘱有抗生素使用病程无记录,规则中没报未记录的抗生素继续走这条规则,报未记录的抗生素过滤
+                continue;   //THR02986  医嘱有激素使用病程无记录,规则中没报未记录的激素继续走这条规则,报未记录的激素过滤
             }
-            if (antibioticDateTimes.get(drugName).get(startDate) > 0) {
-                continue;   //一天内同一抗生素开过多次的抗生素直接过滤
+            if (antibioticDateTimes.get(drugName) != null) {
+                if (antibioticDateTimes.get(drugName).get(startDate) != null && antibioticDateTimes.get(drugName).get(startDate) > 0) {
+                    continue;   //一天内同一激素开过多次的激素直接过滤
+                }
+            }
+
+            if (drugName.contains("甲泼尼龙") || drugName.contains("泼尼松") || drugName.contains("地塞米松") || drugName.contains("可的松")) {
+                collectAntibioticInfo(antibioticInfo, structMap.get("医嘱项目名称"), value, startDateStr);
             }
-            collectAntibioticInfo(antibioticInfo, drugName, value, startDateStr);
         }
 
-        //抗生素及开医嘱时间 <抗生素名,<抗生素用量,[抗生素使用时间...]>>
+        //激素及开医嘱时间 <激素名,<激素用量,[激素使用时间...]>>
         Map<String, Map<String, List<Double>>> antibioticWardInfo = Maps.newLinkedHashMap();
         String dateStr = null;
+        Map<String, Date> mapInfo = Maps.newLinkedHashMap();
         /*********************************************首程治疗计划********************************************************/
         if (firstCourseRecordDoc != null) {
+            getInfo(mapInfo, firstCourseRecordDoc.getStructureMap(), "首次病程录", "记录时间", "治疗计划");
             DrugLabel drugLabel = firstCourseRecordDoc.getDrugLabel();
             dateStr = firstCourseRecordDoc.getStructureMap().get("记录时间");
             if (drugLabel != null && StringUtil.isNotBlank(dateStr)) {
@@ -102,18 +114,12 @@ public class THR03079 extends QCCatalogue {
             }
         }
         /*********************************************查房记录********************************************************/
-        if (threeLevelWardDocs.size() > 0) {
-            List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
-            for (ThreeLevelWardDoc doc : allDoctorWradDocs) {
-                if (doc.getThreeLevelWardLabel().size() == 0) {
-                    continue;
-                }
-                dateStr = doc.getStructureMap().get("查房日期");
-                ThreeLevelWardLabel label = doc.getThreeLevelWardLabel().get(0);
-                List<Drug> drugs = label.getDrugs();
-                getCourseDrugInfo(antibioticWardInfo, drugs, dateStr);
-            }
-        }
+        List<ThreeLevelWardDoc> wardDocs = allDoctorWradDocs
+                .stream()
+                .filter(x -> StringUtil.isNotBlank(x.getStructureMap().get("查房日期")) && x.getThreeLevelWardLabel().size() > 0)
+                .collect(Collectors.toList());
+        wardDocs.forEach(x -> getInfo(mapInfo, x.getStructureMap(), "查房记录", "查房日期", "病情记录", "治疗计划和措施"));
+        wardDocs.forEach(x -> getCourseDrugInfo(antibioticWardInfo, x.getThreeLevelWardLabel().get(x.getThreeLevelWardLabel().size() - 1).getDrugs(), x.getStructureMap().get("查房日期")));
         /**********************************************手术记录、术后首程************************************************/
         if (operationDocs.size() > 0) {
             //手术记录
@@ -123,13 +129,16 @@ public class THR03079 extends QCCatalogue {
                     .filter(Objects::nonNull)
                     .filter(x -> x.getOperationRecordLabel() != null && StringUtil.isNotBlank(x.getStructureMap().get("病历日期")))
                     .collect(Collectors.toList());
+            operationRecordDocs.forEach(x -> getInfo(mapInfo, x.getStructureMap(), "手术记录", "病历日期", "手术经过"));
             operationRecordDocs.forEach(x -> getCourseDrugInfo(antibioticWardInfo, x.getOperationRecordLabel().getDrugs(), x.getStructureMap().get("病历日期")));
+            //术后首程
             List<OperationDiscussionDoc> operationDiscussionDocs = operationDocs
                     .stream()
                     .map(OperationDoc::getOperationDiscussionDoc)
                     .filter(Objects::nonNull)
                     .filter(x -> x.getOperationDiscussionLabel() != null && StringUtil.isNotBlank(x.getStructureMap().get("记录日期")))
                     .collect(Collectors.toList());
+            operationDiscussionDocs.forEach(x -> getInfo(mapInfo, x.getStructureMap(), "术后首程", "记录日期", "手术经过", "治疗计划和措施"));
             operationDiscussionDocs.forEach(x -> getCourseDrugInfo(antibioticWardInfo, x.getOperationDiscussionLabel().getDrugs(), x.getStructureMap().get("记录日期")));
         }
         /*********************************************会诊结果单********************************************************/
@@ -144,19 +153,21 @@ public class THR03079 extends QCCatalogue {
         }*/
         /*********************************************出院小结********************************************************/
         if (leaveHospitalDoc != null) {
+            getInfo(mapInfo, leaveHospitalDoc.getStructureMap(), "出院小结", "出院时间", "诊治经过", "出院带药");
             LeaveHospitalLabel leaveHospitalLabel = leaveHospitalDoc.getLeaveHospitalLabel();
             dateStr = leaveHospitalDoc.getStructureMap().get("出院时间");
             if (leaveHospitalLabel != null && StringUtil.isNotBlank(dateStr)) {
+                getInfo(mapInfo, leaveHospitalDoc.getStructureMap(), "出院小结", "出院时间", "诊治经过", "出院带药");
                 List<Drug> drugs = leaveHospitalLabel.getDrugs();
                 getCourseDrugInfo(antibioticWardInfo, drugs, dateStr);
             }
         }
 
         /**
-         * 1.医嘱中开了抗生素,查房记录中没有该抗生素,则医嘱中该抗生素出现过的所有时间都会提示出来
-         * 2.医嘱中开了抗生素,查房记录中有该抗生素:
-         *      2.1 医嘱中该抗生素某使用量(如50),查房记录中没有该使用量(如只有100),则医嘱中该抗生素使用量出现过的所有时间都会提示出来
-         *      2.2 医嘱中该抗生素某使用量(如50),查房记录中也有该使用量,对比这两个时间,若医嘱时间两天内的查房记录没有该使用量,则该医嘱时间会提示出来
+         * 1.医嘱中开了激素,查房记录中没有该激素,则医嘱中该激素出现过的所有时间都会提示出来
+         * 2.医嘱中开了激素,查房记录中有该激素:
+         *      2.1 医嘱中该激素某使用量(如50),查房记录中没有该使用量(如只有100),则医嘱中该激素使用量出现过的所有时间都会提示出来
+         *      2.2 医嘱中该素某使用量(如50),查房记录中也有该使用量,对比这两个时间,若医嘱时间两天内的查房记录没有该使用量,则该医嘱时间会提示出来
          */
         StringBuffer sb = new StringBuffer();
         String drugKey = null;
@@ -179,31 +190,85 @@ public class THR03079 extends QCCatalogue {
                         String wardDateStr = wdvMap.getKey();
                         Date wardDate = StringUtil.parseDateTime(wardDateStr);
                         List<Double> wardUsage = wdvMap.getValue();
-                        if ((adDate.before(wardDate) && !CatalogueUtil.compareTime(adDate, wardDate, 48 * 60L))
-                                || (wardDate.before(adDate) && !CatalogueUtil.compareTime(wardDate, adDate, 24 * 60L))) {
-                            wardUsage.removeAll(adUsage);//比如adUsage有1.0、2.0,wardUsage中有2.0、3.0,removeAll之后wardUsage只剩3.0
-                            if (wardUsage.size() == 0) {
+                        adDate = DateUtil.dateZeroClear(adDate);
+                        if (adDate.before(wardDate) && !CatalogueUtil.compareTime(adDate, wardDate, 48 * 60L)) {
+                            if (wardUsage.toString().equals(adUsage.toString())) {
                                 match = true;
                             }
-                            adDateStr = DateUtil.formatDate(adDate);
-                            if (!match && wardUsage.size() > 0 && !sb.toString().contains(drugKey + "(" + adDateStr + ")")) {
-                                infoAppend(sb, ai.getKey(), adDateStr);
-                                break;
+                        }
+                        if (wardDate.before(adDate) && !CatalogueUtil.compareTime(wardDate, adDate, 24 * 60L)) {
+                            boolean isWard = false;
+                            if (wardUsage.toString().equals(adUsage.toString())) {
+                                isWard = true;
+                            }
+                            match = isWard;
+                        }
+                    }
+                    adDateStr = DateUtil.formatDate(adDate);
+                    if (!match && !sb.toString().contains(drugKey + "(" + adDateStr + ")")) {
+                        List<Double> drugDosage = isContinueTreat(adDate, mapInfo, wardDateValue);
+                        if (drugDosage == null) {
+                            infoAppend(sb, drugKey, adDateStr);
+                        } else {
+                            drugDosage.removeAll(adUsage);//比如adUsage有1.0、2.0,wardUsage中有2.0、3.0,removeAll之后wardUsage只剩3.0
+                            if (drugDosage.size() != 0) {
+                                infoAppend(sb, drugKey, adDateStr);
                             }
                         }
                     }
                 }
             }
         }
-
         if (sb.toString().length() > 0) {
             status.set("-1");
-            info.set("医嘱:" + sb.toString().substring(0, sb.toString().length() - 1));
+            info.set("医嘱" + sb.toString().substring(0, sb.toString().length() - 1));
         }
     }
 
     /**
-     * 记录同一抗生素同一天内是否开过多次,用于医嘱中需要处理的抗生素过滤(一天内同一抗生素开过多次的抗生素直接过滤)
+     * 记录病程记录中是否有继续治疗,治疗同前等
+     *
+     * @param adDate
+     * @param mapInfo
+     * @param wardDateMaps
+     */
+    private List<Double> isContinueTreat(Date adDate, Map<String, Date> mapInfo, Map<String, List<Double>> wardDateMaps) {
+        for (Map.Entry<String, Date> map : mapInfo.entrySet()) {
+            String content = map.getKey();
+            Date dateValue = map.getValue();
+            //开医嘱时间起,昨天今天明天记录内查找药
+            if ((adDate.before(dateValue) && !CatalogueUtil.compareTime(adDate, dateValue, 48 * 60L))
+                    || (dateValue.before(adDate) && !CatalogueUtil.compareTime(dateValue, adDate, 24 * 60L))) {
+                if (regexFind(content, "继续", "治疗") || regexFind(content, "维持", "治疗") || regexFind(content, "继续", "抗感染") ||
+                        regexFind(content, "治疗", "同前") || regexFind(content, "治疗同前")) {
+                    List<Double> drugDosage = null;
+                    for (Map.Entry<String, List<Double>> wdvMap : wardDateMaps.entrySet()) {
+                        String wardDateStr = wdvMap.getKey();
+                        Date wardDate = StringUtil.parseDateTime(wardDateStr);
+                        if (wardDate.before(dateValue)) {
+                            drugDosage = wdvMap.getValue();
+                        }
+                    }
+                    return drugDosage;
+                }
+            }
+        }
+        return null;
+    }
+
+    private boolean regexFind(String content, String... str) {
+        String s = "";
+        for (String word : str) {
+            s += word + ".*";
+        }
+        s = s.substring(0, s.lastIndexOf(".*"));
+        Pattern p = Pattern.compile(s);
+        Matcher m = p.matcher(content);
+        return m.find();
+    }
+
+    /**
+     * 记录同一激素同一天内是否开过多次,用于医嘱中需要处理的激素过滤(一天内同一激素开过多次的激素直接过滤)
      *
      * @param docAdvStruct
      * @param antibioticDateTimes
@@ -216,7 +281,11 @@ public class THR03079 extends QCCatalogue {
         for (Map<String, String> structMap : docAdvStruct) {
             drugName = structMap.get("医嘱项目名称");
             startDateStr = structMap.get("医嘱开始时间");
-            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+            startDate = StringUtil.parseDateTime(startDateStr);
+            String drugStandardWord = similarityUtil.getDrugStandardWord(drugName);
+            if (StringUtil.isNotBlank(drugStandardWord)) {
+                drugName = drugStandardWord;
+            }
             if (antibioticDateTimes.containsKey(drugName)) {
                 Map<Date, Integer> map = antibioticDateTimes.get(drugName);
                 if (map.containsKey(startDate)) {
@@ -255,16 +324,36 @@ public class THR03079 extends QCCatalogue {
      * @param date
      */
     private void infoAppend(StringBuffer sb, String drugKey, String date) {
-        sb.append(drugKey).append("(").append(date).append(")").append("、");
+        sb.append(drugKey).append("(").append(date).append(")").append("_");
+    }
+
+    /**
+     * 获取各模块信息<入院记录、首次病程录、手术记录、术后首程、会诊结果单、查房记录、出院小结>
+     *
+     * @param info
+     * @param structureMap
+     * @param modelType
+     * @param dateKey
+     * @param contentKey
+     */
+    private void getInfo(Map<String, Date> info, Map<String, String> structureMap, String modelType, String dateKey, String... contentKey) {
+        String content = CatalogueUtil.structureMapJoin(structureMap, Lists.newArrayList(contentKey));
+        String recordDateStr = structureMap.get(dateKey);
+        if (StringUtil.isNotBlank(recordDateStr)) {
+            Date date = StringUtil.parseDateTime(recordDateStr);
+            if (StringUtil.isNotBlank(content) && date != null) {
+                info.put(modelType + "->" + content, date);
+            }
+        }
     }
 
     /**
-     * 收集抗生素各种信息
+     * 收集素各种信息
      *
-     * @param antibioticInfo 抗生素使用量及所有时间
-     * @param drugName       抗生素名称
-     * @param value          抗生素用量
-     * @param startDateStr   抗生素使用时间(医嘱开始时间或查房时间)
+     * @param antibioticInfo 素使用量及所有时间
+     * @param drugName       素名称
+     * @param value          素用量
+     * @param startDateStr   素使用时间(医嘱开始时间或查房时间)
      */
     private void collectAntibioticInfo(Map<String, Map<String, List<Double>>> antibioticInfo, String drugName, String value, String startDateStr) {
         Map<String, List<Double>> antibioticValueList = null;
@@ -281,17 +370,17 @@ public class THR03079 extends QCCatalogue {
             v = v / 1000;
         }
         if (!antibioticInfo.containsKey(drugName)) {
-            //存该抗生素使用第1个值
+            //存该素使用第1个值
             antibioticValueList = Maps.newLinkedHashMap();
             antibioticValueList.put(startDateStr, Lists.newArrayList(v));
             antibioticInfo.put(drugName, antibioticValueList);
         } else {
             antibioticValueList = antibioticInfo.get(drugName);
-            //存该抗生素使用时间时第n个量
+            //存该素使用时间时第n个量
             if (antibioticValueList.containsKey(startDateStr)) {
                 antibioticValueList.get(startDateStr).add(v);
             } else {
-                //存该抗生素使用时间时第1个量
+                //存该素使用时间时第1个量
                 antibioticValueList.put(startDateStr, Lists.newArrayList(v));
             }
         }
@@ -321,10 +410,7 @@ public class THR03079 extends QCCatalogue {
         return str;
     }
 
-    private static final List<String> filterKey = Lists.newArrayList("ACF", "ID", "IG", "IM", "IP", "IV",
-            "关节腔注射", "宫颈注射", "皮下注射", "皮下注射(儿童)", "皮下注射(免费)", "皮下注射(成人)", "皮内", "皮内注射",
-            "结膜下注射", "肌注", "肌肉注射(儿童)", "肌肉注射(公卫专用)", "肌肉注射(成人)", "胸腔注射", "腹腔内注射", "腹腔注射",
-            "静滴(儿童)", "静滴(成人)", "静脉注射", "静脉注射(儿童)", "静脉注射(免费)", "静脉注射(成人)", "静脉注射(泵)",
-            "静脉滴注", "静脉滴注(泵)", "鞘内注射");
+    private static final List<String> filterKey = Lists.newArrayList("静脉滴注", "静脉注射", "口服", "皮下注射", "肌注", "静脉注射(泵)",
+            "膀胱持续冲洗", "静脉滴注(泵)", "膀胱冲洗", "腹腔注射", "鞘内注射", "关节腔注射", "胸腔注射", "皮内");
 
 }