|
@@ -1,28 +1,20 @@
|
|
package com.diagbot.facade;
|
|
package com.diagbot.facade;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.HashSet;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
-import java.util.Set;
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
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 com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.diagbot.client.UserServiceClient;
|
|
import com.diagbot.client.UserServiceClient;
|
|
-import com.diagbot.dto.MultContactListDTO;
|
|
|
|
|
|
+import com.diagbot.dto.OnlyByRootListDTO;
|
|
import com.diagbot.dto.RespDTO;
|
|
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.service.impl.RelationServiceImpl;
|
|
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.vo.MultContactListVO;
|
|
|
|
|
|
+import com.diagbot.vo.OnlyByRootListVO;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 医学术语关联业务层
|
|
* @Description: 医学术语关联业务层
|
|
@@ -34,45 +26,27 @@ public class MultContactFacade extends RelationServiceImpl {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private UserServiceClient userServiceClient;
|
|
private UserServiceClient userServiceClient;
|
|
- @Autowired
|
|
|
|
- private ConceptFacade conceptFacade;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 医学术语多层关联维护-列表
|
|
* 医学术语多层关联维护-列表
|
|
* @param multContactListVO
|
|
* @param multContactListVO
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public IPage<MultContactListDTO> multContactList(MultContactListVO multContactListVO) {
|
|
|
|
- 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()));
|
|
|
|
- }
|
|
|
|
|
|
+ public IPage<OnlyByRootListDTO> multContactList(OnlyByRootListVO onlyByRootListVO) {
|
|
|
|
+
|
|
|
|
+ IPage<OnlyByRootListDTO> ipage = this.baseMapper.onlyByRootList(onlyByRootListVO);
|
|
|
|
|
|
- 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());
|
|
|
|
|
|
+ if(ListUtil.isNotEmpty(ipage.getRecords())){
|
|
|
|
+ List<String> userIds = ipage.getRecords().stream().map(i -> i.getOperName()).distinct().collect(Collectors.toList());
|
|
RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(userIds);
|
|
RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(userIds);
|
|
RespDTOUtil.respNGDealCover(respDTO, "获取用户信息失败");
|
|
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->{
|
|
|
|
|
|
+ ipage.getRecords().forEach(i->{
|
|
i.setOperName(respDTO.data.get(i.getOperName()));
|
|
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 multContactListDTOPage;
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return ipage;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|