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 |
|
iven
|
9b8307fbba
|
feat(ai): 添加 ai_suggestion 和 ai_risk_threshold SeaORM Entity
|
2026-05-01 08:05:42 +08:00 |
|
iven
|
7789a5e227
|
feat(ai): 新增 Suggestion/RiskLevel/SuggestionStatus 枚举和结构化输出 DTO
重构 dto.rs 为 dto/ 目录模块,新增 suggestion.rs 包含:
- SuggestionType (Followup/Appointment/Alert)
- RiskLevel (Low/Medium/High) + is_auto_executable
- SuggestionStatus (6 种状态)
- StructuredSuggestion / StructuredOutput / ParsedOutput DTO
- 7 个单元测试覆盖序列化往返
|
2026-05-01 08:02:53 +08:00 |
|
iven
|
30344d474f
|
fix(health+ai+dialysis): 审计 P1 批次修复 — EventBus接入/盲索引去重/事件消费者补全
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
P1-2: erp-ai EventBus 接入
- handler 层 SSE 流完成/失败时发布 ai.analysis.completed/failed 事件
- build_sse_stream 新增 tenant_id 参数
P1-2: erp-dialysis EventBus 接入
- create_dialysis_record 审计后发布 dialysis.record.created 事件
P1-5: message.sent 消费者改进
- 从占位 tracing::info 升级为带 payload 详情的结构化日志
P1-7: 盲索引去重
- create_patient 中新增 id_number HMAC 去重检查(查 blind_indexes 表)
- 患者创建成功后写入 blind_indexes 表(id_number + phone)
- 防止同租户重复建档
P1-1: 事件消费者补全
- 新增 ai.analysis.completed 消费者(幂等处理 + 日志)
- 新增 dialysis.record.created 消费者(幂等处理 + 日志)
|
2026-04-29 17:00:24 +08:00 |
|
iven
|
a84378ab50
|
feat(ai): 定期自动分析定时任务 — 每 24 小时扫描高风险患者
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 服务:
- 启动后延迟 5 分钟,每 24 小时执行一次
- 查找所有活跃租户中高风险患者(异常体征指标)
- 自动调用趋势分析并存储分析结果
- 每租户限制 50 名患者,防止过载
- erp-server main.rs 中注册后台任务
|
2026-04-28 20:02:01 +08:00 |
|
iven
|
cf844a561f
|
feat(ai+db): 趋势分析 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
- 新增迁移 000093:更新 health_trend_analysis prompt,使用统计字段
替代原始数据点遍历,引导 AI 专注 slope/R²/异常点分析
- erp-ai handler: stream_trends 改用 get_trend_analysis_data()
替代 get_vital_signs(),传递预计算趋势特征
- sanitizer: 新增 sanitize_trend_analysis() 方法
|
2026-04-28 19:57:51 +08:00 |
|
iven
|
0aab27295c
|
feat(ai): 实现 AI 数据桥接 — 4 个 HealthDataProvider 方法从 stub 替换为真实查询
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_lab_report: 查询 lab_report + patient,解析 JSON items 构造 LabReportDto
- get_vital_signs: 查询 vital_signs 时间序列,按指标提取 8 种体征数据
- get_patient_summary: 聚合 patient + diagnosis + medication_record + health_record
- get_full_report: 查询 health_record + 关联诊断和化验报告构造章节
- AiState 新增 health_provider 字段,erp-server 注入 HealthDataProviderImpl
- 4 个 SSE handler 从 placeholder JSON 改为调用 provider + sanitizer 真实数据流
|
2026-04-28 19:08:38 +08:00 |
|
iven
|
50e63530d9
|
test(ai): erp-ai 从零增至 34 个单元测试 — 覆盖 DTO/error/prompt/sanitization
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
- dto.rs: 8 个测试(AnalysisType 映射、serde round-trip、SSE 事件、默认值)
- error.rs: 10 个测试(AiError 全部 10 个变体 → AppError 映射)
- prompt: 8 个测试(变量替换、嵌套对象、数组迭代、条件、严格模式缺失变量)
- sanitization: 8 个测试(4 种 DTO 脱敏通过、PII 字段检测、空数据边界)
|
2026-04-28 18:17:19 +08:00 |
|
iven
|
7ab89f5e93
|
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
- erp-ai entity 表名对齐数据库: ai_prompt/ai_analysis/ai_usage
- stats_service: count() u64 → i64 显式转换
- health_data_service: 危急值检测 i32 比较修正 + req 所有权修复
- points_service: check_version 参数修正
- diagnosis_service: 补充 ActiveModelTrait 导入
- module.rs: start_overdue_checker 参数改为 DatabaseConnection
- module.rs: register_handlers_with_state 避免 move
|
2026-04-26 00:28:31 +08:00 |
|
iven
|
876308596a
|
feat(ai): 补全 Prompt CRUD + 分析历史 + 用量统计 handler 和路由
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
- 替换 list_analysis/get_analysis 空壳为真实查询
- 新增 list_prompts/create_prompt/activate_prompt/rollback_prompt
- 新增 usage_overview/usage_by_type
- 注册 6 个新路由到 AiModule
|
2026-04-25 23:21:11 +08:00 |
|
iven
|
48d1a84c77
|
feat(ai): UsageService 补全 get_overview/get_by_type 聚合方法
|
2026-04-25 22:53:56 +08:00 |
|
iven
|
2a8c707f6d
|
feat(ai): AnalysisService 补全 list/get 查询方法
|
2026-04-25 22:52:50 +08:00 |
|
iven
|
b2b64ec15d
|
feat(ai): PromptService 补全 list/update/activate/rollback 方法
|
2026-04-25 22:51:47 +08:00 |
|
iven
|
9901d5ce49
|
fix(ai): 审计问题修复 — 错误映射/性能/SSE/依赖规范化
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
- C3: handler 中 .map_err(AppError::Internal) 改为 ? 操作符,
利用 From<AiError> for AppError 实现正确的 HTTP 状态码映射
- H1: AiState 预构建在 AppState 初始化时,避免每次请求重建
ClaudeProvider/AnalysisService/PromptService/UsageService
- H3: stream_analyze 的 user_id 参数传递到 created_by/updated_by
- H5: SSE 事件添加 .event("chunk"/"error"/"done") 类型字段
- L3: erp-ai Cargo.toml 依赖改用 workspace 引用
(reqwest/handlebars/sha2/hex)
- 修复 erp-health 编译错误: points_handler 缺少 ColumnTrait 导入,
points_service 版本字段部分移动问题
|
2026-04-25 16:53:01 +08:00 |
|
iven
|
41dda568a5
|
feat(ai): SSE 流式分析 Handler 实现 (4 端点 + 历史)
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
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-04-25 14:03:29 +08:00 |
|
iven
|
fada33101c
|
feat(ai): AiState + AiModule (ErpModule impl + 权限 + 路由骨架)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-04-25 13:58:33 +08:00 |
|
iven
|
6d392ae2b5
|
feat(ai): AnalysisService 核心编排 + PromptService + UsageService
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-04-25 13:57:23 +08:00 |
|
iven
|
e0e4a7f9a1
|
feat(ai): 数据脱敏服务 + Prompt 模板渲染引擎
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-04-25 13:55:40 +08:00 |
|
iven
|
06f3d08c61
|
feat(ai): AiProvider trait + Claude SSE 流式实现 + DTO 定义
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-04-25 13:54:49 +08:00 |
|
iven
|
af338e0a70
|
feat(ai): 添加 SeaORM Entity (ai_prompt/ai_analysis/ai_usage)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-04-25 13:52:47 +08:00 |
|
iven
|
ec0483ffb1
|
feat(ai): 创建 erp-ai crate 骨架 + 错误类型
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-04-25 13:47:57 +08:00 |
|