feat(message+health): 补全 14 个事件消费者 + 修复 6 个事件 payload 缺失字段
事件消费者补全(erp-message/module.rs): - consultation.opened: 医生收到新咨询会话通知 - consultation.closed: 患者收到会话结束通知 - follow_up.created: 被分配人收到新随访任务通知 - follow_up.completed: 患者收到随访完成通知 - points.earned: 患者收到积分到账通知 - points.exchanged: 患者收到兑换成功通知 - points.expired: 患者收到积分过期提醒 - article.published/rejected: 作者收到审核结果通知 - ai.analysis.failed: 医生收到 AI 分析失败通知 - lab_report.uploaded/patient.updated/daily_monitoring/doctor: 审计日志记录 事件 payload 补充(erp-health services): - consultation.opened: 添加 doctor_id 字段 - follow_up.created: 添加 assigned_to + planned_date 字段 - points.earned: 添加 patient_id + reason 字段 - points.exchanged: 添加 product_name 字段 - article.rejected: 添加 author_id 字段
This commit is contained in:
@@ -235,7 +235,8 @@ pub async fn reject_article(
|
||||
|
||||
state.event_bus.publish(
|
||||
DomainEvent::new(crate::event::ARTICLE_REJECTED, tenant_id, erp_core::events::build_event_payload(serde_json::json!({
|
||||
"article_id": m.id, "title": m.title,
|
||||
"article_id": m.id.to_string(), "title": m.title,
|
||||
"author_id": m.created_by.map(|id| id.to_string()).unwrap_or_default(),
|
||||
}))),
|
||||
&state.db,
|
||||
).await;
|
||||
|
||||
@@ -77,7 +77,11 @@ pub async fn create_session(
|
||||
let event = DomainEvent::new(
|
||||
crate::event::CONSULTATION_OPENED,
|
||||
tenant_id,
|
||||
erp_core::events::build_event_payload(serde_json::json!({ "session_id": m.id, "patient_id": m.patient_id })),
|
||||
erp_core::events::build_event_payload(serde_json::json!({
|
||||
"session_id": m.id.to_string(),
|
||||
"patient_id": m.patient_id.to_string(),
|
||||
"doctor_id": m.doctor_id.map(|id| id.to_string()).unwrap_or_default(),
|
||||
})),
|
||||
);
|
||||
state.event_bus.publish(event, &state.db).await;
|
||||
|
||||
@@ -175,7 +179,10 @@ pub async fn close_session(
|
||||
let event = DomainEvent::new(
|
||||
crate::event::CONSULTATION_CLOSED,
|
||||
tenant_id,
|
||||
erp_core::events::build_event_payload(serde_json::json!({ "session_id": m.id, "patient_id": m.patient_id })),
|
||||
erp_core::events::build_event_payload(serde_json::json!({
|
||||
"session_id": m.id.to_string(),
|
||||
"patient_id": m.patient_id.to_string(),
|
||||
})),
|
||||
);
|
||||
state.event_bus.publish(event, &state.db).await;
|
||||
|
||||
|
||||
@@ -170,7 +170,12 @@ pub async fn create_task(
|
||||
let event = DomainEvent::new(
|
||||
crate::event::FOLLOW_UP_CREATED,
|
||||
tenant_id,
|
||||
erp_core::events::build_event_payload(serde_json::json!({ "task_id": m.id, "patient_id": m.patient_id })),
|
||||
erp_core::events::build_event_payload(serde_json::json!({
|
||||
"task_id": m.id.to_string(),
|
||||
"patient_id": m.patient_id.to_string(),
|
||||
"assigned_to": m.assigned_to.map(|id| id.to_string()).unwrap_or_default(),
|
||||
"planned_date": m.planned_date.to_string(),
|
||||
})),
|
||||
);
|
||||
state.event_bus.publish(event, &state.db).await;
|
||||
|
||||
|
||||
@@ -195,6 +195,7 @@ pub async fn earn_points(
|
||||
DomainEvent::new(crate::event::POINTS_EARNED, tenant_id, erp_core::events::build_event_payload(serde_json::json!({
|
||||
"transaction_id": inserted.id, "account_id": inserted.account_id,
|
||||
"amount": inserted.amount, "balance_after": inserted.balance_after,
|
||||
"patient_id": patient_id.to_string(), "reason": event_type,
|
||||
}))),
|
||||
&state.db,
|
||||
).await;
|
||||
@@ -980,6 +981,7 @@ pub async fn exchange_product(
|
||||
DomainEvent::new(crate::event::POINTS_EXCHANGED, tenant_id, erp_core::events::build_event_payload(serde_json::json!({
|
||||
"order_id": inserted_order.id, "patient_id": inserted_order.patient_id,
|
||||
"product_id": inserted_order.product_id, "points_cost": inserted_order.points_cost,
|
||||
"product_name": product.name,
|
||||
}))),
|
||||
&state.db,
|
||||
).await;
|
||||
|
||||
Reference in New Issue
Block a user