开发医院、科室、排班接口

  • 一、医院接口
    • 查询医院接口
  • 二、科室接口
    • (1)上传科室功能
    • (2)查询科室功能
    • (3)删除科室功能
  • 三、排班接口
    • (1)上传排班功能
    • (2)查询排班功能
    • (3)删除排班功能

一、医院接口

本文继续开发分布式医疗挂号系统,进入到医院信息、科室、排版接口的开发,内容比较枯燥。关于医院医院信息的上传接口实现,已经在上一篇文章中进行了介绍,本文继续对接口进行扩展。

查询医院接口

Controller层:

 @PostMapping("hospital/show")public Result getHospital(HttpServletRequest request) {// 1.将从医院管理表传递过来的医院信息转换为Object类型Map<String, String[]> requestMap = request.getParameterMap();Map<String, Object> paramMap = HttpRequestHelper.switchMap(requestMap);// 2.获取医院管理表中的密钥(已经使用MD5加密好了)String hospSign = (String) paramMap.get("sign");// 3.获取医院设置表中的密钥并进行MD5加密String hoscode = (String) paramMap.get("hoscode");String signKey = hospitalSetService.getSignKey(hoscode);String signKeyMd5 = MD5.encrypt(signKey);// 4.密钥不匹配就抛出错误if (!hospSign.equals(signKeyMd5)) {throw new YyghException(ResultCodeEnum.SIGN_ERROR);}// 5.执行查询操作Hospital hospital = hospitalService.getByHoscode(hoscode);return Result.ok(hospital);}

Service接口:

    Hospital getByHoscode(String hoscode);

Service实现类:

    @Overridepublic Hospital getByHoscode(String hoscode) {Hospital hospital = hospitalRepository.getHospitalByHoscode(hoscode);return hospital;}

(3)Repository层:

@Repository
public interface HospitalRepository extends MongoRepository<Hospital,String> {/*** 根据HosCode获得记录* @param hoscode* @return*/Hospital getHospitalByHoscode(String hoscode);
}

二、科室接口

(1)上传科室功能

上传科室Controller层:

 @PostMapping("saveDepartment")public Result saveDepartment(HttpServletRequest request) {// 1.将传递过来的数组类型转换为Object类型Map<String, String[]> requestMap = request.getParameterMap();Map<String, Object> paramMap = HttpRequestHelper.switchMap(requestMap);// 2.获取医院管理表中的密钥(已经使用MD5加密好了)String hospSign = (String) paramMap.get("sign");// 3.获取医院设置表中的密钥并进行MD5加密String hoscode = (String) paramMap.get("hoscode");String signKey = hospitalSetService.getSignKey(hoscode);String signKeyMd5 = MD5.encrypt(signKey);// 4.密钥不匹配就抛出错误if (!hospSign.equals(signKeyMd5)) {throw new YyghException(ResultCodeEnum.SIGN_ERROR);}// 5.执行上传科室操作departmentService.save(paramMap);return Result.ok();}

上传科室Service接口:

 void save(Map<String, Object> paramMap);

上传科室Service实现类:

    @Overridepublic void save(Map<String, Object> paramMap) {// 1.把paramMap集合转换为Department对象(借助JSONObject工具)String paramMapString = JSONObject.toJSONString(paramMap);Department department = JSONObject.parseObject(paramMapString, Department.class);// 2.根据医院编号和科室编号查询科室信息Department departmentExist = departmentRepository.getDepartmentByHoscodeAndDepcode(department.getHoscode(), department.getDepcode());// 3.如果有就执行更新,没有就执行保存if (null != departmentExist) {// 更新departmentExist.setUpdateTime(new Date());departmentExist.setIsDeleted(0);departmentRepository.save(departmentExist);} else {// 保存department.setCreateTime(new Date());department.setUpdateTime(new Date());department.setIsDeleted(0);departmentRepository.save(department);}}

Repositroy层交由Spring Data去自动完成。

(2)查询科室功能

查询科室Controller层:

 @PostMapping("department/list")public Result findDepartment(HttpServletRequest request) {// 1.将传递过来的科室转换为Object类型Map<String, String[]> requestMap = request.getParameterMap();Map<String, Object> paramMap = HttpRequestHelper.switchMap(requestMap);// 3.获取医院编号String hoscode = (String) paramMap.get("hoscode");// 2.获取医院管理表中的密钥(已经使用MD5加密好了)String hospSign = (String) paramMap.get("sign");// 当前页和每页记录数int page = StringUtils.isEmpty(paramMap.get("page")) ? 1 : Integer.parseInt((String) paramMap.get("page"));int limit = StringUtils.isEmpty(paramMap.get("limit")) ? 1 : Integer.parseInt((String) paramMap.get("limit"));String signKey = hospitalSetService.getSignKey(hoscode);String signKeyMd5 = MD5.encrypt(signKey);// 4.密钥不匹配就抛出错误if (!hospSign.equals(signKeyMd5)) {throw new YyghException(ResultCodeEnum.SIGN_ERROR);}DepartmentQueryVo departmentQueryVo = new DepartmentQueryVo();departmentQueryVo.setHoscode(hoscode);// 执行查询科室操作Page<Department> pageModel = departmentService.findPageDepartment(page, limit, departmentQueryVo);return Result.ok(pageModel);}

查询科室Service接口:

 Page<Department> findPageDepartment(int page, int limit, DepartmentQueryVo departmentQueryVo);

查询科室Service实现类:

    @Overridepublic Page<Department> findPageDepartment(int page, int limit, DepartmentQueryVo departmentQueryVo) {// 创建Pageable对象,设置当前页和每页记录数PageRequest 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<Department> example = Example.of(department, matcher);Page<Department> all = departmentRepository.findAll(example, pageable);return all;}

Repositroy层交由Spring Data去自动完成。

(3)删除科室功能

删除科室Controller层:

 @PostMapping("department/remove")public Result removeDepartment(HttpServletRequest request) {// 1.将传递过来的科室转换为Object类型Map<String, String[]> requestMap = request.getParameterMap();Map<String, Object> paramMap = HttpRequestHelper.switchMap(requestMap);// 获取科室编号 和 医院编号String depcode = (String) paramMap.get("depcode");String hoscode = (String) paramMap.get("hoscode");// 2.获取医院管理表中的密钥(已经使用MD5加密好了)String hospSign = (String) paramMap.get("sign");// 3.获取医院设置表中的密钥并进行MD5加密String signKey = hospitalSetService.getSignKey(hoscode);String signKeyMd5 = MD5.encrypt(signKey);// 4.密钥不匹配就抛出错误if (!hospSign.equals(signKeyMd5)) {throw new YyghException(ResultCodeEnum.SIGN_ERROR);}departmentService.remove(hoscode, depcode);return Result.ok();}

删除科室Service接口:

@PostMapping("department/remove")public Result removeDepartment(HttpServletRequest request) {// 1.将传递过来的科室转换为Object类型Map<String, String[]> requestMap = request.getParameterMap();Map<String, Object> paramMap = HttpRequestHelper.switchMap(requestMap);// 获取科室编号 和 医院编号String depcode = (String) paramMap.get("depcode");String hoscode = (String) paramMap.get("hoscode");// 2.获取医院管理表中的密钥(已经使用MD5加密好了)String hospSign = (String) paramMap.get("sign");// 3.获取医院设置表中的密钥并进行MD5加密String signKey = hospitalSetService.getSignKey(hoscode);String signKeyMd5 = MD5.encrypt(signKey);// 4.密钥不匹配就抛出错误if (!hospSign.equals(signKeyMd5)) {throw new YyghException(ResultCodeEnum.SIGN_ERROR);}departmentService.remove(hoscode, depcode);return Result.ok();}

删除科室Service接口:

 void remove(String hoscode, String depcode);

删除科室Service实现类:

    @Overridepublic void remove(String hoscode, String depcode) {// 1.根据 医院编号 和 科室编号 查询科室信息Department department = departmentRepository.getDepartmentByHoscodeAndDepcode(hoscode, depcode);if (null != department) {// 执行删除方法departmentRepository.deleteById(department.getId());}}

Repositroy层交由Spring Data去自动完成。

三、排班接口

(1)上传排班功能

上传排班Controller层:

@PostMapping("saveSchedule")public Result saveSchedule(HttpServletRequest request) {Map<String, String[]> requestMap = request.getParameterMap();Map<String, Object> paramMap = HttpRequestHelper.switchMap(requestMap);// 获取科室编号 和 医院编号String hoscode = (String) paramMap.get("hoscode");// 2.获取医院管理表中的密钥(已经使用MD5加密好了)String hospSign = (String) paramMap.get("sign");// 3.获取医院设置表中的密钥并进行MD5加密String signKey = hospitalSetService.getSignKey(hoscode);String signKeyMd5 = MD5.encrypt(signKey);// 4.密钥不匹配就抛出错误if (!hospSign.equals(signKeyMd5)) {throw new YyghException(ResultCodeEnum.SIGN_ERROR);}// 执行上传操作scheduleService.save(paramMap);return Result.ok();}

上传排班Service接口:

 void save(Map<String, Object> paramMap);

上传排班Service实现类:

    @Overridepublic void save(Map<String, Object> paramMap) {// 1.把paramMap集合转换为Department对象(借助JSONObject工具)String paramMapString = JSONObject.toJSONString(paramMap);Schedule schedule = JSONObject.parseObject(paramMapString, Schedule.class);// 2.根据 医院编号 和 排班编号 查询科室信息Schedule scheduleExist = scheduleRepository.getScheduleByHoscodeAndHosScheduleId(schedule.getHoscode(), schedule.getHosScheduleId());// 3.如果有就执行更新,没有就执行保存if (null != scheduleExist) {// 更新scheduleExist.setUpdateTime(new Date());scheduleExist.setIsDeleted(0);scheduleExist.setStatus(1);scheduleRepository.save(scheduleExist);} else {// 保存schedule.setCreateTime(new Date());schedule.setUpdateTime(new Date());schedule.setIsDeleted(0);schedule.setStatus(1);scheduleRepository.save(schedule);}}

Repositroy层交由Spring Data去自动完成。

(2)查询排班功能

查询排班Controller层:

 @PostMapping("schedule/list")public Result findSchedule(HttpServletRequest request) {Map<String, String[]> requestMap = request.getParameterMap();Map<String, Object> paramMap = HttpRequestHelper.switchMap(requestMap);// 3.获取医院编号,科室编号String hoscode = (String) paramMap.get("hoscode");String depcode = (String) paramMap.get("depcode");// 2.获取医院管理表中的密钥(已经使用MD5加密好了)String hospSign = (String) paramMap.get("sign");// 当前页和每页记录数int page = StringUtils.isEmpty(paramMap.get("page")) ? 1 : Integer.parseInt((String) paramMap.get("page"));int limit = StringUtils.isEmpty(paramMap.get("limit")) ? 1 : Integer.parseInt((String) paramMap.get("limit"));String signKey = hospitalSetService.getSignKey(hoscode);String signKeyMd5 = MD5.encrypt(signKey);// 4.密钥不匹配就抛出错误if (!hospSign.equals(signKeyMd5)) {throw new YyghException(ResultCodeEnum.SIGN_ERROR);}ScheduleQueryVo scheduleQueryVo = new ScheduleQueryVo();scheduleQueryVo.setHoscode(hoscode);scheduleQueryVo.setHoscode(depcode);// 执行查询科室操作Page<Schedule> pageModel = scheduleService.findPageSchedule(page, limit, scheduleQueryVo);return Result.ok(pageModel);}

查询排班Service接口:

 Page<Schedule> findPageSchedule(int page, int limit, ScheduleQueryVo scheduleQueryVo);

查询排班Service实现类:

 @Overridepublic Page<Schedule> findPageSchedule(int page, int limit, ScheduleQueryVo scheduleQueryVo) {// 创建Pageable对象,设置当前页和每页记录数PageRequest pageable = PageRequest.of(page - 1, limit);// 创建Example对象Schedule schedule = new Schedule();BeanUtils.copyProperties(scheduleQueryVo, schedule);schedule.setIsDeleted(0);schedule.setStatus(1);ExampleMatcher matcher = ExampleMatcher.matching().withStringMatcher(ExampleMatcher.StringMatcher.CONTAINING).withIgnoreCase(true);Example<Schedule> example = Example.of(schedule, matcher);Page<Schedule> all = scheduleRepository.findAll(example, pageable);return all;}

Repositroy层交由Spring Data去自动完成。

(3)删除排班功能

删除排班Controller层:

@PostMapping("schedule/remove")public Result removeSchedule(HttpServletRequest request){Map<String, String[]> requestMap = request.getParameterMap();Map<String, Object> paramMap = HttpRequestHelper.switchMap(requestMap);// 获取医院编号和排班编号String hoscode = (String) paramMap.get("hoscode");String hosScheduleId = (String) paramMap.get("hosScheduleId");// 2.获取医院管理表中的密钥(已经使用MD5加密好了)String hospSign = (String) paramMap.get("sign");// 3.获取医院设置表中的密钥并进行MD5加密String signKey = hospitalSetService.getSignKey(hoscode);String signKeyMd5 = MD5.encrypt(signKey);// 4.密钥不匹配就抛出错误if (!hospSign.equals(signKeyMd5)) {throw new YyghException(ResultCodeEnum.SIGN_ERROR);}scheduleService.removeSchedule(hoscode, hosScheduleId);return Result.ok();}

删除排班Service接口:

 void removeSchedule(String hoscode, String hosScheduleId);

删除排班Service实现类:

@PostMapping("schedule/remove")public Result removeSchedule(HttpServletRequest request){Map<String, String[]> requestMap = request.getParameterMap();Map<String, Object> paramMap = HttpRequestHelper.switchMap(requestMap);// 获取医院编号和排班编号String hoscode = (String) paramMap.get("hoscode");String hosScheduleId = (String) paramMap.get("hosScheduleId");// 2.获取医院管理表中的密钥(已经使用MD5加密好了)String hospSign = (String) paramMap.get("sign");// 3.获取医院设置表中的密钥并进行MD5加密String signKey = hospitalSetService.getSignKey(hoscode);String signKeyMd5 = MD5.encrypt(signKey);// 4.密钥不匹配就抛出错误if (!hospSign.equals(signKeyMd5)) {throw new YyghException(ResultCodeEnum.SIGN_ERROR);}scheduleService.removeSchedule(hoscode, hosScheduleId);return Result.ok();}

Repositroy层交由Spring Data去自动完成。

分布式医疗挂号系统(十二) | 开发医院、科室、排班接口相关推荐

  1. 分布式医疗挂号系统(七) | 开发医院设置页面

    @[toc](分布式医疗挂号系统(七) | 开发医院设置页面) 在分布式医疗挂号系统中,前端主要使用的两个技术是Vue和ElementUI.医院设置微服务模块的后端之前已经完成,现在需要借助Vue+E ...

  2. 分布式医疗挂号系统(二) | 开发医院设置微服务模块

    本系列文章介绍从0开始搭建一个基于分布式的医疗挂号系统.本次四篇文章完成了医院设置微服务模块的后端接口,为了方便开发,对接口的返回结果.全局异常.全局日志进行了统一处理. 同时,为了方便进行访问测试, ...

  3. Day108.尚医通:医院模拟系统接口对接 - 医院|科室|排班 增删改分页条件查询

    目录 一.部署医院模拟系统 二.开发平台接口 - 上传(保存)医院信息接口 3.实现医院上传功能 4.实现签名校验 三.查询医院 四.搭建科室接口 上传科室 五.查询科室  ★★ 六.删除科室 七.上 ...

  4. 【Visual C++】游戏开发笔记三十二 浅墨DirectX提高班之一 DirectX大局观认知篇

    本系列文章由zhmxy555(毛星云)编写,转载请注明出处. 文章链接:  http://blog.csdn.net/zhmxy555/article/details/8172615 作者:毛星云(浅 ...

  5. 计算机操做系统(十二):进程同步和互斥

    计算机操做系统(十二):进程同步和互斥 来源王道考研视频: https://www.bilibili.com/video/BV1YE411D7nH?p=18 基本概念 异步性:各并发执行的进程以各自独 ...

  6. Slicer学习笔记(六十二)slicer下导出模块接口

    Slicer学习笔记(六十二)slicer下导出模块接口 1. 参考文件实现 1. 参考文件实现 通过配置config_file为每一个生成类添加 Export,并为每个Module生成 Export ...

  7. Day228229.上传查询医院接口、上传查询删除科室接口、上传查询删除排班接口 -尚医通

    尚医通 一.上传医院接口 参考<尚医通API接口文档.docx>业务接口4.1上传医院 参考<医院接口模拟系统.docx>进行接口测试与数据上传 这里要整合hospital-m ...

  8. c++实现医院检验科排班程序

    c++实现医院检验科排班程序 1.背景: 医院急诊检验科24h×7×365值班.工作人员固定.採取轮班制度.确保24h都有人值班. 本文就通过C++实现编敲代码自己主动排班,并能够转为Excel打印. ...

  9. 通过Dapr实现一个简单的基于.net的微服务电商系统(十二)——istio+dapr构建多运行时服务网格...

    多运行时是一个非常新的概念.在 2020 年,Bilgin Ibryam 提出了 Multi-Runtime(多运行时)的理念,对基于 Sidecar 模式的各种产品形态进行了实践总结和理论升华.那到 ...

最新文章

  1. 劫持选举 EOJ 3535(随机)
  2. php 递归实现无限极分类和排序_PHP无限级分类实现层级值间用字符串拼接
  3. Java数据结构和算法(五)——队列
  4. java的printf语法_java printf的一些常用的打印格式总结
  5. 用户控件如何控制ASPX页面的控件
  6. 一些iis配置相关报错的参考
  7. [Everyday Mathematics]20150214
  8. python excelwriter保存路径_Python和Excel 终于可以互通了!!
  9. postman发送HTTP请求自动生成MD5签名
  10. MyBatis-Plus-Generator配置
  11. centos 查看版本(转)
  12. 无线摄像头接有线如何改协议_WiFi中继器——让无线传输更简单
  13. 识别到硬盘 计算机不显示盘符,移动硬盘不显示盘符怎么办
  14. 强化学习之Q函数的个人理解
  15. 来,给产品狗起个正儿八经的名字!
  16. port isolate enable命令
  17. WEB APP、HYBRID APP与NATIVE APP 差异分析
  18. 【物联网平台篇9】使用MQTT上传图片到OneNET
  19. html table vtop,在html中實現可輸入的下拉列表
  20. 5G NR CSI-RS介绍(4)-- CSI Report配置详解

热门文章

  1. 实战 lasso特征筛选得到5个基因 cox单因素分析得到很多有意义的基因 如何lasso筛选特征基因 然后再进行cox多因素分析
  2. 怎样用计算机制作项链单页,Photoshop路径工具和图层样式制作质感项链
  3. 基本路径测试案例分析
  4. java 代码实现身份证合法性校验(全国所有地方)
  5. 学习了解GET,POST传参,编写PHP代码,回显GET,POST输入
  6. 如何从sim卡中读取手机号码?
  7. 微信小程序云开发实战:网上商城(三)
  8. 严蔚敏数据结构c++版微盘_招聘 | 传智 C 位,等你坐镇~
  9. 档案的逻辑 | 档案分类中的重要概念
  10. 数据结构与算法代码(浙大版本陈越、何钦铭老师mooc课程)