|
@@ -6,14 +6,17 @@ import com.diagbot.dto.BillMsg;
|
|
|
import com.diagbot.dto.MedClassMedDTO;
|
|
|
import com.diagbot.dto.RuleDTO;
|
|
|
import com.diagbot.entity.KlConcept;
|
|
|
+import com.diagbot.entity.KlRuleBase;
|
|
|
import com.diagbot.entity.ResultRule;
|
|
|
import com.diagbot.enums.ConEnum;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.enums.LexiconEnum;
|
|
|
import com.diagbot.enums.RuleBaseTypeEnum;
|
|
|
+import com.diagbot.enums.RuleTypeEnum;
|
|
|
import com.diagbot.enums.StatusEnum;
|
|
|
import com.diagbot.enums.TypeEnum;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
+import com.diagbot.util.FastJsonUtils;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.MsgUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
@@ -46,6 +49,8 @@ public class MedRuleConvertFacade {
|
|
|
private KlRuleFacade klRuleFacade;
|
|
|
@Autowired
|
|
|
private KlRelationFacade klRelationFacade;
|
|
|
+ @Autowired
|
|
|
+ private KlRuleBaseFacade klRuleBaseFacade;
|
|
|
|
|
|
@Autowired
|
|
|
private LisConfigFacade lisConfigFacade;
|
|
@@ -161,6 +166,7 @@ public class MedRuleConvertFacade {
|
|
|
Map<Integer, List<ResultRule>> tempMap = new HashMap<>();
|
|
|
Integer num = 1;
|
|
|
for (RuleDTO record : entry.getValue()) {
|
|
|
+ System.out.println(FastJsonUtils.getBeanToJson(record));
|
|
|
List<ResultRule> tempList = Lists.newLinkedList();
|
|
|
|
|
|
ResultRule result = new ResultRule();
|
|
@@ -185,26 +191,27 @@ public class MedRuleConvertFacade {
|
|
|
result.setRuleBaseHisDetailName("");
|
|
|
result.setGroupType(record.getGroupType());
|
|
|
|
|
|
- //年龄转换数值
|
|
|
- switch (result.getRuleBaseLibName()) {
|
|
|
- case "新生儿":
|
|
|
- result.setRuleBaseInputValue(random_int(1, 12, true, true).toString());
|
|
|
- result.setRuleBaseUnit("月");
|
|
|
- break;
|
|
|
- case "幼儿":
|
|
|
- result.setRuleBaseInputValue(random_int(1, 6, true, false).toString());
|
|
|
- break;
|
|
|
- case "儿童":
|
|
|
- result.setRuleBaseInputValue(random_int(1, 6, true, false).toString());
|
|
|
- break;
|
|
|
- case "成人":
|
|
|
- result.setRuleBaseInputValue(random_int(18, 200, true, false).toString());
|
|
|
- break;
|
|
|
- case "月经期":
|
|
|
- result.setRuleBaseInputValue(random_int(0, 99, true, true).toString());
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
+ if (StringUtil.isNotBlank(result.getRuleBaseLibName())) {
|
|
|
+ switch (result.getRuleBaseLibName()) {
|
|
|
+ case "新生儿":
|
|
|
+ result.setRuleBaseInputValue(random_int(1, 12, true, true).toString());
|
|
|
+ result.setRuleBaseUnit("月");
|
|
|
+ break;
|
|
|
+ case "幼儿":
|
|
|
+ result.setRuleBaseInputValue(random_int(1, 6, true, false).toString());
|
|
|
+ break;
|
|
|
+ case "儿童":
|
|
|
+ result.setRuleBaseInputValue(random_int(6, 18, true, false).toString());
|
|
|
+ break;
|
|
|
+ case "成人":
|
|
|
+ result.setRuleBaseInputValue(random_int(18, 200, true, false).toString());
|
|
|
+ break;
|
|
|
+ case "月经期":
|
|
|
+ result.setRuleBaseInputValue(random_int(0, 99, true, true).toString());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -213,18 +220,18 @@ public class MedRuleConvertFacade {
|
|
|
result.setRuleMsg(record.getRuleMsg());
|
|
|
|
|
|
//其他值提醒辅检
|
|
|
- if (result.getRuleType().equals(4)) {
|
|
|
+ if (result.getRuleType().equals(RuleTypeEnum.OtherValReminders.getKey())) {
|
|
|
result.setExpectedOutput(record.getRuleMsg());
|
|
|
}
|
|
|
|
|
|
//高危药品
|
|
|
- if (result.getRuleType().equals(2)
|
|
|
+ if (result.getRuleType().equals(RuleTypeEnum.HighRisk.getKey())
|
|
|
&& result.getRuleLibType().equals(LexiconEnum.Medicine.getKey())) {
|
|
|
result.setReferenceValue(record.getRuleMsg());
|
|
|
}
|
|
|
|
|
|
//输血其他值提醒
|
|
|
- if (result.getRuleType().equals(5)) {
|
|
|
+ if (result.getRuleType().equals(RuleTypeEnum.Transfusion.getKey())) {
|
|
|
result.setReferenceValue(record.getRuleMsg());
|
|
|
}
|
|
|
//比较关系
|
|
@@ -235,8 +242,8 @@ public class MedRuleConvertFacade {
|
|
|
if (record.getRuleBaseMaxValue() >= record.getRuleBaseMinValue()) {
|
|
|
ResultRule valResult = new ResultRule();
|
|
|
BeanUtil.copyProperties(result, valResult);
|
|
|
- valResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()));
|
|
|
- valResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()));
|
|
|
+ valResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
+ valResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
if (valResult.getRuleBaseLibName().equals("年龄")
|
|
|
&& valResult.getRuleBaseMinValue().doubleValue() > 1D) {
|
|
|
valResult.setRuleBaseInputValue(random_int(record.getRuleBaseMinValue().intValue(),
|
|
@@ -262,7 +269,7 @@ public class MedRuleConvertFacade {
|
|
|
//大于最小值inputValue>minValue
|
|
|
ResultRule gtResult = new ResultRule();
|
|
|
BeanUtil.copyProperties(result, gtResult);
|
|
|
- gtResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()));
|
|
|
+ gtResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
if (gtResult.getRuleBaseLibName().equals("年龄")
|
|
|
&& gtResult.getRuleBaseMinValue().doubleValue() > 1D) {
|
|
|
gtResult.setRuleBaseInputValue(random_int(record.getRuleBaseMinValue().intValue(),
|
|
@@ -285,7 +292,7 @@ public class MedRuleConvertFacade {
|
|
|
ResultRule ltResult = new ResultRule();
|
|
|
BeanUtil.copyProperties(result, ltResult);
|
|
|
//inputValue>minValue
|
|
|
- ltResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()));
|
|
|
+ ltResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
if (ltResult.getRuleBaseLibName().equals("年龄")
|
|
|
&& ltResult.getRuleBaseMaxValue().doubleValue() > 1D) {
|
|
|
ltResult.setRuleBaseInputValue(random_int(null,
|
|
@@ -308,7 +315,7 @@ public class MedRuleConvertFacade {
|
|
|
&& StringUtil.isBlank(record.getRuleBaseMaxOperator())) {
|
|
|
ResultRule gtResult = new ResultRule();
|
|
|
BeanUtil.copyProperties(result, gtResult);
|
|
|
- gtResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()));
|
|
|
+ gtResult.setRuleBaseMinValue(new BigDecimal(record.getRuleBaseMinValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
if (gtResult.getRuleBaseLibName().equals("年龄")
|
|
|
&& gtResult.getRuleBaseMinValue().doubleValue() > 1D) {
|
|
|
gtResult.setRuleBaseInputValue(random_int(record.getRuleBaseMinValue().intValue(),
|
|
@@ -331,7 +338,7 @@ public class MedRuleConvertFacade {
|
|
|
ResultRule ltResult = new ResultRule();
|
|
|
BeanUtil.copyProperties(result, ltResult);
|
|
|
//inputValue>minValue
|
|
|
- ltResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()));
|
|
|
+ ltResult.setRuleBaseMaxValue(new BigDecimal(record.getRuleBaseMaxValue()).setScale(3, BigDecimal.ROUND_HALF_UP));
|
|
|
if (ltResult.getRuleBaseLibName().equals("年龄")
|
|
|
&& ltResult.getRuleBaseMaxValue().doubleValue() > 1D) {
|
|
|
ltResult.setRuleBaseInputValue(random_int(null,
|
|
@@ -388,9 +395,11 @@ public class MedRuleConvertFacade {
|
|
|
for (ResultRule result : entry.getValue()) {
|
|
|
List<ResultRule> tempList = Lists.newLinkedList();
|
|
|
if (result.getHasSubCond() != null && result.getHasSubCond().equals(1)) {
|
|
|
- if (result.getRuleBaseLibType().equals(LexiconEnum.MedChemClass.getKey())
|
|
|
+ if (result.getRuleBaseLibType() != null
|
|
|
+ && (result.getRuleBaseLibType().equals(LexiconEnum.MedChemClass.getKey())
|
|
|
|| result.getRuleBaseLibType().equals(LexiconEnum.MedZhiLiaoClass.getKey())
|
|
|
- || result.getRuleBaseLibType().equals(LexiconEnum.MedYaoLiClass.getKey())) {
|
|
|
+ || result.getRuleBaseLibType().equals(LexiconEnum.MedYaoLiClass.getKey())
|
|
|
+ || result.getRuleBaseLibType().equals(LexiconEnum.MedJiePouClass.getKey()))) {
|
|
|
List<String> medicines = medClassMedMap.get(result.getRuleBaseLibName());
|
|
|
if (ListUtil.isNotEmpty(medicines)) {
|
|
|
for (String med : medicines) {
|
|
@@ -427,7 +436,7 @@ public class MedRuleConvertFacade {
|
|
|
Integer num = 1;
|
|
|
for (ResultRule result : entry.getValue()) {
|
|
|
List<ResultRule> tempList = Lists.newLinkedList();
|
|
|
- if (result.getRuleType().equals(4)) {
|
|
|
+ if (result.getRuleType().equals(RuleTypeEnum.OtherValReminders.getKey())) {
|
|
|
if (StringUtil.isNotBlank(result.getRuleBaseLibName())
|
|
|
&& result.getRuleBaseLibName().equals("流产")) {
|
|
|
List<String> conflictDiseases = Lists.newLinkedList();
|
|
@@ -447,7 +456,7 @@ public class MedRuleConvertFacade {
|
|
|
for (String conflictDisease : conflictDiseases) {
|
|
|
ResultRule convertResult = new ResultRule();
|
|
|
BeanUtil.copyProperties(result, convertResult);
|
|
|
- convertResult.setReferenceValue(convertResult.getRuleBaseLibType() + "_" + convertResult.getRuleBaseLibName() + "_" + convertResult.getRuleBaseLibName());
|
|
|
+ convertResult.setReferenceValue(convertResult.getRuleBaseLibType() + "_" + convertResult.getRuleBaseLibTypeName() + "_" + convertResult.getRuleBaseLibName());
|
|
|
convertResult.setRuleBaseLibName(conflictDisease);
|
|
|
convertResult.setRuleBaseLibType(LexiconEnum.Disease.getKey());
|
|
|
convertResult.setRuleBaseLibTypeName(LexiconEnum.Disease.getName());
|
|
@@ -473,7 +482,7 @@ public class MedRuleConvertFacade {
|
|
|
Integer num = 1;
|
|
|
for (ResultRule result : entry.getValue()) {
|
|
|
List<ResultRule> tempList = Lists.newLinkedList();
|
|
|
- if (result.getRuleType().equals(6)) {
|
|
|
+ if (result.getRuleType().equals(RuleTypeEnum.Repeatedly.getKey())) {
|
|
|
if (StringUtil.isNotBlank(result.getRuleBaseInputValue())) {
|
|
|
List<String> pacsResultArr = Arrays.asList(result.getRuleBaseInputValue().split("\\|"));
|
|
|
for (String pacsResult : pacsResultArr) {
|
|
@@ -503,76 +512,84 @@ public class MedRuleConvertFacade {
|
|
|
for (Map.Entry<Long, List<ResultRule>> entry : billMappingMap.entrySet()) {
|
|
|
Map<Integer, List<ResultRule>> tempMap = new HashMap<>();
|
|
|
Integer num = 1;
|
|
|
- for (ResultRule result : entry.getValue()) {
|
|
|
+ for (int i = 0; i < entry.getValue().size(); i++) {
|
|
|
+ //for (ResultRule result : entry.getValue()) {
|
|
|
+ ResultRule result = entry.getValue().get(i);
|
|
|
List<ResultRule> tempList = Lists.newLinkedList();
|
|
|
- if (result.getRuleLibType().equals(LexiconEnum.Medicine.getKey())) {
|
|
|
- List<ResultRule> mappingList = getMappingResult_medicine(result, drugConfigMap, 1);
|
|
|
- if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
- && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
- mappingList.forEach(item -> {
|
|
|
- item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
- });
|
|
|
- }
|
|
|
- tempList.addAll(mappingList);
|
|
|
- } else if (result.getRuleLibType().equals(LexiconEnum.Operation.getKey())) {
|
|
|
- List<ResultRule> mappingList = getMappingResult(result, operationConfigMap, 1);
|
|
|
- if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
- && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
- mappingList.forEach(item -> {
|
|
|
- item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
- });
|
|
|
- }
|
|
|
- tempList.addAll(mappingList);
|
|
|
- } else if (result.getRuleLibType().equals(LexiconEnum.LisName.getKey())) {
|
|
|
- List<ResultRule> mappingList = getMappingResult_lis(result, lisConfigMap, 1);
|
|
|
- if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
- && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
- mappingList.forEach(item -> {
|
|
|
- item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
- item.setRuleBaseHisDetailName(item.getRuleHisDetailName());
|
|
|
- });
|
|
|
- }
|
|
|
- tempList.addAll(mappingList);
|
|
|
- } else if (result.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
|
|
|
- List<ResultRule> mappingList = getMappingResult_lis(result, lisConfigMap, 1);
|
|
|
- if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
- && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
- mappingList.forEach(item -> {
|
|
|
- item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
- item.setRuleBaseHisDetailName(item.getRuleHisDetailName());
|
|
|
- });
|
|
|
- }
|
|
|
- tempList.addAll(mappingList);
|
|
|
- } else if (result.getRuleLibType().equals(LexiconEnum.PacsName.getKey())) {
|
|
|
- List<ResultRule> mappingList = getMappingResult(result, pacsConfigMap, 1);
|
|
|
- if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
- && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
- mappingList.forEach(item -> {
|
|
|
- item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
- });
|
|
|
- }
|
|
|
- tempList.addAll(mappingList);
|
|
|
- } else if (result.getRuleLibType().equals(LexiconEnum.PacsSubName.getKey())) {
|
|
|
- List<ResultRule> mappingList = getMappingResult(result, pacsConfigMap, 1);
|
|
|
- if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
- && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
- mappingList.forEach(item -> {
|
|
|
- item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
- });
|
|
|
- }
|
|
|
- tempList.addAll(mappingList);
|
|
|
- } else if (result.getRuleLibType().equals(LexiconEnum.Transfusion.getKey())) {
|
|
|
- List<ResultRule> mappingList = getMappingResult(result, transfusionConfigMap, 1);
|
|
|
- if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
- && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
- mappingList.forEach(item -> {
|
|
|
- item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
- });
|
|
|
+ if (i == 0) {
|
|
|
+ if (result.getRuleLibType().equals(LexiconEnum.Medicine.getKey())) {
|
|
|
+ List<ResultRule> mappingList = getMappingResult_medicine(result, drugConfigMap, 1, result.getRuleType());
|
|
|
+ if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
+ && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
+ mappingList.forEach(item -> {
|
|
|
+ item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ tempList.addAll(mappingList);
|
|
|
+ } else if (result.getRuleLibType().equals(LexiconEnum.Operation.getKey())) {
|
|
|
+ List<ResultRule> mappingList = getMappingResult(result, operationConfigMap, 1);
|
|
|
+ if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
+ && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
+ mappingList.forEach(item -> {
|
|
|
+ item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ tempList.addAll(mappingList);
|
|
|
+ } else if (result.getRuleLibType().equals(LexiconEnum.LisName.getKey())) {
|
|
|
+ List<ResultRule> mappingList = getMappingResult_lis(result, lisConfigMap, 1);
|
|
|
+ if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
+ && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
+ mappingList.forEach(item -> {
|
|
|
+ item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
+ item.setRuleBaseHisDetailName(item.getRuleHisDetailName());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ tempList.addAll(mappingList);
|
|
|
+ } else if (result.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
|
|
|
+ List<ResultRule> mappingList = getMappingResult_lis(result, lisConfigMap, 1);
|
|
|
+ if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
+ && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
+ mappingList.forEach(item -> {
|
|
|
+ item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
+ item.setRuleBaseHisDetailName(item.getRuleHisDetailName());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ tempList.addAll(mappingList);
|
|
|
+ } else if (result.getRuleLibType().equals(LexiconEnum.PacsName.getKey())) {
|
|
|
+ List<ResultRule> mappingList = getMappingResult(result, pacsConfigMap, 1);
|
|
|
+ if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
+ && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
+ mappingList.forEach(item -> {
|
|
|
+ item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ tempList.addAll(mappingList);
|
|
|
+ } else if (result.getRuleLibType().equals(LexiconEnum.PacsSubName.getKey())) {
|
|
|
+ List<ResultRule> mappingList = getMappingResult(result, pacsConfigMap, 1);
|
|
|
+ if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
+ && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
+ mappingList.forEach(item -> {
|
|
|
+ item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ tempList.addAll(mappingList);
|
|
|
+ } else if (result.getRuleLibType().equals(LexiconEnum.Transfusion.getKey())) {
|
|
|
+ List<ResultRule> mappingList = getMappingResult(result, transfusionConfigMap, 1);
|
|
|
+ if (result.getRuleLibType().equals(result.getRuleBaseLibType())
|
|
|
+ && result.getRuleLibName().equals(result.getRuleBaseLibName())) {
|
|
|
+ mappingList.forEach(item -> {
|
|
|
+ item.setRuleBaseHisName(item.getRuleHisName());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ tempList.addAll(mappingList);
|
|
|
+ } else if (result.getRuleLibType().equals(LexiconEnum.PacsResult.getKey())) {
|
|
|
+ tempList.add(result);
|
|
|
+ } else {
|
|
|
+ tempList.add(result);
|
|
|
}
|
|
|
- tempList.addAll(mappingList);
|
|
|
- } else if (result.getRuleLibType().equals(LexiconEnum.PacsResult.getKey())) {
|
|
|
- tempList.add(result);
|
|
|
} else {
|
|
|
+ result.setRuleHisName(entry.getValue().get(0).getRuleHisName());
|
|
|
+ result.setRuleHisDetailName(entry.getValue().get(0).getRuleHisDetailName());
|
|
|
tempList.add(result);
|
|
|
}
|
|
|
tempMap.put(num++, tempList);
|
|
@@ -598,7 +615,7 @@ public class MedRuleConvertFacade {
|
|
|
List<ResultRule> mappingList = getMappingResult(result, diseaseConfigMap, 2);
|
|
|
tempList.addAll(mappingList);
|
|
|
} else if (result.getRuleBaseLibType().equals(LexiconEnum.Medicine.getKey())) {
|
|
|
- List<ResultRule> mappingList = getMappingResult_medicine(result, drugConfigMap, 2);
|
|
|
+ List<ResultRule> mappingList = getMappingResult_medicine(result, drugConfigMap, 2, result.getRuleType());
|
|
|
tempList.addAll(mappingList);
|
|
|
} else if (result.getRuleBaseLibType().equals(LexiconEnum.LisSubName.getKey())) {
|
|
|
List<ResultRule> mappingList = getMappingResult_lis(result, lisConfigMap, 2);
|
|
@@ -671,7 +688,7 @@ public class MedRuleConvertFacade {
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
- public List<ResultRule> addRuleOrderNo(Map<Integer, List<ResultRule>> map, Integer index, List<ResultRule> tempList, List<ResultRule> retList) {
|
|
|
+ public List<ResultRule> addRuleOrderNo(Map<Integer, List<ResultRule>> map, Integer index, List<ResultRule> tempList, List<ResultRule> retList) {
|
|
|
if (index < map.size()) {
|
|
|
List<ResultRule> list = map.get(index++);
|
|
|
for (ResultRule subResult : list) {
|
|
@@ -723,10 +740,87 @@ public class MedRuleConvertFacade {
|
|
|
.collect(Collectors.toList()));
|
|
|
|
|
|
//带子条件的规则
|
|
|
- Map<Long, List<RuleDTO>> ruleIdMap = list.stream()
|
|
|
+ List<RuleDTO> listWithCond = list.stream()
|
|
|
.filter(i -> i.getHasSubCond() != null && i.getHasSubCond().equals(1))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(listWithCond)) {
|
|
|
+ return retList;
|
|
|
+ }
|
|
|
+ List<Long> ruleBaseIds = listWithCond.stream()
|
|
|
+ .map(i -> i.getRuleBaseId())
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<KlRuleBase> ruleBaseList = klRuleBaseFacade.list(new QueryWrapper<KlRuleBase>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("status", StatusEnum.Enable.getKey()));
|
|
|
+ //.in("id", ruleBaseIds));
|
|
|
+ Map<Long, String> ruleBaseMap = ruleBaseList.stream()
|
|
|
+ .collect(Collectors.toMap(k -> k.getId(), v -> v.getConceptId() + "_"
|
|
|
+ + v.getType() + "_"
|
|
|
+ + v.getMaxOperator() + "_"
|
|
|
+ + v.getMaxValue() + "_"
|
|
|
+ + v.getMaxUnit() + "_"
|
|
|
+ + v.getMinOperator() + "_"
|
|
|
+ + v.getMinValue() + "_"
|
|
|
+ + v.getMinUnit() + "_"
|
|
|
+ + v.getEqOperator() + "_"
|
|
|
+ + v.getEqValue() + "_"
|
|
|
+ + v.getEqUnit()));
|
|
|
+ /*Map<String, String> sameCondMap = ruleBaseList.stream()
|
|
|
+ .collect(Collectors.groupingBy(k -> k.getConceptId() + "_"
|
|
|
+ + k.getType() + "_"
|
|
|
+ + k.getMaxOperator() + "_"
|
|
|
+ + k.getMaxValue() + "_"
|
|
|
+ + k.getMaxUnit() + "_"
|
|
|
+ + k.getMinOperator() + "_"
|
|
|
+ + k.getMinValue() + "_"
|
|
|
+ + k.getMinUnit() + "_"
|
|
|
+ + k.getEqOperator() + "_"
|
|
|
+ + k.getEqValue() + "_"
|
|
|
+ + k.getEqUnit(),
|
|
|
+ Collectors.mapping(v -> v.getId().toString(), Collectors.joining("|"))));
|
|
|
+ Map<String, Boolean> usedCondMap = new HashMap<>();
|
|
|
+ for (Map.Entry<String, String> entry : sameCondMap.entrySet()) {
|
|
|
+ usedCondMap.put(entry.getValue(), false);
|
|
|
+ }*/
|
|
|
+
|
|
|
+ Map<Long, List<RuleDTO>> ruleIdMap = listWithCond.stream()
|
|
|
.collect(Collectors.groupingBy(RuleDTO::getRuleId));
|
|
|
- //Map<ruleId,Map<groupType_ruleBaseId,RuleDTO>>
|
|
|
+ Map<Long, Map<String, RuleDTO>> baseNestMap = new HashMap<>();
|
|
|
+ Map<Long, String> baseCondMap = new HashMap<>();
|
|
|
+ for (Map.Entry<Long, List<RuleDTO>> entry : ruleIdMap.entrySet()) {
|
|
|
+ Map<String, RuleDTO> subMap = new HashMap<>();
|
|
|
+ for (RuleDTO result : entry.getValue()) {
|
|
|
+ subMap.put(ruleBaseMap.get(result.getRuleBaseId()), result);
|
|
|
+ }
|
|
|
+ baseNestMap.put(entry.getKey(), subMap);
|
|
|
+ baseCondMap.put(entry.getKey(), subMap.keySet().stream().sorted().collect(Collectors.joining("|")));
|
|
|
+ }
|
|
|
+ Map<String, List<Long>> baseReversedMap = new HashMap<>();
|
|
|
+ for (Map.Entry<Long, String> entry : baseCondMap.entrySet()) {
|
|
|
+ List<Long> ruleIds = Lists.newLinkedList();
|
|
|
+ if (baseReversedMap.containsKey(entry.getValue())) {
|
|
|
+ ruleIds = baseReversedMap.get(entry.getValue());
|
|
|
+ }
|
|
|
+ ruleIds.add(entry.getKey());
|
|
|
+ baseReversedMap.put(entry.getValue(), ruleIds);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (Map.Entry<String, List<Long>> entry : baseReversedMap.entrySet()) {
|
|
|
+ if (ListUtil.isEmpty(entry.getValue())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Integer num = 0;
|
|
|
+ List<String> baseIdList = Arrays.asList(entry.getKey().split("\\|"));
|
|
|
+ for (Long ruleId : entry.getValue()) {
|
|
|
+ retList.add(baseNestMap.get(ruleId).get(baseIdList.get(num++)));
|
|
|
+ if (num == baseIdList.size()) {
|
|
|
+ num = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*//Map<ruleId,Map<groupType_ruleBaseId,RuleDTO>>
|
|
|
Map<Long, Map<String, RuleDTO>> nestMap = new HashMap<>();
|
|
|
//Map<ruleId,groupType_ruleBaseId|groupType_ruleBaseId|groupType_ruleBaseId……>
|
|
|
Map<Long, String> conditionMap = new HashMap<>();
|
|
@@ -739,6 +833,7 @@ public class MedRuleConvertFacade {
|
|
|
.map(i -> i.getGroupType() + "_" + i.getRuleBaseId())
|
|
|
.collect(Collectors.joining("|")));
|
|
|
}
|
|
|
+
|
|
|
//Map<groupType_ruleBaseId,List<ruleId>
|
|
|
Map<String, List<Long>> reversedMap = new HashMap<>();
|
|
|
for (Map.Entry<Long, String> entry : conditionMap.entrySet()) {
|
|
@@ -762,7 +857,7 @@ public class MedRuleConvertFacade {
|
|
|
num = 0;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
return retList;
|
|
|
}
|
|
@@ -824,7 +919,8 @@ public class MedRuleConvertFacade {
|
|
|
* @param type
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<ResultRule> getMappingResult_medicine(ResultRule result, Map<String, Map<String, Map<String, List<Long>>>> configMap, Integer type) {
|
|
|
+ public List<ResultRule> getMappingResult_medicine(ResultRule result, Map<String, Map<String,
|
|
|
+ Map<String, List<Long>>>> configMap, Integer type, Integer ruleType) {
|
|
|
List<ResultRule> retList = Lists.newLinkedList();
|
|
|
if (configMap == null || configMap.size() == 0) {
|
|
|
result.setSuccess(0);
|
|
@@ -843,29 +939,90 @@ public class MedRuleConvertFacade {
|
|
|
keyName = result.getRuleBaseLibName();
|
|
|
}
|
|
|
|
|
|
- List<String> hisNames = configMap.containsKey(keyName)
|
|
|
- //? configMap.get(keyName).values().stream().map(i -> i.keySet()).flatMap(Collection::stream).distinct().collect(Collectors.toList())
|
|
|
- ? new ArrayList<>(configMap.get(keyName).keySet())
|
|
|
- : new ArrayList<>();
|
|
|
- if (ListUtil.isNotEmpty(hisNames)) {
|
|
|
- for (String hisName : hisNames) {
|
|
|
- ResultRule bmResult = new ResultRule();
|
|
|
- BeanUtil.copyProperties(result, bmResult);
|
|
|
+ if (ruleType.equals(RuleTypeEnum.HighRisk.getKey())) {
|
|
|
+ Map<String, Map<String, List<Long>>> hisMap = configMap.containsKey(keyName)
|
|
|
+ ? configMap.get(keyName)
|
|
|
+ : new HashMap<>();
|
|
|
+ if (hisMap.size() > 0) {
|
|
|
+ for (Map.Entry<String, Map<String, List<Long>>> hisEntry : hisMap.entrySet()) {
|
|
|
+ if (result.getRuleBaseLibType().equals(LexiconEnum.Form.getKey())
|
|
|
+ && StringUtil.isNotBlank(result.getRuleBaseLibName())) {
|
|
|
+ if (hisEntry.getValue() == null || hisEntry.getValue().size() == 0) {
|
|
|
+ ResultRule bmResult = new ResultRule();
|
|
|
+ BeanUtil.copyProperties(result, bmResult);
|
|
|
+ bmResult.setSuccess(0);
|
|
|
+ if (type.equals(1)) {
|
|
|
+ bmResult.setMessage(result.getMessage() + result.getRuleLibName() + "(" + result.getRuleLibTypeName()
|
|
|
+ + ")+" + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
|
|
|
+ } else if (type.equals(2)) {
|
|
|
+ bmResult.setMessage(result.getMessage() + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
|
|
|
+ }
|
|
|
+ retList.add(bmResult);
|
|
|
+ } else {
|
|
|
+ ResultRule bmResult = new ResultRule();
|
|
|
+ BeanUtil.copyProperties(result, bmResult);
|
|
|
+ if (hisEntry.getValue().containsKey(result.getRuleBaseLibName())) {
|
|
|
+ if (type.equals(1)) {
|
|
|
+ bmResult.setRuleHisName(hisEntry.getKey());
|
|
|
+ } else if (type.equals(2)) {
|
|
|
+ bmResult.setRuleBaseHisName(hisEntry.getKey());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ bmResult.setSuccess(0);
|
|
|
+ if (type.equals(1)) {
|
|
|
+ bmResult.setMessage(result.getMessage() + result.getRuleLibName() + "(" + result.getRuleLibTypeName()
|
|
|
+ + ")+" + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
|
|
|
+ } else if (type.equals(2)) {
|
|
|
+ bmResult.setMessage(result.getMessage() + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ retList.add(bmResult);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ResultRule bmResult = new ResultRule();
|
|
|
+ BeanUtil.copyProperties(result, bmResult);
|
|
|
+ if (type.equals(1)) {
|
|
|
+ bmResult.setRuleHisName(hisEntry.getKey());
|
|
|
+ } else if (type.equals(2)) {
|
|
|
+ bmResult.setRuleBaseHisName(hisEntry.getKey());
|
|
|
+ }
|
|
|
+ retList.add(bmResult);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setSuccess(0);
|
|
|
if (type.equals(1)) {
|
|
|
- bmResult.setRuleHisName(hisName);
|
|
|
+ result.setMessage(result.getMessage() + result.getRuleLibName() + "(" + result.getRuleLibTypeName() + ")缺少医院端映射;");
|
|
|
} else if (type.equals(2)) {
|
|
|
- bmResult.setRuleBaseHisName(hisName);
|
|
|
+ result.setMessage(result.getMessage() + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
|
|
|
}
|
|
|
- retList.add(bmResult);
|
|
|
+ retList.add(result);
|
|
|
}
|
|
|
} else {
|
|
|
- result.setSuccess(0);
|
|
|
- if (type.equals(1)) {
|
|
|
- result.setMessage(result.getMessage() + result.getRuleLibName() + "(" + result.getRuleLibTypeName() + ")缺少医院端映射;");
|
|
|
- } else if (type.equals(2)) {
|
|
|
- result.setMessage(result.getMessage() + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
|
|
|
+ List<String> hisNames = configMap.containsKey(keyName)
|
|
|
+ //? configMap.get(keyName).values().stream().map(i -> i.keySet()).flatMap(Collection::stream).distinct().collect(Collectors.toList())
|
|
|
+ ? new ArrayList<>(configMap.get(keyName).keySet())
|
|
|
+ : new ArrayList<>();
|
|
|
+ if (ListUtil.isNotEmpty(hisNames)) {
|
|
|
+ for (String hisName : hisNames) {
|
|
|
+ ResultRule bmResult = new ResultRule();
|
|
|
+ BeanUtil.copyProperties(result, bmResult);
|
|
|
+ if (type.equals(1)) {
|
|
|
+ bmResult.setRuleHisName(hisName);
|
|
|
+ } else if (type.equals(2)) {
|
|
|
+ bmResult.setRuleBaseHisName(hisName);
|
|
|
+ }
|
|
|
+ retList.add(bmResult);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setSuccess(0);
|
|
|
+ if (type.equals(1)) {
|
|
|
+ result.setMessage(result.getMessage() + result.getRuleLibName() + "(" + result.getRuleLibTypeName() + ")缺少医院端映射;");
|
|
|
+ } else if (type.equals(2)) {
|
|
|
+ result.setMessage(result.getMessage() + result.getRuleBaseLibName() + "(" + result.getRuleBaseLibTypeName() + ")缺少医院端映射;");
|
|
|
+ }
|
|
|
+ retList.add(result);
|
|
|
}
|
|
|
- retList.add(result);
|
|
|
}
|
|
|
return retList;
|
|
|
}
|
|
@@ -941,7 +1098,7 @@ public class MedRuleConvertFacade {
|
|
|
conType = getConType(resultRule.getRuleBaseLibTypeName(), resultRule.getRuleType(), resultRule.getRuleBaseType());
|
|
|
}
|
|
|
//开单合理性
|
|
|
- if (resultRule.getRuleType().equals(1)) {
|
|
|
+ if (resultRule.getRuleType().equals(RuleTypeEnum.Rationality.getKey())) {
|
|
|
if (resultRule.getHasSubCond() != null && resultRule.getHasSubCond().equals(1)) {
|
|
|
if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Disease.getKey())) {
|
|
|
//禁忌疾病
|
|
@@ -1071,14 +1228,14 @@ public class MedRuleConvertFacade {
|
|
|
if (StringUtil.isNotBlank(resultRule.getRuleBaseInputValue())) {
|
|
|
content += trimZero(resultRule.getRuleBaseInputValue());
|
|
|
}
|
|
|
- billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleHisName(),
|
|
|
+ /*billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleHisName(),
|
|
|
resultRule.getRuleLibName(),
|
|
|
content,
|
|
|
conType,
|
|
|
- orderType);
|
|
|
+ orderType);*/
|
|
|
}
|
|
|
}
|
|
|
- } else if (resultRule.getRuleType().equals(2)) {
|
|
|
+ } else if (resultRule.getRuleType().equals(RuleTypeEnum.HighRisk.getKey())) {
|
|
|
if (resultRule.getHasSubCond() != null && resultRule.getHasSubCond().equals(1)) {
|
|
|
if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Disease.getKey())) {
|
|
|
billMsg = MsgUtil.getCommonHighRiskMsg(resultRule.getRuleBaseHisName(), resultRule.getRuleHisName(), orderType);
|
|
@@ -1126,7 +1283,7 @@ public class MedRuleConvertFacade {
|
|
|
} else {
|
|
|
billMsg = MsgUtil.getCommonHighRiskMsg("", resultRule.getRuleHisName(), orderType);
|
|
|
}
|
|
|
- } else if (resultRule.getRuleType().equals(3)) {
|
|
|
+ } else if (resultRule.getRuleType().equals(RuleTypeEnum.Critical.getKey())) {
|
|
|
if (resultRule.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
|
|
|
String content = "";
|
|
|
if (StringUtil.isNotBlank(resultRule.getRuleBaseHisName())) {
|
|
@@ -1143,7 +1300,7 @@ public class MedRuleConvertFacade {
|
|
|
} else if (resultRule.getRuleLibType().equals(LexiconEnum.PacsResult.getKey())) {
|
|
|
billMsg = MsgUtil.getCommonCriticalMsg(resultRule.getRuleLibName(), orderType);
|
|
|
}
|
|
|
- } else if (resultRule.getRuleType().equals(4)) {
|
|
|
+ } else if (resultRule.getRuleType().equals(RuleTypeEnum.OtherValReminders.getKey())) {
|
|
|
if (resultRule.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
|
|
|
Lis lis = new Lis();
|
|
|
lis.setName(resultRule.getRuleHisName());
|
|
@@ -1159,7 +1316,7 @@ public class MedRuleConvertFacade {
|
|
|
if (StringUtil.isNotBlank(resultRule.getRuleBaseInputValue())) {
|
|
|
content += trimZero(resultRule.getRuleBaseInputValue());
|
|
|
}
|
|
|
- billMsg = MsgUtil.getCommonOtherMsg(orderType, content, resultRule.getRuleHisName(), conType, lis);
|
|
|
+ billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.lisSelf.getName(), content, resultRule.getRuleHisName(), conType, lis);
|
|
|
} else if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Group.getKey())) {
|
|
|
billMsg = MsgUtil.getCommonOtherMsg(orderType, resultRule.getRuleBaseLibName(), resultRule.getRuleHisName(), ConEnum.group.getName(), lis);
|
|
|
}
|
|
@@ -1178,7 +1335,7 @@ public class MedRuleConvertFacade {
|
|
|
billMsg = MsgUtil.getCommonOtherMsg(orderType, resultRule.getExpectedOutput(), resultRule.getRuleLibName(), conType, null);
|
|
|
}
|
|
|
}
|
|
|
- } else if (resultRule.getRuleType().equals(5)) {
|
|
|
+ } else if (resultRule.getRuleType().equals(RuleTypeEnum.Transfusion.getKey())) {
|
|
|
if (resultRule.getRuleBaseLibType().equals(LexiconEnum.LisSubName.getKey())) {
|
|
|
String content = "";
|
|
|
content += resultRule.getRuleHisName();
|
|
@@ -1191,7 +1348,7 @@ public class MedRuleConvertFacade {
|
|
|
}
|
|
|
billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.transfusion.getName(), content, resultRule.getRuleMsg(), ConEnum.lis.getName(), null);
|
|
|
}
|
|
|
- } else if (resultRule.getRuleType().equals(6)) {
|
|
|
+ } else if (resultRule.getRuleType().equals(RuleTypeEnum.Repeatedly.getKey())) {
|
|
|
billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleHisName(), resultRule.getRuleLibName(), resultRule.getRuleBaseHisName(), conType, orderType);
|
|
|
}
|
|
|
} else if (list.size() > 1) {
|
|
@@ -1259,9 +1416,9 @@ public class MedRuleConvertFacade {
|
|
|
} else if (ListUtil.isNotEmpty(medicineResults)) {
|
|
|
billMsg = MsgUtil.getCommonOtherMsg(orderType, content, medicineResults.get(0).getRuleBaseHisName(), TypeEnum.drug.getName(), lis);
|
|
|
} else if (ListUtil.isNotEmpty(groupResults)) {
|
|
|
- billMsg = MsgUtil.getCommonOtherMsg(orderType, content, groupResults.get(0).getRuleBaseLibName(), ConEnum.group.getName(), lis);
|
|
|
+ billMsg = MsgUtil.getCommonOtherMsg(orderType, content, groupResults.get(0).getRuleBaseLibName(), TypeEnum.group.getName(), lis);
|
|
|
} else {
|
|
|
- billMsg = MsgUtil.getCommonOtherMsg(orderType, content, "", ConEnum.lis.getName(), lis);
|
|
|
+ billMsg = MsgUtil.getCommonOtherMsg(orderType, content, "", TypeEnum.lis.getName(), lis);
|
|
|
}
|
|
|
} else if (ruleLibType.equals(LexiconEnum.PacsResult.getKey())) {
|
|
|
billMsg = MsgUtil.getCommonOtherMsg(orderType, list.get(0).getExpectedOutput(), "", "", null);
|
|
@@ -1318,7 +1475,7 @@ public class MedRuleConvertFacade {
|
|
|
conType = getConType(resultRule.getRuleBaseLibTypeName(), resultRule.getRuleType(), resultRule.getRuleBaseType());
|
|
|
}
|
|
|
//开单合理性
|
|
|
- if (resultRule.getRuleType().equals(1)) {
|
|
|
+ if (resultRule.getRuleType().equals(RuleTypeEnum.Rationality.getKey())) {
|
|
|
if (resultRule.getHasSubCond() != null && resultRule.getHasSubCond().equals(1)) {
|
|
|
if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Disease.getKey())) {
|
|
|
//禁忌疾病
|
|
@@ -1444,14 +1601,14 @@ public class MedRuleConvertFacade {
|
|
|
if (StringUtil.isNotBlank(resultRule.getRuleBaseInputValue())) {
|
|
|
content += trimZero(resultRule.getRuleBaseInputValue());
|
|
|
}
|
|
|
- billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleLibName(),
|
|
|
+ /*billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleLibName(),
|
|
|
resultRule.getRuleLibName(),
|
|
|
content,
|
|
|
conType,
|
|
|
- orderType);
|
|
|
+ orderType);*/
|
|
|
}
|
|
|
}
|
|
|
- } else if (resultRule.getRuleType().equals(2)) {
|
|
|
+ } else if (resultRule.getRuleType().equals(RuleTypeEnum.HighRisk.getKey())) {
|
|
|
if (resultRule.getHasSubCond() != null && resultRule.getHasSubCond().equals(1)) {
|
|
|
if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Disease.getKey())) {
|
|
|
billMsg = MsgUtil.getCommonHighRiskMsg(resultRule.getRuleBaseLibName(), resultRule.getRuleLibName(), orderType);
|
|
@@ -1495,7 +1652,7 @@ public class MedRuleConvertFacade {
|
|
|
} else {
|
|
|
billMsg = MsgUtil.getCommonHighRiskMsg("", resultRule.getRuleLibName(), orderType);
|
|
|
}
|
|
|
- } else if (resultRule.getRuleType().equals(3)) {
|
|
|
+ } else if (resultRule.getRuleType().equals(RuleTypeEnum.Critical.getKey())) {
|
|
|
if (resultRule.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
|
|
|
String content = "";
|
|
|
if (StringUtil.isNotBlank(resultRule.getRuleBaseLibName())) {
|
|
@@ -1508,7 +1665,7 @@ public class MedRuleConvertFacade {
|
|
|
} else if (resultRule.getRuleLibType().equals(LexiconEnum.PacsResult.getKey())) {
|
|
|
billMsg = MsgUtil.getCommonCriticalMsg(resultRule.getRuleLibName(), orderType);
|
|
|
}
|
|
|
- } else if (resultRule.getRuleType().equals(4)) {
|
|
|
+ } else if (resultRule.getRuleType().equals(RuleTypeEnum.OtherValReminders.getKey())) {
|
|
|
if (resultRule.getRuleLibType().equals(LexiconEnum.LisSubName.getKey())) {
|
|
|
Lis lis = new Lis();
|
|
|
lis.setUniqueName(resultRule.getRuleLibName());
|
|
@@ -1518,7 +1675,7 @@ public class MedRuleConvertFacade {
|
|
|
if (StringUtil.isNotBlank(resultRule.getRuleBaseInputValue())) {
|
|
|
content += trimZero(resultRule.getRuleBaseInputValue());
|
|
|
}
|
|
|
- billMsg = MsgUtil.getCommonOtherMsg(orderType, content, resultRule.getRuleLibName(), conType, lis);
|
|
|
+ billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.lisSelf.getName(), content, resultRule.getRuleLibName(), conType, lis);
|
|
|
} else if (resultRule.getRuleBaseLibType().equals(LexiconEnum.Group.getKey())) {
|
|
|
billMsg = MsgUtil.getCommonOtherMsg(orderType, resultRule.getRuleBaseLibName(), resultRule.getRuleLibName(), ConEnum.group.getName(), lis);
|
|
|
}
|
|
@@ -1537,7 +1694,7 @@ public class MedRuleConvertFacade {
|
|
|
billMsg = MsgUtil.getCommonOtherMsg(orderType, resultRule.getExpectedOutput(), resultRule.getRuleLibName(), conType, null);
|
|
|
}
|
|
|
}
|
|
|
- } else if (resultRule.getRuleType().equals(5)) {
|
|
|
+ } else if (resultRule.getRuleType().equals(RuleTypeEnum.Transfusion.getKey())) {
|
|
|
if (resultRule.getRuleBaseLibType().equals(LexiconEnum.LisSubName.getKey())) {
|
|
|
String content = "";
|
|
|
content += resultRule.getRuleLibName();
|
|
@@ -1546,7 +1703,7 @@ public class MedRuleConvertFacade {
|
|
|
}
|
|
|
billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.transfusion.getName(), content, resultRule.getRuleMsg(), ConEnum.lis.getName(), null);
|
|
|
}
|
|
|
- } else if (resultRule.getRuleType().equals(6)) {
|
|
|
+ } else if (resultRule.getRuleType().equals(RuleTypeEnum.Repeatedly.getKey())) {
|
|
|
billMsg = MsgUtil.getCommonBillMsg(resultRule.getRuleLibName(), resultRule.getRuleLibName(), resultRule.getRuleBaseLibName(), conType, orderType);
|
|
|
}
|
|
|
} else if (list.size() > 1) {
|
|
@@ -1604,9 +1761,9 @@ public class MedRuleConvertFacade {
|
|
|
} else if (ListUtil.isNotEmpty(medicineResults)) {
|
|
|
billMsg = MsgUtil.getCommonOtherMsg(orderType, content, medicineResults.get(0).getRuleBaseLibName(), TypeEnum.drug.getName(), lis);
|
|
|
} else if (ListUtil.isNotEmpty(groupResults)) {
|
|
|
- billMsg = MsgUtil.getCommonOtherMsg(orderType, content, groupResults.get(0).getRuleBaseLibName(), ConEnum.group.getName(), lis);
|
|
|
+ billMsg = MsgUtil.getCommonOtherMsg(orderType, content, groupResults.get(0).getRuleBaseLibName(), TypeEnum.group.getName(), lis);
|
|
|
} else {
|
|
|
- billMsg = MsgUtil.getCommonOtherMsg(orderType, content, "", ConEnum.lis.getName(), lis);
|
|
|
+ billMsg = MsgUtil.getCommonOtherMsg(orderType, content, "", TypeEnum.lis.getName(), lis);
|
|
|
}
|
|
|
} else if (ruleLibType.equals(LexiconEnum.PacsResult.getKey())) {
|
|
|
billMsg = MsgUtil.getCommonOtherMsg(orderType, list.get(0).getExpectedOutput(), "", "", null);
|
|
@@ -1659,12 +1816,19 @@ public class MedRuleConvertFacade {
|
|
|
max = min.add(BigDecimal.TEN);
|
|
|
}
|
|
|
BigDecimal randomVal = new BigDecimal(Math.random() * (max.doubleValue() - min.doubleValue()) + min.doubleValue());
|
|
|
- BigDecimal random_dec = randomVal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal random_dec = randomVal.setScale(3, BigDecimal.ROUND_HALF_UP);
|
|
|
//是否包含边界值
|
|
|
- if (!minBoundary || maxBoundary) {
|
|
|
- random_dec.add(new BigDecimal(0.01d));
|
|
|
+ if (!minBoundary) {
|
|
|
+ if (maxBoundary) {
|
|
|
+ if (randomVal.setScale(3, BigDecimal.ROUND_UP).doubleValue() <= max.setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue()) {
|
|
|
+ random_dec = randomVal.setScale(3, BigDecimal.ROUND_UP);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (randomVal.setScale(3, BigDecimal.ROUND_UP).doubleValue() < max.setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue()) {
|
|
|
+ random_dec = randomVal.setScale(3, BigDecimal.ROUND_UP);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- random_dec = randomVal.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
return random_dec;
|
|
|
}
|
|
|
|