271 lines
8.8 KiB
Markdown
271 lines
8.8 KiB
Markdown
# 处方管理模块
|
||
|
||
## 概述
|
||
|
||
处方管理模块是 XK 系统的核心业务模块,负责处方的开具、审核、转诊、打印等全流程管理。
|
||
|
||
---
|
||
|
||
## 处方开具
|
||
|
||
### 接口
|
||
|
||
| 方法 | 路径 | 说明 |
|
||
|------|------|------|
|
||
| GET | `prescription/list` | 处方列表 |
|
||
| GET | `prescription/detail` | 处方详情 |
|
||
| POST | `prescription/add-chinese` | 创建中药处方 |
|
||
| POST | `prescription/add-west` | 创建西药处方 |
|
||
| POST | `prescription/add-granular` | 创建颗粒处方 |
|
||
| POST | `prescription/add-simple` | 创建简单处方(中成药/服务包/非药品/医疗器械) |
|
||
| POST | `prescription/update` | 更新处方 |
|
||
| POST | `prescription/delete` | 删除处方 |
|
||
| GET | `prescription/print` | 处方打印 |
|
||
|
||
### 关联类
|
||
|
||
| 类 | 文件 | 说明 |
|
||
|----|------|------|
|
||
| `PrescriptionController` | `app/Http/Controllers/admin/business/prescription/PrescriptionController.php` | 控制器 |
|
||
| `PrescriptionService` | `app/Service/admin/business/prescription/PrescriptionService.php` | 业务服务 |
|
||
| `PrescriptionModel` | `app/Models/old/prescription/PrescriptionModel.php` | 主处方模型 |
|
||
| `PrescriptionChineseModel` | `app/Models/old/prescription/PrescriptionChineseModel.php` | 中药处方模型 |
|
||
| `PrescriptionWestModel` | `app/Models/old/prescription/PrescriptionWestModel.php` | 西药处方模型 |
|
||
| `PrescriptionGranularModel` | `app/Models/old/prescription/PrescriptionGranularModel.php` | 颗粒处方模型 |
|
||
| `PrescriptionServerModel` | `app/Models/old/prescription/PrescriptionServerModel.php` | 服务包处方模型 |
|
||
| `PrescriptionPrintService` | `app/Service/admin/hy/PrescriptionPrintService.php` | 打印服务 |
|
||
| `HyRecipeHtmlRenderer` | `app/Service/admin/hy/HyRecipeHtmlRenderer.php` | HTML 渲染 |
|
||
|
||
### 关联模型
|
||
|
||
| 模型 | 表名 | 说明 |
|
||
|------|------|------|
|
||
| `PrescriptionModel` | `yii_prescription` | 主处方表 |
|
||
| `PrescriptionChineseModel` | `yii_prescription_chinese` | 中药处方 |
|
||
| `PrescriptionWestModel` | `yii_prescription_west` | 西药处方 |
|
||
| `PrescriptionGranularModel` | `yii_prescription_granular` | 颗粒处方 |
|
||
| `PrescriptionServerModel` | `yii_prescription_server` | 服务包处方 |
|
||
|
||
### 处方状态机
|
||
|
||
```mermaid
|
||
stateDiagram-v2
|
||
[*] --> 待审核: 医生开方
|
||
待审核 --> 通过: 医生初审通过
|
||
待审核 --> 未通过: 审核拒绝
|
||
通过 --> 药师复审: 药师审核
|
||
药师复审 --> 生效: 复审通过
|
||
药师复审 --> 未通过: 复审拒绝
|
||
生效 --> 已使用: 患者购药
|
||
生效 --> 已过期: 超时未用
|
||
```
|
||
|
||
### 处方类型
|
||
|
||
| 类型 | 值 | 说明 |
|
||
|------|-----|------|
|
||
| 中药 | 1 | 中药饮片处方 |
|
||
| 西药 | 2 | 西药处方 |
|
||
| 颗粒 | 3 | 配方颗粒处方 |
|
||
| 中成药 | 4 | 中成药处方 |
|
||
| 产品服务包 | 5 | 服务包处方 |
|
||
|
||
### 处方状态
|
||
|
||
| 状态 | 值 | 说明 |
|
||
|------|-----|------|
|
||
| 待审核 | 0 | 医生已开方,等待审核 |
|
||
| 通过 | 1 | 审核通过 |
|
||
| 未通过 | 2 | 审核拒绝 |
|
||
| 无需审核 | 3 | 免审处方 |
|
||
|
||
### 处方开具流程
|
||
|
||
```mermaid
|
||
sequenceDiagram
|
||
participant D as 医生
|
||
participant C as PrescriptionController
|
||
participant S as PrescriptionService
|
||
participant M as PrescriptionModel
|
||
participant DB as 数据库
|
||
|
||
D->>C: POST prescription/add-chinese
|
||
C->>S: addChinesePrescription(data)
|
||
S->>S: validateData(data)
|
||
S->>M: create(prescription)
|
||
M->>DB: INSERT INTO yii_prescription
|
||
S->>M: createChinese(items)
|
||
M->>DB: INSERT INTO yii_prescription_chinese
|
||
S-->>C: prescription_id
|
||
C-->>D: 处方创建成功
|
||
```
|
||
|
||
---
|
||
|
||
## 处方审核
|
||
|
||
### 接口
|
||
|
||
| 方法 | 路径 | 说明 |
|
||
|------|------|------|
|
||
| GET | `audit-prescription/list` | 待审处方列表 |
|
||
| GET | `audit-prescription/detail` | 处方详情 |
|
||
| POST | `audit-prescription/audit` | 审核操作 |
|
||
| POST | `audit-prescription/reject` | 拒绝操作 |
|
||
|
||
### 关联类
|
||
|
||
| 类 | 文件 | 说明 |
|
||
|----|------|------|
|
||
| `AuditPrescriptionController` | `app/Http/Controllers/admin/business/prescription/AuditPrescriptionController.php` | 控制器 |
|
||
| `AuditPrescriptionService` | `app/Service/admin/business/prescription/AuditPrescriptionService.php` | 业务服务 |
|
||
|
||
### 关联模型
|
||
|
||
| 模型 | 表名 | 说明 |
|
||
|------|------|------|
|
||
| `PrescriptionModel` | `yii_prescription` | 主处方表 |
|
||
|
||
### 审核流程
|
||
|
||
```mermaid
|
||
sequenceDiagram
|
||
participant A as 审核员
|
||
participant C as AuditPrescriptionController
|
||
participant S as AuditPrescriptionService
|
||
participant M as PrescriptionModel
|
||
|
||
A->>C: POST audit-prescription/audit
|
||
C->>S: audit(prescription_id, action)
|
||
S->>M: findById(prescription_id)
|
||
S->>S: checkPermission(audit_user)
|
||
|
||
alt 医生初审
|
||
S->>M: update(status=1, first_view, first_sign)
|
||
else 药师复审
|
||
S->>M: update(status=1, again_view, again_sign)
|
||
end
|
||
|
||
S-->>C: audit_result
|
||
C-->>A: 审核成功
|
||
```
|
||
|
||
---
|
||
|
||
## 转诊处方
|
||
|
||
### 接口
|
||
|
||
| 方法 | 路径 | 说明 |
|
||
|------|------|------|
|
||
| GET | `transfer-prescription/list` | 转诊处方列表 |
|
||
| GET | `transfer-prescription/detail` | 转诊详情 |
|
||
| POST | `transfer-prescription/create` | 创建转诊 |
|
||
| POST | `transfer-prescription/confirm` | 确认转诊 |
|
||
| POST | `transfer-prescription/import` | 导入转诊 |
|
||
| POST | `transfer-prescription/cancel` | 取消转诊 |
|
||
|
||
### 关联类
|
||
|
||
| 类 | 文件 | 说明 |
|
||
|----|------|------|
|
||
| `TransferPrescriptionController` | `app/Http/Controllers/admin/business/prescription/TransferPrescriptionController.php` | 控制器 |
|
||
| `TransferPrescriptionService` | `app/Service/admin/business/prescription/TransferPrescriptionService.php` | 业务服务 |
|
||
| `TransferPrescriptionModel` | `app/Models/old/prescription/TransferPrescriptionModel.php` | 模型 |
|
||
| `TransferQuestionService` | `app/Service/admin/business/prescription/TransferQuestionService.php` | 问题配置 |
|
||
| `TransferAssistantConfigService` | `app/Service/admin/business/prescription/TransferAssistantConfigService.php` | 助手配置 |
|
||
|
||
### 关联模型
|
||
|
||
| 模型 | 表名 | 说明 |
|
||
|------|------|------|
|
||
| `TransferPrescriptionModel` | `yii_transfer_prescription` | 转诊处方 |
|
||
| `TransferQuestionModel` | `xk_transfer_question` | 转诊问题 |
|
||
| `TransferPrescriptionQuestionModel` | `xk_transfer_prescription_question` | 转诊问答 |
|
||
| `TransferAssistantConfigModel` | `xk_transfer_assistant_config` | 转诊助手配置 |
|
||
|
||
### 转诊流程
|
||
|
||
```mermaid
|
||
sequenceDiagram
|
||
participant O as 转诊方(发起)
|
||
participant R as 接收方(接收)
|
||
participant DB as 数据库
|
||
|
||
O->>DB: 创建转诊处方(transfer_prescription)
|
||
O->>O: 设置 is_from_transfer=1
|
||
|
||
Note over O,R: 转诊方获得 100% 利润
|
||
|
||
R->>DB: 确认接收
|
||
R->>DB: 导入为注册订单(register)
|
||
R->>DB: 创建处方(prescription)
|
||
R->>DB: 设置 store_id = delegate_store_id
|
||
```
|
||
|
||
### 转诊分账规则
|
||
|
||
::: warning 关键逻辑
|
||
- 转诊方(发起方)获得 **100%** 利润
|
||
- 接收方(被转方)获得 **0%** 利润
|
||
- 处方来源自动设为接收方门店(`store_id = delegate_store_id`)
|
||
:::
|
||
|
||
---
|
||
|
||
## 常用处方
|
||
|
||
### 接口
|
||
|
||
| 方法 | 路径 | 说明 |
|
||
|------|------|------|
|
||
| GET | `common-prescription/list` | 常用处方列表 |
|
||
| POST | `common-prescription/create` | 创建常用处方 |
|
||
| POST | `common-prescription/update` | 更新常用处方 |
|
||
| POST | `common-prescription/delete` | 删除常用处方 |
|
||
|
||
### 关联类
|
||
|
||
| 类 | 文件 | 说明 |
|
||
|----|------|------|
|
||
| `CommonPrescriptionController` | `app/Http/Controllers/admin/business/doctor/CommonPrescriptionController.php` | 控制器 |
|
||
| `CommonPrescriptionService` | `app/Service/admin/business/doctor/CommonPrescriptionService.php` | 业务服务 |
|
||
|
||
---
|
||
|
||
## 转诊问题配置
|
||
|
||
### 接口
|
||
|
||
| 方法 | 路径 | 说明 |
|
||
|------|------|------|
|
||
| GET | `transfer-question/list` | 问题列表 |
|
||
| POST | `transfer-question/create` | 创建问题 |
|
||
| POST | `transfer-question/update` | 更新问题 |
|
||
| POST | `transfer-question/delete` | 删除问题 |
|
||
|
||
### 关联类
|
||
|
||
| 类 | 文件 | 说明 |
|
||
|----|------|------|
|
||
| `TransferQuestionController` | `app/Http/Controllers/admin/business/prescription/TransferQuestionController.php` | 控制器 |
|
||
| `TransferQuestionService` | `app/Service/admin/business/prescription/TransferQuestionService.php` | 业务服务 |
|
||
|
||
---
|
||
|
||
## 转诊助手配置
|
||
|
||
### 接口
|
||
|
||
| 方法 | 路径 | 说明 |
|
||
|------|------|------|
|
||
| GET | `transfer-assistant-config/detail` | 助手配置详情 |
|
||
| POST | `transfer-assistant-config/update` | 更新助手配置 |
|
||
|
||
### 关联类
|
||
|
||
| 类 | 文件 | 说明 |
|
||
|----|------|------|
|
||
| `TransferAssistantConfigController` | `app/Http/Controllers/admin/business/prescription/TransferAssistantConfigController.php` | 控制器 |
|
||
| `TransferAssistantConfigService` | `app/Service/admin/business/prescription/TransferAssistantConfigService.php` | 业务服务 |
|