package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
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 com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.YishengEntity;
import com.entity.view.YishengView;
import com.service.YishengService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 医生
* 后端接口
* @author
* @email
* @date 2020-09-23 17:33:51
*/
@RestController
@RequestMapping("/yisheng")
public class YishengController {
@Autowired
private YishengService yishengService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
YishengEntity user = yishengService.selectOne(new EntityWrapper<YishengEntity>().eq("gonghao", username));
if(user==null || !user.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(), username,"yisheng", "医生" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody YishengEntity yisheng){
//ValidatorUtils.validateEntity(yisheng);
YishengEntity user = yishengService.selectOne(new EntityWrapper<YishengEntity>().eq("gonghao", yisheng.getGonghao()));
if(user!=null) {
return R.error("注册用户已存在");
}
Long uId = new Date().getTime();
yisheng.setId(uId);
yishengService.insert(yisheng);
return R.ok();
}
/**
* 退出
*/
@RequestMapping("/logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){
Long id = (Long)request.getSession().getAttribute("userId");
YishengEntity user = yishengService.selectById(id);
return R.ok().put("data", user);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
YishengEntity user = yishengService.selectOne(new EntityWrapper<YishengEntity>().eq("gonghao", username));
if(user==null) {
return R.error("账号不存在");
}
user.setMima("123456");
yishengService.updateById(user);
return R.ok("密码已重置为:123456");
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,YishengEntity yisheng, HttpServletRequest request){
EntityWrapper<YishengEntity> ew = new EntityWrapper<YishengEntity>();
PageUtils page = yishengService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yisheng), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,YishengEntity yisheng, HttpServletRequest request){
EntityWrapper<YishengEntity> ew = new EntityWrapper<YishengEntity>();
PageUtils page = yishengService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yisheng), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( YishengEntity yisheng){
EntityWrapper<YishengEntity> ew = new EntityWrapper<YishengEntity>();
ew.allEq(MPUtil.allEQMapPre( yisheng, "yisheng"));
return R.ok().put("data", yishengService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(YishengEntity yisheng){
EntityWrapper< YishengEntity> ew = new EntityWrapper< YishengEntity>();
ew.allEq(MPUtil.allEQMapPre( yisheng, "yisheng"));
YishengView yishengView = yishengService.selectView(ew);
return R.ok("查询医生成功").put("data", yishengView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id){
YishengEntity yisheng = yishengService.selectById(id);
return R.ok().put("data", yisheng);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") String id){
YishengEntity yisheng = yishengService.selectById(id);
return R.ok().put("data", yisheng);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody YishengEntity yisheng, HttpServletRequest request){
yisheng.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yisheng);
YishengEntity user = yishengService.selectOne(new EntityWrapper<YishengEntity>().eq("gonghao", yisheng.getGonghao()));
if(user!=null) {
return R.error("用户已存在");
}
yisheng.setId(new Date().getTime());
yishengService.insert(yisheng);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody YishengEntity yisheng, HttpServletRequest request){
yisheng.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yisheng);
YishengEntity user = yishengService.selectOne(new EntityWrapper<YishengEntity>().eq("gonghao", yisheng.getGonghao()));
if(user!=null) {
return R.error("用户已存在");
}
yisheng.setId(new Date().getTime());
yishengService.insert(yisheng);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody YishengEntity yisheng, HttpServletRequest request){
//ValidatorUtils.validateEntity(yisheng);
yishengService.updateById(yisheng);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
yishengService.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<String, Object> 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 D
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Java 毕业设计,Java 课程设计,基于SSM+Vue 开发的,含有代码注释,新手也可看懂。毕业设计、期末大作业、课程设计、高分必看,下载下来,简单部署,就可以使用。 包含:项目源码、数据库脚本、软件工具等,该项目可以作为毕设、课程设计使用,前后端代码都在里面。 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。 项目都经过严格调试,确保可以运行! 1. 技术组成 前端:Vue 后台框架:SSM 开发环境:idea 数据库:MySql(建议用 5.7,8.0 有时候会有坑) 部署环境:Tomcat(建议用 7.x 或者 8.x b版本),maven
资源推荐
资源详情
资源评论
收起资源包目录
基于ssm+vue的疫情期间医院门诊管理系统(java毕业设计,包括源码,数据库,教程).zip (878个子文件)
2-run.bat 14B
1-install.bat 12B
YishengController.class 10KB
YonghuController.class 10KB
CommonController.class 10KB
ZaixianliaotianController.class 8KB
LiaotianhuifuController.class 8KB
YuyuexinxiController.class 8KB
YiyuanxinxiController.class 8KB
XingdongguijiController.class 8KB
YiyangbaogaoController.class 8KB
StoreupController.class 8KB
DiscussyiyuanxinxiController.class 8KB
DiscussyishengController.class 8KB
YiqinggonggaoController.class 8KB
YichangbaogaoController.class 7KB
KeshixinxiController.class 7KB
MPUtil.class 7KB
UserController.class 6KB
YuyuexinxiEntity.class 5KB
YiyuanxinxiEntity.class 5KB
TokenServiceImpl.class 4KB
FileController.class 4KB
YishengEntity.class 4KB
BaiduUtil.class 4KB
XingdongguijiEntity.class 4KB
YiyangbaogaoEntity.class 4KB
DiscussyiyuanxinxiServiceImpl.class 4KB
YonghuEntity.class 4KB
ZaixianliaotianServiceImpl.class 4KB
DiscussyishengServiceImpl.class 4KB
YichangbaogaoServiceImpl.class 4KB
XingdongguijiServiceImpl.class 4KB
YiqinggonggaoServiceImpl.class 4KB
LiaotianhuifuServiceImpl.class 4KB
ZaixianliaotianEntity.class 4KB
YiyangbaogaoServiceImpl.class 4KB
LiaotianhuifuEntity.class 4KB
YiyuanxinxiServiceImpl.class 4KB
KeshixinxiServiceImpl.class 4KB
YuyuexinxiServiceImpl.class 4KB
YishengServiceImpl.class 4KB
StoreupServiceImpl.class 4KB
YonghuServiceImpl.class 4KB
ConfigController.class 4KB
AuthorizationInterceptor.class 3KB
YiqinggonggaoEntity.class 3KB
YuyuexinxiModel.class 3KB
YuyuexinxiVO.class 3KB
StoreupEntity.class 3KB
YichangbaogaoEntity.class 3KB
Query.class 3KB
YiyuanxinxiModel.class 3KB
DiscussyiyuanxinxiEntity.class 3KB
YiyuanxinxiVO.class 3KB
DiscussyishengEntity.class 3KB
UserServiceImpl.class 3KB
PageUtils.class 3KB
TokenEntity.class 3KB
KeshixinxiEntity.class 2KB
YishengModel.class 2KB
YishengVO.class 2KB
XingdongguijiModel.class 2KB
XingdongguijiVO.class 2KB
CommonServiceImpl.class 2KB
YiyangbaogaoModel.class 2KB
YiyangbaogaoVO.class 2KB
LiaotianhuifuModel.class 2KB
ZaixianliaotianModel.class 2KB
LiaotianhuifuVO.class 2KB
ZaixianliaotianVO.class 2KB
R.class 2KB
YonghuModel.class 2KB
YonghuVO.class 2KB
UserEntity.class 2KB
DiscussyiyuanxinxiService.class 2KB
ValidatorUtils.class 2KB
SpringContextUtils.class 2KB
DiscussyiyuanxinxiDao.class 2KB
ZaixianliaotianService.class 2KB
DiscussyishengService.class 2KB
YichangbaogaoService.class 2KB
XingdongguijiService.class 2KB
YiqinggonggaoService.class 2KB
LiaotianhuifuService.class 2KB
ZaixianliaotianDao.class 2KB
YiyangbaogaoService.class 2KB
DiscussyishengDao.class 2KB
YiyuanxinxiService.class 2KB
YiqinggonggaoDao.class 2KB
LiaotianhuifuDao.class 2KB
XingdongguijiDao.class 2KB
YichangbaogaoDao.class 2KB
YuyuexinxiService.class 2KB
KeshixinxiService.class 2KB
YiyangbaogaoDao.class 2KB
HttpClientUtils.class 2KB
YiyuanxinxiDao.class 2KB
KeshixinxiDao.class 2KB
YuyuexinxiDao.class 2KB
共 878 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
Java徐师兄
- 粉丝: 1558
- 资源: 2309
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于java的摄影跟拍预定管理系统设计与实现.docx
- 基于java的协同过滤算法的体育商品推荐系统设计与实现.docx
- 基于java的私人健身与教练预约管理系统设计与实现.docx
- 基于java的校园二手书交易管理系统设计与实现.docx
- 基于java的学生成绩管理系统设计与实现.docx
- 基于java的休闲娱乐代理售票系统设计与实现.docx
- 基于java的学生信息管理系统设计与实现.docx
- 基于java的学生综合测评系统设计与实现.docx
- 基于java的饮食分享平台设计与实现.docx
- 基于java的医院信管系统设计与实现.docx
- 基于小程序的疫情核酸预约小程序源码(小程序毕业设计完整源码).zip
- 基于java的在线考试设计与实现.docx
- 基于java的智慧学生校舍系统设计与实现.docx
- 基于java的智慧党建系统设计与实现.docx
- html新年烟花代码效果
- 基于小程序的童心党史小程序源码(小程序毕业设计完整源码).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功