Kaynağa Gözat

有抗菌药物使用病程无记录

zhaops 2 yıl önce
ebeveyn
işleme
e924c237e9

+ 77 - 36
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03122.java

@@ -1,16 +1,20 @@
 package com.lantone.qc.kernel.catalogue.threelevelward;
 
 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.*;
+import com.lantone.qc.pub.model.doc.operation.OperationDoc;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * @ClassName : THR03119
@@ -24,11 +28,15 @@ public class THR03122 extends QCCatalogue {
         status.set("0");
         boolean flag = false;
         FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
+        FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
         List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+        List<OperationDoc> operationDocList = inputInfo.getOperationDocs();
+        LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
+
         List<String> antimicrobialDrugList = Content.antimicrobialDrugList;
         List<String> cfAntibacterialList = Content.cfAntibacterialList;
         String drugAllergy = "";
-        String drugAllergyStr="";
+        String drugAllergyStr = "";
         //判断是否有抗菌药物的使用
         //首页费用
         if (firstPageRecordDoc != null) {
@@ -40,35 +48,34 @@ public class THR03122 extends QCCatalogue {
                     flag = true;
                 }
             }
-            drugAllergy = structureMap.get("过敏药物")+drugAllergy;
-            drugAllergyStr = structureMap.get("药物过敏")+drugAllergyStr;
+            drugAllergy = structureMap.get("过敏药物") + drugAllergy;
+            drugAllergyStr = structureMap.get("药物过敏") + drugAllergyStr;
         }
