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

一、项目简述

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

二、项目运行

环境配置:

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

项目技术:

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

 

 

 

角色控制层:
/** * <p> * 角色 前端控制器 * </p> * */ @RestController @RequestMapping("/roles")
public class RoleController { @Resource private IRoleService roleService;
@GetMapping public Result getlist(@RequestParam Map<String, Object> param) {
InitUtil.initPage(param); int num =
Integer.parseInt(param.get("page").toString()); int limit =
Integer.parseInt(param.get("limit").toString()); QueryWrapper<Role> wrapper =
new QueryWrapper<>(); InitUtil.initLike(param, wrapper, "name");
InitUtil.initEq(param, wrapper, "active"); IPage<Role> page = new Page<>(num,
limit); return ResultGenerator.getSuccessResult(roleService.page(page,
wrapper)); } @GetMapping("/all") public Result getAll() { QueryWrapper<Role>
wrapper = new QueryWrapper<>(); wrapper.eq("active", 1); JSONObject jsonObject
= new JSONObject(); List<Role> list = roleService.list(wrapper); for (Role i :
list) { jsonObject.put(i.getId().toString(), Map.of("name",i.getName())); }
return ResultGenerator.getSuccessResult(jsonObject); } @GetMapping("/{id}")
public Result getRole(@PathVariable int id) { Role role =
roleService.getById(id); if (role == null) return
ResultGenerator.getFailResult("", "无该角色记录"); return
ResultGenerator.getSuccessResult(role); } @GetMapping("/check") public Result
checkUserName(@RequestParam String name) { QueryWrapper<Role> wrapper = new
QueryWrapper<>(); wrapper.eq("name", name); if (roleService.getOne(wrapper) !=
null) return ResultGenerator.getFailResult("", "该角色名已存在"); return
ResultGenerator.getSuccessResult(); } @PostMapping() @UserLoginToken public
Result save(@RequestBody Role role) { // System.out.println(role); if
(roleService.save(role)) return ResultGenerator.getSuccessResult("", "添加成功");
return ResultGenerator.getFailResult("", "添加失败"); } @PutMapping("/{id}")
@UserLoginToken public Result update(@RequestBody Role role, @PathVariable int
id) { role.setId(id); // System.out.println(role); if
(roleService.updateById(role)) return ResultGenerator.getSuccessResult("",
"更新成功"); return ResultGenerator.getFailResult("", "更新失败"); }
@PutMapping("/{id}/state/{active}") @UserLoginToken public Result
changeActive(@PathVariable int id, @PathVariable int active) { Role role = new
Role(); role.setActive(active); role.setId(id); if
(roleService.updateById(role)) return ResultGenerator.getSuccessResult("",
"激活状态修改成功"); return ResultGenerator.getFailResult("", "激活状态修改失败"); }
@DeleteMapping("/{id}") @UserLoginToken public Result del(@PathVariable int id)
{ if (roleService.removeById(id)) return ResultGenerator.getSuccessResult("",
"删除成功"); return ResultGenerator.getFailResult("", "删除失败"); }
@DeleteMapping("/batchdel") @UserLoginToken public Result
batchDel(@RequestParam String ids) { String[] idList = ids.split(",");
List<Integer> list = new ArrayList<>(idList.length); for (String id : idList) {
list.add(Integer.parseInt(id)); } if (roleService.removeByIds(list)) return
ResultGenerator.getSuccessResult("", "删除成功"); return
ResultGenerator.getFailResult("", "删除失败"); } }

