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:
@@ -34,6 +34,7 @@ const FOLLOW_UP_TYPE_OPTIONS = [
|
|||||||
{ value: 'phone', label: '电话' },
|
{ value: 'phone', label: '电话' },
|
||||||
{ value: 'outpatient', label: '门诊' },
|
{ value: 'outpatient', label: '门诊' },
|
||||||
{ value: 'home_visit', label: '家访' },
|
{ value: 'home_visit', label: '家访' },
|
||||||
|
{ value: 'online', label: '线上' },
|
||||||
{ value: 'wechat', label: '微信' },
|
{ value: 'wechat', label: '微信' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -41,6 +42,7 @@ const FOLLOW_UP_TYPE_MAP: Record<string, string> = {
|
|||||||
phone: '电话',
|
phone: '电话',
|
||||||
outpatient: '门诊',
|
outpatient: '门诊',
|
||||||
home_visit: '家访',
|
home_visit: '家访',
|
||||||
|
online: '线上',
|
||||||
wechat: '微信',
|
wechat: '微信',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ pub fn validate_schedule_status(value: &str) -> HealthResult<()> {
|
|||||||
/// follow_up_task.follow_up_type
|
/// follow_up_task.follow_up_type
|
||||||
pub fn validate_follow_up_type(value: &str) -> HealthResult<()> {
|
pub fn validate_follow_up_type(value: &str) -> HealthResult<()> {
|
||||||
validate_enum!(value, "follow_up_type", [
|
validate_enum!(value, "follow_up_type", [
|
||||||
"phone", "face_to_face", "online",
|
"phone", "outpatient", "home_visit", "online", "wechat",
|
||||||
]);
|
]);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ mod m20260426_000074_create_vital_signs_hourly;
|
|||||||
mod m20260426_000075_create_patient_devices;
|
mod m20260426_000075_create_patient_devices;
|
||||||
mod m20260426_000076_create_alert_rules;
|
mod m20260426_000076_create_alert_rules;
|
||||||
mod m20260426_000077_create_alerts;
|
mod m20260426_000077_create_alerts;
|
||||||
|
mod m20260427_000078_normalize_follow_up_types;
|
||||||
|
|
||||||
pub struct Migrator;
|
pub struct Migrator;
|
||||||
|
|
||||||
@@ -161,6 +162,7 @@ impl MigratorTrait for Migrator {
|
|||||||
Box::new(m20260426_000075_create_patient_devices::Migration),
|
Box::new(m20260426_000075_create_patient_devices::Migration),
|
||||||
Box::new(m20260426_000076_create_alert_rules::Migration),
|
Box::new(m20260426_000076_create_alert_rules::Migration),
|
||||||
Box::new(m20260426_000077_create_alerts::Migration),
|
Box::new(m20260426_000077_create_alerts::Migration),
|
||||||
|
Box::new(m20260427_000078_normalize_follow_up_types::Migration),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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(())
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user