基于javaweb的医院管理系统(java+springboot+mybatis+vue+mysql)

运行环境

Java≥8、MySQL≥5.7、Node.js≥10

开发工具

后端:eclipse/idea/myeclipse/sts等均可配置运行

前端:WebStorm/VSCode/HBuilderX等均可

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

20220819220003

20220819220004

20220819220005

20220819220006

20220819220007

基于javaweb+mysql的医院管理系统(java+Springboot+Maven+Mybatis+Vue+Mysql)

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

二、项目运行 环境配置:

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

项目技术:

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

角色控制层:

/**

  • 角色 前端控制器

*/

@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 wrapper = new QueryWrapper<>();

InitUtil.initLike(param, wrapper, “name”);

InitUtil.initEq(param, wrapper, “active”);

IPage page = new Page<>(num, limit);

return ResultGenerator.getSuccessResult(roleService.page(page, wrapper));

@GetMapping(“/all”)

public Result getAll() {

QueryWrapper wrapper = new QueryWrapper<>();

wrapper.eq(“active”, 1);

JSONObject jsonObject = new JSONObject();

List 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 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 list = new ArrayList<>(idList.length);

for (String id : idList) {

list.add(Integer.parseInt(id));

if (roleService.removeByIds(list))

return ResultGenerator.getSuccessResult(“”, “删除成功”);

return ResultGenerator.getFailResult(“”, “删除失败”);

用户管理控制层:

/**

  • 用户 前端控制器

*/

@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 wrapper = new QueryWrapper();

Object name = param.get(“name”);

if (!StringUtils.isEmpty(name)){

wrapper.like(“username”, name).or().like(“realname”, name);

InitUtil.initEq(param, wrapper, “active”);

IPage 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 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 wrapper = new QueryWrapper<>();

InitUtil.initEq(param, wrapper, “user_type”,“dept_id”,“active”);

JSONObject jsonObject = new JSONObject();

List 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 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 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);


Logo

前往低代码交流专区

更多推荐