11.启动医院接口模拟系统
# 医院接口模拟系统
医院接口模拟系统,模拟外部医院管理系统控制台,该系统通过调用 【预约挂号系统】提供的对外API,上传相应的信息
具体的API功能有
- 上传科室接口
- 上传医院接口
- 上传排班接口
调用关系
具体说明参考 附录:医院接口模拟系统说明
具体代码访问
# 创建库与表
创建库 yygh_manage
医院设置表 hospital_set
包含医院上传的url信息以及秘钥
订单表 order_info
- 排班信息,就诊人信息,支付信息等
日程安排表 schedule
- 科室,医生安排信息等
# Host: localhost (Version 5.7.19-log)
# Date: 2020-07-31 14:28:31
# Generator: MySQL-Front 6.1 (Build 1.26)
CREATE DATABASE IF NOT EXISTS `yygh_manage` CHARACTER SET utf8mb4;
USE `yygh_manage`;
#
# Structure for table "hospital_set"
#
CREATE TABLE `hospital_set`
(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
`hoscode` varchar(30) DEFAULT NULL COMMENT '医院编号',
`sign_key` varchar(50) DEFAULT NULL COMMENT '签名秘钥',
`api_url` varchar(100) DEFAULT NULL COMMENT '统一挂号平台api地址',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`is_deleted` tinyint(3) NOT NULL DEFAULT '0' COMMENT '逻辑删除(1:已删除,0:未删除)',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 2
DEFAULT CHARSET = utf8 COMMENT ='医院设置表';
#
# Structure for table "order_info"
#
CREATE TABLE `order_info`
(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
`schedule_id` bigint(20) DEFAULT NULL COMMENT '排班id',
`patient_id` bigint(20) DEFAULT NULL COMMENT '就诊人id',
`number` int(11) DEFAULT NULL COMMENT '预约号序',
`fetch_time` varchar(50) DEFAULT NULL COMMENT '建议取号时间',
`fetch_address` varchar(255) DEFAULT NULL COMMENT '取号地点',
`amount` decimal(10, 0) DEFAULT NULL COMMENT '医事服务费',
`pay_time` datetime DEFAULT NULL COMMENT '支付时间',
`quit_time` datetime DEFAULT NULL COMMENT '退号时间',
`order_status` tinyint(3) DEFAULT NULL COMMENT '订单状态',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`is_deleted` tinyint(3) NOT NULL DEFAULT '0' COMMENT '逻辑删除(1:已删除,0:未删除)',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 11
DEFAULT CHARSET = utf8 COMMENT ='订单表';
#
# Structure for table "schedule"
#
CREATE TABLE `schedule`
(
`id` bigint(20) NOT NULL DEFAULT '0' COMMENT '编号',
`hoscode` varchar(30) DEFAULT NULL COMMENT '医院编号',
`depcode` varchar(30) DEFAULT NULL COMMENT '科室编号',
`title` varchar(20) DEFAULT NULL COMMENT '职称',
`docname` varchar(20) DEFAULT NULL COMMENT '医生名称',
`skill` text COMMENT '擅长技能',
`work_date` date DEFAULT NULL COMMENT '安排日期',
`work_time` tinyint(3) DEFAULT '0' COMMENT '安排时间(0:上午 1:下午)',
`reserved_number` int(11) DEFAULT '0' COMMENT '可预约数',
`available_number` int(11) DEFAULT '0' COMMENT '剩余预约数',
`amount` decimal(10, 0) DEFAULT NULL COMMENT '挂号费',
`status` tinyint(3) DEFAULT NULL COMMENT '排班状态(-1:停诊 0:停约 1:可约)',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`is_deleted` tinyint(3) NOT NULL DEFAULT '0' COMMENT '逻辑删除(1:已删除,0:未删除)',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8 COMMENT ='医生日程安排表';
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 修改系统配置
修改application-dev.yaml文件
- 修改redis和mysql的链接配置
server:
port: 9998
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations: classpath:mapper/*.xml
spring:
thymeleaf:
mode: LEGACYHTML5
#编码 可不用配置
encoding: UTF-8
#开发配置为false,避免修改模板还要重启服务器
cache: false
#配置模板路径,默认是templates,可以不用配置
prefix: classpath:/templates/
redis:
host: localhost
port: 6379
database: 0
timeout: 1800000
password:
lettuce:
pool:
max-active: 20 #最大连接数
max-wait: -1 #最大阻塞等待时间(负数表示没限制)
max-idle: 5 #最大空闲
min-idle: 0 #最小空闲
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/yygh_manage?characterEncoding=utf-8&useSSL=false
username: root
password: 123456
hikari:
connection-test-query: SELECT 1
connection-timeout: 60000
idle-timeout: 500000
max-lifetime: 540000
maximum-pool-size: 12
minimum-idle: 10
pool-name: GuliHikariPool
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
配置完成后启动查看是否成功
# 代码分析
ApiController 中 saveHospital 对信息上传发送给 在线预约平台
@RequestMapping(value="/hospital/save",method=RequestMethod.POST)
public String saveHospital(String data, HttpServletRequest request) {
try {
apiService.saveHospital(data);
} catch (YyghException e) {
return this.failurePage(e.getMessage(),request);
} catch (Exception e) {
return this.failurePage("数据异常",request);
}
return this.successPage(null,request);
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
在 ApiServiceImpl 中将数据通过http的方式上传到 预约挂号平台上
@Override
public boolean saveHospital(String data) {
JSONObject jsonObject = JSONObject.parseObject(data);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("hoscode",this.getHoscode());
paramMap.put("hosname",jsonObject.getString("hosname"));
paramMap.put("hostype",jsonObject.getString("hostype"));
paramMap.put("provinceCode",jsonObject.getString("provinceCode"));
paramMap.put("cityCode", jsonObject.getString("cityCode"));
paramMap.put("districtCode",jsonObject.getString("districtCode"));
paramMap.put("address",jsonObject.getString("address"));
paramMap.put("intro",jsonObject.getString("intro"));
paramMap.put("route",jsonObject.getString("route"));
//图片
paramMap.put("logoData", jsonObject.getString("logoData"));
JSONObject bookingRule = jsonObject.getJSONObject("bookingRule");
paramMap.put("bookingRule",bookingRule.toJSONString());
paramMap.put("timestamp", HttpRequestHelper.getTimestamp());
paramMap.put("sign", HttpRequestHelper.getSign(paramMap, this.getSignKey()));
JSONObject respone = HttpRequestHelper.sendRequest(paramMap,this.getApiUrl()+"/api/hosp/saveHospital");
System.out.println(respone.toJSONString());
if(null != respone && 200 == respone.getIntValue("code")) {
return true;
} else {
throw new YyghException(respone.getString("message"), 201);
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Last Updated: 2022/01/16, 11:29:51