Files
hms/crates/erp-health/src/entity/consultation_session.rs
iven d6678d001e
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled
feat(health): Handler 接线 + Doctor Service + DTO 统一
- 重写全部 6 个 handler 文件,从占位错误改为调用 service 层
- 删除 handler 内联 DTO,统一使用 dto/ 模块类型
- 新增 dto/doctor_dto.rs 和 dto/follow_up_dto.rs
- 新增 service/doctor_service.rs 实现医护档案 CRUD
- 将 follow_up_service 内联 DTO 迁移到 dto/follow_up_dto.rs
- 修复 consultation_session 列名 type→consultation_type(数据库+entity+迁移同步)
- 全部 51 个 API 端点已验证可用

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-23 21:31:42 +08:00

61 lines
1.8 KiB
Rust

use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "consultation_session")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub tenant_id: Uuid,
pub patient_id: Uuid,
#[sea_orm(skip_serializing_if = "Option::is_none")]
pub doctor_id: Option<Uuid>,
pub consultation_type: String,
pub status: String,
#[sea_orm(skip_serializing_if = "Option::is_none")]
pub last_message_at: Option<DateTimeUtc>,
pub unread_count_patient: i32,
pub unread_count_doctor: i32,
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::patient::Entity",
from = "Column::PatientId",
to = "super::patient::Column::Id"
)]
Patient,
#[sea_orm(
belongs_to = "super::doctor_profile::Entity",
from = "Column::DoctorId",
to = "super::doctor_profile::Column::Id"
)]
Doctor,
#[sea_orm(has_many = "super::consultation_message::Entity")]
Message,
}
impl Related<super::patient::Entity> for Entity {
fn to() -> RelationDef {
Relation::Patient.def()
}
}
impl Related<super::consultation_message::Entity> for Entity {
fn to() -> RelationDef {
Relation::Message.def()
}
}
impl ActiveModelBehavior for ActiveModel {}