|
@@ -39,6 +39,7 @@ import com.diagbot.entity.ConceptCommon;
|
|
|
import com.diagbot.entity.Lexicon;
|
|
|
import com.diagbot.entity.LibraryInfo;
|
|
|
import com.diagbot.entity.Medical;
|
|
|
+import com.diagbot.entity.Relation;
|
|
|
import com.diagbot.entity.wrapper.ConceptWrapper;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.enums.LexiconRSTypeEnum;
|
|
@@ -84,8 +85,8 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
// private LibraryDetailFacade libraryDetailFacade;
|
|
|
@Autowired
|
|
|
private MedicalFacade medicalFacade;
|
|
|
- // @Autowired
|
|
|
- // private RelationFacade relationFacade;
|
|
|
+ @Autowired
|
|
|
+ private RelationFacade relationFacade;
|
|
|
@Autowired
|
|
|
@Qualifier("libraryInfoServiceImpl")
|
|
|
private LibraryInfoService libraryInfoService;
|
|
@@ -167,7 +168,45 @@ public class ConceptFacade extends ConceptServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public List<GetAllForRelationDTO> getAllForRelation(GetAllForRelationVO getAllForRelationVO) {
|
|
|
- return this.baseMapper.getAllForRelation(getAllForRelationVO);
|
|
|
+ List<GetAllForRelationDTO> retList = new ArrayList<>();
|
|
|
+
|
|
|
+ QueryWrapper<Concept> conceptQe = new QueryWrapper<>();
|
|
|
+ conceptQe.eq("is_deleted", "N");
|
|
|
+ conceptQe.like(StringUtil.isNotEmpty(getAllForRelationVO.getName()),"lib_name", getAllForRelationVO.getName());
|
|
|
+ conceptQe.eq(getAllForRelationVO.getTypeId()!=null,"lib_type", getAllForRelationVO.getTypeId());
|
|
|
+ List<Concept> conceptList = list(conceptQe);
|
|
|
+
|
|
|
+ Map<Long,Long> reCouMap = new HashMap<>();
|
|
|
+ if(getAllForRelationVO.getRelationPosition()!=3){
|
|
|
+ if(getAllForRelationVO.getRelationId()==null){
|
|
|
+ throw new CommonException(CommonErrorCode.RPC_ERROR, "关系类型id必传!");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Long> conceptIdList = conceptList.stream().map(i->i.getId()).collect(Collectors.toList());
|
|
|
+ QueryWrapper<Relation> relationQe = new QueryWrapper<>();
|
|
|
+ relationQe.eq("relation_id", getAllForRelationVO.getRelationId());
|
|
|
+ if(getAllForRelationVO.getRelationPosition()==1){
|
|
|
+ relationQe.in("start_id", conceptIdList);
|
|
|
+ relationQe.eq(getAllForRelationVO.getRelationConceptId()!=null,"end_id", getAllForRelationVO.getRelationConceptId());
|
|
|
+ reCouMap = relationFacade.list(relationQe).stream().collect(Collectors.groupingBy(Relation::getStartId,Collectors.counting()));
|
|
|
+ }else{
|
|
|
+ relationQe.in("end_id", conceptIdList);
|
|
|
+ relationQe.eq(getAllForRelationVO.getRelationConceptId()!=null,"start_id", getAllForRelationVO.getRelationConceptId());
|
|
|
+ reCouMap = relationFacade.list(relationQe).stream().collect(Collectors.groupingBy(Relation::getEndId,Collectors.counting()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for(Concept i : conceptList){
|
|
|
+ if(reCouMap.get(i.getId())!=null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ GetAllForRelationDTO getAllForRelationDTO = new GetAllForRelationDTO();
|
|
|
+ getAllForRelationDTO.setConceptId(i.getId());
|
|
|
+ getAllForRelationDTO.setConceptName(i.getLibName());
|
|
|
+ retList.add(getAllForRelationDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ return retList;
|
|
|
}
|
|
|
|
|
|
/**
|