liuqq пре 3 година
родитељ
комит
3ca6d6c72c

+ 7 - 0
pom.xml

@@ -212,6 +212,13 @@
             <version>${easypoi.version}</version>
         </dependency>
 
+        <!--多数据源-->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
+            <version>3.3.1</version>
+        </dependency>
+
         <dependency>
             <groupId>com.oracle</groupId>
             <artifactId>ojdbc6</artifactId>

+ 2 - 1
src/main/java/com/diagbot/MrqcSysApplication.java

@@ -1,5 +1,6 @@
 package com.diagbot;
 
+import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@@ -19,7 +20,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
  * @time: 2018/8/7 9:26
  */
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,
-        JmxAutoConfiguration.class, ThymeleafAutoConfiguration.class })
+        JmxAutoConfiguration.class, ThymeleafAutoConfiguration.class , DruidDataSourceAutoConfigure.class})
 @EnableFeignClients({ "com.diagbot.client" })
 @EnableHystrixDashboard
 @EnableHystrix

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

@@ -292,6 +292,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/qc/appealInfo/getAppealMode").permitAll()
                 .antMatchers("/qc/appealInfo/getUserRole").permitAll()
                 .antMatchers("/qc/mode/getModes").permitAll()
+                .antMatchers("/qcView/data/*").permitAll()
                 .antMatchers("/**").authenticated();
         //                .antMatchers("/**").permitAll();
     }

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

@@ -369,6 +369,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/qc/appealInfo/getAppealMode", request)
                 || matchers("/qc/appealInfo/getUserRole", request)
                 || matchers("/qc/mode/getModes", request)
+                || matchers("/qcView/data/*", request)
                 || matchers("/", request)) {
             return true;
         }

+ 19 - 0
src/main/java/com/diagbot/dto/his/DoctorHosDTO.java

@@ -0,0 +1,19 @@
+package com.diagbot.dto.his;
+
+import lombok.Data;
+
+@Data
+public class DoctorHosDTO {
+
+    private String userId;
+
+    private String deptCode;
+
+    private String name;
+
+    private String title;
+
+    private String deptName;
+
+    private String job;
+}

+ 103 - 0
src/main/java/com/diagbot/entity/his/DoctorHos.java

@@ -0,0 +1,103 @@
+package com.diagbot.entity.his;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2022-04-20
+ */
+@TableName("DOCTOR_HOS")
+public class DoctorHos implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableField("USER_ID")
+    private String userId;
+
+    @TableField("DEPT_CODE")
+    private String deptCode;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("TITLE")
+    private String title;
+
+    @TableField("CERTIFICATE")
+    private String certificate;
+
+    @TableField("DEPT_NAME")
+    private String deptName;
+
+    @TableField("JOB")
+    private String job;
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+    public String getDeptCode() {
+        return deptCode;
+    }
+
+    public void setDeptCode(String deptCode) {
+        this.deptCode = deptCode;
+    }
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+    public String getCertificate() {
+        return certificate;
+    }
+
+    public void setCertificate(String certificate) {
+        this.certificate = certificate;
+    }
+    public String getDeptName() {
+        return deptName;
+    }
+
+    public void setDeptName(String deptName) {
+        this.deptName = deptName;
+    }
+    public String getJob() {
+        return job;
+    }
+
+    public void setJob(String job) {
+        this.job = job;
+    }
+
+    @Override
+    public String toString() {
+        return "DoctorHos{" +
+            "userId=" + userId +
+            ", deptCode=" + deptCode +
+            ", name=" + name +
+            ", title=" + title +
+            ", certificate=" + certificate +
+            ", deptName=" + deptName +
+            ", job=" + job +
+        "}";
+    }
+}

+ 37 - 0
src/main/java/com/diagbot/facade/his/DoctorHosFacade.java

