zhoutg 6 лет назад
Родитель
Сommit
a272968579

+ 8 - 7
icssman-service/src/main/java/com/diagbot/client/KnowledgemanServiceClient.java

@@ -3,10 +3,8 @@ package com.diagbot.client;
 import com.diagbot.client.hystrix.KnowledgemanServiceHystrix;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.RespDTO;
-import com.diagbot.vo.ConceptExistVO;
 import com.diagbot.vo.ConceptSearchVO;
 import com.diagbot.vo.ConceptTypeVO;
-import com.diagbot.vo.IndexVO;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -22,11 +20,14 @@ import java.util.Map;
 @FeignClient(value = "knowledgeman-service", fallback = KnowledgemanServiceHystrix.class)
 public interface KnowledgemanServiceClient {
 
-    @PostMapping("/commonconcept/index")
-    RespDTO<List<ConceptBaseDTO>> index(@RequestBody IndexVO indexVO);
-
-    @PostMapping("/commonconcept/getConceptMapByNameAndType")
-    RespDTO<Map<String, List<Integer>>> getConceptMap(@RequestBody ConceptExistVO conceptExistVO);
+//    @PostMapping("/commonconcept/index")
+//    RespDTO<List<ConceptBaseDTO>> index(@RequestBody IndexVO indexVO);
+//
+//    @PostMapping("/commonconcept/indexByLexicon")
+//    RespDTO<List<ConceptBaseDTO>> indexByLexiconFac(@RequestBody IndexLexiconVO indexLexiconVO);
+//
+//    @PostMapping("/commonconcept/getConceptMapByNameAndType")
+//    RespDTO<Map<String, List<Integer>>> getConceptMap(@RequestBody ConceptExistVO conceptExistVO);
 
     /**
      * 根据概念Id列表获取概念列表Map

+ 17 - 13
icssman-service/src/main/java/com/diagbot/client/hystrix/KnowledgemanServiceHystrix.java

@@ -3,10 +3,8 @@ package com.diagbot.client.hystrix;
 import com.diagbot.client.KnowledgemanServiceClient;
 import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.RespDTO;
-import com.diagbot.vo.ConceptExistVO;
 import com.diagbot.vo.ConceptSearchVO;
 import com.diagbot.vo.ConceptTypeVO;
-import com.diagbot.vo.IndexVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -23,17 +21,23 @@ import java.util.Map;
 @Slf4j
 public class KnowledgemanServiceHystrix implements KnowledgemanServiceClient {
 
-    @Override
-    public RespDTO<List<ConceptBaseDTO>> index(IndexVO indexVO) {
-        log.error("【hystrix】调用{}异常", "index");
-        return null;
-    }
-
-    @Override
-    public RespDTO<Map<String, List<Integer>>> getConceptMap(ConceptExistVO conceptExistVO) {
-        log.error("【hystrix】调用{}异常", "getConceptMap");
-        return null;
-    }
+//    @Override
+//    public RespDTO<List<ConceptBaseDTO>> index(IndexVO indexVO) {
+//        log.error("【hystrix】调用{}异常", "index");
+//        return null;
+//    }
+//
+//    @Override
+//    public RespDTO<List<ConceptBaseDTO>> indexByLexiconFac(IndexLexiconVO indexLexiconVO) {
+//        log.error("【hystrix】调用{}异常", "indexByLexiconFac");
+//        return null;
+//    }
+//
+//    @Override
+//    public RespDTO<Map<String, List<Integer>>> getConceptMap(ConceptExistVO conceptExistVO) {
+//        log.error("【hystrix】调用{}异常", "getConceptMap");
+//        return null;
+//    }
 
     /**
      * 根据概念Id列表获取概念列表Map

+ 46 - 39
icssman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -1,39 +1,46 @@
-package com.diagbot.facade;
-
-import com.diagbot.client.KnowledgemanServiceClient;
-import com.diagbot.dto.ConceptBaseDTO;
-import com.diagbot.dto.RespDTO;
-import com.diagbot.util.RespDTOUtil;
-import com.diagbot.vo.ConceptExistVO;
-import com.diagbot.vo.IndexVO;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @Description:
- * @Author:zhoutg
- * @time: 2018/11/23 11:37
- */
-@Component
-public class ConceptFacade {
-
-    @Autowired
-    KnowledgemanServiceClient knowledgemanServiceClient;
-
-    public List<ConceptBaseDTO> indexFac(IndexVO indexVO) {
-        RespDTO<List<ConceptBaseDTO>> res = knowledgemanServiceClient.index(indexVO);
-        RespDTOUtil.respNGDeal(res, "远程调用获取概念列表失败");
-        return res.data;
-    }
-
-
-    public Map<String, List<Integer>> getConceptMap(ConceptExistVO conceptExistVO) {
-        RespDTO<Map<String, List<Integer>>> res = knowledgemanServiceClient.getConceptMap(conceptExistVO);
-        RespDTOUtil.respNGDeal(res, "远程调用获取概念列表失败");
-        return res.data;
-    }
-
-}
+//package com.diagbot.facade;
+//
+//import com.diagbot.client.KnowledgemanServiceClient;
+//import com.diagbot.dto.ConceptBaseDTO;
+//import com.diagbot.dto.RespDTO;
+//import com.diagbot.util.RespDTOUtil;
+//import com.diagbot.vo.ConceptExistVO;
+//import com.diagbot.vo.IndexLexiconVO;
+//import com.diagbot.vo.IndexVO;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+//import java.util.List;
+//
+///**
+// * @Description:
+// * @Author:zhoutg
+// * @time: 2018/11/23 11:37
+// */
+//@Component
+//public class ConceptFacade {
+//
+//    @Autowired
+//    KnowledgemanServiceClient knowledgemanServiceClient;
+//
+//    public List<ConceptBaseDTO> indexFac(IndexVO indexVO) {
+//        RespDTO<List<ConceptBaseDTO>> res = knowledgemanServiceClient.index(indexVO);
+//        RespDTOUtil.respNGDeal(res, "远程调用获取概念列表失败");
+//        return res.data;
+//    }
+//
+//
+//    public Map<String, List<Integer>> getConceptMap(ConceptExistVO conceptExistVO) {
+//        RespDTO<Map<String, List<Integer>>> res = knowledgemanServiceClient.getConceptMap(conceptExistVO);
+//        RespDTOUtil.respNGDeal(res, "远程调用获取概念列表失败");
+//        return res.data;
+//    }
+//
+//
+//    public List<ConceptBaseDTO> indexByLexiconFac(IndexLexiconVO indexLexiconVO) {
+//        RespDTO<List<ConceptBaseDTO>> res = knowledgemanServiceClient.indexByLexiconFac(indexLexiconVO);
+//        RespDTOUtil.respNGDeal(res, "远程调用搜索概念列表失败");
+//        return res.data;
+//    }
+//
+//}

+ 22 - 0
icssman-service/src/main/java/com/diagbot/vo/IndexLexiconVO.java

@@ -0,0 +1,22 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @description:
+ * @author: zhoutg
+ * @date: 2019/5/10 10:47
+ */
+@Getter
+@Setter
+public class IndexLexiconVO {
+    @NotBlank(message = "名称不能为空")
+    private String name;
+    @NotNull(message = "词性类型不能为空")
+    private List<Integer> libType;
+}

+ 84 - 67
icssman-service/src/main/java/com/diagbot/web/ConceptController.java

@@ -1,67 +1,84 @@
-package com.diagbot.web;
-
-
-import com.diagbot.annotation.SysLogger;
-import com.diagbot.dto.ConceptBaseDTO;
-import com.diagbot.dto.RespDTO;
-import com.diagbot.facade.ConceptFacade;
-import com.diagbot.vo.ConceptExistVO;
-import com.diagbot.vo.IndexVO;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * <p>
- * 概念表 前端控制器
- * </p>
- *
- * @author zhaops
- * @since 2019-05-06
- */
-@RestController
-@RequestMapping("/concept")
-@Api(value = "概念相关API", tags = { "知识库标准化-概念相关API" })
-@SuppressWarnings("unchecked")
-public class ConceptController {
-    @Autowired
-    ConceptFacade conceptFacade;
-
-    /**
-     * 检索
-     *
-     * @param indexVO 搜索参数
-     * @return 名称和概念id
-     */
-    @ApiOperation(value = "知识库标准化-根据名称和类型获取概念列表[by:zhoutg]",
-            notes = "name: 搜索内容<br>" +
-                    "type:类型(1:症状 2:既往史,3:其他史,4:查体,5:化验),必填<br>")
-    @PostMapping("/index")
-    @SysLogger("index")
-    public RespDTO<List<ConceptBaseDTO>> index(@RequestBody IndexVO indexVO){
-        return RespDTO.onSuc(conceptFacade.indexFac(indexVO));
-    }
-
-
-    /**
-     * 根据名称和类型获取概念列表Map
-     *
-     * @param conceptExistVO 搜索参数
-     * @return 术语id和术语 Map
-     */
-    @ApiOperation(value = "知识库标准化-根据名称和类型获取概念列表Map[by:zhoutg]",
-            notes = "nameList: 名称列表<br>" +
-                    "type: 类型")
-    @PostMapping("/getConceptMapByNameAndType")
-    @SysLogger("getConceptMapByNameAndType")
-    public RespDTO<Map<String, Long>> getConceptMapByNameAndType(@RequestBody ConceptExistVO conceptExistVO){
-        return RespDTO.onSuc(conceptFacade.getConceptMap(conceptExistVO));
-    }
-}
+//package com.diagbot.web;
+//
+//
+//import com.diagbot.annotation.SysLogger;
+//import com.diagbot.dto.ConceptBaseDTO;
+//import com.diagbot.dto.RespDTO;
+//import com.diagbot.facade.ConceptFacade;
+//import com.diagbot.vo.ConceptExistVO;
+//import com.diagbot.vo.IndexLexiconVO;
+//import com.diagbot.vo.IndexVO;
+//import io.swagger.annotations.Api;
+//import io.swagger.annotations.ApiOperation;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.web.bind.annotation.PostMapping;
+//import org.springframework.web.bind.annotation.RequestBody;
+//import org.springframework.web.bind.annotation.RequestMapping;
+//import org.springframework.web.bind.annotation.RestController;
+//
+//import java.util.List;
+//import java.util.Map;
+//
+///**
+// * <p>
+// * 概念表 前端控制器
+// * </p>
+// *
+// * @author zhaops
+// * @since 2019-05-06
+// */
+//@RestController
+//@RequestMapping("/concept")
+//@Api(value = "概念相关API", tags = { "知识库标准化-概念相关API" })
+//@SuppressWarnings("unchecked")
+//public class ConceptController {
+//    @Autowired
+//    ConceptFacade conceptFacade;
+//
+//    /**
+//     * 检索
+//     *
+//     * @param indexVO 搜索参数
+//     * @return 名称和概念id
+//     */
+//    @ApiOperation(value = "知识库标准化-根据名称和类型获取概念列表[by:zhoutg]",
+//            notes = "name: 搜索内容<br>" +
+//                    "type:类型(1:症状 2:既往史,3:其他史,4:查体,5:化验),必填<br>")
+//    @PostMapping("/index")
+//    @SysLogger("index")
+//    public RespDTO<List<ConceptBaseDTO>> index(@RequestBody IndexVO indexVO){
+//        return RespDTO.onSuc(conceptFacade.indexFac(indexVO));
+//    }
+//
+//
+//    /**
+//     * 根据名称和类型获取概念列表Map
+//     *
+//     * @param conceptExistVO 搜索参数
+//     * @return 术语id和术语 Map
+//     */
+//    @ApiOperation(value = "知识库标准化-根据名称和类型获取概念列表Map[by:zhoutg]",
+//            notes = "nameList: 名称列表<br>" +
+//                    "type: 类型")
+//    @PostMapping("/getConceptMapByNameAndType")
+//    @SysLogger("getConceptMapByNameAndType")
+//    public RespDTO<Map<String, Long>> getConceptMapByNameAndType(@RequestBody ConceptExistVO conceptExistVO){
+//        return RespDTO.onSuc(conceptFacade.getConceptMap(conceptExistVO));
+//    }
+//
+//
+//    /**
+//     * 检索
+//     *
+//     * @param indexLexiconVO 搜索参数
+//     * @return 名称和概念id
+//     */
+//    @ApiOperation(value = "知识库标准化-根据名称和术语库词性类型搜索[by:zhoutg]",
+//            notes = "name: 搜索内容,必填<br>" +
+//                    "libType:术语库词性类型,必填<br>")
+//    @PostMapping("/indexByLexicon")
+//    @SysLogger("indexByLexicon")
+//    public RespDTO<List<ConceptBaseDTO>> indexByLexicon(@RequestBody IndexLexiconVO indexLexiconVO){
+//        return RespDTO.onSuc(conceptFacade.indexByLexiconFac(indexLexiconVO));
+//    }
+//}

+ 1 - 0
knowledgeman-service/src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -33,6 +33,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/dictionaryInfo/getList").permitAll()
                 .antMatchers("/commonconcept/getConceptMapByNameAndType").permitAll()
                 .antMatchers("/commonconcept/index").permitAll()
+                .antMatchers("/commonconcept/indexByLexicon").permitAll()
                 .antMatchers("/**").authenticated();
 //                .antMatchers("/**").permitAll();
     }

