|
@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
|
|
|
/**
|
|
|
* @author HUJING
|
|
|
* @create 2020-08-28 14:10
|
|
|
- * @desc 病程中未记录抗生素用量
|
|
|
+ * @desc 病程中抗生素记录不规范
|
|
|
**/
|
|
|
@Component
|
|
|
public class THR03077 extends QCCatalogue {
|
|
@@ -51,12 +51,8 @@ public class THR03077 extends QCCatalogue {
|
|
|
if (doctorAdviceDocs.size() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
- //抗生素及开医嘱时间(包括加用过抗生素的时间) key:抗生素名 "2020-08-20,2020-08-21 ..."
|
|
|
- Map<String, List<String>> antibioticDate = Maps.newHashMap();
|
|
|
- //抗生素加用集合 key:抗生素名 value: 0:未加用,1及以上:加用次数
|
|
|
- Map<String, Integer> antibioticStatus = Maps.newHashMap();
|
|
|
- //抗生素及各初始剂量 key:抗生素名 value:抗生素第一次使用时剂量
|
|
|
- Map<String, List<Double>> antibioticValue = Maps.newHashMap();
|
|
|
+
|
|
|
+ Map<Date, String> extData = (Map<Date, String>) outputInfo.getResult().get("THR02985").get("extData");
|
|
|
|
|
|
List<Map<String, String>> docAdvStruct = doctorAdviceDocs
|
|
|
.stream()
|
|
@@ -64,24 +60,49 @@ public class THR03077 extends QCCatalogue {
|
|
|
.map(DoctorAdviceDoc::getStructureMap)
|
|
|
.filter(x -> StringUtil.isNotBlank(x.get("药品类型")) && x.get("药品类型").contains("抗生素") && StringUtil.isNotBlank(x.get("医嘱单次剂量")))
|
|
|
.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"))
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
+ //抗生素及开医嘱时间(包括加用过抗生素的时间) key:抗生素名 "2020-08-20,2020-08-21 ..."
|
|
|
+ Map<String, List<String>> antibioticDate = Maps.newHashMap();
|
|
|
+ //抗生素加用集合 key:抗生素名 value: 0:未加用,1及以上:加用次数
|
|
|
+ Map<String, Integer> antibioticStatus = Maps.newHashMap();
|
|
|
+ //抗生素及各初始剂量 key:抗生素名 value:抗生素第一次使用时剂量
|
|
|
+ Map<String, List<Double>> antibioticValue = Maps.newHashMap();
|
|
|
+ //记录同一天内是否开过多次同一抗生素
|
|
|
+ Map<String, Map<Date, Integer>> antibioticDateTimes = Maps.newHashMap();
|
|
|
String drugName = null, value = null, startDateStr = null;
|
|
|
+ Date startDate = null;
|
|
|
+ getAntibioticTimes(docAdvStruct, antibioticDateTimes);
|
|
|
for (Map<String, String> structMap : docAdvStruct) {
|
|
|
drugName = structMap.get("医嘱项目名称");
|
|
|
value = structMap.get("医嘱单次剂量");
|
|
|
startDateStr = structMap.get("医嘱开始时间");
|
|
|
- drugName = removeBracket(drugName);
|
|
|
+ startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
|
|
|
+ if (extData != null && extData.containsKey(startDate) && extData.get(startDate).equals(drugName)) {
|
|
|
+ continue; //THR02985 医嘱有抗生素使用病程无记录,规则中没报未记录的抗生素继续走这条规则,报未记录的抗生素过滤
|
|
|
+ }
|
|
|
+ if (antibioticDateTimes.get(drugName).get(startDate) > 0) {
|
|
|
+ continue; //一天内同一抗生素开过多次的抗生素直接过滤
|
|
|
+ }
|
|
|
collectAntibioticInfo(antibioticDate, antibioticStatus, antibioticValue, drugName, value, startDateStr);
|
|
|
}
|
|
|
|
|
|
- //把抗生素没加用过的抗生素删除
|
|
|
- for (Map.Entry<String, Integer> as : antibioticStatus.entrySet()) {
|
|
|
- if (as.getValue() == 0) {
|
|
|
- antibioticDate.remove(as.getKey());
|
|
|
- antibioticValue.remove(as.getKey());
|
|
|
+ //把抗生素使用剂量没变化过的抗生素删除
|
|
|
+ antibioticStatus.forEach((x, y) -> {
|
|
|
+ if (y == 0) {
|
|
|
+ antibioticDate.remove(x);
|
|
|
+ antibioticValue.remove(x);
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
+ //把同一天内同一个抗生素开过多次的抗生素删除
|
|
|
+// antibioticDateTimes.forEach((x, y) -> {
|
|
|
+// if (y > 0) {
|
|
|
+// antibioticDate.remove(x);
|
|
|
+// antibioticValue.remove(x);
|
|
|
+// }
|
|
|
+// });
|
|
|
//抗生素加用过的集合如果为空,则一个抗生素都没有加用过,直接返回0
|
|
|
if (antibioticDate.size() == 0) {
|
|
|
return;
|
|
@@ -161,7 +182,8 @@ public class THR03077 extends QCCatalogue {
|
|
|
String drugKey = null, start = null, change = null, wardStartStr = null, wardChangeStr = null;
|
|
|
List<String> dateList = null;
|
|
|
for (Map.Entry<String, List<String>> ad : antibioticDate.entrySet()) {
|
|
|
- drugKey = ad.getKey().replaceAll("[^\u4e00-\u9fa5]", "");
|
|
|
+ drugKey = ad.getKey();
|
|
|
+ drugKey = removeBracket(drugKey).replaceAll("[^\u4e00-\u9fa5]", "");
|
|
|
String drugStandardWord = similarityUtil.getDrugStandardWord(drugKey);
|
|
|
if (StringUtil.isNotBlank(drugStandardWord)) {
|
|
|
drugKey = drugStandardWord;
|
|
@@ -174,10 +196,11 @@ public class THR03077 extends QCCatalogue {
|
|
|
Date adStart = DateUtil.dateZeroClear(StringUtil.parseDateTime(start));
|
|
|
for (int j = 0; j < wardDateStr.size(); j++) {
|
|
|
wardStartStr = wardDateStr.get(j); //查房记录开抗生素时间
|
|
|
+ wardStartStr = wardStartStr.split("=")[0];
|
|
|
Date wardStart = StringUtil.parseDateTime(wardStartStr);
|
|
|
if ((adStart.before(wardStart) && !CatalogueUtil.compareTime(adStart, wardStart, 48 * 60L))
|
|
|
|| (wardStart.before(adStart) && !CatalogueUtil.compareTime(wardStart, adStart, 24 * 60L))) {
|
|
|
- infoAppend(sb, drugKey, start);
|
|
|
+ infoAppend(sb, ad.getKey(), start, wardDateStr.get(j).split("=")[1]);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -187,19 +210,51 @@ public class THR03077 extends QCCatalogue {
|
|
|
|
|
|
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 docAdvStruct
|
|
|
+ * @param antibioticDateTimes
|
|
|
+ */
|
|
|
+ private void getAntibioticTimes(List<Map<String, String>> docAdvStruct, Map<String, Map<Date, Integer>> antibioticDateTimes) {
|
|
|
+ String drugName;
|
|
|
+ String startDateStr;
|
|
|
+ Date startDate;
|
|
|
+ Map<Date, Integer> antibioticDateTime;
|
|
|
+ for (Map<String, String> structMap : docAdvStruct) {
|
|
|
+ drugName = structMap.get("医嘱项目名称");
|
|
|
+ startDateStr = structMap.get("医嘱开始时间");
|
|
|
+ startDate = DateUtil.dateZeroClear(StringUtil.parseDateTime(startDateStr));
|
|
|
+ if (antibioticDateTimes.containsKey(drugName)) {
|
|
|
+ Map<Date, Integer> map = antibioticDateTimes.get(drugName);
|
|
|
+ if (map.containsKey(startDate)) {
|
|
|
+ map.put(startDate, map.get(startDate) + 1);
|
|
|
+ } else {
|
|
|
+ map.put(startDate, 0);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ antibioticDateTime = Maps.newHashMap();
|
|
|
+ antibioticDateTime.put(startDate, 0);
|
|
|
+ antibioticDateTimes.put(drugName, antibioticDateTime);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 收集各模块药品信息
|
|
|
*
|
|
|
- * @param antibioticDateWard 病程中没有用量的抗生素使用所有时间
|
|
|
+ * @param antibioticDateWard 病程中没有用量+用法+频率的抗生素使用所有时间
|
|
|
* @param dateStr 记录日期
|
|
|
* @param drugs 模型提取出的药品列表
|
|
|
*/
|
|
|
private void getCourseDrugInfo(Map<String, List<String>> antibioticDateWard, String dateStr, List<Drug> drugs) {
|
|
|
+ StringBuffer sb = null;
|
|
|
for (Drug drug : drugs) {
|
|
|
+ sb = new StringBuffer();
|
|
|
String wardDrug = drug.getName();
|
|
|
wardDrug = removeBracket(wardDrug);
|
|
|
String drugStandardWord = similarityUtil.getDrugStandardWord(wardDrug);
|
|
@@ -207,15 +262,38 @@ public class THR03077 extends QCCatalogue {
|
|
|
wardDrug = drugStandardWord;
|
|
|
}
|
|
|
if (drug.getConsumption() == null) {
|
|
|
+ concatInfo(dateStr, sb, "用量");
|
|
|
+ }
|
|
|
+ if (drug.getUsageWardRound() == null) {
|
|
|
+ concatInfo(dateStr, sb, "用法");
|
|
|
+ }
|
|
|
+ if (drug.getFrequency() == null) {
|
|
|
+ concatInfo(dateStr, sb, "频率");
|
|
|
+ }
|
|
|
+ if (sb.toString().length() > 0) {
|
|
|
if (antibioticDateWard.containsKey(wardDrug)) {
|
|
|
- antibioticDateWard.get(wardDrug).add(dateStr);
|
|
|
+ antibioticDateWard.get(wardDrug).add(sb.toString());
|
|
|
} else {
|
|
|
- antibioticDateWard.put(wardDrug, Lists.newArrayList(dateStr));
|
|
|
+ antibioticDateWard.put(wardDrug, Lists.newArrayList(sb.toString()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 拼接抗生素缺失信息
|
|
|
+ *
|
|
|
+ * @param dateStr
|
|
|
+ * @param sb
|
|
|
+ */
|
|
|
+ private void concatInfo(String dateStr, StringBuffer sb, String missType) {
|
|
|
+ if (sb.toString().contains("=")) {
|
|
|
+ sb.append(",").append(missType);
|
|
|
+ } else {
|
|
|
+ sb.append(dateStr).append("=").append(missType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 收集抗生素各种信息
|
|
|
*
|
|
@@ -232,7 +310,7 @@ public class THR03077 extends QCCatalogue {
|
|
|
try {
|
|
|
v = Double.parseDouble(getNumber(value));
|
|
|
} catch (Exception e) {
|
|
|
- System.out.println("THR03074: " + drugName + ":" + value + "解析异常");
|
|
|
+ System.out.println("THR03077: " + drugName + ":" + value + "解析异常");
|
|
|
}
|
|
|
if (v < 0) {
|
|
|
return;
|
|
@@ -255,8 +333,8 @@ public class THR03077 extends QCCatalogue {
|
|
|
return;
|
|
|
}
|
|
|
//2.如果抗生素剂量两次开启的时间间隔相差3天,也记录该抗生素开始时间
|
|
|
- if (antibioticDate.get(drugName).size() > 0) {
|
|
|
- List<String> currentAntibioticDate = antibioticDate.get(drugName);
|
|
|
+ List<String> currentAntibioticDate = antibioticDate.get(drugName);
|
|
|
+ if (currentAntibioticDate.size() > 0) {
|
|
|
String lastDate = currentAntibioticDate.get(currentAntibioticDate.size() - 1);
|
|
|
if (CatalogueUtil.compareTime(StringUtil.parseDateTime(lastDate), StringUtil.parseDateTime(startDateStr), 72 * 60L)) {
|
|
|
beforeValue.add(v);
|
|
@@ -299,8 +377,9 @@ public class THR03077 extends QCCatalogue {
|
|
|
* @param drugKey
|
|
|
* @param date
|
|
|
*/
|
|
|
- private void infoAppend(StringBuffer sb, String drugKey, String date) {
|
|
|
- sb.append(drugKey).append("(").append(DateUtil.formatDate(StringUtil.parseDateTime(date))).append(")").append(",");
|
|
|
+ private void infoAppend(StringBuffer sb, String drugKey, String date, String missType) {
|
|
|
+ sb.append(drugKey).append("(").append(DateUtil.formatDate(StringUtil.parseDateTime(date)))
|
|
|
+ .append(",").append(missType).append(")").append(",");
|
|
|
}
|
|
|
|
|
|
}
|