|
@@ -0,0 +1,129 @@
|
|
|
+package com.lantone.qc.kernel.catalogue.beilun.operationdiscussion;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+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.AnesthesiaRecordDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.operation.OperationDoc;
|
|
|
+import com.lantone.qc.pub.util.DateUtil;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.time.DateUtils;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * @ClassName: OPE03103
|
|
|
+ * @Description: 主刀医师与麻醉记录不一致
|
|
|
+ * @Author songxl
|
|
|
+ * @Date 2021/3/22
|
|
|
+ * @Version 1.0
|
|
|
+ */
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class OPE03103 extends QCCatalogue {
|
|
|
+ public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
+ /**
|
|
|
+ * 1.先去判断手术记录和麻醉记录的主刀医师,如果不一致就直接抛出错误
|
|
|
+ * 2.手术记录和麻醉记录的主刀医师一致,再去和病案首页主刀医师进行比对不一致抛出错误
|
|
|
+ */
|
|
|
+ status.set("0");
|
|
|
+ //1.获取患者的手术相关文档,手麻记录
|
|
|
+ List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
|
+ if(operationDocs==null||operationDocs.isEmpty())//无手术相关记录
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<AnesthesiaRecordDoc> anesthesiaDocs = inputInfo.getAnesthesiaRecordDocs();
|
|
|
+ if(anesthesiaDocs==null|| anesthesiaDocs.isEmpty())//无手麻相关记录
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //2.遍历获取手术记录
|
|
|
+ try{
|
|
|
+ for(OperationDoc operationDoc:operationDocs)
|
|
|
+ {
|
|
|
+ if(operationDoc.getOperationRecordDoc()!=null)
|
|
|
+ {
|
|
|
+ //2.1获取手术主刀医师
|
|
|
+ String doctorName = operationDoc.getOperationRecordDoc().getStructureMap().get("主刀医师");
|
|
|
+ Date operationStartTime = DateUtil.newParseDateTime(operationDoc.getOperationRecordDoc()
|
|
|
+ .getStructureMap().get("手术开始时间"));
|
|
|
+ if(StringUtil.isBlank(doctorName)||operationStartTime==null) {continue;}
|
|
|
+ anesthesiaDocs.forEach(anesthesiaRecordDoc -> {
|
|
|
+ if(anesthesiaRecordDoc.getAnesStartTime()!=null) {
|
|
|
+ if (DateUtils.isSameInstant(operationStartTime, anesthesiaRecordDoc.getAnesStartTime())) {
|
|
|
+ //2.2遍历手麻记录,对比主刀医师
|
|
|
+ if (StringUtil.isNotBlank(anesthesiaRecordDoc.getDoctorName())) {
|
|
|
+ if (!StringUtil.equals(doctorName, anesthesiaRecordDoc.getDoctorName())) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //2.3 手术记录和麻醉记录如果一致判断是否和病案首页是否一致
|
|
|
+ //2.3.1.获取患者的病案首页相关文档,手麻记录
|
|
|
+ FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
|
|
|
+ if(firstPageRecordDoc==null||firstPageRecordDoc.getStructureExtMap().isEmpty()
|
|
|
+ ||firstPageRecordDoc.getStructureExtMap().get("手术信息")==null
|
|
|
+ ||(JSONArray.parseArray(""+firstPageRecordDoc.getStructureExtMap().get("手术信息"))).isEmpty())//无病案首页相关记录或者病案首页无手术记录
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //2.3.2.获取手术信息
|
|
|
+ try {
|
|
|
+ JSONArray operationArr = JSONArray.parseArray("" + firstPageRecordDoc.getStructureExtMap().get("手术信息"));
|
|
|
+ for (Object operationOBJ : operationArr) {
|
|
|
+ JSONObject operationJson = JSONObject.parseObject(operationOBJ + "");
|
|
|
+ if (operationJson != null) {
|
|
|
+ //2.1获取手术麻醉方式
|
|
|
+ Long doctorID = operationJson.getLong("手术医生ID");
|
|
|
+ //通过手术时间判断是否是同一个手术
|
|
|
+ Date firOperationStartTime = DateUtil.newParseDateTime(operationJson.getString("手术日期"));
|
|
|
+ if (doctorID == null) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (operationStartTime == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ //2.2遍历手麻记录,对比手术名称(如果手麻开始时间和病案首页记录时间在3个小时以内则判定为同一台手术)
|
|
|
+ if (CatalogueUtil.compareTime(firOperationStartTime,
|
|
|
+ anesthesiaRecordDoc.getAnesStartTime(),
|
|
|
+ Long.valueOf(2 * 60)))
|
|
|
+ {
|
|
|
+ if(!doctorID.equals(anesthesiaRecordDoc.getDid()))
|
|
|
+ {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ log.error(e.getMessage(),e);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|