Source code acquisition : Blog home page " resources " Download in !

one , Project brief

The system functions include : Hospital registration , Back number , pay , Refund , Check application form issuance , Department management , Doctor bill , Registration level , Opening of inspection items , Opening of inspection items , Doctor reception and other functions .

two , Project operation

Environment configuration :

Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm OK )+ Eclispe(IntelliJ
IDEA,Eclispe,MyEclispe,Sts All support ).

Project technology :

Springboot + Maven + Mybatis + Vue Etc. composition ,B/S pattern + Maven Management, etc .
 

 

 

 

Role control layer :
/** * <p> * role Front end controller * </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("", " No record of this role "); 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("", " The role name already exists "); return
ResultGenerator.getSuccessResult(); } @PostMapping() @UserLoginToken public
Result save(@RequestBody Role role) { // System.out.println(role); if
(roleService.save(role)) return ResultGenerator.getSuccessResult("", " Added successfully ");
return ResultGenerator.getFailResult("", " Add failed "); } @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("",
" Update successful "); return ResultGenerator.getFailResult("", " Update failed "); }
@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("",
" Activation status modified successfully "); return ResultGenerator.getFailResult("", " Activation status modification failed "); }
@DeleteMapping("/{id}") @UserLoginToken public Result del(@PathVariable int id)
{ if (roleService.removeById(id)) return ResultGenerator.getSuccessResult("",
" Deleted successfully "); return ResultGenerator.getFailResult("", " Delete failed "); }
@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("", " Deleted successfully "); return
ResultGenerator.getFailResult("", " Delete failed "); } }

User management control layer :
/** * <p> * user Front end controller * </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);// Parameter 1 is the current page , Parameter 2 is the number of pages per page 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(""," No user record "); 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("", " The user name already exists "); 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(""," Added successfully ");
return ResultGenerator.getFailResult(""," Add failed "); } @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(""," Update successful "); return
ResultGenerator.getFailResult(""," Update failed "); } /** * Modify user's status , It is equivalent to modifying the activation status of the user */
@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("",
" Activation status modified successfully "); return ResultGenerator.getFailResult("", " Activation status modification failed "); }
@DeleteMapping("/{id}") @UserLoginToken public Result del(@PathVariable int id)
{ if(userService.removeById(id)) return
ResultGenerator.getSuccessResult(""," Deleted successfully "); return
ResultGenerator.getFailResult(""," Delete failed "); } @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("",
" Deleted successfully "); return ResultGenerator.getFailResult("", " Delete failed "); } }

Login control layer :
@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," Wrong mobile phone number or password "); } if (user.getActive() == 0) {
return ResultGenerator.getFailResult(null," Please contact the administrator to activate it for you "); }
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," Login successful "); } private void
updateLoginTime(int id){ User user = new User(); user.setId(id);
user.setLastlogin(LocalDateTime.now()); userService.updateById(user); } }
Source code acquisition : Blog home page " resources " Download in !

Technology
Daily Recommendation
views 267
views 232
views 231