|
@@ -0,0 +1,130 @@
|
|
|
+package com.lantone.qc.kernel.catalogue.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.AnesthesiaRelatedDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.operation.OperationDiscussionDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.operation.OperationDoc;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.text.ParseException;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description: 术后首次病程手术开始时间与手麻系统记录不一致
|
|
|
+ * @author: 胡敬
|
|
|
+ * @time: 2020/5/12 10:23
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class OPE0729 extends QCCatalogue {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void start(InputInfo inputInfo, OutputInfo outputInfo) throws ParseException {
|
|
|
+ status.set("0");
|
|
|
+ // boolean isOperativePatient = true;//是手术患者(暂时默认是)
|
|
|
+ // if (isOperativePatient) {
|
|
|
+ List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
|
+ List<AnesthesiaRelatedDoc> anesthesiaRelatedDocs = inputInfo.getAnesthesiaRelatedDocs();
|
|
|
+ if (operationDocs == null || operationDocs.size() == 0
|
|
|
+ || anesthesiaRelatedDocs == null || anesthesiaRelatedDocs.size() == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (AnesthesiaRelatedDoc anesthesiaRelatedDoc : anesthesiaRelatedDocs) {
|
|
|
+ Map<String, String> anesthesiaStructureMap = anesthesiaRelatedDoc.getStructureMap();
|
|
|
+ String anesOperationName = anesthesiaStructureMap.get("手术名称");
|
|
|
+ String anesOperationStartDateStr = anesthesiaStructureMap.get("手术开始时间");
|
|
|
+ if (StringUtil.isBlank(anesOperationName)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ anesOperationName = StringUtil.removeBlank(anesOperationName);
|
|
|
+ if (StringUtil.isBlank(anesOperationStartDateStr)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Date anesOperationStartDate = StringUtil.parseDateTime(anesOperationStartDateStr);
|
|
|
+ if (anesOperationStartDate == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<String, Date> startEndDate = getStartEndDate(operationDocs, anesOperationName);
|
|
|
+ if (startEndDate.get("手术开始时间") != null) {
|
|
|
+ Date operationStartDate = startEndDate.get("手术开始时间");
|
|
|
+ if (!operationStartDate.equals(anesOperationStartDate)) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取手术开始时间和结束时间
|
|
|
+ *
|
|
|
+ * @param operationDocs
|
|
|
+ * @param anesOperationName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Map<String, Date> getStartEndDate(List<OperationDoc> operationDocs, String anesOperationName) {
|
|
|
+ Map<String, Date> startEndDateMap = new HashMap<>();
|
|
|
+ Date startDate = null, endDate = null;
|
|
|
+ for (OperationDoc operationDoc : operationDocs) {
|
|
|
+ OperationDiscussionDoc operationDiscussionDoc = operationDoc.getOperationDiscussionDoc();
|
|
|
+ if (operationDiscussionDoc == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<String, String> operationStructureMap = operationDiscussionDoc.getStructureMap();
|
|
|
+ String operationName = operationStructureMap.get("手术名称");
|
|
|
+ String operationStartDateStr = operationStructureMap.get("手术开始时间");
|
|
|
+ String operationEndDateStr = operationStructureMap.get("手术结束时间");
|
|
|
+ if (StringUtil.isBlank(operationName)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ operationName = StringUtil.removeBlank(operationName);
|
|
|
+ if (withInOneDay(operationStartDateStr, operationEndDateStr)) {
|
|
|
+ if (anesOperationName.contains(operationName)) {
|
|
|
+ Date operationStartDate = StringUtil.parseDateTime(operationStartDateStr);
|
|
|
+ if (startDate == null || operationStartDate.before(startDate)) {
|
|
|
+ startDate = operationStartDate;
|
|
|
+ }
|
|
|
+ Date operationEndDate = StringUtil.parseDateTime(operationEndDateStr);
|
|
|
+ if (endDate == null || operationEndDate.after(endDate)) {
|
|
|
+ endDate = operationEndDate;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (startDate != null) {
|
|
|
+ startEndDateMap.put("手术开始时间", startDate);
|
|
|
+ }
|
|
|
+ if (endDate != null) {
|
|
|
+ startEndDateMap.put("手术结束时间", endDate);
|
|
|
+ }
|
|
|
+ return startEndDateMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 确认手术开始时间->手术结束时间是否为24小时内
|
|
|
+ *
|
|
|
+ * @param firstDateStr
|
|
|
+ * @param secondDateStr
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private boolean withInOneDay(String firstDateStr, String secondDateStr) {
|
|
|
+ if (StringUtil.isBlank(firstDateStr) && StringUtil.isBlank(secondDateStr)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ Date firstDate = StringUtil.parseDateTime(firstDateStr);
|
|
|
+ Date secondDate = StringUtil.parseDateTime(secondDateStr);
|
|
|
+ if (firstDate == null || secondDate == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return firstDate.before(secondDate) && !CatalogueUtil.compareTime(firstDate, secondDate, 24 * 60L);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|