+ 1 - 0
knowledgeman-service/src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -96,6 +96,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/dictionaryInfo/getList", request)
                 || matchers("/commonconcept/getConceptMapByNameAndType", request)
                 || matchers("/commonconcept/index", request)
+                || matchers("/commonconcept/indexByLexicon", request)
                 || matchers("/", request)) {
             return true;
         }

+ 7 - 0
knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -45,6 +45,7 @@ import com.diagbot.vo.GetAllForRelationVO;
 import com.diagbot.vo.GetAllInformationVO;
 import com.diagbot.vo.GetAllLisConceptVO;
 import com.diagbot.vo.GetConceptInfoDetailVO;
+import com.diagbot.vo.IndexLexiconVO;
 import com.diagbot.vo.IndexVO;
 import com.diagbot.vo.RemoveConceptInfoVO;
 import org.apache.commons.lang.time.DateFormatUtils;
@@ -934,6 +935,12 @@ public class ConceptFacade extends ConceptServiceImpl {
         return this.index(indexVO);
     }
 
+
+    public List<ConceptBaseDTO> indexByLexiconFac(IndexLexiconVO indexLexiconVO) {
+        return this.indexByLexicon(indexLexiconVO);
+    }
+
+
     /**
      * 根据概念Id列表获取概念列表Map
      *

+ 11 - 2
knowledgeman-service/src/main/java/com/diagbot/mapper/ConceptMapper.java

@@ -1,7 +1,5 @@
 package com.diagbot.mapper;
 
-import java.util.List;
-
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.dto.ConceptBaseDTO;
@@ -13,8 +11,11 @@ import com.diagbot.entity.Concept;
 import com.diagbot.entity.wrapper.ConceptWrapper;
 import com.diagbot.vo.GetAllInformationVO;
 import com.diagbot.vo.GetAllLisConceptVO;
+import com.diagbot.vo.IndexLexiconVO;
 import com.diagbot.vo.IndexVO;
 
+import java.util.List;
+
 /**
  * <p>
  * Mapper 接口
@@ -60,5 +61,13 @@ public interface ConceptMapper extends BaseMapper<Concept> {
      * @return 检索结果
      */
     List<ConceptBaseDTO> index(IndexVO indexVO);
