基于java+ssm+jsp的心理咨询管理子系统

项目介绍

传统信息的管理大部分依赖于管理人员的手工登记与管理,然而,随着近些年信息技术的迅猛发展,让许多比较老套的信息管理模式进行了更新迭代,心理咨询预约信息因为其管理内容繁杂,管理数量繁多导致手工进行处理不能满足广大用户的需求,因此就应运而生出相应的心理咨询管理子系统。

本心理咨询管理子系统分为管理员还有用户两个权限,管理员可以管理用户的基本信息内容,可以管理公告信息以及公告的租赁信息,能够与用户进行相互交流等操作,用户可以查看心理咨询预约信息,可以查看公告以及查看管理员回复信息等操作。

该心理咨询管理子系统采用的是WEB应用程序开发中最受欢迎的B/S三层结构模式,使用占用空间小但功能齐全的MySQL数据库进行数据的存储操作,系统开发技术使用到了JSP技术。该心理咨询管理子系统能够解决许多传统手工操作的难题,比如数据查询耽误时间长,数据管理步骤繁琐等问题。总的来说,心理咨询管理子系统性能稳定,功能较全,投入运行使用性价比很高。

4.2 系统模块设计
心理咨询管理子系统系统在进行系统中功能模块的划分时,采用层次图来进行表示。层次图具有树形结构,它能使用矩形框来描绘数据信息。顶层代表的数据结构很完整,顶层下面的矩形框表示的数据就是子集数据,当然处于最下面的矩形框就是不能再进行细分的数据元素了,使用层次方框图描述系统功能能让用户一目了然,能够明白系统的功能,以及对应功能板块下面的子功能都可以清楚领会。心理咨询管理子系统分为管理员和用户两部分操作角色,下面将对他们的功能进行阐述。
管理员可以管理用户的基本信息,可以管理等功能。管理员功能结构图如下:
在这里插入图片描述

开发环境

编程语言:Java
数据库 :Mysql
系统架构:B/S
后端框架:SSM
编译工具:idea或者eclipse,jdk1.8,maven
支持定做:java/php/python/android/小程序/vue/爬虫/c#/asp.net

系统实现

5.1 管理员功能模块的实现
5.1.1 心理咨询预约列表
如图5.1显示的就是心理咨询预约列表页面,此页面提供给管理员的功能有:查看心理咨询预约、新增心理咨询预约、修改心理咨询预约、删除心理咨询预约等。
在这里插入图片描述

图5.1 心理咨询预约列表页面

5.1.2 公告信息管理
管理员可以对前台的注册用户的基本信息进行管理,可以设置注册用户的账号为冻结或者是在用状态,管理员也能选择很多个已经失效的注册用户的信息进行批量删除操作。注册用户管理界面如图5.2所示。
在这里插入图片描述

图5.2 公告信息管理页面

5.1.3 公告类型管理
公告类型管理页面显示所有公告类型,在此页面既可以让管理员添加新的公告信息类型,也能对已有的公告类型信息执行编辑更新,失效的公告类型信息也能让管理员快速删除。下图就是公告类型管理页面。公告类型管理界面如图5.3所示。
在这里插入图片描述

图5.3公告类型管理界面
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

核心代码


