chore: 编译器警告清理 — 22 条全部消除,workspace 零警告
erp-ai(8): 移除未用 import + serde 结构体 #[allow(dead_code)] erp-plugin(5): 移除未用 import + FromQueryResult 结构体允许 erp-health(8): 移除未用 import/变量 + FromQueryResult 字段允许 erp-server(1): AnalyticsEvent.timestamp 允许(未来分析集成)
This commit is contained in:
@@ -100,9 +100,9 @@ where
|
|||||||
{
|
{
|
||||||
require_permission(&ctx, "ai.suggestion.list")?;
|
require_permission(&ctx, "ai.suggestion.list")?;
|
||||||
|
|
||||||
use crate::entity::ai_suggestion;
|
use sea_orm::EntityTrait;
|
||||||
use sea_orm::{ColumnTrait, EntityTrait, QueryFilter};
|
|
||||||
|
|
||||||
|
use crate::entity::ai_suggestion;
|
||||||
let suggestion = ai_suggestion::Entity::find_by_id(id)
|
let suggestion = ai_suggestion::Entity::find_by_id(id)
|
||||||
.one(&state.db)
|
.one(&state.db)
|
||||||
.await
|
.await
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ struct ClaudeStreamEvent {
|
|||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
event_type: String,
|
event_type: String,
|
||||||
delta: Option<ClaudeDelta>,
|
delta: Option<ClaudeDelta>,
|
||||||
|
#[allow(dead_code)] // serde 反序列化需要,但流式处理中不读取
|
||||||
message: Option<ClaudeMessageResp>,
|
message: Option<ClaudeMessageResp>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,12 +63,15 @@ struct ClaudeDelta {
|
|||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct ClaudeMessageResp {
|
struct ClaudeMessageResp {
|
||||||
|
#[allow(dead_code)] // serde 反序列化需要,暂未使用 usage 信息
|
||||||
usage: Option<ClaudeUsage>,
|
usage: Option<ClaudeUsage>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct ClaudeUsage {
|
struct ClaudeUsage {
|
||||||
|
#[allow(dead_code)] // serde 反序列化需要,暂未追踪 token 用量
|
||||||
input_tokens: u32,
|
input_tokens: u32,
|
||||||
|
#[allow(dead_code)]
|
||||||
output_tokens: u32,
|
output_tokens: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use erp_core::health_provider::{HealthDataProvider, TimeRange};
|
use erp_core::health_provider::TimeRange;
|
||||||
use sea_orm::{EntityTrait, FromQueryResult, Statement};
|
use sea_orm::{FromQueryResult, Statement};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::dto::AnalysisType;
|
use crate::dto::AnalysisType;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ pub async fn handle_reanalysis_requested(
|
|||||||
#[derive(Debug, FromQueryResult)]
|
#[derive(Debug, FromQueryResult)]
|
||||||
struct OriginalSuggestion {
|
struct OriginalSuggestion {
|
||||||
baseline_snapshot: Option<serde_json::Value>,
|
baseline_snapshot: Option<serde_json::Value>,
|
||||||
|
#[allow(dead_code)] // FromQueryResult 映射需要,当前未读取
|
||||||
params: Option<serde_json::Value>,
|
params: Option<serde_json::Value>,
|
||||||
risk_level: Option<String>,
|
risk_level: Option<String>,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -325,15 +325,7 @@ pub fn register_handlers_with_state(state: crate::state::HealthState) {
|
|||||||
.and_then(|s| uuid::Uuid::parse_str(s).ok());
|
.and_then(|s| uuid::Uuid::parse_str(s).ok());
|
||||||
|
|
||||||
if let Some(patient_id) = patient_id {
|
if let Some(patient_id) = patient_id {
|
||||||
// 通过 raw SQL 查找关联的 AI 建议(action_result 中包含 followup_task_id)
|
// 通过 ai_suggestion_loader 查找关联的 AI 建议
|
||||||
let sql = r#"
|
|
||||||
SELECT id FROM ai_suggestion
|
|
||||||
WHERE tenant_id = $1
|
|
||||||
AND deleted_at IS NULL
|
|
||||||
AND status = 'executed'
|
|
||||||
AND action_result @> $2
|
|
||||||
LIMIT 1
|
|
||||||
"#;
|
|
||||||
if let Some(suggestion_id) = crate::service::ai_suggestion_loader::find_by_followup_task(
|
if let Some(suggestion_id) = crate::service::ai_suggestion_loader::find_by_followup_task(
|
||||||
&fu_db, event.tenant_id, task_id,
|
&fu_db, event.tenant_id, task_id,
|
||||||
).await.unwrap_or(None) {
|
).await.unwrap_or(None) {
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ struct ActionItemRow {
|
|||||||
patient_id: Uuid,
|
patient_id: Uuid,
|
||||||
patient_name: String,
|
patient_name: String,
|
||||||
result_content: Option<String>,
|
result_content: Option<String>,
|
||||||
|
#[allow(dead_code)] // FromQueryResult 映射需要,当前 DTO 转换中未读取
|
||||||
source_id: Option<Uuid>,
|
source_id: Option<Uuid>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,6 +117,7 @@ struct CountRow {
|
|||||||
#[derive(Debug, FromQueryResult)]
|
#[derive(Debug, FromQueryResult)]
|
||||||
struct ActionDetail {
|
struct ActionDetail {
|
||||||
id: Uuid,
|
id: Uuid,
|
||||||
|
#[allow(dead_code)] // FromQueryResult 映射需要,当前 DTO 转换中未读取
|
||||||
action_type: String,
|
action_type: String,
|
||||||
priority_raw: String,
|
priority_raw: String,
|
||||||
status: String,
|
status: String,
|
||||||
@@ -124,6 +126,7 @@ struct ActionDetail {
|
|||||||
reanalysis_id: Option<Uuid>,
|
reanalysis_id: Option<Uuid>,
|
||||||
created_at: DateTime<Utc>,
|
created_at: DateTime<Utc>,
|
||||||
updated_at: DateTime<Utc>,
|
updated_at: DateTime<Utc>,
|
||||||
|
#[allow(dead_code)] // FromQueryResult 映射需要,当前 DTO 转换中未读取
|
||||||
source_id: Option<Uuid>,
|
source_id: Option<Uuid>,
|
||||||
patient_id: Uuid,
|
patient_id: Uuid,
|
||||||
patient_name: String,
|
patient_name: String,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use sea_orm::entity::prelude::*;
|
|
||||||
use sea_orm::{ActiveModelTrait, ActiveValue::Set, ColumnTrait, EntityTrait, PaginatorTrait, QueryFilter, QueryOrder, QuerySelect};
|
use sea_orm::{ActiveModelTrait, ActiveValue::Set, ColumnTrait, EntityTrait, PaginatorTrait, QueryFilter, QueryOrder, QuerySelect};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use sea_orm::{ColumnTrait, ConnectionTrait, EntityTrait, PaginatorTrait, QueryFilter, sea_query::Expr, FromQueryResult, Statement};
|
use sea_orm::{ColumnTrait, ConnectionTrait, EntityTrait, PaginatorTrait, QueryFilter, sea_query::Expr, FromQueryResult};
|
||||||
|
|
||||||
use erp_core::error::AppResult;
|
use erp_core::error::AppResult;
|
||||||
|
|
||||||
@@ -7,7 +7,6 @@ use crate::entity::{
|
|||||||
patient, consultation_session, follow_up_task,
|
patient, consultation_session, follow_up_task,
|
||||||
points_transaction, lab_report,
|
points_transaction, lab_report,
|
||||||
appointment, vital_signs, patient_doctor_relation, doctor_profile,
|
appointment, vital_signs, patient_doctor_relation, doctor_profile,
|
||||||
article,
|
|
||||||
};
|
};
|
||||||
use crate::state::HealthState;
|
use crate::state::HealthState;
|
||||||
|
|
||||||
@@ -463,6 +462,7 @@ async fn compute_daily_report_rate(
|
|||||||
struct DailyRow {
|
struct DailyRow {
|
||||||
date: String,
|
date: String,
|
||||||
reported: i64,
|
reported: i64,
|
||||||
|
#[allow(dead_code)] // FromQueryResult 映射需要 total 字段,当前未读取
|
||||||
total: i64,
|
total: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -902,7 +902,7 @@ pub async fn get_points_recent_activity(
|
|||||||
|
|
||||||
/// 模块状态
|
/// 模块状态
|
||||||
pub async fn get_module_status(
|
pub async fn get_module_status(
|
||||||
state: &HealthState,
|
_state: &HealthState,
|
||||||
) -> AppResult<Vec<ModuleStatusResp>> {
|
) -> AppResult<Vec<ModuleStatusResp>> {
|
||||||
let modules = vec![
|
let modules = vec![
|
||||||
ModuleStatusResp {
|
ModuleStatusResp {
|
||||||
|
|||||||
@@ -459,6 +459,7 @@ impl PluginDataService {
|
|||||||
rel_table, fk
|
rel_table, fk
|
||||||
);
|
);
|
||||||
#[derive(FromQueryResult)]
|
#[derive(FromQueryResult)]
|
||||||
|
#[allow(dead_code)] // FromQueryResult 映射需要 chk 字段,仅检查是否存在
|
||||||
struct RefCheck { chk: Option<i32> }
|
struct RefCheck { chk: Option<i32> }
|
||||||
let has_ref = RefCheck::find_by_statement(Statement::from_sql_and_values(
|
let has_ref = RefCheck::find_by_statement(Statement::from_sql_and_values(
|
||||||
sea_orm::DatabaseBackend::Postgres,
|
sea_orm::DatabaseBackend::Postgres,
|
||||||
@@ -771,6 +772,7 @@ impl PluginDataService {
|
|||||||
rel_table, fk
|
rel_table, fk
|
||||||
);
|
);
|
||||||
#[derive(FromQueryResult)]
|
#[derive(FromQueryResult)]
|
||||||
|
#[allow(dead_code)] // FromQueryResult 映射需要 chk 字段,仅检查是否存在
|
||||||
struct RefCheck { chk: Option<i32> }
|
struct RefCheck { chk: Option<i32> }
|
||||||
let has_ref = RefCheck::find_by_statement(Statement::from_sql_and_values(
|
let has_ref = RefCheck::find_by_statement(Statement::from_sql_and_values(
|
||||||
sea_orm::DatabaseBackend::Postgres,
|
sea_orm::DatabaseBackend::Postgres,
|
||||||
@@ -1168,6 +1170,7 @@ impl PluginDataService {
|
|||||||
let col = sanitize_identifier(&field.name);
|
let col = sanitize_identifier(&field.name);
|
||||||
|
|
||||||
#[derive(FromQueryResult)]
|
#[derive(FromQueryResult)]
|
||||||
|
#[allow(dead_code)] // FromQueryResult 映射需要 id 字段,通过 is_some 检查
|
||||||
struct RefRow {
|
struct RefRow {
|
||||||
id: Uuid,
|
id: Uuid,
|
||||||
// 动态列 — SeaORM 无法直接映射,用 JSON 构建
|
// 动态列 — SeaORM 无法直接映射,用 JSON 构建
|
||||||
@@ -1530,6 +1533,7 @@ async fn validate_ref_entities(
|
|||||||
ref_table
|
ref_table
|
||||||
);
|
);
|
||||||
#[derive(FromQueryResult)]
|
#[derive(FromQueryResult)]
|
||||||
|
#[allow(dead_code)] // FromQueryResult 映射需要 check_result 字段,仅检查是否存在
|
||||||
struct ExistsCheck { check_result: Option<i32> }
|
struct ExistsCheck { check_result: Option<i32> }
|
||||||
let result = ExistsCheck::find_by_statement(Statement::from_sql_and_values(
|
let result = ExistsCheck::find_by_statement(Statement::from_sql_and_values(
|
||||||
sea_orm::DatabaseBackend::Postgres,
|
sea_orm::DatabaseBackend::Postgres,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use sea_orm::{ConnectionTrait, DatabaseConnection};
|
use sea_orm::DatabaseConnection;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use wasmtime::StoreLimits;
|
use wasmtime::StoreLimits;
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use erp_core::types::ApiResponse;
|
|||||||
pub struct AnalyticsEvent {
|
pub struct AnalyticsEvent {
|
||||||
pub event: String,
|
pub event: String,
|
||||||
pub properties: Option<serde_json::Value>,
|
pub properties: Option<serde_json::Value>,
|
||||||
|
#[allow(dead_code)] // 客户端上报字段,后续接入分析表时会使用
|
||||||
pub timestamp: Option<String>,
|
pub timestamp: Option<String>,
|
||||||
pub page: Option<String>,
|
pub page: Option<String>,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user