+
+    /**
+     * 根据名称和词性检索
+     *
+     * @param indexLexiconVO
+     * @return
+     */
+    List<ConceptBaseDTO> indexByLexicon(IndexLexiconVO indexLexiconVO);
     
 }

+ 12 - 0
knowledgeman-service/src/main/java/com/diagbot/service/ConceptService.java

@@ -6,6 +6,7 @@ import com.diagbot.dto.ConceptRes;
 import com.diagbot.dto.ConceptWithOrderRes;
 import com.diagbot.entity.Concept;
 import com.diagbot.entity.wrapper.ConceptWrapper;
+import com.diagbot.vo.IndexLexiconVO;
 import com.diagbot.vo.IndexVO;
 
 import java.util.List;
@@ -45,4 +46,15 @@ public interface ConceptService extends IService<Concept> {
      * @return 检索结果
      */
     List<ConceptBaseDTO> index(IndexVO indexVO);
+
+
+    /**
+     * 根据名称和词性检索
+     *
+     * @param indexLexiconVO
+     * @return
+     */
+    List<ConceptBaseDTO> indexByLexicon(IndexLexiconVO indexLexiconVO);
+
+
 }

+ 6 - 0
knowledgeman-service/src/main/java/com/diagbot/service/impl/ConceptServiceImpl.java

