基于SpringBoot的医院管理系统

news2024/10/6 8:25:20

目录

前言

 一、技术栈

二、系统功能介绍

病床信息管理

药房信息管理

个人中心管理

药房信息

病床类别

科室信息管理

三、核心代码

1、登录模块

 2、文件上传模块

3、代码封装


前言

随着信息互联网信息的飞速发展,医院也在创建着属于自己的管理系统。本文介绍了医院管理系统的开发全过程。通过分析企业对于医院管理系统的需求,创建了一个计算机管理医院管理系统的方案。文章介绍了医院管理系统的系统分析部分,包括可行性分析等,系统设计部分主要介绍了系统功能设计和数据库设计。

本医院管理系统管理员功能,个人中心,医生管理,护士管理,病床类别管理,药品类别管理,科室信息管理,内部论坛管理,系统管理。医生功能,个人中心,病床管理,药房管理,病人信息管理,药方信息管理。护士功能修改个人中心,查看病床管理,查看药房管理,查看病人信息管理,查看药方信息管理。因而具有一定的实用性。

本站是一个B/S模式系统,采用Spring Boot框架作为开发技术,MYSQL数据库设计开发,充分保证系统的稳定性。系统具有界面清晰、操作简单,功能齐全的特点,使得医院管理系统管理工作系统化、规范化。

 一、技术栈

末尾获取源码
SpringBoot+Vue+JS+ jQuery+Ajax...

二、系统功能介绍

病床信息管理

医院管理系统的医生可以管理病床信息,可以对病床信息添加修改删除操作。

药房信息管理

医生可以对药房信息进行添加,修改,删除操作。

 

个人中心管理

护士可以对个人中心里面的属于自己的信息进行修改操作。

药房信息

护士登录后,可以查看药房信息,可以在药房信息界面进行查询操作。

 

病床类别

管理员可以对病床类别进行添加,修改查询以及删除操作。

科室信息管理

管理员登录后可以对科室信息进行添加,修改,查询以及删除操作。

 

三、核心代码

1、登录模块

 
package com.controller;
 
 
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;
 
/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;
 
	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }
 
	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }
 
	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }
 
    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
 
    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }
 
    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }
 
    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

 2、文件上传模块

package com.controller;
 
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
 
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
 
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;
 
/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

3、代码封装

package com.utils;
 
import java.util.HashMap;
import java.util.Map;
 
/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}
 
	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}
 
	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

如何像人类一样写HTML之代码编辑器的选择与基础框架

文章目录 前言一、 HTML是什么&#xff1f;二、 HTML的发展历史三、 HTML的优点a. 简单易学b. 跨浏览器兼容性c. 良好的可读性 四、 超文本是什么&#xff1f;五、 代码编辑器的选择&#xff1a;VSCodea. 安装VSCodeb. 创建HTML文件方式1方式2 c. 编写HTML代码安装Live Server插…

【算法基础】数组和链表,动态数组,循环数组,链表的变种

目录 1 数组&#xff08;Array&#xff09; 1.1 定义和特点 1.2 基本操作 1.3 数组的时间复杂度 1.4 应用场景 2 链表&#xff08;Linked List&#xff09; 2.1 定义和特点&#xff1a; 2.1.1 单向链表&#xff08;Singly Linked List&#xff09; 2.1.2 双向链表&…

Axure RP9 引入eCharts图表

一、 ECharts 地址&#xff1a;https://echarts.apache.org/zh/index.html 概述&#xff1a;一个基于 JavaScript 的开源可视化图表库 提供了很多图标样式案例 二、 Axure引入eCharts图表步骤 步骤一&#xff1a;打开Axure&#xff0c;添加矩形元素&#xff0c;调整矩形所…

Mybatis 二级缓存

之前我们介绍过映射器与XML配置职责分离&#xff0c;本篇我们在此基础上介绍Mybatis中二级缓存的使用。 如果您对映射器与XML配置职责分离不太了解&#xff0c;建议您先进行了解后再阅读本篇&#xff0c;可以参考&#xff1a; Mybatis 映射器与XML配置职责分离https://blog.c…

轻松解决软件游戏msvcr120.dll丢失问题,msvcr120.dll丢失的修复步骤分享

msvcr120.dll 丢失可能会让许多软件和游戏无法正常运行&#xff0c;给用户带来无尽的困扰。当你尝试打开某个程序时&#xff0c;可能会弹出一个提示框&#xff0c;告诉你缺少 msvcr120.dll 文件。当你尝试运行某个游戏时&#xff0c;可能会遇到无法启动或运行一段时间后崩溃的问…

java项目中数据权限实现思路

一、需求&#xff1a; 同样的页面&#xff0c;不同的账号登录进去&#xff0c;看到的数据不一样。 二、权限管理的方式 RBAC模型 角色与数据权限的关系&#xff1a; 比如管理员角色&#xff0c;他的数据权限是全部&#xff0c;那么拥有该角色的用户&#xff0c;所能看到的数…

基于YOLOv8模型的蜜蜂目标检测系统(PyTorch+Pyside6+YOLOv8模型)

摘要&#xff1a;基于YOLOv8模型的蜜蜂目标检测系统可用于日常生活中检测与定位蜜蜂目标&#xff0c;利用深度学习算法可实现图片、视频、摄像头等方式的目标检测&#xff0c;另外本系统还支持图片、视频等格式的结果可视化与结果导出。本系统采用YOLOv8目标检测算法训练数据集…

