Kaynağa Gözat

医学术语映射

wangfeng 4 yıl önce
ebeveyn
işleme
b6cb47ce95

+ 4 - 1
config-server/src/main/resources/shared/ltkg-service-dev.yml

@@ -95,4 +95,7 @@ nlprel:
 
 qa:
   server:
-    address: http://192.168.3.150:9998
+    address: http://192.168.3.150:9998
+term:
+  server:
+    address: http://192.168.3.150:23232

+ 4 - 1
config-server/src/main/resources/shared/ltkg-service-local.yml

@@ -95,4 +95,7 @@ nlprel:
 
 qa:
   server:
-    address: http://192.168.3.150:9998
+    address: http://192.168.3.150:9998
+term:
+  server:
+    address: http://192.168.3.150:23232

+ 4 - 1
config-server/src/main/resources/shared/ltkg-service-pre.yml

@@ -95,4 +95,7 @@ nlprel:
 
 qa:
   server:
-    address: http://192.168.2.186:9998
+    address: http://192.168.2.186:9998
+term:
+  server:
+    address: http://192.168.2.186:23232

+ 4 - 1
config-server/src/main/resources/shared/ltkg-service-pro.yml

@@ -95,4 +95,7 @@ nlprel:
 
 qa:
   server:
-    address: http://192.168.2.123:9998
+    address: http://192.168.2.123:9998
+term:
+  server:
+    address: http://192.168.2.123:23232

+ 4 - 1
config-server/src/main/resources/shared/ltkg-service-test.yml

@@ -95,4 +95,7 @@ nlprel:
 
 qa:
   server:
-    address: http://192.168.2.234:9998
+    address: http://192.168.2.234:9998
+term:
+  server:
+    address: http://192.168.2.234:23232

+ 19 - 0
ltkg-service/src/main/java/com/diagbot/client/TermServiceClient.java

@@ -0,0 +1,19 @@
+package com.diagbot.client;
+
+import com.diagbot.client.hystrix.TermServiceHystrix;
+import com.diagbot.vo.TermVO;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020-07-13 13:54
+ */
+@FeignClient(name = "Term", url = "${term.server.address}", fallback = TermServiceHystrix.class)
+public interface TermServiceClient {
+
+    @PostMapping(value = "/api/similarity")
+    String similaritys(@RequestBody TermVO termVO);
+}

+ 21 - 0
ltkg-service/src/main/java/com/diagbot/client/hystrix/TermServiceHystrix.java

@@ -0,0 +1,21 @@
+package com.diagbot.client.hystrix;
+
+import com.diagbot.client.TermServiceClient;
+import com.diagbot.vo.TermVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020-07-13 14:13
+ */
+@Component
+@Slf4j
+public class TermServiceHystrix implements TermServiceClient {
+    @Override
+    public String similaritys(TermVO termVO) {
+        log.error("【hystrix】调用{}异常", "similaritys");
+        return null;
+    }
+}

+ 22 - 0
ltkg-service/src/main/java/com/diagbot/facade/TermFacade.java

@@ -0,0 +1,22 @@
+package com.diagbot.facade;
+
+import com.diagbot.client.TermServiceClient;
+import com.diagbot.vo.TermVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020-07-10 15:09
+ */
+@Component
+public class TermFacade {
+    @Autowired
+    TermServiceClient termServiceClient;
+
+    public String getTerms(TermVO termVO) {
+        return termServiceClient.similaritys(termVO);
+    }
+}
+

+ 17 - 0
ltkg-service/src/main/java/com/diagbot/vo/TermVO.java

@@ -0,0 +1,17 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020-07-10 15:10
+ */
+@Setter
+@Getter
+public class TermVO {
+    private String word_type;
+    private String word;
+    private Integer number;
+}

+ 34 - 0
ltkg-service/src/main/java/com/diagbot/web/TermController.java

@@ -0,0 +1,34 @@
+package com.diagbot.web;
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.TermFacade;
+import com.diagbot.vo.TermVO;
+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;
+
+/**
+ * @author wangfeng
+ * @Description:
+ * @date 2020-07-10 15:07
+ */
+@RestController
+@RequestMapping("/term")
+@Api(value = "医学术语映射相关API", tags = { "医学术语映射相关API" })
+@SuppressWarnings("unchecked")
+public class TermController {
+    @Autowired
+    private TermFacade termFacade;
+
+    @ApiOperation(value = "医学术语映射[zhaops]", notes = "")
+    @PostMapping("/getTerm")
+    @SysLogger("getTerm")
+    public RespDTO<String> getTerm(@RequestBody TermVO termVO) {
+        return RespDTO.onSuc(termFacade.getTerms(termVO));
+    }
+}