东莞网站推广行者seo08,服装设计怎么学 从零开始,中小企业建站是什么,中国经济排名世界第几作者主页#xff1a;编程指南针 作者简介#xff1a;Java领域优质创作者、CSDN博客专家 、掘金特邀作者、多年架构师设计经验、腾讯课堂常驻讲师 主要内容#xff1a;Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助 文末获取源码 项目编号#xff1a;KS-032… 作者主页编程指南针 作者简介Java领域优质创作者、CSDN博客专家 、掘金特邀作者、多年架构师设计经验、腾讯课堂常驻讲师 主要内容Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助 文末获取源码 项目编号KS-032
一项目简介
医院病患管理SpringbootThymeleafBootStrapMybatis页面好看功能完全.有登录权限拦截、忘记密码、发送邮件等功能。主要包含病患管理、信息统计、用户注册、用户登陆、病患联系等功能
二环境介绍
语言环境Java: jdk1.8
数据库Mysql: mysql5.7
应用服务器Tomcat: tomcat8.5.31
开发工具IDEA或eclipse 三系统展示
登陆 注册 首页 病患管理 个人信息管理 发邮件 四核心代码展示 package com.liefox.config;import org.springframework.web.servlet.HandlerInterceptor;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;/*** Author znz* Date 2021/4/19 下午 12:41**/
public class LoginHandlerInterceptor implements HandlerInterceptor {Overridepublic boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {//登录成功之后应该有用户的sessionObject loginUser request.getSession().getAttribute(loginUser);if (loginUser null) {System.err.println(loginUserSessionloginUser);request.setAttribute(msg, 没有权限请登录);/*转发到登录页*/request.getRequestDispatcher(/tosign-in).forward(request, response);return false;} else {return true;}}
}package com.liefox.config;import org.springframework.web.servlet.LocaleResolver;
import org.thymeleaf.util.StringUtils;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Locale;/*** Author znz* Date 2021/4/19 上午 9:44* 国际化**/
public class MyLocaleResolver implements LocaleResolver {//解析请求Overridepublic Locale resolveLocale(HttpServletRequest httpServletRequest) {//获取请求中的语言参数String language httpServletRequest.getParameter(l);Locale locale Locale.getDefault();//如果没有就使用默认值//如果请求的链接携带了国际化的参数if (!StringUtils.isEmpty(language)) {//zh_CNString[] split language.split(_);//国家地区locale new Locale(split[0], split[1]);}return locale;}Overridepublic void setLocale(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Locale locale) {}
}package com.liefox.config;import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;/*** Author znz* Date 2021/4/18 下午 2:40**/
Configuration
public class MyMvcConfig implements WebMvcConfigurer {Overridepublic void addViewControllers(ViewControllerRegistry registry) {/*** 医生页* *//*欢迎页*/registry.addViewController(/).setViewName(doctor/sign-in);/*首页*/registry.addViewController(/index).setViewName(doctor/index);/*去登录*/registry.addViewController(/tosign-in).setViewName(doctor/sign-in);/*去注册*/registry.addViewController(/tosign-up).setViewName(doctor/sign-up);/*去忘记密码*/registry.addViewController(/torecoverpw).setViewName(doctor/pages-recoverpw);/*去修改个人信息*/registry.addViewController(/topro-edit).setViewName(doctor/main/profile-edit);/*去邮箱*/registry.addViewController(/toemail).setViewName(doctor/app/email-compose);/*去编辑病患表格*/registry.addViewController(/totable).setViewName(doctor/app/table-editable);/*去修改病患信息*/registry.addViewController(/toRePatientInfo).setViewName(doctor/app/rePatientInfo);/*去增加病患信息*/registry.addViewController(/toAddPatientInfo).setViewName(doctor/app/addPatientInfo);/*去群聊天*/registry.addViewController(/toChat).setViewName(doctor/main/chat);/*** 医生页* */}//自定义的国际化就生效了Beanpublic LocaleResolver localeResolver() {return new MyLocaleResolver();}//配置登录拦截器Overridepublic void addInterceptors(InterceptorRegistry registry) {registry.addInterceptor(new LoginHandlerInterceptor())/*拦截*/.addPathPatterns(/**)/*放行*/.excludePathPatterns(/tosign-in, /tosign-up, /sign-in, /sign-up, /torecoverpw, /recPwEmail, /recPw, /, /css/**, /js/**, /images/**, /app/**, /fonts/**, /fullcalendar/**);}}package com.liefox.controller;import com.liefox.pojo.Patient;
import com.liefox.pojo.User;
import com.liefox.service.PatientService;
import com.sun.org.apache.xpath.internal.operations.Mod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.UUID;/*** Author znz* Date 2021/4/21 下午 1:35**/
Controller
public class PatientController {Autowiredprivate PatientService patientService;AutowiredJavaMailSenderImpl mailSender;/*获取全部病者信息*/RequestMapping(/getPatientInfo)public String getPatientInfo(Model model) {ListPatient patientInfo patientService.getPatientInfo();model.addAttribute(patientInfos, patientInfo);return doctor/app/table-editable;}/*删除病人信息根据UUID*/RequestMapping(/delPatientInfoByUUID/{UUID})public String delPatientInfoByUUID(PathVariable(UUID) String UUID) {patientService.delPatientInfoByUUID(UUID);return redirect:/getPatientInfo;}/*获取病人信息根据UUID*/RequestMapping(/getPatientInfoByUUID/{UUID})public String getPatientInfoByUUID(PathVariable(UUID) String UUID, Model model) {Patient patientInfoByUUID patientService.getPatientInfoByUUID(UUID);System.out.println(patientInfoByUUID);model.addAttribute(patientInfoByUUID, patientInfoByUUID);return doctor/app/rePatientInfo;}/*更新病人信息根据UUID*/RequestMapping(/upPatientInfoByUUID)public String upPatientInfoByEmail(Patient patient) {patientService.upPatientInfoByUUID(patient);return redirect:/getPatientInfo;}/*去新增病患页*/RequestMapping(/toAddPatientInfo)public String toAddPatientInfo(Model model) {String uuid UUID.randomUUID().toString();model.addAttribute(uuid, uuid);return doctor/app/addPatientInfo;}/*新增病患*/RequestMapping(/addPatientInfo)public String addPatientInfo(Patient patient, Model model) {int i patientService.addPatientInfo(patient);model.addAttribute(msg, 添加成功);return redirect:/getPatientInfo;}/*去发邮件页面*/RequestMapping(/toEmail/{Email})public String toEmail(PathVariable(Email) String Email, Model model) {model.addAttribute(PatientEmail, Email);return doctor/app/email-compose;}/*发邮件给病者*/RequestMapping(/sentEmail)public String recPwEmail(String ToEmail, String CcEmail, String subject, String Message,HttpSession session, Model model) {try {//邮件设置SimpleMailMessage message new SimpleMailMessage();//主题message.setSubject(subject);//内容message.setText(Message);//收件人message.setTo(ToEmail);//发件人message.setFrom(CcEmail);//发送mailSender.send(message);model.addAttribute(info, 邮件发送成功);return doctor/app/email-compose;} catch (Exception e) {model.addAttribute(info, 邮箱地址不正确);return doctor/app/email-compose;}}}package com.liefox.controller;import com.liefox.pojo.Patient;
import com.liefox.pojo.User;
import com.liefox.service.PatientService;
import com.liefox.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpSession;
import java.util.List;/*** Author znz* Date 2021/4/18 下午 5:30**/
Controller
public class UserController {Autowiredprivate UserService userService;AutowiredJavaMailSenderImpl mailSender;Autowiredprivate PatientService patientService;/*** 生成6位随机数验证码*/public static int randomCode() {return (int) ((Math.random() * 9 1) * 100000);}/*** i:验证码*/static int i randomCode();/*注册*/PostMapping(/sign-up)public String signup(User user, Model model) {try {int i userService.Signup(user);if (i ! 0) {System.out.println(user 》注册成功);model.addAttribute(msg, 注册成功);return /doctor/sign-in;}} catch (Exception e) {System.err.println(user 注册失败);model.addAttribute(msg, 该邮箱已注册);return /doctor/sign-up;}return null;}/*登录*/RequestMapping(/sign-in)public String signin(User user, Model model, HttpSession session, String Email) {User signin userService.Signin(user);User userInfo userService.getUserInfo(Email);System.out.println(userInfo 用户信息);String userName userService.getUserName(user.getEmail(), user.getPassword());if (signin ! null) {/*用户信息*/session.setAttribute(UserInfo, userInfo);/*登录拦截*/session.setAttribute(loginUser, userName);/*获取病人病情信息*/ListPatient patientInfo patientService.getPatientInfo();long count patientInfo.stream().count();model.addAttribute(patientInfos,patientInfo);model.addAttribute(count,count);/*获取医生信息*/ListUser userinfo userService.getUser();model.addAttribute(userInfos,userinfo);/**/session.setAttribute(Email, Email);System.out.println(user 》登录成功);return /doctor/index;} else {System.err.println(user 》登录失败);model.addAttribute(msg, 邮箱地址或密码错误!);return /doctor/sign-in;}}/*去首页*/RequestMapping(/toindex)public String toindex(Model model){/*获取病人病情信息*/ListPatient patientInfo patientService.getPatientInfo();model.addAttribute(patientInfos, patientInfo);long count patientInfo.stream().count();model.addAttribute(count,count);/*获取医生信息*/ListUser user userService.getUser();model.addAttribute(userInfos,user);return /doctor/index;}/*注销*/RequestMapping(/logout)public String logout(HttpSession session) {session.removeAttribute(loginUser);return redirect:/sign-in.html;}/*忘记密码发邮件*/RequestMapping(/recPwEmail)public String recPwEmail(String Email, HttpSession session, Model model) {System.out.println(Email 发送了验证码);System.err.println(i);session.setAttribute(Email, Email);try {//邮件设置SimpleMailMessage message new SimpleMailMessage();//主题message.setSubject(Shiqi-验证码);//内容-验证码message.setText(String.valueOf(i));//收件人message.setTo(Email);//发件人message.setFrom(2606097218qq.com);//发送mailSender.send(message);model.addAttribute(info, 验证码发送成功);return /doctor/pages-recoverpw;} catch (Exception e) {System.err.println(cs);model.addAttribute(info, 邮箱地址不正确);return /doctor/pages-recoverpw;}}/*判断验证码正确,并重置密码*/RequestMapping(/recPw)public String recPw(String Email, int token, String Password, Model model) {System.out.println(Email 重置密码为》 Password 输入的验证码为 i);if (token i) {userService.recPw(Email, Password);model.addAttribute(info, 修改成功);return /doctor/sign-in;} else {model.addAttribute(error, 验证码错误);return /doctor/pages-recoverpw;}}/*查看个人信息页面*/RequestMapping(/getUserInfo)public String getUserInfo() {return /doctor/main/profile-edit;}/*修改个人信息*/RequestMapping(/updateUserInfo)public String updateUserInfo(User user, Model model) {int i userService.updateUserInfo(user);if (i ! 0) {model.addAttribute(msg,下次登录生效);return /doctor/main/profile-edit;}else {System.err.println(111111111);model.addAttribute(msg,不修改就别乱点);return /doctor/main/profile-edit;}}/*修改密码*/RequestMapping(/upPw)public String upPw(String Email,String Password,Model model){userService.upPw(Email, Password);model.addAttribute(info,修改成功);return doctor/sign-in;}}五项目总结
整个系统功能模块不是很多但是系统选题立意新颖功能简洁明了个性功能鲜明突出像邮件发送、图片报表展示和统计等可以做毕业设计或课程设计使用。