diff --git a/crates/erp-health/src/module.rs b/crates/erp-health/src/module.rs index 74736ae..a7dda3c 100644 --- a/crates/erp-health/src/module.rs +++ b/crates/erp-health/src/module.rs @@ -7,13 +7,13 @@ use erp_core::module::{ErpModule, PermissionDescriptor}; use crate::handler::{ action_inbox_handler, alert_handler, alert_rule_handler, appointment_handler, - article_category_handler, article_handler, article_tag_handler, ble_gateway_handler, - care_plan_handler, consent_handler, consultation_handler, critical_alert_handler, - critical_value_threshold_handler, daily_monitoring_handler, device_handler, - device_reading_handler, diagnosis_handler, doctor_handler, family_proxy_handler, - follow_up_handler, follow_up_template_handler, health_data_handler, medication_record_handler, - medication_reminder_handler, patient_handler, points_handler, shift_handler, stats_handler, - vital_signs_daily_handler, + article_category_handler, article_handler, article_tag_handler, banner_handler, + ble_gateway_handler, care_plan_handler, consent_handler, consultation_handler, + critical_alert_handler, critical_value_threshold_handler, daily_monitoring_handler, + device_handler, device_reading_handler, diagnosis_handler, doctor_handler, + family_proxy_handler, follow_up_handler, follow_up_template_handler, health_data_handler, + media_handler, medication_record_handler, medication_reminder_handler, patient_handler, + points_handler, shift_handler, stats_handler, vital_signs_daily_handler, }; pub struct HealthModule; @@ -148,10 +148,15 @@ impl HealthModule { crate::state::HealthState: axum::extract::FromRef, S: Clone + Send + Sync + 'static, { - Router::new().route( - "/oauth/token", - axum::routing::post(crate::oauth::handler::token), - ) + Router::new() + .route( + "/oauth/token", + axum::routing::post(crate::oauth::handler::token), + ) + .route( + "/public/banners", + axum::routing::get(banner_handler::list_public_banners), + ) } /// FHIR R4 只读路由(使用 OAuth client_credentials 认证) @@ -502,6 +507,10 @@ impl HealthModule { "/health/consultation-sessions/{id}/messages", axum::routing::get(consultation_handler::list_messages), ) + .route( + "/health/consultation-sessions/{id}/messages/poll", + axum::routing::get(consultation_handler::poll_messages), + ) .route( "/health/consultation-sessions/{id}/close", axum::routing::put(consultation_handler::close_session), @@ -884,6 +893,58 @@ impl HealthModule { "/health/oauth/clients/{id}/regenerate-secret", axum::routing::post(crate::oauth::handler::regenerate_secret), ) + // 媒体库 + .route( + "/health/media", + axum::routing::get(media_handler::list_media), + ) + .route( + "/health/media/upload", + axum::routing::post(media_handler::upload_media), + ) + .route( + "/health/media/batch-delete", + axum::routing::post(media_handler::batch_delete_media), + ) + .route( + "/health/media/{id}", + axum::routing::get(media_handler::get_media) + .put(media_handler::update_media) + .delete(media_handler::delete_media), + ) + .route( + "/health/media/{id}/move", + axum::routing::post(media_handler::move_media), + ) + .route( + "/health/media/{id}/crop", + axum::routing::post(media_handler::crop_media), + ) + // 媒体文件夹 + .route( + "/health/media-folders", + axum::routing::get(media_handler::list_folders).post(media_handler::create_folder), + ) + .route( + "/health/media-folders/{id}", + axum::routing::put(media_handler::update_folder) + .delete(media_handler::delete_folder), + ) + // 轮播图管理 + .route( + "/health/banners", + axum::routing::get(banner_handler::list_banners) + .post(banner_handler::create_banner), + ) + .route( + "/health/banners/sort", + axum::routing::put(banner_handler::sort_banners), + ) + .route( + "/health/banners/{id}", + axum::routing::put(banner_handler::update_banner) + .delete(banner_handler::delete_banner), + ) // 护理计划 .route( "/health/care-plans", @@ -1487,6 +1548,32 @@ impl ErpModule for HealthModule { description: "授权/撤销家庭成员健康数据访问".into(), module: "health".into(), }, + // 媒体库 + PermissionDescriptor { + code: "health.media.list".into(), + name: "查看媒体库".into(), + description: "查看媒体文件列表、文件夹和详情".into(), + module: "health".into(), + }, + PermissionDescriptor { + code: "health.media.manage".into(), + name: "管理媒体库".into(), + description: "上传/编辑/删除媒体文件、管理文件夹".into(), + module: "health".into(), + }, + // 轮播图 + PermissionDescriptor { + code: "health.banners.list".into(), + name: "查看轮播图".into(), + description: "查看轮播图列表和详情".into(), + module: "health".into(), + }, + PermissionDescriptor { + code: "health.banners.manage".into(), + name: "管理轮播图".into(), + description: "创建/编辑/删除/排序轮播图".into(), + module: "health".into(), + }, ] }