|
@@ -0,0 +1,110 @@
|
|
|
+package com.lantone.qc.kernel.catalogue.threelevelward;
|
|
|
+
|
|
|
+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.util.ListUtil;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @ClassName : THR0602
|
|
|
+ * @Description : 主治医师在术后48小时内无查房记录
|
|
|
+ * @Author : 胡敬
|
|
|
+ * @Date: 2020-03-30 14:03
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class THR0602 extends QCCatalogue {
|
|
|
+ public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
+ status.set("0");
|
|
|
+ List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
|
+ List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
|
|
|
+ if (ListUtil.isEmpty(operationDocs) || ListUtil.isEmpty(threeLevelWardDocs)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (OperationDoc operationDoc : operationDocs) {
|
|
|
+ OperationRecordDoc operationRecordDoc = operationDoc.getOperationRecordDoc();
|
|
|
+ if (operationRecordDoc == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<String, String> operationRecordStructureMap = operationRecordDoc.getStructureMap();
|
|
|
+ String operationEndDateStr = operationRecordStructureMap.get("手术结束时间");
|
|
|
+ if (CatalogueUtil.isEmpty(operationEndDateStr)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<String, String> doctorRecord = extractWardRecord(
|
|
|
+ threeLevelWardDocs,
|
|
|
+ operationEndDateStr,
|
|
|
+ 48 * 60);
|
|
|
+ if (!doctorRecord.containsKey(Content.indications)) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 抽取住院duration分钟内查房记录并取第一条主治医师查房记录以及第一条主任/副主任医师查房记录
|
|
|
+ *
|
|
|
+ * @param threeLevelWardDocs
|
|
|
+ * @param admisTime
|
|
|
+ * @param duration
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private static Map<String, String> extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs, String admisTime, int duration) {
|
|
|
+ Map<Date, String> dateRecord = new HashMap<>();
|
|
|
+ List<String> sortRecord = new ArrayList<>();
|
|
|
+ Map<String, String> doctorRecord = new HashMap<>();
|
|
|
+ String recordTime = "";
|
|
|
+ Date admisDate = StringUtil.parseDateTime(admisTime);
|
|
|
+ if (admisDate == null) {
|
|
|
+ return doctorRecord;
|
|
|
+ }
|
|
|
+ for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
|
|
|
+ Map<String, String> threeLevelWardStructureMap = threeLevelWardDoc.getStructureMap();
|
|
|
+ recordTime = threeLevelWardStructureMap.get("查房日期");
|
|
|
+ Date recordDate = StringUtil.parseDateTime(recordTime);
|
|
|
+ if (recordDate == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (admisDate.before(recordDate) && !CatalogueUtil.compareTime(admisDate, recordDate, Long.valueOf(duration))) {
|
|
|
+ String wardTitle = threeLevelWardStructureMap.get("查房标题");
|
|
|
+ wardTitle = StringUtil.isBlank(wardTitle) ? "" : wardTitle;
|
|
|
+ dateRecord.put(recordDate, wardTitle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dateRecord.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEachOrdered(
|
|
|
+ x -> sortRecord.add(x.getValue())
|
|
|
+ );
|
|
|
+ //按时间排好序查房记录的第一条主治医师查房记录存进doctorRecord
|
|
|
+ for (String record : sortRecord) {
|
|
|
+ if (!CatalogueUtil.subTitle(record).contains(Content.indications)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ doctorRecord.put(Content.indications, record);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ //按时间排好序查房记录的第一条主任医师/副主任医师查房记录存进doctorRecord
|
|
|
+ for (String record : sortRecord) {
|
|
|
+ if (!CatalogueUtil.subTitle(record).contains(Content.director)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ doctorRecord.put(Content.director, record);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return doctorRecord;
|
|
|
+ }
|
|
|
+}
|