@@ -0,0 +1,37 @@
+package com.diagbot.facade.his;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.his.DoctorHosDTO;
+import com.diagbot.entity.his.DoctorHos;
+import com.diagbot.service.impl.his.DoctorHosServiceImpl;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.StringUtil;
+import com.diagbot.vo.his.DoctorHosVO;
+import com.google.common.collect.Lists;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public class DoctorHosFacade extends DoctorHosServiceImpl {
+
+    public List<DoctorHosDTO> getDoctorInfo(DoctorHosVO doctorHosVO){
+        List<DoctorHosDTO> dto= Lists.newArrayList();
+        try{
+            QueryWrapper<DoctorHos> query = new QueryWrapper<>();
+            query.notIn("JOB","护士");
+            if(StringUtil.isNotEmpty(doctorHosVO.getKeyString())){
+                query.like("USER_ID",doctorHosVO.getKeyString().toUpperCase()).or()
+                        .like("NAME",doctorHosVO.getKeyString()).or()
+                        .like("DEPT_CODE",doctorHosVO.getKeyString()).or()
+                        .like("DEPT_NAME",doctorHosVO.getKeyString());
+            }
+            List<DoctorHos> list=this.baseMapper.selectList(query);
+            dto=BeanUtil.listCopyTo(list,DoctorHosDTO.class);
+        }catch (Exception e){
+            log.error("获取医生信息异常"+e.getMessage(),new Throwable());
+        }
+        return dto;
+    }
+}

+ 16 - 0
src/main/java/com/diagbot/mapper/his/DoctorHosMapper.java

@@ -0,0 +1,16 @@
+package com.diagbot.mapper.his;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.diagbot.entity.his.DoctorHos;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2022-04-20
+ */
+public interface DoctorHosMapper extends BaseMapper<DoctorHos> {
+
+}

+ 16 - 0
src/main/java/com/diagbot/service/his/DoctorHosService.java

@@ -0,0 +1,16 @@
+package com.diagbot.service.his;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.his.DoctorHos;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2022-04-20
+ */
+public interface DoctorHosService extends IService<DoctorHos> {
+
+}

+ 22 - 0
src/main/java/com/diagbot/service/impl/his/DoctorHosServiceImpl.java

@@ -0,0 +1,22 @@
+package com.diagbot.service.impl.his;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.entity.his.DoctorHos;
+import com.diagbot.mapper.his.DoctorHosMapper;
+import com.diagbot.service.his.DoctorHosService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2022-04-20
+ */
+@Service
+@DS("slave")
+public class DoctorHosServiceImpl extends ServiceImpl<DoctorHosMapper, DoctorHos> implements DoctorHosService {
+
+}

+ 15 - 0
src/main/java/com/diagbot/vo/his/DoctorHosVO.java

@@ -0,0 +1,15 @@
+package com.diagbot.vo.his;
+
+import lombok.Data;
+
+@Data
+public class DoctorHosVO {
+    private String keyString;
+    /*
+    private String userId;
+
+    private String deptCode;
+
+    private String name;*/
+
+}

+ 42 - 0
src/main/java/com/diagbot/web/DataViewController.java

@@ -0,0 +1,42 @@
+package com.diagbot.web;
+
+
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.dto.his.DoctorHosDTO;
+import com.diagbot.facade.his.DoctorHosFacade;
+import com.diagbot.vo.his.DoctorHosVO;
+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;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author zhanghang
+ * @since 2022-04-20
+ */
+@RestController
+@RequestMapping("/qcView/data")
+@Api(value = "HIS视图接口API", tags = { "HIS视图接口API" })
+public class DataViewController {
+
+    @Autowired
+    private DoctorHosFacade doctorHosFacade;
+
+    @ApiOperation(value = "获取HIS医生信息")
+    @PostMapping("/getDoctorHos")
+    @SysLogger("getDoctorHos")
+    public RespDTO<List<DoctorHosDTO>> getDoctorInfo(@RequestBody DoctorHosVO doctorHosVO){
+        return RespDTO.onSuc(doctorHosFacade.getDoctorInfo(doctorHosVO));
+    }
+
+}

+ 209 - 0
src/main/resources/application-his.yml

