赞
踩
作者主页:源码空间站2022
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
基于Springboot Vue牙科诊所管理系统(含论文)
角色:管理员、医生、用户三种角色,分为前后台;
用户:用户在前台可以查看首页、公告、医生等信息;用户登录后,可进行医生预约、查看我的病例、预约记录等信息;
管理员:管理员登录成功后进入到系统操作界面,可以对个人中心、管理员管理、基础数据管理、公告管理、医生管理、医生预约管理、病例管理、用户管理、轮播图信息等功能模块进行相对应操作。
医生:医生登录成功后进入到系统操作界面,可以对个人中心、公告管理、医生预约管理、病例管理、用户管理等功能模块进行相应操作。
使用人群:
正在做毕设的学生,或者需要项目实战练习的Java学习者
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;
后端:SpringBoot+Mybaits
前端:Vue +ElementUI +Layui +HTML+CSS+JS
项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4.运行项目,在浏览器中输入地址:
前台地址:http://localhost:8080/yakezhensuo/front/index.html
用户:a1/123456
后台地址:http://localhost:8080/yakezhensuo/admin/dist/index.html#/login
管理员:admin/admin
医生:a3/123456
BingliController
-
- package com.controller;
-
- import java.io.File;
- import java.math.BigDecimal;
- import java.net.URL;
- import java.text.SimpleDateFormat;
- import com.alibaba.fastjson.JSONObject;
- import java.util.*;
- import org.springframework.beans.BeanUtils;
- import javax.servlet.http.HttpServletRequest;
- import org.springframework.web.context.ContextLoader;
- import javax.servlet.ServletContext;
- import com.service.TokenService;
- import com.utils.*;
- import java.lang.reflect.InvocationTargetException;
-
- import com.service.DictionaryService;
- import org.apache.commons.lang3.StringUtils;
- import com.annotation.IgnoreAuth;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.*;
- import com.baomidou.mybatisplus.mapper.EntityWrapper;
- import com.baomidou.mybatisplus.mapper.Wrapper;
- import com.entity.*;
- import com.entity.view.*;
- import com.service.*;
- import com.utils.PageUtils;
- import com.utils.R;
- import com.alibaba.fastjson.*;
-
- /**
- * 病例
- * 后端接口
- * @author
- * @email
- */
- @RestController
- @Controller
- @RequestMapping("/bingli")
- public class BingliController {
- private static final Logger logger = LoggerFactory.getLogger(BingliController.class);
-
- private static final String TABLE_NAME = "bingli";
-
- @Autowired
- private BingliService bingliService;
-
-
- @Autowired
- private TokenService tokenService;
-
- @Autowired
- private DictionaryService dictionaryService;//字典
- @Autowired
- private GonggaoService gonggaoService;//公告
- @Autowired
- private YishengService yishengService;//医生
- @Autowired
- private YishengYuyueService yishengYuyueService;//医生预约
- @Autowired
- private YonghuService yonghuService;//用户
- @Autowired
- private UsersService usersService;//管理员
-
-
- /**
- * 后端列表
- */
- @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("用户".equals(role))
- params.put("yonghuId",request.getSession().getAttribute("userId"));
- else if("医生".equals(role))
- params.put("yishengId",request.getSession().getAttribute("userId"));
- CommonUtil.checkMap(params);
- PageUtils page = bingliService.queryPage(params);
-
- //字典表数据转换
- List<BingliView> list =(List<BingliView>)page.getList();
- for(BingliView 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);
- BingliEntity bingli = bingliService.selectById(id);
- if(bingli !=null){
- //entity转view
- BingliView view = new BingliView();
- BeanUtils.copyProperties( bingli , view );//把实体数据重构到view中
- //级联表 用户
- //级联表
- YonghuEntity yonghu = yonghuService.selectById(bingli.getYonghuId());
- if(yonghu != null){
- BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yishengId"
- , "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
- view.setYonghuId(yonghu.getId());
- }
- //级联表 医生
- //级联表
- YishengEntity yisheng = yishengService.selectById(bingli.getYishengId());
- if(yisheng != null){
- BeanUtils.copyProperties( yisheng , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yishengId"
- , "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
- view.setYishengId(yisheng.getId());
- }
- //修改对应字典表字段
- dictionaryService.dictionaryConvert(view, request);
- return R.ok().put("data", view);
- }else {
- return R.error(511,"查不到数据");
- }
-
- }
- /**
- * 缴费
- */
- @RequestMapping("/jiaofei")
- public R jiaofei(Integer id, HttpServletRequest request){
- BingliEntity bingli = bingliService.selectById(id);
- YonghuEntity yonghuEntity = yonghuService.selectById(bingli.getYonghuId());
- if(yonghuEntity == null)
- return R.error("查不到用户");
- double balance = yonghuEntity.getNewMoney() - bingli.getBingliHuafei();
- if(balance<0)
- return R.error("余额不够支付,请充值后再缴费");
- yonghuEntity.setNewMoney(balance);
- yonghuService.updateById(yonghuEntity);
- bingli.setJiaofeiTypes(2);
- bingliService.updateById(bingli);
- return R.ok();
- }
-
- /**
- * 后端保存
- */
- @RequestMapping("/save")
- public R save(@RequestBody BingliEntity bingli, HttpServletRequest request){
- logger.debug("save方法:,,Controller:{},,bingli:{}",this.getClass().getName(),bingli.toString());
-
- String role = String.valueOf(request.getSession().getAttribute("role"));
- if(false)
- return R.error(511,"永远不会进入");
- else if("医生".equals(role))
- bingli.setYishengId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
- else if("用户".equals(role))
- bingli.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
-
- Wrapper<BingliEntity> queryWrapper = new EntityWrapper<BingliEntity>()
- .eq("yonghu_id", bingli.getYonghuId())
- .eq("yisheng_id", bingli.getYishengId())
- .eq("bingli_name", bingli.getBingliName())
- .eq("bingli_types", bingli.getBingliTypes())
- .eq("jiaofei_types", bingli.getJiaofeiTypes())
- ;
-
- logger.info("sql语句:"+queryWrapper.getSqlSegment());
- BingliEntity bingliEntity = bingliService.selectOne(queryWrapper);
- if(bingliEntity==null){
- bingli.setInsertTime(new Date());
- bingli.setCreateTime(new Date());
- bingliService.insert(bingli);
- return R.ok();
- }else {
- return R.error(511,"表中有相同数据");
- }
- }
-
- /**
- * 后端修改
- */
- @RequestMapping("/update")
- public R update(@RequestBody BingliEntity bingli, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
- logger.debug("update方法:,,Controller:{},,bingli:{}",this.getClass().getName(),bingli.toString());
- BingliEntity oldBingliEntity = bingliService.selectById(bingli.getId());//查询原先数据
-
- String role = String.valueOf(request.getSession().getAttribute("role"));
- // if(false)
- // return R.error(511,"永远不会进入");
- // else if("医生".equals(role))
- // bingli.setYishengId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
- // else if("用户".equals(role))
- // bingli.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
-
- bingliService.updateById(bingli);//根据id更新
- return R.ok();
- }
-
-
-
- /**
- * 删除
- */
- @RequestMapping("/delete")
- public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
- logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
- List<BingliEntity> oldBingliList =bingliService.selectBatchIds(Arrays.asList(ids));//要删除的数据
- bingliService.deleteBatchIds(Arrays.asList(ids));
-
- 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<BingliEntity> bingliList = 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){
- //循环
- BingliEntity bingliEntity = new BingliEntity();
- // bingliEntity.setYonghuId(Integer.valueOf(data.get(0))); //用户 要改的
- // bingliEntity.setYishengId(Integer.valueOf(data.get(0))); //医生 要改的
- // bingliEntity.setBingliUuidNumber(data.get(0)); //病例编号 要改的
- // bingliEntity.setBingliName(data.get(0)); //病例名称 要改的
- // bingliEntity.setBingliTypes(Integer.valueOf(data.get(0))); //病例类型 要改的
- // bingliEntity.setKanbingTime(sdf.parse(data.get(0))); //看病时间 要改的
- // bingliEntity.setBingliZishuText(data.get(0)); //病人自述 要改的
- // bingliEntity.setBingliZhenduanText(data.get(0)); //诊断结果 要改的
- // bingliEntity.setBingliYaofangText(data.get(0)); //药方 要改的
- // bingliEntity.setBingliHuafei(data.get(0)); //花费金额 要改的
- // bingliEntity.setJiaofeiTypes(Integer.valueOf(data.get(0))); //是否缴费 要改的
- // bingliEntity.setInsertTime(date);//时间
- // bingliEntity.setCreateTime(date);//时间
- bingliList.add(bingliEntity);
-
-
- //把要查询是否重复的字段放入map中
- //病例编号
- if(seachFields.containsKey("bingliUuidNumber")){
- List<String> bingliUuidNumber = seachFields.get("bingliUuidNumber");
- bingliUuidNumber.add(data.get(0));//要改的
- }else{
- List<String> bingliUuidNumber = new ArrayList<>();
- bingliUuidNumber.add(data.get(0));//要改的
- seachFields.put("bingliUuidNumber",bingliUuidNumber);
- }
- }
-
- //查询是否重复
- //病例编号
- List<BingliEntity> bingliEntities_bingliUuidNumber = bingliService.selectList(new EntityWrapper<BingliEntity>().in("bingli_uuid_number", seachFields.get("bingliUuidNumber")));
- if(bingliEntities_bingliUuidNumber.size() >0 ){
- ArrayList<String> repeatFields = new ArrayList<>();
- for(BingliEntity s:bingliEntities_bingliUuidNumber){
- repeatFields.add(s.getBingliUuidNumber());
- }
- return R.error(511,"数据库的该表中的 [病例编号] 字段已经存在 存在数据为:"+repeatFields.toString());
- }
- bingliService.insertBatch(bingliList);
- return R.ok();
- }
- }
- }
- }catch (Exception e){
- e.printStackTrace();
- return R.error(511,"批量插入数据异常,请联系管理员");
- }
- }
-
-
-
-
- /**
- * 前端列表
- */
- @IgnoreAuth
- @RequestMapping("/list")
- public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
- logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
-
- CommonUtil.checkMap(params);
- PageUtils page = bingliService.queryPage(params);
-
- //字典表数据转换
- List<BingliView> list =(List<BingliView>)page.getList();
- for(BingliView 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);
- BingliEntity bingli = bingliService.selectById(id);
- if(bingli !=null){
-
-
- //entity转view
- BingliView view = new BingliView();
- BeanUtils.copyProperties( bingli , view );//把实体数据重构到view中
-
- //级联表
- YonghuEntity yonghu = yonghuService.selectById(bingli.getYonghuId());
- if(yonghu != null){
- BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
- view.setYonghuId(yonghu.getId());
- }
- //级联表
- YishengEntity yisheng = yishengService.selectById(bingli.getYishengId());
- if(yisheng != null){
- BeanUtils.copyProperties( yisheng , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
- view.setYishengId(yisheng.getId());
- }
- //修改对应字典表字段
- dictionaryService.dictionaryConvert(view, request);
- return R.ok().put("data", view);
- }else {
- return R.error(511,"查不到数据");
- }
- }
-
-
- /**
- * 前端保存
- */
- @RequestMapping("/add")
- public R add(@RequestBody BingliEntity bingli, HttpServletRequest request){
- logger.debug("add方法:,,Controller:{},,bingli:{}",this.getClass().getName(),bingli.toString());
- Wrapper<BingliEntity> queryWrapper = new EntityWrapper<BingliEntity>()
- .eq("yonghu_id", bingli.getYonghuId())
- .eq("yisheng_id", bingli.getYishengId())
- .eq("bingli_uuid_number", bingli.getBingliUuidNumber())
- .eq("bingli_name", bingli.getBingliName())
- .eq("bingli_types", bingli.getBingliTypes())
- .eq("bingli_zishu_text", bingli.getBingliZishuText())
- .eq("bingli_zhenduan_text", bingli.getBingliZhenduanText())
- .eq("bingli_yaofang_text", bingli.getBingliYaofangText())
- .eq("jiaofei_types", bingli.getJiaofeiTypes())
- // .notIn("bingli_types", new Integer[]{102})
- ;
- logger.info("sql语句:"+queryWrapper.getSqlSegment());
- BingliEntity bingliEntity = bingliService.selectOne(queryWrapper);
- if(bingliEntity==null){
- bingli.setInsertTime(new Date());
- bingli.setCreateTime(new Date());
- bingliService.insert(bingli);
-
- return R.ok();
- }else {
- return R.error(511,"表中有相同数据");
- }
- }
-
- }
-
如果也想学习本系统,下面领取。关注并回复:181springboot
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。