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

View File

@ -6,7 +6,8 @@ spring:
druid:
# 主库数据源
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
password: 1qaz!@#$
# 从库数据源
@ -16,6 +17,13 @@ spring:
url:
username:
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
# 最小连接池数量
@ -54,4 +62,4 @@ spring:
merge-sql: true
wall:
config:
multi-statement-allow: true
multi-statement-allow: true

View File

@ -6,7 +6,10 @@ spring:
druid:
# 主库数据源
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
password: root
# 从库数据源
@ -54,4 +57,4 @@ spring:
merge-sql: true
wall:
config:
multi-statement-allow: true
multi-statement-allow: true

View File

@ -10,6 +10,7 @@ xinelu:
demoEnabled: true
# 文件路径 示例( Windows配置D:/postdischarge/uploadPathLinux配置 /home/postdischarge/uploadPath
profile: E:/postdischarge/uploadPath
# profile: E:/postdischarge/uploadPath/xf
# 签约知情书上传
sign-informed-file-url: /signInformed
# 素材库封面上传
@ -36,7 +37,7 @@ xinelu:
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 9090
port: 19090
servlet:
# 应用的访问路径
context-path: /
@ -109,7 +110,7 @@ token:
# 令牌有效期默认30分钟
expireTime: 30
# 请求拦截白名单
ant-matchers: /postDischarge/**,/testMobile/**,/postDischargeApplet/**,/api/**
ant-matchers: /postDischarge/**,/testMobile/**,/postDischargeApplet/**,/api/**,/manage/patientInfoimporttemp/**
## MyBatis-Plus配置
mybatis-plus:
@ -291,5 +292,6 @@ aiob:
accessKey: 9a61c68abf134ab9823e39f61f2c2f72
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);
}
@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")
@Primary
public DynamicDataSource dataSource(DataSource masterDataSource) {
Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
setDataSource(targetDataSources, DataSourceType.HKHIS.name(), "hkhisDataSource");
return new DynamicDataSource(masterDataSource, targetDataSources);
}

View File

@ -235,7 +235,7 @@ public class UploadRobotPublishTask {
actualTimeTaskDto.setRobotId(scriptInfo.getRobotPublishId());
actualTimeTaskDto.setMobile(patientInfo.getPatientPhone());
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());
// 处理变量