Files
hzdyjs/docs/需求文档/心理咨询预约需求/心理咨询预约系统需求说明.md

234 lines
11 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 心理健康系统-心理咨询预约功能需求说明(xljk_consultation)
## 1. 项目定位
- **一级模块**:心理健康系统(Mental Health System)
- **二级功能**:心理咨询预约(Consultation Appointment)
- **功能标识前缀**:xljk_consultation
- **其他二级功能举例**:心理健康测评(xljk_evaluation)、心理危机干预等
## 2. 主要功能
### 2.1 预约时段管理(心理健康管理员)
- 设置咨询师工作日历(可选上午/下午、时间段、最大预约数、状态)
- 支持批量配置、复制、日历/表格视图
### 2.2 预约申请与处理
- 学生自主预约
- 咨询师处理预约(确认/拒绝/记录到访情况/填写咨询内容)
- 预约三次不到自动限制
### 2.3 咨询记录管理
- 咨询师填写沟通时长、内容
- 历史记录可查
### 2.4 统计与报表
- 按学期统计预约数、到访数、到访率、沟通时长
- 支持班级、专业等维度
### 2.5 角色权限
- 管理员:配置时段、管理咨询师、查阅统计
- 咨询师:处理预约、填写记录、查阅统计
- 班主任:查阅本班学生预约情况
- 学生:自主预约、查阅个人记录
## 3. 数据结构设计(表名全部以xljk_consultation_为前缀)
### 3.1 咨询师表(xljk_consultation_counselor)
| 字段名 | 类型 | 说明 |
| -------------- | ------------ | ------------ |
| id | bigint(20) NOT NULL | 主键ID |
| tenant_id | varchar(20) NOT NULL DEFAULT '000000' | 租户编号 |
| create_dept | bigint(20) DEFAULT NULL | 创建部门 |
| create_by | bigint(20) DEFAULT NULL | 创建者 |
| create_time | datetime DEFAULT NULL | 创建时间 |
| update_by | bigint(20) DEFAULT NULL | 更新者 |
| update_time | datetime DEFAULT NULL | 更新时间 |
| deleted | tinyint(1) DEFAULT 0 | 删除标志(0代表存在 1代表删除) |
| name | varchar(50) | 咨询师姓名 |
| work_no | varchar(20) | 工号 |
| title | varchar(50) | 职称 |
| specialty | varchar(255) | 专长领域 |
| introduction | text | 简介 |
| status | char(1) | 状态(0正常 1停用)|
### 3.2 预约时段表(xljk_consultation_schedule)
| 字段名 | 类型 | 说明 |
| ------------------ | ------------ | ------------ |
| id | bigint(20) NOT NULL | 主键ID |
| tenant_id | varchar(20) NOT NULL DEFAULT '000000' | 租户编号 |
| create_dept | bigint(20) DEFAULT NULL | 创建部门 |
| create_by | bigint(20) DEFAULT NULL | 创建者 |
| create_time | datetime DEFAULT NULL | 创建时间 |
| update_by | bigint(20) DEFAULT NULL | 更新者 |
| update_time | datetime DEFAULT NULL | 更新时间 |
| deleted | tinyint(1) DEFAULT 0 | 删除标志(0代表存在 1代表删除) |
| counselor_id | bigint(20) | 咨询师ID |
| schedule_date | date | 日期 |
| morning_enabled | tinyint(1) | 上午启用 |
| morning_start_time | time | 上午开始 |
| morning_end_time | time | 上午结束 |
| afternoon_enabled | tinyint(1) | 下午启用 |
| afternoon_start_time| time | 下午开始 |
| afternoon_end_time | time | 下午结束 |
| max_appointments | int | 最大预约数 |
| current_appointments| int | 当前预约数 |
| status | char(1) | 0可预约 1已满 2停用 |
### 3.3 预约记录表(xljk_consultation_appointment)
| 字段名 | 类型 | 说明 |
| ------------------ | ------------ | ------------ |
| id | bigint(20) NOT NULL | 主键ID |
| tenant_id | varchar(20) NOT NULL DEFAULT '000000' | 租户编号 |
| create_dept | bigint(20) DEFAULT NULL | 创建部门 |
| create_by | bigint(20) DEFAULT NULL | 创建者 |
| create_time | datetime DEFAULT NULL | 创建时间 |
| update_by | bigint(20) DEFAULT NULL | 更新者 |
| update_time | datetime DEFAULT NULL | 更新时间 |
| deleted | tinyint(1) DEFAULT 0 | 删除标志(0代表存在 1代表删除) |
| student_id | bigint(20) | 学生ID |
| student_name | varchar(50) | 学生姓名 |
| student_no | varchar(20) | 学号 |
| phone | varchar(20) | 手机号 |
| major | varchar(100) | 专业 |
| class_name | varchar(50) | 班级 |
| counselor_id | bigint(20) | 咨询师ID |
| schedule_id | bigint(20) | 预约时段ID |
| appointment_date | date | 预约日期 |
| time_slot | char(1) | 0上午 1下午 |
| status | char(1) | 0待处理 1已确认 2已完成 3已取消 4未到访 |
| apply_time | datetime | 申请时间 |
| process_time | datetime | 处理时间 |
| process_remark | varchar(500) | 处理备注 |
### 3.4 咨询记录表(xljk_consultation_record)
| 字段名 | 类型 | 说明 |
| ------------------ | ------------ | ------------ |
| id | bigint(20) NOT NULL | 主键ID |
| tenant_id | varchar(20) NOT NULL DEFAULT '000000' | 租户编号 |
| create_dept | bigint(20) DEFAULT NULL | 创建部门 |
| create_by | bigint(20) DEFAULT NULL | 创建者 |
| create_time | datetime DEFAULT NULL | 创建时间 |
| update_by | bigint(20) DEFAULT NULL | 更新者 |
| update_time | datetime DEFAULT NULL | 更新时间 |
| deleted | tinyint(1) DEFAULT 0 | 删除标志(0代表存在 1代表删除) |
| appointment_id | bigint(20) | 预约记录ID |
| visit_status | char(1) | 0正常到访 1未到访 |
| duration | int | 沟通时长(分钟)|
| content | text | 咨询内容 |
### 3.5 未到访记录表(xljk_consultation_no_show)
| 字段名 | 类型 | 说明 |
| ------------------ | ------------ | ------------ |
| id | bigint(20) NOT NULL | 主键ID |
| tenant_id | varchar(20) NOT NULL DEFAULT '000000' | 租户编号 |
| create_dept | bigint(20) DEFAULT NULL | 创建部门 |
| create_by | bigint(20) DEFAULT NULL | 创建者 |
| create_time | datetime DEFAULT NULL | 创建时间 |
| update_by | bigint(20) DEFAULT NULL | 更新者 |
| update_time | datetime DEFAULT NULL | 更新时间 |
| deleted | tinyint(1) DEFAULT 0 | 删除标志(0代表存在 1代表删除) |
| student_id | bigint(20) | 学生ID |
| appointment_id | bigint(20) | 预约记录ID |
| no_show_date | date | 未到访日期 |
| expire_date | date | 限制到期日 |
| status | char(1) | 0生效中 1已过期 2已解除 |
## 4. API设计(全部以/xljk/consultation为前缀)
### 4.1 预约时段管理
- GET `/api/xljk/consultation/schedule/list`
- GET `/api/xljk/consultation/schedule/{id}`
- POST `/api/xljk/consultation/schedule`
- PUT `/api/xljk/consultation/schedule`
- DELETE `/api/xljk/consultation/schedule/{ids}`
- POST `/api/xljk/consultation/schedule/batch`
- POST `/api/xljk/consultation/schedule/copy`
- GET `/api/xljk/consultation/schedule/calendar`
### 4.2 预约管理
- GET `/api/xljk/consultation/appointment/list`
- GET `/api/xljk/consultation/appointment/{id}`
- POST `/api/xljk/consultation/appointment/apply`
- POST `/api/xljk/consultation/appointment/process`
- POST `/api/xljk/consultation/appointment/record`
- GET `/api/xljk/consultation/appointment/record/{appointmentId}`
- POST `/api/xljk/consultation/appointment/cancel`
- GET `/api/xljk/consultation/appointment/student`
### 4.3 咨询师管理
- GET `/api/xljk/consultation/counselor/list`
- GET `/api/xljk/consultation/counselor/{id}`
- POST `/api/xljk/consultation/counselor`
- PUT `/api/xljk/consultation/counselor`
- DELETE `/api/xljk/consultation/counselor/{ids}`
### 4.4 统计与报表
- GET `/api/xljk/consultation/statistics/overview`
- GET `/api/xljk/consultation/statistics/by-class`
- GET `/api/xljk/consultation/statistics/by-major`
- GET `/api/xljk/consultation/statistics/by-semester`
### 4.5 预约限制管理
- GET `/api/xljk/consultation/no-show/list` # 查询未到访记录列表
- GET `/api/xljk/consultation/no-show/{id}` # 获取未到访记录详情
- PUT `/api/xljk/consultation/no-show/{id}/release` # 解除预约限制
- GET `/api/xljk/consultation/no-show/check-limitation` # 检查学生是否被限制预约
## 5. 权限标识建议
- `xljk:consultation:schedule:list`
- `xljk:consultation:appointment:apply`
- `xljk:consultation:appointment:process`
- `xljk:consultation:appointment:record`
- `xljk:consultation:counselor:list`
- `xljk:consultation:statistics:view`
- `xljk:consultation:noshow:list` # 查看未到访记录列表
- `xljk:consultation:noshow:query` # 查看未到访记录详情
- `xljk:consultation:noshow:release` # 解除预约限制
## 6. 业务流程
### 6.1 预约流程
1. 管理员设置预约时段
2. 学生发起预约申请
3. 咨询师处理预约申请(确认/拒绝)
4. 系统通知学生预约结果
### 6.2 咨询流程
1. 学生按预约时间到访
2. 咨询师进行咨询
3. 咨询师记录咨询情况(到访情况、沟通时长、咨询内容)
4. 系统更新预约状态为"已完成"
### 6.3 未到访处理流程
1. 学生未按预约时间到访
2. 咨询师记录为"未到访"
3. 系统在`xljk_consultation_no_show`表中创建未到访记录
4. 系统检查30天内学生未到访次数
5. 如达到三次未到访,系统自动限制7天内不能预约(从最后一次未到访日期算起,不含当天)
6. 限制期间学生尝试预约时,系统提示预约受限及解除日期
### 6.4 预约限制解除流程
1. **自动解除**:
- 系统定期检查限制记录
- 限制期满7天后,自动将状态更新为"已过期(1)"
- 状态更新后,学生可以正常预约
2. **手动解除**:
- 心理健康管理员可通过"预约限制解除"菜单查看限制记录
- 管理员可手动解除限制,将状态更改为"已解除(2)"
- 手动解除后,学生立即可以正常预约
3. **限制状态说明**:
- "生效中(0)":限制当前有效,学生无法预约
- "已过期(1)":限制已自动到期,学生可以预约
- "已解除(2)":限制被管理员手动解除,学生可以预约
## 7. 其他说明
- 咨询内容属于高度敏感信息,需要特别注意保密
- 预约规则可能需要根据实际情况进行调整
- 当前仅支持一位咨询师,后续可扩展多咨询师
- 所有表均包含基础字段(创建者、创建时间、更新者、更新时间、逻辑删除、租户ID)
- 预约限制功能中,30天内累计三次未到访的计算以`no_show_date`字段为准
- 预约限制到期日计算公式:`expire_date = no_show_date + 7天`(不包含未到访当天)
- 预约限制解除页面仅显示有限制的记录(即`status`有值的记录)