|
@@ -1,18 +1,28 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.diagbot.client.UserServiceClient;
|
|
|
import com.diagbot.dto.MultContactListDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.entity.Concept;
|
|
|
+import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.enums.LexiconTypeEnum;
|
|
|
import com.diagbot.service.impl.RelationServiceImpl;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.RespDTOUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.vo.MultContactListVO;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Description: 医学术语关联业务层
|
|
@@ -24,25 +34,45 @@ public class MultContactFacade extends RelationServiceImpl {
|
|
|
|
|
|
@Autowired
|
|
|
private UserServiceClient userServiceClient;
|
|
|
+ @Autowired
|
|
|
+ private ConceptFacade conceptFacade;
|
|
|
|
|
|
/**
|
|
|
* 医学术语多层关联维护-列表
|
|
|
- *
|
|
|
* @param multContactListVO
|
|
|
* @return
|
|
|
*/
|
|
|
public IPage<MultContactListDTO> multContactList(MultContactListVO multContactListVO) {
|
|
|
- IPage<MultContactListDTO> ipage = this.baseMapper.multContactList(multContactListVO);
|
|
|
- if (ipage.getRecords().size() > 0) {
|
|
|
- List<String> ids = ipage.getRecords().stream().map(i -> i.getOperName()).distinct().collect(Collectors.toList());
|
|
|
- RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
|
|
|
- RespDTOUtil.respNGDealCover(respDTO, "获取用户信息失败");
|
|
|
- ipage.getRecords().forEach(i -> {
|
|
|
- i.setOperName(respDTO.data.get(i.getOperName()));
|
|
|
- });
|
|
|
+ if(StringUtil.isNotBlank(multContactListVO.getName())||StringUtil.isNotBlank(multContactListVO.getType())){
|
|
|
+ QueryWrapper<Concept> conceptQe = new QueryWrapper<>();
|
|
|
+ conceptQe.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ conceptQe.like(StringUtil.isNotBlank(multContactListVO.getName()),"lib_name", multContactListVO.getName());
|
|
|
+ conceptQe.eq(StringUtil.isNotBlank(multContactListVO.getType()),"lib_type", LexiconTypeEnum.getKey(multContactListVO.getType()));
|
|
|
+ multContactListVO.setRootNodeConceptIds(conceptFacade.list(conceptQe).stream().map(i->i.getId()).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+
|
|
|
+ IPage<MultContactListDTO> multContactListDTOPage = this.baseMapper.multContactList(multContactListVO);
|
|
|
+
|
|
|
+ if(ListUtil.isNotEmpty(multContactListDTOPage.getRecords())){
|
|
|
+ List<String> userIds = multContactListDTOPage.getRecords().stream().map(i -> i.getOperName()).distinct().collect(Collectors.toList());
|
|
|
+ RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(userIds);
|
|
|
+ RespDTOUtil.respNGDealCover(respDTO, "获取用户信息失败");
|
|
|
+
|
|
|
+ Set<Long> otherIds = new HashSet<>();
|
|
|
+ otherIds.addAll(Arrays.asList(multContactListDTOPage.getRecords().stream().map(i->i.getOtherIds()).collect(Collectors.joining(",")).split(",")).stream().map(i->Long.parseLong(i)).collect(Collectors.toList()));
|
|
|
+ otherIds.addAll(multContactListDTOPage.getRecords().stream().map(i->i.getConceptId()).collect(Collectors.toList()));
|
|
|
+ Map<Long,Concept> conceptMap = conceptFacade.listByIds(otherIds).stream().collect(Collectors.toMap(Concept::getId, i->i));
|
|
|
+
|
|
|
+ multContactListDTOPage.getRecords().forEach(i->{
|
|
|
+ i.setOperName(respDTO.data.get(i.getOperName()));
|
|
|
+ i.setLibName(conceptMap.get(i.getConceptId()).getLibName());
|
|
|
+ i.setLibType(LexiconTypeEnum.getName(conceptMap.get(i.getConceptId()).getLibType().intValue()));
|
|
|
+ i.setLibNameType(i.getLibName()+"("+i.getLibType()+")");
|
|
|
+ i.setOtherNames(Arrays.asList(i.getOtherIds().split(",")).stream().map(k->conceptMap.get(Long.parseLong(k)).getLibName()).collect(Collectors.joining(",")));
|
|
|
+ });
|
|
|
}
|
|
|
- return ipage;
|
|
|
+
|
|
|
+ return multContactListDTOPage;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|