|
@@ -2,6 +2,7 @@ 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.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
+import com.diagbot.dto.LexiconDTO;
|
|
import com.diagbot.dto.ResultRulePageDTO;
|
|
import com.diagbot.dto.ResultRulePageDTO;
|
|
import com.diagbot.entity.ResultRule;
|
|
import com.diagbot.entity.ResultRule;
|
|
import com.diagbot.service.impl.ResultRuleServiceImpl;
|
|
import com.diagbot.service.impl.ResultRuleServiceImpl;
|
|
@@ -13,6 +14,8 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
+import java.util.Comparator;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -70,6 +73,7 @@ public class ResultRuleFacade extends ResultRuleServiceImpl {
|
|
IPage<ResultRulePageDTO> page = super.getPage(resultRulePageVO);
|
|
IPage<ResultRulePageDTO> page = super.getPage(resultRulePageVO);
|
|
List<ResultRulePageDTO> records = page.getRecords();
|
|
List<ResultRulePageDTO> records = page.getRecords();
|
|
List<ResultRule> baseRules = this.list(new QueryWrapper<ResultRule>()
|
|
List<ResultRule> baseRules = this.list(new QueryWrapper<ResultRule>()
|
|
|
|
+ .eq("result_id", resultRulePageVO.getResultId())
|
|
.eq("success", resultRulePageVO.getSuccess()));
|
|
.eq("success", resultRulePageVO.getSuccess()));
|
|
|
|
|
|
Map<Long, ResultRule> baseRuleMap = baseRules.stream().collect(Collectors.toMap(ResultRule::getId, v -> v));
|
|
Map<Long, ResultRule> baseRuleMap = baseRules.stream().collect(Collectors.toMap(ResultRule::getId, v -> v));
|
|
@@ -87,4 +91,41 @@ public class ResultRuleFacade extends ResultRuleServiceImpl {
|
|
String fileName = "规则测试结果导出.xls";
|
|
String fileName = "规则测试结果导出.xls";
|
|
ExcelUtils.exportExcelUser(records, null, "sheet1", ResultRulePageDTO.class, fileName, response);
|
|
ExcelUtils.exportExcelUser(records, null, "sheet1", ResultRulePageDTO.class, fileName, response);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 动态获取下拉菜单选项
|
|
|
|
+ *
|
|
|
|
+ * @param resultRulePageVO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public Map<String, List<LexiconDTO>> getDroplistData(ResultRulePageVO resultRulePageVO) {
|
|
|
|
+ Map<String, List<LexiconDTO>> map = new HashMap<>();
|
|
|
|
+ List<ResultRule> list = this.list(new QueryWrapper<ResultRule>()
|
|
|
|
+ .eq("result_id", resultRulePageVO.getResultId())
|
|
|
|
+ .eq("success", resultRulePageVO.getSuccess()));
|
|
|
|
+
|
|
|
|
+ List<LexiconDTO> libTypeList = list.stream().map(item -> {
|
|
|
|
+ LexiconDTO lexiconDTO = new LexiconDTO();
|
|
|
|
+ lexiconDTO.setLibType(item.getRuleLibType());
|
|
|
|
+ lexiconDTO.setLibTypeName(item.getRuleLibTypeName());
|
|
|
|
+ return lexiconDTO;
|
|
|
|
+ }).distinct()
|
|
|
|
+ .sorted(Comparator.comparing(LexiconDTO::getLibType))
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ List<LexiconDTO> baseLibTypeList = list.stream()
|
|
|
|
+ .filter(i -> i.getRuleBaseLibType() != null)
|
|
|
|
+ .map(item -> {
|
|
|
|
+ LexiconDTO lexiconDTO = new LexiconDTO();
|
|
|
|
+ lexiconDTO.setLibType(item.getRuleBaseLibType());
|
|
|
|
+ lexiconDTO.setLibTypeName(item.getRuleBaseLibTypeName());
|
|
|
|
+ return lexiconDTO;
|
|
|
|
+ }).distinct()
|
|
|
|
+ .sorted(Comparator.comparing(LexiconDTO::getLibType))
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ map.put("ruleLibType", libTypeList);
|
|
|
|
+ map.put("ruleBaseLibType", baseLibTypeList);
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
}
|
|
}
|