🍊作者:计算机编程-吉哥
🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。
🍊心愿:点赞 👍 收藏 ⭐评论 📝
🍅 文末获取源码联系👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~
Java毕业设计项目~热门选题推荐《1000套》
技术选型
springboot、mybatisplus、vue、elementui、html、css、js、mysql、jdk1.8
数据库表结构
10张
开发工具
idea、navicat
⭐功能
【角色】
管理员、用户
【前台功能模块】
- 登录注册
- 首页
- 论坛
- 网站介绍
- 联系我们
- 医院介绍
- 医生
- 个人中心
- 后台管理
【后台功能模块】
- 登录
- 首页
- 个人中心
- 基础数据管理
- 帖子类型管理
- 科室管理
- 时间段管理
- 职位管理
- 论坛管理
- 用户管理
- 医生管理
- 轮播图管理
🏆项目演示截图
1、首页
2、预约挂号
3、个人中心
4、论坛
5、我的医生挂号订单
6、论坛管理
7、用户管理
8、医生管理
9、医生挂号订单管理
数据库文件设计
CREATE TABLE `config` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',`name` varchar(100) NOT NULL COMMENT '配置参数名称',`value` varchar(100) DEFAULT NULL COMMENT '配置参数值',PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='配置文件';CREATE TABLE `dictionary` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',`dic_code` varchar(200) DEFAULT NULL COMMENT '字段',`dic_name` varchar(200) DEFAULT NULL COMMENT '字段名',`code_index` int(11) DEFAULT NULL COMMENT '编码',`index_name` varchar(200) DEFAULT NULL COMMENT '编码名字 Search111 ',`super_id` int(11) DEFAULT NULL COMMENT '父字段id',`beizhu` varchar(200) DEFAULT NULL COMMENT '备注',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8 COMMENT='字典';CREATE TABLE `forum` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`forum_name` varchar(200) DEFAULT NULL COMMENT '帖子标题 Search111 ',`huiyuan_id` int(11) DEFAULT NULL COMMENT '会员',`zhuanjia_id` int(11) DEFAULT NULL COMMENT '医生',`users_id` int(11) DEFAULT NULL COMMENT '管理员',`forum_content` text COMMENT '发布内容',`super_ids` int(11) DEFAULT NULL COMMENT '父id',`forum_types` int(11) DEFAULT NULL COMMENT '帖子类型',`forum_state_types` int(11) DEFAULT NULL COMMENT '帖子状态',`insert_time` timestamp NULL DEFAULT NULL COMMENT '发帖时间',`update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show2',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COMMENT='论坛';CREATE TABLE `huiyuan` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`username` varchar(200) DEFAULT NULL COMMENT '账户',`password` varchar(200) DEFAULT NULL COMMENT '密码',`huiyuan_name` varchar(200) DEFAULT NULL COMMENT '会员姓名 Search111 ',`huiyuan_phone` varchar(200) DEFAULT NULL COMMENT '会员手机号',`huiyuan_id_number` varchar(200) DEFAULT NULL COMMENT '会员身份证号',`huiyuan_photo` varchar(200) DEFAULT NULL COMMENT '会员头像',`sex_types` int(11) DEFAULT NULL COMMENT '性别',`huiyuan_email` varchar(200) DEFAULT NULL COMMENT '电子邮箱',`new_money` decimal(10,2) DEFAULT NULL COMMENT '余额 ',`huiyuan_content` text COMMENT '会员介绍',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='会员 show2 photoShow';CREATE TABLE `single_seach` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`single_seach_name` varchar(200) DEFAULT NULL COMMENT '名字 Search111 ',`single_seach_types` int(11) DEFAULT NULL COMMENT '数据类型',`single_seach_content` text COMMENT '内容',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show2 nameShow',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='单页数据';CREATE TABLE `token` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',`userid` bigint(20) NOT NULL COMMENT '用户id',`username` varchar(100) NOT NULL COMMENT '用户名',`tablename` varchar(100) DEFAULT NULL COMMENT '表名',`role` varchar(100) DEFAULT NULL COMMENT '角色',`token` varchar(200) NOT NULL COMMENT '密码',`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',`expiratedtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='token表';CREATE TABLE `users` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',`username` varchar(100) NOT NULL COMMENT '用户名',`password` varchar(100) NOT NULL COMMENT '密码',`role` varchar(100) DEFAULT '管理员' COMMENT '角色',`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='管理员';CREATE TABLE `zhuanjia` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`username` varchar(200) DEFAULT NULL COMMENT '账户',`password` varchar(200) DEFAULT NULL COMMENT '密码',`zhuanjia_name` varchar(200) DEFAULT NULL COMMENT '医生姓名 Search111 ',`zhuanjia_phone` varchar(200) DEFAULT NULL COMMENT '医生手机号',`zhuanjia_id_number` varchar(200) DEFAULT NULL COMMENT '医生身份证号',`zhuanjia_photo` varchar(200) DEFAULT NULL COMMENT '医生头像',`zhuanjia_paiban` varchar(200) DEFAULT NULL COMMENT '医生排班',`sex_types` int(11) DEFAULT NULL COMMENT '性别',`keshi_types` int(11) DEFAULT NULL COMMENT '科室 Search111 ',`zhiwei_types` int(11) DEFAULT NULL COMMENT '职位 Search111 ',`guahao_money` decimal(10,2) DEFAULT NULL COMMENT '挂号费 ',`zhuanjia_email` varchar(200) DEFAULT NULL COMMENT '电子邮箱',`zhuanjia_content` text COMMENT '医生介绍',`zhuanjia_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',`insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='医生';CREATE TABLE `zhuanjia_liuyan` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`zhuanjia_id` int(11) DEFAULT NULL COMMENT '医生',`huiyuan_id` int(11) DEFAULT NULL COMMENT '会员',`zhuanjia_liuyan_text` text COMMENT '留言内容',`insert_time` timestamp NULL DEFAULT NULL COMMENT '留言时间',`reply_text` text COMMENT '回复内容',`update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COMMENT='医生留言';CREATE TABLE `zhuanjia_order` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`zhuanjia_order_uuid_number` varchar(200) DEFAULT NULL COMMENT '号 Search111 ',`zhuanjia_id` int(11) DEFAULT NULL COMMENT '医生',`huiyuan_id` int(11) DEFAULT NULL COMMENT '会员',`guahao_time` date DEFAULT NULL COMMENT '挂号日期 Search111 ',`shijianduan_types` int(11) DEFAULT NULL COMMENT '时间段 Search111 ',`zhuanjia_order_yesno_types` int(11) DEFAULT NULL COMMENT '状态 Search111 ',`zhuanjia_order_yesno_text` text COMMENT '审核意见',`insert_time` timestamp NULL DEFAULT NULL COMMENT '订单创建时间',`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='医生挂号订单';
核心代码
package com.controller;import com.alibaba.fastjson.JSONObject;
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.ZhuanjiaEntity;
import com.entity.view.ZhuanjiaView;
import com.service.DictionaryService;
import com.service.HuiyuanService;
import com.service.TokenService;
import com.service.ZhuanjiaService;
import com.utils.PageUtils;
import com.utils.PoiUtil;
import com.utils.R;
import com.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;/*** 医生* 后端接口* @author 计算机编程-吉哥* @email
*/
@RestController
@Controller
@RequestMapping("/zhuanjia")
public class ZhuanjiaController {private static final Logger logger = LoggerFactory.getLogger(ZhuanjiaController.class);@Autowiredprivate ZhuanjiaService zhuanjiaService;@Autowiredprivate TokenService tokenService;@Autowiredprivate DictionaryService dictionaryService;//级联表service@Autowiredprivate HuiyuanService huiyuanService;/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永不会进入");else if("用户 show2 photoShow".equals(role))params.put("huiyuanId",request.getSession().getAttribute("userId"));else if("医生".equals(role))params.put("zhuanjiaId",request.getSession().getAttribute("userId"));params.put("zhuanjiaDeleteStart",1);params.put("zhuanjiaDeleteEnd",1);if(params.get("orderBy")==null || params.get("orderBy")==""){params.put("orderBy","id");}PageUtils page = zhuanjiaService.queryPage(params);//字典表数据转换List<ZhuanjiaView> list =(List<ZhuanjiaView>)page.getList();for(ZhuanjiaView c:list){//修改对应字典表字段dictionaryService.dictionaryConvert(c, request);}return R.ok().put("data", page);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);ZhuanjiaEntity zhuanjia = zhuanjiaService.selectById(id);if(zhuanjia !=null){//entity转viewZhuanjiaView view = new ZhuanjiaView();BeanUtils.copyProperties( zhuanjia , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody ZhuanjiaEntity zhuanjia, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,zhuanjia:{}",this.getClass().getName(),zhuanjia.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");Wrapper<ZhuanjiaEntity> queryWrapper = new EntityWrapper<ZhuanjiaEntity>().eq("username", zhuanjia.getUsername()).or().eq("zhuanjia_phone", zhuanjia.getZhuanjiaPhone()).or().eq("zhuanjia_id_number", zhuanjia.getZhuanjiaIdNumber()).andNew().eq("zhuanjia_delete", 1);logger.info("sql语句:"+queryWrapper.getSqlSegment());ZhuanjiaEntity zhuanjiaEntity = zhuanjiaService.selectOne(queryWrapper);if(zhuanjiaEntity==null){zhuanjia.setZhuanjiaDelete(1);zhuanjia.setInsertTime(new Date());zhuanjia.setCreateTime(new Date());zhuanjia.setPassword("123456");zhuanjiaService.insert(zhuanjia);return R.ok();}else {return R.error(511,"账户或者医生手机号或者医生身份证号已经被使用");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody ZhuanjiaEntity zhuanjia, HttpServletRequest request){logger.debug("update方法:,,Controller:{},,zhuanjia:{}",this.getClass().getName(),zhuanjia.toString());String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");//根据字段查询是否有相同数据Wrapper<ZhuanjiaEntity> queryWrapper = new EntityWrapper<ZhuanjiaEntity>().notIn("id",zhuanjia.getId()).andNew().eq("username", zhuanjia.getUsername()).or().eq("zhuanjia_phone", zhuanjia.getZhuanjiaPhone()).or().eq("zhuanjia_id_number", zhuanjia.getZhuanjiaIdNumber()).andNew().eq("zhuanjia_delete", 1);logger.info("sql语句:"+queryWrapper.getSqlSegment());ZhuanjiaEntity zhuanjiaEntity = zhuanjiaService.selectOne(queryWrapper);if("".equals(zhuanjia.getZhuanjiaPhoto()) || "null".equals(zhuanjia.getZhuanjiaPhoto())){zhuanjia.setZhuanjiaPhoto(null);}if(zhuanjiaEntity==null){zhuanjiaService.updateById(zhuanjia);//根据id更新return R.ok();}else {return R.error(511,"账户或者医生手机号或者医生身份证号已经被使用");}}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Integer[] ids){logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());ArrayList<ZhuanjiaEntity> list = new ArrayList<>();for(Integer id:ids){ZhuanjiaEntity zhuanjiaEntity = new ZhuanjiaEntity();zhuanjiaEntity.setId(id);zhuanjiaEntity.setZhuanjiaDelete(2);list.add(zhuanjiaEntity);}if(list != null && list.size() >0){zhuanjiaService.updateBatchById(list);}return R.ok();}/*** 批量上传*/@RequestMapping("/batchInsert")public R save(String fileName, HttpServletRequest request){logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");try {List<ZhuanjiaEntity> zhuanjiaList = new ArrayList<>();//上传的东西Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段Date date = new Date();int lastIndexOf = fileName.lastIndexOf(".");if(lastIndexOf == -1){return R.error(511,"该文件没有后缀");}else{String suffix = fileName.substring(lastIndexOf);if(!".xls".equals(suffix)){return R.error(511,"只支持后缀为xls的excel文件");}else{URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径File file = new File(resource.getFile());if(!file.exists()){return R.error(511,"找不到上传文件,请联系管理员");}else{List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件dataList.remove(0);//删除第一行,因为第一行是提示for(List<String> data:dataList){//循环ZhuanjiaEntity zhuanjiaEntity = new ZhuanjiaEntity();zhuanjiaList.add(zhuanjiaEntity);//把要查询是否重复的字段放入map中//账户if(seachFields.containsKey("username")){List<String> username = seachFields.get("username");username.add(data.get(0));//要改的}else{List<String> username = new ArrayList<>();username.add(data.get(0));//要改的seachFields.put("username",username);}//医生手机号if(seachFields.containsKey("zhuanjiaPhone")){List<String> zhuanjiaPhone = seachFields.get("zhuanjiaPhone");zhuanjiaPhone.add(data.get(0));//要改的}else{List<String> zhuanjiaPhone = new ArrayList<>();zhuanjiaPhone.add(data.get(0));//要改的seachFields.put("zhuanjiaPhone",zhuanjiaPhone);}//医生身份证号if(seachFields.containsKey("zhuanjiaIdNumber")){List<String> zhuanjiaIdNumber = seachFields.get("zhuanjiaIdNumber");zhuanjiaIdNumber.add(data.get(0));//要改的}else{List<String> zhuanjiaIdNumber = new ArrayList<>();zhuanjiaIdNumber.add(data.get(0));//要改的seachFields.put("zhuanjiaIdNumber",zhuanjiaIdNumber);}}//查询是否重复//账户List<ZhuanjiaEntity> zhuanjiaEntities_username = zhuanjiaService.selectList(new EntityWrapper<ZhuanjiaEntity>().in("username", seachFields.get("username")).eq("zhuanjia_delete", 1));if(zhuanjiaEntities_username.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(ZhuanjiaEntity s:zhuanjiaEntities_username){repeatFields.add(s.getUsername());}return R.error(511,"数据库的该表中的 [账户] 字段已经存在 存在数据为:"+repeatFields.toString());}//医生手机号List<ZhuanjiaEntity> zhuanjiaEntities_zhuanjiaPhone = zhuanjiaService.selectList(new EntityWrapper<ZhuanjiaEntity>().in("zhuanjia_phone", seachFields.get("zhuanjiaPhone")).eq("zhuanjia_delete", 1));if(zhuanjiaEntities_zhuanjiaPhone.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(ZhuanjiaEntity s:zhuanjiaEntities_zhuanjiaPhone){repeatFields.add(s.getZhuanjiaPhone());}return R.error(511,"数据库的该表中的 [医生手机号] 字段已经存在 存在数据为:"+repeatFields.toString());}//医生身份证号List<ZhuanjiaEntity> zhuanjiaEntities_zhuanjiaIdNumber = zhuanjiaService.selectList(new EntityWrapper<ZhuanjiaEntity>().in("zhuanjia_id_number", seachFields.get("zhuanjiaIdNumber")).eq("zhuanjia_delete", 1));if(zhuanjiaEntities_zhuanjiaIdNumber.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(ZhuanjiaEntity s:zhuanjiaEntities_zhuanjiaIdNumber){repeatFields.add(s.getZhuanjiaIdNumber());}return R.error(511,"数据库的该表中的 [医生身份证号] 字段已经存在 存在数据为:"+repeatFields.toString());}zhuanjiaService.insertBatch(zhuanjiaList);return R.ok();}}}}catch (Exception e){e.printStackTrace();return R.error(511,"批量插入数据异常,请联系管理员");}}/*** 登录*/@IgnoreAuth@RequestMapping(value = "/login")public R login(String username, String password, String captcha, HttpServletRequest request) {ZhuanjiaEntity zhuanjia = zhuanjiaService.selectOne(new EntityWrapper<ZhuanjiaEntity>().eq("username", username));if(zhuanjia==null || !zhuanjia.getPassword().equals(password))return R.error("账号或密码不正确");else if(zhuanjia.getZhuanjiaDelete() != 1)return R.error("账户已被删除");// // 获取监听器中的字典表// ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();// Map<String, Map<Integer, String>> dictionaryMap= (Map<String, Map<Integer, String>>) servletContext.getAttribute("dictionaryMap");// Map<Integer, String> role_types = dictionaryMap.get("role_types");// role_types.get(.getRoleTypes());String token = tokenService.generateToken(zhuanjia.getId(),username, "zhuanjia", "医生");R r = R.ok();r.put("token", token);r.put("role","医生");r.put("username",zhuanjia.getZhuanjiaName());r.put("tableName","zhuanjia");r.put("userId",zhuanjia.getId());return r;}/*** 注册*/@IgnoreAuth@PostMapping(value = "/register")public R register(@RequestBody ZhuanjiaEntity zhuanjia){
// ValidatorUtils.validateEntity(user);Wrapper<ZhuanjiaEntity> queryWrapper = new EntityWrapper<ZhuanjiaEntity>().eq("username", zhuanjia.getUsername()).or().eq("zhuanjia_phone", zhuanjia.getZhuanjiaPhone()).or().eq("zhuanjia_id_number", zhuanjia.getZhuanjiaIdNumber()).andNew().eq("zhuanjia_delete", 1);ZhuanjiaEntity zhuanjiaEntity = zhuanjiaService.selectOne(queryWrapper);if(zhuanjiaEntity != null)return R.error("账户或者医生手机号或者医生身份证号已经被使用");zhuanjia.setGuahaoMoney(0.0);zhuanjia.setZhuanjiaDelete(1);zhuanjia.setInsertTime(new Date());zhuanjia.setCreateTime(new Date());zhuanjiaService.insert(zhuanjia);return R.ok();}/*** 重置密码*/@GetMapping(value = "/resetPassword")public R resetPassword(Integer id){ZhuanjiaEntity zhuanjia = new ZhuanjiaEntity();zhuanjia.setPassword("123456");zhuanjia.setId(id);zhuanjia.setInsertTime(new Date());zhuanjiaService.updateById(zhuanjia);return R.ok();}/*** 忘记密码*/@IgnoreAuth@RequestMapping(value = "/resetPass")public R resetPass(String username, HttpServletRequest request) {ZhuanjiaEntity zhuanjia = zhuanjiaService.selectOne(new EntityWrapper<ZhuanjiaEntity>().eq("username", username));if(zhuanjia!=null){zhuanjia.setPassword("123456");boolean b = zhuanjiaService.updateById(zhuanjia);if(!b){return R.error();}}else{return R.error("账号不存在");}return R.ok();}/*** 获取用户的session用户信息*/@RequestMapping("/session")public R getCurrZhuanjia(HttpServletRequest request){Integer id = (Integer)request.getSession().getAttribute("userId");ZhuanjiaEntity zhuanjia = zhuanjiaService.selectById(id);if(zhuanjia !=null){//entity转viewZhuanjiaView view = new ZhuanjiaView();BeanUtils.copyProperties( zhuanjia , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 退出*/@GetMapping(value = "logout")public R logout(HttpServletRequest request) {request.getSession().invalidate();return R.ok("退出成功");}/*** 前端列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));// 没有指定排序字段就默认id倒序if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){params.put("orderBy","id");}PageUtils page = zhuanjiaService.queryPage(params);//字典表数据转换List<ZhuanjiaView> list =(List<ZhuanjiaView>)page.getList();for(ZhuanjiaView c:list)dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段return R.ok().put("data", page);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);ZhuanjiaEntity zhuanjia = zhuanjiaService.selectById(id);if(zhuanjia !=null){//entity转viewZhuanjiaView view = new ZhuanjiaView();BeanUtils.copyProperties( zhuanjia , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody ZhuanjiaEntity zhuanjia, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,zhuanjia:{}",this.getClass().getName(),zhuanjia.toString());Wrapper<ZhuanjiaEntity> queryWrapper = new EntityWrapper<ZhuanjiaEntity>().eq("username", zhuanjia.getUsername()).or().eq("zhuanjia_phone", zhuanjia.getZhuanjiaPhone()).or().eq("zhuanjia_id_number", zhuanjia.getZhuanjiaIdNumber()).andNew().eq("zhuanjia_delete", 1);logger.info("sql语句:"+queryWrapper.getSqlSegment());ZhuanjiaEntity zhuanjiaEntity = zhuanjiaService.selectOne(queryWrapper);if(zhuanjiaEntity==null){zhuanjia.setZhuanjiaDelete(1);zhuanjia.setInsertTime(new Date());zhuanjia.setCreateTime(new Date());zhuanjia.setPassword("123456");zhuanjiaService.insert(zhuanjia);return R.ok();}else {return R.error(511,"账户或者医生手机号或者医生身份证号已经被使用");}}}
参考文档
更多项目推荐:计算机毕业设计项目
如果大家有任何疑虑,请在下方咨询或评论