作者:魔方16674 | 来源:互联网 | 2023-06-30 19:13
3.医院上传接口3.1上传,查询医院接口导入hospital-manage系统(已完成,直接复制),在mysql数据库中导入新建yygh_manage数据库,新建hospital_
3. 医院上传接口
3.1 上传, 查询医院接口
导入hospital-manage 系统(已完成,直接复制), 在mysql 数据库中导入新建yygh_manage数据库,
新建hospital_set, order_info, schedule表
#
# 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='医生日程安排表';
通过医院的系统 hospital-manage上传数据, 数据最终集中到平台和配置的数据库中来
- hospital-manage 读取输入的json文件, 以及@yygh_manage hospital_set中的hoscode, MD5加密的signKey,发送给服务器端service_hosp
- 和服务器端数据库中的表@yygh_hosp hospital_set对比后, hascode 和sign_key 字段一样, 将其缓存入mongodb数据库
传入的json数据:
{
"hoscode": "1000_0",
"hosname": "北京协和医院",
"hostype": "1",
"provinceCode": "110000",
"cityCode": "110100",
"districtCode": "110102",
"address": "大望路",
"intro": "北京协和医院是集医疗、教学、科研于一体的大型三级甲等综合医院,是国家卫生计生委...目标而继续努力。",
"route": "东院区乘车路线:106、...更多乘车路线详见须知。",
"logoData": "iVBORw0KGgoAAAA...NSUhEUg==",
"bookingRule": {
"cycle": "1",
"releaseTime": "08:30",
"stopTime": "11:30",
"quitDay": "-1",
"quitTime": "15:30",
"rule": [
"西院区预约号取号地点:西院区门诊楼一层大厅挂号窗口取号",
"东院区预约号取号地点:东院区老门诊楼一层大厅挂号窗口或新门诊楼各楼层挂号/收费窗口取号"
]
}
}
3.2 上传科室, 查询科室接口
private static final long serialVersiOnUID= 1L;
@ApiModelProperty(value = "医院编号")
@Indexed //普通索引
private String hoscode;
@ApiModelProperty(value = "科室编号")
@Indexed(unique = true) //唯一索引
private String depcode;
@ApiModelProperty(value = "科室名称")
private String depname;
@ApiModelProperty(value = "科室描述")
private String intro;
@ApiModelProperty(value = "大科室编号")
private String bigcode;
@ApiModelProperty(value = "大科室名称")
private String bigname;
{
"hoscode": "1000_0",
"depcode": "200050923",
"depname": "门诊部核酸检测门诊(东院)",
"intro": "门诊部核酸检测门诊(东院)",
"bigcode": "44f162029abb45f9ff0a5f743da0650d",
"bigname": "体检科"
}
public Page findPageDepartment(int page, int limit, DepartmentQueryVo departmentQueryVo) {
// 创建一个Pageable 对象, 设置当前页和每页记录数, 0 为第一页
Pageable pageable = PageRequest.of(page-1,limit);
// 创建Example对象
Department department = new Department();
BeanUtils.copyProperties(departmentQueryVo,department);
department.setIsDeleted(0);
// 构建匹配器
ExampleMatcher matcher = ExampleMatcher.matching() // 构建对象
.withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING) // 改变默认字符串匹配形式: 模糊查询
.withIgnoreCase(true); // 忽略大小写
Example example = Example.of(department,matcher);
Page all = departmentRepository.findAll(example, pageable);
return all;
}
3.3 上传排班接口
{
"hoscode": "1000_0",
"depcode": "200040878",
"title": "医师",
"docname": "",
"skill": "内分泌科常见病。",
"workDate": "2020-06-22",
"workTime": 0,
"reservedNumber": 33,
"availableNumber": 22,
"amount": "100",
"status": 1,
"hosScheduleId": "1"
}