新建 erp-health 原生 Rust crate,覆盖设计规格中定义的 5 大业务域: - 16 个 SeaORM Entity(患者/家属/标签/医生/健康档案/体征/化验单/预约/排班/随访/咨询等) - 16 表数据库迁移(含索引、外键、默认值、可回滚) - 40+ API 路由骨架(患者管理/健康数据/预约排班/随访/咨询/医生管理) - 12 个权限声明(health.patient/health-data/appointment/follow-up/consultation/doctor 各 .list/.manage) - DTO / Service / Handler / Event 四层架构,Service 使用 todo!() 占位 - erp-server 集成:模块注册 + AppState FromRef 桥接 + 路由挂载 同步更新 CLAUDE.md 项目进度、wiki 知识库、设计规格文档。
44 lines
1.2 KiB
Rust
44 lines
1.2 KiB
Rust
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "consultation_message")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: Uuid,
|
|
pub tenant_id: Uuid,
|
|
pub session_id: Uuid,
|
|
pub sender_id: Uuid,
|
|
pub sender_role: String,
|
|
pub content_type: String,
|
|
pub content: String,
|
|
pub is_read: bool,
|
|
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,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(
|
|
belongs_to = "super::consultation_session::Entity",
|
|
from = "Column::SessionId",
|
|
to = "super::consultation_session::Column::Id"
|
|
)]
|
|
Session,
|
|
}
|
|
|
|
impl Related<super::consultation_session::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Session.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|