|
@@ -2,16 +2,20 @@ package com.lantone.qc.kernel.catalogue.firstpagerecord;
|
|
|
|
|
|
import com.lantone.qc.kernel.catalogue.QCCatalogue;
|
|
|
import com.lantone.qc.kernel.util.CatalogueUtil;
|
|
|
+import com.lantone.qc.kernel.util.RegexUtil;
|
|
|
import com.lantone.qc.pub.Content;
|
|
|
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.LisDoc;
|
|
|
+import com.lantone.qc.pub.util.ListUtil;
|
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @ClassName : FIRP0190
|
|
@@ -22,18 +26,106 @@ import java.util.Map;
|
|
|
@Component
|
|
|
public class FIRP0190 extends QCCatalogue {
|
|
|
public void start(InputInfo inputInfo, OutputInfo outputInfo) {
|
|
|
+ /**
|
|
|
+ * 1.首先获取[病案首页]>>[RH/Rh血型/Rh],若文书不在或字段未填写,直接返回。
|
|
|
+ * 2.查看内容填写是否为(阴性/阳性/阴/阳/不详/未查/1/2/3/4).若为否则报错。
|
|
|
+ * 3.获取病历内存在【输血*记录】文书,或【病案首页>>血费】>0,填写(不详/未查/3/4/-),则报规则。
|
|
|
+ * 4.若病历内存在包含(血型鉴定/Rh血型鉴定/血型)化验检查报告单,找报告单内明细项[Rh血型/RhD血型/Rh(D)/Rh/Rh(D)血型/Rh(D)]结果值,和首页对比是否一致,
|
|
|
+ * 同义词需转换,如[阴性/阴/1/-/-/(-)/(-)]相同,[阳性/阳/2/+/+/(+)/(+)]相同,不一致则触发规则。若未获得血型化验结果,则返回(或内测时能提示未成功获取血型化验结果)
|
|
|
+ * 5.若病历内存在【输血*记录】时,"获取结构化数据的"输注种类、血型、数量"若是没有则获取【Rh/Rh(D)/Rh血型/Rh(D)血型/Rh(D)】",然后判断其含(阴性/阳性/阴/阳/(-)/(+))次数,以次数多的为准。
|
|
|
+ * 如果所有输血记录都没有rh记录(阴性/阳性/阴/阳/(-)/(+)),则不报错。若找到,跟首页[RH/Rh血型/Rh]对比是否一致,同义词需转换,如[阴性/阴/1/-/-/(-)/(-)]相同,[阳性/阳/2/+/+/(+)/(+)]相同,
|
|
|
+ * 不一致则触发规则,未找到或空不比较
|
|
|
+ */
|
|
|
status.set("0");
|
|
|
- if (inputInfo.getFirstPageRecordDoc() == null || inputInfo.getFirstPageRecordDoc().getStructureMap() == null
|
|
|
- || inputInfo.getClinicalBloodDocs().size() == 0) {
|
|
|
+ if (inputInfo.getFirstPageRecordDoc() == null || inputInfo.getFirstPageRecordDoc().getStructureMap() == null) {
|
|
|
return;
|
|
|
}
|
|
|
Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
|
|
|
List<ClinicalBloodDoc> clinicalBloodDocList = inputInfo.getClinicalBloodDocs();
|
|
|
+ List<LisDoc> lisDocs = inputInfo.getLisDocs();
|
|
|
String rhFactor = firstpageStructureMap.get(Content.rhFactor);
|
|
|
if (CatalogueUtil.isEmpty(rhFactor)) {
|
|
|
return;
|
|
|
}
|
|
|
- int matchSum = 0, noRhSum = 0;
|
|
|
+
|
|
|
+ String regex = "阴性|阳性|阴|阳|不详|未查|1|2|3|4";
|
|
|
+ String regexNegative = "阴性|阴|1|\\-|\\-|\\(\\-\\)|(\\-)";
|
|
|
+ String regexPositive = "阳性|阳|2|\\+|\\+|\\(\\+\\)|(\\+)";
|
|
|
+ String regexLis = "血型鉴定|Rh血型鉴定|血型";
|
|
|
+ String regexLisDetail = "Rh血型|RhD血型|Rh(D)|Rh|Rh\\(D\\)血型|Rh\\(D\\)";
|
|
|
+ String regexResult = "阴性|阳性|阴|阳|\\(\\-\\)|\\(\\+\\)|(\\-)|(\\+)";
|
|
|
+
|
|
|
+ if (!RegexUtil.getRegexRes(rhFactor, regex)) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取病历内存在【输血*记录】文书,【病案首页>>血费】>0,填写(不详/未查/3/4/-),则报规则。
|
|
|
+ String regex1 = "不详|未查|3|4|-";
|
|
|
+ if (ListUtil.isEmpty(clinicalBloodDocList)
|
|
|
+ || (firstpageStructureMap.containsKey("血费")
|
|
|
+ && BigDecimal.valueOf(Double.valueOf(firstpageStructureMap.get("血费"))).compareTo(BigDecimal.ZERO) == 1)) {
|
|
|
+ if (RegexUtil.getRegexRes(rhFactor, regex1)) {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(lisDocs)) {
|
|
|
+
|
|
|
+
|
|
|
+ List<LisDoc> filterLisDocs = lisDocs.stream()
|
|
|
+ .filter(i -> RegexUtil.getRegexRes(i.getStructureMap().get("报告名称"), regexLis))
|
|
|
+ .filter(i -> RegexUtil.getRegexRes(i.getStructureMap().get("报告名称"), regexLisDetail))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (LisDoc lisDoc : filterLisDocs) {
|
|
|
+ String lisResult = lisDoc.getStructureMap().get("检验结果");
|
|
|
+ if (CatalogueUtil.isEmpty(lisResult)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if ((RegexUtil.getRegexRes(rhFactor, regexNegative) && RegexUtil.getRegexRes(lisResult, regexNegative))
|
|
|
+ || (RegexUtil.getRegexRes(rhFactor, regexPositive) && RegexUtil.getRegexRes(lisResult, regexPositive))) {
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (ClinicalBloodDoc clinicalBloodDoc : clinicalBloodDocList) {
|
|
|
+ String bloodType = clinicalBloodDoc.getStructureMap().get("输注种类、血型、数量");
|
|
|
+ if (StringUtil.isBlank(bloodType)) {
|
|
|
+ // 台州无“输注种类、血型、数量”,匹配“Rh血型”
|
|
|
+ bloodType = (clinicalBloodDoc.getStructureMap().containsKey("Rh") ? clinicalBloodDoc.getStructureMap().get("Rh") : "")
|
|
|
+ + (clinicalBloodDoc.getStructureMap().containsKey("Rh(D)") ? clinicalBloodDoc.getStructureMap().get("Rh(D)") : "")
|
|
|
+ + (clinicalBloodDoc.getStructureMap().containsKey("Rh(D)") ? clinicalBloodDoc.getStructureMap().get("Rh(D)") : "")
|
|
|
+ + (clinicalBloodDoc.getStructureMap().containsKey("Rh血型") ? clinicalBloodDoc.getStructureMap().get("Rh血型") : "")
|
|
|
+ + (clinicalBloodDoc.getStructureMap().containsKey("Rh(D)血型") ? clinicalBloodDoc.getStructureMap().get("Rh(D)血型") : "")
|
|
|
+ + (clinicalBloodDoc.getStructureMap().containsKey("Rh(D)血型") ? clinicalBloodDoc.getStructureMap().get("Rh(D)血型") : "");
|
|
|
+ }
|
|
|
+ if (CatalogueUtil.isEmpty(bloodType)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> matchStrs = RegexUtil.getRegexRes(bloodType, regexResult, true);
|
|
|
+ if (ListUtil.isEmpty(matchStrs)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (String matchStr : matchStrs) {
|
|
|
+ if ((RegexUtil.getRegexRes(rhFactor, regexNegative) && RegexUtil.getRegexRes(rhFactor, regexNegative))
|
|
|
+ || (RegexUtil.getRegexRes(rhFactor, regexPositive) && RegexUtil.getRegexRes(rhFactor, regexPositive))) {
|
|
|
+ continue;
|
|
|
+ } else {
|
|
|
+ status.set("-1");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*int matchSum = 0, noRhSum = 0;
|
|
|
for (ClinicalBloodDoc clinicalBloodDoc : clinicalBloodDocList) {
|
|
|
String bloodType = clinicalBloodDoc.getStructureMap().get("输注种类、血型、数量");
|
|
|
if (StringUtil.isBlank(bloodType)) {
|
|
@@ -54,15 +146,15 @@ public class FIRP0190 extends QCCatalogue {
|
|
|
if (bloodType.contains(rh) ||
|
|
|
bloodType.contains(CatalogueUtil.removeSpecialChar(rhFactor))) {
|
|
|
matchSum++;
|
|
|
- return ;
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
- /* 如果所有输血记录都没有rh记录(阴、阳),则不报错 */
|
|
|
- if (noRhSum == clinicalBloodDocList.size()){
|
|
|
+ *//* 如果所有输血记录都没有rh记录(阴、阳),则不报错 *//*
|
|
|
+ if (noRhSum == clinicalBloodDocList.size()) {
|
|
|
return;
|
|
|
}
|
|
|
if (matchSum == 0) {
|
|
|
status.set("-1");
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
-}
|
|
|
+}
|