feat(health): 体征增加体温/SpO2/血糖类型字段
- 迁移 079: vital_signs 表新增 body_temperature/spo2/blood_sugar_type 列 - Entity/DTO/Service 全链路支持新字段 - blood_sugar_type: fasting/postprandial/random/ogtt - daily_monitoring 兼容层补全新字段为 None
This commit is contained in:
@@ -78,6 +78,7 @@ mod m20260426_000075_create_patient_devices;
|
||||
mod m20260426_000076_create_alert_rules;
|
||||
mod m20260426_000077_create_alerts;
|
||||
mod m20260427_000078_normalize_follow_up_types;
|
||||
mod m20260427_000079_add_vital_signs_fields;
|
||||
|
||||
pub struct Migrator;
|
||||
|
||||
@@ -163,6 +164,7 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20260426_000076_create_alert_rules::Migration),
|
||||
Box::new(m20260426_000077_create_alerts::Migration),
|
||||
Box::new(m20260427_000078_normalize_follow_up_types::Migration),
|
||||
Box::new(m20260427_000079_add_vital_signs_fields::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
pub struct Migration;
|
||||
|
||||
impl MigrationName for Migration {
|
||||
fn name(&self) -> &str {
|
||||
"m20260427_000079_add_vital_signs_fields"
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
let conn = manager.get_connection();
|
||||
|
||||
conn.execute_unprepared(
|
||||
"ALTER TABLE vital_signs ADD COLUMN IF NOT EXISTS body_temperature DECIMAL(4,1)",
|
||||
)
|
||||
.await?;
|
||||
|
||||
conn.execute_unprepared(
|
||||
"ALTER TABLE vital_signs ADD COLUMN IF NOT EXISTS spo2 INTEGER",
|
||||
)
|
||||
.await?;
|
||||
|
||||
conn.execute_unprepared(
|
||||
"ALTER TABLE vital_signs ADD COLUMN IF NOT EXISTS blood_sugar_type VARCHAR(20) DEFAULT 'fasting'",
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
let conn = manager.get_connection();
|
||||
|
||||
conn.execute_unprepared(
|
||||
"ALTER TABLE vital_signs DROP COLUMN IF EXISTS blood_sugar_type",
|
||||
)
|
||||
.await?;
|
||||
|
||||
conn.execute_unprepared(
|
||||
"ALTER TABLE vital_signs DROP COLUMN IF EXISTS spo2",
|
||||
)
|
||||
.await?;
|
||||
|
||||
conn.execute_unprepared(
|
||||
"ALTER TABLE vital_signs DROP COLUMN IF EXISTS body_temperature",
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user