|
@@ -7,15 +7,21 @@ import com.diagbot.entity.ResultBill;
|
|
|
import com.diagbot.entity.ResultCritical;
|
|
|
import com.diagbot.entity.ResultHighriskDrug;
|
|
|
import com.diagbot.entity.ResultHighriskOperation;
|
|
|
+import com.diagbot.entity.ResultOtherLis;
|
|
|
import com.diagbot.entity.node.BillItem;
|
|
|
import com.diagbot.entity.node.LisCritical;
|
|
|
import com.diagbot.entity.node.LisName;
|
|
|
+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.TransfusionRemind;
|
|
|
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.enums.GraphLabelEnum;
|
|
|
+import com.diagbot.enums.NeoEnum;
|
|
|
import com.diagbot.enums.StatusEnum;
|
|
|
import com.diagbot.enums.TypeEnum;
|
|
|
import com.diagbot.repository.MedicineRepository;
|
|
@@ -35,6 +41,7 @@ import java.util.HashMap;
|
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -668,7 +675,7 @@ public class RuleConvertFacade {
|
|
|
result.setLevel(item.getOpgrade());
|
|
|
//带条件高危手术
|
|
|
if (item.getOpgrade().equals("2")) {
|
|
|
- if (condMap == null || condMap.size() == 0||StringUtil.isBlank(item.getHighriskcond())) {
|
|
|
+ if (condMap == null || condMap.size() == 0 || StringUtil.isBlank(item.getHighriskcond())) {
|
|
|
result.setSuccess(0);
|
|
|
result.setMessage("缺少高危条件");
|
|
|
retOptList.add(result);
|
|
@@ -945,6 +952,144 @@ public class RuleConvertFacade {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 其他值提醒-化验
|
|
|
+ *
|
|
|
+ * @param items
|
|
|
+ * @param hospitalId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ResultOtherLis> otherRuleConvert_lis(List<LisRemind> items, Long hospitalId) {
|
|
|
+ List<ResultOtherLis> retList = Lists.newLinkedList();
|
|
|
+ List<ResultOtherLis> retOtherList = Lists.newLinkedList();
|
|
|
+ List<ResultOtherLis> retMappingList = Lists.newLinkedList();
|
|
|
+
|
|
|
+ Map<String, Map<String, Map<String, List<Long>>>> lisConfigMap = lisConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
+ Map<String, Map<String, Map<String, List<Long>>>> drugConfigMap = drugConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
+ Map<String, Map<String, List<Long>>> diseaseConfigMap = diseaseConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(items)) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (LisRemind item : items) {
|
|
|
+ ResultOtherLis result = new ResultOtherLis();
|
|
|
+ result.setOtherItemType(GraphLabelEnum.LisName.getName());
|
|
|
+ result.setOtherItemName(item.getLisname());
|
|
|
+ result.setOtherItemRange(item.getRange());
|
|
|
+ if (item.getMaxval() != null) {
|
|
|
+ result.setMaxValue(BigDecimal.valueOf(item.getMaxval()));
|
|
|
+ }
|
|
|
+ if (item.getMinval() != null) {
|
|
|
+ result.setMinValue((BigDecimal.valueOf(item.getMinval())));
|
|
|
+ }
|
|
|
+ result.setUnit(item.getUnit());
|
|
|
+
|
|
|
+ //相关诊断
|
|
|
+ Set<LisRemindYiBaoDiseaseName> lisRemindYiBaoDiseaseNameSet = item.getLisReminddisease();
|
|
|
+ if (lisRemindYiBaoDiseaseNameSet != null && lisRemindYiBaoDiseaseNameSet.size() > 0) {
|
|
|
+ lisRemindYiBaoDiseaseNameSet.forEach(lisDis -> {
|
|
|
+ if (lisDis.getYiBaoDiseaseName() != null) {
|
|
|
+ result.setRemindItemType(GraphLabelEnum.YiBaoDiseaseName.getName());
|
|
|
+ result.setRemindItemName(lisDis.getYiBaoDiseaseName().getName());
|
|
|
+ if (diseaseConfigMap.containsKey(lisDis.getYiBaoDiseaseName().getName())) {
|
|
|
+ Map<String, List<Long>> subMap = diseaseConfigMap.get(lisDis.getYiBaoDiseaseName().getName());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ subMap.entrySet().forEach(subEntry -> {
|
|
|
+ ResultOtherLis resultExt = new ResultOtherLis();
|
|
|
+ BeanUtil.copyProperties(result, resultExt);
|
|
|
+ resultExt.setRemindItemHisName(subEntry.getKey());
|
|
|
+ retOtherList.add(resultExt);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ result.setSuccess(0);
|
|
|
+ result.setMessage("提醒项缺少医院端映射;");
|
|
|
+ retOtherList.add(result);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setSuccess(0);
|
|
|
+ result.setMessage("提醒项缺少医院端映射;");
|
|
|
+ retOtherList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //相关禁忌人群
|
|
|
+ Set<LisRemindGroup> lisRemindGroupSet = item.getLisRemindgroup();
|
|
|
+ if (lisRemindGroupSet != null && lisRemindGroupSet.size() > 0) {
|
|
|
+ lisRemindGroupSet.forEach(lisGroup -> {
|
|
|
+ if (lisGroup.getGroup() != null) {
|
|
|
+ result.setRemindItemType(GraphLabelEnum.Group.getName());
|
|
|
+ result.setRemindItemName(lisGroup.getGroup().getName());
|
|
|
+ retOtherList.add(result);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //相关药品
|
|
|
+ Set<LisRemindMedicine> lisRemindMedicineSet = item.getLisRemindmedicines();
|
|
|
+ if (lisRemindMedicineSet != null && lisRemindMedicineSet.size() > 0) {
|
|
|
+ lisRemindMedicineSet.forEach(lisMed -> {
|
|
|
+ if (lisMed.getMedicine() != null) {
|
|
|
+ result.setRemindItemType(GraphLabelEnum.Medicine.getName());
|
|
|
+ result.setRemindItemName(lisMed.getMedicine().getName());
|
|
|
+ if (drugConfigMap.containsKey(lisMed.getMedicine().getName())) {
|
|
|
+ Map<String, Map<String, List<Long>>> subMap = drugConfigMap.get(lisMed.getMedicine().getName());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ subMap.entrySet().forEach(subEntry -> {
|
|
|
+ ResultOtherLis resultExt = new ResultOtherLis();
|
|
|
+ BeanUtil.copyProperties(result, resultExt);
|
|
|
+ resultExt.setRemindItemHisName(subEntry.getKey());
|
|
|
+ retOtherList.add(resultExt);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ result.setSuccess(0);
|
|
|
+ result.setMessage("提醒项缺少医院端映射;");
|
|
|
+ retOtherList.add(result);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setSuccess(0);
|
|
|
+ result.setMessage("提醒项缺少医院端映射;");
|
|
|
+ retOtherList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (ResultOtherLis result : retOtherList) {
|
|
|
+
|
|
|
+ Map<String, Map<String, List<Long>>> subMap = lisConfigMap.get(result.getOtherItemName());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ subMap.entrySet().forEach(subEntry -> {
|
|
|
+ ResultOtherLis resultExt = new ResultOtherLis();
|
|
|
+ BeanUtil.copyProperties(result, resultExt);
|
|
|
+ resultExt.setOtherItemHisName(subEntry.getKey());
|
|
|
+ if (subEntry.getValue() != null) {
|
|
|
+ subEntry.getValue().keySet().forEach(thirdKey -> {
|
|
|
+ ResultOtherLis resultLisExt = new ResultOtherLis();
|
|
|
+ BeanUtil.copyProperties(resultExt, resultLisExt);
|
|
|
+ resultLisExt.setOtherItemHisDetailName(thirdKey);
|
|
|
+ retMappingList.add(resultLisExt);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ retMappingList.add(resultExt);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ result.setSuccess(0);
|
|
|
+ result.setMessage((StringUtil.isNotBlank(result.getMessage()) ? result.getMessage() : "") +
|
|
|
+ "其他值缺少医院端映射;");
|
|
|
+ retMappingList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ retList = createOhterLisInputValue(retMappingList);
|
|
|
+
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
public MappingShortEntity setMappingShortEntity(String name, String hisName, String hisDetailName) {
|
|
|
MappingShortEntity item = new MappingShortEntity();
|
|
|
item.setName(name);
|
|
@@ -1121,6 +1266,58 @@ public class RuleConvertFacade {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 模拟输入数值-其他值-化验
|
|
|
+ *
|
|
|
+ * @param resultList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ResultOtherLis> createOhterLisInputValue(List<ResultOtherLis> resultList) {
|
|
|
+ List<ResultOtherLis> retList = Lists.newLinkedList();
|
|
|
+ if (ListUtil.isEmpty(resultList)) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+ for (ResultOtherLis result : resultList) {
|
|
|
+ if (result.getSuccess() != null && result.getSuccess().equals(0)) {
|
|
|
+ retList.add(result);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (result.getMinValue() != null || result.getMaxValue() != null) {
|
|
|
+ if (result.getOtherItemRange() == null) {
|
|
|
+ result.setOtherItemRange(0);
|
|
|
+ }
|
|
|
+ if (result.getOtherItemRange().equals(1)) {
|
|
|
+ if (result.getMinValue() != null) {
|
|
|
+ ResultOtherLis minResult = new ResultOtherLis();
|
|
|
+ BeanUtil.copyProperties(result, minResult);
|
|
|
+ minResult.setInputValue(random(null, result.getMinValue()).toString());
|
|
|
+ BillMsg billMsg = getOtherLisMsg(result);
|
|
|
+ minResult.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(minResult);
|
|
|
+ }
|
|
|
+ if (result.getMaxValue() != null) {
|
|
|
+ ResultOtherLis maxResult = new ResultOtherLis();
|
|
|
+ BeanUtil.copyProperties(result, maxResult);
|
|
|
+ maxResult.setInputValue(random(result.getMaxValue(), null).toString());
|
|
|
+ BillMsg billMsg = getOtherLisMsg(result);
|
|
|
+ maxResult.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(maxResult);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setInputValue(random(result.getMinValue(), result.getMaxValue()).toString());
|
|
|
+ BillMsg billMsg = getOtherLisMsg(result);
|
|
|
+ result.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(result);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ BillMsg billMsg = getOtherLisMsg(result);
|
|
|
+ result.setExpectedOutput(billMsg.getMsg());
|
|
|
+ retList.add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 模拟提示信息
|
|
|
*
|
|
@@ -1334,6 +1531,31 @@ public class RuleConvertFacade {
|
|
|
return billMsg;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 模拟提示信息-其他化验
|
|
|
+ *
|
|
|
+ * @param result
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public BillMsg getOtherLisMsg(ResultOtherLis result) {
|
|
|
+ BillMsg billMsg = new BillMsg();
|
|
|
+ String content = result.getOtherItemHisName();
|
|
|
+ if (StringUtil.isNotBlank(result.getOtherItemHisDetailName())
|
|
|
+ && !result.getOtherItemHisDetailName().equals(result.getOtherItemHisName())) {
|
|
|
+ content += result.getOtherItemHisDetailName();
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(result.getInputValue())) {
|
|
|
+ content += trimZero(result.getInputValue());
|
|
|
+ }
|
|
|
+ if (result.getRemindItemType().equals(GraphLabelEnum.Medicine.getName())) {
|
|
|
+ billMsg = MsgUtil.getCommonOtherTipLisMsg(content, result.getRemindItemHisName(), TypeEnum.drug.getName());
|
|
|
+ } else if (result.getRemindItemType().equals(GraphLabelEnum.YiBaoDiseaseName.getName())) {
|
|
|
+ billMsg = MsgUtil.getCommonOtherTipLisMsg(content, result.getRemindItemHisName(), TypeEnum.disease.getName());
|
|
|
+ } else if (result.getRemindItemType().equals(GraphLabelEnum.Group.getName())) {
|
|
|
+ billMsg = MsgUtil.getCommonOtherTipLisMsg(content, result.getRemindItemName(), NeoEnum.group.getName());
|
|
|
+ }
|
|
|
+ return billMsg;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 生成随机数
|