- 修复 6 个 Entity table_name 与迁移不匹配: shift, handoff_log, patient_assignment, blind_index, critical_alert, critical_alert_response - 添加透析记录 draft→completed 状态转换 API (PUT /complete) - 修复 family_proxy_service 告警状态过滤 (active→pending/acknowledged) - dev.ps1 添加 RATE_LIMIT__FAIL_CLOSE=false 开发模式 - S2 透析日流程 smoke test 报告
134 lines
4.4 KiB
Rust
134 lines
4.4 KiB
Rust
use async_trait::async_trait;
|
|
use axum::Router;
|
|
use erp_core::error::AppResult;
|
|
use erp_core::module::{ErpModule, ModuleContext, ModuleType, PermissionDescriptor};
|
|
|
|
use crate::handler::{dialysis_handler, dialysis_prescription_handler, dialysis_stats_handler};
|
|
use crate::state::DialysisState;
|
|
|
|
pub struct DialysisModule;
|
|
|
|
impl DialysisModule {
|
|
pub fn public_routes<S>() -> Router<S>
|
|
where
|
|
DialysisState: axum::extract::FromRef<S>,
|
|
S: Clone + Send + Sync + 'static,
|
|
{
|
|
Router::new()
|
|
}
|
|
|
|
pub fn protected_routes<S>() -> Router<S>
|
|
where
|
|
DialysisState: axum::extract::FromRef<S>,
|
|
S: Clone + Send + Sync + 'static,
|
|
{
|
|
Router::new()
|
|
// 透析记录
|
|
.route(
|
|
"/health/patients/{id}/dialysis-records",
|
|
axum::routing::get(dialysis_handler::list_dialysis_records),
|
|
)
|
|
.route(
|
|
"/health/dialysis-records",
|
|
axum::routing::post(dialysis_handler::create_dialysis_record),
|
|
)
|
|
.route(
|
|
"/health/dialysis-records/{id}",
|
|
axum::routing::get(dialysis_handler::get_dialysis_record)
|
|
.put(dialysis_handler::update_dialysis_record)
|
|
.delete(dialysis_handler::delete_dialysis_record),
|
|
)
|
|
.route(
|
|
"/health/dialysis-records/{id}/review",
|
|
axum::routing::put(dialysis_handler::review_dialysis_record),
|
|
)
|
|
.route(
|
|
"/health/dialysis-records/{id}/complete",
|
|
axum::routing::put(dialysis_handler::complete_dialysis_record),
|
|
)
|
|
// 透析方案
|
|
.route(
|
|
"/health/dialysis-prescriptions",
|
|
axum::routing::get(dialysis_prescription_handler::list_prescriptions)
|
|
.post(dialysis_prescription_handler::create_prescription),
|
|
)
|
|
.route(
|
|
"/health/dialysis-prescriptions/{id}",
|
|
axum::routing::get(dialysis_prescription_handler::get_prescription)
|
|
.put(dialysis_prescription_handler::update_prescription)
|
|
.delete(dialysis_prescription_handler::delete_prescription),
|
|
)
|
|
// 透析统计
|
|
.route(
|
|
"/health/admin/statistics/dialysis",
|
|
axum::routing::get(dialysis_stats_handler::get_dialysis_stats),
|
|
)
|
|
}
|
|
}
|
|
|
|
#[async_trait]
|
|
impl ErpModule for DialysisModule {
|
|
fn name(&self) -> &str {
|
|
"透析管理"
|
|
}
|
|
|
|
fn id(&self) -> &str {
|
|
"erp-dialysis"
|
|
}
|
|
|
|
fn version(&self) -> &str {
|
|
"0.1.0"
|
|
}
|
|
|
|
fn module_type(&self) -> ModuleType {
|
|
ModuleType::Builtin
|
|
}
|
|
|
|
fn dependencies(&self) -> Vec<&str> {
|
|
vec!["auth"]
|
|
}
|
|
|
|
fn permissions(&self) -> Vec<PermissionDescriptor> {
|
|
vec![
|
|
PermissionDescriptor {
|
|
code: "health.dialysis.list".into(),
|
|
name: "查看透析记录".into(),
|
|
description: "查看透析记录列表和详情".into(),
|
|
module: "erp-dialysis".into(),
|
|
},
|
|
PermissionDescriptor {
|
|
code: "health.dialysis.manage".into(),
|
|
name: "管理透析记录".into(),
|
|
description: "创建、编辑、审阅、删除透析记录".into(),
|
|
module: "erp-dialysis".into(),
|
|
},
|
|
PermissionDescriptor {
|
|
code: "health.dialysis-prescription.list".into(),
|
|
name: "查看透析处方".into(),
|
|
description: "查看透析处方列表和详情".into(),
|
|
module: "erp-dialysis".into(),
|
|
},
|
|
PermissionDescriptor {
|
|
code: "health.dialysis-prescription.manage".into(),
|
|
name: "管理透析处方".into(),
|
|
description: "创建、编辑、删除透析处方".into(),
|
|
module: "erp-dialysis".into(),
|
|
},
|
|
PermissionDescriptor {
|
|
code: "health.dialysis.stats".into(),
|
|
name: "查看透析统计".into(),
|
|
description: "查看透析统计数据".into(),
|
|
module: "erp-dialysis".into(),
|
|
},
|
|
]
|
|
}
|
|
|
|
async fn on_startup(&self, _ctx: &ModuleContext) -> AppResult<()> {
|
|
Ok(())
|
|
}
|
|
|
|
fn as_any(&self) -> &dyn std::any::Any {
|
|
self
|
|
}
|
|
}
|