Kaynağa Gözat

北仑: 手术患者缺术前主刀医师查房记录

huj 4 yıl önce
ebeveyn
işleme
5414b5fecd

+ 88 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/beilun/operationdiscussion/OPE0369.java

@@ -0,0 +1,88 @@
+package com.lantone.qc.kernel.catalogue.beilun.operationdiscussion;
+
+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.ThreeLevelWardDoc;
+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.text.ParseException;
+import java.util.*;
+
+/**
+ * @Description: 手术患者缺术前主刀医师查房记录
+ * @author: WANGSY
+ * @time: 2020/11/11 11:22
+ */
+@Component
+public class OPE0369 extends QCCatalogue {
+
+    @Override
+    protected void start(InputInfo inputInfo, OutputInfo outputInfo) throws ParseException {
+        status.set("0");
+        //先判断是否有手术记录
+        List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
+        if (operationDocs == null || operationDocs.size() == 0) {
+            return;
+        }
+        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+        long operationCount = operationDocs.stream().filter(operationDoc -> operationDoc.getOperationRecordDoc() != null).count();
+        //主刀查房次数
+        long operateCount = 0;
+        if (operationCount > 0) {
+            //存在手术记录无查房记录
+            if (ListUtil.isEmpty(threeLevelWardDocs)) {
+                status.set("-1");
+                return;
+            }
+//            Map<Date, String> operationDateNameMap = Maps.newLinkedHashMap();
+            List<Date> operDateList = new ArrayList<>();
+            for (OperationDoc operationDoc : operationDocs) {
+                if (operationDoc.getOperationRecordDoc() != null) {
+                    Map<String, String> operationDocStructureMap = operationDoc.getOperationRecordDoc().getStructureMap();
+                    String operationStartDate = operationDocStructureMap.get("手术开始时间");
+                    if (StringUtil.isNotBlank(operationStartDate)) {
+                        operDateList.add(StringUtil.parseDateTime(operationStartDate));
+                    }
+//                    String operatorName = operationDocStructureMap.get("主刀医师");
+//                    if (StringUtil.isBlank(operatorName) && StringUtil.isNotBlank(operationDocStructureMap.get("手术者及助手名称"))) {
+//                        operatorName = operationDocStructureMap.get("手术者及助手名称").split("、")[0];
+//                        if (operatorName.contains("主刀:") && operatorName.split(":").length > 1) {
+//                            operatorName = operatorName.split(":")[1];
+//                        }
+//                    }
+//                    if (StringUtil.isNotBlank(operationStartDate) && StringUtil.isNotBlank(operatorName)) {
+//                        operationDateNameMap.put(StringUtil.parseDateTime(operationStartDate), operatorName);
+//                    }
+                }
+            }
+            if (operDateList.size() > 1) {
+                for (int i = 0; i < operDateList.size(); i++) {
+                    if (CatalogueUtil.compareTime(operDateList.get(i), operDateList.get(i + 1),
+                            Long.valueOf(24 * 60))) {//如果手术记录是同一天,需有一次术前主刀查房
+                        operationCount--;
+                    }
+                }
+            }
+
+            ThreeLevelWardDoc threeLevelWardDoc = threeLevelWardDocs.get(0);
+            List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();
+            for (ThreeLevelWardDoc threeLevelWard : allDoctorWradDocs) {
+                Map<String, String> structureMap = threeLevelWard.getStructureMap();
+                String makeTitle = structureMap.get("查房标题");
+                if (makeTitle.contains("术前主刀")) {
+                    operateCount++;
+                }
+            }
+        }
+
+        if (operationCount != operateCount) {
+            status.set("-1");
+            return;
+        }
+    }
+}