基于SSM的网上医院预约挂号系统

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


目录

一、项目简介

二、系统性能分析

数据完整性

系统可扩展性

系统安全性

三、系统项目截图

客服管理

医生管理

用户管理

用户病例管理

医生坐诊管理

预约挂号管理

用户病例管理

查看医生坐诊

联系客服

预约挂号

用户病例

四、核心代码

4.1登录相关

4.2文件上传

4.3封装


一、项目简介

如今的信息时代,对信息的共享性,信息的流通性有着较高要求,因此传统管理方式就不适合。为了让医院预约挂号信息的管理模式进行升级,也为了更好的维护医院预约挂号信息,网上医院预约挂号系统的开发运用就显得很有必要。并且通过开发网上医院预约挂号系统,不仅可以让所学的SSM框架得到实际运用,也可以掌握MySQL的使用方法,对自身编程能力也有一个检验和提升的过程。尤其是通过实践,可以对系统的开发流程加深印象,无论是前期的分析与设计,还是后期的编码测试等环节,都可以有一个深刻的了解。

网上医院预约挂号系统根据调研,确定管理员除了管理医生,科室和用户外,也能管理用户预约挂号信息,下载用户病例,发布健康资讯,管理客服聊天信息。医生管理本人的坐诊信息,审核预约挂号,管理用户就诊病例。用户在前台查看医生坐诊,对医生预约挂号,评价并收藏医生,查看健康资讯,联系客服,用户在后台支付挂号价格,下载病例。

借助于网上医院预约挂号系统这样的工具,让信息系统化,流程化,规范化是最终的发展结果,让其遵循实际操作流程的情况下,对医院预约挂号信息实施规范化处理,让医院预约挂号信息通过电子的方式进行保存,无论是管理人员检索医院预约挂号信息,维护医院预约挂号信息都可以便利化操作,真正缩短信息处理时间,节省人力和信息管理的成本。


二、系统性能分析

用户使用系统,一是为了阅读需要的信息;二是为了享受系统提供的服务。因此一个质量较好的系统就更容易让用户频繁使用。而能够反馈系统的质量的信息就是系统的性能。常见的能够表示系统性能的指标有安全性,系统可扩展性,数据完整性等。接下来就对这些指标进行介绍。

数据完整性

只要是系统中的数据,其长期保存在数据库里面,就要求其具备可靠性。这样才能发挥出数据具备的参考价值。一般来说,为了保证数据信息是准确的,并且可靠的,在数据处理上,包括录入数据,编辑数据等,都要求数据信息是完整登记的。同时,系统中的数据其自身需要具备完整性外,也要求数据之间产生的关系也要具备完整性。另外,在数据库中填充信息时,同样的信息应该以同样的方式出现在不同的表中。对于数据进行完整性定义,也是方便后期对数据的使用和查看。

系统可扩展性

站在当前用户需求的角度考虑问题具有一定的局限性,由此设计的系统也一样。为了保护开发系统的财产,同时也为了让系统长远立足市场,系统开发人员就需要充分预留系统的空间,让系统在未来的日子里可以扩充功能,并进行更新和升级。这就是系统具备可扩展性的表现。

系统安全性

系统在投入使用中,用户与系统的交互会产生数据,比如插入数据,编辑数据等操作都会产生数据。而作为系统的后台支持的数据库,主要任务就是保存这些数据。为了不让数据信息被窃取或者泄露,也是为了对系统的安全性进行保证,所以市面上也出现了很多的加密技术,其中MD5单向加密技术在系统中运用得最多。其原因有三点:

第一点,面对任意两段明文,在经过MD5加密处理后,它们的密文不一样;

第二点,面对任意一段明文,进行MD5加密处理后,其密文不变;

第三点,破解MD5加密的数据非常困难;

目前,关于MD5加密技术的代码已经可以从网站上下载,可以直接将模块化的代码在系统中直接引用。一般来说,用户注册的数据还有管理员登录系统使用的数据都是很重要的资源,所以这部分数据常常会经过加密处理,这样也就消除了系统安全上的隐患。



三、系统项目截图

客服管理

实现管理员权限的客服管理功能,其运行效果见下图。管理员管理客服聊天信息,一旦接收到用户提交的咨询信息,管理员即可回复。

基于SSM的网上医院预约挂号系统_第1张图片

医生管理

实现管理员权限的医生管理功能,其运行效果见下图。医生的基本资料,包括医生的联系电话,工号以及科室等可以让管理员增删改查管理。

 基于SSM的网上医院预约挂号系统_第2张图片

用户管理

实现管理员权限的用户管理功能,其运行效果见下图。用户通过注册提交个人信息,管理员可以拉黑用户,也能对用户取消拉黑。

 基于SSM的网上医院预约挂号系统_第3张图片

用户病例管理

实现管理员权限的用户病例管理功能,其运行效果见下图。用户病例附件可以让管理员下载查看,管理员也能查询用户的病例信息。

基于SSM的网上医院预约挂号系统_第4张图片

 

医生坐诊管理

实现医生权限的医生坐诊管理功能,其运行效果见下图。医生在个人后台增删改查本人的坐诊信息,坐诊信息描述了坐诊时间,挂号价格等。

基于SSM的网上医院预约挂号系统_第5张图片

预约挂号管理

实现医生权限的预约挂号管理功能,其运行效果见下图。用户对医生进行预约挂号,医生只需审核挂号,对前来就诊的用户登记病例信息。

基于SSM的网上医院预约挂号系统_第6张图片

 

用户病例管理

实现医生权限的用户病例管理功能,其运行效果见下图。医生登记的用户病例资料都会显示在本页面,医生可以下载病例附件。

基于SSM的网上医院预约挂号系统_第7张图片

查看医生坐诊

实现用户权限的查看医生坐诊功能,其运行效果见下图。用户在本页面查看坐诊时间和挂号价格信息,点击预约挂号即可提交资料进行挂号,用户也能评价本页面显示的医生,或者点击红色五角星收藏医生。

基于SSM的网上医院预约挂号系统_第8张图片

 

联系客服

实现用户权限的联系客服功能,其运行效果见下图。用户在操作系统期间有疑问可以向客服进行咨询。

基于SSM的网上医院预约挂号系统_第9张图片

预约挂号

实现用户权限的预约挂号功能,其运行效果见下图。用户在前台提交了预约挂号信息之后,可以进入用户后台支付挂号的价格,查看挂号明细。

基于SSM的网上医院预约挂号系统_第10张图片

 

用户病例

实现用户权限的用户病例功能,其运行效果见下图。用户就诊之后,医生会登记用户的病例,用户在本人的后台可以下载病例附件。

基于SSM的网上医院预约挂号系统_第11张图片


四、核心代码

4.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().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();
    }
}

4.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().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);
	}
	
}

4.3封装

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;
	}
}

你可能感兴趣的:(spring,java,后端,json,开发语言,tomcat,maven)