|
@@ -6,11 +6,13 @@ 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;
|
|
@@ -47,6 +49,8 @@ public class MedRuleConvertFacade {
|
|
|
private KlRuleFacade klRuleFacade;
|
|
|
@Autowired
|
|
|
private KlRelationFacade klRelationFacade;
|
|
|
+ @Autowired
|
|
|
+ private KlRuleBaseFacade klRuleBaseFacade;
|
|
|
|
|
|
@Autowired
|
|
|
private LisConfigFacade lisConfigFacade;
|
|
@@ -197,7 +201,7 @@ public class MedRuleConvertFacade {
|
|
|
result.setRuleBaseInputValue(random_int(1, 6, true, false).toString());
|
|
|
break;
|
|
|
case "儿童":
|
|
|
- result.setRuleBaseInputValue(random_int(1, 6, true, false).toString());
|
|
|
+ result.setRuleBaseInputValue(random_int(6, 18, true, false).toString());
|
|
|
break;
|
|
|
case "成人":
|
|
|
result.setRuleBaseInputValue(random_int(18, 200, true, false).toString());
|
|
@@ -216,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());
|
|
|
}
|
|
|
//比较关系
|
|
@@ -394,7 +398,8 @@ public class MedRuleConvertFacade {
|
|
|
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) {
|
|
@@ -431,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();
|
|
@@ -451,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());
|
|
@@ -477,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) {
|
|
@@ -507,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);
|
|
@@ -602,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);
|
|
@@ -727,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<>();
|
|
@@ -743,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()) {
|
|
@@ -766,7 +857,7 @@ public class MedRuleConvertFacade {
|
|
|
num = 0;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
return retList;
|
|
|
}
|
|
@@ -828,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);
|
|
@@ -847,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;
|
|
|
}
|
|
@@ -945,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())) {
|
|
|
//禁忌疾病
|
|
@@ -1075,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);
|
|
@@ -1130,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())) {
|
|
@@ -1147,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());
|
|
@@ -1182,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();
|
|
@@ -1195,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) {
|
|
@@ -1322,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())) {
|
|
|
//禁忌疾病
|
|
@@ -1448,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);
|
|
@@ -1499,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())) {
|
|
@@ -1512,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());
|
|
@@ -1541,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();
|
|
@@ -1550,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) {
|