|
@@ -7,10 +7,9 @@ import com.lantone.qc.kernel.util.CatalogueUtil;
|
|
import com.lantone.qc.kernel.util.SimilarityUtil;
|
|
import com.lantone.qc.kernel.util.SimilarityUtil;
|
|
import com.lantone.qc.pub.model.InputInfo;
|
|
import com.lantone.qc.pub.model.InputInfo;
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
import com.lantone.qc.pub.model.OutputInfo;
|
|
-import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
|
|
|
|
-import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
|
|
|
|
-import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
|
|
|
|
-import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
|
|
|
|
|
|
+import com.lantone.qc.pub.model.doc.*;
|
|
|
|
+import com.lantone.qc.pub.model.doc.consultation.ConsultationDoc;
|
|
|
|
+import com.lantone.qc.pub.model.doc.consultation.ConsultationResultsDoc;
|
|
import com.lantone.qc.pub.model.doc.operation.OperationDiscussionDoc;
|
|
import com.lantone.qc.pub.model.doc.operation.OperationDiscussionDoc;
|
|
import com.lantone.qc.pub.model.doc.operation.OperationDoc;
|
|
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.OperationRecordDoc;
|
|
@@ -56,6 +55,8 @@ public class THR02985 extends QCCatalogue {
|
|
FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
|
|
FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
|
|
BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
|
|
BeHospitalizedDoc beHospitalizedDoc = inputInfo.getBeHospitalizedDoc();
|
|
List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
|
|
+ LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
|
|
|
|
+ List<ConsultationDoc> consultationDocs = inputInfo.getConsultationDocs();
|
|
if (doctorAdviceDocs.size() == 0 || threeLevelWardDocs.size() == 0) {
|
|
if (doctorAdviceDocs.size() == 0 || threeLevelWardDocs.size() == 0) {
|
|
status.set("0");
|
|
status.set("0");
|
|
return;
|
|
return;
|
|
@@ -65,8 +66,7 @@ public class THR02985 extends QCCatalogue {
|
|
status.set("0");
|
|
status.set("0");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- Map<Date, String> doctorAdviceDrugMap = new HashMap<>();
|
|
|
|
- String regex = "[()*+-]";
|
|
|
|
|
|
+ Map<Date, String> doctorAdviceDrugMap = Maps.newLinkedHashMap();
|
|
for (DoctorAdviceDoc adviceDoc : doctorAdviceDocs) {
|
|
for (DoctorAdviceDoc adviceDoc : doctorAdviceDocs) {
|
|
Map<String, String> adviceDocStructureMap = adviceDoc.getStructureMap();
|
|
Map<String, String> adviceDocStructureMap = adviceDoc.getStructureMap();
|
|
String name = adviceDocStructureMap.get("医嘱项目名称");
|
|
String name = adviceDocStructureMap.get("医嘱项目名称");
|
|
@@ -90,52 +90,53 @@ public class THR02985 extends QCCatalogue {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //入院记录中找药
|
|
|
|
- String behospContent = null, firstCourseContent = null, operContent = null, afterOperContent = null;
|
|
|
|
- Date behospDate = null, firstCourseDate = null, operDate = null, afterOperDate = null;
|
|
|
|
|
|
+ Map<String, Date> info = Maps.newLinkedHashMap();
|
|
|
|
+ //入院记录中获取信息
|
|
if (beHospitalizedDoc != null) {
|
|
if (beHospitalizedDoc != null) {
|
|
- behospContent = CatalogueUtil.structureMapJoin(beHospitalizedDoc.getStructureMap(), Lists.newArrayList("治疗计划"));
|
|
|
|
- String recordDateStr = firstCourseRecordDoc.getStructureMap().get("入院日期");
|
|
|
|
- if (StringUtil.isNotBlank(recordDateStr)) {
|
|
|
|
- behospDate = StringUtil.parseDateTime(recordDateStr);
|
|
|
|
- }
|
|
|
|
|
|
+ Map<String, String> structureMap = beHospitalizedDoc.getStructureMap();
|
|
|
|
+ getInfo(info, structureMap, "入院记录", "入院日期", "治疗计划");
|
|
}
|
|
}
|
|
- //从首程治疗计划中找药
|
|
|
|
|
|
+ //从首程治疗计划中获取信息
|
|
if (firstCourseRecordDoc != null) {
|
|
if (firstCourseRecordDoc != null) {
|
|
- firstCourseContent = firstCourseRecordDoc.getStructureMap().get("治疗计划");
|
|
|
|
- String recordDateStr = firstCourseRecordDoc.getStructureMap().get("记录时间");
|
|
|
|
- if (StringUtil.isNotBlank(recordDateStr)) {
|
|
|
|
- firstCourseDate = StringUtil.parseDateTime(recordDateStr);
|
|
|
|
- }
|
|
|
|
|
|
+ Map<String, String> structureMap = firstCourseRecordDoc.getStructureMap();
|
|
|
|
+ getInfo(info, structureMap, "首次病程录", "记录时间", "治疗计划");
|
|
}
|
|
}
|
|
|
|
|
|
- Map<String, Date> operInfo = Maps.newHashMap();
|
|
|
|
|
|
+ //从手术记录中获取信息
|
|
if (operationDocs.size() > 0) {
|
|
if (operationDocs.size() > 0) {
|
|
- for (OperationDoc oDoc : operationDocs) {
|
|
|
|
- OperationRecordDoc operationRecordDoc = oDoc.getOperationRecordDoc();
|
|
|
|
- if (operationRecordDoc != null) {
|
|
|
|
- operContent = operationRecordDoc.getStructureMap().get("手术经过");
|
|
|
|
- String operDateStr = operationRecordDoc.getStructureMap().get("病历日期");
|
|
|
|
- if (StringUtil.isNotBlank(operDateStr)) {
|
|
|
|
- operDate = StringUtil.parseDateTime(operDateStr);
|
|
|
|
- }
|
|
|
|
- if (StringUtil.isNotBlank(operContent) && operDate != null) {
|
|
|
|
- operInfo.put(operContent, operDate);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- OperationDiscussionDoc operationDiscussionDoc = oDoc.getOperationDiscussionDoc();
|
|
|
|
- if (operationDiscussionDoc != null) {
|
|
|
|
- afterOperContent = CatalogueUtil.structureMapJoin(operationDiscussionDoc.getStructureMap(),
|
|
|
|
- Lists.newArrayList("手术经过", "治疗计划和措施"));
|
|
|
|
- String operDateStr = operationDiscussionDoc.getStructureMap().get("记录日期");
|
|
|
|
- if (StringUtil.isNotBlank(operDateStr)) {
|
|
|
|
- afterOperDate = StringUtil.parseDateTime(operDateStr);
|
|
|
|
- }
|
|
|
|
- if (StringUtil.isNotBlank(afterOperContent) && afterOperDate != null) {
|
|
|
|
- operInfo.put(afterOperContent, afterOperDate);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ //手术记录
|
|
|
|
+ List<Map<String, String>> operationRecordStructMap = operationDocs
|
|
|
|
+ .stream()
|
|
|
|
+ .map(OperationDoc::getOperationRecordDoc)
|
|
|
|
+ .filter(Objects::nonNull)
|
|
|
|
+ .map(OperationRecordDoc::getStructureMap)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ operationRecordStructMap.forEach(x -> getInfo(info, x, "手术记录", "病历日期", "手术经过"));
|
|
|
|
+ //术后首程
|
|
|
|
+ List<Map<String, String>> operationDiscussionStructMap = operationDocs
|
|
|
|
+ .stream()
|
|
|
|
+ .map(OperationDoc::getOperationDiscussionDoc)
|
|
|
|
+ .filter(Objects::nonNull)
|
|
|
|
+ .map(OperationDiscussionDoc::getStructureMap)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ operationDiscussionStructMap.forEach(x -> getInfo(info, x, "术后首程", "记录日期", "手术经过", "治疗计划和措施"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //从会诊记录中获取信息
|
|
|
|
+ if (consultationDocs.size() > 0) {
|
|
|
|
+ List<Map<String, String>> consultationResultStructMap = consultationDocs
|
|
|
|
+ .stream()
|
|
|
|
+ .map(ConsultationDoc::getConsultationResultsDoc)
|
|
|
|
+ .filter(Objects::nonNull)
|
|
|
|
+ .map(ConsultationResultsDoc::getStructureMap)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ consultationResultStructMap.forEach(x -> getInfo(info, x, "会诊结果单", "会诊日期及时间", "会诊意见"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //从出院小结中获取信息
|
|
|
|
+ if (leaveHospitalDoc != null) {
|
|
|
|
+ Map<String, String> structureMap = leaveHospitalDoc.getStructureMap();
|
|
|
|
+ getInfo(info, structureMap, "出院小结", "出院时间", "诊治经过");
|
|
}
|
|
}
|
|
|
|
|
|
String infoStr = "";
|
|
String infoStr = "";
|
|
@@ -146,30 +147,13 @@ public class THR02985 extends QCCatalogue {
|
|
Set<String> splitDrugs = CatalogueUtil.getRegexWords(drugs, "[((\\[][^\\[\\]()()]+[\\]))]")
|
|
Set<String> splitDrugs = CatalogueUtil.getRegexWords(drugs, "[((\\[][^\\[\\]()()]+[\\]))]")
|
|
.stream().filter(x -> !x.equals("合资") && !x.equals("进口") && !x.equals("国产")).collect(Collectors.toSet());
|
|
.stream().filter(x -> !x.equals("合资") && !x.equals("进口") && !x.equals("国产")).collect(Collectors.toSet());
|
|
String missDrug = "";
|
|
String missDrug = "";
|
|
- //入院记录中找药
|
|
|
|
- if (StringUtil.isNotBlank(behospContent) && behospDate != null) {
|
|
|
|
- missDrug = getMissDrug(behospContent, behospDate, doctorAdviceDate, splitDrugs, 2, missDrug);
|
|
|
|
- if (StringUtil.isBlank(missDrug)) {//文本中已找到该抗生素
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //从首程治疗计划中找药
|
|
|
|
- if (StringUtil.isNotBlank(firstCourseContent) && firstCourseDate != null) {
|
|
|
|
- missDrug = getMissDrug(firstCourseContent, firstCourseDate, doctorAdviceDate, splitDrugs, 2, missDrug);
|
|
|
|
- if (StringUtil.isBlank(missDrug)) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- for (Map.Entry<String, Date> info : operInfo.entrySet()) {
|
|
|
|
- missDrug = getMissDrug(info.getKey(), info.getValue(), doctorAdviceDate, splitDrugs, 2, missDrug);
|
|
|
|
- //当前抗生素药(drugs)在手术记录或术后首次病程录中已找到,直接跳出当前循环
|
|
|
|
|
|
+ for (Map.Entry<String, Date> map : info.entrySet()) {
|
|
|
|
+ missDrug = getMissDrug(map.getKey(), map.getValue(), doctorAdviceDate, splitDrugs, 2, missDrug);
|
|
|
|
+ //当前抗生素药(drugs)在info中已找到,直接跳出当前循环
|
|
if (StringUtil.isBlank(missDrug)) {
|
|
if (StringUtil.isBlank(missDrug)) {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (StringUtil.isBlank(missDrug)) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
boolean modelFind = false;
|
|
boolean modelFind = false;
|
|
int wardNum = 0;
|
|
int wardNum = 0;
|
|
for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
|
|
for (ThreeLevelWardDoc threeLevelWardDoc : allDoctorWradDocs) {
|
|
@@ -205,24 +189,41 @@ public class THR02985 extends QCCatalogue {
|
|
}
|
|
}
|
|
//如果目前所有查房记录都没有
|
|
//如果目前所有查房记录都没有
|
|
if (wardNum == allDoctorWradDocs.size() && CatalogueUtil.compareTime(doctorAdviceDate, new Date(), 48 * 60L)) {
|
|
if (wardNum == allDoctorWradDocs.size() && CatalogueUtil.compareTime(doctorAdviceDate, new Date(), 48 * 60L)) {
|
|
- infoStr = CatalogueUtil.concatInfo(infoStr, splitDrugs.toString().replaceAll("[\\[\\]]", ""));
|
|
|
|
|
|
+ infoStr = CatalogueUtil.concatInfo(infoStr, splitDrugs.toString().replaceAll("[\\[\\]]", "") + "(" + DateUtil.formatDate(doctorAdviceDate) + ")");
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
if (StringUtil.isNotBlank(missDrug) && !"时间不匹配".equals(missDrug) && !modelFind) {
|
|
if (StringUtil.isNotBlank(missDrug) && !"时间不匹配".equals(missDrug) && !modelFind) {
|
|
- infoStr = CatalogueUtil.concatInfo(infoStr, missDrug);
|
|
|
|
|
|
+ infoStr = CatalogueUtil.concatInfo(infoStr, missDrug + "(" + DateUtil.formatDate(doctorAdviceDate) + ")");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (StringUtil.isNotBlank(infoStr)) {
|
|
if (StringUtil.isNotBlank(infoStr)) {
|
|
- status.set("-1");
|
|
|
|
- info.set(infoStr);
|
|
|
|
|
|
+ this.status.set("-1");
|
|
|
|
+ this.info.set(infoStr);
|
|
} else {
|
|
} else {
|
|
- status.set("0");
|
|
|
|
|
|
+ this.status.set("0");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取各模块信息<入院记录、首次病程录、手术记录、术后首程、会诊结果单、查房记录、出院小结>
|
|
|
|
+ *
|
|
|
|
+ * @param structureMap
|
|
|
|
+ * @param info
|
|
|
|
+ */
|
|
|
|
+ private void getInfo(Map<String, Date> info, Map<String, String> structureMap, String modelType, String dateKey, String... contentKey) {
|
|
|
|
+ String content = CatalogueUtil.structureMapJoin(structureMap, Lists.newArrayList(contentKey));
|
|
|
|
+ String recordDateStr = structureMap.get(dateKey);
|
|
|
|
+ if (StringUtil.isNotBlank(recordDateStr)) {
|
|
|
|
+ Date date = StringUtil.parseDateTime(recordDateStr);
|
|
|
|
+ if (StringUtil.isNotBlank(content) && date != null) {
|
|
|
|
+ info.put(modelType + "->" + content, date);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 从文本中找药
|
|
|
|
|
|
+ * 核心:从文本中找药
|
|
*
|
|
*
|
|
* @param content 文本
|
|
* @param content 文本
|
|
* @param wardDate
|
|
* @param wardDate
|