213 lines
5.0 KiB
Markdown
213 lines
5.0 KiB
Markdown
# 医生预约系统快速开始指南
|
|
|
|
## 快速安装
|
|
|
|
### Windows用户
|
|
|
|
```bash
|
|
# 双击运行
|
|
install_appointment_system.bat
|
|
```
|
|
|
|
### Linux/Mac用户
|
|
|
|
```bash
|
|
# 添加执行权限
|
|
chmod +x install_appointment_system.sh
|
|
|
|
# 运行安装脚本
|
|
./install_appointment_system.sh
|
|
```
|
|
|
|
### 手动安装
|
|
|
|
1. **创建数据库表**
|
|
```bash
|
|
mysql -u username -p database < server/sql/doctor_appointment.sql
|
|
```
|
|
|
|
2. **清除缓存**
|
|
```bash
|
|
cd server
|
|
php think clear
|
|
```
|
|
|
|
3. **验证安装**
|
|
访问: `http://your-domain/adminapi/doctor.appointment/availableSlots?doctor_id=1&appointment_date=2026-03-04&period=morning`
|
|
|
|
## 文件清单
|
|
|
|
### 后端文件 (已创建)
|
|
- ✅ `server/app/common/model/doctor/Appointment.php` - 数据模型
|
|
- ✅ `server/app/adminapi/controller/doctor/AppointmentController.php` - 控制器
|
|
- ✅ `server/app/adminapi/logic/doctor/AppointmentLogic.php` - 业务逻辑
|
|
- ✅ `server/app/adminapi/validate/doctor/AppointmentValidate.php` - 验证器
|
|
- ✅ `server/app/adminapi/lists/doctor/AppointmentLists.php` - 列表
|
|
- ✅ `server/sql/doctor_appointment.sql` - 数据库脚本
|
|
|
|
### 前端文件 (已创建)
|
|
- ✅ `admin/src/api/doctor.ts` - API接口
|
|
- ✅ `admin/src/views/tcm/diagnosis/appointment.vue` - 预约组件
|
|
- ✅ `admin/src/views/tcm/diagnosis/index.vue` - 诊断列表(已更新)
|
|
|
|
## API接口速查
|
|
|
|
### 1. 获取可用时间段
|
|
```
|
|
GET /adminapi/doctor.appointment/availableSlots
|
|
参数: doctor_id, appointment_date, period
|
|
```
|
|
|
|
### 2. 创建预约
|
|
```
|
|
POST /adminapi/doctor.appointment/create
|
|
参数: patient_id, doctor_id, appointment_date, period, appointment_time
|
|
```
|
|
|
|
### 3. 取消预约
|
|
```
|
|
POST /adminapi/doctor.appointment/cancel
|
|
参数: id
|
|
```
|
|
|
|
### 4. 预约列表
|
|
```
|
|
GET /adminapi/doctor.appointment/lists
|
|
参数: page_no, page_size
|
|
```
|
|
|
|
### 5. 医生可用号源
|
|
```
|
|
GET /adminapi/doctor.appointment/doctorAvailability
|
|
参数: doctor_id, date
|
|
```
|
|
|
|
## 测试步骤
|
|
|
|
### 1. 准备测试数据
|
|
|
|
创建医生排班:
|
|
```sql
|
|
INSERT INTO `la_doctor_roster`
|
|
(`doctor_id`, `date`, `period`, `status`, `quota`, `max_patients`, `create_time`, `update_time`)
|
|
VALUES
|
|
(1, '2026-03-04', 'morning', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
|
|
(1, '2026-03-04', 'afternoon', 1, 10, 15, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
|
|
```
|
|
|
|
### 2. 测试API
|
|
|
|
使用Postman或curl测试:
|
|
|
|
```bash
|
|
# 获取可用时间段
|
|
curl "http://localhost/adminapi/doctor.appointment/availableSlots?doctor_id=1&appointment_date=2026-03-04&period=morning"
|
|
|
|
# 创建预约
|
|
curl -X POST "http://localhost/adminapi/doctor.appointment/create" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"patient_id": 1,
|
|
"doctor_id": 1,
|
|
"appointment_date": "2026-03-04",
|
|
"period": "morning",
|
|
"appointment_time": "09:00",
|
|
"appointment_type": "video"
|
|
}'
|
|
```
|
|
|
|
### 3. 测试前端
|
|
|
|
1. 登录后台管理系统
|
|
2. 进入"中医诊断"页面
|
|
3. 点击任意患者的"挂号"按钮
|
|
4. 选择医生、日期、时间段
|
|
5. 点击"确定"完成预约
|
|
|
|
## 常见问题
|
|
|
|
### Q1: 控制器不存在
|
|
**A**: 运行 `cd server && php think clear` 清除缓存
|
|
|
|
### Q2: 数据库表不存在
|
|
**A**: 执行 `mysql -u username -p database < server/sql/doctor_appointment.sql`
|
|
|
|
### Q3: 没有可用时间段
|
|
**A**: 检查医生是否有排班,排班状态是否为"出诊"(status=1)
|
|
|
|
### Q4: 预约失败
|
|
**A**: 检查:
|
|
- 医生排班是否存在
|
|
- 时间段是否已被占用
|
|
- 号源是否已满
|
|
|
|
## 权限配置
|
|
|
|
在后台权限管理中添加以下权限节点:
|
|
|
|
```
|
|
doctor.appointment/availableSlots - 查看可用时间段
|
|
doctor.appointment/create - 创建预约
|
|
doctor.appointment/cancel - 取消预约
|
|
doctor.appointment/lists - 预约列表
|
|
doctor.appointment/detail - 预约详情
|
|
```
|
|
|
|
## 数据库表结构
|
|
|
|
```sql
|
|
la_doctor_appointment
|
|
├── id (主键)
|
|
├── patient_id (患者ID)
|
|
├── doctor_id (医生ID)
|
|
├── roster_id (排班ID)
|
|
├── appointment_date (预约日期)
|
|
├── period (时段: morning/afternoon)
|
|
├── appointment_time (预约时间)
|
|
├── appointment_type (预约类型: video/text/phone)
|
|
├── status (状态: 1=已预约, 2=已取消, 3=已完成)
|
|
├── remark (备注)
|
|
├── create_time (创建时间)
|
|
└── update_time (更新时间)
|
|
```
|
|
|
|
## 业务规则
|
|
|
|
1. **时间段间隔**: 30分钟
|
|
2. **上午时段**: 09:00 - 11:30
|
|
3. **下午时段**: 13:00 - 20:30
|
|
4. **预约限制**:
|
|
- 必须有医生排班
|
|
- 排班状态必须为"出诊"
|
|
- 时间段不能重复预约
|
|
- 预约数不能超过号源数
|
|
|
|
## 下一步
|
|
|
|
1. ✅ 安装完成
|
|
2. ⏳ 配置权限
|
|
3. ⏳ 创建测试数据
|
|
4. ⏳ 测试功能
|
|
5. ⏳ 上线使用
|
|
|
|
## 相关文档
|
|
|
|
- 详细安装说明: `server/APPOINTMENT_BACKEND_SETUP.md`
|
|
- 系统设计文档: `admin/APPOINTMENT_SYSTEM.md`
|
|
- UI更新说明: `admin/APPOINTMENT_UI_UPDATE.md`
|
|
- 实现总结: `admin/APPOINTMENT_IMPLEMENTATION_SUMMARY.md`
|
|
|
|
## 技术支持
|
|
|
|
如遇问题,请检查:
|
|
1. PHP版本 >= 7.2
|
|
2. MySQL版本 >= 5.7
|
|
3. ThinkPHP框架正常运行
|
|
4. 数据库连接配置正确
|
|
|
|
---
|
|
|
|
**版本**: 1.0.0
|
|
**创建时间**: 2024-02-26
|
|
**最后更新**: 2024-02-26
|