@@ -8,6 +8,7 @@ import com.diagbot.entity.Concept;
 import com.diagbot.entity.wrapper.ConceptWrapper;
 import com.diagbot.mapper.ConceptMapper;
 import com.diagbot.service.ConceptService;
+import com.diagbot.vo.IndexLexiconVO;
 import com.diagbot.vo.IndexVO;
 import org.springframework.stereotype.Service;
 
@@ -50,4 +51,9 @@ public class ConceptServiceImpl extends ServiceImpl<ConceptMapper, Concept> impl
     public List<ConceptBaseDTO> index(IndexVO indexVO) {
         return baseMapper.index(indexVO);
     }
+
+    @Override
+    public List<ConceptBaseDTO> indexByLexicon(IndexLexiconVO indexLexiconVO) {
+        return baseMapper.indexByLexicon(indexLexiconVO);
+    }
 }

+ 22 - 0
knowledgeman-service/src/main/java/com/diagbot/vo/IndexLexiconVO.java

@@ -0,0 +1,22 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @description:
+ * @author: zhoutg
+ * @date: 2019/5/10 10:47
+ */
+@Getter
+@Setter
+public class IndexLexiconVO {
+    @NotBlank(message = "名称不能为空")
+    private String name;
+    @NotNull(message = "词性类型不能为空")
+    private List<Integer> libType;
+}

