fix(health): 统一随访类型为 5 种 — phone/outpatient/home_visit/online/wechat

- validation.rs: face_to_face 替换为 outpatient,新增 home_visit/wechat
- FollowUpTaskList.tsx: 新增 online 选项,与后端对齐
- 迁移 078: follow_up_task + follow_up_record face_to_face → outpatient
This commit is contained in:
iven
2026-04-27 11:20:57 +08:00
parent 6a7d83ec4d
commit 7e66561a5f
4 changed files with 51 additions and 1 deletions

View File

@@ -77,6 +77,7 @@ mod m20260426_000074_create_vital_signs_hourly;
mod m20260426_000075_create_patient_devices;
mod m20260426_000076_create_alert_rules;
mod m20260426_000077_create_alerts;
mod m20260427_000078_normalize_follow_up_types;
pub struct Migrator;
@@ -161,6 +162,7 @@ impl MigratorTrait for Migrator {
Box::new(m20260426_000075_create_patient_devices::Migration),
Box::new(m20260426_000076_create_alert_rules::Migration),
Box::new(m20260426_000077_create_alerts::Migration),
Box::new(m20260427_000078_normalize_follow_up_types::Migration),
]
}
}

View File

@@ -0,0 +1,46 @@
use sea_orm_migration::prelude::*;
pub struct Migration;
impl MigrationName for Migration {
fn name(&self) -> &str {
"m20260427_000078_normalize_follow_up_types"
}
}
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let conn = manager.get_connection();
// follow_up_task: face_to_face → outpatient
conn.execute_unprepared(
"UPDATE follow_up_task SET follow_up_type = 'outpatient' WHERE follow_up_type = 'face_to_face'",
)
.await?;
// follow_up_record: face_to_face → outpatient
conn.execute_unprepared(
"UPDATE follow_up_record SET follow_up_type = 'outpatient' WHERE follow_up_type = 'face_to_face'",
)
.await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let conn = manager.get_connection();
conn.execute_unprepared(
"UPDATE follow_up_task SET follow_up_type = 'face_to_face' WHERE follow_up_type = 'outpatient'",
)
.await?;
conn.execute_unprepared(
"UPDATE follow_up_record SET follow_up_type = 'face_to_face' WHERE follow_up_type = 'outpatient'",
)
.await?;
Ok(())
}
}