feat(dialysis+workflow): 透析会话 BPMN 工作流集成
- dialysis_record 新增 workflow_instance_id 列,关联工作流实例 - 种子 dialysis_session BPMN 流程定义:透前评估→上机确认→透中监测→透后评估→医生审核 - 事件驱动编排器:dialysis.record.created → 自动启动 BPMN 工作流 - 工作流启动后自动回写 instance_id 到透析记录 - 编排器在 erp-server 层实现(遵循星型依赖架构)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
mod config;
|
||||
mod db;
|
||||
mod dialysis_workflow;
|
||||
mod handlers;
|
||||
mod middleware;
|
||||
mod outbox;
|
||||
@@ -295,6 +296,11 @@ async fn main() -> anyhow::Result<()> {
|
||||
tracing::warn!(error = %e, "Failed to seed AI workflow definitions");
|
||||
}
|
||||
|
||||
// Seed dialysis session workflow definition
|
||||
if let Err(e) = dialysis_workflow::seed_dialysis_session_workflow(&db, new_tenant_id, new_tenant_id).await {
|
||||
tracing::warn!(error = %e, "Failed to seed dialysis session workflow");
|
||||
}
|
||||
|
||||
new_tenant_id
|
||||
}
|
||||
}
|
||||
@@ -425,6 +431,10 @@ async fn main() -> anyhow::Result<()> {
|
||||
erp_plugin::notification::start_notification_listener(db.clone(), event_bus.clone());
|
||||
tracing::info!("Plugin notification listener started");
|
||||
|
||||
// Start dialysis workflow orchestrator (dialysis.record.created → BPMN workflow)
|
||||
dialysis_workflow::start_dialysis_workflow_orchestrator(db.clone(), event_bus.clone());
|
||||
tracing::info!("Dialysis workflow orchestrator started");
|
||||
|
||||
// Start outbox relay (LISTEN/NOTIFY + fallback poll for pending domain events)
|
||||
outbox::start_outbox_relay(db.clone(), event_bus.clone(), config.database.url.clone());
|
||||
tracing::info!("Outbox relay started");
|
||||
|
||||
Reference in New Issue
Block a user