Преглед на файлове

北仑:激素处理更新

wangsy преди 4 години
родител
ревизия
bbe7538081

+ 55 - 33
kernel/src/main/java/com/lantone/qc/kernel/catalogue/beilun/threelevelward/THR02986.java

@@ -20,6 +20,7 @@ import com.lantone.qc.pub.model.doc.operation.OperationRecordDoc;
 import com.lantone.qc.pub.model.entity.Drug;
 import com.lantone.qc.pub.util.DateUtil;
 import com.lantone.qc.pub.util.StringUtil;
+import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -53,11 +54,7 @@ public class THR02986 extends QCCatalogue {
         List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
         LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
         List<ConsultationDoc> consultationDocs = inputInfo.getConsultationDocs();
-        if (doctorAdviceDocs.size() == 0 || threeLevelWardDocs.size() == 0) {
-            return;
-        }
-        List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
-        if (allDoctorWradDocs.size() == 0) {
+        if (doctorAdviceDocs.size() == 0) {
             return;
         }
         List<Map<String, String>> docAdvStruct = doctorAdviceDocs
@@ -65,7 +62,7 @@ public class THR02986 extends QCCatalogue {
                 .filter(Objects::nonNull)
                 .map(DoctorAdviceDoc::getStructureMap)
                 .filter(x -> StringUtil.isNotBlank(x.get("药品类型")) && x.get("药品类型").contains("激素"))
-                .filter(x -> StringUtil.isNotBlank(x.get("医嘱状态判别")) && !x.get("医嘱状态判别").contains("已停止"))
+//                .filter(x -> StringUtil.isNotBlank(x.get("医嘱状态判别")) && !x.get("医嘱状态判别").contains("已停止"))
                 //                .filter(x -> StringUtil.isNotBlank(x.get("给药方式")) && x.get("给药方式").contains("静脉滴注"))
                 //                .filter(x -> StringUtil.isNotBlank(x.get("医嘱频率")) && !x.get("医嘱频率").equals("ONCE"))
                 .collect(Collectors.toList());
@@ -82,8 +79,8 @@ public class THR02986 extends QCCatalogue {
             String drugName = adviceDoc.get("医嘱项目名称");
             String startDateStr = adviceDoc.get("医嘱开始时间");
             if (StringUtil.isNotBlank(drugName)) {
-                //                startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
-                startDate = StringUtil.parseDateTime(startDateStr);
+                startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+//                startDate = StringUtil.parseDateTime(startDateStr);
                 if (antibioticDateTimes.get(drugName).get(startDate) > 0) {
                     continue;   //一天内同一抗生素开过多次的抗生素直接过滤
                 }
@@ -111,10 +108,10 @@ public class THR02986 extends QCCatalogue {
         }*/
         //从首程治疗计划中获取信息
         if (firstCourseRecordDoc != null) {
-            getInfo(info, firstCourseRecordDoc.getStructureMap(), "首次病程录", "记录时间", "治疗计划");
+            getInfo(info, firstCourseRecordDoc.getStructureMap(), "首次病程录", "病历日期", "诊疗计划");
             if (firstCourseRecordDoc.getDrugLabel() != null) {
                 List<Drug> drugs = firstCourseRecordDoc.getDrugLabel().getDrugs();
-                dateStr = firstCourseRecordDoc.getStructureMap().get("记录时间");
+                dateStr = firstCourseRecordDoc.getStructureMap().get("病历日期");
                 if (StringUtil.isNotBlank(dateStr)) {
                     getInfo(infoModel, dateStr, drugs);
                 }
@@ -122,13 +119,15 @@ public class THR02986 extends QCCatalogue {
         }
 
         //从查房记录中获取信息
-        List<ThreeLevelWardDoc> wardDocs = allDoctorWradDocs
-                .stream()
-                .filter(x -> StringUtil.isNotBlank(x.getStructureMap().get("查房日期")) && x.getThreeLevelWardLabel().size() > 0)
-                .collect(Collectors.toList());
-        wardDocs.forEach(x -> getInfo(info, x.getStructureMap(), "查房记录", "查房日期", "病情记录", "治疗计划和措施"));
-        wardDocs.forEach(x -> getInfo(infoModel, x.getStructureMap().get("查房日期"), x.getThreeLevelWardLabel().get(x.getThreeLevelWardLabel().size() - 1).getDrugs()));
-
+        if (threeLevelWardDocs.size() > 0) {
+            List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
+            List<ThreeLevelWardDoc> wardDocs = allDoctorWradDocs
+                    .stream()
+                    .filter(x -> StringUtil.isNotBlank(x.getStructureMap().get("查房日期")) && x.getThreeLevelWardLabel().size() > 0)
+                    .collect(Collectors.toList());
+            wardDocs.forEach(x -> getInfo(info, x.getStructureMap(), "查房记录", "查房日期", "病情记录", "治疗计划和措施"));
+            wardDocs.forEach(x -> getInfo(infoModel, x.getStructureMap().get("查房日期"), x.getThreeLevelWardLabel().get(x.getThreeLevelWardLabel().size() - 1).getDrugs()));
+        }
         //从手术记录中获取信息
         if (operationDocs.size() > 0) {
             //手术记录
@@ -136,19 +135,19 @@ public class THR02986 extends QCCatalogue {
                     .stream()
                     .map(OperationDoc::getOperationRecordDoc)
                     .filter(Objects::nonNull)
-                    .filter(x -> x.getOperationRecordLabel() != null && StringUtil.isNotBlank(x.getStructureMap().get("病历日期")))
+                    .filter(x -> x.getOperationRecordLabel() != null && StringUtil.isNotBlank(x.getStructureMap().get("手术时间")))
                     .collect(Collectors.toList());
-            operationRecordDocs.forEach(x -> getInfo(info, x.getStructureMap(), "手术记录", "病历日期", "手术经过"));
-            operationRecordDocs.forEach(x -> getInfo(infoModel, x.getStructureMap().get("病历日期"), x.getOperationRecordLabel().getDrugs()));
+            operationRecordDocs.forEach(x -> getInfo(info, x.getStructureMap(), "手术记录", "手术时间", "手术经过及处理"));
+            operationRecordDocs.forEach(x -> getInfo(infoModel, x.getStructureMap().get("手术时间"), x.getOperationRecordLabel().getDrugs()));
             //术后首程
             List<OperationDiscussionDoc> operationDiscussionDocs = operationDocs
                     .stream()
                     .map(OperationDoc::getOperationDiscussionDoc)
                     .filter(Objects::nonNull)
-                    .filter(x -> x.getOperationDiscussionLabel() != null && StringUtil.isNotBlank(x.getStructureMap().get("记录日期")))
+                    .filter(x -> x.getOperationDiscussionLabel() != null && StringUtil.isNotBlank(x.getStructureMap().get("病历日期")))
                     .collect(Collectors.toList());
-            operationDiscussionDocs.forEach(x -> getInfo(info, x.getStructureMap(), "术后首程", "记录日期", "手术经过", "治疗计划和措施"));
-            operationDiscussionDocs.forEach(x -> getInfo(infoModel, x.getStructureMap().get("记录日期"), x.getOperationDiscussionLabel().getDrugs()));
+            operationDiscussionDocs.forEach(x -> getInfo(info, x.getStructureMap(), "术后首程", "病历日期", "手术简要经过", "术后处理措施"));
+            operationDiscussionDocs.forEach(x -> getInfo(infoModel, x.getStructureMap().get("病历日期"), x.getOperationDiscussionLabel().getDrugs()));
         }
 
         //从会诊记录中获取信息
@@ -165,12 +164,18 @@ public class THR02986 extends QCCatalogue {
 
         //从出院小结中获取信息
         if (leaveHospitalDoc != null) {
-            getInfo(info, leaveHospitalDoc.getStructureMap(), "出院小结", "出院时间", "诊治经过", "出院带药");
-            if (leaveHospitalDoc.getLeaveHospitalLabel() != null) {
-                List<Drug> drugs = leaveHospitalDoc.getLeaveHospitalLabel().getDrugs();
-                dateStr = leaveHospitalDoc.getStructureMap().get("出院时间");
-                if (StringUtil.isNotBlank(dateStr)) {
-                    getInfo(info, leaveHospitalDoc.getStructureMap(), "出院小结", "出院时间", "诊治经过", "出院带药");
+            if (inputInfo.getMedicalRecordInfoDoc() != null) {
+                Map<String, String> medicalRecordInfoStructureMap = inputInfo.getMedicalRecordInfoDoc().getStructureMap();
+                dateStr = medicalRecordInfoStructureMap.get("leaveHospitalDate");
+                //如果存在出院小结,出院日期为空,存储系统当前时间
+                if (StringUtil.isBlank(dateStr)) {
+                    dateStr = DateUtil.formatDateTime(new Date());
+                }
+            }
+            if (StringUtil.isNotBlank(dateStr)) {
+                if (leaveHospitalDoc.getLeaveHospitalLabel() != null) {
+                    List<Drug> drugs = leaveHospitalDoc.getLeaveHospitalLabel().getDrugs();
+                    getDischargeInfo(info, leaveHospitalDoc.getStructureMap(), "出院小结", dateStr, "诊治经过");
                     getInfo(infoModel, dateStr, drugs);
                 }
             }
@@ -254,8 +259,8 @@ public class THR02986 extends QCCatalogue {
         for (Map<String, String> structMap : docAdvStruct) {
             drugName = structMap.get("医嘱项目名称");
             startDateStr = structMap.get("医嘱开始时间");
-            //            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
-            startDate = StringUtil.parseDateTime(startDateStr);
+            startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
+            // startDate = StringUtil.parseDateTime(startDateStr);
             if (antibioticDateTimes.containsKey(drugName)) {
                 Map<Date, Integer> map = antibioticDateTimes.get(drugName);
                 if (map.containsKey(startDate)) {
@@ -272,7 +277,7 @@ public class THR02986 extends QCCatalogue {
     }
 
     /**
-     * 获取各模块信息<入院记录、首次病程录、手术记录、术后首程、会诊结果单、查房记录、出院小结>
+     * 获取各模块信息<入院记录、首次病程录、手术记录、术后首程、会诊结果单、查房记录>
      *
      * @param structureMap
      * @param info
@@ -288,6 +293,22 @@ public class THR02986 extends QCCatalogue {
         }
     }
 
+    /**
+     * 获取出院小结模块信息
+     *
+     * @param structureMap
+     * @param info
+     */
+    private void getDischargeInfo(Map<String, Date> info, Map<String, String> structureMap, String modelType, String dateStr, String... contentKey) {
+        String content = CatalogueUtil.structureMapJoin(structureMap, Lists.newArrayList(contentKey));
+        if (StringUtil.isNotBlank(dateStr)) {
+            Date date = StringUtil.parseDateTime(dateStr);
+            if (StringUtil.isNotBlank(content) && date != null) {
+                info.put(modelType + "->" + content, date);
+            }
+        }
+    }
+
     private void getInfo(Map<String, List<Drug>> info, String dateKey, List<Drug> drugs) {
         if (info.containsKey(dateKey)) {
             info.get(dateKey).addAll(drugs);
@@ -312,7 +333,8 @@ 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))) {
+                || (wardDate.before(doctorAdviceDate) && !CatalogueUtil.compareTime(wardDate, doctorAdviceDate, 24 * 60L))
+                || DateUtils.isSameDay(wardDate, doctorAdviceDate)) {
             boolean findDrug = false;
             String standardDrug = null;
             for (String drug : drugs) {

+ 34 - 29
kernel/src/main/java/com/lantone/qc/kernel/catalogue/beilun/threelevelward/THR03079.java

@@ -49,13 +49,10 @@ public class THR03079 extends QCCatalogue {
         List<ConsultationDoc> consultationDocs = inputInfo.getConsultationDocs();
         List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
         LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
-        if (doctorAdviceDocs.size() == 0 || threeLevelWardDocs.size() == 0) {
-            return;
-        }
-        List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
-        if (allDoctorWradDocs.size() == 0) {
+        if (doctorAdviceDocs.size() == 0) {
             return;
         }
+
         Map<Date, String> extData = null;
         if (outputInfo.getResult().get("THR02986") != null) {
             extData = (Map<Date, String>) outputInfo.getResult().get("THR02986").get("extData");
@@ -65,8 +62,8 @@ public class THR03079 extends QCCatalogue {
                 .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("已停止"))
+                .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("给药方式")));
 
@@ -79,9 +76,9 @@ public class THR03079 extends QCCatalogue {
         Date startDate = null;
         for (Map<String, String> structMap : docAdvStruct) {
             drugName = structMap.get("医嘱项目名称");
-            value = structMap.get("一次使用数量");
+            value = structMap.get("医嘱单次剂量");
             startDateStr = structMap.get("医嘱开始时间");
-            startDate = DateUtil.parseDateTime(startDateStr);
+            startDate = StringUtil.parseDateTime(startDateStr);
             drugName = removeBracket(drugName).replaceAll("[^\u4e00-\u9fa5]", "");
             String drugStandardWord = similarityUtil.getDrugStandardWord(drugName);
             if (StringUtil.isNotBlank(drugStandardWord)) {
@@ -107,21 +104,24 @@ public class THR03079 extends QCCatalogue {
         Map<String, Date> mapInfo = Maps.newLinkedHashMap();
         /*********************************************首程治疗计划********************************************************/
         if (firstCourseRecordDoc != null) {
-            getInfo(mapInfo, firstCourseRecordDoc.getStructureMap(), "首次病程录", "记录时间", "治疗计划");
+            getInfo(mapInfo, firstCourseRecordDoc.getStructureMap(), "首次病程录", "病历日期", "治疗计划");
             DrugLabel drugLabel = firstCourseRecordDoc.getDrugLabel();
-            dateStr = firstCourseRecordDoc.getStructureMap().get("记录时间");
+            dateStr = firstCourseRecordDoc.getStructureMap().get("病历日期");
             if (drugLabel != null && StringUtil.isNotBlank(dateStr)) {
                 List<Drug> drugs = drugLabel.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 (threeLevelWardDocs.size() > 0) {
+            List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
+            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) {
             //手术记录
@@ -129,19 +129,19 @@ public class THR03079 extends QCCatalogue {
                     .stream()
                     .map(OperationDoc::getOperationRecordDoc)
                     .filter(Objects::nonNull)
-                    .filter(x -> x.getOperationRecordLabel() != null && StringUtil.isNotBlank(x.getStructureMap().get("病历日期")))
+                    .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("病历日期")));
+            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("记录日期")))
+                    .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("记录日期")));
+            operationDiscussionDocs.forEach(x -> getInfo(mapInfo, x.getStructureMap(), "术后首程", "病历日期", "手术简要经过", "术后处理措施"));
+            operationDiscussionDocs.forEach(x -> getCourseDrugInfo(antibioticWardInfo, x.getOperationDiscussionLabel().getDrugs(), x.getStructureMap().get("病历日期")));
         }
         /*********************************************会诊结果单********************************************************/
         /*if (consultationDocs.size() > 0) {
@@ -155,12 +155,17 @@ 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();
+            if (inputInfo.getMedicalRecordInfoDoc() != null) {
+                Map<String, String> medicalRecordInfoStructureMap = inputInfo.getMedicalRecordInfoDoc().getStructureMap();
+                dateStr = medicalRecordInfoStructureMap.get("leaveHospitalDate");
+                if (StringUtil.isBlank(dateStr)) {
+                    dateStr = DateUtil.formatDateTime(new Date());
+                }
+                //如果存在出院小结,出院日期为空,存储系统当前时间
+            }
+            if (leaveHospitalDoc.getLeaveHospitalLabel() != null && StringUtil.isNotBlank(dateStr)) {
+                getInfo(mapInfo, leaveHospitalDoc.getStructureMap(), "出院小结", "出院时间", "诊治经过");
+                List<Drug> drugs = leaveHospitalDoc.getLeaveHospitalLabel().getDrugs();
                 getCourseDrugInfo(antibioticWardInfo, drugs, dateStr);
             }
         }