218 lines
6.9 KiB
Markdown
218 lines
6.9 KiB
Markdown
# 药品管理模块
|
|
|
|
## 概述
|
|
|
|
药品管理模块负责药品目录、分类、定价、仓库管理、价格同步等。
|
|
|
|
---
|
|
|
|
## 西药/中成药
|
|
|
|
### 接口
|
|
|
|
| 方法 | 路径 | 说明 |
|
|
|------|------|------|
|
|
| GET | `western-medicine/list` | 药品列表 |
|
|
| GET | `western-medicine/detail` | 药品详情 |
|
|
| POST | `western-medicine/create` | 创建药品 |
|
|
| POST | `western-medicine/update` | 更新药品 |
|
|
| POST | `western-medicine/status` | 上下架 |
|
|
|
|
### 关联类
|
|
|
|
| 类 | 文件 | 说明 |
|
|
|----|------|------|
|
|
| `WesternMedicineController` | `app/Http/Controllers/admin/business/product/WesternMedicineController.php` | 控制器 |
|
|
| `WesternMedicineService` | `app/Service/admin/business/product/WesternMedicineService.php` | 业务服务 |
|
|
|
|
### 关联模型
|
|
|
|
| 模型 | 表名 | 说明 |
|
|
|------|------|------|
|
|
| `DrugModel` | `yii_drug` | 药品主表 |
|
|
| `DrugStoreRelationsModel` | `yii_drug_store_relations` | 药品-门店定价 |
|
|
|
|
---
|
|
|
|
## 中药
|
|
|
|
### 接口
|
|
|
|
| 方法 | 路径 | 说明 |
|
|
|------|------|------|
|
|
| GET | `china-medicine/list` | 中药列表 |
|
|
| GET | `china-medicine/detail` | 中药详情 |
|
|
| POST | `china-medicine/create` | 创建中药 |
|
|
| POST | `china-medicine/update` | 更新中药 |
|
|
|
|
### 关联类
|
|
|
|
| 类 | 文件 | 说明 |
|
|
|----|------|------|
|
|
| `ChinaMedicineController` | `app/Http/Controllers/admin/business/product/ChinaMedicineController.php` | 控制器 |
|
|
| `ChinaMedicineService` | `app/Service/admin/business/product/ChinaMedicineService.php` | 业务服务 |
|
|
|
|
### 关联模型
|
|
|
|
| 模型 | 表名 | 说明 |
|
|
|------|------|------|
|
|
| `DrugModel` | `yii_drug` | 药品主表 |
|
|
| `DrugNatureModel` | `yii_drug_nature` | 药品配伍(十八反十九畏) |
|
|
|
|
### 中药配伍禁忌
|
|
|
|
| 类型 | 常量 | 说明 |
|
|
|------|------|------|
|
|
| 十八反 | `OPPOSITION` | 相反药物不能同用 |
|
|
| 十九畏 | `CONFLICT` | 相畏药物需谨慎 |
|
|
| 有毒药材 | `POISONOUS` | 有毒性药材 |
|
|
|
|
---
|
|
|
|
## 保健食品
|
|
|
|
### 接口
|
|
|
|
| 方法 | 路径 | 说明 |
|
|
|------|------|------|
|
|
| GET | `health-food/list` | 保健食品列表 |
|
|
| POST | `health-food/create` | 创建 |
|
|
| POST | `health-food/update` | 更新 |
|
|
|
|
### 关联类
|
|
|
|
| 类 | 文件 | 说明 |
|
|
|----|------|------|
|
|
| `HealthFoodController` | `app/Http/Controllers/admin/business/product/HealthFoodController.php` | 控制器 |
|
|
| `HealthFoodService` | `app/Service/admin/business/product/HealthFoodService.php` | 业务服务 |
|
|
|
|
---
|
|
|
|
## 非药品/医疗器械
|
|
|
|
### 接口
|
|
|
|
| 方法 | 路径 | 说明 |
|
|
|------|------|------|
|
|
| GET | `non-drug/list` | 非药品列表 |
|
|
| POST | `non-drug/create` | 创建 |
|
|
| GET | `medical-device/list` | 医疗器械列表 |
|
|
| POST | `medical-device/create` | 创建 |
|
|
|
|
### 关联类
|
|
|
|
| 类 | 文件 | 说明 |
|
|
|----|------|------|
|
|
| `NonDrugController` | `app/Http/Controllers/admin/business/product/NonDrugController.php` | 非药品控制器 |
|
|
| `MedicalDeviceController` | `app/Http/Controllers/admin/business/product/MedicalDeviceController.php` | 医疗器械控制器 |
|
|
| `NonDrugService` | `app/Service/admin/business/product/NonDrugService.php` | 非药品服务 |
|
|
| `MedicalDeviceService` | `app/Service/admin/business/product/MedicalDeviceService.php` | 医疗器械服务 |
|
|
|
|
---
|
|
|
|
## 药品分类
|
|
|
|
### 接口
|
|
|
|
| 方法 | 路径 | 说明 |
|
|
|------|------|------|
|
|
| GET | `drug-categories/list` | 分类列表 |
|
|
| POST | `drug-categories/create` | 创建分类 |
|
|
| POST | `drug-categories/update` | 更新分类 |
|
|
| POST | `drug-categories/delete` | 删除分类 |
|
|
|
|
### 关联类
|
|
|
|
| 类 | 文件 | 说明 |
|
|
|----|------|------|
|
|
| `DrugCategoriesController` | `app/Http/Controllers/admin/business/product/DrugCategoriesController.php` | 控制器 |
|
|
| `DrugCategoriesService` | `app/Service/admin/business/product/DrugCategoriesService.php` | 业务服务 |
|
|
|
|
### 关联模型
|
|
|
|
| 模型 | 表名 | 说明 |
|
|
|------|------|------|
|
|
| `DrugCategoriesModel` | `yii_drug_categories` | 药品分类 |
|
|
|
|
---
|
|
|
|
## 仓库管理
|
|
|
|
### 接口
|
|
|
|
| 方法 | 路径 | 说明 |
|
|
|------|------|------|
|
|
| GET | `warehouse-drug-management/list` | 仓库药品列表 |
|
|
| POST | `warehouse-drug-management/update-price` | 更新价格 |
|
|
| POST | `warehouse-drug-management/update-status` | 更新状态 |
|
|
| GET | `warehouse-drug-management-store/list` | 门店药品列表 |
|
|
| POST | `warehouse-drug-management-store/sync` | 同步到门店 |
|
|
|
|
### 关联类
|
|
|
|
| 类 | 文件 | 说明 |
|
|
|----|------|------|
|
|
| `WarehouseDrugManagementController` | `app/Http/Controllers/admin/business/warehouseDrugManagement/WarehouseDrugManagementController.php` | 仓库控制器 |
|
|
| `WarehouseDrugManagementStoreController` | `app/Http/Controllers/admin/business/warehouseDrugManagement/WarehouseDrugManagementStoreController.php` | 门店控制器 |
|
|
| `WarehouseDrugManagementService` | `app/Service/admin/business/warehouseDrugManagement/WarehouseDrugManagementService.php` | 仓库服务 |
|
|
| `WarehouseDrugManagementStoreService` | `app/Service/admin/business/warehouseDrugManagement/WarehouseDrugManagementStoreService.php` | 门店服务 |
|
|
|
|
### 关联模型
|
|
|
|
| 模型 | 表名 | 说明 |
|
|
|------|------|------|
|
|
| `DrugStoreModel` | `yii_drugstore` | 药品仓库 |
|
|
| `DrugStoreDrugModel` | `yii_drugstore_drug` | 仓库药品 |
|
|
| `DrugStoreRelationsModel` | `yii_drug_store_relations` | 药品-门店定价 |
|
|
|
|
### 价格同步流程
|
|
|
|
```mermaid
|
|
sequenceDiagram
|
|
participant WH as 仓库
|
|
participant API as xk-api
|
|
participant STORE as 门店
|
|
|
|
WH->>API: 价格变更
|
|
API->>API: BatchSyncDrugPriceJob
|
|
API->>STORE: 同步采购价(warehouse * z_buy_percent)
|
|
API->>STORE: 同步销售价(warehouse * z_sale_percent)
|
|
STORE->>STORE: 更新 yii_drug_store_relations
|
|
```
|
|
|
|
### 关联 Job
|
|
|
|
| Job | 文件 | 说明 |
|
|
|-----|------|------|
|
|
| `BatchSyncDrugPriceJob` | `app/Jobs/admin/store/BatchSyncDrugPriceJob.php` | 批量同步价格 |
|
|
| `SyncDrugPriceBySubscribeJob` | `app/Jobs/admin/store/SyncDrugPriceBySubscribeJob.php` | 订阅同步 |
|
|
| `SyncSingleDrugPriceBySubscribeJob` | `app/Jobs/admin/store/SyncSingleDrugPriceBySubscribeJob.php` | 单品同步 |
|
|
| `UpdateStoreChinesePriceByRatioJob` | `app/Jobs/admin/products/UpdateStoreChinesePriceByRatioJob.php` | 按比例更新中药价格 |
|
|
| `UpdateStoreChineseSalePriceJob` | `app/Jobs/admin/products/UpdateStoreChineseSalePriceJob.php` | 更新中药销售价百分比 |
|
|
|
|
---
|
|
|
|
## 加工费管理
|
|
|
|
### 接口
|
|
|
|
| 方法 | 路径 | 说明 |
|
|
|------|------|------|
|
|
| GET | `process/list` | 加工费列表 |
|
|
| POST | `process/create` | 创建加工费 |
|
|
| POST | `process/update` | 更新加工费 |
|
|
|
|
### 关联类
|
|
|
|
| 类 | 文件 | 说明 |
|
|
|----|------|------|
|
|
| `ProsessController` | `app/Http/Controllers/admin/system/ProsessController.php` | 控制器 |
|
|
| `ProcessService` | `app/Service/admin/system/ProcessService.php` | 业务服务 |
|
|
|
|
### 关联模型
|
|
|
|
| 模型 | 表名 | 说明 |
|
|
|------|------|------|
|
|
| `ProcessRuleModel` | `yii_process_rule` | 加工规则 |
|
|
| `ProcessRuleNoteModel` | `yii_process_rule_note` | 加工规则说明 |
|