|
@@ -13,6 +13,7 @@ import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.EntityUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.MsgUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -45,10 +46,15 @@ public class RuleConvertFacade {
|
|
|
|
|
|
@Autowired
|
|
|
private MedicineRepository medicineRepository;
|
|
|
+ @Autowired
|
|
|
+ private DrugTypeFacade drugTypeFacade;
|
|
|
|
|
|
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> retBillList = Lists.newArrayList();
|
|
|
+ List<ResultBill> retConflictList = Lists.newArrayList();
|
|
|
|
|
|
if (ListUtil.isEmpty(billItems)) {
|
|
|
return resultBillList;
|
|
@@ -62,6 +68,9 @@ public class RuleConvertFacade {
|
|
|
medNameRegNameMap.put(entry.getKey(), entry.getValue().stream().map(i -> i.getMedName()).collect(Collectors.toList()));
|
|
|
});
|
|
|
|
|
|
+ //药物过敏原药品分类转药品
|
|
|
+ Map<String, List<String>> medClassMap = drugTypeFacade.getDrugTypeMap();
|
|
|
+
|
|
|
Map<String, Map<String, Map<String, List<Long>>>> lisConfigMap = lisConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
Map<String, Map<String, List<Long>>> pacsConfigMap = pacsConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
Map<String, Map<String, Map<String, List<Long>>>> drugConfigMap = drugConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
@@ -70,150 +79,206 @@ public class RuleConvertFacade {
|
|
|
Map<String, Map<String, List<Long>>> transfusionConfigMap = transfusionConfigFacade.getUniqueConfigMap(hospitalId, null, null);
|
|
|
|
|
|
|
|
|
- int count=1;
|
|
|
for (BillItem billItem : billItems) {
|
|
|
- System.out.println(count++ +",id:"+billItem.getConceptId()+"name:"+billItem.getConceptName()+",type:"+billItem.getConceptLabel());
|
|
|
- List<MappingShortEntity> billMappingList = Lists.newArrayList();
|
|
|
- List<MappingShortEntity> conflictMappingList = Lists.newArrayList();
|
|
|
+ //基础属性复制
|
|
|
+ ResultBill resultBill = new ResultBill();
|
|
|
+ resultBill.setBillType(1);
|
|
|
+ resultBill.setBillItemType(billItem.getConceptLabel());
|
|
|
+ resultBill.setBillItemName(billItem.getConceptName());
|
|
|
+ resultBill.setConflictItemType(billItem.getConditionLabel());
|
|
|
+ resultBill.setConflictItemName(billItem.getConditionName());
|
|
|
+ if (billItem.getConditionMaxValue() != null) {
|
|
|
+ resultBill.setMaxValue(BigDecimal.valueOf(billItem.getConditionMaxValue()));
|
|
|
+ }
|
|
|
+ if (billItem.getConditionMinValue() != null) {
|
|
|
+ resultBill.setMinValue(BigDecimal.valueOf(billItem.getConditionMinValue()));
|
|
|
+ }
|
|
|
+ resultBill.setConflictItemRange(billItem.getConditionRange());
|
|
|
+ resultBill.setUnit(billItem.getConditionUnit());
|
|
|
|
|
|
- if (billItem.getConceptLabel().equals(GraphLabelEnum.LisSet.getName())) {
|
|
|
- Map<String, Map<String, List<Long>>> subMap = lisConfigMap.get(billItem.getConceptName());
|
|
|
+ if (resultBill.getConflictItemType().equals(GraphLabelEnum.MedAllergen.getName())) {
|
|
|
+ List<String> medNameList = medClassMap.get(billItem.getConditionName());
|
|
|
+ if (ListUtil.isNotEmpty(medNameList)) {
|
|
|
+ for (String medName : medNameList) {
|
|
|
+ ResultBill resultBill1Ext = new ResultBill();
|
|
|
+ BeanUtil.copyProperties(resultBill, resultBill1Ext);
|
|
|
+ resultBill1Ext.setReferenceValue(resultBill1Ext.getConflictItemName());
|
|
|
+ resultBill1Ext.setConflictItemName(medName);
|
|
|
+ resultBillList.add(resultBill1Ext);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ resultBillList.add(resultBill);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ resultBillList.add(resultBill);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //药品注册名转通用名
|
|
|
+ for (ResultBill resultBill : resultBillList) {
|
|
|
+ if (resultBill.getBillItemType().equals(GraphLabelEnum.MedRegName.getName())) {
|
|
|
+ List<String> medNameList = medNameRegNameMap.get(resultBill.getBillItemName());
|
|
|
+ if (ListUtil.isNotEmpty(medNameList)) {
|
|
|
+ for (String medName : medNameList) {
|
|
|
+ ResultBill resultBill1Ext = new ResultBill();
|
|
|
+ BeanUtil.copyProperties(resultBill, resultBill1Ext);
|
|
|
+ resultBill1Ext.setReferenceValue(resultBill1Ext.getBillItemName());
|
|
|
+ resultBill1Ext.setBillItemName(medName);
|
|
|
+ retMedNameList.add(resultBill1Ext);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ resultBill.setSuccess(0);
|
|
|
+ resultBill.setMessage("药品注册名称找不到对应药品通用名称;");
|
|
|
+ retMedNameList.add(resultBill);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ retMedNameList.add(resultBill);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //数据映射-开单项转换
|
|
|
+ for (ResultBill resultBill : retMedNameList) {
|
|
|
+ List<MappingShortEntity> billMappingList = Lists.newArrayList();
|
|
|
+ if (resultBill.getBillItemType().equals(GraphLabelEnum.LisSet.getName())) {
|
|
|
+ Map<String, Map<String, List<Long>>> subMap = lisConfigMap.get(resultBill.getBillItemName());
|
|
|
if (subMap != null) {
|
|
|
subMap.entrySet().forEach(subEntry -> {
|
|
|
if (subEntry.getValue() != null && subEntry.getValue().size() > 0) {
|
|
|
subEntry.getValue().entrySet().forEach(detailEntry -> {
|
|
|
- billMappingList.add(setMappingShortEntity(billItem.getConceptName(), subEntry.getKey(), detailEntry.getKey()));
|
|
|
+ billMappingList.add(setMappingShortEntity(resultBill.getBillItemName(), subEntry.getKey(), detailEntry.getKey()));
|
|
|
});
|
|
|
} else {
|
|
|
- billMappingList.add(setMappingShortEntity(billItem.getConceptName(), subEntry.getKey(), ""));
|
|
|
+ billMappingList.add(setMappingShortEntity(resultBill.getBillItemName(), subEntry.getKey(), ""));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- } else if (billItem.getConceptLabel().equals(GraphLabelEnum.PacsName.getName())
|
|
|
- || billItem.getConceptLabel().equals(GraphLabelEnum.PacsSubName.getName())) {
|
|
|
- Map<String, List<Long>> subMap = pacsConfigMap.get(billItem.getConceptName());
|
|
|
+ } else if (resultBill.getBillItemType().equals(GraphLabelEnum.PacsName.getName())
|
|
|
+ || resultBill.getBillItemType().equals(GraphLabelEnum.PacsSubName.getName())) {
|
|
|
+ Map<String, List<Long>> subMap = pacsConfigMap.get(resultBill.getBillItemName());
|
|
|
if (subMap != null) {
|
|
|
subMap.entrySet().forEach(subEntry -> {
|
|
|
- billMappingList.add(setMappingShortEntity(billItem.getConceptName(), subEntry.getKey(), ""));
|
|
|
+ billMappingList.add(setMappingShortEntity(resultBill.getBillItemName(), subEntry.getKey(), ""));
|
|
|
});
|
|
|
}
|
|
|
- } else if (billItem.getConceptLabel().equals(GraphLabelEnum.YiBaoOperationName.getName())) {
|
|
|
- Map<String, List<Long>> subMap = operationConfigMap.get(billItem.getConceptName());
|
|
|
+ } else if (resultBill.getBillItemType().equals(GraphLabelEnum.YiBaoOperationName.getName())) {
|
|
|
+ Map<String, List<Long>> subMap = operationConfigMap.get(resultBill.getBillItemName());
|
|
|
if (subMap != null) {
|
|
|
subMap.entrySet().forEach(subEntry -> {
|
|
|
- billMappingList.add(setMappingShortEntity(billItem.getConceptName(), subEntry.getKey(), ""));
|
|
|
+ billMappingList.add(setMappingShortEntity(resultBill.getBillItemName(), subEntry.getKey(), ""));
|
|
|
});
|
|
|
}
|
|
|
- } else if (billItem.getConceptLabel().equals(GraphLabelEnum.MedRegName.getName())) {
|
|
|
- if (medNameRegNameMap.containsKey(billItem.getConceptName())) {
|
|
|
- List<String> medNames = medNameRegNameMap.get(billItem.getConceptName());
|
|
|
- for (String medName : medNames) {
|
|
|
- Map<String, Map<String, List<Long>>> subMap = drugConfigMap.get(medName);
|
|
|
- if (subMap != null) {
|
|
|
- subMap.entrySet().forEach(subEntry -> {
|
|
|
- billMappingList.add(setMappingShortEntity(billItem.getConceptName(), subEntry.getKey(), ""));
|
|
|
- });
|
|
|
- }
|
|
|
+ } else if (resultBill.getBillItemType().equals(GraphLabelEnum.MedRegName.getName())) {
|
|
|
+ if (medNameRegNameMap.containsKey(resultBill.getBillItemName())) {
|
|
|
+ Map<String, Map<String, List<Long>>> subMap = drugConfigMap.get(resultBill.getBillItemName());
|
|
|
+ if (subMap != null) {
|
|
|
+ subMap.entrySet().forEach(subEntry -> {
|
|
|
+ billMappingList.add(setMappingShortEntity(resultBill.getBillItemName(), subEntry.getKey(), ""));
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (billItem.getConditionLabel().equals(GraphLabelEnum.Lis.getName())) {
|
|
|
- Map<String, Map<String, List<Long>>> subMap = lisConfigMap.get(billItem.getConditionName());
|
|
|
+ if (ListUtil.isEmpty(billMappingList)) {
|
|
|
+ resultBill.setSuccess(0);
|
|
|
+ resultBill.setMessage(StringUtil.isNotBlank(resultBill.getMessage())
|
|
|
+ ? resultBill.getMessage()
|
|
|
+ : ""
|
|
|
+ + "开单项缺少医院端映射;");
|
|
|
+ retBillList.add(resultBill);
|
|
|
+ } else {
|
|
|
+ billMappingList.forEach(billMappingItem -> {
|
|
|
+ ResultBill addResultBill = new ResultBill();
|
|
|
+ BeanUtil.copyProperties(resultBill, addResultBill);
|
|
|
+ addResultBill.setBillItemHisName(billMappingItem.getHisName());
|
|
|
+ addResultBill.setBillItemHisDetailName(billMappingItem.getHisDetailName());
|
|
|
+ retBillList.add(addResultBill);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //数据映射-禁忌项转换
|
|
|
+ for (ResultBill resultBill : retBillList) {
|
|
|
+ List<MappingShortEntity> conflictMappingList = Lists.newArrayList();
|
|
|
+ if (resultBill.getConflictItemType().equals(GraphLabelEnum.Lis.getName())) {
|
|
|
+ Map<String, Map<String, List<Long>>> subMap = lisConfigMap.get(resultBill.getConflictItemName());
|
|
|
if (subMap != null) {
|
|
|
subMap.entrySet().forEach(subEntry -> {
|
|
|
if (subEntry.getValue() != null && subEntry.getValue().size() > 0) {
|
|
|
subEntry.getValue().entrySet().forEach(detailEntry -> {
|
|
|
- conflictMappingList.add(setMappingShortEntity(billItem.getConditionName(), subEntry.getKey(), detailEntry.getKey()));
|
|
|
+ conflictMappingList.add(setMappingShortEntity(resultBill.getConflictItemName(), subEntry.getKey(), detailEntry.getKey()));
|
|
|
});
|
|
|
} else {
|
|
|
- conflictMappingList.add(setMappingShortEntity(billItem.getConditionName(), subEntry.getKey(), ""));
|
|
|
+ conflictMappingList.add(setMappingShortEntity(resultBill.getConflictItemName(), subEntry.getKey(), ""));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- } else if (billItem.getConditionLabel().equals(GraphLabelEnum.BillConflictItem.getName())) {
|
|
|
- Map<String, List<Long>> subMap = pacsConfigMap.get(billItem.getConditionName());
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.BillConflictItem.getName())) {
|
|
|
+ Map<String, List<Long>> subMap = pacsConfigMap.get(resultBill.getConflictItemName());
|
|
|
if (subMap != null) {
|
|
|
subMap.entrySet().forEach(subEntry -> {
|
|
|
- conflictMappingList.add(setMappingShortEntity(billItem.getConditionName(), subEntry.getKey(), ""));
|
|
|
+ conflictMappingList.add(setMappingShortEntity(resultBill.getConflictItemName(), subEntry.getKey(), ""));
|
|
|
});
|
|
|
}
|
|
|
- } else if (billItem.getConditionLabel().equals(GraphLabelEnum.Disease.getName())) {
|
|
|
- Map<String, List<Long>> subMap = diseaseConfigMap.get(billItem.getConditionName());
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.Disease.getName())) {
|
|
|
+ Map<String, List<Long>> subMap = diseaseConfigMap.get(resultBill.getConflictItemName());
|
|
|
if (subMap != null) {
|
|
|
subMap.entrySet().forEach(subEntry -> {
|
|
|
- conflictMappingList.add(setMappingShortEntity(billItem.getConditionName(), subEntry.getKey(), ""));
|
|
|
+ conflictMappingList.add(setMappingShortEntity(resultBill.getConflictItemName(), subEntry.getKey(), ""));
|
|
|
});
|
|
|
}
|
|
|
- } else if (billItem.getConditionLabel().equals(GraphLabelEnum.OralMedicine.getName())
|
|
|
- || billItem.getConditionLabel().equals(GraphLabelEnum.MedAllergen.getName())) {
|
|
|
- Map<String, Map<String, List<Long>>> subMap = drugConfigMap.get(billItem.getConditionName());
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.OralMedicine.getName())) {
|
|
|
+ Map<String, Map<String, List<Long>>> subMap = drugConfigMap.get(resultBill.getConflictItemName());
|
|
|
if (subMap != null) {
|
|
|
subMap.entrySet().forEach(subEntry -> {
|
|
|
- conflictMappingList.add(setMappingShortEntity(billItem.getConditionName(), subEntry.getKey(), ""));
|
|
|
+ conflictMappingList.add(setMappingShortEntity(resultBill.getConflictItemName(), subEntry.getKey(), ""));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else if (resultBill.getConflictItemType().equals(GraphLabelEnum.MedAllergen.getName())) {
|
|
|
+ List<String> medNameList = medClassMap.get(resultBill.getConflictItemName());
|
|
|
+ if (ListUtil.isNotEmpty(medNameList)) {
|
|
|
+ medNameList.forEach(medName -> {
|
|
|
+ Map<String, Map<String, List<Long>>> subMap = drugConfigMap.get(medName);
|
|
|
+ if (subMap != null) {
|
|
|
+ subMap.entrySet().forEach(subEntry -> {
|
|
|
+ conflictMappingList.add(setMappingShortEntity(resultBill.getConflictItemName(), subEntry.getKey(), ""));
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //基础属性复制
|
|
|
- ResultBill resultBill = new ResultBill();
|
|
|
- resultBill.setBillType(1);
|
|
|
- resultBill.setBillItemType(billItem.getConceptLabel());
|
|
|
- resultBill.setBillItemName(billItem.getConceptName());
|
|
|
- resultBill.setConflictItemType(billItem.getConditionLabel());
|
|
|
- resultBill.setConflictItemName(billItem.getConditionName());
|
|
|
- if (billItem.getConditionMaxValue() != null) {
|
|
|
- resultBill.setMaxValue(BigDecimal.valueOf(billItem.getConditionMaxValue()));
|
|
|
- }
|
|
|
- if (billItem.getConditionMinValue() != null) {
|
|
|
- resultBill.setMinValue(BigDecimal.valueOf(billItem.getConditionMinValue()));
|
|
|
- }
|
|
|
- resultBill.setConflictItemRange(billItem.getConditionRange());
|
|
|
- resultBill.setUnit(billItem.getConditionUnit());
|
|
|
- if (ListUtil.isEmpty(billMappingList)) {
|
|
|
- if (ListUtil.isEmpty(conflictMappingList)) {
|
|
|
- ResultBill addResultBill = new ResultBill();
|
|
|
- BeanUtil.copyProperties(resultBill, addResultBill);
|
|
|
- resultBillList.add(addResultBill);
|
|
|
- } else {
|
|
|
- conflictMappingList.forEach(conflictItem -> {
|
|
|
- ResultBill addResultBill = new ResultBill();
|
|
|
- BeanUtil.copyProperties(resultBill, addResultBill);
|
|
|
- addResultBill.setConflictItemHisName(conflictItem.getHisName());
|
|
|
- addResultBill.setConflictItemHisDetailName(conflictItem.getHisDetailName());
|
|
|
- resultBillList.add(addResultBill);
|
|
|
- });
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(conflictMappingList)) {
|
|
|
+ if (resultBill.getConflictItemType().equals(GraphLabelEnum.MedAllergen.getName())
|
|
|
+ || resultBill.getConflictItemType().equals(GraphLabelEnum.OralMedicine.getName())
|
|
|
+ || resultBill.getConflictItemType().equals(GraphLabelEnum.Lis.getName())
|
|
|
+ || resultBill.getConflictItemType().equals(GraphLabelEnum.BillConflictItem.getName())
|
|
|
+ || resultBill.getConflictItemType().equals(GraphLabelEnum.Disease.getName())) {
|
|
|
+ resultBill.setSuccess(0);
|
|
|
+ resultBill.setMessage(StringUtil.isNotBlank(resultBill.getMessage())
|
|
|
+ ? resultBill.getMessage()
|
|
|
+ : "" +
|
|
|
+ "禁忌项缺少医院端映射;");
|
|
|
}
|
|
|
+ retConflictList.add(resultBill);
|
|
|
} else {
|
|
|
- if (ListUtil.isEmpty(conflictMappingList)) {
|
|
|
- billMappingList.forEach(billMappingItem -> {
|
|
|
- ResultBill addResultBill = new ResultBill();
|
|
|
- BeanUtil.copyProperties(resultBill, addResultBill);
|
|
|
- addResultBill.setBillItemHisName(billMappingItem.getHisName());
|
|
|
- addResultBill.setBillItemHisDetailName(billMappingItem.getHisDetailName());
|
|
|
- resultBillList.add(addResultBill);
|
|
|
- });
|
|
|
- } else {
|
|
|
- billMappingList.forEach(billMappingItem -> {
|
|
|
- ResultBill addResultBill = new ResultBill();
|
|
|
- BeanUtil.copyProperties(resultBill, addResultBill);
|
|
|
- addResultBill.setBillItemHisName(billMappingItem.getHisName());
|
|
|
- addResultBill.setBillItemHisDetailName(billMappingItem.getHisDetailName());
|
|
|
- conflictMappingList.forEach(conflictItem -> {
|
|
|
- ResultBill addExtResultBill = new ResultBill();
|
|
|
- BeanUtil.copyProperties(addResultBill, addExtResultBill);
|
|
|
- addExtResultBill.setConflictItemHisName(conflictItem.getHisName());
|
|
|
- addExtResultBill.setConflictItemHisDetailName(conflictItem.getHisDetailName());
|
|
|
- resultBillList.add(addExtResultBill);
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
+ conflictMappingList.forEach(conflictItem -> {
|
|
|
+ ResultBill addResultBill = new ResultBill();
|
|
|
+ BeanUtil.copyProperties(resultBill, addResultBill);
|
|
|
+ addResultBill.setConflictItemHisName(conflictItem.getHisName());
|
|
|
+ addResultBill.setConflictItemHisDetailName(conflictItem.getHisDetailName());
|
|
|
+ retConflictList.add(addResultBill);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//模拟输入值
|
|
|
- for (ResultBill result : resultBillList) {
|
|
|
- String orderType = getOrderType(result.getBillItemType());
|
|
|
+ for (ResultBill result : retConflictList) {
|
|
|
+ if (result.getSuccess() != null && result.getSuccess().equals(0)) {
|
|
|
+ retList.add(result);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if (result.getMaxValue() != null || result.getMinValue() != null) {
|
|
|
if (result.getConflictItemRange() == null) {
|
|
|
result.setConflictItemRange(0);
|
|
@@ -223,11 +288,7 @@ public class RuleConvertFacade {
|
|
|
ResultBill minResult = new ResultBill();
|
|
|
BeanUtil.copyProperties(result, minResult);
|
|
|
minResult.setInputValue(random(null, result.getMinValue()).toString());
|
|
|
- BillMsg billMsg = MsgUtil.getCommonBillMsg(minResult.getBillItemHisName(),
|
|
|
- minResult.getBillItemName(),
|
|
|
- minResult.getInputValue(),
|
|
|
- "禁忌" + minResult.getConflictItemType(),
|
|
|
- orderType);
|
|
|
+ BillMsg billMsg = getBillMsg(minResult);
|
|
|
minResult.setExpectedOutput(billMsg.getMsg());
|
|
|
retList.add(minResult);
|
|
|
}
|
|
@@ -235,31 +296,18 @@ public class RuleConvertFacade {
|
|
|
ResultBill maxResult = new ResultBill();
|
|
|
BeanUtil.copyProperties(result, maxResult);
|
|
|
maxResult.setInputValue(random(result.getMaxValue(), null).toString());
|
|
|
- BillMsg billMsg = MsgUtil.getCommonBillMsg(maxResult.getBillItemHisName(),
|
|
|
- maxResult.getBillItemName(),
|
|
|
- maxResult.getInputValue(),
|
|
|
- "禁忌" + maxResult.getConflictItemType(),
|
|
|
- orderType);
|
|
|
+ BillMsg billMsg = getBillMsg(maxResult);
|
|
|
maxResult.setExpectedOutput(billMsg.getMsg());
|
|
|
retList.add(maxResult);
|
|
|
}
|
|
|
} else {
|
|
|
result.setInputValue(random(result.getMinValue(), result.getMaxValue()).toString());
|
|
|
- BillMsg billMsg = MsgUtil.getCommonBillMsg(result.getBillItemHisName(),
|
|
|
- result.getBillItemName(),
|
|
|
- result.getInputValue(),
|
|
|
- "禁忌" + result.getConflictItemType(),
|
|
|
- orderType);
|
|
|
+ BillMsg billMsg = getBillMsg(result);
|
|
|
result.setExpectedOutput(billMsg.getMsg());
|
|
|
retList.add(result);
|
|
|
}
|
|
|
} else {
|
|
|
- //result.setInputValue(result.getConflictItemName());
|
|
|
- BillMsg billMsg = MsgUtil.getCommonBillMsg(result.getBillItemHisName(),
|
|
|
- result.getBillItemName(),
|
|
|
- result.getConflictItemName(),
|
|
|
- "禁忌" + result.getConflictItemType(),
|
|
|
- orderType);
|
|
|
+ BillMsg billMsg = getBillMsg(result);
|
|
|
result.setExpectedOutput(billMsg.getMsg());
|
|
|
retList.add(result);
|
|
|
}
|
|
@@ -275,6 +323,85 @@ public class RuleConvertFacade {
|
|
|
return item;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 模拟提示信息
|
|
|
+ *
|
|
|
+ * @param resultBill
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ 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 (StringUtil.isNotBlank(resultBill.getInputValue())) {
|
|
|
+ content += trimZero(resultBill.getInputValue());
|
|
|
+ }
|
|
|
+ billMsg = MsgUtil.getCommonBillMsg(resultBill.getBillItemHisName(),
|
|
|
+ resultBill.getBillItemName(),
|
|
|
+ content,
|
|
|
+ "禁忌" + resultBill.getConflictItemType(),
|
|
|
+ orderType);
|
|
|
+ }
|
|
|
+ return billMsg;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 生成随机数
|
|
|
*
|
|
@@ -295,41 +422,57 @@ public class RuleConvertFacade {
|
|
|
|
|
|
/**
|
|
|
* 开单类型转换
|
|
|
+ *
|
|
|
* @param type
|
|
|
* @return
|
|
|
*/
|
|
|
- public String getOrderType(String type){
|
|
|
- String orderType="";
|
|
|
- if(type.equals(GraphLabelEnum.LisSet.getName())){
|
|
|
- orderType=TypeEnum.lis.getName();
|
|
|
+ public String getOrderType(String type) {
|
|
|
+ String orderType = "";
|
|
|
+ if (type.equals(GraphLabelEnum.LisSet.getName())) {
|
|
|
+ orderType = TypeEnum.lis.getName();
|
|
|
}
|
|
|
- if(type.equals(GraphLabelEnum.PacsName)
|
|
|
- ||type.equals(GraphLabelEnum.PacsSubName)){
|
|
|
- orderType=TypeEnum.pacs.getName();
|
|
|
+ if (type.equals(GraphLabelEnum.PacsName)
|
|
|
+ || type.equals(GraphLabelEnum.PacsSubName)) {
|
|
|
+ orderType = TypeEnum.pacs.getName();
|
|
|
}
|
|
|
- if(type.equals(GraphLabelEnum.YiBaoDiseaseName.getName())){
|
|
|
- orderType=TypeEnum.disease.getName();
|
|
|
+ if (type.equals(GraphLabelEnum.YiBaoDiseaseName.getName())) {
|
|
|
+ orderType = TypeEnum.disease.getName();
|
|
|
}
|
|
|
- if(type.equals(GraphLabelEnum.MedRegName.getName())
|
|
|
- ||type.equals(GraphLabelEnum.Medicine.getName())){
|
|
|
- orderType=TypeEnum.drug.getName();
|
|
|
+ if (type.equals(GraphLabelEnum.MedRegName.getName())
|
|
|
+ || type.equals(GraphLabelEnum.Medicine.getName())) {
|
|
|
+ orderType = TypeEnum.drug.getName();
|
|
|
}
|
|
|
- if(type.equals(GraphLabelEnum.ClinicalFinding.getName())){
|
|
|
- orderType=TypeEnum.clinical.getName();
|
|
|
+ if (type.equals(GraphLabelEnum.ClinicalFinding.getName())) {
|
|
|
+ orderType = TypeEnum.clinical.getName();
|
|
|
}
|
|
|
- if(type.equals(GraphLabelEnum.YiBaoOperationName.getName())){
|
|
|
- orderType=TypeEnum.operation.getName();
|
|
|
+ if (type.equals(GraphLabelEnum.YiBaoOperationName.getName())) {
|
|
|
+ orderType = TypeEnum.operation.getName();
|
|
|
}
|
|
|
- if(type.equals(GraphLabelEnum.Vital.getName())){
|
|
|
- orderType=TypeEnum.vital.getName();
|
|
|
+ if (type.equals(GraphLabelEnum.Vital.getName())) {
|
|
|
+ orderType = TypeEnum.vital.getName();
|
|
|
}
|
|
|
- if(type.equals(GraphLabelEnum.TransfusionRemind.getName())
|
|
|
- ||type.equals(GraphLabelEnum.TransfusionSuggest.getName())){
|
|
|
- orderType=TypeEnum.transfusion.getName();
|
|
|
+ if (type.equals(GraphLabelEnum.TransfusionRemind.getName())
|
|
|
+ || type.equals(GraphLabelEnum.TransfusionSuggest.getName())) {
|
|
|
+ orderType = TypeEnum.transfusion.getName();
|
|
|
}
|
|
|
- if(type.equals(GraphLabelEnum.Age.getName())){
|
|
|
- orderType=TypeEnum.age.getName();
|
|
|
+ if (type.equals(GraphLabelEnum.Age.getName())) {
|
|
|
+ orderType = TypeEnum.age.getName();
|
|
|
}
|
|
|
return orderType;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 去除小数点末位的0,如果都是0同时去除小数点
|
|
|
+ *
|
|
|
+ * @param s
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String trimZero(String s) {
|
|
|
+ if (s.indexOf(".") > 0) {
|
|
|
+ //正则表达
|
|
|
+ s = s.replaceAll("0+?$", "");//去掉后面无用的零
|
|
|
+ s = s.replaceAll("[.]$", "");//如小数点后面全是零则去掉小数点
|
|
|
+ }
|
|
|
+ return s;
|
|
|
+ }
|
|
|
}
|