|
@@ -50,7 +50,10 @@ public class THR03079 extends QCCatalogue {
|
|
|
if (doctorAdviceDocs.size() == 0 || threeLevelWardDocs.size() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+ List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
|
|
|
+ if (allDoctorWradDocs.size() == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
Map<Date, String> extData = null;
|
|
|
if (outputInfo.getResult().get("THR02986") != null) {
|
|
|
extData = (Map<Date, String>) outputInfo.getResult().get("THR02986").get("extData");
|
|
@@ -85,7 +88,6 @@ public class THR03079 extends QCCatalogue {
|
|
|
if (extData != null && extData.containsKey(startDate) && extData.get(startDate).equals(drugName)) {
|
|
|
continue; //THR02986 医嘱有激素使用病程无记录,规则中没报未记录的激素继续走这条规则,报未记录的激素过滤
|
|
|
}
|
|
|
-// startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
|
|
|
if (antibioticDateTimes.get(drugName) != null) {
|
|
|
if (antibioticDateTimes.get(drugName).get(startDate) != null && antibioticDateTimes.get(drugName).get(startDate) > 0) {
|
|
|
continue; //一天内同一激素开过多次的激素直接过滤
|
|
@@ -100,8 +102,10 @@ public class THR03079 extends QCCatalogue {
|
|
|
//激素及开医嘱时间 <激素名,<激素用量,[激素使用时间...]>>
|
|
|
Map<String, Map<String, List<Double>>> antibioticWardInfo = Maps.newLinkedHashMap();
|
|
|
String dateStr = null;
|
|
|
+ Map<String, Date> mapInfo = Maps.newLinkedHashMap();
|
|
|
/*********************************************首程治疗计划********************************************************/
|
|
|
if (firstCourseRecordDoc != null) {
|
|
|
+ getInfo(mapInfo, firstCourseRecordDoc.getStructureMap(), "首次病程录", "记录时间", "治疗计划");
|
|
|
DrugLabel drugLabel = firstCourseRecordDoc.getDrugLabel();
|
|
|
dateStr = firstCourseRecordDoc.getStructureMap().get("记录时间");
|
|
|
if (drugLabel != null && StringUtil.isNotBlank(dateStr)) {
|
|
@@ -110,18 +114,12 @@ public class THR03079 extends QCCatalogue {
|
|
|
}
|
|
|
}
|
|
|
/*********************************************查房记录********************************************************/
|
|
|
- if (threeLevelWardDocs.size() > 0) {
|
|
|
- List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
|
|
|
- for (ThreeLevelWardDoc doc : allDoctorWradDocs) {
|
|
|
- if (doc.getThreeLevelWardLabel().size() == 0) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- dateStr = doc.getStructureMap().get("查房日期");
|
|
|
- ThreeLevelWardLabel label = doc.getThreeLevelWardLabel().get(0);
|
|
|
- List<Drug> drugs = label.getDrugs();
|
|
|
- getCourseDrugInfo(antibioticWardInfo, drugs, dateStr);
|
|
|
- }
|
|
|
- }
|
|
|
+ List<ThreeLevelWardDoc> wardDocs = allDoctorWradDocs
|
|
|
+ .stream()
|
|
|
+ .filter(x -> StringUtil.isNotBlank(x.getStructureMap().get("查房日期")) && x.getThreeLevelWardLabel().size() > 0)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ wardDocs.forEach(x -> getInfo(mapInfo, x.getStructureMap(), "查房记录", "查房日期", "病情记录", "治疗计划和措施"));
|
|
|
+ wardDocs.forEach(x -> getCourseDrugInfo(antibioticWardInfo, x.getThreeLevelWardLabel().get(x.getThreeLevelWardLabel().size() - 1).getDrugs(), x.getStructureMap().get("查房日期")));
|
|
|
/**********************************************手术记录、术后首程************************************************/
|
|
|
if (operationDocs.size() > 0) {
|
|
|
//手术记录
|
|
@@ -131,13 +129,16 @@ public class THR03079 extends QCCatalogue {
|
|
|
.filter(Objects::nonNull)
|
|
|
.filter(x -> x.getOperationRecordLabel() != null && StringUtil.isNotBlank(x.getStructureMap().get("病历日期")))
|
|
|
.collect(Collectors.toList());
|
|
|
+ operationRecordDocs.forEach(x -> getInfo(mapInfo, x.getStructureMap(), "手术记录", "病历日期", "手术经过"));
|
|
|
operationRecordDocs.forEach(x -> getCourseDrugInfo(antibioticWardInfo, x.getOperationRecordLabel().getDrugs(), x.getStructureMap().get("病历日期")));
|
|
|
+ //术后首程
|
|
|
List<OperationDiscussionDoc> operationDiscussionDocs = operationDocs
|
|
|
.stream()
|
|
|
.map(OperationDoc::getOperationDiscussionDoc)
|
|
|
.filter(Objects::nonNull)
|
|
|
.filter(x -> x.getOperationDiscussionLabel() != null && StringUtil.isNotBlank(x.getStructureMap().get("记录日期")))
|
|
|
.collect(Collectors.toList());
|
|
|
+ operationDiscussionDocs.forEach(x -> getInfo(mapInfo, x.getStructureMap(), "术后首程", "记录日期", "手术经过", "治疗计划和措施"));
|
|
|
operationDiscussionDocs.forEach(x -> getCourseDrugInfo(antibioticWardInfo, x.getOperationDiscussionLabel().getDrugs(), x.getStructureMap().get("记录日期")));
|
|
|
}
|
|
|
/*********************************************会诊结果单********************************************************/
|
|
@@ -152,9 +153,11 @@ public class THR03079 extends QCCatalogue {
|
|
|
}*/
|
|
|
/*********************************************出院小结********************************************************/
|
|
|
if (leaveHospitalDoc != null) {
|
|
|
+ getInfo(mapInfo, leaveHospitalDoc.getStructureMap(), "出院小结", "出院时间", "诊治经过", "出院带药");
|
|
|
LeaveHospitalLabel leaveHospitalLabel = leaveHospitalDoc.getLeaveHospitalLabel();
|
|
|
dateStr = leaveHospitalDoc.getStructureMap().get("出院时间");
|
|
|
if (leaveHospitalLabel != null && StringUtil.isNotBlank(dateStr)) {
|
|
|
+ getInfo(mapInfo, leaveHospitalDoc.getStructureMap(), "出院小结", "出院时间", "诊治经过", "出院带药");
|
|
|
List<Drug> drugs = leaveHospitalLabel.getDrugs();
|
|
|
getCourseDrugInfo(antibioticWardInfo, drugs, dateStr);
|
|
|
}
|
|
@@ -189,38 +192,79 @@ public class THR03079 extends QCCatalogue {
|
|
|
List<Double> wardUsage = wdvMap.getValue();
|
|
|
adDate = DateUtil.dateZeroClear(adDate);
|
|
|
if (adDate.before(wardDate) && !CatalogueUtil.compareTime(adDate, wardDate, 48 * 60L)) {
|
|
|
- wardUsage.removeAll(adUsage);//比如adUsage有1.0、2.0,wardUsage中有2.0、3.0,removeAll之后wardUsage只剩3.0
|
|
|
- if (wardUsage.size() == 0) {
|
|
|
+ if (wardUsage.toString().equals(adUsage.toString())) {
|
|
|
match = true;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
if (wardDate.before(adDate) && !CatalogueUtil.compareTime(wardDate, adDate, 24 * 60L)) {
|
|
|
boolean isWard = false;
|
|
|
- wardUsage.removeAll(adUsage);//比如adUsage有1.0、2.0,wardUsage中有2.0、3.0,removeAll之后wardUsage只剩3.0
|
|
|
- if (wardUsage.size() == 0) {
|
|
|
+ if (wardUsage.toString().equals(adUsage.toString())) {
|
|
|
isWard = true;
|
|
|
-
|
|
|
}
|
|
|
-// adDateStr = DateUtil.formatDate(adDate);
|
|
|
-// if (!match && wardUsage.size() > 0 && !sb.toString().contains(drugKey + "(" + adDateStr + ")")) {
|
|
|
-// infoAppend(sb, ai.getKey(), adDateStr);
|
|
|
-// }
|
|
|
match = isWard;
|
|
|
}
|
|
|
}
|
|
|
adDateStr = DateUtil.formatDate(adDate);
|
|
|
if (!match && !sb.toString().contains(drugKey + "(" + adDateStr + ")")) {
|
|
|
- infoAppend(sb, ai.getKey(), adDateStr);
|
|
|
+ List<Double> drugDosage = isContinueTreat(adDate, mapInfo, wardDateValue);
|
|
|
+ if (drugDosage == null) {
|
|
|
+ infoAppend(sb, drugKey, adDateStr);
|
|
|
+ } else {
|
|
|
+ drugDosage.removeAll(adUsage);//比如adUsage有1.0、2.0,wardUsage中有2.0、3.0,removeAll之后wardUsage只剩3.0
|
|
|
+ if (drugDosage.size() != 0) {
|
|
|
+ infoAppend(sb, drugKey, adDateStr);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
if (sb.toString().length() > 0) {
|
|
|
status.set("-1");
|
|
|
- info.set("医嘱:" + sb.toString().substring(0, sb.toString().length() - 1));
|
|
|
+ info.set("医嘱:" + sb.toString().substring(0, sb.toString().length() - 1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 记录病程记录中是否有继续治疗,治疗同前等
|
|
|
+ *
|
|
|
+ * @param adDate
|
|
|
+ * @param mapInfo
|
|
|
+ * @param wardDateMaps
|
|
|
+ */
|
|
|
+ private List<Double> isContinueTreat(Date adDate, Map<String, Date> mapInfo, Map<String, List<Double>> wardDateMaps) {
|
|
|
+ for (Map.Entry<String, Date> map : mapInfo.entrySet()) {
|
|
|
+ String content = map.getKey();
|
|
|
+ Date dateValue = map.getValue();
|
|
|
+ //开医嘱时间起,昨天今天明天记录内查找药
|
|
|
+ if ((adDate.before(dateValue) && !CatalogueUtil.compareTime(adDate, dateValue, 48 * 60L))
|
|
|
+ || (dateValue.before(adDate) && !CatalogueUtil.compareTime(dateValue, adDate, 24 * 60L))) {
|
|
|
+ if (regexFind(content, "继续", "治疗") || regexFind(content, "维持", "治疗") || regexFind(content, "继续", "抗感染") ||
|
|
|
+ regexFind(content, "治疗", "同前") || regexFind(content, "治疗同前")) {
|
|
|
+ List<Double> drugDosage = null;
|
|
|
+ for (Map.Entry<String, List<Double>> wdvMap : wardDateMaps.entrySet()) {
|
|
|
+ String wardDateStr = wdvMap.getKey();
|
|
|
+ Date wardDate = StringUtil.parseDateTime(wardDateStr);
|
|
|
+ if (wardDate.before(dateValue)) {
|
|
|
+ drugDosage = wdvMap.getValue();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return drugDosage;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean regexFind(String content, String... str) {
|
|
|
+ String s = "";
|
|
|
+ for (String word : str) {
|
|
|
+ s += word + ".*";
|
|
|
}
|
|
|
+ s = s.substring(0, s.lastIndexOf(".*"));
|
|
|
+ Pattern p = Pattern.compile(s);
|
|
|
+ Matcher m = p.matcher(content);
|
|
|
+ return m.find();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -280,7 +324,27 @@ public class THR03079 extends QCCatalogue {
|
|
|
* @param date
|
|
|
*/
|
|
|
private void infoAppend(StringBuffer sb, String drugKey, String date) {
|
|
|
- sb.append(drugKey).append("(").append(date).append(")").append("、");
|
|
|
+ sb.append(drugKey).append("(").append(date).append(")").append("_");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取各模块信息<入院记录、首次病程录、手术记录、术后首程、会诊结果单、查房记录、出院小结>
|
|
|
+ *
|
|
|
+ * @param info
|
|
|
+ * @param structureMap
|
|
|
+ * @param modelType
|
|
|
+ * @param dateKey
|
|
|
+ * @param contentKey
|
|
|
+ */
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -349,9 +413,4 @@ public class THR03079 extends QCCatalogue {
|
|
|
private static final List<String> filterKey = Lists.newArrayList("静脉滴注", "静脉注射", "口服", "皮下注射", "肌注", "静脉注射(泵)",
|
|
|
"膀胱持续冲洗", "静脉滴注(泵)", "膀胱冲洗", "腹腔注射", "鞘内注射", "关节腔注射", "胸腔注射", "皮内");
|
|
|
|
|
|
- /*private static final List<String> filterKey = Lists.newArrayList("ACF", "ID", "IG", "IM", "IP", "IV",
|
|
|
- "关节腔注射", "宫颈注射", "皮下注射", "皮下注射(儿童)", "皮下注射(免费)", "皮下注射(成人)", "皮内", "皮内注射",
|
|
|
- "结膜下注射", "肌注", "肌肉注射(儿童)", "肌肉注射(公卫专用)", "肌肉注射(成人)", "胸腔注射", "腹腔内注射", "腹腔注射",
|
|
|
- "静滴(儿童)", "静滴(成人)", "静脉注射", "静脉注射(儿童)", "静脉注射(免费)", "静脉注射(成人)", "静脉注射(泵)",
|
|
|
- "静脉滴注", "静脉滴注(泵)", "鞘内注射");*/
|
|
|
}
|