Преглед на файлове

添加术语搜索接口,备用

zhoutg преди 4 години
родител
ревизия
b01a79440d

+ 35 - 1
cdssman-service/src/main/java/com/diagbot/facade/KlConceptFacade.java

@@ -46,6 +46,7 @@ import com.diagbot.vo.KlConceptSaveSubVO;
 import com.diagbot.vo.KlConceptSaveVO;
 import com.diagbot.vo.KlLibraryInfoVO;
 import com.diagbot.vo.SearchConceptVO;
+import com.diagbot.vo.SearchVO;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import org.apache.commons.lang3.StringUtils;
@@ -107,7 +108,6 @@ public class KlConceptFacade extends KlConceptServiceImpl {
     @Autowired
     KlTcmSyndromeFacade klTcmSyndromeFacade;
 
-
     /**
      * @param klConceptInfoVO
      * @return
@@ -443,6 +443,12 @@ public class KlConceptFacade extends KlConceptServiceImpl {
         return retList;
     }
 
+    /**
+     * 根据类型和名称查找术语,名称和类型不能为空
+     *
+     * @param searchConceptVO
+     * @return
+     */
     public List<GetAllForRelationDTO> searchConceptByNameAndLibType(SearchConceptVO searchConceptVO) {
         List<GetAllForRelationDTO> getAllForRelationDTOS = Lists.newArrayList();
         String name = searchConceptVO.getName();
@@ -469,6 +475,34 @@ public class KlConceptFacade extends KlConceptServiceImpl {
         return getAllForRelationDTOS;
     }
 
+    /**
+     * 根据类型和名称查找术语,名称可为空
+     *
+     * @param SearchVO
+     * @return
+     */
+    public List<GetAllForRelationDTO> searchConceptByNameAndLibType(SearchVO SearchVO) {
+        List<GetAllForRelationDTO> getAllForRelationDTOS = Lists.newArrayList();
+        List<Long> excludedConceptIds = SearchVO.getExcludedConceptIds();
+        List<KlConcept> conceptList = this.list(new QueryWrapper<KlConcept>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("lib_type", SearchVO.getLibType())
+                .eq("status", StatusEnum.Enable.getKey())
+                .like(StringUtil.isNotBlank(SearchVO.getName()), "lib_name", SearchVO.getName())
+                .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;
+    }
+
     /**
      * 筛选符合类型的概念id
      *

+ 27 - 0
cdssman-service/src/main/java/com/diagbot/vo/SearchVO.java

@@ -0,0 +1,27 @@
+package com.diagbot.vo;
+
+import com.google.common.collect.Lists;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @author zhoutg
+ * @date 2021/3/10
+ * @time 12:57
+ */
+@Data
+public class SearchVO {
+
+    @ApiModelProperty(value="名称")
+    private String name;
+
+    @ApiModelProperty(value="词性id")
+    @NotNull(message ="请输入搜索词的词性" )
+    private Integer libType;
+
+    @ApiModelProperty(value="需要排除的概念id集合")
+    private List<Long> excludedConceptIds = Lists.newArrayList();
+}

+ 14 - 0
cdssman-service/src/main/java/com/diagbot/web/KlConceptController.java

@@ -4,6 +4,7 @@ package com.diagbot.web;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.GetAllForRelationDTO;
 import com.diagbot.dto.KlConceptAllDTO;
 import com.diagbot.dto.KlConceptInfoDTO;
 import com.diagbot.dto.RespDTO;
@@ -14,6 +15,7 @@ import com.diagbot.vo.KlConceptClearVO;
 import com.diagbot.vo.KlConceptInfoVO;
 import com.diagbot.vo.KlConceptSatarOrdisaVO;
 import com.diagbot.vo.KlConceptSaveVO;
+import com.diagbot.vo.SearchVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.List;
 
 /**
  * <p>
@@ -189,4 +192,15 @@ public class KlConceptController {
     public RespDTO<Boolean> startRuleInfos(@RequestBody @Valid KlConceptSatarOrdisaVO klConceptSatarOrdisaVO) {
         return RespDTO.onSuc(klConceptFacade.startOrDisableRule(klConceptSatarOrdisaVO,StatusEnum.Enable.getKey()));
     }
+
+    @ApiOperation(value = "根据类型和名称查找术语,名称可为空[by:zhoutg]",
+            notes = "name: 术语的名称<br>" +
+                    "libType: 术语的词性<br>" +
+                    "excludedConceptIds: 需要排除的概念id集合")
+    @PostMapping("/search")
+    @SysLogger("search")
+    public RespDTO<GetAllForRelationDTO> search(@RequestBody SearchVO SearchVO) {
+        List<GetAllForRelationDTO> getAllForRelationDTOS = klConceptFacade.searchConceptByNameAndLibType(SearchVO);
+        return RespDTO.onSuc(getAllForRelationDTOS);
+    }
 }