Browse Source

Merge branch 'develop' into dev/20200702_1.3.7

gaodm 4 years ago
parent
commit
895a10d29d

+ 18 - 0
doc/014.20200708v1.3.6.5/qc_initv1.3.6.5.sql

@@ -0,0 +1,18 @@
+use `qc`;
+
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', '评分接口地址(本地)', 'active_profiles_local', 'http://192.168.2.232:6007', '评分接口地址(本地)-长兴');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '2', '评分接口地址(本地)', 'active_profiles_local', 'http://192.168.2.232:6008', '评分接口地址(本地)-邵逸夫');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '3', '评分接口地址(本地)', 'active_profiles_local', 'http://192.168.2.232:6009', '评分接口地址(本地)-台州');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', '评分接口地址(开发)', 'active_profiles_dev', 'http://192.168.2.232:6007', '评分接口地址(开发)-长兴');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '2', '评分接口地址(开发)', 'active_profiles_dev', 'http://192.168.2.232:6008', '评分接口地址(开发)-邵逸夫');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '3', '评分接口地址(开发)', 'active_profiles_dev', 'http://192.168.2.232:6009', '评分接口地址(开发)-台州');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', '评分接口地址(测试)', 'active_profiles_test', 'http://192.168.2.241:6007', '评分接口地址(测试)-长兴');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '2', '评分接口地址(测试)', 'active_profiles_test', 'http://192.168.2.241:6008', '评分接口地址(测试)-邵逸夫');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '3', '评分接口地址(测试)', 'active_profiles_test', 'http://192.168.2.241:6009', '评分接口地址(测试)-台州');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', '评分接口地址(医学)', 'active_profiles_pre', 'http://192.168.2.186:6007', '评分接口地址(医学)-长兴');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '2', '评分接口地址(医学)', 'active_profiles_pre', 'http://192.168.2.186:6008', '评分接口地址(医学)-邵逸夫');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '3', '评分接口地址(医学)', 'active_profiles_pre', 'http://192.168.2.186:6009', '评分接口地址(医学)-台州');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '1', '评分接口地址(参考)', 'active_profiles_pro', 'http://192.168.2.123:6007', '评分接口地址(参考)-长兴');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '2', '评分接口地址(参考)', 'active_profiles_pro', 'http://192.168.2.123:6008', '评分接口地址(参考)-邵逸夫');
+INSERT INTO `qc`.`sys_hospital_set` (`is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `name`, `code`, `value`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '3', '评分接口地址(参考)', 'active_profiles_pro', 'http://192.168.2.123:6009', '评分接口地址(参考)-台州');
+

+ 4 - 2
src/main/java/com/diagbot/client/QcServiceClient.java

@@ -7,17 +7,19 @@ import com.diagbot.vo.QueryVo;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 
 
+import java.net.URI;
+
 
 
 /**
 /**
  * @description: 病历质控远程调用
  * @description: 病历质控远程调用
  * @author: zhoutg
  * @author: zhoutg
  * @date: 2020/4/13 18:28
  * @date: 2020/4/13 18:28
  */
  */
-@FeignClient(name = "qc", url = "${qc.address}",fallback = QcServiceHystrix.class)
+@FeignClient(name = "qc", url = "url-placehokder", fallback = QcServiceHystrix.class)
 public interface QcServiceClient {
 public interface QcServiceClient {
 
 
     @PostMapping(value = "/analyse/rec")
     @PostMapping(value = "/analyse/rec")
-    Response<OutputInfo> extract(QueryVo queryVo);
+    Response<OutputInfo> extract(URI uri, QueryVo queryVo);
 
 
 }
 }
 
 

+ 3 - 1
src/main/java/com/diagbot/client/hystrix/QcServiceHystrix.java

@@ -8,6 +8,8 @@ import com.diagbot.vo.QueryVo;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
+import java.net.URI;
+
 /**
 /**
  * @description: 病历质控远程调用熔断器
  * @description: 病历质控远程调用熔断器
  * @author: zhoutg
  * @author: zhoutg
@@ -18,7 +20,7 @@ import org.springframework.stereotype.Component;
 public class QcServiceHystrix implements QcServiceClient {
 public class QcServiceHystrix implements QcServiceClient {
 
 
     @Override
     @Override
-    public Response<OutputInfo> extract(QueryVo queryVo) {
+    public Response<OutputInfo> extract(URI uri, QueryVo queryVo) {
         log.error("【hystrix】调用{}异常", "extract");
         log.error("【hystrix】调用{}异常", "extract");
         return null;
         return null;
     }
     }

+ 2 - 2
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.client.AuthServiceClient;
 import com.diagbot.client.AuthServiceClient;
-import com.diagbot.client.QcServiceClient;
 import com.diagbot.dto.AlgorithmDTO;
 import com.diagbot.dto.AlgorithmDTO;
 import com.diagbot.dto.AnalyzeDTO;
 import com.diagbot.dto.AnalyzeDTO;
 import com.diagbot.dto.AnalyzeRunDTO;
 import com.diagbot.dto.AnalyzeRunDTO;
@@ -84,7 +83,7 @@ import java.util.stream.Collectors;
 public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
 public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
 
 
     @Autowired
     @Autowired
-    QcServiceClient qcServiceClient;
+    QcClientFacade qcServiceClient;
     @Autowired
     @Autowired
     DoctorAdviceFacade doctorAdviceFacade;
     DoctorAdviceFacade doctorAdviceFacade;
     @Autowired
     @Autowired
@@ -262,6 +261,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("hospital_id", hospitalId)
                 .eq("hospital_id", hospitalId)
                 .eq("behospital_code", analyzeVO.getBehospitalCode())
                 .eq("behospital_code", analyzeVO.getBehospitalCode())
+                .orderByAsc("da_start_date")
         );
         );
 
 
         // 危急值
         // 危急值

+ 44 - 0
src/main/java/com/diagbot/facade/QcClientFacade.java

@@ -0,0 +1,44 @@
+package com.diagbot.facade;
+
+import com.diagbot.client.QcServiceClient;
+import com.diagbot.dto.OutputInfo;
+import com.diagbot.dto.Response;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
+import com.diagbot.util.SpringContextUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.QueryVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.net.URI;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/7/8 11:33
+ */
+@Component
+public class QcClientFacade {
+
+    @Autowired
+    private QcServiceClient qcServiceClient;
+    @Autowired
+    private SysHospitalSetFacade sysHospitalSetFacade;
+
+    public Response<OutputInfo> extract(QueryVo queryVo) {
+        URI uri = null;
+        String code = "active_profiles_" + SpringContextUtil.getActiveProfile();
+        String url = sysHospitalSetFacade.getValue(Long.valueOf(queryVo.getHospitalId()), code);
+        if (StringUtil.isBlank(url)) {
+            throw new CommonException(CommonErrorCode.NOT_EXISTS, "配置表内找不到评分接口地址数据!");
+        }
+        try {
+            uri = new URI(url);
+        } catch (Exception e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR);
+        }
+
+        return qcServiceClient.extract(uri, queryVo);
+    }
+}

+ 16 - 0
src/main/java/com/diagbot/facade/SysHospitalSetFacade.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.entity.SysHospitalSet;
 import com.diagbot.entity.SysHospitalSet;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.service.impl.SysHospitalSetServiceImpl;
 import com.diagbot.service.impl.SysHospitalSetServiceImpl;
+import com.diagbot.util.StringUtil;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 /**
 /**
@@ -28,4 +29,19 @@ public class SysHospitalSetFacade extends SysHospitalSetServiceImpl {
         }
         }
         return res;
         return res;
     }
     }
+
+    public String getValue(Long hospitalId, String code) {
+        String res = "";
+        SysHospitalSet sysHospitalSet
+                = this.getOne(new QueryWrapper<SysHospitalSet>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq("hospital_id", hospitalId)
+                        .eq("code", code)
+                , false);
+        if (null != sysHospitalSet
+                && StringUtil.isNotBlank(sysHospitalSet.getValue())) {
+            res = sysHospitalSet.getValue();
+        }
+        return res;
+    }
 }
 }

+ 47 - 0
src/main/java/com/diagbot/util/SpringContextUtil.java

@@ -0,0 +1,47 @@
+package com.diagbot.util;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+import java.util.Locale;
+
+/**
+ * @Description:
+ * @author: gaodm
+ * @time: 2020/7/8 11:45
+ */
+@Component
+public class SpringContextUtil implements ApplicationContextAware {
+
+    private static ApplicationContext context = null;
+
+    /* (non Javadoc)
+     * @Title: setApplicationContext
+     * @Description: spring获取bean工具类
+     * @param applicationContext
+     * @throws BeansException
+     * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
+     */
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext)
+            throws BeansException {
+        this.context = applicationContext;
+    }
+
+    // 传入线程中
+    public static <T> T getBean(String beanName) {
+        return (T) context.getBean(beanName);
+    }
+
+    // 国际化使用
+    public static String getMessage(String key) {
+        return context.getMessage(key, null, Locale.getDefault());
+    }
+
+    /// 获取当前环境
+    public static String getActiveProfile() {
+        return context.getEnvironment().getActiveProfiles()[0];
+    }
+}

+ 0 - 1
src/main/resources/application-dev.yml

@@ -161,7 +161,6 @@ io.github.lvyahui8.spring:
 
 
 myhost: localhost
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 oath.self.address: http://${myhost}:${server.port}
-qc.address: http://192.168.2.232:6009
 
 
 # 加解密开关
 # 加解密开关
 encrypt:
 encrypt:

+ 0 - 1
src/main/resources/application-local.yml

@@ -161,7 +161,6 @@ io.github.lvyahui8.spring:
 
 
 myhost: localhost
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 oath.self.address: http://${myhost}:${server.port}
-qc.address: http://192.168.2.232:6009
 
 
 # 加解密开关
 # 加解密开关
 encrypt:
 encrypt:

+ 0 - 1
src/main/resources/application-pre.yml

@@ -161,7 +161,6 @@ io.github.lvyahui8.spring:
 
 
 myhost: localhost
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 oath.self.address: http://${myhost}:${server.port}
-qc.address: http://192.168.2.186:6009
 
 
 # 加解密开关
 # 加解密开关
 encrypt:
 encrypt:

+ 0 - 1
src/main/resources/application-pro.yml

@@ -161,7 +161,6 @@ io.github.lvyahui8.spring:
 
 
 myhost: localhost
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 oath.self.address: http://${myhost}:${server.port}
-qc.address: http://192.168.2.123:6009
 
 
 # 加解密开关
 # 加解密开关
 encrypt:
 encrypt:

+ 0 - 1
src/main/resources/application-test.yml

@@ -161,7 +161,6 @@ io.github.lvyahui8.spring:
 
 
 myhost: localhost
 myhost: localhost
 oath.self.address: http://${myhost}:${server.port}
 oath.self.address: http://${myhost}:${server.port}
-qc.address: http://192.168.2.241:6009
 
 
 # 加解密开关
 # 加解密开关
 encrypt:
 encrypt: