多数据源支持HKHIS

This commit is contained in:
zhuangyuanke 2024-11-29 09:13:31 +08:00
parent f9d2a978bf
commit 9b88db6b31
7 changed files with 50 additions and 16 deletions

View File

@ -44,6 +44,12 @@
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
</dependency> </dependency>
<!-- 添加 PostgreSQL 数据库驱动的依赖 -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.5.0</version> <!-- 使用当前最新稳定版本 -->
</dependency>
<!-- 核心模块--> <!-- 核心模块-->
<dependency> <dependency>
<groupId>com.xinelu</groupId> <groupId>com.xinelu</groupId>
@ -88,17 +94,17 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version> <version>3.1.0</version>
<configuration> <configuration>
<failOnMissingWebXml>false</failOnMissingWebXml> <failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName> <warName>${project.artifactId}</warName>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
</build> </build>
</project> </project>

View File

@ -6,7 +6,8 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://192.168.16.64:3306/post-discharge?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true # url: jdbc:mysql://192.168.16.64:3306/post-discharge?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
url: jdbc:mysql://182.92.166.109:8000/post-discharge?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
username: root username: root
password: 1qaz!@#$ password: 1qaz!@#$
# 从库数据源 # 从库数据源
@ -16,6 +17,13 @@ spring:
url: url:
username: username:
password: password:
hkhis:
# 从数据源开关/默认关闭
enabled: true
url: jdbc:mysql://127.0.0.1:3306/post-discharge?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
username: root
password: sa123456
driverClassName: com.mysql.cj.jdbc.Driver
# 初始连接数 # 初始连接数
initialSize: 5 initialSize: 5
# 最小连接池数量 # 最小连接池数量
@ -54,4 +62,4 @@ spring:
merge-sql: true merge-sql: true
wall: wall:
config: config:
multi-statement-allow: true multi-statement-allow: true

View File

@ -6,7 +6,10 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://localhost:3306/post-discharge?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:mysql://localhost:3306/post-discharge?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://192.168.16.64:3306/post-discharge?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
username: root username: root
password: root password: root
# 从库数据源 # 从库数据源
@ -54,4 +57,4 @@ spring:
merge-sql: true merge-sql: true
wall: wall:
config: config:
multi-statement-allow: true multi-statement-allow: true

View File

@ -10,6 +10,7 @@ xinelu:
demoEnabled: true demoEnabled: true
# 文件路径 示例( Windows配置D:/postdischarge/uploadPathLinux配置 /home/postdischarge/uploadPath # 文件路径 示例( Windows配置D:/postdischarge/uploadPathLinux配置 /home/postdischarge/uploadPath
profile: E:/postdischarge/uploadPath profile: E:/postdischarge/uploadPath
# profile: E:/postdischarge/uploadPath/xf
# 签约知情书上传 # 签约知情书上传
sign-informed-file-url: /signInformed sign-informed-file-url: /signInformed
# 素材库封面上传 # 素材库封面上传
@ -36,7 +37,7 @@ xinelu:
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口默认为8080 # 服务器的HTTP端口默认为8080
port: 9090 port: 19090
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
@ -109,7 +110,7 @@ token:
# 令牌有效期默认30分钟 # 令牌有效期默认30分钟
expireTime: 30 expireTime: 30
# 请求拦截白名单 # 请求拦截白名单
ant-matchers: /postDischarge/**,/testMobile/**,/postDischargeApplet/**,/api/** ant-matchers: /postDischarge/**,/testMobile/**,/postDischargeApplet/**,/api/**,/manage/patientInfoimporttemp/**
## MyBatis-Plus配置 ## MyBatis-Plus配置
mybatis-plus: mybatis-plus:
@ -291,5 +292,6 @@ aiob:
accessKey: 9a61c68abf134ab9823e39f61f2c2f72 accessKey: 9a61c68abf134ab9823e39f61f2c2f72
secretKey: 4287bfa1d5a34c229aacb5e056c94682 secretKey: 4287bfa1d5a34c229aacb5e056c94682
# 任务执行回调地址--测试 # 任务执行回调地址--测试
callBackUrl: http://8.131.93.145:54011/api/taskCallBack callBackUrl: http://182.92.166.109:9707/api/taskCallBack
# callBackUrl: http://8.131.93.145:54011/api/taskCallBack

View File

@ -14,5 +14,10 @@ public enum DataSourceType {
/** /**
* 从库 * 从库
*/ */
SLAVE SLAVE,
/**
* 从库_河口HIS
*/
HKHIS
} }

View File

@ -43,12 +43,22 @@ public class DruidConfig {
return druidProperties.dataSource(dataSource); return druidProperties.dataSource(dataSource);
} }
@Bean
@ConfigurationProperties("spring.datasource.druid.hkhis")
@ConditionalOnProperty(prefix = "spring.datasource.druid.hkhis", name = "enabled", havingValue = "true")
public DataSource hkhisDataSource(DruidProperties druidProperties) {
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
}
@Bean(name = "dynamicDataSource") @Bean(name = "dynamicDataSource")
@Primary @Primary
public DynamicDataSource dataSource(DataSource masterDataSource) { public DynamicDataSource dataSource(DataSource masterDataSource) {
Map<Object, Object> targetDataSources = new HashMap<>(); Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource); targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource"); setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
setDataSource(targetDataSources, DataSourceType.HKHIS.name(), "hkhisDataSource");
return new DynamicDataSource(masterDataSource, targetDataSources); return new DynamicDataSource(masterDataSource, targetDataSources);
} }

View File

@ -235,7 +235,7 @@ public class UploadRobotPublishTask {
actualTimeTaskDto.setRobotId(scriptInfo.getRobotPublishId()); actualTimeTaskDto.setRobotId(scriptInfo.getRobotPublishId());
actualTimeTaskDto.setMobile(patientInfo.getPatientPhone()); actualTimeTaskDto.setMobile(patientInfo.getPatientPhone());
actualTimeTaskDto.setSecretType(2); actualTimeTaskDto.setSecretType(2);
actualTimeTaskDto.setStopDate(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " 17:00:00"); actualTimeTaskDto.setStopDate(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " 20:00:00");
// 查询患者画像信息 // 查询患者画像信息
List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(patientInfo.getId()); List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(patientInfo.getId());
// 处理变量 // 处理变量