+ 17 - 0
knowledgeman-service/src/main/java/com/diagbot/web/CommonConceptController.java

@@ -5,6 +5,7 @@ import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.ConceptFacade;
 import com.diagbot.vo.ConceptExistVO;
+import com.diagbot.vo.IndexLexiconVO;
 import com.diagbot.vo.IndexVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -64,4 +65,20 @@ public class CommonConceptController {
     public RespDTO<List<ConceptBaseDTO>> index(@RequestBody IndexVO indexVO){
         return RespDTO.onSuc(conceptFacade.indexFac(indexVO));
     }
+
+
+    /**
+     * 检索
+     *
+     * @param indexLexiconVO 搜索参数
+     * @return 名称和概念id
+     */
+    @ApiOperation(value = "知识库标准化-根据名称和术语库词性类型搜索[by:zhoutg]",
+            notes = "name: 搜索内容,必填<br>" +
+                    "libType:术语库词性类型,必填<br>")
+    @PostMapping("/indexByLexicon")
+    @SysLogger("indexByLexicon")
+    public RespDTO<List<ConceptBaseDTO>> indexByLexicon(@RequestBody IndexLexiconVO indexLexiconVO){
+        return RespDTO.onSuc(conceptFacade.indexByLexiconFac(indexLexiconVO));
+    }
 }

+ 15 - 1
knowledgeman-service/src/main/resources/mapper/ConceptMapper.xml

@@ -276,6 +276,20 @@
         and (a.name like concat('%',#{name},'%')
               or a.spell like concat('%',#{name},'%'))
     </select>
-    
+
+
+	<select id="indexByLexicon" resultType="com.diagbot.dto.ConceptBaseDTO">
+		SELECT b.id conceptId, b.lib_name name
+		FROM `kl_library_info` a, kl_concept b
+		where b.is_deleted = 'N' and a.is_deleted = 'N' and a.concept_id = b.id and a.is_concept = 1
+		<if test="libType != null and libType.size() > 0">
+			and b.lib_type in
+			<foreach collection="libType" item="item" open="(" close=")" separator=",">
+				#{item}
+			</foreach>
+		</if>
+		and (a.name like concat('%',#{name},'%')
+		or a.spell like concat('%',#{name},'%'))
+	</select>
     
 </mapper>