基于SSM中小型医院管理系统的设计与实现

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:SSM
前端:采用JSP技术开发
数据库:MySQL5.7和Navicat管理工具结合
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


目录

一、项目简介

二、系统功能

三、系统项目截图

首页界面的实现

门诊功能的实现界面

个人中心功能的实现界面

公告功能的实现界面

用户角色功能的界面实现

挂号功能的实现界面

处方信息管理功能的实现界面

门诊项目功能的实现界面

住院登记功能的实现界面

出院信息功能的实现界面

管理员功能的实现界面

医生功能的实现界面

四、核心代码

登录相关

文件上传

封装


一、项目简介

随着医院工作压力越来越大,使用办公软件的医院越来越多。现在大多数医院采用各种挂号软件、叫号软件、问诊软件进行协助办公。这些软件可以有效的提高医院的办公效率,实现分流,使患者减少排队提高看病的效率。然后这些软件大多都针对医院的办公人员使用,患者只能挂号,不能查询更多的信息。目前,网络发展成熟,各类网站平台层出不穷,如果可以有专业的系统提供更多服务,则可以帮助患者解决需求。

本中小型医院管理系统采用SSM框架进行设计,语言采用Java,数据库为Mysql。在技术中加入Jsp,使界面更加丰富、友好。本系统针对医院办公而开发,使用角色为管理员和用户、医生。用户可以通过注册登录,在界面里浏览门诊进行挂号,可以查询处方信息和门诊项目信息以及进行住院登记和查询出院信息。管理员可以管理用户信息、门诊信息、科室信息、挂号信息、药品信息、门诊项目信息等。医生可以管理挂号信息和进行开处方、查询药品等。在本系统中,用户可以在线支付,灵活性强,实现线上挂号,节省时间。


二、系统功能

  本系统的功能界面设计为四个,前台界面、用户中心界面和管理员中心界面、医生中心界面。根据不同用户的不同需求分开设计功能。前台界面的功能为公告、门诊信息、个人中心和后台管理,用户中心界面的功能为个人资料、挂号信息管理、住院登记等,管理员中心界面的功能为系统用户、门诊信息等,医生中心界面的功能为挂号管理、处方信息管理等。

基于SSM中小型医院管理系统的设计与实现_第1张图片

 



三、系统项目截图

首页界面的实现

本功能设计的目的是帮助用户一键返回首页,在首页里的元素包括图片、列表框、文字、按钮等。在首页的上半部分是粉底白字的系统名称,系统名称下面是导航栏,接着就是图片,图片下面是门诊信息。

基于SSM中小型医院管理系统的设计与实现_第2张图片 

门诊功能的实现界面

在门诊功能里可以看到坐诊的科室和医生等信息。

基于SSM中小型医院管理系统的设计与实现_第3张图片 基于SSM中小型医院管理系统的设计与实现_第4张图片

个人中心功能的实现界面

用户登录后在个人中心里可以管理自己的注册信息 

基于SSM中小型医院管理系统的设计与实现_第5张图片

公告功能的实现界面

在本功能模块里展示公告标题,想要看具体的公告详情需要点击公告标题进入公告详情页。 

基于SSM中小型医院管理系统的设计与实现_第6张图片 

用户角色功能的界面实现

挂号功能的实现界面

用户在门诊信息里可以挂号,挂号成功后可以管理挂号信息和在线支付费用。

基于SSM中小型医院管理系统的设计与实现_第7张图片 

处方信息管理功能的实现界面

用户可以查询医生开出的处方,并进行费用的支付。

基于SSM中小型医院管理系统的设计与实现_第8张图片 

门诊项目功能的实现界面

用户可以查询门诊项目。

基于SSM中小型医院管理系统的设计与实现_第9张图片 

住院登记功能的实现界面

用户可以查询住院的详情。

基于SSM中小型医院管理系统的设计与实现_第10张图片 

出院信息功能的实现界面

用户可以查询出院信息以及进行费用的结算。 

基于SSM中小型医院管理系统的设计与实现_第11张图片 

管理员功能的实现界面

管理员的功能为管理前台信息和审核医生管理的功能以及管理用户信息。管理的前台信息包括公告信息、门诊信息、项目信息、类型信息等。

基于SSM中小型医院管理系统的设计与实现_第12张图片 

医生功能的实现界面

医生的功能为管理个人资料和管理挂号信息、为用户开处方,登记用户的住院信息和处理用户的出院信息、查询药品等

基于SSM中小型医院管理系统的设计与实现_第13张图片 


四、核心代码

登录相关


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().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().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().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 params,UserEntity user){
        EntityWrapper ew = new EntityWrapper();
    	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 ew = new EntityWrapper();
      	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().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();
    }
}

文件上传

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().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 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(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

封装

package com.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 返回数据
 */
public class R extends HashMap {
	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 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;
	}
}

你可能感兴趣的:(智能手机,旅游,java,前端,开发语言)