-            //查医嘱
-            List<DoctorAdviceDoc> doctorAdviceDocs = inputInfo.getDoctorAdviceDocs();
-            for (DoctorAdviceDoc doctorAdviceDoc : doctorAdviceDocs) {
-                Map<String, String> structureMap = doctorAdviceDoc.getStructureMap();
-                String daStatus = structureMap.get(Content.doctorAdviceState);
-                if (StringUtil.isNotEmpty(daStatus)) {
-                    if (!Content.cancellationOrderList.contains(daStatus)) {
-                        String adviceType = structureMap.get(Content.doctorAdviceType);
-                        String drugType = structureMap.get(Content.drugType);
-                        //取长期和临时医嘱
-                        if (adviceType.equals(Content.statOrder) || adviceType.equals(Content.standingOrder)) {
-                            //取医嘱药品类型为抗生素的医嘱
-                            if (StringUtil.isNotEmpty(drugType)) {
-                                if(drugType.equals("抗生素")) {
-                                    String daItemName = structureMap.get(Content.medicalOrderName);
-                                    for (String antimicrobialDrug : antimicrobialDrugList) {
-                                        if (daItemName.contains(antimicrobialDrug)) {
-                                            //排除过敏药物的情况
-                                            if ((StringUtil.isEmpty(drugAllergy) || drugAllergy.equals("")) && (StringUtil.isEmpty(drugAllergyStr) || drugAllergyStr.equals(""))) {
-                                                flag = true;
-                                                break;
-                                            }
-                                            if (!drugAllergy.contains(antimicrobialDrug) && !drugAllergyStr.contains(antimicrobialDrug)) {
-                                                flag = true;
-                                                break;
-                                            }
+        //查医嘱
+        List<DoctorAdviceDoc> doctorAdviceDocs = inputInfo.getDoctorAdviceDocs();
+        for (DoctorAdviceDoc doctorAdviceDoc : doctorAdviceDocs) {
+            Map<String, String> structureMap = doctorAdviceDoc.getStructureMap();
+            String daStatus = structureMap.get(Content.doctorAdviceState);
+            if (StringUtil.isNotEmpty(daStatus)) {
+                if (!Content.cancellationOrderList.contains(daStatus)) {
+                    String adviceType = structureMap.get(Content.doctorAdviceType);
+                    String drugType = structureMap.get(Content.drugType);
+                    //取长期和临时医嘱
+                    if (adviceType.equals(Content.statOrder) || adviceType.equals(Content.standingOrder)) {
+                        //取医嘱药品类型为抗生素的医嘱
+                        if (StringUtil.isNotEmpty(drugType)) {
+                            if (drugType.equals("抗生素")) {
+                                String daItemName = structureMap.get(Content.medicalOrderName);
+                                for (String antimicrobialDrug : antimicrobialDrugList) {
+                                    if (daItemName.contains(antimicrobialDrug)) {
+                                        //排除过敏药物的情况
+                                        if ((StringUtil.isEmpty(drugAllergy) || drugAllergy.equals("")) && (StringUtil.isEmpty(drugAllergyStr) || drugAllergyStr.equals(""))) {
+                                            flag = true;
+                                            break;
+                                        }
+                                        if (!drugAllergy.contains(antimicrobialDrug) && !drugAllergyStr.contains(antimicrobialDrug)) {
+                                            flag = true;
+                                            break;
                                         }
                                     }
                                 }
@@ -77,25 +84,26 @@ public class THR03122 extends QCCatalogue {
                     }
                 }
             }
-            //查房记录
-        if(ListUtil.isNotEmpty(threeLevelWardDocs)) {
+        }
+        //查房记录
+        if (ListUtil.isNotEmpty(threeLevelWardDocs)) {
             List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
             for (ThreeLevelWardDoc allDoctorWradDoc : allDoctorWradDocs) {
                 String illness = allDoctorWradDoc.getStructureMap().get(Content.illnessRecords);
                 for (String antimicrobialDrug : antimicrobialDrugList) {
                     if (illness.contains(antimicrobialDrug)) {
-                        if((StringUtil.isEmpty(drugAllergy)||drugAllergy.equals(""))&&(StringUtil.isEmpty(drugAllergyStr)||drugAllergyStr.equals(""))){
+                        if ((StringUtil.isEmpty(drugAllergy) || drugAllergy.equals("")) && (StringUtil.isEmpty(drugAllergyStr) || drugAllergyStr.equals(""))) {
                             flag = true;
                             break;
                         }
-                        if(!drugAllergy.contains(antimicrobialDrug)&&!drugAllergyStr.contains(antimicrobialDrug)){
-                            flag=true;
+                        if (!drugAllergy.contains(antimicrobialDrug) && !drugAllergyStr.contains(antimicrobialDrug)) {
+                            flag = true;
                             break;
                         }
                     }
                 }
                 for (String cfAntibacterial : cfAntibacterialList) {
-                    if(illness.contains(cfAntibacterial)){
+                    if (illness.contains(cfAntibacterial)) {
                         flag = true;
                         break;
                     }
@@ -120,7 +128,7 @@ public class THR03122 extends QCCatalogue {
                                 }
                             }
                             for (String cfAntibacterial : cfAntibacterialList) {
-                                if(illnessRecords.contains(cfAntibacterial)){
+                                if (illnessRecords.contains(cfAntibacterial)) {
                                     status.set("0");
                                     return;
                                 }
@@ -128,6 +136,39 @@ public class THR03122 extends QCCatalogue {
                         }
                     }
                 }
+            } else if (firstCourseRecordDoc != null) {
+                if (StringUtil.isNotBlank(firstCourseRecordDoc.getText())) {
+                    if (RegexUtil.getRegexListRes(firstCourseRecordDoc.getText(), antimicrobialDrugList)
+                            || RegexUtil.getRegexListRes(firstCourseRecordDoc.getText(), cfAntibacterialList)) {
+                        status.set("0");
+                        return;
+                    }
+                }
+            } else if (ListUtil.isNotEmpty(operationDocList)) {
+                List<String> operativeFindingsList = operationDocList.stream()
+                        .map(OperationDoc::getOperationDiscussionDoc)
+                        .filter(Objects::nonNull)
+                        .filter(i -> i.getOperationDiscussionLabel() != null && StringUtil.isNotBlank(i.getOperationDiscussionLabel().getOperativeFindings()))
+                        .map(i -> i.getOperationDiscussionLabel().getOperativeFindings())
+                        .collect(Collectors.toList());
+
+                if (ListUtil.isNotEmpty(operativeFindingsList)) {
+                    for (String str : operativeFindingsList) {
+                        if (RegexUtil.getRegexListRes(str, antimicrobialDrugList)
+                                || RegexUtil.getRegexListRes(str, cfAntibacterialList)) {
+                            status.set("0");
+                            return;
+                        }
+                    }
+                }
+            } else if (leaveHospitalDoc != null) {
+                if (leaveHospitalDoc.getStructureMap() != null && StringUtil.isNotBlank(leaveHospitalDoc.getStructureMap().get("诊疗经过"))) {
+                    if (RegexUtil.getRegexListRes(leaveHospitalDoc.getStructureMap().get("诊疗经过"), antimicrobialDrugList)
+                            || RegexUtil.getRegexListRes(leaveHospitalDoc.getStructureMap().get("诊疗经过"), cfAntibacterialList)) {
+                        status.set("0");
+                        return;
+                    }
+                }
             }
         }
     }