当前位置:   article > 正文

Java项目:医院管理系统(java+Springboot+Maven+Mybatis+Vue+Mysql)_医院自动排班java

医院自动排班java

源码获取:博客首页 "资源" 里下载!

一、项目简述

本系统功能包括:医院挂号,退号,缴费,退费,检查申请单开立,科室管理,医生开单,挂号级别,检验项目开立,检查项目开立,医生接诊等等功能。

二、项目运行

环境配置:

Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。

项目技术:

Springboot + Maven + Mybatis + Vue 等等组成,B/S模式 + Maven管理等等。
 

 

 

 

角色控制层:

  1. /**
  2. * <p>
  3. * 角色 前端控制器
  4. * </p>
  5. *
  6. */
  7. @RestController
  8. @RequestMapping("/roles")
  9. public class RoleController {
  10. @Resource
  11. private IRoleService roleService;
  12. @GetMapping
  13. public Result getlist(@RequestParam Map<String, Object> param) {
  14. InitUtil.initPage(param);
  15. int num = Integer.parseInt(param.get("page").toString());
  16. int limit = Integer.parseInt(param.get("limit").toString());
  17. QueryWrapper<Role> wrapper = new QueryWrapper<>();
  18. InitUtil.initLike(param, wrapper, "name");
  19. InitUtil.initEq(param, wrapper, "active");
  20. IPage<Role> page = new Page<>(num, limit);
  21. return ResultGenerator.getSuccessResult(roleService.page(page, wrapper));
  22. }
  23. @GetMapping("/all")
  24. public Result getAll() {
  25. QueryWrapper<Role> wrapper = new QueryWrapper<>();
  26. wrapper.eq("active", 1);
  27. JSONObject jsonObject = new JSONObject();
  28. List<Role> list = roleService.list(wrapper);
  29. for (Role i : list) {
  30. jsonObject.put(i.getId().toString(), Map.of("name",i.getName()));
  31. }
  32. return ResultGenerator.getSuccessResult(jsonObject);
  33. }
  34. @GetMapping("/{id}")
  35. public Result getRole(@PathVariable int id) {
  36. Role role = roleService.getById(id);
  37. if (role == null)
  38. return ResultGenerator.getFailResult("", "无该角色记录");
  39. return ResultGenerator.getSuccessResult(role);
  40. }
  41. @GetMapping("/check")
  42. public Result checkUserName(@RequestParam String name) {
  43. QueryWrapper<Role> wrapper = new QueryWrapper<>();
  44. wrapper.eq("name", name);
  45. if (roleService.getOne(wrapper) != null)
  46. return ResultGenerator.getFailResult("", "该角色名已存在");
  47. return ResultGenerator.getSuccessResult();
  48. }
  49. @PostMapping()
  50. @UserLoginToken
  51. public Result save(@RequestBody Role role) {
  52. // System.out.println(role);
  53. if (roleService.save(role))
  54. return ResultGenerator.getSuccessResult("", "添加成功");
  55. return ResultGenerator.getFailResult("", "添加失败");
  56. }
  57. @PutMapping("/{id}")
  58. @UserLoginToken
  59. public Result update(@RequestBody Role role, @PathVariable int id) {
  60. role.setId(id);
  61. // System.out.println(role);
  62. if (roleService.updateById(role))
  63. return ResultGenerator.getSuccessResult("", "更新成功");
  64. return ResultGenerator.getFailResult("", "更新失败");
  65. }
  66. @PutMapping("/{id}/state/{active}")
  67. @UserLoginToken
  68. public Result changeActive(@PathVariable int id, @PathVariable int active) {
  69. Role role = new Role();
  70. role.setActive(active);
  71. role.setId(id);
  72. if (roleService.updateById(role))
  73. return ResultGenerator.getSuccessResult("", "激活状态修改成功");
  74. return ResultGenerator.getFailResult("", "激活状态修改失败");
  75. }
  76. @DeleteMapping("/{id}")
  77. @UserLoginToken
  78. public Result del(@PathVariable int id) {
  79. if (roleService.removeById(id))
  80. return ResultGenerator.getSuccessResult("", "删除成功");
  81. return ResultGenerator.getFailResult("", "删除失败");
  82. }
  83. @DeleteMapping("/batchdel")
  84. @UserLoginToken
  85. public Result batchDel(@RequestParam String ids) {
  86. String[] idList = ids.split(",");
  87. List<Integer> list = new ArrayList<>(idList.length);
  88. for (String id : idList) {
  89. list.add(Integer.parseInt(id));
  90. }
  91. if (roleService.removeByIds(list))
  92. return ResultGenerator.getSuccessResult("", "删除成功");
  93. return ResultGenerator.getFailResult("", "删除失败");
  94. }
  95. }

