|
@@ -8,6 +8,8 @@ import com.diagbot.entity.ResultCritical;
|
|
|
import com.diagbot.entity.ResultHighriskDrug;
|
|
|
import com.diagbot.entity.ResultHighriskOperation;
|
|
|
import com.diagbot.entity.ResultOtherLis;
|
|
|
+import com.diagbot.entity.ResultOtherPacs;
|
|
|
+import com.diagbot.entity.ResultOtherTransfusion;
|
|
|
import com.diagbot.entity.node.BillItem;
|
|
|
import com.diagbot.entity.node.LisCritical;
|
|
|
import com.diagbot.entity.node.LisName;
|
|
@@ -15,11 +17,16 @@ import com.diagbot.entity.node.LisRemind;
|
|
|
import com.diagbot.entity.node.MedNameRegName;
|
|
|
import com.diagbot.entity.node.MedRegName;
|
|
|
import com.diagbot.entity.node.PacsCritical;
|
|
|
+import com.diagbot.entity.node.PacsRemind;
|
|
|
import com.diagbot.entity.node.TransfusionRemind;
|
|
|
+import com.diagbot.entity.node.TransfusionSuggest;
|
|
|
+import com.diagbot.entity.node.YiBaoDiseaseName;
|
|
|
import com.diagbot.entity.node.YiBaoOperationName;
|
|
|
import com.diagbot.entity.relationship.LisRemindGroup;
|
|
|
import com.diagbot.entity.relationship.LisRemindMedicine;
|
|
|
import com.diagbot.entity.relationship.LisRemindYiBaoDiseaseName;
|
|
|
+import com.diagbot.entity.relationship.TransfusionSuggestYiBaoDiseaseName;
|
|
|
+import com.diagbot.entity.relationship.TransfusionSuggestYiBaoOperationName;
|
|
|
import com.diagbot.enums.GraphLabelEnum;
|
|
|
import com.diagbot.enums.NeoEnum;
|
|
|
import com.diagbot.enums.StatusEnum;
|
|
@@ -1090,6 +1097,217 @@ public class RuleConvertFacade {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 其他值提醒-辅检
|
|
|
+ * @param items
|
|
|
+ * @param hospitalId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ResultOtherPacs> otherRuleConvert_pacs(List<PacsRemind> items,Long hospitalId) {
|
|
|
+ List<ResultOtherPacs> retList = Lists.newLinkedList();
|
|
|
+ List<ResultOtherPacs> retOtherList = Lists.newLinkedList();
|
|
|
+
|
|
|
+ Map<String, Map<String, List<Long>>> diseaseConfigMap = diseaseConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(items)) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (PacsRemind item : items) {
|
|
|
+ ResultOtherPacs result = new ResultOtherPacs();
|
|
|
+ result.setPacsResult(item.getResult());
|
|
|
+ result.setExpectedOutput(item.getMsg());
|
|
|
+ result.setMessage("");
|
|
|
+
|
|
|
+ if (StringUtil.isNotBlank(item.getGender())) {
|
|
|
+ result.setGender(item.getGender());
|
|
|
+ }
|
|
|
+ if (item.getRange() != null) {
|
|
|
+ result.setAgeRange(item.getRange());
|
|
|
+ }
|
|
|
+ if (item.getMaxval() != null) {
|
|
|
+ result.setMaxAge(BigDecimal.valueOf(item.getMaxval()));
|
|
|
+ }
|
|
|
+ if (item.getMinval() != null) {
|
|
|
+ result.setMinAge(BigDecimal.valueOf(item.getMinval()));
|
|
|
+ }
|
|
|
+ result.setPostoken(item.getPostoken());
|
|
|
+ result.setNegtoken(item.getNegtoken());
|
|
|
+
|
|
|
+ if (StringUtil.isNotBlank(item.getDisease())) {
|
|
|
+ result.setRemindItemType(GraphLabelEnum.YiBaoDiseaseName.getName());
|
|
|
+ result.setRemindItemName(item.getDisease());
|
|
|
+ Map<String, List<Long>> subMap = diseaseConfigMap.get(item.getDisease());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ subMap.keySet().forEach(hisName -> {
|
|
|
+ ResultOtherPacs resultExt = new ResultOtherPacs();
|
|
|
+ BeanUtil.copyProperties(result, resultExt);
|
|
|
+ resultExt.setRemindItemHisName(hisName);
|
|
|
+ retOtherList.add(resultExt);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ result.setSuccess(0);
|
|
|
+ result.setMessage(result.getMessage() + "诊断缺少医院端映射;");
|
|
|
+ retOtherList.add(result);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ retOtherList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //生成模拟数据
|
|
|
+ for (ResultOtherPacs result : retOtherList) {
|
|
|
+ if (result.getMaxAge() != null || result.getMinAge() != null) {
|
|
|
+ if (result.getAgeRange() == null) {
|
|
|
+ result.setAgeRange(0);
|
|
|
+ }
|
|
|
+ if (result.getAgeRange().equals(1)) {
|
|
|
+ if (result.getMinAge() != null) {
|
|
|
+ ResultOtherPacs minResult = new ResultOtherPacs();
|
|
|
+ BeanUtil.copyProperties(result, minResult);
|
|
|
+ minResult.setInputAge(random_int(null, result.getMinAge().intValue()).toString());
|
|
|
+ retList.add(minResult);
|
|
|
+ }
|
|
|
+ if (result.getMaxAge() != null) {
|
|
|
+ ResultOtherPacs maxResult = new ResultOtherPacs();
|
|
|
+ BeanUtil.copyProperties(result, maxResult);
|
|
|
+ maxResult.setInputAge(random_int(result.getMaxAge().intValue(), null).toString());
|
|
|
+ retList.add(maxResult);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setInputAge(random_int(result.getMinAge().intValue(), result.getMaxAge().intValue()).toString());
|
|
|
+ retList.add(result);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ retList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 其他值提醒-输血
|
|
|
+ * @param items
|
|
|
+ * @param hospitalId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ResultOtherTransfusion> otherRuleConvert_transfusion(List<TransfusionSuggest> items,Long hospitalId) {
|
|
|
+ List<ResultOtherTransfusion> retList = Lists.newLinkedList();
|
|
|
+ List<ResultOtherTransfusion> retOtherList = Lists.newLinkedList();
|
|
|
+ List<ResultOtherTransfusion> retMappingList = Lists.newLinkedList();
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(items)) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Map<String, Map<String, List<Long>>>> lisConfigMap = lisConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
+ Map<String, Map<String, List<Long>>> diseaseConfigMap = diseaseConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
+ Map<String, Map<String, List<Long>>> operationConfigMap = operationConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
+
|
|
|
+ for (TransfusionSuggest item : items) {
|
|
|
+ ResultOtherTransfusion result = new ResultOtherTransfusion();
|
|
|
+ result.setOtherItemName(item.getIndex_name());
|
|
|
+ result.setTransfusionType(item.getTransfusion_type());
|
|
|
+ if (item.getMaxval() != null) {
|
|
|
+ result.setOtherItemMaxValue(BigDecimal.valueOf(item.getMaxval()));
|
|
|
+ }
|
|
|
+ if (item.getMinval() != null) {
|
|
|
+ result.setOtherItemMinValue(BigDecimal.valueOf(item.getMinval()));
|
|
|
+ }
|
|
|
+ result.setOtherItemUnit(item.getUnit());
|
|
|
+ result.setOtherItemRange(item.getRange());
|
|
|
+ result.setMessage("");
|
|
|
+
|
|
|
+ //诊断
|
|
|
+ Set<TransfusionSuggestYiBaoDiseaseName> transfusionSuggestYiBaoDiseaseNameSet = item.getTransfusionSuggestDiseases();
|
|
|
+ if (transfusionSuggestYiBaoDiseaseNameSet != null && transfusionSuggestYiBaoDiseaseNameSet.size() > 0) {
|
|
|
+ transfusionSuggestYiBaoDiseaseNameSet.forEach(transDis -> {
|
|
|
+ YiBaoDiseaseName dis = transDis.getYiBaoDiseaseName();
|
|
|
+ result.setConflictItemType(GraphLabelEnum.YiBaoDiseaseName.getName());
|
|
|
+ if (dis != null) {
|
|
|
+ result.setConflictItemName(dis.getName());
|
|
|
+ Map<String, List<Long>> subMap = diseaseConfigMap.get(dis.getName());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ subMap.keySet().forEach(hisName -> {
|
|
|
+ ResultOtherTransfusion resultExt = new ResultOtherTransfusion();
|
|
|
+ BeanUtil.copyProperties(result, resultExt);
|
|
|
+ resultExt.setConflictItemHisName(hisName);
|
|
|
+ retOtherList.add(resultExt);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ result.setMessage(result.getMessage() + "禁忌项缺少医院端映射;");
|
|
|
+ result.setSuccess(0);
|
|
|
+ retOtherList.add(result);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setMessage(result.getMessage() + "缺少禁忌项;");
|
|
|
+ result.setSuccess(0);
|
|
|
+ retOtherList.add(result);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //手术和操作
|
|
|
+ Set<TransfusionSuggestYiBaoOperationName> transfusionSuggestYiBaoOperationNameSet = item.getTransfusionSuggestOperations();
|
|
|
+ if (transfusionSuggestYiBaoOperationNameSet != null && transfusionSuggestYiBaoOperationNameSet.size() > 0) {
|
|
|
+ transfusionSuggestYiBaoOperationNameSet.forEach(transOpt -> {
|
|
|
+ YiBaoOperationName opt = transOpt.getYiBaoOperationName();
|
|
|
+ result.setConflictItemType(GraphLabelEnum.YiBaoOperationName.getName());
|
|
|
+ if (opt != null) {
|
|
|
+ result.setConflictItemName(opt.getName());
|
|
|
+ Map<String, List<Long>> subMap = operationConfigMap.get(opt.getName());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ subMap.keySet().forEach(hisName -> {
|
|
|
+ ResultOtherTransfusion resultExt = new ResultOtherTransfusion();
|
|
|
+ BeanUtil.copyProperties(result, resultExt);
|
|
|
+ resultExt.setConflictItemHisName(hisName);
|
|
|
+ retOtherList.add(resultExt);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ result.setMessage(result.getMessage() + "禁忌项缺少医院端映射;");
|
|
|
+ result.setSuccess(0);
|
|
|
+ retOtherList.add(result);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setMessage(result.getMessage() + "缺少禁忌项;");
|
|
|
+ result.setSuccess(0);
|
|
|
+ retOtherList.add(result);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (ResultOtherTransfusion result : retOtherList) {
|
|
|
+ Map<String, Map<String, List<Long>>> subMap = lisConfigMap.get(result.getOtherItemName());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ subMap.entrySet().forEach(subEntry -> {
|
|
|
+ ResultOtherTransfusion resultExt = new ResultOtherTransfusion();
|
|
|
+ BeanUtil.copyProperties(result, resultExt);
|
|
|
+ resultExt.setOtherItemHisName(subEntry.getKey());
|
|
|
+ if (subEntry.getValue() != null && subEntry.getValue().size() > 0) {
|
|
|
+ subEntry.getValue().keySet().forEach(detailName -> {
|
|
|
+ ResultOtherTransfusion resultOtherTransfusion = new ResultOtherTransfusion();
|
|
|
+ BeanUtil.copyProperties(resultExt, resultOtherTransfusion);
|
|
|
+ resultOtherTransfusion.setOtherItemHisDetailName(detailName);
|
|
|
+ retMappingList.add(resultOtherTransfusion);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ retMappingList.add(resultExt);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ result.setMessage(result.getMessage() + "实验室检查缺少医院端映射;");
|
|
|
+ result.setSuccess(0);
|
|
|
+ retMappingList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ retList = createOhterTransfusionInputValue(retMappingList);
|
|
|
+
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
public MappingShortEntity setMappingShortEntity(String name, String hisName, String hisDetailName) {
|
|
|
MappingShortEntity item = new MappingShortEntity();
|
|
|
item.setName(name);
|
|
@@ -1318,6 +1536,57 @@ public class RuleConvertFacade {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 模拟输入数值-其他值-输血
|
|
|
+ * @param resultList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ResultOtherTransfusion> createOhterTransfusionInputValue(List<ResultOtherTransfusion> resultList) {
|
|
|
+ List<ResultOtherTransfusion> retList = Lists.newLinkedList();
|
|
|
+ if (ListUtil.isEmpty(resultList)) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+ for (ResultOtherTransfusion result : resultList) {
|
|
|
+ if (result.getSuccess() != null && result.getSuccess().equals(0)) {
|
|
|
+ retList.add(result);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (result.getOtherItemMinValue() != null || result.getOtherItemMaxValue() != null) {
|
|
|
+ if (result.getOtherItemRange() == null) {
|
|
|
+ result.setOtherItemRange(0);
|
|
|
+ }
|
|
|
+ if (result.getOtherItemRange().equals(1)) {
|
|
|
+ if (result.getOtherItemMinValue() != null) {
|
|
|
+ ResultOtherTransfusion minResult = new ResultOtherTransfusion();
|
|
|
+ BeanUtil.copyProperties(result, minResult);
|
|
|
+ minResult.setOtherItemInputValue(random(null, result.getOtherItemMinValue()).toString());
|
|
|
+ BillMsg billMsg = getOtherTransfusionMsg(result);
|
|
|
+ minResult.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(minResult);
|
|
|
+ }
|
|
|
+ if (result.getOtherItemMaxValue() != null) {
|
|
|
+ ResultOtherTransfusion maxResult = new ResultOtherTransfusion();
|
|
|
+ BeanUtil.copyProperties(result, maxResult);
|
|
|
+ maxResult.setOtherItemInputValue(random(result.getOtherItemMaxValue(), null).toString());
|
|
|
+ BillMsg billMsg = getOtherTransfusionMsg(result);
|
|
|
+ maxResult.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(maxResult);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setOtherItemInputValue(random(result.getOtherItemMinValue(), result.getOtherItemMaxValue()).toString());
|
|
|
+ BillMsg billMsg = getOtherTransfusionMsg(result);
|
|
|
+ result.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(result);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ BillMsg billMsg = getOtherTransfusionMsg(result);
|
|
|
+ result.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 模拟提示信息
|
|
|
*
|
|
@@ -1532,7 +1801,7 @@ public class RuleConvertFacade {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 模拟提示信息-其他化验
|
|
|
+ * 模拟提示信息-其他值-化验
|
|
|
*
|
|
|
* @param result
|
|
|
* @return
|
|
@@ -1557,6 +1826,46 @@ public class RuleConvertFacade {
|
|
|
return billMsg;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 模拟提示信息-其他值-输血
|
|
|
+ *
|
|
|
+ * @param result
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public BillMsg getOtherTransfusionMsg(ResultOtherTransfusion result) {
|
|
|
+ BillMsg billMsg = new BillMsg();
|
|
|
+ if (result.getConflictItemType().equals(GraphLabelEnum.YiBaoDiseaseName.getName())) {
|
|
|
+ String content = "诊断" + result.getConflictItemHisName() + ",";
|
|
|
+ content += result.getOtherItemHisName();
|
|
|
+ if (StringUtil.isNotBlank(result.getOtherItemHisDetailName())
|
|
|
+ && !result.getOtherItemHisDetailName().equals(result.getOtherItemHisName())) {
|
|
|
+ content += result.getOtherItemHisDetailName();
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(result.getOtherItemInputValue())) {
|
|
|
+ content += trimZero(result.getOtherItemInputValue());
|
|
|
+ }
|
|
|
+ billMsg = MsgUtil.getCommonOtherTipTransfusionMsg(content, result.getTransfusionType());
|
|
|
+ } else if (result.getConflictItemType().equals(GraphLabelEnum.YiBaoOperationName.getName())) {
|
|
|
+ String content = "";
|
|
|
+ content += result.getOtherItemHisName();
|
|
|
+ if (StringUtil.isNotBlank(result.getOtherItemHisDetailName())
|
|
|
+ && !result.getOtherItemHisDetailName().equals(result.getOtherItemHisName())) {
|
|
|
+ content += result.getOtherItemHisDetailName();
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(result.getOtherItemInputValue())) {
|
|
|
+ content += trimZero(result.getOtherItemInputValue());
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(content)) {
|
|
|
+ content += ",";
|
|
|
+ }
|
|
|
+ content += "已开" + result.getConflictItemHisName();
|
|
|
+
|
|
|
+ billMsg = MsgUtil.getCommonOtherTipTransfusionMsg(content, result.getTransfusionType());
|
|
|
+ }
|
|
|
+
|
|
|
+ return billMsg;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 生成随机数
|
|
|
*
|