完整ER关系图
erDiagram
patients ||--o{ patient_health_records : "拥有"
patients ||--o{ disease_plans : "关联"
patients ||--o{ follow_up_plans : "关联"
patients ||--o{ follow_up_records : "关联"
patients ||--o{ consultations : "咨询"
patients ||--o{ service_orders : "购买"
patients ||--o{ health_data : "记录"
disease_categories ||--o{ disease_plans : "分类"
disease_plans ||--o{ follow_up_plans : "生成"
doctors ||--o{ disease_plans : "负责"
doctors ||--o{ follow_up_records : "执行"
doctors ||--o{ consultations : "回复"
doctors ||--o{ service_packages : "提供"
follow_up_plans ||--o{ follow_up_records : "产生"
service_packages ||--o{ service_orders : "被购买"
service_packages ||--o{ service_package_items : "包含"
education_article_categories ||--o{ education_articles : "分类"
wechat_users ||--o{ customers : "关联"
wechat_users ||--o{ tasks : "负责"
customers ||--o{ customer_feedback : "反馈"
customers ||--o{ customer_tags : "标签"
customers ||--o{ customer_groups : "分组"
customers ||--o{ customer_assets : "资产"
customers ||--o{ follow_records : "跟进"
tags ||--o{ customer_tags : "关联"
groups ||--o{ customer_groups : "关联"
source_channels ||--o{ leads : "来源"
leads ||--o{ customers : "转换"
message_templates ||--o{ messages : "模板"
messages ||--o{ message_receivers : "接收者"
messages ||--o{ message_tasks : "任务"
roles ||--o{ role_permissions : "权限"
roles ||--o{ admin_users : "角色"
patients {
int id PK
string name
enum gender
date birth_date
string phone UK
string id_card UK
string address
text medical_history
enum status
datetime created_at
datetime updated_at
}
doctors {
int id PK
string name
string title
string department
string specialty
string phone
enum status
datetime created_at
}
disease_plans {
int id PK
int patient_id FK
int doctor_id FK
int category_id FK
string plan_name
text management_goals
text plan_content
date start_date
date end_date
int progress_percent
enum status
datetime created_at
}
follow_up_plans {
int id PK
int patient_id FK
int doctor_id FK
int disease_plan_id FK
enum follow_type
datetime follow_time
enum status
datetime created_at
}
follow_up_records {
int id PK
int plan_id FK
int patient_id FK
int doctor_id FK
datetime follow_time
enum follow_type
text follow_result
datetime created_at
}
service_packages {
int id PK
int doctor_id FK
string package_name
decimal price
int duration_days
enum status
datetime created_at
}
service_orders {
int id PK
int patient_id FK
int package_id FK
string order_no UK
decimal amount
enum pay_status
enum order_status
datetime created_at
}
customers {
int id PK
string name
string phone UK
enum customer_status
int source_channel_id FK
datetime created_at
}
tags {
int id PK
string name
string color
int use_count
datetime created_at
}
customer_tags {
int id PK
int customer_id FK
int tag_id FK
datetime created_at
}
messages {
int id PK
int template_id FK
string message_type
text content
enum send_type
datetime send_time
enum status
datetime created_at
}
admin_users {
int id PK
string username UK
string password
int role_id FK
enum status
datetime created_at
}