初始化
This commit is contained in:
175
docs/database/overview.md
Normal file
175
docs/database/overview.md
Normal file
@@ -0,0 +1,175 @@
|
||||
# 数据库总览
|
||||
|
||||
XK 系统使用两个 MySQL 数据库,分别存储新旧系统的数据。
|
||||
|
||||
## 数据库概况
|
||||
|
||||
| 数据库 | 表数量 | 状态 | 说明 |
|
||||
|--------|--------|------|------|
|
||||
| **z_xk** | 67 张 | 活跃使用 | 新库,当前核心业务表 |
|
||||
| **z_o_xk** | ~100 张 | 部分使用 | 旧库,Yii2 时代遗留 |
|
||||
|
||||
## 双库关系
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
subgraph ZXK["z_xk 新库 67张表"]
|
||||
A1[管理后台]
|
||||
A2[财务结算]
|
||||
A3[销售推广]
|
||||
A4[特色处方]
|
||||
A5[监管日志]
|
||||
A6[系统配置]
|
||||
A7[聊天消息]
|
||||
A8[中医疾病库]
|
||||
end
|
||||
|
||||
subgraph OXK["z_o_xk 旧库 ~100张表"]
|
||||
B1[药品目录]
|
||||
B2[订单系统]
|
||||
B3[处方系统]
|
||||
B4[用户系统]
|
||||
B5[门店系统]
|
||||
B6[医生系统]
|
||||
B7[支付系统]
|
||||
B8[物流系统]
|
||||
end
|
||||
|
||||
API[xk-api] --> A1
|
||||
API --> A2
|
||||
API --> A3
|
||||
API --> B1
|
||||
API --> B2
|
||||
API --> B3
|
||||
API --> B4
|
||||
API --> B5
|
||||
```
|
||||
|
||||
::: warning 跨库约束
|
||||
- 新库和旧库之间**不允许 JOIN 查询**
|
||||
- 需要跨库关联时使用两步查询
|
||||
- 定时任务中需要特别注意数据一致性
|
||||
:::
|
||||
|
||||
## 表活跃状态
|
||||
|
||||
### z_xk (新库) — 全部活跃
|
||||
|
||||
所有 67 张表均在当前系统中使用。
|
||||
|
||||
### z_o_xk (旧库) — 部分活跃
|
||||
|
||||
| 状态 | 表数量 | 说明 |
|
||||
|------|--------|------|
|
||||
| **仍在使用** | ~40 张 | 药品、订单、处方、用户、门店、医生、支付等核心表 |
|
||||
| **已废弃** | ~60 张 | 旧配置表、旧 IM 表、旧日志表、旧迁移表等 |
|
||||
|
||||
### 仍在使用的核心表 (z_o_xk)
|
||||
|
||||
| 表名 | 说明 | 使用方 |
|
||||
|------|------|--------|
|
||||
| `yii_drug` | 药品目录 | xk-api, xk-admin |
|
||||
| `yii_drug_store_relations` | 药品-门店定价 | xk-api, xk-admin |
|
||||
| `yii_drug_categories` | 药品分类 | xk-api, xk-admin |
|
||||
| `yii_drug_nature` | 药品配伍 | xk-api |
|
||||
| `yii_product_order` | 产品订单 | xk-api, xk-admin |
|
||||
| `yii_product_order_items` | 订单明细 | xk-api, xk-admin |
|
||||
| `yii_register` | 挂号订单 | xk-api, xk-admin |
|
||||
| `yii_prescription` | 主处方表 | xk-api, xk-admin, xk-doctor-wx |
|
||||
| `yii_prescription_chinese` | 中药处方 | xk-api, xk-doctor-wx |
|
||||
| `yii_prescription_west` | 西药处方 | xk-api, xk-doctor-wx |
|
||||
| `yii_prescription_granular` | 颗粒处方 | xk-api, xk-doctor-wx |
|
||||
| `yii_prescription_server` | 服务包处方 | xk-api, xk-doctor-wx |
|
||||
| `yii_user` | 用户表 | xk-api, xk-client-wx |
|
||||
| `yii_user_patient` | 就诊人 | xk-api, xk-client-wx |
|
||||
| `yii_store` | 门店表 | xk-api, xk-admin, xk-doctor-wx |
|
||||
| `yii_doctor_info` | 医生信息 | xk-api, xk-admin, xk-doctor-wx |
|
||||
| `yii_doctor_service` | 医生服务设置 | xk-api, xk-doctor-wx |
|
||||
| `yii_pharmacist_info` | 药师信息 | xk-api, xk-admin, xk-doctor-wx |
|
||||
| `yii_service_user` | 服务用户 | xk-api |
|
||||
| `yii_payment_order` | 咨询支付 | xk-api |
|
||||
| `yii_payment_product_order` | 产品支付 | xk-api |
|
||||
| `yii_payment_register` | 挂号支付 | xk-api |
|
||||
| `yii_ledger` | 分账记录 | xk-api, xk-admin |
|
||||
| `yii_fund_water` | 资金流水 | xk-api, xk-admin |
|
||||
| `yii_cash_account` | 提现账户 | xk-api, xk-admin |
|
||||
| `yii_cash_apply` | 提现申请 | xk-api, xk-admin |
|
||||
| `yii_reconciliation` | 对账记录 | xk-api, xk-admin |
|
||||
| `yii_order` | 咨询订单 | xk-api |
|
||||
| `yii_order_refund` | 咨询退款 | xk-api |
|
||||
| `yii_product_order_refund` | 产品退款 | xk-api |
|
||||
| `yii_register_refund` | 挂号退款 | xk-api |
|
||||
| `yii_transfer_prescription` | 转诊处方 | xk-api, xk-admin |
|
||||
| `yii_chinese_recipe` | 中药处方笺 | xk-api |
|
||||
| `yii_west_recipe` | 西药处方笺 | xk-api |
|
||||
| `yii_granular_recipe` | 颗粒处方笺 | xk-api |
|
||||
| `yii_im_message` | IM 消息 | xk-api |
|
||||
| `yii_im_message_session` | IM 会话 | xk-api |
|
||||
| `yii_examine_log` | 药师审核记录 | xk-api |
|
||||
| `yii_reviewer` | 审方人 | xk-api |
|
||||
| `yii_region` | 地区 | xk-api, xk-admin |
|
||||
| `yii_express_nos` | 快递单号 | xk-api |
|
||||
| `yii_express_companies` | 快递公司 | xk-api, xk-admin |
|
||||
|
||||
## 数据库设计规范
|
||||
|
||||
### 表命名
|
||||
- 新表:`xk_` 前缀 + 业务域 + 功能名(如 `xk_salesperson_commission_record`)
|
||||
- 旧表:`yii_` 前缀(Yii2 框架约定)
|
||||
|
||||
### 字段命名
|
||||
- 主键:`id`(自增 bigint)
|
||||
- 时间戳:`created_at`, `updated_at`
|
||||
- 软删除:`deleted_at`
|
||||
- 外键:`{关联表名}_id`(如 `store_id`, `user_id`)
|
||||
- 状态字段:`status`(使用枚举值)
|
||||
|
||||
### 索引设计
|
||||
- 主键索引:`id`
|
||||
- 唯一索引:`uk_` 前缀(如 `uk_order_item_sp_type`)
|
||||
- 普通索引:`idx_` 前缀(如 `idx_store_id`)
|
||||
- 联合索引:多字段组合(如 `idx_anchor_step`)
|
||||
|
||||
### 数据类型
|
||||
- 金额:`decimal(10,2)` 或 `decimal(12,2)`
|
||||
- 大文本:`text` 或 `mediumtext`
|
||||
- JSON:`json` 或 `text`(存储 JSON 字符串)
|
||||
- 状态/类型:`tinyint` 或 `int`
|
||||
- 手机号:`varchar(20)`
|
||||
- 银行卡:`varchar(30)`
|
||||
|
||||
## ER 关系图
|
||||
|
||||
### 核心业务关系
|
||||
|
||||
```mermaid
|
||||
erDiagram
|
||||
yii_user ||--o{ yii_user_patient : "拥有"
|
||||
yii_user ||--o{ yii_product_order : "下单"
|
||||
yii_user ||--o{ yii_register : "挂号"
|
||||
yii_user ||--o{ yii_order : "问诊"
|
||||
|
||||
yii_store ||--o{ yii_product_order : "归属"
|
||||
yii_store ||--o{ yii_register : "归属"
|
||||
yii_store ||--o{ yii_drug_store_relations : "定价"
|
||||
|
||||
yii_doctor_info ||--o{ yii_prescription : "开方"
|
||||
yii_doctor_info ||--o{ yii_order : "接诊"
|
||||
yii_doctor_info ||--o{ yii_register : "接诊"
|
||||
|
||||
yii_prescription ||--o{ yii_prescription_chinese : "中药"
|
||||
yii_prescription ||--o{ yii_prescription_west : "西药"
|
||||
yii_prescription ||--o{ yii_prescription_granular : "颗粒"
|
||||
|
||||
yii_product_order ||--o{ yii_product_order_items : "明细"
|
||||
yii_product_order ||--o{ yii_payment_product_order : "支付"
|
||||
yii_product_order ||--o{ yii_product_order_refund : "退款"
|
||||
yii_product_order ||--o{ yii_ledger : "分账"
|
||||
|
||||
yii_register ||--o{ yii_payment_register : "支付"
|
||||
yii_register ||--o{ yii_register_refund : "退款"
|
||||
|
||||
xk_clinic_salesperson ||--o{ xk_salesperson_commission_record : "佣金"
|
||||
xk_salesperson_commission_record ||--o{ xk_salesperson_settlement_record : "结算"
|
||||
xk_salesperson_settlement ||--o{ xk_salesperson_settlement_record : "包含"
|
||||
```
|
||||
196
docs/database/z-o-xk.md
Normal file
196
docs/database/z-o-xk.md
Normal file
@@ -0,0 +1,196 @@
|
||||
# z_o_xk 旧库
|
||||
|
||||
z_o_xk 是 XK 系统的旧数据库,约 100 张表,Yii2 时代遗留。部分表仍在使用,部分已废弃。
|
||||
|
||||
## 表状态总览
|
||||
|
||||
| 状态 | 表数量 | 说明 |
|
||||
|------|--------|------|
|
||||
| 仍在使用 | ~40 张 | 核心业务表,xk-api 和前端仍在读写 |
|
||||
| 已废弃 | ~60 张 | 旧配置、旧日志、旧迁移等,仅保留数据 |
|
||||
|
||||
## 仍在使用的核心表
|
||||
|
||||
### 药品 (drug/)
|
||||
|
||||
| 表名 | 说明 | 使用方 |
|
||||
|------|------|--------|
|
||||
| `yii_drug` | 药品主表 | xk-api, xk-admin |
|
||||
| `yii_drug_categories` | 药品分类 | xk-api, xk-admin |
|
||||
| `yii_drug_store_relations` | 药品-门店定价 | xk-api, xk-admin |
|
||||
| `yii_drug_nature` | 药品配伍(十八反十九畏) | xk-api |
|
||||
| `yii_drug_dosage` | 中药剂量 | xk-api |
|
||||
| `yii_drug_use_frequency` | 用药频率 | xk-api |
|
||||
| `yii_drug_use_num` | 用药数量 | xk-api |
|
||||
| `yii_drug_use_time` | 用药时间 | xk-api |
|
||||
| `yii_drug_use_type` | 用药方式 | xk-api |
|
||||
| `yii_drug_use_way` | 煎煮方式 | xk-api |
|
||||
| `yii_process_rule` | 加工规则 | xk-api |
|
||||
| `yii_process_rule_note` | 加工规则说明 | xk-api |
|
||||
| `yii_west_unit` | 西药单位 | xk-api |
|
||||
| `yii_package_method` | 包装方式 | xk-api |
|
||||
|
||||
### 订单 (order/)
|
||||
|
||||
| 表名 | 说明 | 使用方 |
|
||||
|------|------|--------|
|
||||
| `yii_product_order` | 产品订单 | xk-api, xk-admin |
|
||||
| `yii_product_order_items` | 订单明细 | xk-api, xk-admin |
|
||||
| `yii_register` | 挂号订单 | xk-api, xk-admin |
|
||||
| `yii_order` | 咨询订单 | xk-api |
|
||||
| `yii_order_refund` | 咨询退款 | xk-api |
|
||||
| `yii_product_order_refund` | 产品退款 | xk-api |
|
||||
| `yii_register_refund` | 挂号退款 | xk-api |
|
||||
| `yii_order_number_change` | 回复次数变更 | xk-api |
|
||||
| `yii_order_video_info` | 视频通话信息 | xk-api |
|
||||
| `yii_order_log` | 订单日志 | xk-api |
|
||||
|
||||
### 处方 (prescription/)
|
||||
|
||||
| 表名 | 说明 | 使用方 |
|
||||
|------|------|--------|
|
||||
| `yii_prescription` | 主处方表 | xk-api, xk-admin, xk-doctor-wx |
|
||||
| `yii_prescription_chinese` | 中药处方 | xk-api, xk-doctor-wx |
|
||||
| `yii_prescription_west` | 西药处方 | xk-api, xk-doctor-wx |
|
||||
| `yii_prescription_granular` | 颗粒处方 | xk-api, xk-doctor-wx |
|
||||
| `yii_prescription_server` | 服务包处方 | xk-api, xk-doctor-wx |
|
||||
| `yii_transfer_prescription` | 转诊处方 | xk-api, xk-admin |
|
||||
| `yii_chinese_recipe` | 中药处方笺 | xk-api |
|
||||
| `yii_west_recipe` | 西药处方笺 | xk-api |
|
||||
| `yii_granular_recipe` | 颗粒处方笺 | xk-api |
|
||||
| `yii_chinese_medicine` | 中药饮片 | xk-api |
|
||||
| `yii_granular_medicine` | 颗粒药品 | xk-api |
|
||||
| `yii_server_recipe` | 服务包处方笺 | xk-api |
|
||||
| `yii_prescription_log` | 处方日志 | xk-api |
|
||||
| `yii_prescrip_order_log` | 处方订单日志 | xk-api |
|
||||
| `yii_prescrip_order_refund` | 处方订单退款 | xk-api |
|
||||
| `yii_examine_log` | 药师审核记录 | xk-api |
|
||||
| `yii_reviewer` | 审方人 | xk-api |
|
||||
|
||||
### 用户 (user/)
|
||||
|
||||
| 表名 | 说明 | 使用方 |
|
||||
|------|------|--------|
|
||||
| `yii_user` | 用户表 | xk-api, xk-client-wx |
|
||||
| `yii_user_patient` | 就诊人 | xk-api, xk-client-wx |
|
||||
| `yii_user_patient_case` | 患者病历 | xk-api |
|
||||
| `yii_user_patient_record` | 患者档案 | xk-api |
|
||||
| `yii_user_patient_health_inquiry` | 健康问诊 | xk-api |
|
||||
| `yii_user_patient_ill` | 患者疾病 | xk-api |
|
||||
| `yii_user_inquiry` | 用户问诊 | xk-api |
|
||||
| `yii_user_collect` | 用户收藏 | xk-api |
|
||||
| `yii_user_comment` | 用户评价 | xk-api |
|
||||
| `yii_address` | 收货地址 | xk-api |
|
||||
| `yii_service_user` | 服务用户(医生/药师) | xk-api |
|
||||
| `yii_service_user_token` | 服务用户令牌 | xk-api |
|
||||
|
||||
### 医生 (doctor/)
|
||||
|
||||
| 表名 | 说明 | 使用方 |
|
||||
|------|------|--------|
|
||||
| `yii_doctor_info` | 医生信息 | xk-api, xk-admin, xk-doctor-wx |
|
||||
| `yii_doctor_service` | 医生服务设置 | xk-api, xk-doctor-wx |
|
||||
| `yii_doctor_identity` | 医生身份验证 | xk-api |
|
||||
| `yii_doctor_practicing` | 医生执业证书 | xk-api |
|
||||
| `yii_doctor_register` | 医生挂号 | xk-api |
|
||||
| `yii_doctor_rostering` | 医生排班 | xk-api |
|
||||
| `yii_doctor_notice` | 医生停诊通知 | xk-api |
|
||||
| `yii_doctor_patient` | 医生患者列表 | xk-api |
|
||||
| `yii_doctor_patient_remark` | 患者备注 | xk-api |
|
||||
| `yii_doctor_article` | 医生文章 | xk-api, xk-admin |
|
||||
| `yii_doctor_common` | 医生常用药品 | xk-api |
|
||||
| `yii_doctor_tag_ill` | 医生疾病标签 | xk-api |
|
||||
| `yii_doctor_tag_word` | 医生常用语 | xk-api |
|
||||
| `yii_doctor_title` | 医生职称 | xk-api |
|
||||
| `yii_doctor_apply` | 医生升级申请 | xk-api |
|
||||
| `yii_store_doctor` | 门店-医生关联 | xk-api |
|
||||
| `yii_department` | 科室 | xk-api |
|
||||
| `yii_diagnose_common` | 常用医嘱 | xk-api |
|
||||
| `yii_disease` | 疾病库 | xk-api |
|
||||
| `yii_disease_common` | 常用疾病 | xk-api |
|
||||
| `yii_patient_visit_record` | 就诊记录 | xk-api |
|
||||
| `yii_pharmacist_info` | 药师信息 | xk-api, xk-admin, xk-doctor-wx |
|
||||
| `yii_pharmacist_identity` | 药师身份验证 | xk-api |
|
||||
| `yii_pharmacist_practicing` | 药师执业证书 | xk-api |
|
||||
| `yii_serv_info` | 客服信息 | xk-api |
|
||||
|
||||
### 门店 (store/)
|
||||
|
||||
| 表名 | 说明 | 使用方 |
|
||||
|------|------|--------|
|
||||
| `yii_store` | 门店表 | xk-api, xk-admin, xk-doctor-wx |
|
||||
| `yii_store_department` | 门店-科室关联 | xk-api |
|
||||
| `yii_store_user` | 门店-用户关联 | xk-api |
|
||||
|
||||
### 财务 (finance/)
|
||||
|
||||
| 表名 | 说明 | 使用方 |
|
||||
|------|------|--------|
|
||||
| `yii_ledger` | 分账记录 | xk-api, xk-admin |
|
||||
| `yii_ledger_log` | 分账变更日志 | xk-api |
|
||||
| `yii_cash_account` | 提现账户 | xk-api, xk-admin |
|
||||
| `yii_cash_apply` | 提现申请 | xk-api, xk-admin |
|
||||
| `yii_fund_water` | 资金流水 | xk-api, xk-admin |
|
||||
| `yii_reconciliation` | 对账记录 | xk-api, xk-admin |
|
||||
| `yii_refund_bills` | 退款账单 | xk-api |
|
||||
| `yii_charge_cash_pay_record` | 代理付款记录 | xk-api |
|
||||
|
||||
### 支付 (payment/)
|
||||
|
||||
| 表名 | 说明 | 使用方 |
|
||||
|------|------|--------|
|
||||
| `yii_payment_order` | 咨询支付 | xk-api |
|
||||
| `yii_payment_product_order` | 产品支付 | xk-api |
|
||||
| `yii_payment_register` | 挂号支付 | xk-api |
|
||||
| `yii_payment_refund` | 咨询退款记录 | xk-api |
|
||||
| `yii_payment_product_refund` | 产品退款记录 | xk-api |
|
||||
| `yii_payment_register_refund` | 挂号退款记录 | xk-api |
|
||||
| `yii_pay_config` | 支付配置 | xk-api |
|
||||
| `yii_bills` | 账单 | xk-api |
|
||||
|
||||
### IM (im/)
|
||||
|
||||
| 表名 | 说明 | 使用方 |
|
||||
|------|------|--------|
|
||||
| `yii_im_message` | IM 消息 | xk-api |
|
||||
| `yii_im_message_session` | IM 会话 | xk-api |
|
||||
| `yii_im_message_session_order` | 会话-订单关联 | xk-api |
|
||||
|
||||
### 其他仍在使用的表
|
||||
|
||||
| 表名 | 说明 | 使用方 |
|
||||
|------|------|--------|
|
||||
| `yii_region` | 地区 | xk-api, xk-admin |
|
||||
| `yii_express_companies` | 快递公司 | xk-api, xk-admin |
|
||||
| `yii_express_nos` | 快递单号 | xk-api |
|
||||
| `yii_express_details` | 快递详情 | xk-api |
|
||||
| `yii_express_fees` | 快递费用 | xk-api |
|
||||
| `yii_base_config` | 基础配置 | xk-api |
|
||||
| `yii_system_notice` | 系统通知 | xk-api |
|
||||
| `yii_inquiry_refuse_reason` | 问诊拒绝原因 | xk-api |
|
||||
| `yii_refund_reason` | 退款原因 | xk-api |
|
||||
| `yii_replay_template` | 快捷回复模板 | xk-api |
|
||||
| `yii_replay_template_group` | 回复模板分组 | xk-api |
|
||||
| `yii_follow_doctor` | 用户关注医生 | xk-api |
|
||||
| `yii_follow_user` | 医生关注用户 | xk-api |
|
||||
|
||||
## 已废弃的表
|
||||
|
||||
以下表已不再使用,仅保留历史数据:
|
||||
|
||||
| 类别 | 表 | 说明 |
|
||||
|------|-----|------|
|
||||
| 旧配置 | `yii_admin`, `yii_admin_access_token`, `yii_admin_role` | 已迁移到 `xk_admin` |
|
||||
| 旧 RBAC | `yii_auth_assignment`, `yii_auth_item`, `yii_auth_item_child` | 已迁移到 `xk_role` |
|
||||
| 旧菜单 | `yii_menu`, `yii_role_menu` | 已迁移到 `xk_menu`, `xk_role_menu_relations` |
|
||||
| 旧平台 | `yii_plate`, `yii_platform` | 已迁移到 `xk_platform` |
|
||||
| 旧配置 | `yii_config`, `yii_system_config` | 已迁移到 `xk_system_config` |
|
||||
| 旧日志 | `yii_log`, `yii_op_log` | 已迁移到 `xk_api_op_log` |
|
||||
| 旧附件 | `yii_attachment`, `yii_attachment_group` | 已迁移到 `xk_file` |
|
||||
| 旧迁移 | `yii_migration`, `yii_migrations` | 迁移记录 |
|
||||
| 旧队列 | `yii_queue`, `yii_queue4`, `yii_failed_jobs` | 已迁移到 RabbitMQ |
|
||||
| 旧 IM | `z_yii_im_message` | 旧 IM 消息 |
|
||||
| 体检 | `yii_physical_package`, `yii_physical_reserve`, `yii_physical_reserve_total` | 体检功能 |
|
||||
| 医院 | `yii_hospital`, `yii_hospital_yard`, `yii_hospital_department_intro` | 医院信息 |
|
||||
| 商品 | `yii_carts` | 购物车(已迁移) |
|
||||
| 其他 | `yii_categories`, `yii_healthy_news`, `yii_orther_info` | 杂项 |
|
||||
121
docs/database/z-xk.md
Normal file
121
docs/database/z-xk.md
Normal file
@@ -0,0 +1,121 @@
|
||||
# z_xk 新库
|
||||
|
||||
z_xk 是 XK 系统的新数据库,包含 67 张表,全部在当前系统中活跃使用。
|
||||
|
||||
## 管理后台 (14张表)
|
||||
|
||||
| 表名 | 说明 | 关键字段 |
|
||||
|------|------|----------|
|
||||
| `xk_admin` | 管理员用户 | login_account, password, role_id, store_id, supplier_id |
|
||||
| `xk_admin_notice` | 管理员消息 | title, content, type, status |
|
||||
| `xk_admin_notice_relations` | 用户通知关联 | notice_id, user_id, status |
|
||||
| `xk_admin_salesperson` | 管理员-推广员关联 | admin_id, salesperson_id, store_id |
|
||||
| `xk_card` | 用户银行卡 | bank_user_name, bank_card, bank_name |
|
||||
| `xk_menu` | 菜单定义 | title, icon, path, pid, sort |
|
||||
| `xk_notice` | 公告 | title, content, status |
|
||||
| `xk_platform` | 平台信息 | name, logo, introduce |
|
||||
| `xk_queue_job` | 业务队列任务 | title, job_name, status |
|
||||
| `xk_role` | 角色定义 | user_type, name, value, pid |
|
||||
| `xk_role_menu_relations` | 角色-菜单绑定 | role_id, menu_id |
|
||||
| `xk_role_quick_nav` | 角色快捷导航 | role_id, menu_id, title, url |
|
||||
| `xk_supplier` | 供应商 | name, logo, business_license |
|
||||
| `xk_platform_qualifications` | 平台资质 | 各类许可证图片, store_id |
|
||||
|
||||
## 财务 (3张表)
|
||||
|
||||
| 表名 | 说明 | 关键字段 |
|
||||
|------|------|----------|
|
||||
| `xk_account_balance` | 账户余额 | user_id, type, total, balance, frozen, withdrawn |
|
||||
| `xk_account_balance_change_record` | 余额变更记录 | user_id, order_id, amount |
|
||||
| `xk_account_able_change_log` | 可提现金额变更日志 | user_id, user_type, before_amount, after_amount, source_type |
|
||||
|
||||
## 销售 (11张表)
|
||||
|
||||
| 表名 | 说明 | 关键字段 |
|
||||
|------|------|----------|
|
||||
| `xk_clinic_salesperson` | 门店推广员 | phone, nick_name, split, split_type |
|
||||
| `xk_salesperson_commission_record` | 佣金记录 | salesperson_id, drug_id, commission_amount, split_type |
|
||||
| `xk_salesperson_commission_template` | 佣金模板 | store_id, name |
|
||||
| `xk_salesperson_commission_template_item` | 佣金模板明细 | template_id, drug_id, commission |
|
||||
| `xk_salesperson_drug_commission` | 药品佣金配置 | salesperson_id, drug_id, commission |
|
||||
| `xk_salesperson_qr_code` | 推广员二维码 | salesperson_id, qr_code, status |
|
||||
| `xk_salesperson_settlement` | 推广员结算单 | settlement_no, amount, period_start, period_end |
|
||||
| `xk_salesperson_settlement_record` | 结算-佣金关联 | settlement_id, commission_record_id |
|
||||
| `xk_salesperson_store_config` | 推广员门店配置 | store_id, see_price |
|
||||
| `xk_user_salesperson` | 用户-推广员绑定 | user_id, salesperson_id, type, status |
|
||||
| `xk_admin_salesperson` | 管理员-推广员关联 | admin_id, salesperson_id |
|
||||
|
||||
## 特色处方 (7张表)
|
||||
|
||||
| 表名 | 说明 | 关键字段 |
|
||||
|------|------|----------|
|
||||
| `xk_special_prescription` | 特色处方主表 | name, category_id, price_per_dose, status, store_id |
|
||||
| `xk_special_prescription_category` | 处方分类 | name, sort, status |
|
||||
| `xk_special_prescription_sku` | SKU 剂量规格 | sku_name, dose_count, buy_price, sale_price |
|
||||
| `xk_special_prescription_drug_price` | 药品分摊价格 | drug_id, buy_price, sell_price |
|
||||
| `xk_special_prescription_order` | 处方订单快照 | product_order_id, dose_count, sku_sale_price |
|
||||
| `xk_special_prescription_patient_record` | 患者处方记录 | user_id, dose_count, status |
|
||||
| `xk_special_prescription_introduction_images` | 介绍图片 | image_url, sort |
|
||||
|
||||
## 系统 (9张表)
|
||||
|
||||
| 表名 | 说明 | 关键字段 |
|
||||
|------|------|----------|
|
||||
| `xk_store_input` | 门店预填表单 | name, type, province_id, city_id, status |
|
||||
| `xk_store_input_contract` | 门店合同文件 | file_url, file_name |
|
||||
| `xk_store_input_nav` | 门店轮播图 | pic, sort |
|
||||
| `xk_doctor_input` | 医生预填表单 | name, mobile, title_id, type, status |
|
||||
| `xk_doctor_input_store` | 医生-门店绑定 | doctor_input_id, store_id |
|
||||
| `xk_store_bank_card_report` | 门店银行卡上报 | bank_card, report_status, epl_state |
|
||||
| `xk_spreadsheet_table_config` | 画布表格配置 | table_name, sheet_key, config |
|
||||
| `xk_spreadsheet_edit_history` | 画布编辑历史 | table_name, action, before_snapshot, after_snapshot |
|
||||
| `xk_spreadsheet_formula` | 画布公式库 | code, name, expression_template |
|
||||
|
||||
## 监管日志 (8张表)
|
||||
|
||||
| 表名 | 说明 | 关键字段 |
|
||||
|------|------|----------|
|
||||
| `xk_hy_transit_batch` | 监管同步批次 | anchor_date, step, pull_status, total_count |
|
||||
| `xk_hy_transit_record` | 监管拉取/回调记录 | biz_key, payload_json, pull_status, push_status, callback_status |
|
||||
| `xk_api_op_log` | 新 API 操作日志 | url, method, param, result, platform_type |
|
||||
| `xk_error_log` | 错误日志 | type, content |
|
||||
| `xk_product_order_price_adjust_log` | 订单改价日志 | old_price, new_price, adjust_amount |
|
||||
| `xk_store_drug_update_log` | 药品价格变更日志 | old_buy, new_buy, old_price, new_price |
|
||||
| `xk_sync_china_order_log` | ERP 同步日志 | order_id, content, is_success |
|
||||
| `xk_spreadsheet_edit_history` | 画布编辑历史 | action, before_snapshot, after_snapshot |
|
||||
|
||||
## 其他 (15张表)
|
||||
|
||||
| 表名 | 说明 | 关键字段 |
|
||||
|------|------|----------|
|
||||
| `xk_chat_messages` | 聊天消息 | room_id, sender_user_id, message_type, message_content |
|
||||
| `xk_chat_room` | 聊天房间 | sender_user_id, receiver_user_id |
|
||||
| `xk_system_config` | 系统配置 | config_key, config_value, value_type |
|
||||
| `xk_file` | 文件管理 | url, original_name, file_size, type |
|
||||
| `xk_file_group` | 文件分组 | name, sort |
|
||||
| `xk_file_group_rel` | 文件-分组关联 | file_id, group_id |
|
||||
| `xk_file_type` | 文件类型 | name, value, suffix |
|
||||
| `xk_home_zones` | 首页分区 | title, type, store_id |
|
||||
| `xk_transfer_assistant_config` | 转诊助手配置 | name, avatar |
|
||||
| `xk_transfer_question` | 转诊问题模板 | question, answers, type |
|
||||
| `xk_transfer_prescription_question` | 转诊处方问答 | transfer_prescription_id, question_id, answer |
|
||||
| `xk_register_info` | 挂号就诊信息 | register_id, user_id, drug_id, type |
|
||||
| `xk_register_info_drug` | 挂号关联药品 | register_info_id, drug_id, quantity |
|
||||
| `xk_user_patient_guardian` | 患者监护人 | guardian_name, guardian_id_card, guardian_mobile |
|
||||
| `xk_subjects` | 医学学科 | name, code, pid |
|
||||
| `xk_doctor_order` | 医嘱 | name |
|
||||
| `xk_doctor_quick_reply` | 医生快捷回复 | doctor_id, content, sort_order |
|
||||
| `xk_doctor_wx_phone_openid` | 医生手机-微信绑定 | phone, openid |
|
||||
| `xk_drug_introduction_images` | 药品介绍图片 | drug_id, image_url |
|
||||
| `xk_store_subscribe` | 门店价格订阅 | store_id, status |
|
||||
| `xk_traditional_chinese_medicine_diseases` | 中医疾病库 | code, name |
|
||||
| `xk_traditional_chinese_medicine_method` | 中医治法库 | code, name |
|
||||
| `xk_traditional_chinese_medicine_syndrome` | 中医证候库 | code, name |
|
||||
| `xk_prescription_disease` | 处方-疾病关联 | prescription_id, disease_id |
|
||||
| `xk_prescription_method` | 处方-治法关联 | prescription_id, method_id |
|
||||
| `xk_prescription_syndrome` | 处方-证候关联 | prescription_id, syndrome_id |
|
||||
| `xk_monthly_payment` | 月结账单 | store_id, amount, status |
|
||||
| `xk_monthly_payment_settlement` | 月结结算记录 | store_id, amount |
|
||||
| `xk_product_order_export_scheme` | 订单导出方案 | admin_id, config |
|
||||
| `xk_monthly_payment` | 月结账单 | store_id, order_id, amount, status |
|
||||
| `xk_monthly_payment_settlement` | 月结结算记录 | url, store_id, amount |
|
||||
Reference in New Issue
Block a user