feat(ai): 添加 ai_analysis_queue 迁移 + Entity
异步分析队列表,支持优先级/重试/状态机(pending→running→completed/failed) 索引覆盖租户状态查询和调度扫描,迁移号 000118
This commit is contained in:
34
crates/erp-ai/src/entity/ai_analysis_queue.rs
Normal file
34
crates/erp-ai/src/entity/ai_analysis_queue.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "ai_analysis_queue")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub tenant_id: Uuid,
|
||||
pub patient_id: Uuid,
|
||||
pub analysis_type: String,
|
||||
pub priority: i32,
|
||||
pub status: String,
|
||||
pub source_event: Option<String>,
|
||||
pub source_ref: String,
|
||||
pub scheduled_at: DateTimeUtc,
|
||||
pub started_at: Option<DateTimeUtc>,
|
||||
pub completed_at: Option<DateTimeUtc>,
|
||||
pub result_analysis_id: Option<Uuid>,
|
||||
pub error_message: Option<String>,
|
||||
pub retry_count: i32,
|
||||
pub max_retries: i32,
|
||||
pub created_at: DateTimeUtc,
|
||||
pub updated_at: DateTimeUtc,
|
||||
pub created_by: Option<Uuid>,
|
||||
pub updated_by: Option<Uuid>,
|
||||
pub deleted_at: Option<DateTimeUtc>,
|
||||
pub version_lock: i32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
@@ -1,4 +1,5 @@
|
||||
pub mod ai_analysis;
|
||||
pub mod ai_analysis_queue;
|
||||
pub mod ai_prompt;
|
||||
pub mod ai_risk_threshold;
|
||||
pub mod ai_suggestion;
|
||||
|
||||
Reference in New Issue
Block a user