|
@@ -5,6 +5,7 @@ import com.diagbot.entity.MappingShortEntity;
|
|
|
import com.diagbot.entity.ResultBill;
|
|
|
import com.diagbot.entity.node.BillItem;
|
|
|
import com.diagbot.entity.node.MedNameRegName;
|
|
|
+import com.diagbot.entity.node.TransfusionRemind;
|
|
|
import com.diagbot.enums.GraphLabelEnum;
|
|
|
import com.diagbot.enums.StatusEnum;
|
|
|
import com.diagbot.enums.TypeEnum;
|
|
@@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -49,15 +51,21 @@ public class RuleConvertFacade {
|
|
|
@Autowired
|
|
|
private DrugTypeFacade drugTypeFacade;
|
|
|
|
|
|
+ /**
|
|
|
+ * 开单规则转换
|
|
|
+ * @param billItems
|
|
|
+ * @param hospitalId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public List<ResultBill> billRuleConvert(List<BillItem> billItems, Long hospitalId) {
|
|
|
List<ResultBill> retList = Lists.newLinkedList();
|
|
|
List<ResultBill> resultBillList = Lists.newLinkedList();
|
|
|
- List<ResultBill> retMedNameList=Lists.newArrayList();
|
|
|
+ List<ResultBill> retMedNameList = Lists.newArrayList();
|
|
|
List<ResultBill> retBillList = Lists.newArrayList();
|
|
|
List<ResultBill> retConflictList = Lists.newArrayList();
|
|
|
|
|
|
if (ListUtil.isEmpty(billItems)) {
|
|
|
- return resultBillList;
|
|
|
+ return retList;
|
|
|
}
|
|
|
|
|
|
List<MedNameRegName> medNameRegNameList = medicineRepository.findCustomByNameAndRegName(StatusEnum.Enable.getKey());
|
|
@@ -76,8 +84,6 @@ public class RuleConvertFacade {
|
|
|
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);
|
|
|
Map<String, Map<String, List<Long>>> operationConfigMap = operationConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
- Map<String, Map<String, List<Long>>> transfusionConfigMap = transfusionConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
-
|
|
|
|
|
|
for (BillItem billItem : billItems) {
|
|
|
//基础属性复制
|
|
@@ -272,9 +278,137 @@ public class RuleConvertFacade {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //模拟输入值
|
|
|
+ retList = createInputValue(retConflictList);
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public List<ResultBill> billRuleConvert_transfusion(List<TransfusionRemind> items,Long hospitalId) {
|
|
|
+ List<ResultBill> retList = Lists.newLinkedList();
|
|
|
+ List<ResultBill> resultBillList = Lists.newLinkedList();
|
|
|
+ List<ResultBill> retBillList = Lists.newArrayList();
|
|
|
+ List<ResultBill> retConflictList = Lists.newArrayList();
|
|
|
+
|
|
|
+ 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);
|
|
|
+ Map<String, Map<String, List<Long>>> transfusionConfigMap = transfusionConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
+
|
|
|
+ for (TransfusionRemind item : items) {
|
|
|
+ //基础属性复制
|
|
|
+ ResultBill resultBill = new ResultBill();
|
|
|
+ resultBill.setBillType(2);
|
|
|
+ resultBill.setBillItemType("输血提醒指标");
|
|
|
+ resultBill.setBillItemName(item.getTransfusion_type());
|
|
|
+ resultBill.setConflictItemType(item.getNode_label());
|
|
|
+ resultBill.setConflictItemName(item.getIndex_name());
|
|
|
+ if (item.getMaxval() != null) {
|
|
|
+ resultBill.setMaxValue(BigDecimal.valueOf(item.getMaxval()));
|
|
|
+ }
|
|
|
+ if (item.getMinval() != null) {
|
|
|
+ resultBill.setMinValue(BigDecimal.valueOf(item.getMinval()));
|
|
|
+ }
|
|
|
+ resultBill.setConflictItemRange(item.getRange());
|
|
|
+ resultBill.setUnit(item.getUnit());
|
|
|
+ resultBillList.add(resultBill);
|
|
|
+ }
|
|
|
+
|
|
|
+ //开单项转医院名称
|
|
|
+ for (ResultBill resultBill : resultBillList) {
|
|
|
+ Map<String, List<Long>> hisMap = transfusionConfigMap.get(resultBill.getBillItemName());
|
|
|
+ if (hisMap != null && hisMap.size() > 0) {
|
|
|
+ hisMap.entrySet().forEach(result -> {
|
|
|
+ ResultBill addResultBill = new ResultBill();
|
|
|
+ BeanUtil.copyProperties(resultBill, addResultBill);
|
|
|
+ addResultBill.setBillItemHisName(result.getKey());
|
|
|
+ retBillList.add(addResultBill);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ resultBill.setSuccess(0);
|
|
|
+ resultBill.setMessage("开单项缺少医院端映射;");
|
|
|
+ retBillList.add(resultBill);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //禁忌项转医院名称
|
|
|
+ for (ResultBill resultBill : retBillList) {
|
|
|
+ Map<String, List<String>> hisMap = new HashMap<>();
|
|
|
+ if (resultBill.getConflictItemType().equals(GraphLabelEnum.YiBaoOperationName.getName())) {
|
|
|
+ Map<String, List<Long>> subMap = operationConfigMap.get(resultBill.getConflictItemName());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ subMap.entrySet().forEach(item -> {
|
|
|
+ hisMap.put(item.getKey(), new ArrayList<>());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.YiBaoDiseaseName.getName())) {
|
|
|
+ Map<String, List<Long>> subMap = diseaseConfigMap.get(resultBill.getConflictItemName());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ subMap.entrySet().forEach(item -> {
|
|
|
+ hisMap.put(item.getKey(), new ArrayList<>());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.LisName.getName())) {
|
|
|
+ Map<String, Map<String, List<Long>>> subMap = lisConfigMap.get(resultBill.getConflictItemName());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ subMap.entrySet().forEach(item -> {
|
|
|
+ hisMap.put(item.getKey(), new ArrayList<>(item.getValue().keySet()));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (hisMap != null && hisMap.size() > 0) {
|
|
|
+ hisMap.entrySet().forEach(item -> {
|
|
|
+ ResultBill addResultBill = new ResultBill();
|
|
|
+ BeanUtil.copyProperties(resultBill, addResultBill);
|
|
|
+ addResultBill.setConflictItemHisName(item.getKey());
|
|
|
+ if (ListUtil.isNotEmpty(item.getValue())) {
|
|
|
+ item.getValue().forEach(detailName -> {
|
|
|
+ ResultBill addResultBillExt = new ResultBill();
|
|
|
+ BeanUtil.copyProperties(addResultBill, addResultBillExt);
|
|
|
+ addResultBillExt.setConflictItemHisDetailName(detailName);
|
|
|
+ retConflictList.add(addResultBillExt);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ retConflictList.add(addResultBill);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ resultBill.setSuccess(0);
|
|
|
+ resultBill.setMessage("禁忌项缺少医院端映射;");
|
|
|
+ retConflictList.add(resultBill);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//模拟输入值
|
|
|
- for (ResultBill result : retConflictList) {
|
|
|
+ retList = createInputValue(retConflictList);
|
|
|
+
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public MappingShortEntity setMappingShortEntity(String name, String hisName, String hisDetailName) {
|
|
|
+ MappingShortEntity item = new MappingShortEntity();
|
|
|
+ item.setName(name);
|
|
|
+ item.setHisName(hisName);
|
|
|
+ item.setHisDetailName(hisDetailName);
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 模拟输入数值
|
|
|
+ * @param resultList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<ResultBill> createInputValue(List<ResultBill> resultList) {
|
|
|
+ List<ResultBill> retList = Lists.newLinkedList();
|
|
|
+ if (ListUtil.isEmpty(resultList)) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+ for (ResultBill result : resultList) {
|
|
|
if (result.getSuccess() != null && result.getSuccess().equals(0)) {
|
|
|
retList.add(result);
|
|
|
continue;
|
|
@@ -315,14 +449,6 @@ public class RuleConvertFacade {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
- public MappingShortEntity setMappingShortEntity(String name, String hisName, String hisDetailName) {
|
|
|
- MappingShortEntity item = new MappingShortEntity();
|
|
|
- item.setName(name);
|
|
|
- item.setHisName(hisName);
|
|
|
- item.setHisDetailName(hisDetailName);
|
|
|
- return item;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 模拟提示信息
|
|
|
*
|
|
@@ -332,72 +458,125 @@ public class RuleConvertFacade {
|
|
|
public BillMsg getBillMsg(ResultBill resultBill) {
|
|
|
BillMsg billMsg = new BillMsg();
|
|
|
String orderType = getOrderType(resultBill.getBillItemType());
|
|
|
- if (resultBill.getConflictItemType().equals(GraphLabelEnum.BillConflictItem.getName())) {
|
|
|
- //互斥项
|
|
|
- billMsg = MsgUtil.getBillExclusionMsg(resultBill.getBillItemHisName(),
|
|
|
- resultBill.getConflictItemHisName(),
|
|
|
- resultBill.getConflictItemHisName(),
|
|
|
- "禁忌" + resultBill.getConflictItemType());
|
|
|
- } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.ConflictDevice.getName())) {
|
|
|
- //禁忌医疗器械及物品提示信息
|
|
|
- billMsg = MsgUtil.getBillMedEquMsg(resultBill.getBillItemHisName(),
|
|
|
- resultBill.getBillItemName(),
|
|
|
- resultBill.getConflictItemName(),
|
|
|
- "禁忌" + resultBill.getConflictItemType(),
|
|
|
- orderType);
|
|
|
- } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.YiBaoOperationName.getName())) {
|
|
|
- //禁忌手术
|
|
|
- billMsg = MsgUtil.getCommonSurgeryMsg(resultBill.getBillItemHisName(),
|
|
|
- resultBill.getBillItemName(),
|
|
|
- resultBill.getConflictItemHisName(),
|
|
|
- "禁忌" + resultBill.getConflictItemType(),
|
|
|
- orderType);
|
|
|
- } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.OralMedicine.getName())) {
|
|
|
- //禁忌服用药品
|
|
|
- billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
- resultBill.getBillItemName(),
|
|
|
- "可能正在用药" + resultBill.getConflictItemHisName(),
|
|
|
- "禁忌" + resultBill.getConflictItemType(),
|
|
|
- orderType);
|
|
|
- } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.MedAllergen.getName())
|
|
|
- || resultBill.getConflictItemType().equals(GraphLabelEnum.Allergen.getName())) {
|
|
|
- //禁忌药物过敏原/食物过敏原/过敏原
|
|
|
- billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
- resultBill.getBillItemName(),
|
|
|
- StringUtil.isNotBlank(resultBill.getConflictItemHisName())
|
|
|
- ? resultBill.getConflictItemHisName()
|
|
|
- : resultBill.getConflictItemName()
|
|
|
- + "过敏",
|
|
|
- "禁忌" + resultBill.getConflictItemType(),
|
|
|
- orderType);
|
|
|
- }else if (resultBill.getConflictItemType().equals(GraphLabelEnum.Group.getName())) {
|
|
|
- //禁忌禁忌人群
|
|
|
- billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
- resultBill.getBillItemName(),
|
|
|
- resultBill.getConflictItemName(),
|
|
|
- "禁忌" + resultBill.getConflictItemType(),
|
|
|
- orderType);
|
|
|
- } else {
|
|
|
- //通用
|
|
|
- String content = "";
|
|
|
- if (StringUtil.isNotBlank(resultBill.getConflictItemHisName())) {
|
|
|
- content = resultBill.getConflictItemHisName();
|
|
|
- }
|
|
|
- if (StringUtil.isNotBlank(resultBill.getConflictItemHisDetailName())
|
|
|
- && !resultBill.getConflictItemHisName().equals(resultBill.getConflictItemHisDetailName())) {
|
|
|
- content += resultBill.getConflictItemHisDetailName();
|
|
|
- }
|
|
|
- if (StringUtil.isBlank(content)) {
|
|
|
- content += resultBill.getConflictItemName();
|
|
|
+ //输血开单
|
|
|
+ if (resultBill.getBillItemType().equals(GraphLabelEnum.TransfusionRemind.getName())) {
|
|
|
+ if (resultBill.getConflictItemType().equals(GraphLabelEnum.LisName.getName())) {
|
|
|
+ String content = resultBill.getConflictItemHisName();
|
|
|
+ if (StringUtil.isNotBlank(resultBill.getConflictItemHisDetailName())
|
|
|
+ && !resultBill.getConflictItemHisName().equals(resultBill.getConflictItemHisDetailName())) {
|
|
|
+ content += resultBill.getConflictItemHisDetailName();
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(resultBill.getInputValue())) {
|
|
|
+ content += trimZero(resultBill.getInputValue());
|
|
|
+ }
|
|
|
+ billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getBillItemName(),
|
|
|
+ content,
|
|
|
+ "禁忌" + resultBill.getConflictItemType(),
|
|
|
+ orderType
|
|
|
+ );
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.YiBaoOperationName.getName())) {
|
|
|
+ billMsg = MsgUtil.getCommonSurgeryMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getBillItemName(),
|
|
|
+ resultBill.getConflictItemHisName(),
|
|
|
+ "禁忌" + resultBill.getConflictItemType(),
|
|
|
+ orderType
|
|
|
+ );
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.YiBaoDiseaseName.getName())) {
|
|
|
+ billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getBillItemName(),
|
|
|
+ resultBill.getConflictItemHisName(),
|
|
|
+ "禁忌" + resultBill.getConflictItemType(),
|
|
|
+ orderType
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getBillItemName(),
|
|
|
+ resultBill.getConflictItemName(),
|
|
|
+ "禁忌" + resultBill.getConflictItemType(),
|
|
|
+ orderType
|
|
|
+ );
|
|
|
}
|
|
|
- if (StringUtil.isNotBlank(resultBill.getInputValue())) {
|
|
|
- content += trimZero(resultBill.getInputValue());
|
|
|
+ } else {
|
|
|
+ if (resultBill.getConflictItemType().equals(GraphLabelEnum.BillConflictItem.getName())) {
|
|
|
+ //互斥项
|
|
|
+ billMsg = MsgUtil.getBillExclusionMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getConflictItemHisName(),
|
|
|
+ resultBill.getConflictItemHisName(),
|
|
|
+ "禁忌" + resultBill.getConflictItemType());
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.ConflictDevice.getName())) {
|
|
|
+ //禁忌医疗器械及物品提示信息
|
|
|
+ billMsg = MsgUtil.getBillMedEquMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getBillItemName(),
|
|
|
+ resultBill.getConflictItemName(),
|
|
|
+ "禁忌" + resultBill.getConflictItemType(),
|
|
|
+ orderType);
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.YiBaoOperationName.getName())) {
|
|
|
+ //禁忌手术
|
|
|
+ billMsg = MsgUtil.getCommonSurgeryMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getBillItemName(),
|
|
|
+ resultBill.getConflictItemHisName(),
|
|
|
+ "禁忌" + resultBill.getConflictItemType(),
|
|
|
+ orderType);
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.OralMedicine.getName())) {
|
|
|
+ //禁忌服用药品
|
|
|
+ billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getBillItemName(),
|
|
|
+ "可能正在用药" + resultBill.getConflictItemHisName(),
|
|
|
+ "禁忌" + resultBill.getConflictItemType(),
|
|
|
+ orderType);
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.MedAllergen.getName())
|
|
|
+ || resultBill.getConflictItemType().equals(GraphLabelEnum.Allergen.getName())) {
|
|
|
+ //禁忌药物过敏原/食物过敏原/过敏原
|
|
|
+ billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getBillItemName(),
|
|
|
+ StringUtil.isNotBlank(resultBill.getConflictItemHisName())
|
|
|
+ ? resultBill.getConflictItemHisName()
|
|
|
+ : resultBill.getConflictItemName()
|
|
|
+ + "过敏",
|
|
|
+ "禁忌" + resultBill.getConflictItemType(),
|
|
|
+ orderType);
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.Group.getName())) {
|
|
|
+ //禁忌禁忌人群
|
|
|
+ billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getBillItemName(),
|
|
|
+ resultBill.getConflictItemName(),
|
|
|
+ "禁忌" + resultBill.getConflictItemType(),
|
|
|
+ orderType);
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.Lis.getName())) {
|
|
|
+ //禁忌实验室检查
|
|
|
+ String content = "";
|
|
|
+ if (StringUtil.isNotBlank(resultBill.getConflictItemHisName())) {
|
|
|
+ content = resultBill.getConflictItemHisName();
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(resultBill.getConflictItemHisDetailName())
|
|
|
+ && !resultBill.getConflictItemHisName().equals(resultBill.getConflictItemHisDetailName())) {
|
|
|
+ content += resultBill.getConflictItemHisDetailName();
|
|
|
+ }
|
|
|
+ billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getBillItemName(),
|
|
|
+ content,
|
|
|
+ "禁忌" + resultBill.getConflictItemType(),
|
|
|
+ orderType);
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.Disease.getName())) {
|
|
|
+ //禁忌疾病
|
|
|
+ billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getBillItemName(),
|
|
|
+ resultBill.getConflictItemHisName(),
|
|
|
+ "禁忌" + resultBill.getConflictItemType(),
|
|
|
+ orderType);
|
|
|
+ } else {
|
|
|
+ //通用
|
|
|
+ String content = resultBill.getConflictItemName();
|
|
|
+ if (StringUtil.isNotBlank(resultBill.getInputValue())) {
|
|
|
+ content += trimZero(resultBill.getInputValue());
|
|
|
+ }
|
|
|
+ billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getBillItemName(),
|
|
|
+ content,
|
|
|
+ "禁忌" + resultBill.getConflictItemType(),
|
|
|
+ orderType);
|
|
|
}
|
|
|
- billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
- resultBill.getBillItemName(),
|
|
|
- content,
|
|
|
- "禁忌" + resultBill.getConflictItemType(),
|
|
|
- orderType);
|
|
|
}
|
|
|
return billMsg;
|
|
|
}
|