|
@@ -1,6 +1,7 @@
|
|
|
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;
|
|
@@ -9,7 +10,11 @@ import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
|
|
|
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 : THR0136
|
|
@@ -21,8 +26,23 @@ import java.util.List;
|
|
|
public class THR0136 extends QCCatalogue {
|
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
status.set("0");
|
|
|
- if (inputInfo.getThreeLevelWardDocs().size() > 0) {
|
|
|
+ if (inputInfo.getBeHospitalizedDoc() != null && inputInfo.getBeHospitalizedDoc().getStructureMap() != null
|
|
|
+ && inputInfo.getThreeLevelWardDocs().size() > 0) {
|
|
|
+ Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
|
|
|
+ String admisTime = beHospitalStructureMap.get(Content.admisDate);
|
|
|
+ if (CatalogueUtil.isEmpty(admisTime)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
|
|
|
+ Map<String,Map<String, String>> doctorRecord = extractWardRecord(
|
|
|
+ threeLevelWardDocs,
|
|
|
+ admisTime,
|
|
|
+ 72 * 60);
|
|
|
+ if (doctorRecord.containsKey(Content.director)) {
|
|
|
+ if (doctorRecord.get(Content.director).get("病情记录").contains("鉴别诊断")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
|
|
|
ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
|
|
|
if (threeLevelWardLabel == null
|
|
@@ -30,6 +50,9 @@ public class THR0136 extends QCCatalogue {
|
|
|
|| !Content.director.equals(threeLevelWardLabel.getTitle())) {
|
|
|
continue;
|
|
|
}
|
|
|
+ if (threeLevelWardDoc.getText().contains("鉴别诊断")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (threeLevelWardLabel.getDiffDiag().size() == 0 && StringUtil.isBlank(threeLevelWardLabel.getDiffDiagText())) {
|
|
|
status.set("-1");
|
|
|
return;
|
|
@@ -37,4 +60,57 @@ public class THR0136 extends QCCatalogue {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 抽取住院duration分钟内查房记录并取第一条主治医师查房记录以及第一条主任/副主任医师查房记录
|
|
|
+ *
|
|
|
+ * @param threeLevelWardDocs
|
|
|
+ * @param admisTime
|
|
|
+ * @param duration
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private static Map<String, Map<String, String>> extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs, String admisTime, int duration) {
|
|
|
+ Map<Date, Map<String, String>> dateRecord = new HashMap<>();
|
|
|
+ List<Map<String, String>> sortRecord = new ArrayList<>();
|
|
|
+ Map<String, 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))) {
|
|
|
+ if (StringUtil.isBlank(threeLevelWardStructureMap.get("查房标题"))) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ dateRecord.put(recordDate, threeLevelWardStructureMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dateRecord.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEachOrdered(
|
|
|
+ x -> sortRecord.add(x.getValue())
|
|
|
+ );
|
|
|
+ //按时间排好序查房记录的第一条主治医师查房记录存进doctorRecord
|
|
|
+ for (Map<String, String> record : sortRecord) {
|
|
|
+ if (!CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.indications)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ doctorRecord.put(Content.indications, record);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ //按时间排好序查房记录的第一条主任医师/副主任医师查房记录存进doctorRecord
|
|
|
+ for (Map<String, String> record : sortRecord) {
|
|
|
+ if (!CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.director)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ doctorRecord.put(Content.director, record);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return doctorRecord;
|
|
|
+ }
|
|
|
}
|