|
@@ -20,6 +20,7 @@ import com.lantone.qc.pub.model.doc.operation.OperationRecordDoc;
|
|
import com.lantone.qc.pub.model.entity.Drug;
|
|
import com.lantone.qc.pub.model.entity.Drug;
|
|
import com.lantone.qc.pub.util.DateUtil;
|
|
import com.lantone.qc.pub.util.DateUtil;
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
|
+import org.apache.commons.lang3.time.DateUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@@ -53,11 +54,7 @@ public class THR02986 extends QCCatalogue {
|
|
List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
|
|
LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
|
|
LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
|
|
List<ConsultationDoc> consultationDocs = inputInfo.getConsultationDocs();
|
|
List<ConsultationDoc> consultationDocs = inputInfo.getConsultationDocs();
|
|
- if (doctorAdviceDocs.size() == 0 || threeLevelWardDocs.size() == 0) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
|
|
|
|
- if (allDoctorWradDocs.size() == 0) {
|
|
|
|
|
|
+ if (doctorAdviceDocs.size() == 0) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
List<Map<String, String>> docAdvStruct = doctorAdviceDocs
|
|
List<Map<String, String>> docAdvStruct = doctorAdviceDocs
|
|
@@ -65,7 +62,7 @@ public class THR02986 extends QCCatalogue {
|
|
.filter(Objects::nonNull)
|
|
.filter(Objects::nonNull)
|
|
.map(DoctorAdviceDoc::getStructureMap)
|
|
.map(DoctorAdviceDoc::getStructureMap)
|
|
.filter(x -> StringUtil.isNotBlank(x.get("药品类型")) && x.get("药品类型").contains("激素"))
|
|
.filter(x -> StringUtil.isNotBlank(x.get("药品类型")) && x.get("药品类型").contains("激素"))
|
|
- .filter(x -> StringUtil.isNotBlank(x.get("医嘱状态判别")) && !x.get("医嘱状态判别").contains("已停止"))
|
|
|
|
|
|
+// .filter(x -> StringUtil.isNotBlank(x.get("医嘱状态判别")) && !x.get("医嘱状态判别").contains("已停止"))
|
|
// .filter(x -> StringUtil.isNotBlank(x.get("给药方式")) && x.get("给药方式").contains("静脉滴注"))
|
|
// .filter(x -> StringUtil.isNotBlank(x.get("给药方式")) && x.get("给药方式").contains("静脉滴注"))
|
|
// .filter(x -> StringUtil.isNotBlank(x.get("医嘱频率")) && !x.get("医嘱频率").equals("ONCE"))
|
|
// .filter(x -> StringUtil.isNotBlank(x.get("医嘱频率")) && !x.get("医嘱频率").equals("ONCE"))
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
@@ -82,8 +79,8 @@ public class THR02986 extends QCCatalogue {
|
|
String drugName = adviceDoc.get("医嘱项目名称");
|
|
String drugName = adviceDoc.get("医嘱项目名称");
|
|
String startDateStr = adviceDoc.get("医嘱开始时间");
|
|
String startDateStr = adviceDoc.get("医嘱开始时间");
|
|
if (StringUtil.isNotBlank(drugName)) {
|
|
if (StringUtil.isNotBlank(drugName)) {
|
|
- // startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
|
|
|
|
- startDate = StringUtil.parseDateTime(startDateStr);
|
|
|
|
|
|
+ startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
|
|
|
|
+// startDate = StringUtil.parseDateTime(startDateStr);
|
|
if (antibioticDateTimes.get(drugName).get(startDate) > 0) {
|
|
if (antibioticDateTimes.get(drugName).get(startDate) > 0) {
|
|
continue; //一天内同一抗生素开过多次的抗生素直接过滤
|
|
continue; //一天内同一抗生素开过多次的抗生素直接过滤
|
|
}
|
|
}
|
|
@@ -111,10 +108,10 @@ public class THR02986 extends QCCatalogue {
|
|
}*/
|
|
}*/
|
|
//从首程治疗计划中获取信息
|
|
//从首程治疗计划中获取信息
|
|
if (firstCourseRecordDoc != null) {
|
|
if (firstCourseRecordDoc != null) {
|
|
- getInfo(info, firstCourseRecordDoc.getStructureMap(), "首次病程录", "记录时间", "治疗计划");
|
|
|
|
|
|
+ getInfo(info, firstCourseRecordDoc.getStructureMap(), "首次病程录", "病历日期", "诊疗计划");
|
|
if (firstCourseRecordDoc.getDrugLabel() != null) {
|
|
if (firstCourseRecordDoc.getDrugLabel() != null) {
|
|
List<Drug> drugs = firstCourseRecordDoc.getDrugLabel().getDrugs();
|
|
List<Drug> drugs = firstCourseRecordDoc.getDrugLabel().getDrugs();
|
|
- dateStr = firstCourseRecordDoc.getStructureMap().get("记录时间");
|
|
|
|
|
|
+ dateStr = firstCourseRecordDoc.getStructureMap().get("病历日期");
|
|
if (StringUtil.isNotBlank(dateStr)) {
|
|
if (StringUtil.isNotBlank(dateStr)) {
|
|
getInfo(infoModel, dateStr, drugs);
|
|
getInfo(infoModel, dateStr, drugs);
|
|
}
|
|
}
|
|
@@ -122,13 +119,15 @@ public class THR02986 extends QCCatalogue {
|
|
}
|
|
}
|
|
|
|
|
|
//从查房记录中获取信息
|
|
//从查房记录中获取信息
|
|
- List<ThreeLevelWardDoc> wardDocs = allDoctorWradDocs
|
|
|
|
- .stream()
|
|
|
|
- .filter(x -> StringUtil.isNotBlank(x.getStructureMap().get("查房日期")) && x.getThreeLevelWardLabel().size() > 0)
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
- wardDocs.forEach(x -> getInfo(info, x.getStructureMap(), "查房记录", "查房日期", "病情记录", "治疗计划和措施"));
|
|
|
|
- wardDocs.forEach(x -> getInfo(infoModel, x.getStructureMap().get("查房日期"), x.getThreeLevelWardLabel().get(x.getThreeLevelWardLabel().size() - 1).getDrugs()));
|
|
|
|
-
|
|
|
|
|
|
+ if (threeLevelWardDocs.size() > 0) {
|
|
|
|
+ List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
|
|
|
|
+ List<ThreeLevelWardDoc> wardDocs = allDoctorWradDocs
|
|
|
|
+ .stream()
|
|
|
|
+ .filter(x -> StringUtil.isNotBlank(x.getStructureMap().get("查房日期")) && x.getThreeLevelWardLabel().size() > 0)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ wardDocs.forEach(x -> getInfo(info, x.getStructureMap(), "查房记录", "查房日期", "病情记录", "治疗计划和措施"));
|
|
|
|
+ wardDocs.forEach(x -> getInfo(infoModel, x.getStructureMap().get("查房日期"), x.getThreeLevelWardLabel().get(x.getThreeLevelWardLabel().size() - 1).getDrugs()));
|
|
|
|
+ }
|
|
//从手术记录中获取信息
|
|
//从手术记录中获取信息
|
|
if (operationDocs.size() > 0) {
|
|
if (operationDocs.size() > 0) {
|
|
//手术记录
|
|
//手术记录
|
|
@@ -136,19 +135,19 @@ public class THR02986 extends QCCatalogue {
|
|
.stream()
|
|
.stream()
|
|
.map(OperationDoc::getOperationRecordDoc)
|
|
.map(OperationDoc::getOperationRecordDoc)
|
|
.filter(Objects::nonNull)
|
|
.filter(Objects::nonNull)
|
|
- .filter(x -> x.getOperationRecordLabel() != null && StringUtil.isNotBlank(x.getStructureMap().get("病历日期")))
|
|
|
|
|
|
+ .filter(x -> x.getOperationRecordLabel() != null && StringUtil.isNotBlank(x.getStructureMap().get("手术时间")))
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
- operationRecordDocs.forEach(x -> getInfo(info, x.getStructureMap(), "手术记录", "病历日期", "手术经过"));
|
|
|
|
- operationRecordDocs.forEach(x -> getInfo(infoModel, x.getStructureMap().get("病历日期"), x.getOperationRecordLabel().getDrugs()));
|
|
|
|
|
|
+ operationRecordDocs.forEach(x -> getInfo(info, x.getStructureMap(), "手术记录", "手术时间", "手术经过及处理"));
|
|
|
|
+ operationRecordDocs.forEach(x -> getInfo(infoModel, x.getStructureMap().get("手术时间"), x.getOperationRecordLabel().getDrugs()));
|
|
//术后首程
|
|
//术后首程
|
|
List<OperationDiscussionDoc> operationDiscussionDocs = operationDocs
|
|
List<OperationDiscussionDoc> operationDiscussionDocs = operationDocs
|
|
.stream()
|
|
.stream()
|
|
.map(OperationDoc::getOperationDiscussionDoc)
|
|
.map(OperationDoc::getOperationDiscussionDoc)
|
|
.filter(Objects::nonNull)
|
|
.filter(Objects::nonNull)
|
|
- .filter(x -> x.getOperationDiscussionLabel() != null && StringUtil.isNotBlank(x.getStructureMap().get("记录日期")))
|
|
|
|
|
|
+ .filter(x -> x.getOperationDiscussionLabel() != null && StringUtil.isNotBlank(x.getStructureMap().get("病历日期")))
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
- operationDiscussionDocs.forEach(x -> getInfo(info, x.getStructureMap(), "术后首程", "记录日期", "手术经过", "治疗计划和措施"));
|
|
|
|
- operationDiscussionDocs.forEach(x -> getInfo(infoModel, x.getStructureMap().get("记录日期"), x.getOperationDiscussionLabel().getDrugs()));
|
|
|
|
|
|
+ operationDiscussionDocs.forEach(x -> getInfo(info, x.getStructureMap(), "术后首程", "病历日期", "手术简要经过", "术后处理措施"));
|
|
|
|
+ operationDiscussionDocs.forEach(x -> getInfo(infoModel, x.getStructureMap().get("病历日期"), x.getOperationDiscussionLabel().getDrugs()));
|
|
}
|
|
}
|
|
|
|
|
|
//从会诊记录中获取信息
|
|
//从会诊记录中获取信息
|
|
@@ -165,12 +164,18 @@ public class THR02986 extends QCCatalogue {
|
|
|
|
|
|
//从出院小结中获取信息
|
|
//从出院小结中获取信息
|
|
if (leaveHospitalDoc != null) {
|
|
if (leaveHospitalDoc != null) {
|
|
- getInfo(info, leaveHospitalDoc.getStructureMap(), "出院小结", "出院时间", "诊治经过", "出院带药");
|
|
|
|
- if (leaveHospitalDoc.getLeaveHospitalLabel() != null) {
|
|
|
|
- List<Drug> drugs = leaveHospitalDoc.getLeaveHospitalLabel().getDrugs();
|
|
|
|
- dateStr = leaveHospitalDoc.getStructureMap().get("出院时间");
|
|
|
|
- if (StringUtil.isNotBlank(dateStr)) {
|
|
|
|
- getInfo(info, leaveHospitalDoc.getStructureMap(), "出院小结", "出院时间", "诊治经过", "出院带药");
|
|
|
|
|
|
+ if (inputInfo.getMedicalRecordInfoDoc() != null) {
|
|
|
|
+ Map<String, String> medicalRecordInfoStructureMap = inputInfo.getMedicalRecordInfoDoc().getStructureMap();
|
|
|
|
+ dateStr = medicalRecordInfoStructureMap.get("leaveHospitalDate");
|
|
|
|
+ //如果存在出院小结,出院日期为空,存储系统当前时间
|
|
|
|
+ if (StringUtil.isBlank(dateStr)) {
|
|
|
|
+ dateStr = DateUtil.formatDateTime(new Date());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isNotBlank(dateStr)) {
|
|
|
|
+ if (leaveHospitalDoc.getLeaveHospitalLabel() != null) {
|
|
|
|
+ List<Drug> drugs = leaveHospitalDoc.getLeaveHospitalLabel().getDrugs();
|
|
|
|
+ getDischargeInfo(info, leaveHospitalDoc.getStructureMap(), "出院小结", dateStr, "诊治经过");
|
|
getInfo(infoModel, dateStr, drugs);
|
|
getInfo(infoModel, dateStr, drugs);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -254,8 +259,8 @@ public class THR02986 extends QCCatalogue {
|
|
for (Map<String, String> structMap : docAdvStruct) {
|
|
for (Map<String, String> structMap : docAdvStruct) {
|
|
drugName = structMap.get("医嘱项目名称");
|
|
drugName = structMap.get("医嘱项目名称");
|
|
startDateStr = structMap.get("医嘱开始时间");
|
|
startDateStr = structMap.get("医嘱开始时间");
|
|
- // startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
|
|
|
|
- startDate = StringUtil.parseDateTime(startDateStr);
|
|
|
|
|
|
+ startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
|
|
|
|
+ // startDate = StringUtil.parseDateTime(startDateStr);
|
|
if (antibioticDateTimes.containsKey(drugName)) {
|
|
if (antibioticDateTimes.containsKey(drugName)) {
|
|
Map<Date, Integer> map = antibioticDateTimes.get(drugName);
|
|
Map<Date, Integer> map = antibioticDateTimes.get(drugName);
|
|
if (map.containsKey(startDate)) {
|
|
if (map.containsKey(startDate)) {
|
|
@@ -272,7 +277,7 @@ public class THR02986 extends QCCatalogue {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 获取各模块信息<入院记录、首次病程录、手术记录、术后首程、会诊结果单、查房记录、出院小结>
|
|
|
|
|
|
+ * 获取各模块信息<入院记录、首次病程录、手术记录、术后首程、会诊结果单、查房记录>
|
|
*
|
|
*
|
|
* @param structureMap
|
|
* @param structureMap
|
|
* @param info
|
|
* @param info
|
|
@@ -288,6 +293,22 @@ public class THR02986 extends QCCatalogue {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取出院小结模块信息
|
|
|
|
+ *
|
|
|
|
+ * @param structureMap
|
|
|
|
+ * @param info
|
|
|
|
+ */
|
|
|
|
+ private void getDischargeInfo(Map<String, Date> info, Map<String, String> structureMap, String modelType, String dateStr, String... contentKey) {
|
|
|
|
+ String content = CatalogueUtil.structureMapJoin(structureMap, Lists.newArrayList(contentKey));
|
|
|
|
+ if (StringUtil.isNotBlank(dateStr)) {
|
|
|
|
+ Date date = StringUtil.parseDateTime(dateStr);
|
|
|
|
+ if (StringUtil.isNotBlank(content) && date != null) {
|
|
|
|
+ info.put(modelType + "->" + content, date);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private void getInfo(Map<String, List<Drug>> info, String dateKey, List<Drug> drugs) {
|
|
private void getInfo(Map<String, List<Drug>> info, String dateKey, List<Drug> drugs) {
|
|
if (info.containsKey(dateKey)) {
|
|
if (info.containsKey(dateKey)) {
|
|
info.get(dateKey).addAll(drugs);
|
|
info.get(dateKey).addAll(drugs);
|
|
@@ -312,7 +333,8 @@ public class THR02986 extends QCCatalogue {
|
|
}
|
|
}
|
|
//开医嘱时间起,昨天今天明天记录内查找药
|
|
//开医嘱时间起,昨天今天明天记录内查找药
|
|
if ((doctorAdviceDate.before(wardDate) && !CatalogueUtil.compareTime(doctorAdviceDate, wardDate, days * 24 * 60L))
|
|
if ((doctorAdviceDate.before(wardDate) && !CatalogueUtil.compareTime(doctorAdviceDate, wardDate, days * 24 * 60L))
|
|
- || (wardDate.before(doctorAdviceDate) && !CatalogueUtil.compareTime(wardDate, doctorAdviceDate, 24 * 60L))) {
|
|
|
|
|
|
+ || (wardDate.before(doctorAdviceDate) && !CatalogueUtil.compareTime(wardDate, doctorAdviceDate, 24 * 60L))
|
|
|
|
+ || DateUtils.isSameDay(wardDate, doctorAdviceDate)) {
|
|
boolean findDrug = false;
|
|
boolean findDrug = false;
|
|
String standardDrug = null;
|
|
String standardDrug = null;
|
|
for (String drug : drugs) {
|
|
for (String drug : drugs) {
|