@@ -0,0 +1,209 @@
+server:
+  port: 5858
+  max-http-header-size: 10MB
+  tomcat:
+    uri-encoding: utf-8
+
+hystrix:
+  threadpool:
+    default:
+      coreSize: 200 #并发执行的最大线程数,默认10
+      maxQueueSize: 200 #BlockingQueue的最大队列数
+      queueSizeRejectionThreshold: 50 #即使maxQueueSize没有达到,达到queueSizeRejectionThreshold该值后,请求也会被拒绝
+  command:
+    QcServiceClient#extract(QueryVo).execution.isolation.thread.timeoutInMilliseconds: 3600000
+    default:
+      execution:
+        timeout:
+          enabled: true
+        isolation:
+          strategy: SEMAPHORE
+          semaphore:
+            maxConcurrentRequests: 2000
+          thread:
+            timeoutInMilliseconds: 20000
+
+ribbon:
+  ReadTimeout: 20000
+  ConnectTimeout: 20000
+  MaxAutoRetries: 0
+  MaxAutoRetriesNextServer: 1
+
+feign:
+  hystrix:
+    enabled: true
+  #开启Feign请求压缩
+  compression:
+    response:
+      enabled: true
+  httpclient:
+    enabled: false
+  okhttp:
+    enabled: true
+    max-connections: 1000 # 默认值
+    max-connections-per-route: 250 # 默认值
+
+management:
+  endpoints:
+    web:
+      exposure:
+        include: bus-refresh,health,info,hystrix.stream
+      cors:
+        allowed-origins: "*"
+        allowed-methods: "*"
+  endpoint:
+    health:
+      show-details: always
+
+# 驱动配置信息
+spring:
+  application:
+    name: gateway-service
+  datasource:
+    dynamic:
+      primary: master
+      druid:
+        # 连接池的配置信息
+        # 初始化大小,最小,最大
+        initialSize: 5
+        minIdle: 5
+        maxActive: 20
+        # 配置获取连接等待超时的时间
+        maxWait: 60000
+        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+        timeBetweenEvictionRunsMillis: 60000
+        # 配置一个连接在池中最小生存的时间,单位是毫秒
+        minEvictableIdleTimeMillis: 300000
+        validationQuery: SELECT 1 FROM DUAL
+        testWhileIdle: true
+        testOnBorrow: false
+        testOnReturn: false
+        # 打开PSCache,并且指定每个连接上PSCache的大小
+        poolPreparedStatements: true
+        maxPoolPreparedStatementPerConnectionSize: 20
+        # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
+        filters.commons-log.connection-logger-name: wall,log4j
+        filter:
+          stat:
+            enabled: true
+            mergeSql: true
+            log-slow-sql: true
+            slow-sql-millis: 2000
+        #监控配置
+        web-stat-filter:
+          enabled: true
+          url-pattern: /*
+          exclusions: '*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*'
+
+        # StatViewServlet配置,说明请参考Druid Wiki,配置_StatViewServlet配置
+        stat-view-servlet:
+          enabled: true
+          url-pattern: /druid/*
+          reset-enable: false
+          login-username: root
+          login-password: root
+      datasource:
+        master:
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          platform: mysql
+          url: jdbc:mysql://192.168.2.126:3307/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
+          username: root
+          password: Lat0ne@tesT
+          druid:
+            initial-size: 5
+        slave:
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          platform: mysql
+          url: jdbc:mysql://192.168.2.126:3307/xy_st?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
+          username: root
+          password: Lat0ne@tesT
+          druid:
+            initial-size: 5
+  jackson:
+    date-format: yyyy-MM-dd HH:mm:ss
+    time-zone: GMT+8
+
+  #redis
+  redis:
+    database:
+      cache: 8 # cache索引
+      token: 8 # Token索引
+    host: 192.168.2.237  #Redis服务器地址
+    port: 63791 # Redis服务器连接端口(本地环境端口6378,其他环境端口是6379)
+    password: emrais # Redis服务器连接密码(默认为空)
+    lettuce:
+      pool:
+        max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
+        max-idle: 5 # 连接池中的最大空闲连接
+        max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
+        min-idle: 0 # 连接池中的最小空闲连接
+    timeout: 20000 # 连接超时时间(毫秒)
+
+  servlet:
+    multipart:
+      max-request-size: 2048MB
+  http:
+    encoding:
+      charset: utf-8
+      force: true
+      enabled: true
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:/mapper/*Mapper.xml,classpath:/mapper/his/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.diagbot.entity
+  global-config:
+    #刷新mapper 调试神器
+    db-config:
+      #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+      id-type: id_worker
+      #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+      field-strategy: not_empty
+      #驼峰下划线转换
+      column-underline: true
+      #数据库大写下划线转换
+      #capital-mode: true
+      #刷新mapper 调试神器
+      refresh-mapper: true
+      #逻辑删除配置
+      logic-delete-value: 0
+      logic-not-delete-value: 1
+      #自定义填充策略接口实现
+      #meta-object-handler: com.baomidou.springboot.xxx
+      #自定义SQL注入器
+      #sql-injector: com.baomidou.springboot.xxx
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+
+io.github.lvyahui8.spring:
+  base-packages: com.diagbot.aggregate
+  thread-number: 12
+
+myhost: localhost
+oath.self.address: http://${myhost}:${server.port}
+
+# 加解密开关
+encrypt:
+  enable: false
+
+swagger:
+  enable: true
+
+#xml解析成结构化开关
+xml_analyse:
+  enable: false
+
+#函数初始化modeId开关
+initmodeid:
+  enable: false
+
+#对接过程中是否记录正常流程的日志
+log_switch:
+  enable: false
+
+mrqcLog:
+  enable: false
+
+appeal.address: http://132.147.253.31:8871

+ 12 - 0
src/main/resources/logback-spring.xml

@@ -303,4 +303,16 @@
             <appender-ref ref="LOGSTASHPRO"/>
         </root>
     </springProfile>
+
+    <!-- 生产环境下的日志配置 -->
+    <springProfile name="his">
+        <root level="INFO">
+            <appender-ref ref="ERROR"/>
+            <appender-ref ref="WARN"/>
+            <appender-ref ref="INFO"/>
+            <appender-ref ref="DEBUG"/>
+            <appender-ref ref="STDOUT"/>
+            <appender-ref ref="LOGSTASHPRO"/>
+        </root>
+    </springProfile>
 </configuration>

+ 16 - 0
src/main/resources/mapper/his/DoctorHosMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.diagbot.mapper.his.DoctorHosMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.diagbot.entity.his.DoctorHos">
+        <result column="USER_ID" property="userId" />
+        <result column="DEPT_CODE" property="deptCode" />
+        <result column="NAME" property="name" />
+        <result column="TITLE" property="title" />
+        <result column="CERTIFICATE" property="certificate" />
+        <result column="DEPT_NAME" property="deptName" />
+        <result column="JOB" property="job" />
+    </resultMap>
+
+</mapper>

+ 4 - 4
src/test/java/com/diagbot/CodeGeneration.java

@@ -27,7 +27,7 @@ public class CodeGeneration {
 
         // 全局配置
         GlobalConfig gc = new GlobalConfig();
-        gc.setOutputDir("D://code");
+        gc.setOutputDir("C://code");
         gc.setFileOverride(true);
         gc.setActiveRecord(false);// 不需要ActiveRecord特性的请改为false
         gc.setEnableCache(false);// XML 二级缓存
@@ -48,15 +48,15 @@ public class CodeGeneration {
         dsc.setDbType(DbType.MYSQL);
         dsc.setDriverName("com.mysql.cj.jdbc.Driver");
         dsc.setUsername("root");
-        dsc.setPassword("lantone");
-        dsc.setUrl("jdbc:mysql://192.168.2.236:3306/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8");
+        dsc.setPassword("Lat0ne@tesT");
+        dsc.setUrl("jdbc:mysql://192.168.2.126:3307/xy_st?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8");
         mpg.setDataSource(dsc);
 
         // 策略配置
         StrategyConfig strategy = new StrategyConfig();
 //        strategy.setTablePrefix(new String[] { "med_" });// 此处可以修改为您的表前缀
         strategy.setNaming(NamingStrategy.underline_to_camel);// 表名生成策略
-        strategy.setInclude(new String[] { "med_check_info"}); // 需要生成的表
+        strategy.setInclude(new String[] { "DOCTOR_HOS"}); // 需要生成的表
 
         strategy.setSuperServiceClass(null);
         strategy.setSuperServiceImplClass(null);