|
@@ -1,5 +1,6 @@
|
|
|
package com.diagbot.aggregate;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.dto.AllRulesDTO;
|
|
|
import com.diagbot.dto.RuleBaseDTO;
|
|
|
import com.diagbot.dto.RuleBaseInitDTO;
|
|
@@ -15,15 +16,18 @@ import com.diagbot.enums.RuleTypeEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.facade.KlRuleFacade;
|
|
|
+import com.diagbot.service.KlRuleSearchService;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.EntityUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.RedisUtil;
|
|
|
import io.github.lvyahui8.spring.annotation.DataConsumer;
|
|
|
import io.github.lvyahui8.spring.annotation.DataProvider;
|
|
|
+import io.github.lvyahui8.spring.annotation.InvokeParameter;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -44,6 +48,9 @@ public class RuleAggregate {
|
|
|
private KlRuleFacade klRuleFacade;
|
|
|
@Autowired
|
|
|
private RedisUtil redisUtil;
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("klRuleSearchServiceImpl")
|
|
|
+ private KlRuleSearchService klRuleSearchService;
|
|
|
|
|
|
@DataProvider("getAllRules")
|
|
|
public AllRulesDTO getAllRules(
|
|
@@ -125,7 +132,7 @@ public class RuleAggregate {
|
|
|
}
|
|
|
ruleConditionMap.put(ruleConditionDTO1.toString(), 1);
|
|
|
//规则搜索有效的规则ID
|
|
|
- if (!ruleIdSet.contains(ruleInitDTO.getRuleId())){
|
|
|
+ if (!ruleIdSet.contains(ruleInitDTO.getRuleId())) {
|
|
|
ruleIdSet.add(ruleInitDTO.getRuleId());
|
|
|
KlRuleSearch klRuleSearch = new KlRuleSearch();
|
|
|
klRuleSearch.setId(ruleInitDTO.getRuleId());
|
|
@@ -148,7 +155,7 @@ public class RuleAggregate {
|
|
|
ruleDTO.getRuleConditionDTOList().add(ruleConditionDTO);
|
|
|
ruleConditionMap.put(ruleConditionDTO.toString(), 1);
|
|
|
//规则搜索有效的规则ID
|
|
|
- if (!ruleIdSet.contains(ruleInitDTO.getRuleId())){
|
|
|
+ if (!ruleIdSet.contains(ruleInitDTO.getRuleId())) {
|
|
|
ruleIdSet.add(ruleInitDTO.getRuleId());
|
|
|
KlRuleSearch klRuleSearch = new KlRuleSearch();
|
|
|
klRuleSearch.setId(ruleInitDTO.getRuleId());
|
|
@@ -271,6 +278,43 @@ public class RuleAggregate {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @DataProvider("setAllRules")
|
|
|
+ public Boolean setAllRules(
|
|
|
+ @InvokeParameter("allRulesDTO") AllRulesDTO allRulesDTO,
|
|
|
+ @DataConsumer("setRuleDTOMap") Boolean resRuleDTOMap,
|
|
|
+ @DataConsumer("setDrugAllergen") Boolean resDrugAllergen,
|
|
|
+ @DataConsumer("setKlRuleSearchList") Boolean resKlRuleSearchList) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @DataProvider("setRuleDTOMap")
|
|
|
+ public Boolean setRuleDTOMap(@InvokeParameter("allRulesDTO") AllRulesDTO allRulesDTO) {
|
|
|
+ //加载有效规则Map
|
|
|
+ if (MapUtils.isNotEmpty(allRulesDTO.getRuleDTOMap())) {
|
|
|
+ redisUtil.multiSet(allRulesDTO.getRuleDTOMap());
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @DataProvider("setDrugAllergen")
|
|
|
+ public Boolean setDrugAllergen(@InvokeParameter("allRulesDTO") AllRulesDTO allRulesDTO) {
|
|
|
+ //加载药物过敏源缓存
|
|
|
+ if (MapUtils.isNotEmpty(allRulesDTO.getDrugAllergen())) {
|
|
|
+ redisUtil.set(RedisEnum.drugAllergen.getName(), allRulesDTO.getDrugAllergen());
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @DataProvider("setKlRuleSearchList")
|
|
|
+ public Boolean setKlRuleSearchList(@InvokeParameter("allRulesDTO") AllRulesDTO allRulesDTO) {
|
|
|
+ //存储有效规则Id
|
|
|
+ klRuleSearchService.remove(new QueryWrapper<>());
|
|
|
+ if (ListUtil.isNotEmpty(allRulesDTO.getKlRuleSearchList())) {
|
|
|
+ klRuleSearchService.saveBatch(allRulesDTO.getKlRuleSearchList());
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
public static void main(String[] args) {
|
|
|
List<List<RuleBaseDTO>> ruleBaseList = new ArrayList<>();
|
|
|
List<RuleBaseDTO> ruleBaseDTOListA = new ArrayList<>();
|