iven
|
212c08b7ae
|
feat(health,ai): 后端服务优化 + 媒体文件处理
- erp-health: article/banner/consultation/media 服务层优化
- erp-ai: analysis/insight/prompt 服务增强
- erp-auth: auth/role/token 服务改进
- erp-workflow: executor 执行引擎修复
- erp-plugin: 服务层改进
- 新增媒体上传文件样例
|
2026-05-13 23:28:57 +08:00 |
|
iven
|
02082ccc61
|
feat(ci,ai): P2-1 权限注册表 + P2-2 AI utoipa 注解全覆盖
P2-1 权限注册表单一真相源:
- 新增 permissions.yaml: 131 个权限码 × 8 模块,含冻结标记
- 新增 scripts/gen-permissions.js: 生成器脚本
--sql 输出 seed SQL, --frontend 输出 routeConfig 片段,
--validate 验证一致性(131/131 = 0 mismatches)
P2-2 AI 模块 utoipa 注解:
- 为 30 个 handler 函数添加 #[utoipa::path] 注解
(mod.rs 18 + insight 3 + risk 1 + rule 4 + suggestion 4)
- 为 6 个 DTO struct 添加 ToSchema/IntoParams derive
(AnalyzeBody, CreatePromptBody, CreateRuleBody, UpdateRuleBody,
ApproveBody, ExecuteBody, DialysisLabInput, ListAnalysisQuery,
ListPromptsQuery)
- AI handler utoipa 覆盖率: 0/5 → 5/5 (100%)
|
2026-05-13 17:45:45 +08:00 |
|
iven
|
d6676abecf
|
fix(ai): Copilot 审计修复 — C-1/H-1/H-2/H-3/H-4/H-5/L-2
- L-2: value_to_f64 对 Null 返回 NaN(防止误触发规则)
- C-1: load_patient_data 空数据时跳过写入快照
- H-1: 每日刷新定时器添加初始延迟
- H-2: copilot_consumer 传内层 content
- H-3: 前端 hooks/Alert 修复分页响应解析
- H-4: risk_handler 动态选择 AI provider
- H-5: 新增 DELETE /copilot/rules/{id} 软删除路由
|
2026-05-13 00:21:27 +08:00 |
|
iven
|
a48ad6ed33
|
feat(ai): 告警洞察生成逻辑 + 事件消费者增强
- engine.rs 新增 generate_anomaly_insights(过滤 info 级别)
- copilot_consumer 在风险评分后自动生成 warning/critical 告警洞察
|
2026-05-12 22:34:11 +08:00 |
|
iven
|
ba0a4f4d2e
|
feat(ai): 每日风险快照批量刷新定时任务
- risk_service 新增 refresh_all_patients 方法
- module on_startup 启动每日刷新后台任务
|
2026-05-12 22:14:08 +08:00 |
|
iven
|
a999ee0036
|
feat(ai): LLM 补充风险分析 + 降级策略
- scoring.rs 新增 llm_supplement 函数(调用 AI provider 生成补充洞察)
- risk_service 新增 compute_risk_with_llm 方法(LLM 失败静默降级)
- risk_handler 改用 compute_risk_with_llm
|
2026-05-12 22:10:05 +08:00 |
|
iven
|
44dcfbd5cb
|
feat(ai): Copilot 事件消费者(订阅 health 事件触发风险评分刷新)
|
2026-05-12 22:00:47 +08:00 |
|
iven
|
57f33dd726
|
feat(ai): Copilot 评分引擎 + Handler + 路由 + 权限码
- scoring.rs: 混合评分 (calculate_risk) + RiskScore/MatchedRule 结构
- engine.rs: CopilotEngine 协调规则评估和评分
- risk_service.rs: 风险计算 + UPSERT 快照 + 规则加载
- insight_service.rs: 洞察 CRUD + 过期清理
- 3 个 Handler: insight/risk/rule,7 个 API 端点
- 5 个权限码: copilot.insights.list/manage, copilot.risk.view, copilot.rules.list/manage
- AiState 扩展 risk_service + insight_service
|
2026-05-12 12:14:16 +08:00 |
|
iven
|
fe983ba4ae
|
feat(ai): Copilot 基因化 Phase 0 Task 1-4 — 迁移 + Entity + 规则引擎
- 4 表迁移: copilot_rules, copilot_insights, copilot_risk_snapshots, copilot_chat_logs
- 4 个 SeaORM Entity 对应新表
- JSONLogic 规则引擎 (evaluate + evaluate_rules) + 5 个单元测试
|
2026-05-12 11:57:09 +08:00 |
|
iven
|
8490344d69
|
fix(ai): AI 配额摘要端点 500 错误修复
CI / security-audit (push) Has been cancelled
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
get_usage_summary 中 get_tenant_config 和 get_monthly_token_usage 的
数据库错误直接传播为 AppError::Internal (500),当 ai_tenant_configs 表
为空或查询异常时导致整个端点不可用。
改为 unwrap_or 降级处理:config 缺失时使用默认配额,token 查询失败时归零,
确保端点始终返回有效数据而非 500。
|
2026-05-09 07:52:41 +08:00 |
|
iven
|
6d5a711d2c
|
fix: 修复测试发现的 7 个问题 + 全 workspace clippy 清零
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
功能修复:
1. 患者创建空名称验证:后端添加 name.trim().is_empty() 检查
2. 仪表盘统计容错:单个查询失败返回零值而非 500
3. FHIR 路由修复:从 /fhir 移到 /api/v1/fhir 保持一致
4. 冻结模块后端中间件:新增 frozen_module_middleware 拦截冻结路径
5. 积分端点权限码:health.health-data.list → health.points.list
6. 角色权限迁移:护士补充 devices.list,运营补充 points.list/manage
7. 测试结果文档:R01-R05 角色测试 + T00/T10 结果归档
Clippy 全 workspace 清零(14→0 errors):
- erp-core: 修复 empty doc line、collapsible if、redundant closure 等 9 处
- erp-health: 修复 too_many_arguments、unused var、unnecessary parens 等 58 处
- erp-ai: 修复 dead_code、unused import 等 11 处
- erp-plugin: 修复 too_many_arguments、wildcard pattern 等 11 处
- erp-server-migration: 修复 enum_variant_names 5 处
- erp-auth/config/workflow/message: 各 1-3 处
工程改进:
- lint-staged 配置迁移到 .lintstagedrc.js(函数式避免文件列表传给 clippy)
- cargo fmt 统一格式化
|
2026-05-07 23:43:14 +08:00 |
|
iven
|
d9818c263e
|
fix(ai): AI 提示词模板添加安全检查
|
2026-05-06 10:21:35 +08:00 |
|
iven
|
087e23e57b
|
fix(ai): AI 分析队列 claim_next 添加租户隔离
|
2026-05-05 23:43:11 +08:00 |
|
iven
|
b1a96ace1f
|
fix(ai): 修复 qwen3 模型 thinking 模式导致 AI 分析输出为空
CI / security-audit (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
qwen3:4b 默认启用 thinking 模式,流式 API 中 content 字段始终为空,
所有 token 消耗在 thinking 上。修复方案:
- 对 qwen3 模型改用非流式 API,从 content 中剥离 <think... 块
- 将清理后的内容按句子/段落分块模拟流式输出
- 自动提升 qwen3 的 num_predict 至 4096 确保 thinking + 回复完整
- 流式解析中跳过空 content chunk
- 新增 strip_think_block 函数及 5 个单元测试
|
2026-05-05 22:55:20 +08:00 |
|
iven
|
a62332f1c4
|
fix(ai): AI 分析预校验 + prompt 非对话化
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
- 四个 SSE 端点增加数据完整性校验:items/sections 为空时返回 400
- 迁移 000123 更新全部 prompt system_prompt:明确非对话、输出结构化结果
- 前端用户看到的是分析结论,不再收到"请补充数据"的对话式回复
|
2026-05-05 19:53:04 +08:00 |
|
iven
|
1f91dcc5cc
|
fix(ai): 修复分析结果 JSON 嵌套 bug
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
- replay_cached 直接回放纯文本,不再包装 JSON 壳
- complete_analysis 跳过已完成的记录,防止缓存命中时覆写
- 前端 AnalysisContent 增加 extractPlainText 递归解析 JSON
|
2026-05-05 19:45:36 +08:00 |
|
iven
|
7dac749eff
|
feat(ai): 新增预算状态 + 成本估算 API 端点
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
Phase 3 Task 25:
- GET /ai/budget/status — 租户月度预算状态和告警等级
- GET /ai/cost/estimate — 按分析类型+模型估算单次成本
|
2026-05-05 16:05:00 +08:00 |
|
iven
|
0da59c6a0e
|
feat(ai): 成本估算 + 预算告警服务 — CostService
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled
CI / rust-check (push) Has been cancelled
Phase 3 Task 24:
- 按分析类型+模型估算 token 用量和 USD 成本
- 查询租户月度预算状态和告警等级(Normal/Warning/Critical/Exceeded)
|
2026-05-05 16:03:32 +08:00 |
|
iven
|
d2512ca9db
|
feat(ai): 集成知识库到 AnalysisService — system_prompt 自动注入临床规则
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
Phase 3 Task 23: AnalysisService 新增可选 knowledge_source,
stream_analyze 前自动查询 L1/L2/L3 知识并注入 system_prompt
|
2026-05-05 16:01:52 +08:00 |
|
iven
|
70f69a2008
|
feat(ai): 实现 StructuredKnowledgeSource — L1/L2/L3 知识库查询
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
Phase 3 Task 22: 从 rules/references/guides 表构建 Prompt 注入上下文
- 规则按优先级排序,参考资料附带引用,指南截取前 2000 字
- 总上下文不超过 8000 字符,confidence 根据 L1/L2 匹配度计算
|
2026-05-05 15:58:54 +08:00 |
|
iven
|
3592b55556
|
feat(ai+db): 知识库 3 表迁移 + Entity — rules/references/guides
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
Phase 3 Task 21:
- ai_knowledge_rules: L1 规则表(条件表达式 + 动作文本)
- ai_knowledge_references: L2 参考表(摘要 + pgvector 嵌入)
- ai_knowledge_guides: L3 指南表(全文 + pgvector 嵌入)
|
2026-05-05 15:55:20 +08:00 |
|
iven
|
75a70d2e46
|
feat(ai): 添加知识库 trait 和 DTO — KnowledgeSource/PatientSummary/Reference
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
Phase 3 Task 19: 定义统一知识获取接口,支持未来向量检索扩展
|
2026-05-05 15:50:57 +08:00 |
|
iven
|
54116d1a1f
|
refactor(ai): auto_analysis 改为入队模式
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
高风险患者扫描结果构造 AnalysisJob 入队而非直接调用 Provider
保留定时扫描逻辑(每 24h),分析执行由队列消费者负责
|
2026-05-05 15:41:30 +08:00 |
|
iven
|
553de13cd5
|
feat(ai): 扩展事件订阅自动入队分析
订阅 health_data.critical_alert → 趋势分析 (priority=2)
订阅 lab_report.uploaded → 化验单解读 (priority=1)
订阅 dialysis.record.created → KDIGO 风险评估 (priority=2)
tokio::select! 多通道并发消费
|
2026-05-05 15:40:15 +08:00 |
|
iven
|
7fb92714c7
|
feat(ai): 实现 AnalysisQueue 服务
支持 enqueue/claim_next/mark_completed/mark_failed 状态机
失败自动重试(retry_count < max_retries → pending),queue_status 聚合查询
|
2026-05-05 15:38:14 +08:00 |
|
iven
|
3186c5aee9
|
feat(ai): 添加 ai_analysis_queue 迁移 + Entity
异步分析队列表,支持优先级/重试/状态机(pending→running→completed/failed)
索引覆盖租户状态查询和调度扫描,迁移号 000118
|
2026-05-05 15:35:59 +08:00 |
|
iven
|
c268229311
|
feat(ai): 实现 CacheService 两级缓存 + 集成到 AiState
Redis TTL (L1) + DB SHA-256 hash (L2),Redis 不可用时自动降级
CacheKey 基于 tenant_id + analysis_type + input_hash + prompt_version
AiState 新增 cache 字段,main.rs 注入共享 Redis Client
|
2026-05-05 15:33:58 +08:00 |
|
iven
|
50b9e8d683
|
feat(ai): 添加 Provider 管理 API 端点
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
GET /ai/providers — 列出已注册提供商
GET /ai/providers/health — 各提供商健康状态
GET /ai/quota/summary — 租户配额使用摘要
|
2026-05-05 15:19:49 +08:00 |
|
iven
|
a16e86bf04
|
feat(ai): 重构 AiState 集成 ProviderRegistry + QuotaService
AiState 新增 provider_registry 和 quota 字段
main.rs 启动时按配置注册 Claude/OpenAI/Ollama Provider
支持多 Provider 并发注册和健康检查
|
2026-05-05 15:18:26 +08:00 |
|
iven
|
63ff8660fc
|
feat(ai): 实现 QuotaService 租户配额检查
月度 Token 预算 + 每日患者分析次数限制,raw SQL 聚合查询
可全局开关 (quota_check_enabled),无配置时默认放行
|
2026-05-05 15:16:09 +08:00 |
|
iven
|
105cae0565
|
feat(ai): 添加 ai_tenant_configs 迁移 + Entity
支持租户级 Provider 路由配置、月度 Token 预算、每日患者限制
unique 索引确保每租户一条配置,迁移号 000117
|
2026-05-05 15:13:05 +08:00 |
|
iven
|
37acd34154
|
feat(ai): 实现 OllamaProvider 本地模型支持
使用 /api/chat 端点,无需 API Key,支持流式/非流式生成
健康检查通过 /api/tags,含 7 个单元测试
|
2026-05-05 15:10:43 +08:00 |
|
iven
|
b728618d61
|
feat(ai): 实现 OpenAIProvider 兼容 OpenAI API 格式
支持 /v1/chat/completions 端点的流式/非流式生成 + 健康检查
含序列化/反序列化单元测试
|
2026-05-05 15:08:41 +08:00 |
|
iven
|
74b1d44068
|
feat(ai): 实现 ProviderRegistry 并发安全多提供商注册与路由
DashMap 支持并发注册,resolve() 按首选→回退→任意可用顺序
实时健康检查,含 4 个单元测试覆盖正常/降级/全不可用场景
|
2026-05-05 15:07:19 +08:00 |
|
iven
|
24bb8e7bca
|
feat(ai): 扩展 AiError 支持配额/缓存/知识库/队列/配置错误变体
新增 QuotaExhausted→429, CacheError/KnowledgeError/QueueError/ConfigError→500
|
2026-05-05 15:02:38 +08:00 |
|
iven
|
4d02b2b531
|
feat(ai): 扩展 AiConfig 支持多 Provider 配置
- config/default.toml 新增 providers 子段(claude/openai/ollama)
- erp-server/config.rs AiConfig 新增 quota_check_enabled + providers HashMap
- erp-ai/config.rs 新增 ProviderType 枚举 + ProviderConfig 结构体
|
2026-05-05 15:01:24 +08:00 |
|
iven
|
8d288cadfa
|
fix(health+ai): 后端质量修复 — Phase 2d
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
H3: 设备数据摄入增加 tracing 日志(事务保护待 ConnectionTrait 重构)
M4: care_plan/shift/ble_gateway/vital_signs_daily 补全 tracing 入口日志
M1: AI 分析缓存命中检查 + 缓存结果 Stream 回放
H4: 透析→KDIGO 自动串联(dialysis_notifier 发布 ai.dialysis.kdigo_requested 事件)
|
2026-05-05 00:19:22 +08:00 |
|
iven
|
0a5290aee4
|
feat(ai): KDIGO 透析专用风险评分器 — Phase 1 关怀引擎 MVP 第二步
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
新增 DialysisRiskScorer:12 条 KDIGO 规则覆盖 Kt/V、血磷、血钾、血红蛋白、
体重增长、eGFR、白蛋白,含 KDIGO CKD G1-G5 分期。同步暴露
POST /ai/dialysis/risk-assessment 端点。76 个测试全部通过。
|
2026-05-04 18:44:22 +08:00 |
|
iven
|
d68c7be098
|
feat(ai): 建议状态生命周期 — 转换验证 + 执行端点 + 事件发布
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
建议(ai_suggestion)原有状态枚举完整但缺乏生命周期管理:
- 无转换验证(可从 Rejected 跳到 Approved)
- 无执行端点(护士无法标记"已执行")
- 无状态变更事件
变更:
1. SuggestionStatus.can_transition_to() — 仅允许合法单向转换
Pending → Approved/Rejected/Expired → Approved → Executed/Rejected/Expired
2. SuggestionService.execute_suggestion() — 记录执行结果
3. SuggestionService.expire_stale_suggestions() — 批量过期超时建议
4. POST /ai/suggestions/{id}/execute — 新执行端点
5. publish_status_event() — 状态变更时发布 ai.suggestion.status_changed 事件
6. 9 个新单元测试覆盖所有转换规则
|
2026-05-04 13:39:48 +08:00 |
|
iven
|
e78eb1af07
|
fix(ai): 连接 ai.analysis.requested 事件消费者
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
erp-health 在化验单上传时发布 ai.analysis.requested 事件,
但 erp-ai 的 on_startup 仅订阅 ai.reanalysis.* 前缀。
将订阅前缀从 "ai.reanalysis." 扩大为 "ai.",
新增 ai.analysis.requested 事件的接收和日志记录。
完整自动分析实现依赖 Prompt 模板就绪后补充。
|
2026-05-04 13:12:47 +08:00 |
|
iven
|
77cf866adf
|
fix(ai): 修复自动分析管道 — 补全建议生成 + 事件发布
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
自动分析批处理(auto_analysis.rs)在完成流式分析后仅保存结果,
缺少三个关键步骤导致关怀引擎无法启动:
1. 不解析双通道输出(StructuredOutput)→ 无结构化建议
2. 不调用 SuggestionService.create_suggestions() → 无建议记录
3. 不发布 ai.analysis.completed 事件 → 下游消费者无感知
修复方案:提取 post_process_analysis() 共享函数,统一处理
解析→创建建议→发布事件的后处理逻辑,SSE handler 和自动分析共用。
|
2026-05-04 13:10:55 +08:00 |
|
iven
|
5140552ff6
|
fix(health): 走查止血 — 患者名显示修复 + 枚举补全 + 医护统计 + 设备选择器
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
后端:
- alert_service: list_alerts 批量查询 patient_name 填充 AlertResponse
- consultation_service: list_sessions 批量查询 patient_name/doctor_name
- erp-ai handler: list_analysis 通过 raw SQL 查询 patient_name
前端:
- AlertList/AlertDashboard: 使用后端返回的 patient_name 替代 ID 截断
- ConsultationDetail: 使用 patient_name/doctor_name 替代 ID 截断
- AiAnalysisList: 使用 patient_name 替代 ID 截断
- constants/health: SEVERITY 补 high/medium, STATUS 补 active
- AdminDashboard: 医护人数改为 API 查询(useStatsData 新增 doctorCount)
- DeviceManage: 患者 ID 输入改为 PatientSelect 搜索选择器
|
2026-05-04 00:03:40 +08:00 |
|
iven
|
bc6206c0df
|
chore: 编译器警告清理 — 22 条全部消除,workspace 零警告
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
erp-ai(8): 移除未用 import + serde 结构体 #[allow(dead_code)]
erp-plugin(5): 移除未用 import + FromQueryResult 结构体允许
erp-health(8): 移除未用 import/变量 + FromQueryResult 字段允许
erp-server(1): AnalyticsEvent.timestamp 允许(未来分析集成)
|
2026-05-03 20:09:26 +08:00 |
|
iven
|
3412d807e3
|
fix(core): 跨 crate 小修复 — dto 合并、tracing 补全、死代码清理
- erp-ai: 删除孤立 dto.rs(已合并到子模块)
- erp-core: audit_service tracing 优化
- erp-health: points_handler 补充返回值、alert_engine 修正日志级别
- erp-plugin: host/data_handler/market_handler tracing 统一
- erp-dialysis/event: 移除无用 import
- erp-workflow/executor: tracing 格式统一
|
2026-05-03 19:31:46 +08:00 |
|
iven
|
5d2402a1e7
|
feat(ai+health): 闭环核心 — 随访完成→再分析触发 + 前后对比报告
- follow_up.completed 消费者:通过 action_result 反查 AI 建议,触发再分析
- ai.reanalysis.requested 消费者:加载原始建议 baseline
- comparison.rs:对比报告生成引擎(指标变化百分比+趋势判断)
- GET /ai/suggestions/{id}/comparison:前后对比报告 API
- find_by_followup_task:通过随访任务反查关联建议ID
|
2026-05-01 09:14:13 +08:00 |
|
iven
|
415d7617c8
|
feat(ai): 建议查询/审批 API 端点 + 权限注册
- GET /ai/suggestions?analysis_id=xxx — 查看建议列表(ai.suggestion.list)
- POST /ai/suggestions/{id}/approve — 批准/拒绝建议(ai.suggestion.manage)
- 新增 ai.suggestion.list 和 ai.suggestion.manage 权限码
|
2026-05-01 08:12:29 +08:00 |
|
iven
|
6e761ae22b
|
feat(ai): 集成双通道输出解析到 SSE handler — 自动创建建议记录
在 build_sse_stream 完成回调中:
- 调用 parse_dual_channel 解析 AI 输出
- 有结构化建议时调用 SuggestionService::create_suggestions 创建记录
- 解析失败时调用 mark_parse_failed 记录日志
- 扩展 ai.analysis.completed 事件 payload 含 risk_level + suggestion_count
|
2026-05-01 08:11:23 +08:00 |
|
iven
|
b30897119b
|
feat(ai): SuggestionService — 建议记录 CRUD + 状态流转
- create_suggestions: 批量创建建议记录,关联分析 ID 和 baseline 快照
- list_by_analysis: 按 analysis_id 查询建议列表(带 tenant_id 过滤 + 软删除)
- list_pending: 查询待审批建议
- update_status: 更新状态(带乐观锁 + tenant_id 过滤)
- mark_parse_failed: 解析失败时记录日志
- AiState 新增 suggestion 字段
|
2026-05-01 08:09:59 +08:00 |
|
iven
|
3b6f72d5c0
|
feat(ai): 本地临床规则引擎 — AI 不可用时的回退方案
- LocalRulesEngine: 预定义 8 条临床规则(收缩压/心率/血糖/血氧)
- CompareOp: GreaterThan/LessThan 比较运算
- evaluate(): 输入指标 JSON,输出 StructuredSuggestion 列表(按优先级排序)
- 5 个单元测试覆盖:高值触发、正常无建议、缺失指标跳过、SpO2 低、优先级排序
|
2026-05-01 08:08:48 +08:00 |
|
iven
|
92e6cf0c43
|
feat(ai): 双通道输出解析器 — 文本/JSON 分割 + 降级策略
- parse_dual_channel: 分割 ===PATIENT_TEXT=== / ===STRUCTURED_JSON=== 标记
- JSON 解析失败时降级为纯文本,structured 为 None
- 5 个单元测试覆盖:正常解析、纯文本、无效 JSON、空建议、风险等级
|
2026-05-01 08:07:26 +08:00 |
|