低代码软件:业务经理的利器!快速掌握使用技巧

低代码的出现&#xff0c;让应用开发不再是开发人员的专属工作。要知道在企业中&#xff0c;业务开发压力加上开发人手不够导致开发团队会积压大量请求。不仅拖慢了业务进程&#xff0c;也难免造成开发软对和业务团队之间的矛盾。 而成熟的业务经理在行业中深耕多年&#xff0…

基于PHP+MySQL的家教平台

摘要 设计和实现基于PHP的家教平台是一个复杂而令人兴奋的任务。这个项目旨在为学生、家长和教师提供一个便捷的在线学习和教授平台。本文摘要将概述这个项目的关键方面&#xff0c;包括用户管理、课程管理、支付处理、评价系统、通知系统和安全性。首先&#xff0c;我们将建立…

Golang的测试、基准测试和持续集成

在Golang中&#xff0c;内置的垃圾回收器处理内存管理&#xff0c;自动执行内存分配和释放。 单元测试是软件开发中至关重要的一个方面&#xff0c;它确保了代码的正确性并在开发过程中尽早发现错误。在Go中&#xff0c;编写有效的单元测试非常简单&#xff0c;并为开发人员提…

Mysql8安装+重装的数据备份方法【提供Mysql8.0.27版本的压缩包】

文章目录 Mysql8压缩安装包下载安装流程压缩包解压配置环境变量 初始化数据库连接数据库修改密码Mysql重装/重装系统 的数据库备份方法数据备份数据还原 Mysql8压缩安装包下载 压缩包下载路径 安装流程 压缩包解压 首先将压缩包解压&#xff0c;下图是解压之后的文件目录&a…

Leetcode 71. 简化路径

文章目录 题目代码&#xff08;9.28 首刷调试看解析&#xff09; 题目 Leetcode 71. 简化路径 代码&#xff08;9.28 首刷调试看解析&#xff09; class Solution { public:string simplifyPath(string path) {vector<string> parts;int start 0;for(int i 1; i <…

【C++11保姆级教程】空指针(nullptr),long long类型,char16_t和char32_t类型

文章目录 前言一、空指针(nullptr)1.1概念解释1.2形象比喻1.3示例代码1.4空指针nullptr的优势 二、long long类型2.1概念解释2.2形象比喻2.3示例代码2.4优势2.5劣势 三、char16_t和char32_t类型3.1概念解释3.2形象比喻3.3示例代码3.4优势3.5劣势 总结 前言 在C11标准中引入了许…

C# 数组

C# 数组 数组简单数组多维数组锯齿数组Array类数组的接口枚举 数组 如果需要使用同一类型的多个对象&#xff0c;就可以使用集合和数组。C#用特殊的记号声明和使用数组。 简单数组 在声明数组时&#xff0c;应先定义数组中元素的类型&#xff0c;其后是一个空方括号和一个变…

计算机毕业设计 基于SSM的垃圾分类管理系统(以医疗垃圾为例)的设计与实现 Java实战项目 附源码+文档+视频讲解

博主介绍&#xff1a;✌从事软件开发10年之余&#xff0c;专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌ &#x1f345;文末获取源码联系&#x1f345; &#x1f447;&#x1f3fb; 精…

高性能MySQL第四版

主要列出与第三版的区别 第一章、MySQL架构 MySQL逻辑架构 左右分别是第三和第四版。 第四版架构图里把第二层的“查询缓存”去掉了&#xff0c;也去掉了对应的文字描述。 连接管理和安全 “每个 客户 端 连接 都会 在 服务器 进程 中 拥有 一个 线程” 第四版对这句话增…

英语——分享篇——每日100词——501-600

hill——will愿意——他不愿意去小山里 Easter——east东方(熟词)er儿(拼音)——东方的儿子都过复活节 exhibition——ex前夫(熟词)hi嗨(熟词)bition比神(谐音)——展览会上前夫很嗨&#xff0c;比神还开心 chase——vt.追捕&#xff0c;追逐&#xff0c;追赶——cha茶se色——…

国庆day1

消息队列 代码 发送 #include<myhead.h> //声明一个消息结构体 typedef struct {long msgtype; //消息类型char data[1024]; //消息正文 }Msg_s; #define SIZE sizeof(Msg_s)-sizeof(long) //消息正文的大小 int main(int argc, const char *argv[]) {key_t key; /…

HashMap底层源码,数据结构

HashMap的底层结构在jdk1.7中由数组链表实现&#xff0c;在jdk1.8中由数组链表红黑树实现&#xff0c;以数组链表的结构为例。 JDK1.8之前Put方法&#xff1a; JDK1.8之后Put方法&#xff1a; HashMap基于哈希表的Map接口实现&#xff0c;是以key-value存储形式存在&#xff0c…

lwip开发指南2

目录 NTP 协议实验NTP 简介NTP 实验硬件设计软件设计下载验证 lwIP 测试网速JPerf 网络测速工具JPerf 网络实验硬件设计软件设计下载验证 HTTP 服务器实验HTTP 协议简介HTTP 服务器实验硬件设计下载验证 网络摄像头&#xff08;ATK-MC5640&#xff09;实验ATK-MC5640 简介SCCB …