计算机Java项目|基于Springboot实现患者管理系统

 作者主页:编程指南针

作者简介:Java领域优质创作者、CSDN博客专家 、掘金特邀作者、多年架构师设计经验、腾讯课堂常驻讲师

主要内容:Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助

文末获取源码 

项目编号:KS-032

一,项目简介

医院病患管理,Springboot+Thymeleaf+BootStrap+Mybatis,页面好看,功能完全.有登录权限拦截、忘记密码、发送邮件等功能。主要包含病患管理、信息统计、用户注册、用户登陆、病患联系等功能

二,环境介绍

语言环境: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 {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

        //登录成功之后,应该有用户的session
        Object loginUser = request.getSession().getAttribute("loginUser");


        if (loginUser == null) {
            System.err.println("loginUserSession=>"+loginUser);
            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 {
    //解析请求
    @Override
    public Locale resolveLocale(HttpServletRequest httpServletRequest) {
        //获取请求中的语言参数
        String language = httpServletRequest.getParameter("l");
        Locale locale = Locale.getDefault();//如果没有就使用默认值
        //如果请求的链接携带了国际化的参数
        if (!StringUtils.isEmpty(language)) {
            //zh_CN
            String[] split = language.split("_");
            //国家地区
            locale = new Locale(split[0], split[1]);
        }
        return locale;
    }

    @Override
    public 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 {
    @Override
    public 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");


        /**
         * 医生页
         * */
    }

    //自定义的国际化就生效了
    @Bean
    public LocaleResolver localeResolver() {
        return new MyLocaleResolver();
    }


    //配置登录拦截器
    @Override
    public 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 {

    @Autowired
    private PatientService patientService;
    @Autowired
    JavaMailSenderImpl mailSender;

    /*获取全部病者信息*/
    @RequestMapping("/getPatientInfo")
    public String getPatientInfo(Model model) {
        List<Patient> 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 {

    @Autowired
    private UserService userService;
    @Autowired
    JavaMailSenderImpl mailSender;
    @Autowired
    private 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);
            /*获取病人病情信息*/
            List<Patient> patientInfo = patientService.getPatientInfo();
            long count = patientInfo.stream().count();
            model.addAttribute("patientInfos",patientInfo);
            model.addAttribute("count",count);
            /*获取医生信息*/
            List<User> 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){
        /*获取病人病情信息*/
        List<Patient> patientInfo = patientService.getPatientInfo();
        model.addAttribute("patientInfos", patientInfo);
        long count = patientInfo.stream().count();
        model.addAttribute("count",count);
        /*获取医生信息*/
        List<User> 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("2606097218@qq.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";


    }


}

五,项目总结

整个系统功能模块不是很多,但是系统选题立意新颖,功能简洁明了,个性功能鲜明突出,像邮件发送、图片报表展示和统计等,可以做毕业设计或课程设计使用。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/298068.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

new FormData 同时发送表单 json 以及文件二进制流

需要新增时同时发送表单 json 以及对应的文件即可使用以下方法传参 let formDataParams new FormData(); 首先通过 new FormData&#xff08;&#xff09; 创建你需要最后发送的表单 接着将你的对象 json 存储&#xff0c;注意使用 new Blob 创建大表单转换成 json 格式。以…

交换机04_远程连接

通过远程管理方式连接交换机 1、telnet简介 telnet 是应用层协议 基于传输层TCP协议的&#xff0c;默认端口&#xff1a;23 采用的是明文密码方式 不是很安全&#xff0c;一般用于内网管理。 2、ssh协议简介 ssh 是应用层的协议&#xff0c;基于传输层的TCP协议&#x…

新手小白必了解c语言之字符串函数

本篇介绍字符串库函数为 目录 引言 一&#xff1a;字符串函数的头文件为#include 二&#xff1a;求字符串长度函数 &#xff08;strlen&#xff09; 1.函数介绍 2.函数使用举例 3.模拟实现 三&#xff1a;字符串复制函数(strcpy) 1.函数介绍 2.函数使用举例 3.模…

lombok注解 @Data使用在继承类上时出现警告解决

一、警告问题 1、Data注解 Data 包含了 ToString、EqualsAndHashCode、Getter / Setter和RequiredArgsConstructor的功能。 当使用 Data注解时&#xff0c;则有了 EqualsAndHashCode注解&#xff08;即EqualsAndHashCode(callSuperfalse)&#xff09;&#xff0c;那么就会在此…

uni-app 经验分享,从入门到离职(实战篇)——模拟从后台获取图片路径数据后授权相册以及保存图片到本地(手机相册)

文章目录 &#x1f4cb;前言⏬关于专栏 &#x1f3af;需求描述&#x1f3af;前置知识点&#x1f9e9;uni.showLoading()&#x1f9e9;uni.authorize()&#x1f9e9;uni.downloadFile()&#x1f9e9;uni.saveImageToPhotosAlbum() &#x1f3af;演示代码&#x1f9e9;关于图片接…

YOLOv5改进 | 2023 | SCConv空间和通道重构卷积(精细化检测,又轻量又提点)

一、本文介绍 本文给大家带来的改进内容是SCConv,即空间和通道重构卷积,是一种发布于2023.9月份的一个新的改进机制。它的核心创新在于能够同时处理图像的空间(形状、结构)和通道(色彩、深度)信息,这样的处理方式使得SCConv在分析图像时更加精细和高效。这种技术不仅适…

DP专题9 理解01背包问题

本题链接&#xff1a;晴问算法 题目&#xff1a; 样例&#xff1a; 输入 5 8 3 5 1 2 2 4 5 2 1 3 输出 10 思路&#xff1a; 对于 01 背包问题&#xff0c;我们需要明确 DP 数组的含义&#xff0c;这里 经典的 01 背包问题可以用 二维DP进行表示。 即&#xff1a; dp[ i ]…

【C++】类和对象详解(类的使用,this指针)

文章目录 前言面向过程和面向对象的初步认识类的引入类的定义类的访问限定符和封装性访问限定符封装性 类的作用域类的实例化类对象模型如何计算类对象的大小类对象的存储方式猜测结构体内存对齐规则 this指针this指针的引出this指针的特性 总结 前言 提示&#xff1a;这里可以…

红帽Redhat安装教程及安装出错(Liunx)

一、红帽5安装 1.打开vmware,新建虚拟机。或者文件→新建虚拟机 2.自定义,下一步 3.下一步 4.稍后安装操作系统,下一步 5.linux 红帽5 64位,下一步 6.给虚拟机取名字,选择安装路径。下一步 7.下一步(可以根据自己的电脑配置稍微增加数量) 8.4GB 下一步 9.仅主机(根据需…

运维工程师——敢问路在何方!

✅作者简介&#xff1a;2022年博客新星 第八。热爱国学的Java后端开发者&#xff0c;修心和技术同步精进。 &#x1f34e;个人主页&#xff1a;Java Fans的博客 &#x1f34a;个人信条&#xff1a;不迁怒&#xff0c;不贰过。小知识&#xff0c;大智慧。 ✨特色专栏&#xff1a…

[NISACTF 2022]popchains

[NISACTF 2022]popchains wp 题目代码&#xff1a; Happy New Year~ MAKE A WISH <?phpecho Happy New Year~ MAKE A WISH<br>;if(isset($_GET[wish])){unserialize($_GET[wish]); } else{$anew Road_is_Long;highlight_file(__FILE__); } /**********************…

RTT打印时间戳

官方的RTT VIEWER没有打印接收时间戳的功能&#xff0c;经过查找后发现可以有以下三种打印时间戳的方法。 第三方的RTT上位机ExtraPutty自己打印 第三方的RTT上位机 码云上有一个RTT_T2的仓库&#xff0c;基于python qt包写的画面&#xff0c;通过pylink来jlink通信。 优点…

CorelDRAW 2023 中文破解、终身永久版 (附序列号)

CorelDRAW2023是一款非常专业的电脑图像设计工具。该产品推出了全新的2023版本&#xff0c;在功能和体验上更进一步&#xff0c;最新的填充和透明设备功能可以完全控制任何类型的纹理&#xff0c;适用于网络摄影、印刷项目、艺术、排版等&#xff0c;让你可以更好的进行图像设计…

安全加密基础—基本概念、keytool、openssl

安全加密基础—基本概念、keytool、openssl 目录 前言 一、概念 明文通信 无密钥密文通信 对称加密 非对称加密 数字签名 消息摘要(MD5) CA数字证书(解决公钥分发的问题) HTTPS 相关文件扩展名 常用后缀名 普通的pem文件内容 二、keytool 2.1常用的命令如下 2…

网络优化篇(一)---------TCP重传性能优化

本文通过一个TCP重传优化的实际问题,详细讲解问题的分析、定位、优化过程。 通过本文你将学到: 如何通过linux命令和/proc文件系统分析TCP性能数据如何通过linux命令和netlink api分析某个具体的TCP连接的性能数据如何通过bcc工具分析TCP性能数据如何通过调整系统参数优化TCP重…

第1章 线性回归

一、基本概念 1、线性模型 2、线性模型可以看成&#xff1a;单层的神经网络 输入维度&#xff1a;d 输出维度&#xff1a;1 每个箭头代表权重 一个输入层&#xff0c;一个输出层 单层神经网络&#xff1a;带权重的层为1&#xff08;将权重和输入层放在一起&#xff09; 3、…

从零开始C++精讲:第一篇——C++入门

文章目录 前言一、C关键字二、命名空间2.1引子2.2命名空间定义2.3命名空间的使用 三、C输入和输出3.1输出3.2输入 四、缺省参数4.1全缺省4.2半缺省 五、函数重载5.1重载概念 六、引用6.1定义6.2引用的使用示例6.2.1引用作参数6.2.1引用作返回值 6.3传值、传引用效率比较6.4常引…

真空引水罐 虹吸抽水机 负压虹吸罐 农业灌溉工作原理动画介绍

​ 1&#xff1a;真空引水罐虹吸抽水机虹吸罐介绍 真空引水罐是一种水泵吸水设备&#xff0c;也被称为真空罐、吸水罐或自动引水装置。它是一个密封的罐体&#xff0c;被串联在泵前的吸水管上&#xff0c;能够使水泵的吸水口从负压吸水变为正压吸水。使用真空引水罐可以节省真…

彻底解决vue-video-player视频铺满div

需求 最近需要接入海康视频摄像头&#xff0c;然后把视频的画面接入到自己的网站系统中。以前对接过rtsp固定IP的显示视频&#xff0c;这次的不一样&#xff0c;没有了固定IP。海康的解决办法是&#xff0c;摄像头通过配置服务器到萤石云平台&#xff0c;然后购买企业版账号和…

解决vue3中watch 监听不到旧值的问题,亲测有效!

问题描述 这个问题是我在公司vue3项目的时候发现的一个问题&#xff0c;watch 在监听对象/数组变量的变化时&#xff0c;发现对象的数据变化时 旧数据 获取到的和新数据是一样的 类似于下面这样 const objref({a:我是原来的值,b:6, })obj.a改变值watch(obj,(nel,old)>{ c…
最新文章