- 迁移 m000067: patient_family_member 添加 phone_hash + key_version - 迁移 m000068: doctor_profile 添加 license_number_hash + key_version - family_member: phone 加密 + HMAC 索引 + 列表脱敏 - doctor_profile: license_number 加密 + HMAC 搜索重写 + 详情解密 - 列表中 Tier 1 字段返回 None
60 lines
2.0 KiB
Rust
60 lines
2.0 KiB
Rust
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "doctor_profile")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: Uuid,
|
|
pub tenant_id: Uuid,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub user_id: Option<Uuid>,
|
|
pub name: String,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub department: Option<String>,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub title: Option<String>,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub specialty: Option<String>,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub license_number: Option<String>,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub license_number_hash: Option<String>,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub bio: Option<String>,
|
|
pub online_status: String,
|
|
pub created_at: DateTimeUtc,
|
|
pub updated_at: DateTimeUtc,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub created_by: Option<Uuid>,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub updated_by: Option<Uuid>,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub deleted_at: Option<DateTimeUtc>,
|
|
pub version: i32,
|
|
#[sea_orm(skip_serializing_if = "Option::is_none")]
|
|
pub key_version: Option<i32>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::patient_doctor_relation::Entity")]
|
|
PatientRelation,
|
|
#[sea_orm(has_many = "super::doctor_schedule::Entity")]
|
|
Schedule,
|
|
}
|
|
|
|
impl Related<super::patient_doctor_relation::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::PatientRelation.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::doctor_schedule::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Schedule.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|