浏览代码

手术患者无术前讨论记录逻辑修改1.如果急诊手术【入院时间-手术开始时间小于30分钟】则可不用写术前小结。2.无1的情况,如果手术记录次数(第一次手术的开始至截止时间内有其他手术不算次数) 大于 术前讨论、术前小结次数,否则则报错

huj 4 年之前
父节点
当前提交
a9ec41f01c
共有 1 个文件被更改,包括 29 次插入46 次删除
  1. 29 46
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/preoperativediscussion/PRE0328.java

+ 29 - 46
kernel/src/main/java/com/lantone/qc/kernel/catalogue/preoperativediscussion/PRE0328.java

@@ -1,6 +1,7 @@
 package com.lantone.qc.kernel.catalogue.preoperativediscussion;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
@@ -29,20 +30,34 @@ public class PRE0328 extends QCCatalogue {
     @Override
     protected void start(InputInfo inputInfo, OutputInfo outputInfo) throws ParseException {
         /**
-         * 如果手术记录次数(第一次手术的日期内有其他手术不算次数) 大于 术前讨论、术前小结次数,则出错
+         * 1:如果急诊手术【入院时间-手术开始时间小于30分钟】则可不用写术前小结。
+         * 2:如果入院时间-手术开始时间小于30分钟,则术前讨论、术前小结次数+1。
+         * 3:如果手术记录次数(第一次手术的日期内有其他手术不算次数) 大于 术前讨论、术前小结次数,则出错
          */
         status.set("0");
         List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
         if (operationDocs == null || operationDocs.size() == 0) {
             return;
         }
-//        if (inputInfo.getBeHospitalizedDoc() != null
-//                && inputInfo.getBeHospitalizedDoc().getStructureMap().get("现病史") != null
-//                && inputInfo.getBeHospitalizedDoc().getStructureMap().get("现病史").matches(".*急诊.*术.*|.*急症.*术.*")) {
-//            return;
-//        }
-//        boolean emergencyOperation = findEmergencyOperation(inputInfo);
-//        boolean emergencyOperationFromWardRecord = findEmergencyOperationFromWardRecord(inputInfo);
+        boolean emergencyOperation = false;
+        if (inputInfo.getBeHospitalizedDoc() != null) {
+            Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
+            String admisTime = beHospitalStructureMap.get("入院日期");
+            //取手术记录第一次手术开始时间和入院时间比较,相差30分钟内不报缺陷
+            OperationRecordDoc operationRecordDoc = operationDocs.get(0).getOperationRecordDoc();
+            String startTime = "";
+            if (operationRecordDoc != null) {
+                startTime = operationRecordDoc.getStructureMap().get("手术开始时间");
+            }
+            if (StringUtil.isNotBlank(startTime) && StringUtil.isNotBlank(admisTime)) {
+                if (!CatalogueUtil.compareTime(
+                        StringUtil.parseDateTime(admisTime),
+                        StringUtil.parseDateTime(startTime),
+                        Long.valueOf(30))) {//入院到手术未超过30分钟,则可不用写术前小结
+                    emergencyOperation = true;
+                }
+            }
+        }
 
         int i = getOperationSum(operationDocs); // 获取手术记录次数
         int j = 0;  // 获取术前讨论、术前小结次数
@@ -51,50 +66,18 @@ public class PRE0328 extends QCCatalogue {
                 j++;
             }
         }
-//        /* 如果首次病程录的诊疗计划里有急诊手术 或 查房记录的病情记录里有急诊手术,则术前小结的数量加1 */
-//        if (emergencyOperation || emergencyOperationFromWardRecord) {
-//            if (j == 0) {
-//                j++;
-//            }
-//        }
+        /* 如果入院时间-手术开始时间小于30分钟,则术前讨论、术前小结次数+1*/
+        if (emergencyOperation) {
+            if (j == 0) {
+                j++;
+            }
+        }
         if (i > 0 && i > j) {
             status.set("-1");
             info.set("手术记录不一致");
         }
     }
 
-//    private boolean findEmergencyOperation(InputInfo inputInfo) {
-//        FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
-//        if (firstCourseRecordDoc != null) {
-//            String treatPlan = firstCourseRecordDoc.getStructureMap().get("诊疗计划");
-//            // 根据医学部要求,加入“急症”和“术”
-//            if (StringUtil.isNotBlank(treatPlan)) {
-//                String regex = ".*急诊.*术.*|.*急症.*术.*";
-//                return treatPlan.matches(regex);
-//            }
-//        }
-//        return false;
-//    }
-//
-//    private boolean findEmergencyOperationFromWardRecord(InputInfo inputInfo) {
-//        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
-//        if (threeLevelWardDocs.size() == 0) {
-//            return false;
-//        }
-//        List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
-//        for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
-//            String content = threeLevelWardDoc.getStructureMap().get("病情记录");
-//            // 根据医学部要求,加入“急症”和“术”
-//            if (StringUtil.isNotBlank(content)) {
-//                String regex = ".*急诊.*术.*|.*急症.*术.*";
-//                if (content.matches(regex)) {
-//                    return true;
-//                }
-//            }
-//        }
-//        return false;
-//    }
-
     /**
      * 获取手术记录次数
      *