|
|
@@ -719,53 +719,62 @@ public class RuleEngine {
|
|
|
}
|
|
|
|
|
|
public void getRuleProjectIntoMap(MedicalInsRuleInfo medicalInsRuleInfo, Map<String,Object> itemMap){
|
|
|
- List<MedicalInsRuleProject> medicalInsRuleProjectList = medicalInsRuleProjectService.lambdaQuery().eq(MedicalInsRuleProject::getMedicalInsRuleInfoId, medicalInsRuleInfo.getId())
|
|
|
- .eq(MedicalInsRuleProject::getState,Constant.EFF_STATE).list();
|
|
|
-
|
|
|
String selectedRoles = medicalInsRuleInfo.getSelectedRoles();
|
|
|
if(StringUtils.isNotBlank(selectedRoles)){
|
|
|
String[] selectedRolesArr = selectedRoles.split(",");
|
|
|
boolean diagnoseFlag = Arrays.stream(selectedRolesArr).anyMatch(attr -> attr.equals("medicalDiagnoseCode"));
|
|
|
boolean correlationDiagnoseFlag = Arrays.stream(selectedRolesArr).anyMatch(attr -> attr.equals("correlationMedicalDiagnoseCode"));
|
|
|
+ boolean projectCodeFlag = Arrays.stream(selectedRolesArr).anyMatch(attr -> attr.equals("projectCode"));
|
|
|
String projectCode = null;
|
|
|
- String collectionProjectCode = null;
|
|
|
- if(CollectionUtil.isNotEmpty(medicalInsRuleProjectList)){
|
|
|
- if(medicalInsRuleProjectList.size()==1) {
|
|
|
- String jsonStr = JSON.toJSONString(medicalInsRuleProjectList.get(0));
|
|
|
- projectCode = medicalInsRuleProjectList.get(0).getProjectCode();
|
|
|
- collectionProjectCode = medicalInsRuleProjectList.get(0).getCorrelationProjectCode();
|
|
|
- JSONObject ruleProjectJSONObject = JSON.parseObject(jsonStr);
|
|
|
- Map<String,Object> filterMap = filterMap(ruleProjectJSONObject);
|
|
|
- itemMap.putAll(filterMap);
|
|
|
- }
|
|
|
+ if(projectCodeFlag && null != itemMap.get(Constant.PROJECT_CODE_KEY)) {
|
|
|
+ projectCode = itemMap.get(Constant.PROJECT_CODE_KEY).toString();
|
|
|
+ }else{
|
|
|
+ return;
|
|
|
}
|
|
|
- if(diagnoseFlag){
|
|
|
- List<MedicalInsRuleProjectDiagnose> medicalInsRuleProjectDiagnoseList = null;
|
|
|
- boolean conditionFlag = false;
|
|
|
- if(StringUtils.isNotBlank(projectCode)) {
|
|
|
- conditionFlag = true;
|
|
|
+ List<MedicalInsRuleProject> medicalInsRuleProjectList = medicalInsRuleProjectService.lambdaQuery().eq(MedicalInsRuleProject::getMedicalInsRuleInfoId, medicalInsRuleInfo.getId())
|
|
|
+ .eq(projectCodeFlag, MedicalInsRuleProject::getProjectCode, projectCode).eq(MedicalInsRuleProject::getState,Constant.EFF_STATE).list();
|
|
|
+ List<String> correlationProjectCodeList = new ArrayList<>();
|
|
|
+ String collectionProjectCode = null;
|
|
|
+ if(CollectionUtil.isNotEmpty(medicalInsRuleProjectList)){
|
|
|
+ if(medicalInsRuleProjectList.size()==1) {
|
|
|
+ String jsonStr = JSON.toJSONString(medicalInsRuleProjectList.get(0));
|
|
|
+ collectionProjectCode = medicalInsRuleProjectList.get(0).getCorrelationProjectCode();
|
|
|
+ JSONObject ruleProjectJSONObject = JSON.parseObject(jsonStr);
|
|
|
+ Map<String,Object> filterMap = filterMap(ruleProjectJSONObject);
|
|
|
+ itemMap.putAll(filterMap);
|
|
|
+ }else{
|
|
|
+ correlationProjectCodeList = medicalInsRuleProjectList.stream().map(MedicalInsRuleProject::getProjectCode).collect(Collectors.toList());
|
|
|
+ itemMap.put(SystemEventAttrConstant.MEDICAL_INS_CORRELATIONPROJECTCODELIST, correlationProjectCodeList);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- medicalInsRuleProjectDiagnoseList = medicalInsRuleProjectDiagnoseService.lambdaQuery().eq(conditionFlag, MedicalInsRuleProjectDiagnose::getMedicalInsProjectCode, projectCode).eq(MedicalInsRuleProjectDiagnose::getMedicalInsRuleInfoId, medicalInsRuleInfo.getId())
|
|
|
- .eq(MedicalInsRuleProjectDiagnose::getProjectCodeType, 1).list();
|
|
|
- if(CollectionUtil.isNotEmpty(medicalInsRuleProjectDiagnoseList)) {
|
|
|
- List<String> medicalDiagnoseStrList = medicalInsRuleProjectDiagnoseList.stream().map(MedicalInsRuleProjectDiagnose::getMedicalDiagnoseCode).collect(Collectors.toList());
|
|
|
- itemMap.put(SystemEventAttrConstant.MEDICAL_INS_MEDICALDIAGNOSECODELIST, medicalDiagnoseStrList);
|
|
|
+ if(diagnoseFlag){
|
|
|
+ List<MedicalInsRuleProjectDiagnose> medicalInsRuleProjectDiagnoseList = null;
|
|
|
+ boolean conditionFlag = false;
|
|
|
+ if(StringUtils.isNotBlank(projectCode)) {
|
|
|
+ conditionFlag = true;
|
|
|
+ }
|
|
|
+ medicalInsRuleProjectDiagnoseList = medicalInsRuleProjectDiagnoseService.lambdaQuery().eq(conditionFlag, MedicalInsRuleProjectDiagnose::getMedicalInsProjectCode, projectCode).eq(MedicalInsRuleProjectDiagnose::getMedicalInsRuleInfoId, medicalInsRuleInfo.getId())
|
|
|
+ .eq(MedicalInsRuleProjectDiagnose::getProjectCodeType, 1).list();
|
|
|
+ if(CollectionUtil.isNotEmpty(medicalInsRuleProjectDiagnoseList)) {
|
|
|
+ List<String> medicalDiagnoseStrList = medicalInsRuleProjectDiagnoseList.stream().map(MedicalInsRuleProjectDiagnose::getMedicalDiagnoseCode).collect(Collectors.toList());
|
|
|
+ itemMap.put(SystemEventAttrConstant.MEDICAL_INS_MEDICALDIAGNOSECODELIST, medicalDiagnoseStrList);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if(correlationDiagnoseFlag){
|
|
|
- List<MedicalInsRuleProjectDiagnose> medicalInsRuleProjectDiagnoseList = null;
|
|
|
- boolean conditionFlag = false;
|
|
|
- if(StringUtils.isNotBlank(projectCode)) {
|
|
|
- conditionFlag = true;
|
|
|
- }
|
|
|
- medicalInsRuleProjectDiagnoseList = medicalInsRuleProjectDiagnoseService.lambdaQuery().eq(conditionFlag, MedicalInsRuleProjectDiagnose::getMedicalInsProjectCode, collectionProjectCode).eq(MedicalInsRuleProjectDiagnose::getMedicalInsRuleInfoId, medicalInsRuleInfo.getId())
|
|
|
- .eq(MedicalInsRuleProjectDiagnose::getProjectCodeType, 2).list();
|
|
|
- if(CollectionUtil.isNotEmpty(medicalInsRuleProjectDiagnoseList)) {
|
|
|
- List<String> medicalDiagnoseStrList = medicalInsRuleProjectDiagnoseList.stream().map(MedicalInsRuleProjectDiagnose::getMedicalDiagnoseCode).collect(Collectors.toList());
|
|
|
- itemMap.put(SystemEventAttrConstant.MEDICAL_INS_CORRELATIONMEDICALDIAGNOSECODE, medicalDiagnoseStrList);
|
|
|
+ if(correlationDiagnoseFlag){
|
|
|
+ List<MedicalInsRuleProjectDiagnose> medicalInsRuleProjectDiagnoseList = null;
|
|
|
+ boolean conditionFlag = false;
|
|
|
+ if(StringUtils.isNotBlank(collectionProjectCode)) {
|
|
|
+ conditionFlag = true;
|
|
|
+ }
|
|
|
+ medicalInsRuleProjectDiagnoseList = medicalInsRuleProjectDiagnoseService.lambdaQuery().eq(conditionFlag, MedicalInsRuleProjectDiagnose::getMedicalInsProjectCode, collectionProjectCode).eq(MedicalInsRuleProjectDiagnose::getMedicalInsRuleInfoId, medicalInsRuleInfo.getId())
|
|
|
+ .eq(MedicalInsRuleProjectDiagnose::getProjectCodeType, 2).list();
|
|
|
+ if(CollectionUtil.isNotEmpty(medicalInsRuleProjectDiagnoseList)) {
|
|
|
+ List<String> medicalDiagnoseStrList = medicalInsRuleProjectDiagnoseList.stream().map(MedicalInsRuleProjectDiagnose::getMedicalDiagnoseCode).collect(Collectors.toList());
|
|
|
+ itemMap.put(SystemEventAttrConstant.MEDICAL_INS_CORRELATIONMEDICALDIAGNOSECODE, medicalDiagnoseStrList);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
}
|