用户管理控制层:

  1. /**
  2. * <p>
  3. * 用户 前端控制器
  4. * </p>
  5. *
  6. */
  7. @RestController
  8. @RequestMapping("/users")
  9. public class UserController {
  10. @Resource
  11. private IUserService userService;
  12. @GetMapping
  13. public Result getList(@RequestParam Map<String, Object> param) {
  14. InitUtil.initPage(param);
  15. int num = Integer.parseInt(param.get("page").toString());
  16. int limit = Integer.parseInt(param.get("limit").toString());
  17. QueryWrapper<User> wrapper = new QueryWrapper<User>();
  18. Object name = param.get("name");
  19. if (!StringUtils.isEmpty(name)){
  20. wrapper.like("username", name).or().like("realname", name);
  21. }
  22. InitUtil.initEq(param, wrapper, "active");
  23. IPage<User> page = new Page<>(num, limit);// 参数一是当前页,参数二是每页个数
  24. return ResultGenerator.getSuccessResult(userService.page(page, wrapper));
  25. }
  26. @GetMapping("/{id}")
  27. public Result getUser(@PathVariable int id) {
  28. User user = userService.getById(id);
  29. if (user == null) return ResultGenerator.getFailResult("","无用户记录");
  30. return ResultGenerator.getSuccessResult(user);
  31. }
  32. @GetMapping("/check")
  33. public Result checkUserName(@RequestParam String name) {
  34. QueryWrapper<User> wrapper = new QueryWrapper<>();
  35. wrapper.eq("username", name);
  36. if (userService.getOne(wrapper) != null)
  37. return ResultGenerator.getFailResult("", "该用户名已存在");
  38. return ResultGenerator.getSuccessResult();
  39. }
  40. @GetMapping("/list")
  41. public Result getListBy(@RequestParam Map<String, Object> param) {
  42. QueryWrapper<User> wrapper = new QueryWrapper<>();
  43. InitUtil.initEq(param, wrapper, "user_type","dept_id","active");
  44. JSONObject jsonObject = new JSONObject();
  45. List<User> list = userService.list(wrapper);
  46. for (User i : list) {
  47. jsonObject.put(i.getId().toString(),Map.of("name", i.getRealname()));
  48. }
  49. return ResultGenerator.getSuccessResult(jsonObject);
  50. }
  51. @PostMapping()
  52. @UserLoginToken
  53. public Result save(@RequestBody User user){
  54. //System.out.println(user);
  55. user.setPassword(ShaUtil.getSHA256(user.getPassword()));
  56. if(userService.save(user)) return ResultGenerator.getSuccessResult("","添加成功");
  57. return ResultGenerator.getFailResult("","添加失败");
  58. }
  59. @PutMapping("/{id}")
  60. @UserLoginToken
  61. public Result update(@RequestBody User user,@PathVariable int id){
  62. user.setId(id);
  63. //System.out.println(user);
  64. if(userService.updateById(user)) return ResultGenerator.getSuccessResult("","更新成功");
  65. return ResultGenerator.getFailResult("","更新失败");
  66. }
  67. /**
  68. * 修改用户的状态,相当于修改用户的激活状态
  69. */
  70. @PutMapping("/{id}/state/{active}")
  71. @UserLoginToken
  72. public Result changeActive(@PathVariable int id, @PathVariable int active) {
  73. User user = new User();
  74. user.setActive(active);
  75. user.setId(id);
  76. if (userService.updateById(user))
  77. return ResultGenerator.getSuccessResult("", "激活状态修改成功");
  78. return ResultGenerator.getFailResult("", "激活状态修改失败");
  79. }
  80. @DeleteMapping("/{id}")
  81. @UserLoginToken
  82. public Result del(@PathVariable int id) {
  83. if(userService.removeById(id)) return ResultGenerator.getSuccessResult("","删除成功");
  84. return ResultGenerator.getFailResult("","删除失败");
  85. }
  86. @DeleteMapping("/batchdel")
  87. @UserLoginToken
  88. public Result batchDel(@RequestParam String ids) {
  89. String[] idList = ids.split(",");
  90. List<Integer> list = new ArrayList<>(idList.length);
  91. for (String id : idList) {
  92. list.add(Integer.parseInt(id));
  93. }
  94. if (userService.removeByIds(list))
  95. return ResultGenerator.getSuccessResult("", "删除成功");
  96. return ResultGenerator.getFailResult("", "删除失败");
  97. }
  98. }

登录控制层:

  1. @RestController
  2. public class LoginController {
  3. @Resource
  4. private IUserService userService;
  5. @PostMapping("/login")
  6. public Result login(@RequestBody Map<String,Object> param){
  7. System.out.println(param);
  8. QueryWrapper<User> wrapper = new QueryWrapper<>();
  9. wrapper.eq("telephone", param.get("telephone")).eq("password", ShaUtil.getSHA256(param.get("password").toString()));
  10. User user = userService.getOne(wrapper);
  11. if (user == null){
  12. return ResultGenerator.getFailResult(null,"手机号或密码错误");
  13. }
  14. if (user.getActive() == 0) {
  15. return ResultGenerator.getFailResult(null,"请联系管理员帮你激活");
  16. }
  17. user.setLastlogin(LocalDateTime.now());
  18. updateLoginTime(user.getId());
  19. JSONObject jsonObject = new JSONObject();
  20. jsonObject.put("token", JwtUtil.create(user));
  21. jsonObject.put("id",user.getId());
  22. jsonObject.put("deptId",user.getDeptId());
  23. return ResultGenerator.getSuccessResult(jsonObject,"登录成功");
  24. }
  25. private void updateLoginTime(int id){
  26. User user = new User();
  27. user.setId(id);
  28. user.setLastlogin(LocalDateTime.now());
  29. userService.updateById(user);
  30. }
  31. }

源码获取:博客首页 "资源" 里下载!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/927076
推荐阅读
相关标签
  

闽ICP备14008679号