|
@@ -601,56 +601,24 @@ public class RuleEngine {
|
|
|
MidIncidentAudit midIncidentAudit = insertMidWarning(midIncidentWarningVO);
|
|
|
insertLog(midIncidentWarningVO);
|
|
|
midIncidentAudit.setInterfName(intefName);
|
|
|
-
|
|
|
+ //callScenario 1=事前 2=事后 3=事前/事后 4=事中 5=事后/事中
|
|
|
+ List<String> callScenarioList = Arrays.asList("4", "5");
|
|
|
boolean sendFlag = false;
|
|
|
for (Map<String, Object> itemMap : itemList) {
|
|
|
- Set<Integer> medicalInsRuleInfoIdList = itemCodeAndRuleIdMap.get(itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
|
|
|
- List<MedicalInsRuleProject> medicalInsRuleProjectList = null;
|
|
|
- if (CollectionUtil.isEmpty(medicalInsRuleInfoIdList)) {
|
|
|
- log.error("项目编码未匹配到对应的医保规则:{} 再次从数据库检索", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
|
|
|
- medicalInsRuleProjectList = medicalInsRuleProjectService.getRuleProjectByMedicalProjectCode(itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY).toString());
|
|
|
- if (CollectionUtil.isEmpty(medicalInsRuleProjectList)) {
|
|
|
- log.error("项目编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
|
|
|
- } else {
|
|
|
- medicalInsRuleInfoIdList = medicalInsRuleProjectList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
|
|
|
- log.info("数据库检索到匹配规则ID列表:{}", medicalInsRuleInfoIdList);
|
|
|
- }
|
|
|
+ List<MedicalInsRuleProject> medicalInsRuleProjectList = medicalInsRuleProjectService.getRuleProjectByMedicalProjectCode(itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY).toString(), callScenarioList);
|
|
|
+ if (CollectionUtil.isEmpty(medicalInsRuleProjectList)) {
|
|
|
+ log.error("项目编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
|
|
|
} else {
|
|
|
- medicalInsRuleProjectList = medicalInsRuleProjectService.getRuleProjectByRuleIdAndProjectCode(new ArrayList<>(medicalInsRuleInfoIdList), itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY).toString());
|
|
|
+ Set<Integer> medicalInsRuleInfoIdList = medicalInsRuleProjectList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
|
|
|
+ log.info("项目编码:{} 数据库检索到匹配规则ID列表:{}", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY), medicalInsRuleInfoIdList);
|
|
|
}
|
|
|
|
|
|
Object diagnose = itemMap.get(Constant.MEDICAL_DIAGNOSE_CODE_KEY);
|
|
|
if (null != diagnose) {
|
|
|
+ List<String> diagnoseList = (List<String>) diagnose;
|
|
|
//获取诊断编码配置的规则ID,加入需要执行的规则
|
|
|
- Set<Integer> diagnoseMedicalInsRuleInfoIdList = itemCodeAndRuleIdMap.get(diagnose.toString());
|
|
|
- List<MedicalInsRuleProject> medicalInsRuleProjectTempList = null;
|
|
|
- if (CollectionUtil.isEmpty(diagnoseMedicalInsRuleInfoIdList)) {
|
|
|
- medicalInsRuleProjectTempList = medicalInsRuleProjectService.getRuleProjectByDiagCode(diagnose.toString());
|
|
|
- if (CollectionUtil.isEmpty(medicalInsRuleProjectTempList)) {
|
|
|
- log.info("诊断编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据", diagnose);
|
|
|
- }
|
|
|
- Set<Integer> medicalInsRuleInfoIdDiagSet = medicalInsRuleProjectTempList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
|
|
|
- log.info("数据库检索到匹配规则ID列表:{} 诊断编码为:{}", medicalInsRuleInfoIdDiagSet, diagnose);
|
|
|
- } else {
|
|
|
- medicalInsRuleProjectTempList = medicalInsRuleProjectService.getRuleProjectByRuleIdAndDiagCode(new ArrayList<>(diagnoseMedicalInsRuleInfoIdList), diagnose.toString());
|
|
|
- }
|
|
|
- if (CollectionUtil.isNotEmpty(medicalInsRuleProjectTempList)) {
|
|
|
- if (CollectionUtil.isEmpty(medicalInsRuleProjectList)) {
|
|
|
- medicalInsRuleProjectList = new ArrayList<>();
|
|
|
- }
|
|
|
- for (MedicalInsRuleProject medicalInsRuleProject : medicalInsRuleProjectTempList) {
|
|
|
- MedicalInsRuleInfo projectRuleInfo = allMedicalMap.get(medicalInsRuleProject.getMedicalInsRuleInfoId());
|
|
|
- String selectedRoles = projectRuleInfo.getSelectedRoles();
|
|
|
- if (StringUtils.isNotBlank(selectedRoles)) {
|
|
|
- String[] selectedRolesArr = selectedRoles.split(",");
|
|
|
- boolean diagnoseFlag = Arrays.stream(selectedRolesArr).anyMatch(attr -> attr.equals("medicalDiagnoseCode"));
|
|
|
- boolean projectCodeFlag = Arrays.stream(selectedRolesArr).anyMatch(attr -> attr.equals("projectCode"));
|
|
|
- if (diagnoseFlag && !projectCodeFlag) {
|
|
|
- medicalInsRuleProjectList.add(medicalInsRuleProject);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ getAndSetDiagRule(diagnoseList, medicalInsRuleProjectList);
|
|
|
+
|
|
|
}
|
|
|
if (CollectionUtil.isEmpty(medicalInsRuleProjectList)) {
|
|
|
log.error("项目编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据,退出规则执行", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
|
|
@@ -703,55 +671,24 @@ public class RuleEngine {
|
|
|
MidIncidentAudit midIncidentAudit = insertMidWarning(midIncidentWarningVO);
|
|
|
insertLog(midIncidentWarningVO);
|
|
|
midIncidentAudit.setInterfName(intefName);
|
|
|
-
|
|
|
+ //callScenario 1=事前 2=事后 3=事前/事后 4=事中 5=事后/事中
|
|
|
+ List<String> callScenarioList = Arrays.asList("4", "5");
|
|
|
boolean sendFlag = false;
|
|
|
for (Map<String, Object> itemMap : itemList) {
|
|
|
- Set<Integer> medicalInsRuleInfoIdList = itemCodeAndRuleIdMap.get(itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
|
|
|
- List<MedicalInsRuleProject> medicalInsRuleProjectList = null;
|
|
|
- if (CollectionUtil.isEmpty(medicalInsRuleInfoIdList)) {
|
|
|
- log.error("项目编码未匹配到对应的医保规则:{} 再次从数据库检索", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
|
|
|
- medicalInsRuleProjectList = medicalInsRuleProjectService.getRuleProjectByMedicalProjectCode(itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY).toString());
|
|
|
- if (CollectionUtil.isEmpty(medicalInsRuleProjectList)) {
|
|
|
- log.error("项目编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
|
|
|
- } else {
|
|
|
- medicalInsRuleInfoIdList = medicalInsRuleProjectList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
|
|
|
- log.info("数据库检索到匹配规则ID列表:{}", medicalInsRuleInfoIdList);
|
|
|
- }
|
|
|
+ List<MedicalInsRuleProject> medicalInsRuleProjectList = medicalInsRuleProjectService.getRuleProjectByMedicalProjectCode(itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY).toString(), callScenarioList);
|
|
|
+ if (CollectionUtil.isEmpty(medicalInsRuleProjectList)) {
|
|
|
+ log.error("项目编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
|
|
|
} else {
|
|
|
- medicalInsRuleProjectList = medicalInsRuleProjectService.getRuleProjectByRuleIdAndProjectCode(new ArrayList<>(medicalInsRuleInfoIdList), itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY).toString());
|
|
|
+ Set<Integer> medicalInsRuleInfoIdList = medicalInsRuleProjectList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
|
|
|
+ log.info("项目编码:{} 数据库检索到匹配规则ID列表:{}", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY), medicalInsRuleInfoIdList);
|
|
|
}
|
|
|
+
|
|
|
Object diagnose = itemMap.get(Constant.MEDICAL_DIAGNOSE_CODE_KEY);
|
|
|
if (null != diagnose) {
|
|
|
+ List<String> diagnoseList = (List<String>) diagnose;
|
|
|
//获取诊断编码配置的规则ID,加入需要执行的规则
|
|
|
- Set<Integer> diagnoseMedicalInsRuleInfoIdList = itemCodeAndRuleIdMap.get(diagnose.toString());
|
|
|
- List<MedicalInsRuleProject> medicalInsRuleProjectTempList = null;
|
|
|
- if (CollectionUtil.isEmpty(diagnoseMedicalInsRuleInfoIdList)) {
|
|
|
- medicalInsRuleProjectTempList = medicalInsRuleProjectService.getRuleProjectByDiagCode(diagnose.toString());
|
|
|
- if (CollectionUtil.isEmpty(medicalInsRuleProjectTempList)) {
|
|
|
- log.info("诊断编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据", diagnose);
|
|
|
- }
|
|
|
- Set<Integer> medicalInsRuleInfoIdDiagSet = medicalInsRuleProjectTempList.stream().map(MedicalInsRuleProject::getMedicalInsRuleInfoId).collect(Collectors.toSet());
|
|
|
- log.info("数据库检索到匹配规则ID列表:{} 诊断编码为:{}", medicalInsRuleInfoIdDiagSet, diagnose);
|
|
|
- } else {
|
|
|
- medicalInsRuleProjectTempList = medicalInsRuleProjectService.getRuleProjectByRuleIdAndDiagCode(new ArrayList<>(diagnoseMedicalInsRuleInfoIdList), diagnose.toString());
|
|
|
- }
|
|
|
- if (CollectionUtil.isNotEmpty(medicalInsRuleProjectTempList)) {
|
|
|
- if (CollectionUtil.isEmpty(medicalInsRuleProjectList)) {
|
|
|
- medicalInsRuleProjectList = new ArrayList<>();
|
|
|
- }
|
|
|
- for (MedicalInsRuleProject medicalInsRuleProject : medicalInsRuleProjectTempList) {
|
|
|
- MedicalInsRuleInfo projectRuleInfo = allMedicalMap.get(medicalInsRuleProject.getMedicalInsRuleInfoId());
|
|
|
- String selectedRoles = projectRuleInfo.getSelectedRoles();
|
|
|
- if (StringUtils.isNotBlank(selectedRoles)) {
|
|
|
- String[] selectedRolesArr = selectedRoles.split(",");
|
|
|
- boolean diagnoseFlag = Arrays.stream(selectedRolesArr).anyMatch(attr -> attr.equals("medicalDiagnoseCode"));
|
|
|
- boolean projectCodeFlag = Arrays.stream(selectedRolesArr).anyMatch(attr -> attr.equals("projectCode"));
|
|
|
- if (diagnoseFlag && !projectCodeFlag) {
|
|
|
- medicalInsRuleProjectList.add(medicalInsRuleProject);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ getAndSetDiagRule(diagnoseList, medicalInsRuleProjectList);
|
|
|
+
|
|
|
}
|
|
|
if (CollectionUtil.isEmpty(medicalInsRuleProjectList)) {
|
|
|
log.error("项目编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据,退出规则执行", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
|
|
@@ -805,7 +742,9 @@ public class RuleEngine {
|
|
|
String jsonStr = JSON.toJSONString(afterIncidentDetailLog);
|
|
|
log.info("事后处理日志:{}", jsonStr);
|
|
|
JSONObject itemMap = JSON.parseObject(jsonStr);
|
|
|
- List<MedicalInsRuleProject> medicalInsRuleProjectList = medicalInsRuleProjectService.getRuleProjectByMedicalProjectCode(itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY).toString());
|
|
|
+ //callScenario 1=事前 2=事后 3=事前/事后 4=事中 5=事后/事中
|
|
|
+ List<String> callScenarioList = Arrays.asList("2", "5", "3");
|
|
|
+ List<MedicalInsRuleProject> medicalInsRuleProjectList = medicalInsRuleProjectService.getRuleProjectByMedicalProjectCode(itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY).toString(), callScenarioList);
|
|
|
if (CollectionUtil.isEmpty(medicalInsRuleProjectList)) {
|
|
|
log.error("项目编码未匹配到对应的医保规则:{} 在规则库数据库中未检索到数据", itemMap.get(Constant.MEDICAL_PROJECT_CODE_KEY));
|
|
|
} else {
|