feat(dialysis+workflow): 透析会话 BPMN 工作流集成
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

- dialysis_record 新增 workflow_instance_id 列,关联工作流实例
- 种子 dialysis_session BPMN 流程定义:透前评估→上机确认→透中监测→透后评估→医生审核
- 事件驱动编排器:dialysis.record.created → 自动启动 BPMN 工作流
- 工作流启动后自动回写 instance_id 到透析记录
- 编排器在 erp-server 层实现(遵循星型依赖架构)
This commit is contained in:
iven
2026-05-04 20:38:56 +08:00
parent 7e57565ecd
commit 0a9272bcf6
6 changed files with 252 additions and 0 deletions

View File

@@ -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");