|
@@ -3,36 +3,25 @@ package com.diagbot.facade;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
-import com.diagbot.dto.IndicationExportDTO;
|
|
|
|
-import com.diagbot.dto.KlRuleByIdDTO;
|
|
|
|
-import com.diagbot.dto.KlRuleByIdParDTO;
|
|
|
|
-import com.diagbot.dto.KlRuleByIdSubDTO;
|
|
|
|
-import com.diagbot.dto.KlRuleInfoDTO;
|
|
|
|
|
|
+import com.diagbot.dto.*;
|
|
import com.diagbot.entity.KlRule;
|
|
import com.diagbot.entity.KlRule;
|
|
import com.diagbot.entity.KlRuleBase;
|
|
import com.diagbot.entity.KlRuleBase;
|
|
import com.diagbot.entity.KlRuleCondition;
|
|
import com.diagbot.entity.KlRuleCondition;
|
|
|
|
+import com.diagbot.enums.CommonEnum;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
|
+import com.diagbot.enums.RedisEnum;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
import com.diagbot.exception.CommonException;
|
|
import com.diagbot.exception.CommonException;
|
|
import com.diagbot.service.impl.KlRuleServiceImpl;
|
|
import com.diagbot.service.impl.KlRuleServiceImpl;
|
|
-import com.diagbot.util.BeanUtil;
|
|
|
|
-import com.diagbot.util.DateUtil;
|
|
|
|
-import com.diagbot.util.ExcelUtils;
|
|
|
|
-import com.diagbot.util.ListUtil;
|
|
|
|
-import com.diagbot.util.StringUtil;
|
|
|
|
-import com.diagbot.vo.KlRuleByIdVO;
|
|
|
|
-import com.diagbot.vo.KlRuleInfoClearVO;
|
|
|
|
-import com.diagbot.vo.KlRuleInfoSaveSubVO;
|
|
|
|
-import com.diagbot.vo.KlRuleInfoSaveVO;
|
|
|
|
-import com.diagbot.vo.KlRuleInfoVO;
|
|
|
|
-import com.diagbot.vo.KlRuleSatartOrdisaVO;
|
|
|
|
|
|
+import com.diagbot.util.*;
|
|
|
|
+import com.diagbot.vo.*;
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
|
+import io.github.lvyahui8.spring.facade.DataFacade;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description:
|
|
* @Description:
|
|
@@ -45,6 +34,8 @@ public class KlRuleFacade extends KlRuleServiceImpl {
|
|
KlRuleConditionFacade klRuleConditionFacade;
|
|
KlRuleConditionFacade klRuleConditionFacade;
|
|
@Autowired
|
|
@Autowired
|
|
KlRuleBaseFacade klRuleBaseFacade;
|
|
KlRuleBaseFacade klRuleBaseFacade;
|
|
|
|
+ @Autowired
|
|
|
|
+ private RedisUtil redisUtil;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @param klRuleInfoVO
|
|
* @param klRuleInfoVO
|
|
@@ -250,4 +241,126 @@ public class KlRuleFacade extends KlRuleServiceImpl {
|
|
ExcelUtils.exportExcel(indicationExportDTOS, null, "开单合理性", IndicationExportDTO.class, "indication.xlsx",
|
|
ExcelUtils.exportExcel(indicationExportDTOS, null, "开单合理性", IndicationExportDTO.class, "indication.xlsx",
|
|
response, 12.8f);
|
|
response, 12.8f);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 是否集合类型
|
|
|
|
+ *
|
|
|
|
+ * @param type
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public Boolean isGatherType(Integer type) {
|
|
|
|
+ if (type == null) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return (type >= 308 && type <= 329) || (type >= 301 && type <= 304);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询所有有效的规则
|
|
|
|
+ *
|
|
|
|
+ * @param ruleQueryVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public IPage<RuleQueryDTO> getRulePageFac(RuleQueryVO ruleQueryVO) {
|
|
|
|
+ if (StringUtil.isNotBlank(ruleQueryVO.getBaseLibName()) || !IntegerUtil.isNull(ruleQueryVO.getBaseLibType())) {
|
|
|
|
+ try {
|
|
|
|
+ //取得所有基础规则条目的上级规则的ID
|
|
|
|
+ Map<String, Object> invokeParams = new HashMap<>();
|
|
|
|
+ RuleBaseQueryVO ruleBaseQueryVO = new RuleBaseQueryVO();
|
|
|
|
+ ruleBaseQueryVO.setBaseLibType(ruleQueryVO.getBaseLibType());
|
|
|
|
+ ruleBaseQueryVO.setBaseLibName(ruleQueryVO.getBaseLibName());
|
|
|
|
+ invokeParams.put("ruleBaseQueryVO",ruleBaseQueryVO);
|
|
|
|
+ List<Long> ruleIds = DataFacade.get("getAllRuleIds", invokeParams, List.class);
|
|
|
|
+ ruleQueryVO.setRuleIds(ruleIds);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "查询所有有效规则失败" + e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return this.getRulePage(ruleQueryVO);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据录入内容查询有效规则的明细
|
|
|
|
+ *
|
|
|
|
+ * @param ruleQueryKeyVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public RuleDTO getRuleDetail(RuleQueryKeyVO ruleQueryKeyVO) {
|
|
|
|
+ String key = RedisEnum.allRule.getName() + ruleQueryKeyVO.getLibType() + "_" + ruleQueryKeyVO.getLibName() + "_" + ruleQueryKeyVO.getRuleType();
|
|
|
|
+ RuleDTO ruleDTO = redisUtil.get(key);
|
|
|
|
+
|
|
|
|
+ // 规则名称入参,转大写
|
|
|
|
+ String descriptionVO = toUpperCase(ruleQueryKeyVO.getDescription());
|
|
|
|
+ // 基础术语名称入参,转大写
|
|
|
|
+ String baseLibNameVO = toUpperCase(ruleQueryKeyVO.getBaseLibName());
|
|
|
|
+
|
|
|
|
+ // 基础术语类型入参
|
|
|
|
+ Integer baseLibTypeVO = ruleQueryKeyVO.getBaseLibType();
|
|
|
|
+
|
|
|
|
+ // 有条件才去遍历筛选
|
|
|
|
+ if (StringUtil.isNotEmpty(descriptionVO) || StringUtil.isNotEmpty(baseLibNameVO) || baseLibTypeVO != null) {
|
|
|
|
+ List<RuleConditionDTO> ruleConditionDTOList = ruleDTO.getRuleConditionDTOList();
|
|
|
|
+ Iterator<RuleConditionDTO> iterator = ruleConditionDTOList.iterator();
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ RuleConditionDTO ruleConditionDTO = iterator.next();
|
|
|
|
+ // 过滤规则名称
|
|
|
|
+ if (StringUtil.isNotBlank(descriptionVO)) {
|
|
|
|
+ if (!toUpperCase(ruleConditionDTO.getDescription()).contains(descriptionVO)) {
|
|
|
|
+ iterator.remove();
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 过滤基础术语类型和名称
|
|
|
|
+ if ((baseLibTypeVO != null || StringUtil.isNotEmpty(ruleQueryKeyVO.getBaseLibName()))) {
|
|
|
|
+ if (ListUtil.isEmpty(ruleConditionDTO.getRuleBaseDTOList())) {
|
|
|
|
+ iterator.remove();
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ List<RuleBaseDTO> ruleBaseDTOList = ruleConditionDTO.getRuleBaseDTOList();
|
|
|
|
+ boolean hasFlag = false; // 是否匹配
|
|
|
|
+ for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList) {
|
|
|
|
+ Integer baseLibType = ruleBaseDTO.getBaseLibType();
|
|
|
|
+ String baseLibName = toUpperCase(ruleBaseDTO.getBaseLibName());
|
|
|
|
+
|
|
|
|
+ if (StringUtil.isNotBlank(baseLibNameVO) && baseLibTypeVO != null) {
|
|
|
|
+ if (baseLibName.contains(baseLibNameVO) && baseLibTypeVO.equals(baseLibType)) {
|
|
|
|
+ hasFlag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ } else if (StringUtil.isNotBlank(baseLibNameVO)) {
|
|
|
|
+ if (baseLibName.contains(baseLibNameVO)) {
|
|
|
|
+ hasFlag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ } else if (baseLibTypeVO != null) {
|
|
|
|
+ if (baseLibTypeVO.equals(baseLibType)) {
|
|
|
|
+ hasFlag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!hasFlag) {
|
|
|
|
+ iterator.remove();
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return ruleDTO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 转大写
|
|
|
|
+ *
|
|
|
|
+ * @param name
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public String toUpperCase(String name) {
|
|
|
|
+ if (StringUtil.isNotBlank(name)) {
|
|
|
|
+ return name.toUpperCase();
|
|
|
|
+ }
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
}
|
|
}
|