大家好,我是java1234_小锋老师,看到一个不错的Springboot+Vue的医院管理系统,分享下哈。
项目视频演示
【免费】springboot+vue医院管理系统 Java毕业设计_哔哩哔哩_bilibili【免费】springboot+vue医院管理系统 Java毕业设计项目来自互联网,免费开源分享,严禁商业。更多毕业设源码:http://www.java1234.com/a/bysj/javaweb/, 视频播放量 556、弹幕量 1、点赞数 28、投硬币枚数 14、收藏人数 23、转发人数 3, 视频作者 java1234官方, 作者简介 公众号:java1234 微信:java9266,相关视频:【免费】javaweb小区停车位管理系统毕业设计,【免费】springboot+vue校园社团管理系统系统 Java毕业设计,【免费】springboot+vue学生选课管理系统毕业设计演示,【免费】javaweb实验室管理系统毕业设计,【免费】javaweb超市管理系统高级版毕业设计,【免费】SpringBoot + Vue + ElementUI 人力资源管理系统 Java毕业设计,【免费】springboot+vue选课/排课管理系统系统 Java毕业设计,【免费】javaweb企业人力资源管理系统毕业设计,2023版uniapp从入门到上天视频教程(Java后端无废话版),火爆更新中...,【免费】javaweb超市管理系统毕业设计https://www.bilibili.com/video/BV1CG411S7n9/
项目介绍
这是一个在线医院管理系统,使用Maven进行项目管理,基于springboot+mybatis框架开发的项目,mysql底层数据库,前端采用Vue+ElementPlus,redis缓存,作为初学springboot+vue前后端分离架构的同学是一个很不错的项目,如果想在此基础上面进行在线医院管理系统的增强,也是一个不错的方案。
项目分患者,医生,管理员三大角色,不同角色对应不同的权限;比如患者权限,可以在线挂号,缴费,查看自己的病历;医生可以在线写病历,开药,给病人申请住院等。管理员拥有最高权限,包括病人管理,医生管理,医生排班,药瓶管理,病床管理等。
系统展示
部分代码
后端管理员模块:
package com.rabbiter.hospital.controller;
import com.rabbiter.hospital.pojo.Admin;
import com.rabbiter.hospital.pojo.Doctor;
import com.rabbiter.hospital.service.AdminService;
import com.rabbiter.hospital.service.DoctorService;
import com.rabbiter.hospital.service.OrderService;
import com.rabbiter.hospital.service.PatientService;
import com.rabbiter.hospital.utils.JwtUtil;
import com.rabbiter.hospital.utils.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("admin")
public class AdminController {
@Autowired
private AdminService adminService;
@Autowired
private DoctorService doctorService;
@Autowired
private PatientService patientService;
@Autowired
private OrderService orderService;
/**
* 登录数据验证
*/
@PostMapping("/login")
@ResponseBody
public ResponseData login(@RequestParam("aId") int aId, @RequestParam("aPassword") String aPassword) {
Admin admin = this.adminService.login(aId, aPassword);
if (admin != null) {
Map<String,String> map = new HashMap<>();
map.put("aName", admin.getAName());
map.put("aId", String.valueOf(admin.getAId()));
String token = JwtUtil.getToken(map);
map.put("token", token);
return ResponseData.success("登录成功", map);
} else {
return ResponseData.fail("登录失败,密码或账号错误");
}
}
/**
* 分页模糊查询所有医护人员信息
*/
@RequestMapping("findAllDoctors")
public ResponseData findAllDoctors(@RequestParam(value = "pageNumber") int pageNumber, @RequestParam(value = "size") int size, @RequestParam(value = "query") String query){
return ResponseData.success("返回医护人员信息成功", this.doctorService.findAllDoctors(pageNumber, size, query));
}
/**
* 根据id查找医生
*/
@RequestMapping("findDoctor")
public ResponseData findDoctor(@RequestParam(value = "dId") int dId) {
return ResponseData.success("查询医生成功", this.doctorService.findDoctor(dId));
}
/**
* 增加医生信息
*/
@RequestMapping("addDoctor")
@ResponseBody
public ResponseData addDoctor(Doctor doctor) {
Boolean bo = this.doctorService.addDoctor(doctor);
if (bo) {
return ResponseData.success("增加医生信息成功");
}
return ResponseData.fail("增加医生信息失败!账号或已被占用");
}
/**
* 删除医生信息
*/
@RequestMapping("deleteDoctor")
public ResponseData deleteDoctor(@RequestParam(value = "dId") int dId) {
Boolean bo = this.doctorService.deleteDoctor(dId);
if (bo){
return ResponseData.success("删除医生信息成功");
}
return ResponseData.fail("删除医生信息失败");
}
/**
* 修改医生信息
* bug: dState会自动更新为0
*/
@RequestMapping("modifyDoctor")
@ResponseBody
public ResponseData modifyDoctor(Doctor doctor) {
this.doctorService.modifyDoctor(doctor);
return ResponseData.success("修改医生信息成功");
}
/**
* 分页模糊查询所有患者信息
*/
@RequestMapping("findAllPatients")
public ResponseData findAllPatients(@RequestParam(value = "pageNumber") int pageNumber, @RequestParam(value = "size") int size, @RequestParam(value = "query") String query){
return ResponseData.success("返回患者信息成功", this.patientService.findAllPatients(pageNumber, size, query));
}
/**
* 删除患者信息
*/
@RequestMapping("deletePatient")
public ResponseData deletePatient(@RequestParam(value = "pId") int pId) {
Boolean bo = this.patientService.deletePatient(pId);
if (bo){
return ResponseData.success("删除患者信息成功");
}
return ResponseData.fail("删除患者信息失败");
}
/**
* 分页模糊查询所有挂号信息
*/
@RequestMapping("findAllOrders")
public ResponseData findAllOrders(@RequestParam(value = "pageNumber") int pageNumber, @RequestParam(value = "size") int size, @RequestParam(value = "query") String query){
return ResponseData.success("返回挂号信息成功", this.orderService.findAllOrders(pageNumber, size, query));
}
/**
* 删除挂号信息
*/
@RequestMapping("deleteOrder")
public ResponseData deleteOrder(@RequestParam(value = "oId") int oId) {
Boolean bo = this.orderService.deleteOrder(oId);
if (bo){
return ResponseData.success("删除挂号信息成功");
}
return ResponseData.fail("删除挂号信息失败");
}
}
前端用户登录代码:
<template>
<div class="login-index" :style="backgroundDiv">
<div class="mid-index">
<i
style="
top: 40px;
font-size: 28px;
left: 20px;
position: absolute;
"
class="iconfont icon-r-love"
>
登录医院管理系统
</i>
<el-form
:model="loginForm"
:rules="loginRules"
ref="ruleForm"
class="loginForm"
>
<el-form-item prop="id">
<!--必须绑定v-model输入框才能输入字符---->
<el-input v-model="loginForm.id">
<i
slot="prefix"
class="iconfont icon-r-user1"
style="font-size: 22px"
></i>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" show-password>
<i
slot="prefix"
class="iconfont icon-r-lock"
style="font-size: 22px"
></i>
</el-input>
</el-form-item>
<!-- 角色单选框 -->
<el-form-item class="role">
<el-radio-group v-model="role" size="small">
<el-radio label="患者"></el-radio>
<el-radio label="医生"></el-radio>
<el-radio label="管理员"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item class="btns">
<el-button
type="primary"
style="font-size: 18px"
@click="submitLoginForm('ruleForm')"
>
<i
class="iconfont icon-r-yes"
style="font-size: 20px"
></i>
登录</el-button
>
<el-button
type="info"
style="font-size: 18px"
@click="registerFormVisible = true"
>
<i
class="iconfont icon-r-add"
style="font-size: 20px"
></i>
注册新账号</el-button
>
</el-form-item>
<el-form-item>
<div class="options"><a href="http://www.java1234.com/a/bysj/javaweb/" target="_blank"><font color="red"><b>Java1234收藏整理</b></font></a></div>
</el-form-item>
</el-form>
</div>
<!-- 注册对话框 -->
<el-dialog title="用户注册" :visible.sync="registerFormVisible">
<el-form
class="findPassword"
:model="registerForm"
:rules="registerRules"
ref="registerForm"
>
<el-form-item label="账号" label-width="80px" prop="pId">
<el-input v-model.number="registerForm.pId"></el-input>
</el-form-item>
<el-form-item label="性别" label-width="80px">
<el-radio v-model="registerForm.pGender" label="男"
>男</el-radio
>
<el-radio v-model="registerForm.pGender" label="女"
>女</el-radio
>
</el-form-item>
<el-form-item label="密码" label-width="80px" prop="pPassword">
<el-input v-model="registerForm.pPassword"></el-input>
</el-form-item>
<el-form-item label="姓名" label-width="80px" prop="pName">
<el-input v-model="registerForm.pName"></el-input>
</el-form-item>
<el-form-item
label="出生日期"
label-width="80px"
prop="pBirthday"
>
<el-date-picker
v-model="registerForm.pBirthday"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
<el-form-item label="手机号" label-width="80px" prop="pPhone">
<el-input v-model="registerForm.pPhone"></el-input>
</el-form-item>
<el-form-item label="邮箱" label-width="80px" prop="pEmail">
<el-input v-model="registerForm.pEmail"></el-input>
</el-form-item>
<el-form-item label="身份证号" label-width="80px" prop="pCard">
<el-input v-model="registerForm.pCard"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button
@click="registerFormVisible = false"
style="font-size: 18px"
><i
class="iconfont icon-r-left"
style="font-size: 20px"
></i>
取 消</el-button
>
<el-button
type="primary"
@click="registerClick('registerForm')"
style="font-size: 18px"
><i class="iconfont icon-r-yes" style="font-size: 20px"></i>
确 定</el-button
>
</div>
</el-dialog>
</div>
</template>
<script>
import request from "@/utils/request.js";
import { setToken } from "@/utils/storage.js";
import { toLoad } from "@/utils/initialize.js";
export default {
name: "Login",
data() {
var validateMoblie = (rule, value, callback) => {
if (value === undefined) {
callback(new Error("请输入手机号"));
} else {
let reg =
/^1(3[0-9]|4[5,7]|5[0,1,2,3,5,6,7,8,9]|6[2,5,6,7]|7[0,1,7,8]|8[0-9]|9[1,8,9])\d{8}$/;
if (!reg.test(value)) {
callback(new Error("请输入合法的手机号"));
}
callback();
}
};
var validateCard = (rule, value, callback) => {
if (value === undefined) {
callback(new Error("请输入身份证号"));
} else {
let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if (!reg.test(value)) {
callback(new Error("请输入合法的身份证号码"));
}
callback();
}
};
var validatePass = (rule, value, callback) => {
if (value === "") {
callback(new Error("请输入密码"));
} else {
if (this.findForm.checkPassword !== "") {
this.$refs.findForm.validateField("checkPassword");
}
callback();
}
};
var validatePass2 = (rule, value, callback) => {
if (value === "") {
callback(new Error("请再次输入密码"));
} else if (value !== this.findForm.newPassword) {
callback(new Error("两次输入密码不一致!"));
} else {
callback();
}
};
return {
//背景图片
backgroundDiv: {
backgroundImage:
"url(" + require("../assets/doctor.jpeg") + ")",
backgroundRepeat: "no-repeat",
backgroundSize: "100% 100%",
},
loginForm: {
id: "",
password: "",
},
loginRules: {
id: [
{
required: true,
message: "请输入账号编号",
trigger: "blur",
},
{
min: 3,
max: 50,
message: "长度在 3到 50 个字符",
trigger: "blur",
},
],
password: [
{ required: true, message: "请输入密码", trigger: "blur" },
],
},
role: "患者",
findRole: "患者",
//找回密码
findFormVisible: false,
findForm: {
code: "",
newPassword: "",
checkPassword: "",
pEmail: "",
},
findRules: {
pEmail: [
{
required: true,
message: "请输入邮箱地址",
trigger: "blur",
},
{
type: "email",
message: "请输入正确的邮箱地址",
trigger: ["blur", "change"],
},
],
code: [
{
required: true,
message: "请输入验证码",
trigger: "blur",
},
],
newPassword: [{ validator: validatePass, trigger: "blur" }],
checkPassword: [{ validator: validatePass2, trigger: "blur" }],
},
totalTime: 60,
content: "发送验证码",
canClick: true,
//注册
registerFormVisible: false,
registerForm: {
pGender: "男",
},
registerRules: {
pId: [
{ required: true, message: "请输入账号", trigger: "blur" },
{
type: "number",
message: "账号必须数字类型",
trigger: "blur",
},
],
pPassword: [
{ required: true, message: "请输入密码", trigger: "blur" },
{
min: 4,
max: 50,
message: "长度在 4到 50 个字符",
trigger: "blur",
},
],
pName: [
{ required: true, message: "请输入姓名", trigger: "blur" },
{
min: 2,
max: 8,
message: "长度在 2到 8 个字符",
trigger: "blur",
},
],
pEmail: [
{ required: true, message: "请输入邮箱", trigger: "blur" },
{
type: "email",
message: "请输入正确的邮箱地址",
trigger: ["blur", "change"],
},
],
pPhone: [{ validator: validateMoblie }],
pCard: [{ validator: validateCard }],
pBirthday: [
{
required: true,
message: "选择出生日期",
trigger: "blur",
},
],
},
};
},
mounted() {
toLoad()
},
methods: {
//点击注册确认按钮
registerClick(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
request
.get("patient/addPatient", {
params: {
pId: this.registerForm.pId,
pName: this.registerForm.pName,
pPassword: this.registerForm.pPassword,
pGender: this.registerForm.pGender,
pEmail: this.registerForm.pEmail,
pPhone: this.registerForm.pPhone,
pCard: this.registerForm.pCard,
pBirthday: this.registerForm.pBirthday,
},
})
.then((res) => {
if (res.data.status !== 200)
return this.$message.error(
"账号或邮箱已被占用!"
);
this.registerFormVisible = false;
this.$message.success("注册成功!");
console.log(res);
});
} else {
console.log("error submit!!");
return false;
}
});
},
// 点击找回密码确认按钮
findPassword(findForm) {
this.$refs[findForm].validate((valid) => {
if (valid) {
//如果是选中患者
if (this.findRole === "患者") {
request
.get("patient/findPassword", {
params: {
pEmail: this.findForm.pEmail,
pPassword: this.findForm.newPassword,
code: this.findForm.code,
},
})
.then((res) => {
if (res.data.status !== 200)
return this.$message.error(
"验证码错误或者已过期!!!"
);
this.$message.success("密码修改成功!!请登录");
this.findFormVisible = false;
});
}
//如果是选中管理员
if (this.findRole === "管理员") {
request
.get("admin/findPassword", {
params: {
aEmail: this.findForm.pEmail,
aPassword: this.findForm.newPassword,
code: this.findForm.code,
},
})
.then((res) => {
if (res.data.status !== 200)
return this.$message.error(
"验证码错误或者已过期!!!"
);
this.$message.success("密码修改成功!!请登录");
this.findFormVisible = false;
});
}
//如果是选中患者
if (this.findRole === "医生") {
request
.get("doctor/findPassword", {
params: {
dEmail: this.findForm.pEmail,
dPassword: this.findForm.newPassword,
code: this.findForm.code,
},
})
.then((res) => {
if (res.data.status !== 200)
return this.$message.error(
"验证码错误或者已过期!!!"
);
this.$message.success("密码修改成功!!请登录");
this.findFormVisible = false;
});
}
} else {
console.log("error submit!!");
return false;
}
});
},
//点击发送验证码按钮
sendEmail() {
//倒计时
if (!this.canClick) return; //改动的是这两行代码
this.canClick = false;
this.content = this.totalTime + "s后重新发送";
let clock = window.setInterval(() => {
this.totalTime--;
this.content = this.totalTime + "s后重新发送";
if (this.totalTime < 0) {
window.clearInterval(clock);
this.content = "重新发送验证码";
this.totalTime = 10;
this.canClick = true; //这里重新开启
}
}, 1000);
//如果是选中患者
if (this.findRole === "患者") {
request
.get("patient/sendEmail", {
params: {
pEmail: this.findForm.pEmail,
},
})
.then((res) => {
console.log(this.findForm.pEmail);
console.log(res);
if (res.data.status !== 200)
return this.$message.error(
"该邮箱暂未注册!请先注册!"
);
this.$message.success("验证码发送成功!");
});
}
//如果是选中管理员
if (this.findRole === "管理员") {
request
.get("admin/sendEmail", {
params: {
aEmail: this.findForm.pEmail,
},
})
.then((res) => {
console.log(this.findForm.pEmail);
console.log(res);
if (res.data.status !== 200)
return this.$message.error(
"该邮箱暂未注册!请先注册!"
);
this.$message.success("验证码发送成功!");
});
}
//如果是选中医生
if (this.findRole === "医生") {
request
.get("doctor/sendEmail", {
params: {
dEmail: this.findForm.pEmail,
},
})
.then((res) => {
console.log(this.findForm.pEmail);
console.log(res);
if (res.data.status !== 200)
return this.$message.error(
"该邮箱暂未注册!请先注册!"
);
this.$message.success("验证码发送成功!");
});
}
},
//提交表单
submitLoginForm(formName) {
if (!/^\d+$/.test(this.loginForm.id)) {
this.$message.error("用户名有误");
return;
}
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.role === "管理员") {
var params = new URLSearchParams();
params.append("aId", this.loginForm.id);
params.append("aPassword", this.loginForm.password);
request
.post("admin/login", params)
.then((res) => {
console.log(res);
if (res.data.status != 200)
return this.$message.error(
"用户名或密码错误"
);
setToken(res.data.data.token);
this.$router.push("/adminLayout");
})
.catch((e) => {
console.log(e);
if (
e.response == undefined ||
e.response.data == undefined
) {
this.$message({
showClose: true,
message: e,
type: "error",
duration: 5000,
});
} else {
this.$message({
showClose: true,
message: e.response.data,
type: "error",
duration: 5000,
});
}
});
}
if (this.role === "医生") {
var params1 = new URLSearchParams();
params1.append("dId", this.loginForm.id);
params1.append("dPassword", this.loginForm.password);
request
.post("doctor/login", params1)
.then((res) => {
console.log(res);
if (res.data.status != 200)
return this.$message.error(
"用户名或密码错误"
);
setToken(res.data.data.token);
this.$router.push("/doctorLayout");
})
.catch((e) => {
console.log(e);
if (
e.response == undefined ||
e.response.data == undefined
) {
this.$message({
showClose: true,
message: e,
type: "error",
duration: 5000,
});
} else {
this.$message({
showClose: true,
message: e.response.data,
type: "error",
duration: 5000,
});
}
});
}
if (this.role === "患者") {
var params2 = new URLSearchParams();
params2.append("pId", this.loginForm.id);
params2.append("pPassword", this.loginForm.password);
request
.post("patient/login", params2)
.then((res) => {
console.log(res);
if (res.data.status != 200)
return this.$message.error(
"用户名或密码错误"
);
setToken(res.data.data.token);
this.$router.push("/patientLayout");
})
.catch((e) => {
console.log(e);
if (
e.response == undefined ||
e.response.data == undefined
) {
this.$message({
showClose: true,
message: e,
type: "error",
duration: 5000,
});
} else {
this.$message({
showClose: true,
message: e.response.data,
type: "error",
duration: 5000,
});
}
});
}
} else {
console.log("error submit!!");
return false;
}
});
},
}
};
</script>
<style lang="scss">
.codeInput {
width: 70%;
margin-right: 10px;
}
.findPassword {
margin-top: 0px;
}
.login-index {
background: #2b4b6b;
height: 100%;
position: relative;
}
.mid-index {
opacity: 0.9;
width: 450px;
height: 390px;
background: white;
//绝对定位,相对于最左上角来说
position: absolute;
left: 70%;
top: 50%;
transform: translate(-50%, -50%);
}
.logo-index {
background: white;
height: 130px;
width: 130px;
border-radius: 50%;
padding: 10px;
//子绝父相,使一个div悬挂在另一个div上中间
position: absolute;
left: 50%;
top: 0;
transform: translate(-50%, -50%);
border: 1px solid #eee;
box-shadow: 0px 0px 10px #ddd;
img {
height: 100%;
width: 100%;
border-radius: 50%;
background: #eeeeee;
}
}
.loginForm {
margin-top: 120px;
}
.el-form-item {
margin-left: 20px;
margin-right: 20px;
}
//角色单选
.role {
margin-left: 90px;
margin-right: 90px;
}
//按钮
.btns {
display: flex;
justify-content: flex-end;
height: 25px;
}
</style>
源码下载
CSDN 1积分下载:https://download.csdn.net/download/caofeng891102/88519791
或者免费领取加小锋老师wx:java9266
热门推荐
免费分享一套 SpringBoot + Vue + ElementUI 的人力资源管理系统,挺漂亮的_java1234_小锋的博客-CSDN博客文章浏览阅读6.6k次,点赞23次,收藏53次。项目背景人力资源管理是企业运营中必不可少的一环,它关系到企业的前途与发展。尤其对于中小微企业来说,对企业的发展有着举足轻重的作用。随着近年来,政府对创业项目的大力扶持,我国创业型企业蓬勃发展。据统计,2019年,我国创业企业数量已达1810万余家,占全国企业数的97%,截止2020年,我国创业企业数量达到了2030万,同比增长10%。虽然我国创业企业的基数在不断增大,但是能够长久存活的企业却少之又少。https://blog.csdn.net/caoli201314/article/details/128348575
【精选】免费分享一个SpringBoot鲜花商城管理系统,很漂亮的_bootstrap花店个人中心系统_java1234_小锋的博客-CSDN博客文章浏览阅读3.2k次,点赞28次,收藏40次。大家好,我是锋哥,看到一个不错的SpringBoot鲜花商城管理系统,分享下哈。这是基于主流SpringBoot框架开发的项目,thymeleaf模版引擎,Mysql数据库,druid连接池,界面美观大方,可以作为学习参考以及课程设计参考用。1、主界面2,会员登录3,会员注册4,商品详情5,购物车页面6,订单页面7,后台管理-用户管理页面8,后台管理-分类管理页面9,后台管理-订单管理页面10,后台管理-商品添加_bootstrap花店个人中心系统https://blog.csdn.net/caoli201314/article/details/128434103免费分享一个springboot+vue校园宿舍管理系统,挺漂亮的-CSDN博客文章浏览阅读5.6k次,点赞57次,收藏132次。一款不错的springboot+vue校园宿舍管理系统https://blog.csdn.net/caoli201314/article/details/125705973
我写了一套SpringBoot微信小程序电商全栈就业实战课程,免费分享给CSDN的朋友们_java1234微信小程序电商_java1234_小锋的博客-CSDN博客文章浏览阅读4.7k次,点赞32次,收藏70次。大家好,我是你们的锋哥,最近发布了一套免费的Java全栈就业实战课程,逼格略高,专门为Java初学者就业而精心打造。希望你们喜欢!(文末领取)一,Java就业实战课程简介:本套课程采用主流技术栈实现,Mysql数据库,SpringBoot2+Mybatis Plus后端,微信小程序原生实现,Vue3.2+Element Plus实现后台管理。基于JWT技术实现前后端分离。微信小程序端涵盖了axios异步请求,Promise应用,swiper组件,自定义组件,应用了微信小程序提供的登录,支付,地_java1234微信小程序电商https://blog.csdn.net/caoli201314/article/details/124231153
我写了一套SpringBoot+SpringSecurity+Vue权限系统 实战课程,免费分享给CSDN的朋友们_springboot3 springsecurity6 vue_java1234_小锋的博客-CSDN博客文章浏览阅读6k次,点赞35次,收藏61次。一套优秀的SpringBoot+SpringSecurity+Vue权限系统实战课程_springboot3 springsecurity6 vuehttps://blog.csdn.net/caoli201314/article/details/127188639