用户管理控制层:
/** * <p> * 用户 前端控制器 * </p> * */ @RestController @RequestMapping("/users")
public class UserController { @Resource private IUserService userService;
@GetMapping public Result getList(@RequestParam Map<String, Object> param) {
InitUtil.initPage(param); int num =
Integer.parseInt(param.get("page").toString()); int limit =
Integer.parseInt(param.get("limit").toString()); QueryWrapper<User> wrapper =
new QueryWrapper<User>(); Object name = param.get("name"); if
(!StringUtils.isEmpty(name)){ wrapper.like("username",
name).or().like("realname", name); } InitUtil.initEq(param, wrapper, "active");
IPage<User> page = new Page<>(num, limit);// 参数一是当前页,参数二是每页个数 return
ResultGenerator.getSuccessResult(userService.page(page, wrapper)); }
@GetMapping("/{id}") public Result getUser(@PathVariable int id) { User user =
userService.getById(id); if (user == null) return
ResultGenerator.getFailResult("","无用户记录"); return
ResultGenerator.getSuccessResult(user); } @GetMapping("/check") public Result
checkUserName(@RequestParam String name) { QueryWrapper<User> wrapper = new
QueryWrapper<>(); wrapper.eq("username", name); if (userService.getOne(wrapper)
!= null) return ResultGenerator.getFailResult("", "该用户名已存在"); return
ResultGenerator.getSuccessResult(); } @GetMapping("/list") public Result
getListBy(@RequestParam Map<String, Object> param) { QueryWrapper<User> wrapper
= new QueryWrapper<>(); InitUtil.initEq(param, wrapper,
"user_type","dept_id","active"); JSONObject jsonObject = new JSONObject();
List<User> list = userService.list(wrapper); for (User i : list) {
jsonObject.put(i.getId().toString(),Map.of("name", i.getRealname())); } return
ResultGenerator.getSuccessResult(jsonObject); } @PostMapping() @UserLoginToken
public Result save(@RequestBody User user){ //System.out.println(user);
user.setPassword(ShaUtil.getSHA256(user.getPassword()));
if(userService.save(user)) return ResultGenerator.getSuccessResult("","添加成功");
return ResultGenerator.getFailResult("","添加失败"); } @PutMapping("/{id}")
@UserLoginToken public Result update(@RequestBody User user,@PathVariable int
id){ user.setId(id); //System.out.println(user);
if(userService.updateById(user)) return
ResultGenerator.getSuccessResult("","更新成功"); return
ResultGenerator.getFailResult("","更新失败"); } /** * 修改用户的状态,相当于修改用户的激活状态 */
@PutMapping("/{id}/state/{active}") @UserLoginToken public Result
changeActive(@PathVariable int id, @PathVariable int active) { User user = new
User(); user.setActive(active); user.setId(id); if
(userService.updateById(user)) return ResultGenerator.getSuccessResult("",
"激活状态修改成功"); return ResultGenerator.getFailResult("", "激活状态修改失败"); }
@DeleteMapping("/{id}") @UserLoginToken public Result del(@PathVariable int id)
{ if(userService.removeById(id)) return
ResultGenerator.getSuccessResult("","删除成功"); return
ResultGenerator.getFailResult("","删除失败"); } @DeleteMapping("/batchdel")
@UserLoginToken public Result batchDel(@RequestParam String ids) { String[]
idList = ids.split(","); List<Integer> list = new ArrayList<>(idList.length);
for (String id : idList) { list.add(Integer.parseInt(id)); } if
(userService.removeByIds(list)) return ResultGenerator.getSuccessResult("",
"删除成功"); return ResultGenerator.getFailResult("", "删除失败"); } }

登录控制层:
@RestController public class LoginController { @Resource private IUserService
userService; @PostMapping("/login") public Result login(@RequestBody
Map<String,Object> param){ System.out.println(param); QueryWrapper<User>
wrapper = new QueryWrapper<>(); wrapper.eq("telephone",
param.get("telephone")).eq("password",
ShaUtil.getSHA256(param.get("password").toString())); User user =
userService.getOne(wrapper); if (user == null){ return
ResultGenerator.getFailResult(null,"手机号或密码错误"); } if (user.getActive() == 0) {
return ResultGenerator.getFailResult(null,"请联系管理员帮你激活"); }
user.setLastlogin(LocalDateTime.now()); updateLoginTime(user.getId());
JSONObject jsonObject = new JSONObject(); jsonObject.put("token",
JwtUtil.create(user)); jsonObject.put("id",user.getId());
jsonObject.put("deptId",user.getDeptId()); return
ResultGenerator.getSuccessResult(jsonObject,"登录成功"); } private void
updateLoginTime(int id){ User user = new User(); user.setId(id);
user.setLastlogin(LocalDateTime.now()); userService.updateById(user); } }
源码获取:博客首页 "资源" 里下载!

技术
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:[email protected]
QQ群:766591547
关注微信