```java
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("/laoshiOrder")
public class LaoshiOrderController {
    private static final Logger logger = LoggerFactory.getLogger(LaoshiOrderController.class);

    @Autowired
    private LaoshiOrderService laoshiOrderService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service
    @Autowired
    private XueshengService xueshengService;
    @Autowired
    private LaoshiService laoshiService;



    /**
    * 后端列表
    */
    @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("xueshengId",request.getSession().getAttribute("userId"));
        else if("心理咨询老师".equals(role))
            params.put("laoshiId",request.getSession().getAttribute("userId"));
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = laoshiOrderService.queryPage(params);

        //字典表数据转换
        List<LaoshiOrderView> list =(List<LaoshiOrderView>)page.getList();
        for(LaoshiOrderView 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);
        LaoshiOrderEntity laoshiOrder = laoshiOrderService.selectById(id);
        if(laoshiOrder !=null){
            //entity转view
            LaoshiOrderView view = new LaoshiOrderView();
            BeanUtils.copyProperties( laoshiOrder , view );//把实体数据重构到view中

                //级联表
                XueshengEntity xuesheng = xueshengService.selectById(laoshiOrder.getXueshengId());
                if(xuesheng != null){
                    BeanUtils.copyProperties( xuesheng , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setXueshengId(xuesheng.getId());
                }
                //级联表
                LaoshiEntity laoshi = laoshiService.selectById(laoshiOrder.getLaoshiId());
                if(laoshi != null){
                    BeanUtils.copyProperties( laoshi , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setLaoshiId(laoshi.getId());
                }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("ve")
    public R save(@RequestBody LaoshiOrderEntity laoshiOrder, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,laoshiOrder:{}",this.getClass().getName(),laoshiOrder.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");
        else if("心理咨询老师".equals(role))
            laoshiOrder.setLaoshiId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        else if("学生".equals(role))
            laoshiOrder.setXueshengId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

        laoshiOrder.setInsertTime(new Date());
        laoshiOrder.setCreateTime(new Date());
        laoshiOrderService.insert(laoshiOrder);
        return R.ok();
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody LaoshiOrderEntity laoshiOrder, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,laoshiOrder:{}",this.getClass().getName(),laoshiOrder.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("心理咨询老师".equals(role))
//            laoshiOrder.setLaoshiId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
//        else if("学生".equals(role))
//            laoshiOrder.setXueshengId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        //根据字段查询是否有相同数据
        Wrapper<LaoshiOrderEntity> queryWrapper = new EntityWrapper<LaoshiOrderEntity>()
            .eq("id",0)
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        LaoshiOrderEntity laoshiOrderEntity = laoshiOrderService.selectOne(queryWrapper);
        if("".equals(laoshiOrder.getLaoshiOrderFile()) || "null".equals(laoshiOrder.getLaoshiOrderFile())){
                laoshiOrder.setLaoshiOrderFile(null);
        }
        if(laoshiOrderEntity==null){
            laoshiOrderService.updateById(laoshiOrder);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }


    /**
    * 后端修改
    */
    @RequestMapping("enhe")
    public R shenhe(@RequestBody LaoshiOrderEntity laoshiOrder, HttpServletRequest request){
        logger.debug("shenhe方法:,,Controller:{},,laoshiOrder:{}",this.getClass().getName(),laoshiOrder.toString());

        if(laoshiOrder.getLaoshiOrderYesnoTypes() ==2){

            LaoshiOrderEntity laoshiOrderEntity = laoshiOrderService.selectById(laoshiOrder.getId());


            List<LaoshiOrderEntity> laoshiOrderEntities = laoshiOrderService.selectList(
                    new EntityWrapper<LaoshiOrderEntity>()
                            .eq("laoshi_id", laoshiOrderEntity.getLaoshiId())
                            .eq("yuyue_time", new SimpleDateFormat("yyyy-MM-dd").format(laoshiOrderEntity.getYuyueTime()))
                            .eq("laoshi_order_yesno_types",2)
                    .orderDesc(Arrays.asList(new String[]{"laoshi_order_hao"}))
            );

            if(laoshiOrderEntities.size()>0){
                LaoshiOrderEntity laoshiOrderEntity1 = laoshiOrderEntities.get(0);
                Integer integer = Integer.valueOf(String.valueOf(laoshiOrderEntity1.getLaoshiOrderHao()))+1;
                laoshiOrder.setLaoshiOrderHao(String.valueOf(integer));
            }else{
                laoshiOrder.setLaoshiOrderHao(String.valueOf(1));
            }
        }



        laoshiOrderService.updateById(laoshiOrder);//根据id更新
            return R.ok();

    }

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        laoshiOrderService.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<LaoshiOrderEntity> laoshiOrderList = 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("../../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){
                            //循环
                            LaoshiOrderEntity laoshiOrderEntity = new LaoshiOrderEntity();
//                            laoshiOrderEntity.setLaoshiOrderUuidNumber(data.get(0));                    //预约流水号 要改的
//                            laoshiOrderEntity.setLaoshiId(Integer.valueOf(data.get(0)));   //心理咨询老师 要改的
//                            laoshiOrderEntity.setXueshengId(Integer.valueOf(data.get(0)));   //学生 要改的
//                            laoshiOrderEntity.setYuyueTime(sdf.parse(data.get(0)));          //预约日期 要改的
//                            laoshiOrderEntity.setLaoshiOrderHao(data.get(0));                    //当天的号 要改的
//                            laoshiOrderEntity.setLaoshiOrderYesnoTypes(Integer.valueOf(data.get(0)));   //预约状态 要改的
//                            laoshiOrderEntity.setLaoshiOrderYesnoText(data.get(0));                    //审核状态 要改的
//                            laoshiOrderEntity.setZixunjieguoText(data.get(0));                    //咨询结果 要改的
//                            laoshiOrderEntity.setLaoshiOrderFile(data.get(0));                    //心理咨询报告文件 要改的
//                            laoshiOrderEntity.setInsertTime(date);//时间
//                            laoshiOrderEntity.setCreateTime(date);//时间
                            laoshiOrderList.add(laoshiOrderEntity);


                            //把要查询是否重复的字段放入map中
                                //预约流水号
                                if(seachFields.containsKey("laoshiOrderUuidNumber")){
                                    List<String> laoshiOrderUuidNumber = seachFields.get("laoshiOrderUuidNumber");
                                    laoshiOrderUuidNumber.add(data.get(0));//要改的
                                }else{
                                    List<String> laoshiOrderUuidNumber = new ArrayList<>();
                                    laoshiOrderUuidNumber.add(data.get(0));//要改的
                                    seachFields.put("laoshiOrderUuidNumber",laoshiOrderUuidNumber);
                                }
                        }

                        //查询是否重复
                         //预约流水号
                        List<LaoshiOrderEntity> laoshiOrderEntities_laoshiOrderUuidNumber = laoshiOrderService.selectList(new EntityWrapper<LaoshiOrderEntity>().in("laoshi_order_uuid_number", seachFields.get("laoshiOrderUuidNumber")));
                        if(laoshiOrderEntities_laoshiOrderUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(LaoshiOrderEntity s:laoshiOrderEntities_laoshiOrderUuidNumber){
                                repeatFields.add(s.getLaoshiOrderUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [预约流水号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        laoshiOrderService.insertBatch(laoshiOrderList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }





    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("st")
    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 = laoshiOrderService.queryPage(params);

        //字典表数据转换
        List<LaoshiOrderView> list =(List<LaoshiOrderView>)page.getList();
        for(LaoshiOrderView 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);
        LaoshiOrderEntity laoshiOrder = laoshiOrderService.selectById(id);
            if(laoshiOrder !=null){


                //entity转view
                LaoshiOrderView view = new LaoshiOrderView();
                BeanUtils.copyProperties( laoshiOrder , view );//把实体数据重构到view中

                //级联表
                    XueshengEntity xuesheng = xueshengService.selectById(laoshiOrder.getXueshengId());
                if(xuesheng != null){
                    BeanUtils.copyProperties( xuesheng , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setXueshengId(xuesheng.getId());
                }
                //级联表
                    LaoshiEntity laoshi = laoshiService.selectById(laoshiOrder.getLaoshiId());
                if(laoshi != null){
                    BeanUtils.copyProperties( laoshi , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setLaoshiId(laoshi.getId());
                }
                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody LaoshiOrderEntity laoshiOrder, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,laoshiOrder:{}",this.getClass().getName(),laoshiOrder.toString());
            LaoshiEntity laoshiEntity = laoshiService.selectById(laoshiOrder.getLaoshiId());
            if(laoshiEntity == null){
                return R.error(511,"查不到该心理咨询老师");
            }
            // Double laoshiNewMoney = laoshiEntity.getLaoshiNewMoney();




            //计算所获得积分
            Double buyJifen =0.0;
            Integer userId = (Integer) request.getSession().getAttribute("userId");
            laoshiOrder.setXueshengId(userId); //设置订单支付人id

        LaoshiOrderEntity laoshiOrderEntity = laoshiOrderService.selectOne(new EntityWrapper<LaoshiOrderEntity>().eq("xuesheng_id", laoshiOrder.getXueshengId()).eq("laoshi_id", laoshiOrder.getLaoshiId()).notIn("laoshi_order_yesno_types", 3).eq("yuyue_time",new SimpleDateFormat("yyyy-MM-dd").format(laoshiOrder.getYuyueTime())));

        if(laoshiOrderEntity != null){
            if(laoshiOrderEntity.getLaoshiOrderYesnoTypes() ==1){
                return R.error("您已经预约了当天的心理咨询老师,无法重复预约,状态是已预约");
            }

            if(laoshiOrderEntity.getLaoshiOrderYesnoTypes() ==2){
                return R.error("您已经预约了当天的心理咨询老师,无法重复预约,状态是预约成功");
            }
        }


        laoshiOrder.setLaoshiOrderUuidNumber(String.valueOf(new Date().getTime()));
            laoshiOrder.setInsertTime(new Date());
            laoshiOrder.setCreateTime(new Date());
                laoshiOrderService.insert(laoshiOrder);//新增订单
            return R.ok();
    }



}

 

## 论文参考
![在这里插入图片描述](https://img-blog.csdnimg.cn/fd7b97cfd0524d9783714d7cdc48eda1.png)

目    录
摘    要	I
Abstract	II
目    录	III
第一章  课题背景及研究内容	1
1.1 课题背景	1
1.2 开发目的和意义	1
1.3 论文研究内容	1
第二章 相关技术	3
2.1 B/S结构	3
2.2 MySQL数据库	3
第三章 系统分析	5
3.1可行性分析	5
3.1.1时间可行性	5
3.1.2 经济可行性	5
3.1.3 操作可行性	5
3.1.4 技术可行性	5
3.1.5 法律可行性	5
3.2系统流程分析	6
3.3系统功能需求分析	7
3.4 系统非功能需求分析	7
第四章 系统设计	9
4.1 总体功能	9
4.2 系统模块设计	9
4.3 数据库设计	10
4.3.1 数据库设计	10
4.3.2 数据库E-R 图	10
4.3.3 数据库表设计	11
第五章 系统实现	13
5.1 管理员功能模块的实现	13
5.1.1 心理咨询预约列表	13
5.1.2 公告信息管理	13
5.1.3 公告类型管理	14
第六章 系统测试	15
6.1软件测试	15
6.2测试环境	16
6.3 测试用例	16
6.3.1 用户登录测试	16
6.4.2 添加公告类别测试	16
6.5测试结果	16
结  论	17
参考文献	19
致  谢	20
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

q_2781179521

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值