|
@@ -3,7 +3,9 @@ package com.diagbot.facade;
|
|
|
import com.diagbot.dto.BillMsg;
|
|
|
import com.diagbot.entity.MappingShortEntity;
|
|
|
import com.diagbot.entity.ResultBill;
|
|
|
+import com.diagbot.entity.ResultCritical;
|
|
|
import com.diagbot.entity.node.BillItem;
|
|
|
+import com.diagbot.entity.node.LisCritical;
|
|
|
import com.diagbot.entity.node.MedNameRegName;
|
|
|
import com.diagbot.entity.node.TransfusionRemind;
|
|
|
import com.diagbot.enums.GraphLabelEnum;
|
|
@@ -303,7 +305,7 @@ public class RuleConvertFacade {
|
|
|
//基础属性复制
|
|
|
ResultBill resultBill = new ResultBill();
|
|
|
resultBill.setBillType(2);
|
|
|
- resultBill.setBillItemType("输血提醒指标");
|
|
|
+ resultBill.setBillItemType(GraphLabelEnum.TransfusionRemind.getName());
|
|
|
resultBill.setBillItemName(item.getTransfusion_type());
|
|
|
resultBill.setConflictItemType(item.getNode_label());
|
|
|
resultBill.setConflictItemName(item.getIndex_name());
|
|
@@ -390,6 +392,81 @@ public class RuleConvertFacade {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
+ public List<ResultCritical> criticalRuleConvert_lis(List<LisCritical> items,Long hospitalId) {
|
|
|
+ List<ResultCritical> retList = Lists.newLinkedList();
|
|
|
+ List<ResultCritical> resultList = Lists.newLinkedList();
|
|
|
+ List<ResultCritical> resultMappingList = Lists.newArrayList();
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(items)) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Map<String, Map<String, List<Long>>>> lisConfigMap = lisConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
+
|
|
|
+ for (LisCritical item : items) {
|
|
|
+ //基础属性复制
|
|
|
+ ResultCritical result = new ResultCritical();
|
|
|
+ result.setCriticalType(1);
|
|
|
+ result.setCriticalItemType(GraphLabelEnum.LisCritical.getName());
|
|
|
+
|
|
|
+ String uniqueName = item.getName().substring(0, item.getName().length() - 3);
|
|
|
+ result.setCriticalItemName(uniqueName);
|
|
|
+ result.setReferenceValue(item.getName());
|
|
|
+ if (StringUtil.isNotBlank(item.getMaxval())) {
|
|
|
+ result.setMaxValue(BigDecimal.valueOf(Double.valueOf(item.getMaxval())));
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(item.getMinval())) {
|
|
|
+ result.setMinValue(BigDecimal.valueOf(Double.valueOf(item.getMinval())));
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(item.getAge())) {
|
|
|
+ String[] ages = item.getAge().split(":");
|
|
|
+ if (ages.length == 1) {
|
|
|
+ if (item.getAge().startsWith(":")) {
|
|
|
+ result.setMaxAge(Integer.valueOf(ages[0]));
|
|
|
+ } else {
|
|
|
+ result.setMinAge(Integer.valueOf(ages[0]));
|
|
|
+ }
|
|
|
+ } else if (ages.length > 1) {
|
|
|
+ result.setMinAge(Integer.valueOf(ages[0]));
|
|
|
+ result.setMaxAge(Integer.valueOf(ages[1]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.setCriticalItemRange(StringUtil.isBlank(item.getRange()) ? 0 : Integer.valueOf(item.getRange()));
|
|
|
+ result.setUnit(item.getUnit());
|
|
|
+ resultList.add(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ //医院端映射
|
|
|
+ for (ResultCritical result : resultList) {
|
|
|
+ Map<String, Map<String, List<Long>>> hisMap = lisConfigMap.get(result.getCriticalItemName());
|
|
|
+ if (hisMap != null && hisMap.size() > 0) {
|
|
|
+ hisMap.entrySet().forEach(entry -> {
|
|
|
+ result.setCriticalItemHisName(entry.getKey());
|
|
|
+ if (entry.getValue() != null && entry.getValue().size() > 0) {
|
|
|
+ entry.getValue().entrySet().forEach(subEntry -> {
|
|
|
+ ResultCritical resultExt = new ResultCritical();
|
|
|
+ BeanUtil.copyProperties(result, resultExt);
|
|
|
+ resultExt.setCriticalItemHisDetailName(subEntry.getKey());
|
|
|
+ resultMappingList.add(resultExt);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ resultMappingList.add(result);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ result.setSuccess(0);
|
|
|
+ result.setMessage("开单项缺少医院端映射;");
|
|
|
+ resultMappingList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //模拟数据输入
|
|
|
+ retList = createCriticalInputValue(resultMappingList);
|
|
|
+
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public MappingShortEntity setMappingShortEntity(String name, String hisName, String hisDetailName) {
|
|
|
MappingShortEntity item = new MappingShortEntity();
|
|
|
item.setName(name);
|
|
@@ -449,6 +526,57 @@ public class RuleConvertFacade {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 模拟输入数值-危急值
|
|
|
+ * @param resultList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ResultCritical> createCriticalInputValue(List<ResultCritical> resultList) {
|
|
|
+ List<ResultCritical> retList = Lists.newLinkedList();
|
|
|
+ if (ListUtil.isEmpty(resultList)) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+ for (ResultCritical result : resultList) {
|
|
|
+ if (result.getSuccess() != null && result.getSuccess().equals(0)) {
|
|
|
+ retList.add(result);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (result.getMaxValue() != null || result.getMinValue() != null) {
|
|
|
+ if (result.getCriticalItemRange() == null) {
|
|
|
+ result.setCriticalItemRange(0);
|
|
|
+ }
|
|
|
+ if (result.getCriticalItemRange().equals(1)) {
|
|
|
+ if (result.getMinValue() != null) {
|
|
|
+ ResultCritical minResult = new ResultCritical();
|
|
|
+ BeanUtil.copyProperties(result, minResult);
|
|
|
+ minResult.setInputValue(random(null, result.getMinValue()).toString());
|
|
|
+ BillMsg billMsg = getCriticalMsg(minResult);
|
|
|
+ minResult.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(minResult);
|
|
|
+ }
|
|
|
+ if (result.getMaxValue() != null) {
|
|
|
+ ResultCritical maxResult = new ResultCritical();
|
|
|
+ BeanUtil.copyProperties(result, maxResult);
|
|
|
+ maxResult.setInputValue(random(result.getMaxValue(), null).toString());
|
|
|
+ BillMsg billMsg = getCriticalMsg(maxResult);
|
|
|
+ maxResult.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(maxResult);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setInputValue(random(result.getMinValue(), result.getMaxValue()).toString());
|
|
|
+ BillMsg billMsg = getCriticalMsg(result);
|
|
|
+ result.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(result);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ BillMsg billMsg = getCriticalMsg(result);
|
|
|
+ result.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 模拟提示信息
|
|
|
*
|
|
@@ -581,6 +709,33 @@ public class RuleConvertFacade {
|
|
|
return billMsg;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 模拟提示信息-危急值
|
|
|
+ * @param resultCritical
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public BillMsg getCriticalMsg(ResultCritical resultCritical) {
|
|
|
+ BillMsg billMsg = new BillMsg();
|
|
|
+ if (resultCritical.getCriticalItemType().equals(GraphLabelEnum.LisCritical.getName())) {
|
|
|
+ String content = "";
|
|
|
+ if (StringUtil.isNotBlank(resultCritical.getCriticalItemHisName())) {
|
|
|
+ content += resultCritical.getCriticalItemHisName();
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(resultCritical.getCriticalItemHisDetailName())
|
|
|
+ && !resultCritical.getCriticalItemHisName().equals(resultCritical.getCriticalItemHisDetailName())) {
|
|
|
+ content += resultCritical.getCriticalItemHisDetailName();
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(resultCritical.getInputValue())) {
|
|
|
+ content += trimZero(resultCritical.getInputValue());
|
|
|
+ }
|
|
|
+ billMsg = MsgUtil.getCommonCriticalMsg(content, TypeEnum.lis.getName());
|
|
|
+ } else if (resultCritical.getCriticalItemType().equals(GraphLabelEnum.PacsCritical.getName())) {
|
|
|
+ billMsg = MsgUtil.getCommonCriticalMsg("", TypeEnum.pacs.getName());
|
|
|
+ }
|
|
|
+ return billMsg;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 生成随机数
|
|
|
*
|