发布时间:2023-07-15 12:30
末获取源码
开发语言:Java
开发工具:IDEA /Eclipse
数据库:MYSQL5.7
应用服务:Tomcat7/Tomcat8
使用框架ssm+vue
JDK版本:jdk1.8
目录
前言介绍
系统详细设计
前台首页功能模块
首页
医生信息
挂号记录
取消挂号
编辑在线问诊
管理员功能模块
用户管理
医生信息管理
科室信息管理
挂号记录管理
在线问诊管理
医生功能模块
挂号记录管理
机构功能模块
医院信息管理
本系统是基于Mysql数据库,在SSM程序设计的基础上实现的,本系统主要实现的功能是:前台页面:首页,医生信息,挂号记录,取消挂号,在线问诊,评价与投诉,名医讲堂,个人中心,后台管理。管理员:个人中心,用户管理,医生管理,机构管理,医生信息管理,科室分类管理,科室信息管理,医生信息管理,挂号记录管理,取消挂号管理,失信名单管理,在线问诊管理,评价与投诉管理,系统管理。医生:个人中心,医生信息管理,挂号记录管理,取消挂号管理,在线问诊管理,评价投诉管理。机构:医生信息管理,科室分类管理,科室信息管理,医生信息管理,挂号记录管理,取消挂号管理,失信名单管理,在线问诊管理,评价与投诉管理
管理员登录,通过填写用户名、密码、角色等信息,输入完成后选择登录即可进入预约挂号系统,如图
管理员登录进入个人健康信息管理可以查看个人中心,用户管理,医生管理,机构管理,医生信息管理,科室分类管理,科室信息管理,医生信息管理,挂号记录管理,取消挂号管理,失信名单管理,在线问诊管理,评价与投诉管理,系统管理等内容,如图
部分核心代码:
controller层
**
* 挂号记录
* 后端接口
* @author
* @email
* @date 2021-04-19 22:20:39
*/
@RestController
@RequestMapping(\"/guahaojilu\")
public class GuahaojiluController {
@Autowired
private GuahaojiluService guahaojiluService;
/**
* 后端列表
*/
@RequestMapping(\"/page\")
public R page(@RequestParam Map params,GuahaojiluEntity guahaojilu,
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date yuyueshijianstart,
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date yuyueshijianend,
HttpServletRequest request){
String tableName = request.getSession().getAttribute(\"tableName\").toString();
if(tableName.equals(\"yisheng\")) {
guahaojilu.setYishenggonghao((String)request.getSession().getAttribute(\"username\"));
}
if(tableName.equals(\"yonghu\")) {
guahaojilu.setYonghuming((String)request.getSession().getAttribute(\"username\"));
}
EntityWrapper ew = new EntityWrapper();
if(yuyueshijianstart!=null) ew.ge(\"yuyueshijian\", yuyueshijianstart);
if(yuyueshijianend!=null) ew.le(\"yuyueshijian\", yuyueshijianend);
PageUtils page = guahaojiluService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, guahaojilu), params), params));
return R.ok().put(\"data\", page);
}
/**
* 前端列表
*/
@RequestMapping(\"/list\")
public R list(@RequestParam Map params,GuahaojiluEntity guahaojilu, HttpServletRequest request){
String tableName = request.getSession().getAttribute(\"tableName\").toString();
if(tableName.equals(\"yisheng\")) {
guahaojilu.setYishenggonghao((String)request.getSession().getAttribute(\"username\"));
}
if(tableName.equals(\"yonghu\")) {
guahaojilu.setYonghuming((String)request.getSession().getAttribute(\"username\"));
}
EntityWrapper ew = new EntityWrapper();
PageUtils page = guahaojiluService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, guahaojilu), params), params));
return R.ok().put(\"data\", page);
}
/**
* 列表
*/
@RequestMapping(\"/lists\")
public R list( GuahaojiluEntity guahaojilu){
EntityWrapper ew = new EntityWrapper();
ew.allEq(MPUtil.allEQMapPre( guahaojilu, \"guahaojilu\"));
return R.ok().put(\"data\", guahaojiluService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping(\"/query\")
public R query(GuahaojiluEntity guahaojilu){
EntityWrapper< GuahaojiluEntity> ew = new EntityWrapper< GuahaojiluEntity>();
ew.allEq(MPUtil.allEQMapPre( guahaojilu, \"guahaojilu\"));
GuahaojiluView guahaojiluView = guahaojiluService.selectView(ew);
return R.ok(\"查询挂号记录成功\").put(\"data\", guahaojiluView);
}
/**
* 后端详情
*/
@RequestMapping(\"/info/{id}\")
public R info(@PathVariable(\"id\") Long id){
GuahaojiluEntity guahaojilu = guahaojiluService.selectById(id);
return R.ok().put(\"data\", guahaojilu);
}
/**
* 前端详情
*/
@RequestMapping(\"/detail/{id}\")
public R detail(@PathVariable(\"id\") Long id){
GuahaojiluEntity guahaojilu = guahaojiluService.selectById(id);
return R.ok().put(\"data\", guahaojilu);
}
/**
* 后端保存
*/
@RequestMapping(\"/save\")
public R save(@RequestBody GuahaojiluEntity guahaojilu, HttpServletRequest request){
guahaojilu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(guahaojilu);
guahaojiluService.insert(guahaojilu);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping(\"/add\")
public R add(@RequestBody GuahaojiluEntity guahaojilu, HttpServletRequest request){
guahaojilu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(guahaojilu);
guahaojilu.setUserid((Long)request.getSession().getAttribute(\"userId\"));
guahaojiluService.insert(guahaojilu);
return R.ok();
}
/**
* 修改
*/
@RequestMapping(\"/update\")
public R update(@RequestBody GuahaojiluEntity guahaojilu, HttpServletRequest request){
//ValidatorUtils.validateEntity(guahaojilu);
guahaojiluService.updateById(guahaojilu);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping(\"/delete\")
public R delete(@RequestBody Long[] ids){
guahaojiluService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping(\"/remind/{columnName}/{type}\")
public R remindCount(@PathVariable(\"columnName\") String columnName, HttpServletRequest request,
@PathVariable(\"type\") String type,@RequestParam Map map) {
map.put(\"column\", columnName);
map.put(\"type\", type);
if(type.equals(\"2\")) {
SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd\");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get(\"remindstart\")!=null) {
Integer remindStart = Integer.parseInt(map.get(\"remindstart\").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put(\"remindstart\", sdf.format(remindStartDate));
}
if(map.get(\"remindend\")!=null) {
Integer remindEnd = Integer.parseInt(map.get(\"remindend\").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put(\"remindend\", sdf.format(remindEndDate));
}
}
Wrapper wrapper = new EntityWrapper();
if(map.get(\"remindstart\")!=null) {
wrapper.ge(columnName, map.get(\"remindstart\"));
}
if(map.get(\"remindend\")!=null) {
wrapper.le(columnName, map.get(\"remindend\"));
}
String tableName = request.getSession().getAttribute(\"tableName\").toString();
if(tableName.equals(\"yisheng\")) {
wrapper.eq(\"yishenggonghao\", (String)request.getSession().getAttribute(\"username\"));
}
if(tableName.equals(\"yonghu\")) {
wrapper.eq(\"yonghuming\", (String)request.getSession().getAttribute(\"username\"));
}
int count = guahaojiluService.selectCount(wrapper);
return R.ok().put(\"count\", count);
}
}
登陆拦截功能实现
/**
* 权限(Token)验证
*/
@Component
public class AuthorizationInterceptor implements HandlerInterceptor {
public static final String LOGIN_TOKEN_KEY = \"Token\";
@Autowired
private TokenService tokenService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//支持跨域请求
response.setHeader(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, DELETE\");
response.setHeader(\"Access-Control-Max-Age\", \"3600\");
response.setHeader(\"Access-Control-Allow-Credentials\", \"true\");
response.setHeader(\"Access-Control-Allow-Headers\", \"x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization\");
response.setHeader(\"Access-Control-Allow-Origin\", request.getHeader(\"Origin\"));
IgnoreAuth annotation;
if (handler instanceof HandlerMethod) {
annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class);
} else {
return true;
}
//从header中获取token
String token = request.getHeader(LOGIN_TOKEN_KEY);
/**
* 不需要验证权限的方法直接放过
*/
if(annotation!=null) {
return true;
}
TokenEntity tokenEntity = null;
if(StringUtils.isNotBlank(token)) {
tokenEntity = tokenService.getTokenEntity(token);
}
if(tokenEntity != null) {
request.getSession().setAttribute(\"userId\", tokenEntity.getUserid());
request.getSession().setAttribute(\"role\", tokenEntity.getRole());
request.getSession().setAttribute(\"tableName\", tokenEntity.getTablename());
request.getSession().setAttribute(\"username\", tokenEntity.getUsername());
return true;
}
PrintWriter writer = null;
response.setCharacterEncoding(\"UTF-8\");
response.setContentType(\"application/json; charset=utf-8\");
try {
writer = response.getWriter();
writer.print(JSONObject.toJSONString(R.error(401, \"请先登录\")));
} finally {
if(writer != null){
writer.close();
}
}
// throw new EIException(\"请先登录\", 401);
return false;
}
}
文件上传功能
/**
* 上传文件映射表
*/
@RestController
@RequestMapping(\"file\")
@SuppressWarnings({\"unchecked\",\"rawtypes\"})
public class FileController{
@Autowired
private ConfigService configService;
/**
* 上传文件
*/
@RequestMapping(\"/upload\")
public R upload(@RequestParam(\"file\") MultipartFile file, String type,HttpServletRequest request) throws Exception {
if (file.isEmpty()) {
throw new EIException(\"上传文件不能为空\");
}
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(\".\")+1);
String fileName = new Date().getTime()+\".\"+fileExt;
File dest = new File(request.getSession().getServletContext().getRealPath(\"/upload\")+\"/\"+fileName);
file.transferTo(dest);
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 void download(@RequestParam String fileName, HttpServletRequest request, HttpServletResponse response) {
try {
File file = new File(request.getSession().getServletContext().getRealPath(\"/upload\")+\"/\"+fileName);
if (file.exists()) {
response.reset();
response.setHeader(\"Content-Disposition\", \"attachment; filename=\\\"\" + fileName+\"\\\"\");
response.setHeader(\"Cache-Control\", \"no-cache\");
response.setHeader(\"Access-Control-Allow-Credentials\", \"true\");
response.setContentType(\"application/octet-stream; charset=UTF-8\");
IOUtils.write(FileUtils.readFileToByteArray(file), response.getOutputStream());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
entity层
package com.entity;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.lang.reflect.InvocationTargetException;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.beanutils.BeanUtils;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
/**
* 在线问诊评论表
* 数据库通用操作实体类(普通增删改查)
* @author
* @email
* @date 2021-04-19 22:20:39
*/
@TableName(\"discusszaixianwenzhen\")
public class DiscusszaixianwenzhenEntity implements Serializable {
private static final long serialVersionUID = 1L;
public DiscusszaixianwenzhenEntity() {
}
public DiscusszaixianwenzhenEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* 主键id
*/
@TableId
private Long id;
/**
* 关联表id
*/
private Long refid;
/**
* 用户id
*/
private Long userid;
/**
* 用户名
*/
private String nickname;
/**
* 评论内容
*/
private String content;
/**
* 回复内容
*/
private String reply;
@JsonFormat(locale=\"zh\", timezone=\"GMT+8\", pattern=\"yyyy-MM-dd HH:mm:ss\")
@DateTimeFormat
private Date addtime;
public Date getAddtime() {
return addtime;
}
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/**
* 设置:关联表id
*/
public void setRefid(Long refid) {
this.refid = refid;
}
/**
* 获取:关联表id
*/
public Long getRefid() {
return refid;
}
/**
* 设置:用户id
*/
public void setUserid(Long userid) {
this.userid = userid;
}
/**
* 获取:用户id
*/
public Long getUserid() {
return userid;
}
/**
* 设置:用户名
*/
public void setNickname(String nickname) {
this.nickname = nickname;
}
/**
* 获取:用户名
*/
public String getNickname() {
return nickname;
}
/**
* 设置:评论内容
*/
public void setContent(String content) {
this.content = content;
}
/**
* 获取:评论内容
*/
public String getContent() {
return content;
}
/**
* 设置:回复内容
*/
public void setReply(String reply) {
this.reply = reply;
}
/**
* 获取:回复内容
*/
public String getReply() {
return reply;
}
}