|
@@ -0,0 +1,201 @@
|
|
|
|
+package com.lantone.qc.kernel.catalogue.threelevelward;
|
|
|
|
+
|
|
|
|
+import com.lantone.qc.dbanaly.util.KernelConstants;
|
|
|
|
+import com.lantone.qc.dbanaly.util.SpecialStorageUtil;
|
|
|
|
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
|
|
+import com.lantone.qc.kernel.util.CatalogueUtil;
|
|
|
|
+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.ThreeLevelWardDoc;
|
|
|
|
+import com.lantone.qc.pub.model.doc.operation.OperationDoc;
|
|
|
|
+import com.lantone.qc.pub.model.doc.operation.OperationRecordDoc;
|
|
|
|
+import com.lantone.qc.pub.model.doc.operation.PreoperativeDiscussionDoc;
|
|
|
|
+import com.lantone.qc.pub.util.ListUtil;
|
|
|
|
+import com.lantone.qc.pub.util.SpringContextUtil;
|
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @ClassName : THR03139
|
|
|
|
+ * @Description : 术前主刀查房记录无主刀医师查房意见
|
|
|
|
+ * @Author : rengb
|
|
|
|
+ * @Date: 2020-03-06 17:28
|
|
|
|
+ */
|
|
|
|
+@Component
|
|
|
|
+public class THR03139 extends QCCatalogue {
|
|
|
|
+ /**
|
|
|
|
+ * 查房记录内找是否有标题【术前*查房】,找到则判断记录内是否包含【主刀/分析/指出/认为/指示】或【主刀医师名字】:p8
|
|
|
|
+ * p8:【手术记录单/术前讨论、术前小结】内【手术医师/主刀医师签名】
|
|
|
|
+ *
|
|
|
|
+ * @param inputInfo
|
|
|
|
+ * @param outputInfo
|
|
|
|
+ */
|
|
|
|
+ public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
|
+ status.set("0");
|
|
|
|
+ int preoperativeNum=0;
|
|
|
|
+ int opinionNum=0;
|
|
|
|
+ List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
|
|
|
|
+ if (ListUtil.isEmpty(threeLevelWardDocs) || threeLevelWardDocs.size() == 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
|
|
|
|
+ if (ListUtil.isEmpty(allDoctorWradDocs) || allDoctorWradDocs.size() == 0) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ //获取手术记录
|
|
|
|
+ List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
|
|
+ //所有查房
|
|
|
|
+ //可能有多次手术,每次手术前查房都要符合,则需要走完所有的查房,并记录次数
|
|
|
|
+ for (ThreeLevelWardDoc allDoctorWradDoc : allDoctorWradDocs) {
|
|
|
|
+ Map<String, String> docStructureMap = allDoctorWradDoc.getStructureMap();
|
|
|
|
+ if (docStructureMap == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String wardRoundTitle = docStructureMap.get("查房标题");
|
|
|
|
+ if (StringUtil.isBlank(wardRoundTitle)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String rex = "[\\s\\S]*(?=术前)[\\s\\S]*(?=查房)[\\s\\S]*";
|
|
|
|
+ if (wardRoundTitle.matches(rex)) {
|
|
|
|
+ status.set("-1");
|
|
|
|
+ preoperativeNum++;
|
|
|
|
+ //为术前查房,判断记录内是否包含【主刀/分析/指出/认为/指示】或【主刀医师名字】
|
|
|
|
+ String illnessRecords = docStructureMap.get("病情记录");
|
|
|
|
+ if (StringUtil.isBlank(illnessRecords)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ List<String> cfButcherOpinionList = Content.cfButcherOpinionList;
|
|
|
|
+ for (String cfButcherOpinion : cfButcherOpinionList) {
|
|
|
|
+ if (illnessRecords.contains(cfButcherOpinion)) {
|
|
|
|
+ opinionNum++;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String recordTime = docStructureMap.get("查房日期");
|
|
|
|
+ if(StringUtil.isBlank(recordTime)){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Date recordDate = StringUtil.parseDateTime(recordTime);
|
|
|
|
+ //获取手术记录
|
|
|
|
+ if(ListUtil.isEmpty(operationDocs) || operationDocs.size()==0){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String doctorName = getButcherDoctorName(operationDocs, recordDate);
|
|
|
|
+ if(StringUtil.isNotBlank(doctorName)) {
|
|
|
|
+ //包含主刀医师名字
|
|
|
|
+ if (illnessRecords.contains(doctorName)) {
|
|
|
|
+ opinionNum++;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //获取术前讨论
|
|
|
|
+ String discussDoctorName = getDiscussDoctorName(operationDocs, recordDate);
|
|
|
|
+ if(StringUtil.isNotBlank(discussDoctorName)) {
|
|
|
|
+ if (illnessRecords.contains(discussDoctorName)) {
|
|
|
|
+ opinionNum++;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(preoperativeNum==opinionNum){
|
|
|
|
+ status.set("0");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取距离查房最近一次手术主刀医师名字
|
|
|
|
+ public static String getButcherDoctorName(List<OperationDoc> operationDocs, Date recordDate) {
|
|
|
|
+ /* 用于存放手术结束时间距离查房时间最近的一次时间差 */
|
|
|
|
+ String title = "";
|
|
|
|
+ long timeDiff = 0L;
|
|
|
|
+ for (OperationDoc operationDoc : operationDocs) {
|
|
|
|
+ OperationRecordDoc operationRecordDoc = operationDoc.getOperationRecordDoc();
|
|
|
|
+ if (operationRecordDoc == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Map<String, String> structureMap = operationRecordDoc.getStructureMap();
|
|
|
|
+ if (structureMap == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String operatorEndTimeStr = structureMap.get("手术结束时间");
|
|
|
|
+ if (StringUtil.isBlank(operatorEndTimeStr)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Date operatorEndDate = StringUtil.parseDateTime(operatorEndTimeStr);
|
|
|
|
+ if (operatorEndDate != null) {
|
|
|
|
+ //若是查房时间晚于手术结束时间则跳过
|
|
|
|
+ if (operatorEndDate.before(recordDate)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ long timeDifference = CatalogueUtil.timeDifference(operatorEndDate, recordDate);
|
|
|
|
+ if (timeDifference == 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (timeDiff == 0 || timeDiff > timeDifference) {
|
|
|
|
+ /* 取距离此次主刀医师查房最近的一次手术时间 */
|
|
|
|
+ timeDiff = timeDifference;
|
|
|
|
+ String butcherPhysicians = structureMap.get("主刀医师");
|
|
|
|
+ String butcherPhysiciansSignature = structureMap.get("主刀医师签名");
|
|
|
|
+ if (StringUtil.isNotEmpty(butcherPhysicians)) {
|
|
|
|
+ title = butcherPhysicians;
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isNotEmpty(butcherPhysiciansSignature)) {
|
|
|
|
+ title = butcherPhysiciansSignature;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return title;
|
|
|
|
+ }
|
|
|
|
+ //获取距离查房最近一次手术术前讨论主刀医师名字
|
|
|
|
+ public static String getDiscussDoctorName(List<OperationDoc> operationDocs, Date recordDate) {
|
|
|
|
+ /* 用于存放术前讨论时间距离查房时间最近的一次时间差 */
|
|
|
|
+ String title = "";
|
|
|
|
+ long timeDiff = 0L;
|
|
|
|
+ for (OperationDoc operationDoc : operationDocs) {
|
|
|
|
+ PreoperativeDiscussionDoc preoperativeDiscussionDoc = operationDoc.getPreoperativeDiscussionDoc();
|
|
|
|
+ if (preoperativeDiscussionDoc == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Map<String, String> structureMap = preoperativeDiscussionDoc.getStructureMap();
|
|
|
|
+ if (structureMap == null) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String discussionTime = structureMap.get("讨论时间");
|
|
|
|
+ if (StringUtil.isBlank(discussionTime)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Date discussionDate = StringUtil.parseDateTime(discussionTime);
|
|
|
|
+ if (discussionDate != null) {
|
|
|
|
+ //若是查房时间晚于术前讨论结束时间则跳过
|
|
|
|
+ if (discussionDate.before(recordDate)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ long timeDifference = CatalogueUtil.timeDifference(discussionDate, recordDate);
|
|
|
|
+ if (timeDifference == 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (timeDiff == 0 || timeDiff > timeDifference) {
|
|
|
|
+ /* 取距离此次主刀医师查房最近的一次手术时间 */
|
|
|
|
+ timeDiff = timeDifference;
|
|
|
|
+ String theHostName = structureMap.get("主持人");
|
|
|
|
+ String butcherPhysiciansSignature = structureMap.get("主刀医师签名");
|
|
|
|
+ if (StringUtil.isNotEmpty(theHostName)) {
|
|
|
|
+ title = theHostName;
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isNotEmpty(butcherPhysiciansSignature)) {
|
|
|
|
+ title = butcherPhysiciansSignature;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return title;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|