|
@@ -1,13 +1,17 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.diagbot.dto.GetAllForRelationDTO;
|
|
|
import com.diagbot.entity.KlConcept;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.enums.LexiconEnum;
|
|
|
import com.diagbot.service.impl.KlConceptServiceImpl;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
+import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.vo.ConceptVO;
|
|
|
+import com.diagbot.vo.SearchConceptVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -82,4 +86,29 @@ public class KlConceptFacade extends KlConceptServiceImpl {
|
|
|
|
|
|
return retType;
|
|
|
}
|
|
|
+
|
|
|
+ public List<GetAllForRelationDTO> searchConceptByNameAndLibType(SearchConceptVO searchConceptVO) {
|
|
|
+ List<GetAllForRelationDTO> getAllForRelationDTOS = Lists.newArrayList();
|
|
|
+ String name = searchConceptVO.getName();
|
|
|
+ Integer libType = searchConceptVO.getLibType();
|
|
|
+ List<Long> excludedConceptIds = searchConceptVO.getExcludedConceptIds();
|
|
|
+ if (StringUtils.isNotBlank(name) && libType != null) {
|
|
|
+ List<KlConcept> conceptList = this.list(new QueryWrapper<KlConcept>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .like(StringUtil.isNotBlank(name), "lib_name", name.trim())
|
|
|
+ .eq("lib_type", libType)
|
|
|
+ .notIn(ListUtil.isNotEmpty(excludedConceptIds), "id", excludedConceptIds));
|
|
|
+ if (ListUtil.isNotEmpty(conceptList)) {
|
|
|
+ getAllForRelationDTOS = conceptList.stream().map(x -> {
|
|
|
+ GetAllForRelationDTO getAllForRelationDTO = new GetAllForRelationDTO();
|
|
|
+ getAllForRelationDTO.setConceptNameType(x.getLibName());
|
|
|
+ getAllForRelationDTO.setConceptName(x.getLibName());
|
|
|
+ getAllForRelationDTO.setConceptId(x.getId());
|
|
|
+ getAllForRelationDTO.setLibType(x.getLibType());
|
|
|
+ return getAllForRelationDTO;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return getAllForRelationDTOS;
|
|
|
+ }
|
|
|
}
|