|
@@ -201,13 +201,22 @@ public class RuleEngine {
|
|
|
public void initFactor(){
|
|
|
LambdaQueryWrapper<RuleFactorRela> query = new LambdaQueryWrapper<RuleFactorRela>();
|
|
|
query.eq(RuleFactorRela::getDelFlag, CommonConstant.DEL_FLAG_0);
|
|
|
-// query.in(RuleFactorRela::getMedicalInsRuleInfoId, medicalInsRuleInfoIdList);
|
|
|
query.orderByAsc(RuleFactorRela::getSeqNum);
|
|
|
List<RuleFactorRela> ruleFactorRelaList = ruleFactorRelaService.list(query);
|
|
|
ruleIdAndFatorEnchanceIdMap = ruleFactorRelaList.stream().collect(Collectors.groupingBy(RuleFactorRela::getMedicalInsRuleInfoId));
|
|
|
Set<Integer> factorEnchangeIdList = ruleFactorRelaList.stream().map(RuleFactorRela::getFactorEnhanceId).collect(Collectors.toSet());
|
|
|
List<FactorEnchance> factorEnchanceList = factorEnchanceService.listByIds(factorEnchangeIdList);
|
|
|
- allEnchanceTypeMap = factorEnchanceList.stream().collect(Collectors.groupingBy(FactorEnchance::getFactorCatalog));
|
|
|
+ Map<Integer, FactorEnchance> integerFactorEnchanceMap = factorEnchanceList.stream().collect(Collectors.toMap(FactorEnchance::getId, v -> v, (v1, v2) -> v1));
|
|
|
+ for(RuleFactorRela ruleFactorRela : ruleFactorRelaList){
|
|
|
+ FactorEnchance factorEnchance = integerFactorEnchanceMap.get(ruleFactorRela.getFactorEnhanceId());
|
|
|
+ if(allEnchanceTypeMap.containsKey(ruleFactorRela.getMedicalInsRuleInfoId())){
|
|
|
+ allEnchanceTypeMap.get(ruleFactorRela.getMedicalInsRuleInfoId()).add(factorEnchance);
|
|
|
+ }else{
|
|
|
+ List<FactorEnchance> ruleIdFactorEnchanceList = new ArrayList<>();
|
|
|
+ ruleIdFactorEnchanceList.add(factorEnchance);
|
|
|
+ allEnchanceTypeMap.put(ruleFactorRela.getMedicalInsRuleInfoId(), ruleIdFactorEnchanceList);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -312,9 +321,7 @@ public class RuleEngine {
|
|
|
}
|
|
|
|
|
|
|
|
|
- // public boolean initTestMedicalInsRule(String medicalProjectCode, AfterwardsAuditDetail afterwardsAuditDetail,List<MedicalInsRuleInfo> medicalInsRuleInfoList,Map<Integer, MedicalInsRuleInfo> medicalMap,Map<String, Boolean> codeDataMap) {
|
|
|
-// return genItemCodeAndRuleIdMapTest(medicalProjectCode, medicalMap, afterwardsAuditDetail, medicalInsRuleInfoList);
|
|
|
-// }
|
|
|
+
|
|
|
public void genItemCodeAndRuleIdMapTest(String medicalProjectCode, AfterwardsAuditDetail afterwardsAuditDetail, List<MedicalInsRuleInfo> medicalInsRuleInfoList, Map<Integer, MedicalInsRuleInfo> medicalMap, Map<String, Boolean> codeDataMap) {
|
|
|
try {
|
|
|
List<Integer> ruleIdList = medicalInsRuleInfoList.stream().map(MedicalInsRuleInfo::getId).collect(Collectors.toList());
|
|
@@ -486,7 +493,8 @@ public class RuleEngine {
|
|
|
return Result.ok();
|
|
|
}
|
|
|
for (Integer medicalRuleInsInfoId : advanceWaringRuleIdList) {
|
|
|
- MedicalInsRuleInfo medicalInsRuleInfo = medicalInsRuleInfoService.getById(medicalRuleInsInfoId);
|
|
|
+// MedicalInsRuleInfo medicalInsRuleInfo = medicalInsRuleInfoService.getById(medicalRuleInsInfoId);
|
|
|
+ MedicalInsRuleInfo medicalInsRuleInfo = allMedicalMap.get(medicalRuleInsInfoId);
|
|
|
paramMap.put(SystemEventAttrConstant.PRE_ADVANCEWARNINGAUDIT_ID_KEY, advanceWarningAudit.getId());
|
|
|
runAdvanceWaringEngine(paramMap, medicalInsRuleInfo, advanceWarningAudit);
|
|
|
}
|
|
@@ -677,7 +685,7 @@ public class RuleEngine {
|
|
|
if (CollectionUtil.isEmpty(diagnoseMedicalInsRuleInfoIdList)) {
|
|
|
medicalInsRuleProjectTempList = medicalInsRuleProjectService.getRuleProjectByDiagCode(diagnose.toString());
|
|
|
if(CollectionUtil.isEmpty(medicalInsRuleProjectTempList)){
|
|
|
- log.info("诊断编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据,退出规则执行", diagnose);
|
|
|
+ log.info("诊断编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据", diagnose);
|
|
|
}
|
|
|
Set<Integer> medicalInsRuleInfoIdDiagSet = medicalInsRuleProjectTempList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
|
|
|
log.info("数据库检索到匹配规则ID列表:{} 诊断编码为:{}", medicalInsRuleInfoIdDiagSet, diagnose);
|
|
@@ -776,7 +784,7 @@ public class RuleEngine {
|
|
|
if (CollectionUtil.isEmpty(diagnoseMedicalInsRuleInfoIdList)) {
|
|
|
medicalInsRuleProjectTempList = medicalInsRuleProjectService.getRuleProjectByDiagCode(diagnose.toString());
|
|
|
if(CollectionUtil.isEmpty(medicalInsRuleProjectTempList)){
|
|
|
- log.info("诊断编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据,退出规则执行", diagnose);
|
|
|
+ log.info("诊断编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据", diagnose);
|
|
|
}
|
|
|
Set<Integer> medicalInsRuleInfoIdDiagSet = medicalInsRuleProjectTempList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
|
|
|
log.info("数据库检索到匹配规则ID列表:{} 诊断编码为:{}", medicalInsRuleInfoIdDiagSet, diagnose);
|
|
@@ -1093,29 +1101,20 @@ public class RuleEngine {
|
|
|
log.error("未有对应的规则,接口数据:{}", paramMap);
|
|
|
return;
|
|
|
}
|
|
|
- LambdaQueryWrapper<RuleFactorRela> query = new LambdaQueryWrapper<RuleFactorRela>();
|
|
|
- query.eq(RuleFactorRela::getDelFlag, CommonConstant.DEL_FLAG_0);
|
|
|
- query.eq(RuleFactorRela::getMedicalInsRuleInfoId, medicalInsRuleInfo.getId());
|
|
|
- query.orderByAsc(RuleFactorRela::getSeqNum);
|
|
|
- List<RuleFactorRela> ruleFactorRelaList = ruleFactorRelaService.list(query);
|
|
|
-
|
|
|
- if (CollectionUtil.isNotEmpty(ruleFactorRelaList)) {
|
|
|
- Set<Integer> factorEnchangeIdList = ruleFactorRelaList.stream().map(RuleFactorRela::getFactorEnhanceId).collect(Collectors.toSet());
|
|
|
- List<FactorEnchance> factorEnchanceList = factorEnchanceService.listByIds(factorEnchangeIdList);
|
|
|
- Map<Integer, List<FactorEnchance>> enchanceTypeMap = factorEnchanceList.stream().collect(Collectors.groupingBy(FactorEnchance::getFactorCatalog));
|
|
|
- for (Integer medicalRuleInsInfoId : enchanceTypeMap.keySet()) {
|
|
|
- try {
|
|
|
- List<FactorEnchance> factorEnchanceListTemp = enchanceTypeMap.get(medicalRuleInsInfoId);
|
|
|
- paramMap.put(SystemEventAttrConstant.MEDICAL_INS_RULE_INFO_ID, medicalRuleInsInfoId);
|
|
|
- paramMap.put(SystemEventAttrConstant.MEDICAL_INS_RULE_INFO_CODE, medicalInsRuleInfo.getRuleCode());
|
|
|
- paramMap.put(SystemEventAttrConstant.MEDICAL_INS_RULE_INFO_NAME, medicalInsRuleInfo.getRuleName());
|
|
|
- paramMap.put(SystemEventAttrConstant.MEDICAL_INS_RULE_INFO_DESC, medicalInsRuleInfo.getDescription());
|
|
|
- factorEnchangeFactory.runFactorEnchange(medicalRuleInsInfoId, medicalInsRuleInfo, audit, paramMap, ruleFactorRelaList, factorEnchanceListTemp, null);
|
|
|
- }catch (Exception e){
|
|
|
- log.error(e.getMessage(), e);
|
|
|
- }
|
|
|
- }
|
|
|
+ Integer medicalRuleInsInfoId = medicalInsRuleInfo.getId();
|
|
|
+ List<RuleFactorRela> ruleFactorRelaList = ruleIdAndFatorEnchanceIdMap.get(medicalRuleInsInfoId);
|
|
|
+ List<FactorEnchance> factorEnchanceList = allEnchanceTypeMap.get(medicalRuleInsInfoId);
|
|
|
+ try {
|
|
|
+ paramMap.put(SystemEventAttrConstant.MEDICAL_INS_RULE_INFO_ID, medicalRuleInsInfoId);
|
|
|
+ paramMap.put(SystemEventAttrConstant.MEDICAL_INS_RULE_INFO_CODE, medicalInsRuleInfo.getRuleCode());
|
|
|
+ paramMap.put(SystemEventAttrConstant.MEDICAL_INS_RULE_INFO_NAME, medicalInsRuleInfo.getRuleName());
|
|
|
+ paramMap.put(SystemEventAttrConstant.MEDICAL_INS_RULE_INFO_DESC, medicalInsRuleInfo.getDescription());
|
|
|
+ factorEnchangeFactory.runFactorEnchange(medicalRuleInsInfoId, medicalInsRuleInfo, audit, paramMap, ruleFactorRelaList, factorEnchanceList, null);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|