|
@@ -3,6 +3,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.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.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.diagbot.client.UserServiceClient;
|
|
import com.diagbot.client.UserServiceClient;
|
|
import com.diagbot.dto.GetAllForRelationDTO;
|
|
import com.diagbot.dto.GetAllForRelationDTO;
|
|
import com.diagbot.dto.KlConceptAllDTO;
|
|
import com.diagbot.dto.KlConceptAllDTO;
|
|
@@ -24,6 +25,7 @@ import com.diagbot.exception.CommonException;
|
|
import com.diagbot.service.impl.KlConceptServiceImpl;
|
|
import com.diagbot.service.impl.KlConceptServiceImpl;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.DateUtil;
|
|
import com.diagbot.util.DateUtil;
|
|
|
|
+import com.diagbot.util.IntegerUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.RespDTOUtil;
|
|
import com.diagbot.util.RespDTOUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
@@ -82,15 +84,87 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public IPage<KlConceptInfoDTO> getConceptInfoPage(KlConceptInfoVO klConceptInfoVO) {
|
|
public IPage<KlConceptInfoDTO> getConceptInfoPage(KlConceptInfoVO klConceptInfoVO) {
|
|
- IPage<KlConceptInfoDTO> conceptPage = getConceptPage(klConceptInfoVO);
|
|
|
|
- List<String> userIds = conceptPage.getRecords().stream()
|
|
|
|
- .map(i -> i.getModifierId()).distinct().collect(Collectors.toList());
|
|
|
|
- RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(userIds);
|
|
|
|
- RespDTOUtil.respNGDealCover(respDTO, "获取用户信息失败");
|
|
|
|
- conceptPage.getRecords().forEach(i -> {
|
|
|
|
- i.setModifierName(respDTO.data.get(i.getModifierId()));
|
|
|
|
- });
|
|
|
|
- return conceptPage;
|
|
|
|
|
|
+ Page<KlConceptInfoDTO> klConceptInfoDTOPage = new Page<>();
|
|
|
|
+ QueryWrapper<KlConcept> conceptQe = new QueryWrapper<>();
|
|
|
|
+ if (StringUtil.isNotBlank(klConceptInfoVO.getSynonymName())) {
|
|
|
|
+ QueryWrapper<KlLibraryInfo> libraryInfoQe = new QueryWrapper<>();
|
|
|
|
+ libraryInfoQe.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
+ libraryInfoQe.apply(
|
|
|
|
+ "UPPER(`name`) LIKE CONCAT('%',trim('"
|
|
|
|
+ + klConceptInfoVO.getSynonymName().toUpperCase()
|
|
|
|
+ + "'),'%')");
|
|
|
|
+ libraryInfoQe.eq(StringUtil.isNotBlank(klConceptInfoVO.getLibType()),
|
|
|
|
+ "type_id", klConceptInfoVO.getLibType());
|
|
|
|
+ List<Long> conceptIdList = klLibraryInfoFacade.list(libraryInfoQe)
|
|
|
|
+ .stream().map(KlLibraryInfo::getConceptId).distinct().collect(Collectors.toList());
|
|
|
|
+ if (ListUtil.isNotEmpty(conceptIdList)) {
|
|
|
|
+ conceptQe.in("id", conceptIdList);
|
|
|
|
+ } else {
|
|
|
|
+ conceptQe.eq("id", -999999999);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isNotBlank(klConceptInfoVO.getLibName())) {
|
|
|
|
+ conceptQe.apply(
|
|
|
|
+ "UPPER(lib_name) LIKE CONCAT('%',trim('"
|
|
|
|
+ + klConceptInfoVO.getLibName().toUpperCase()
|
|
|
|
+ + "'),'%')");
|
|
|
|
+ }
|
|
|
|
+ conceptQe.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
+ conceptQe.eq(StringUtil.isNotBlank(klConceptInfoVO.getLibType()),
|
|
|
|
+ "lib_type", klConceptInfoVO.getLibType());
|
|
|
|
+ conceptQe.eq(!IntegerUtil.isNull(klConceptInfoVO.getStatus()),
|
|
|
|
+ "status", klConceptInfoVO.getStatus());
|
|
|
|
+ conceptQe.orderByDesc("status");
|
|
|
|
+ conceptQe.orderByDesc("gmt_modified");
|
|
|
|
+ conceptQe.orderByDesc("id");
|
|
|
|
+ IPage<KlConcept> conceptPage = this.page(klConceptInfoVO);
|
|
|
|
+ BeanUtil.copyProperties(conceptPage, klConceptInfoDTOPage);
|
|
|
|
+
|
|
|
|
+ if (ListUtil.isNotEmpty(conceptPage.getRecords())) {
|
|
|
|
+ //获取用户
|
|
|
|
+ List<String> userIds = conceptPage.getRecords().stream()
|
|
|
|
+ .map(KlConcept::getModifier).distinct().collect(Collectors.toList());
|
|
|
|
+ RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(userIds);
|
|
|
|
+ RespDTOUtil.respNGDealCover(respDTO, "获取用户信息失败");
|
|
|
|
+ //获取同义词
|
|
|
|
+ List<Long> conceptIds = conceptPage.getRecords().stream()
|
|
|
|
+ .map(KlConcept::getId).distinct().collect(Collectors.toList());
|
|
|
|
+ QueryWrapper<KlLibraryInfo> qw = new QueryWrapper<>();
|
|
|
|
+ qw.in("concept_id", conceptIds)
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .orderByAsc("concept_id")
|
|
|
|
+ .orderByAsc("is_concept");
|
|
|
|
+ Map<Long, List<KlLibraryInfo>> libMap = klLibraryInfoFacade.list(qw)
|
|
|
|
+ .stream().collect(Collectors.groupingBy(KlLibraryInfo::getConceptId));
|
|
|
|
+ //获取类型
|
|
|
|
+ List<Integer> libTypes = conceptPage.getRecords().stream()
|
|
|
|
+ .map(KlConcept::getLibType).distinct().collect(Collectors.toList());
|
|
|
|
+ QueryWrapper<KlLexicon> qwLib = new QueryWrapper<>();
|
|
|
|
+ qwLib.in("code", libTypes)
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
+ Map<Integer, String> lexiconMap = klLexiconFacade.list(qwLib)
|
|
|
|
+ .stream().collect(Collectors.toMap(KlLexicon::getCode, KlLexicon::getName));
|
|
|
|
+ //组装结果
|
|
|
|
+ List<KlConceptInfoDTO> records = new ArrayList<>();
|
|
|
|
+ conceptPage.getRecords().forEach(i -> {
|
|
|
|
+ KlConceptInfoDTO klConceptInfoDTO = new KlConceptInfoDTO();
|
|
|
|
+ klConceptInfoDTO.setConceptId(i.getId());
|
|
|
|
+ klConceptInfoDTO.setLibName(i.getLibName());
|
|
|
|
+ klConceptInfoDTO.setLibType(i.getLibType());
|
|
|
|
+ klConceptInfoDTO.setTypeName(lexiconMap.get(i.getLibType()));
|
|
|
|
+ klConceptInfoDTO.setSynonymName(libMap.get(i.getId())
|
|
|
|
+ .stream()
|
|
|
|
+ .map(KlLibraryInfo::getName)
|
|
|
|
+ .collect(Collectors.joining("、")));
|
|
|
|
+ klConceptInfoDTO.setModifierId(i.getModifier());
|
|
|
|
+ klConceptInfoDTO.setModifierName(respDTO.data.get(i.getModifier()));
|
|
|
|
+ klConceptInfoDTO.setGmtModified(i.getGmtModified());
|
|
|
|
+ klConceptInfoDTO.setStatus(i.getStatus());
|
|
|
|
+ records.add(klConceptInfoDTO);
|
|
|
|
+ });
|
|
|
|
+ klConceptInfoDTOPage.setRecords(records);
|
|
|
|
+ }
|
|
|
|
+ return klConceptInfoDTOPage;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|