100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > Java项目:springboot+vue大学生健康档案管理系统

Java项目:springboot+vue大学生健康档案管理系统

时间:2023-02-09 18:42:45

相关推荐

Java项目:springboot+vue大学生健康档案管理系统

作者主页:夜未央5788

简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

大学生健康档案管理系统,目前演示数据中主要包括三种角色:管理员、医生、学生;其中管理员包含最高权限;可对体检表,健康文档,体检数据图标展示等进行管理,以及权限管理,指定不同科室医生进行不同的操作。此项目为前后端分离项目,后端API接口为SpringBoot项目;前端为vue项目;

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。

2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;

3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可

4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;

5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

6.数据库:MySql 8.0版本;

软件架构说明

- springboot

- mysql 8.0及以上

- mybatis

- jpa

- swagger-ui

- lombok注:必须安装

安装教程

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

2. 将项目中application.yml配置文件中的数据库配置改为自己的配置

3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行后端项目;

配合前端项目

1.运行 npm install

2.在运行 npm run serve 即可

3.运行项目成功后,在浏览器中输入地址:http://localhost:8083 即可登录;

管理员账号:admin 密码:123456

外科医生账号:waike 密码:123

学生账号:631507030104 密码:123

运行截图

代码相关

健康文档相关

@Api(description = "健康文档相关接口")@Controller@RequestMapping(value = "api/healthDocument")public class HealthDocumentController extends BaseController<HealthDocumentService,HealthDocument,Integer> {@Override@RequiresPermissions("healthDocument:add")public ResponseEntity<HealthDocument> save(@RequestBody HealthDocument entity) {if (entity.getIsPublished()==1){entity.setPublishData(new Date());}return super.save(entity);}@Override@RequiresPermissions("healthDocument:update")public ResponseEntity<HealthDocument> update(@RequestBody HealthDocument entity) {if (entity.getIsPublished()==1){entity.setPublishData(new Date());}return super.update(entity);}@Override@GetMapping(value = "delete/{id}")@RequiresPermissions("healthDocument:delete")public ResponseEntity<String> delete(@PathVariable("id") Integer id) {return super.delete(id);}}

文件上传

@Slf4j@Api(description = "文件上传接口")@RestController@RequestMapping(value = "api/uploadFile")public class UploadController {@PostMapping("/upload")public ResponseEntity<String> uploadLocal(MultipartFile file) throws IOException {if (Objects.isNull(file)){throw new MyException(ExceptionEnums.CHOOSE_FILE);}else {String fileName = file.getOriginalFilename();Integer index = fileName.lastIndexOf('.');String suffix = fileName.substring(index,fileName.length());System.out.println(suffix);String start = "";if ((".png").equals(suffix)){start = "data:image/png;base64,";}if ((".jpg").equals(suffix) || (".jpeg").equals(suffix)){start = "data:image/jpeg;base64,";}InputStream inputStream = file.getInputStream();OutputStream outputStream = new ByteArrayOutputStream();new BASE64Encoder().encodeBuffer(inputStream,outputStream);String key = outputStream.toString();return ResponseEntity.ok(start+key);}}}

用户管理控制器

@Slf4j@Api(description = "用户相关接口")@Controller@RequestMapping(value = "api/user")public class UserController extends BaseController<UserService,User,Integer> {@Overridepublic ResponseEntity<User> save(@RequestBody User entity) {if (entity.getRoleId() == null){entity.setRoleId(2);}if (entity.getUsername() == null){entity.setUsername(entity.getStuNo());}if (entity.getPassword()==null){entity.setPassword("123");}if (StringUtils.isBlank(entity.getUsername())){throw new MyException(ExceptionEnums.ADD_ERROR);}if (this.service.findByUsername(entity.getUsername())!=null){throw new MyException(ExceptionEnums.ACCOUNT_IS_EXIT);}entity.setPassword(MD5Utils.encrypt(entity.getUsername(), entity.getPassword()));return super.save(entity);}@Overridepublic ResponseEntity<User> update(@RequestBody User entity) {if (this.service.selectByKey(entity.getId()).getPassword().equals(entity.getPassword())){return super.update(entity);}else {entity.setPassword(MD5Utils.encrypt(entity.getUsername(), entity.getPassword()));return super.update(entity);}}@PostMapping("/updateUser")public ResponseEntity<User> updateUserName(@RequestBody User entity){Subject subject = SecurityUtils.getSubject();User user = (User) subject.getPrincipal();if (this.service.findByUsername(entity.getUsername())!=null && !entity.getUsername().equals(user.getUsername())){throw new MyException(ExceptionEnums.ACCOUNT_IS_EXIT);}if (this.service.selectByKey(entity.getId()).getPassword().equals(entity.getPassword())){return super.update(entity);}else {entity.setPassword(MD5Utils.encrypt(entity.getUsername(), entity.getPassword()));return super.update(entity);}}@Override@GetMapping(value = "delete/{id}")public ResponseEntity<String> delete(@PathVariable("id")Integer id) {return super.delete(id);}@ApiOperation(value = "用户登录接口")@RequestMapping("login")public ResponseEntity<User> login(@RequestBody User entity, HttpServletRequest request){UsernamePasswordToken token = new UsernamePasswordToken(entity.getUsername(), entity.getPassword());Subject subject = SecurityUtils.getSubject();try {subject.login(token);User user = (User) subject.getPrincipal();return ResponseEntity.ok(user);} catch (Exception e) {log.info("登陆失败:"+e.getMessage());throw e;}}@ApiOperation(value = "用户注销接口")@GetMapping("/loginOut")public ResponseEntity<String> loginOut(){Subject subject = SecurityUtils.getSubject();if (subject!=null){subject.logout();}return ResponseEntity.ok("退出登录");}@ApiOperation(value = "获取所有相应角色用户")@GetMapping("/getAllStudent/{roleId}")public ResponseEntity<List<User>> getAllStudent(@PathVariable("roleId") String roleId){Example example = new Example(User.class);example.createCriteria().andEqualTo("roleId",roleId);List<User> users = this.service.selectByExample(example);return ResponseEntity.ok(users);}}

如果也想学习本系统,下面领取。回复:004springboot

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。