|
@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.constant.CommonConstant;
|
|
|
+import org.jeecg.common.system.vo.DictModel;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
import org.jeecg.modules.medical.Constant;
|
|
|
import org.jeecg.modules.medical.SystemEventAttrConstant;
|
|
@@ -57,6 +58,7 @@ import org.jeecg.modules.medical.service.IRuleAttrService;
|
|
|
import org.jeecg.modules.medical.service.IRuleFactorRelaService;
|
|
|
import org.jeecg.modules.medical.service.ITreatmentItemsService;
|
|
|
import org.jeecg.modules.message.websocket.WebSocket;
|
|
|
+import org.jeecg.modules.system.service.ISysDictService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
@@ -134,6 +136,8 @@ public class RuleEngine {
|
|
|
IMedicalInsuranceDrugsService medicalInsuranceDrugsService;
|
|
|
@Autowired
|
|
|
IDiagnoseItemsService diagnoseItemsService;
|
|
|
+ @Autowired
|
|
|
+ ISysDictService sysDictService;
|
|
|
|
|
|
@Value("${cache.auto:false}")
|
|
|
private Boolean cacheAutoInit;
|
|
@@ -147,6 +151,8 @@ public class RuleEngine {
|
|
|
public static Map<Integer, List<FactorEnchance>> allEnchanceTypeMap = new HashMap<>();
|
|
|
public static Map<Integer, MedicalInsRuleInfo> allMedicalMap = new HashMap<>();
|
|
|
|
|
|
+ public static Set<Integer> daysRuleIdSet = new HashSet<>();
|
|
|
+
|
|
|
public void initMedicalInsRule() {
|
|
|
log.info("进入初始化RuleEngine");
|
|
|
List<MedicalInsRuleInfo> medicalInsRuleInfoList = medicalInsRuleInfoService.lambdaQuery().eq(MedicalInsRuleInfo::getState, Constant.EFF_STATE).list();
|
|
@@ -172,6 +178,7 @@ public class RuleEngine {
|
|
|
List<RuleAttr> ruleAttrList = ruleAttrService.list();
|
|
|
interfRuleAttrList = ruleAttrList.stream().collect(Collectors.groupingBy(RuleAttr::getInterfName));
|
|
|
initFactor();
|
|
|
+ initRuleDaysSet();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -182,6 +189,15 @@ public class RuleEngine {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void initRuleDaysSet(){
|
|
|
+ List<DictModel> ruleList = sysDictService.getDictItems(Constant.DICT_RULE_ID_AGE_DAYS_KEY);
|
|
|
+ if(CollectionUtil.isNotEmpty(ruleList)){
|
|
|
+ for(DictModel dictModel : ruleList){
|
|
|
+ daysRuleIdSet.add(Integer.parseInt(dictModel.getValue()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public void initFactor(){
|
|
|
LambdaQueryWrapper<RuleFactorRela> query = new LambdaQueryWrapper<RuleFactorRela>();
|
|
|
query.eq(RuleFactorRela::getDelFlag, CommonConstant.DEL_FLAG_0);
|
|
@@ -577,7 +593,8 @@ public class RuleEngine {
|
|
|
if (StringUtils.isNotBlank(selectedRoles)) {
|
|
|
String[] selectedRolesArr = selectedRoles.split(",");
|
|
|
boolean diagnoseFlag = Arrays.stream(selectedRolesArr).anyMatch(attr -> attr.equals("medicalDiagnoseCode"));
|
|
|
- if(diagnoseFlag){
|
|
|
+ boolean projectCodeFlag = Arrays.stream(selectedRolesArr).anyMatch(attr -> attr.equals("projectCode"));
|
|
|
+ if(diagnoseFlag && !projectCodeFlag){
|
|
|
medicalInsRuleProjectList.add(medicalInsRuleProject);
|
|
|
}
|
|
|
}
|
|
@@ -677,7 +694,8 @@ public class RuleEngine {
|
|
|
if (StringUtils.isNotBlank(selectedRoles)) {
|
|
|
String[] selectedRolesArr = selectedRoles.split(",");
|
|
|
boolean diagnoseFlag = Arrays.stream(selectedRolesArr).anyMatch(attr -> attr.equals("medicalDiagnoseCode"));
|
|
|
- if(diagnoseFlag){
|
|
|
+ boolean projectCodeFlag = Arrays.stream(selectedRolesArr).anyMatch(attr -> attr.equals("projectCode"));
|
|
|
+ if(diagnoseFlag && !projectCodeFlag){
|
|
|
medicalInsRuleProjectList.add(medicalInsRuleProject);
|
|
|
}
|
|
|
}
|
|
@@ -775,7 +793,8 @@ public class RuleEngine {
|
|
|
if (StringUtils.isNotBlank(selectedRoles)) {
|
|
|
String[] selectedRolesArr = selectedRoles.split(",");
|
|
|
boolean diagnoseFlag = Arrays.stream(selectedRolesArr).anyMatch(attr -> attr.equals("medicalDiagnoseCode"));
|
|
|
- if(diagnoseFlag){
|
|
|
+ boolean projectCodeFlag = Arrays.stream(selectedRolesArr).anyMatch(attr -> attr.equals("projectCode"));
|
|
|
+ if(diagnoseFlag && !projectCodeFlag){
|
|
|
medicalInsRuleProjectList.add(medicalInsRuleProject);
|
|
|
}
|
|
|
}
|
|
@@ -824,6 +843,15 @@ public class RuleEngine {
|
|
|
* @param medicalInsRuleProject
|
|
|
*/
|
|
|
public void setProjectToLocalMap(Map<String,Object> itemMap, MedicalInsRuleProject medicalInsRuleProject){
|
|
|
+ if(null != medicalInsRuleProject.getAge()){
|
|
|
+ if(daysRuleIdSet.contains(medicalInsRuleProject.getMedicalInsRuleInfoId())){
|
|
|
+ medicalInsRuleProject.setAgeDays(Double.valueOf(medicalInsRuleProject.getAge()));
|
|
|
+ }else{
|
|
|
+ if(null != medicalInsRuleProject.getAge()){
|
|
|
+ medicalInsRuleProject.setAgeDays(Double.valueOf(medicalInsRuleProject.getAge() * 365));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
String jsonStr = JSON.toJSONString(medicalInsRuleProject);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(jsonStr);
|
|
|
Map<String,Object> transferMedicalMap = filterMap(jsonObject);
|