|
@@ -0,0 +1,241 @@
|
|
|
+package com.lantone.qc.kernel.catalogue.clinicalblood;
|
|
|
+
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
|
+import com.lantone.qc.kernel.util.RegexUtil;
|
|
|
+import com.lantone.qc.pub.model.InputInfo;
|
|
|
+import com.lantone.qc.pub.model.OutputInfo;
|
|
|
+import com.lantone.qc.pub.model.doc.ClinicalBloodDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
|
|
|
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
|
|
|
+import com.lantone.qc.pub.util.DateUtil;
|
|
|
+import com.lantone.qc.pub.util.ListUtil;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.Comparator;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description :无输血前化验检查
|
|
|
+ * @Author : zhaops
|
|
|
+ * @Date 2022/7/8 10:19
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class CLI0304 extends QCCatalogue {
|
|
|
+ /**
|
|
|
+ * 1.病历包含【输血*记录】时,获取【临时医嘱】处方类型为(化验/检验/检查)是否存在:(输血前检查/术前三项/术前四项/感染四项/输血前四项/输血前筛查)中任意一项,
|
|
|
+ * 1.1若不存在查(乙*肝、丙*肝、人类免疫缺陷病毒、梅毒)是否全部存在,仍不存在报出。
|
|
|
+ * 1.2存在后再查(血型/血型鉴定/血型血清学检查/血型鉴定与抗体筛查)是否存在任意一项,不存在则报出。
|
|
|
+ * 1.3都存在时判断化验医嘱开始日期是否都在“输血*记录”之前。多份输血记录时只走第一份时间,日期只对比到天数
|
|
|
+ * 2.【临时医嘱】包含【输*血/输*红细胞/输*血小板/输*血浆/输*冷沉淀因子】但排除带“预约”。出现时。获取【临时医嘱】处方类型为(化验/检验/检查)是否存在:
|
|
|
+ * 2.1(输血前检查/术前三项/术前四项/感染四项/输血前四项/输血前筛查)中任意一项。若不存在查(乙*肝、丙*肝、人类免疫缺陷病毒、梅毒)是否全部存在,仍不存在报出,
|
|
|
+ * 2.2存在后再查(血型/血型鉴定/血型血清学检查/血型鉴定与抗体筛查)是否存在任意一项,不存在则报出。
|
|
|
+ * 2.3都存在时判断化验医嘱开始日期是否都在“输血医嘱”之前。多份输血医嘱只走最早时间,只对比到天数
|
|
|
+ * 3.【病案首页】(血费>0)出现时,获取【临时医嘱】处方类型为(化验/检验/检查)是否存在:(输血前检查/术前三项/术前四项/感染四项/输血前四项/输血前筛查)中任意一项。
|
|
|
+ * 3.1若不存在查(乙*肝、丙*肝、人类免疫缺陷病毒、梅毒)是否全部存在,仍不存在报出,
|
|
|
+ * 3.2存在后再查(血型/血型鉴定/血型血清学检查/血型鉴定与抗体筛查)是否存在任意一项,不存在则报出。
|
|
|
+ */
|
|
|
+
|
|
|
+ public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
+ List<ClinicalBloodDoc> clinicalBloodDocs = inputInfo.getClinicalBloodDocs();
|
|
|
+ List<DoctorAdviceDoc> doctorAdviceDocs = inputInfo.getDoctorAdviceDocs();
|
|
|
+ FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(doctorAdviceDocs)) {
|
|
|
+ status.set("0");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ String regex1 = "输血前检查|术前三项|术前四项|感染四项|输血前四项|输血前筛查";
|
|
|
+ String regex2 = "乙[\\u4E00-\\u9FA5A-Za-z]{0,}肝";
|
|
|
+ String regex3 = "丙[\\u4E00-\\u9FA5A-Za-z]{0,}肝";
|
|
|
+ String regex4 = "血型|血型鉴定|血型血清学检查|血型鉴定与抗体筛查";
|
|
|
+ String regex5 = "输[\\u4E00-\\u9FA5A-Za-z]{0,}(血|红细胞|血小板|血浆|冷沉淀因子)";
|
|
|
+ List<String> strList = Lists.newArrayList("输血前检查", "术前三项", "术前四项", "感染四项", "输血前四项");
|
|
|
+
|
|
|
+ //医嘱类型判别:临时医嘱,医嘱处方类型:化验、检验、检查
|
|
|
+ List<DoctorAdviceDoc> filterDAList = doctorAdviceDocs.stream().filter(Objects::nonNull)
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱类型判别")) && i.getStructureMap().get("医嘱类型判别").equals("临时医嘱"))
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱处方类型"))
|
|
|
+ && (i.getStructureMap().get("医嘱处方类型").equals("化验")
|
|
|
+ || i.getStructureMap().get("医嘱处方类型").equals("检验")
|
|
|
+ || i.getStructureMap().get("医嘱处方类型").equals("检查")))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(filterDAList)) {
|
|
|
+ status.set("0");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //病历包含【输血*记录】时
|
|
|
+ if (ListUtil.isNotEmpty(clinicalBloodDocs)) {
|
|
|
+ List<DoctorAdviceDoc> itemDAList = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), regex1)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(itemDAList)) {
|
|
|
+ List<DoctorAdviceDoc> l1 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), regex2)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<DoctorAdviceDoc> l2 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), regex3)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<DoctorAdviceDoc> l3 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), "人类免疫缺陷病毒")))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<DoctorAdviceDoc> l4 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), "梅毒")))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(l1) && ListUtil.isNotEmpty(l2) && ListUtil.isNotEmpty(l3) && ListUtil.isNotEmpty(l4)) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ List<DoctorAdviceDoc> l1 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), regex4)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(l1)) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (filterDAList.stream().map(i -> i.getStructureMap().get("医嘱项目名称")).collect(Collectors.toList())
|
|
|
+ .containsAll(strList)) {
|
|
|
+ //输血记录日期
|
|
|
+ List<Date> cBDateList = clinicalBloodDocs.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("病历日期")))
|
|
|
+ .map(i -> DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("病历日期"))))
|
|
|
+ .sorted((Comparator.comparing(i -> i)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ //医嘱日期
|
|
|
+ List<Date> daDateList = filterDAList.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱开始时间")))
|
|
|
+ .map(i -> DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("医嘱开始时间"))))
|
|
|
+ .sorted((Comparator.comparing(i -> i)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(cBDateList) && ListUtil.isNotEmpty(daDateList)
|
|
|
+ && cBDateList.get(0).after(daDateList.get(daDateList.size() - 1))) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //输血临时医嘱
|
|
|
+ List<DoctorAdviceDoc> clinicalBloodDAList = doctorAdviceDocs.stream().filter(Objects::nonNull)
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱类型判别")) && i.getStructureMap().get("医嘱类型判别").equals("临时医嘱"))
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (!i.getStructureMap().get("医嘱项目名称").contains("预约"))
|
|
|
+ && RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), regex5))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(clinicalBloodDAList)) {
|
|
|
+ if (ListUtil.isNotEmpty(filterDAList)) {
|
|
|
+ List<DoctorAdviceDoc> itemDAList = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), regex1)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(itemDAList)) {
|
|
|
+ List<DoctorAdviceDoc> l1 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), regex2)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<DoctorAdviceDoc> l2 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), regex3)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<DoctorAdviceDoc> l3 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), "人类免疫缺陷病毒")))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<DoctorAdviceDoc> l4 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), "梅毒")))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(l1) && ListUtil.isNotEmpty(l2) && ListUtil.isNotEmpty(l3) && ListUtil.isNotEmpty(l4)) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ List<DoctorAdviceDoc> l1 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), regex4)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(l1)) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (filterDAList.stream().map(i -> i.getStructureMap().get("医嘱项目名称")).collect(Collectors.toList())
|
|
|
+ .containsAll(strList)) {
|
|
|
+ //输血医嘱日期
|
|
|
+ List<Date> cBDateList = clinicalBloodDAList.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱开始时间")))
|
|
|
+ .map(i -> DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("医嘱开始时间"))))
|
|
|
+ .sorted((Comparator.comparing(i -> i)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ //医嘱日期
|
|
|
+ List<Date> daDateList = filterDAList.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱开始时间")))
|
|
|
+ .map(i -> DateUtil.getFirstTimeOfDay(StringUtil.parseDateTime(i.getStructureMap().get("医嘱开始时间"))))
|
|
|
+ .sorted((Comparator.comparing(i -> i)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(cBDateList) && ListUtil.isNotEmpty(daDateList)
|
|
|
+ && cBDateList.get(0).after(daDateList.get(daDateList.size() - 1))) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //【病案首页】(血费>0)出现时
|
|
|
+ if (firstPageRecordDoc != null && firstPageRecordDoc.getStructureMap().containsKey("血费")) {
|
|
|
+ if (BigDecimal.valueOf(Double.valueOf(firstPageRecordDoc.getStructureMap().get("血费"))).compareTo(BigDecimal.ZERO) == 1) {
|
|
|
+ List<DoctorAdviceDoc> itemDAList = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), regex1)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(itemDAList)) {
|
|
|
+ List<DoctorAdviceDoc> l1 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), regex2)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<DoctorAdviceDoc> l2 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), regex3)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<DoctorAdviceDoc> l3 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), "人类免疫缺陷病毒")))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<DoctorAdviceDoc> l4 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), "梅毒")))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(l1) && ListUtil.isNotEmpty(l2) && ListUtil.isNotEmpty(l3) && ListUtil.isNotEmpty(l4)) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ List<DoctorAdviceDoc> l1 = filterDAList.stream().filter(i -> StringUtil.isNotBlank(i.getStructureMap().get("医嘱项目名称"))
|
|
|
+ && (RegexUtil.getRegexRes(i.getStructureMap().get("医嘱项目名称"), regex4)))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(l1)) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ status.set("0");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+}
|