Commit Graph

230 Commits

Author SHA1 Message Date
iven
89581b070f feat(ai): Phase 1C 管理看板 — 用量/成本/功能开关三合一
- UsageService 新增 get_daily_usage + aggregate_daily 日聚合能力
- 新增 3 个管理端点: /ai/admin/daily-usage, /ai/admin/flags (GET+POST)
- AiUsageDashboard 扩展为三 Tab: 用量概览/成本分析/功能开关
- 功能开关支持 Switch 实时切换,权限码 ai.admin.flags
- 日聚合用量 30 天趋势表,含 Token/成本汇总统计
2026-05-18 23:36:33 +08:00
iven
281c71ebfc feat(web): AiAnalysisCard 通用组件 — 封装 SSE 流式分析 + 加载/错误/成功态
- 新增 AiAnalysisCard: 支持 4 种分析类型, 自动组装 request body
- 4 种状态: idle(按钮) / loading(骨架屏) / error(重试) / success(结果卡片)
- 权限控制通过 AuthButton 集成, 供多触点复用

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 22:58:51 +08:00
iven
bf37acc681 feat(ai): AI 健康管家 V2 基础设施 — 功能开关 + 角色沙箱准备 + 体征页 AI 趋势分析
- 迁移 000153: 新增 ai_feature_flags / ai_usage_daily / ai_suggestion_feedback 三张表,
  ai_tenant_configs 增加 billing_enabled 列, seed 12 个功能开关 + 2 个管理权限码
- 新增 FeatureFlagService: 5 分钟缓存 + DB 回退 + 即时更新
- VitalSignsTab 添加 AI 趋势分析按钮 (SSE 流式)
- 新增 3 个 Entity (ai_feature_flags / ai_usage_daily / ai_suggestion_feedback)
- AiState 扩展 feature_flags 字段
- 设计规格 + 讨论记录文档

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 22:55:40 +08:00
iven
d623f8b2ff fix: V1 测试版本端到端验证修复 — 6 CRITICAL + 3 HIGH 问题全量修复
修复项:
- fix(db): 迁移 149 — 修复 Admin 角色权限绑定被迁移链破坏 (FE-C1)
- fix(health): 4 个 handler 添加空名称验证 — Doctor/Article/AlertRule/Tag (API-C1~C4)
- fix(health): Stats 仪表盘 new_this_week 查询修复 — SeaORM date_trunc bug (FE-C2)
- fix(server): 添加安全响应头 — X-Frame-Options/CSP/XSS-Protection/Referrer-Policy (SEC-H1)
- fix(mp): 预约创建契约修复 — notes/reason 字段映射 + 移除 schedule_id (MP-H1)
- fix(mp): 咨询会话 subject/last_message 字段改为可选 (MP-H3)
- fix(ai): AiConfig Default derive 替代手写 impl (clippy)

测试报告:
- 8 维度端到端测试全部完成 (后端 87 用例 / 前端 30 页面 / 小程序 80+ API / 安全 20 项 / 性能 20 端点)
- 多角色 7 角色 49 检查 100% 通过
- 综合测试报告 + 专家评估报告
2026-05-18 10:24:40 +08:00
iven
c38967a36e fix(mp): 修复小程序角色路由 + 前后端字段对齐 + E2E 测试报告
- 修复 stores/auth.ts 三种登录方式从错误路径提取 roles(resp.roles → resp.user.roles)
- 首页添加医护人员自动跳转医生端(useDidShow + isMedicalStaff)
- services/auth.ts credentialLogin 返回类型补全 roles 字段
- Web 前端 healthData.ts 字段对齐后端 DTO(indicators→items, content→overall_assessment)
- Web 前端 medicationReminders.ts 字段对齐(time_slots→reminder_times)
- 小程序 report.ts / reports 页面字段对齐后端(indicators→items, doctor_interpretation→doctor_notes)
- 小程序 patient.ts / followup.ts / alert.ts 补全缺失字段
- 后端 stats_handler.rs 权限码修正(health.patient.list→health.dashboard.manage)
- 新增 V1 E2E 测试报告和五专家组评审报告
2026-05-17 01:51:02 +08:00
iven
ced1c0ad0c fix(web): 清零前端 TS 构建错误 — 31 文件类型修复 + 面包屑 + 超时配置
- 修复 verbatimModuleSyntax 要求的 import type 声明
- 修复未使用导入(Badge/EditOutlined/Space/Input/Switch 等)
- 修复 mock.calls 类型注解([string,unknown] → any[])
- 修复 vitest 全局超时和 poolTimeout 配置
- 修复 PageContainer 缺少 onBack prop、MenuInfo children 可选
- 修复 CopilotAlert Badge status info→processing、useCopilotRisk 二次解包
- 修复 articles/doctors 测试 delete 调用缺少 version 参数
- 添加排班管理/预约管理面包屑标题 fallback
2026-05-15 23:03:08 +08:00
iven
d44c6167b1 fix: E2E 测试发现的 10 项 BUG 修复 — 全栈验证通过
P0 修复:
- 侧边栏路由不稳定: Content 区域添加 key={currentPath} 强制重渲染
- 轮播图缩略图不显示: BannerManage 导入 resolveMediaUrl + 反斜杠转正斜杠
- 超长名称导致 500: patient_handler 添加 name.len() > 255 校验
- 迁移 m20260515_000146: version 乐观锁 version+1 修复

P1 修复:
- 排班路由被冻结: routeConfig.ts 移除 /health/schedules 的 frozen 标记
- 轮播图 Switch 切换无效: 切换前先 GET 最新 version 避免乐观锁冲突
- thumbnail_url 反斜杠: media_service 存储时统一 replace('\', '/')

P2 修复:
- 预约类型 follow_up 未映射: APPOINTMENT_TYPE_MAP 补充 '随访'
- 日期选择器未汉化: DatePicker.RangePicker 添加中文 placeholder
- 轮播图 title 必填校验: banner_handler 添加空标题拒绝
- 文章分类重名: article_category_service 添加同名检查
2026-05-15 21:13:49 +08:00
iven
41515e5bec refactor(web): 消除侧边栏硬编码 — iconMap 抽离 + routeTitleFallback 精简
- iconMap 抽离为 utils/iconRegistry.tsx(单一真相源),补齐 10 个后端 seed 使用但前端缺失的图标
- MainLayout import 从 28 个图标减少到 6 个(仅保留布局专用图标)
- routeTitleFallback 从 26 条精简到 10 条(仅保留动态参数路由 + 无后端菜单的静态路由)
- 后端菜单已覆盖的 16 条标题映射移除(由 getTitleFromMenus 从后端数据获取)
- wiki 关键数字更新:迁移 146、权限码 132
2026-05-15 19:27:10 +08:00
iven
2c48bb0f56 refactor(web): Tab 权限映射集中化 — 消除硬编码
- routeConfig.ts 新增 TAB_PERMISSIONS 配置(单一真相源)
- 新增 usePermFilteredTabs hook,通用 Tab 权限过滤
- PatientDetail.tsx 移除内联 TAB_PERMISSIONS,改用 hook
- 未声明 Tab 安全默认隐藏,DEV 模式 console.warn 提示
2026-05-15 19:15:26 +08:00
iven
8763e10d6e fix: 全局权限优化 — 7 项问题修复
1. 菜单权限修复:补充 10 个菜单的 permission 字段 + 修复 menu_service
   回退逻辑(admin 直接跳过过滤,非 admin 无关联则不显示)+ 收紧前端过滤
2. 管理员重置密码:新增 POST /users/{id}/reset-password 端点 + 前端按钮
3. 告警处理人姓名:AlertResponse 添加 acknowledged_by_name 字段
4. Tab 权限过滤:PatientDetail 6 个 Tab 按权限过滤 + 状态字段 Tooltip
5. 消息中心 UI:添加 Popconfirm/AuthButton,移除 inline isDark
2026-05-15 19:00:48 +08:00
iven
4ca9027cd6 fix: 联合调试问题修复 — 预约错误提示 + request 错误提取 + copilot 解包
- ISSUE-APPOINTMENT-001: 后端 DoctorNotFound 改为 Validation 错误(400)
  + 改善错误消息"所选医生暂无医护档案,请联系管理员"
  + 小程序预约创建 catch 传递实际错误消息(不再硬编码"预约失败")
  + 小程序 request.ts 提取后端 message 字段作为用户提示
- copilot API: listInsights/listRules/getPatientRisk 补齐 data.data 解包
- 移除 error.rs 重复的 AppointmentNotFound 分支
2026-05-15 15:25:26 +08:00
iven
e4e5ef04d4 feat(web): Web 前端功能完善 — API 扩展 + 组件优化
- 新增 AI 透析分析 API + 药物提醒 API
- MediaPicker/ThemeSwitcher/usePaginatedData 优化
- 健康管理页面组件增强(Banner/Consultation/Doctor/MediaLibrary 等)
- PluginCRUDPage 导入优化
2026-05-13 23:28:22 +08:00
iven
e9458a6bdf fix(ci,web): API 路径检查脚本归一化 + DEV 模式路由覆盖率校验
- check-api-paths.sh: 归一化前端硬编码 ID、扩展后端路由提取范围
  (users/roles/departments 等基础模块)、排除插件动态路由假阳性
  结果: 46 个不匹配 → 0 个,CI PASS
- routeConfig.ts: 新增 validateRouteCoverage() 开发模式校验函数
- App.tsx: 挂载时调用路由覆盖率校验,未声明权限的路由会 console.warn
2026-05-13 14:48:10 +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
6d97328ff6 feat(web): CopilotAlert 告警组件 + 告警 API 扩展
- CopilotAlert: 分级告警列表,30秒轮询刷新,危急 banner
- copilot.ts 新增 listAlerts 函数
2026-05-12 22:36:36 +08:00
iven
78c052ecc9 feat(web): 患者详情页嵌入 Copilot 风险徽章 2026-05-12 22:25:56 +08:00
iven
22ef9b32d6 feat(web): CopilotBadge + CopilotCard 组件 + hooks
- CopilotBadge: 风险评分标签(低/中/高/危急)
- CopilotCard: 洞察列表卡片(支持忽略操作)
- useCopilotRisk / useCopilotInsights: 数据获取 hooks
2026-05-12 22:20:56 +08:00
iven
cba8c8306d feat(web): Copilot API 调用层 2026-05-12 22:16:28 +08:00
iven
103c8aa059 refactor(web): 文章预览去壳化 — 375px 纯内容面板替代 iPhone 仿真
- 删除全部 iPhone 外壳代码(Dynamic Island / 状态栏 / 侧边按钮 / 相机条 / Home Indicator)
- 从 620 行精简到 200 行
- 改为 375px 固定宽度纯内容面板,CSS 与小程序 article/detail 完全一致
- 内容区自然流动高度 + 滚动,不再被外壳约束
- 顶部简洁标签栏「小程序端效果预览 · 375px」
- 新增头脑风暴讨论记录 docs/discussions/2026-05-11
2026-05-11 09:36:43 +08:00
iven
6269815046 fix(web): 文章编辑器手机预览放大至 375px — 匹配真机阅读效果
- 屏幕宽度从 256px 放大到 375px(接近 iPhone CSS 逻辑像素)
- 内容字体全部改为小程序真实尺寸(16px 正文 / 22px 标题 / 15px 摘要)
- 间距 padding/margin 与小程序 article/detail 完全一致
- 手机高度改为自适应(内容撑开),不再固定截断
- Dynamic Island / 状态栏 / 按钮按比例放大
2026-05-11 03:24:15 +08:00
iven
00301d2528 feat(web): 文章编辑器手机预览更新为 iPhone 17 Pro Max 设计
- 外壳从钛金属渐变改为航空级铝合金一体化银灰色
- 比例更新为 163.4×78.0mm (2.095:1)
- 背面摄像头从三角形排列改为横向相机条(3镜头+闪光灯横向排列)
- 边框收窄(3px),阴影减弱匹配铝合金质感
- 标签更新为 "iPhone 17 Pro Max"
2026-05-11 03:18:59 +08:00
iven
c716cc0f7b feat(web): 文章编辑器 — iPhone 15 Pro Max 高保真预览 + 丰富样式模板
- 手机预览按 iPhone 15 Pro Max 真实比例 (2.084:1) 重设计
- 钛金属渐变边框 + Dynamic Island + 前置摄像头 + 侧边按钮
- 背面摄像头模组微阴影暗示 + 多层投影深度效果
- iOS 17 风格状态栏 (信号/WiFi/电池 SVG 图标)
- 样式模板从 14 种扩展到 27 种
- 新增: 成功/危险/强调提示框、时间线、步骤流程、对比卡片、问答、进度条、引言卡片等
2026-05-11 02:41:30 +08:00
iven
f4b09858c4 feat(web): 文章编辑器重设计 — 公众号风格三栏布局 + styled-block 自定义模块
- 左栏样式组件库(标题/内容/区块 14 种模板,5 种配色主题)
- 中间 Notion 风格编辑区(标题置顶 + wangEditor + 自定义 styled-block)
- 右栏 iPhone 仿真预览(匹配小程序暖奶油配色)
- 设置面板移至 Drawer 抽屉按需打开
- 注册 wangEditor 自定义模块保留模板内联样式
- 使用 snabbdom VNode + insertNode API 解决样式被剥离问题
2026-05-11 02:18:24 +08:00
iven
a6ec8129c9 refactor(web,health): 消除硬编码路径 — 统一 resolveMediaUrl + 动态 base_url
1. 新增 resolveMediaUrl() 工具函数,统一处理 storage_path 前缀和 JWT token
2. MediaLibrary 和 MediaPicker 改用 resolveMediaUrl,消除重复逻辑
3. banner_handler 不再硬编码 localhost:3000,改为从 Host header 动态构建 base_url
2026-05-10 20:00:39 +08:00
iven
270818c3ad fix(web): 媒体库图片添加 JWT token 认证参数
/uploads 路径需要认证,图片 src 须带 ?token= 参数才能正常显示。
MediaLibrary 组件现在从 localStorage 读取 access_token 并附加到图片 URL。
2026-05-10 19:55:13 +08:00
iven
4ea54ff27c fix(web): 媒体库图片不显示 — 添加 /uploads Vite 代理 + 修复路径前缀
前端图片 URL 使用 ./uploads/... 相对路径导致 404:
1. Vite 添加 /uploads 代理到后端 3000 端口
2. MediaLibrary 和 MediaPicker 图片 src 去掉 ./ 前缀
2026-05-10 19:52:49 +08:00
iven
edb4b6557d fix(health): 修复媒体库和轮播图菜单不可见 — parent_id/permission/menu_roles 三重修复
种子迁移 m20260510_000137 存在三个问题导致菜单不显示:
1. parent_id 查找用了错误条件(path='/health'),改为 title='内容运营'
2. menu INSERT 缺少 permission 字段
3. 缺少 menu_roles 关联(admin/operator)
同时新增 BannerManage.tsx 前端页面
2026-05-10 19:07:20 +08:00
iven
d2b79e4a1c feat(web): 添加 MediaPicker 组件并集成到 ArticleEditor 封面图选择 2026-05-10 16:54:30 +08:00
iven
6bf8cc53f8 feat(web): 新增媒体库管理页面
- 左侧面板:文件夹树形结构,支持创建/重命名/删除文件夹
- 右侧面板:媒体网格视图,支持上传/搜索/类型筛选/批量删除
- 上传弹窗:TreeSelect 选择目标文件夹 + 公开访问开关
- 编辑弹窗:修改文件名/替代文本/公开状态
- 移动弹窗:选择目标文件夹移动文件
- 权限码:health.media.list + health.media.manage
2026-05-10 16:18:47 +08:00
iven
2c7d4a3d63 feat(web): 新增媒体库和轮播图 API client
媒体库(media.ts):文件列表/上传/更新/删除/移动/批量删除/裁剪 + 文件夹树形管理
轮播图(banners.ts):列表/创建/更新/删除/排序,字段与后端 DTO 完全对齐
2026-05-10 15:42:24 +08:00
iven
07217336e7 fix(web): 运营仪表盘数据映射错误和浮点精度修复
Some checks failed
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
- OperatorWorkbench: "今日活跃用户" 错误使用体征上报率数据源,改为 pointsStats.active_accounts
- OperatorWorkbench: AI 摘要体征上报率显示原始浮点数(22.413793...),改为保留两位小数
- OperatorWorkbench: "科普阅读量" fallback 错误回退到积分发放数据,移除错误 fallback
- Home.tsx: 运营角色 ROLE_STATS "内容发布" 数据源错误,修正为 patientStats
- Home.tsx: 移除未使用的 TodoList/AiInsightPanel import
- .lintstagedrc.js: 修复 Windows 平台 eslint 命令,使用函数式获取文件名列表
2026-05-09 02:27:38 +08:00
iven
22b8ac7ac6 fix: 修复多角色找茬测试 V2 发现的 11 个问题
Some checks failed
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
P0 (CRITICAL):
- C1: 统计 API 全部改为 safe_aggregate 容错,防止单个子查询崩溃导致 500
- C2: Token 刷新增加用户身份验证,防止并发场景下身份切换
- C3: 患者端线下活动接口添加患者档案验证,防止 Doctor/HM 越权访问

P1 (HIGH):
- H1: 操作记录用 EntityName 组件解析用户名,不再显示截断 UUID
- H4: 告警标题添加中英文映射 (translateAlertTitle)
- H5: 告警面板补全 message import + 修复 hooks 顺序
- H8: 咨询消息发送按钮添加 AuthButton 权限控制
- H9: routeConfig 日常监测权限码改为 health.daily-monitoring.*

P2 (MEDIUM):
- M4: 咨询类型映射补全 online/phone/doctor/follow_up 中文标签

DTO: LabReportStatisticsResp, AppointmentStatisticsResp, VitalSignsReportRateResp 添加 Default derive
2026-05-08 12:42:41 +08:00
iven
c82f7bda1d fix: 系统性预防角色测试高频问题(5 方案落地)
Some checks failed
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
P0 — 默认拒绝 + 强制守卫:
- 创建 routeConfig.ts 作为前端路由权限的单一真相源
- TypeScript 强制每个路由声明非空权限数组,不可能遗漏
- 自动生成 ROUTE_PERMISSIONS 和 FROZEN_ROUTES
- 修正 3 个前端权限码不匹配后端

P0 — CI 权限扫描:
- 新增 tools/check_permissions.py 校验脚本
- 发现并修复 tenant.manage 未注册问题

P1 — 聚合接口容错:
- erp-core 新增 safe_aggregate 工具函数
- 仪表盘统计 handler 重构

P1 — 状态机一致性自检:
- validation.rs 新增 3 个自检测试

fix: lint-staged eslint Windows 兼容性
2026-05-08 08:52:16 +08:00
iven
786f57c151 fix: 修复角色测试发现的 5 个共性问题
Some checks failed
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
- 修复前端路由守卫前缀碰撞(/health/articles 匹配 /health/article-categories)
- 补全 6 条缺失路由权限映射(appointments/follow-up-records/article-categories/article-tags/plugins/market)
- 修复 critical-alerts API 500(escalation_level 字段 INT2/i16 与 Entity i32 类型不匹配)
- 新增迁移 000128:告警状态修正 + 菜单权限码补全 + 非admin角色移除基础模块权限
2026-05-07 15:54:37 +08:00
iven
60dc4dba7a fix(health): 修复 5 角色深度测试发现的权限越权和告警端点缺失
Some checks failed
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
- auth: token_service 查询 role_permissions/user_roles 添加 deleted_at 过滤,
  修复软删除的权限仍被加载到 JWT 的越权漏洞
- health: 新增 GET /health/alerts/{id} 告警详情端点(含 handler + service + 路由)
- web: AlertList 操作按钮增加 active 状态判断,修复按钮不显示
- migration: 新增 000127 清理 doctor 角色多余的 health-data.manage/ai.analysis.manage
2026-05-07 13:51:16 +08:00
iven
85a7dacd16 fix(health): 修复 5 角色深度测试发现的 8 个问题
Some checks failed
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
P0 修复:
- 告警状态机新增 active 合法状态 + 转换规则 (active→acknowledged/dismissed)
- 前端路由守卫改为默认拒绝,未注册路由返回 403

P1 修复:
- 侧边栏菜单根据用户权限码过滤,非 admin 隐藏无权限菜单项
- Critical-alerts handler 增加详细错误日志 + div_ceil 安全防护
- 仪表盘统计 API 调用使用 silent 模式避免 500 触发全局 toast

P2 修复:
- 随访类型映射新增 visit → 上门 (前后端同步)
- 随访 fallback 选项新增 visit 类型

排除的假 BUG (代码已正确):
- 患者性别/血型: MCP fill() 不兼容 Select 组件,正常交互正确
- 随访筛选/对话框关闭: 代码逻辑验证正确

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-07 08:24:12 +08:00
iven
0acf901893 fix(web): 告警详情显示患者名和规则标题替代原始 ID
Some checks failed
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
- 患者字段显示 patient_name,ID 缩短为 tooltip
- 规则字段显示告警标题 title,rule_id 缩短为 tooltip
- 告警详情 JSON 解析为中文标签结构化表格
2026-05-07 07:41:26 +08:00
iven
a9821ab832 fix(web): 告警详情面板用户体验改进
Some checks failed
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
- 用 Alert 横幅醒目展示严重程度、标题和行动指引
- 患者信息卡片显示姓名而非原始 UUID
- 将 JSON 详情解析为中文标签(告警描述/监测值/阈值等)
- 技术信息(原始 ID)移入折叠面板
2026-05-07 07:38:04 +08:00
iven
1613e3cfe9 fix(health): 修复 5 角色测试发现的 4 个共性问题
Some checks failed
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
- 权限路由守卫:静默重定向改为显示 403 页面,使用 useLocation 替代
  window.location.hash,补全缺失路由权限条目
- 随访状态筛选:usePaginatedData hook 添加 filters 变化监听自动刷新
- 告警操作:后端 acknowledge/dismiss/resolve 改返回 AlertResponse
  (含 patient_name),前端增加 active 状态兼容和错误反馈
- 咨询患者名:后端 create/get/close_session 增加 patient_name 和
  doctor_name enrichment,前端 EntityName 空字符串处理
2026-05-07 07:23:41 +08:00
iven
43f0ba7057 fix(web): 修复角色测试发现的权限守卫、API 500、权限配置问题
Some checks failed
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
1. CRITICAL: 前端路由权限守卫 — routePermissions 从 3 条扩展到 31 条,
   覆盖全部 /health/* 路由;匹配逻辑从宽松模块级前缀改为精确权限码匹配
2. HIGH: health-data API 500 — jsonb_array_elements() 添加 CASE WHEN 类型守卫,
   防止 items 字段为非数组 JSON 时崩溃
3. MEDIUM: Doctor 补充 ai.prompt.list、ai.usage.list、follow-up-templates 权限
4. Operator 清理 AI 分析、统计报表菜单关联
5. 更新 5 角色测试计划文档
2026-05-06 22:29:54 +08:00
iven
36275eb307 fix(web): 冻结推迟模块路由守卫
Some checks failed
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
2026-05-06 10:34:55 +08:00
iven
1f91dcc5cc fix(ai): 修复分析结果 JSON 嵌套 bug
Some checks failed
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
93f6e87220 fix(web+config): E2E 测试发现的问题修复
Some checks failed
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
- 排班状态过滤 'active' → 'enabled'(与后端 validation.rs 一致)
- 全局 403 拦截器不再弹出"权限不足" toast(AuthButton 已隐藏入口)
- 角色未关联菜单时回退显示全部(避免种子数据阶段菜单空白)
2026-05-05 13:01:14 +08:00
iven
062b4493e4 fix(web): DoctorSelect 预加载医生列表 + 搜索错误处理
Some checks failed
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
- 组件挂载时预加载最多 50 条医生数据,下拉框打开即有选项
- 搜索清空时保留已有列表(不再置空)
- 搜索失败时 catch 错误,保留初始列表不静默丢失
- 更新质量验证报告:全部 MEDIUM 问题已关闭
2026-05-05 11:15:12 +08:00
iven
15b5781dbb fix(health): 危急值告警全链路修复 — 消费者生命周期 + payload 映射 + 阈值优先级
Some checks failed
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. CRITICAL: 修复 SubscriptionHandle 提前 drop 导致所有事件消费者失效
   - register_handlers_with_state 中所有 handle 在函数返回时被 drop
   - cancel channel 关闭导致 subscribe_filtered 的过滤任务退出
   - 方案: 收集所有 handle 并 std::mem::forget,生命周期与进程一致

2. HIGH: 修复 critical_alert 消费者 payload 字段映射不匹配
   - 消费者读取 alert_type/metric_name 等顶层字段,但实际在 alert 嵌套对象中
   - 更新消费者从 alert 对象提取 indicator/value/threshold/level
   - handle_critical_alert_event 增加 severity 参数

3. MEDIUM: 修复 check_indicator 优先匹配最高严重级别
   - 原实现返回第一个匹配的阈值(可能匹配 warning 而非 critical)
   - 改为遍历所有匹配阈值,选择 severity 最高的(critical > warning)

4. MEDIUM: 修复危急值阈值页面不自动加载数据
   - CriticalValueThresholdList 添加 useEffect 初始化加载
2026-05-05 10:11:06 +08:00
iven
888fa108ef feat(web): 家庭健康代理 + 知情同意 Web UI — Phase 2c
Some checks failed
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
家庭代理:关联患者列表 + 健康摘要查看 + 授权/撤销访问
知情同意:患者范围 CRUD 列表页(类型/范围/签署/撤销)
2026-05-05 00:02:39 +08:00
iven
0774dd75ad feat(web): 危急值阈值 + 诊断记录 Web UI — Phase 2b-2/2b-3
Some checks failed
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
危急值阈值:CRUD 列表页(指标/方向/阈值/级别/科室/年龄范围)
诊断记录:患者范围 CRUD 列表页(ICD编码/类型/状态/确诊日期)
2026-05-04 23:59:22 +08:00
iven
b6838c1bc1 feat(web): BLE 网关管理 UI — Phase 2b-1
Some checks failed
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
网关 CRUD 列表页(状态筛选/密钥刷新/API Key 创建展示)
+ 网关详情页(信息面板/设备绑定管理 Tab)
2026-05-04 23:47:21 +08:00
iven
438f9ca3f4 feat(web): 药物记录 Web UI — Phase 2a-3
Some checks failed
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
新增药物记录管理前端页面,接入后端 4 条孤立路由:
- API 模块: medicationRecords.ts(CRUD + 频次/途径常量)
- 列表页: MedicationRecordList.tsx(患者 ID 查询 + 药物列表 CRUD)
  支持药品名/通用名/剂量/频次/途径/日期/在用状态
- 路由注册: /health/medications

权限: health.medication-records.list / health.medication-records.manage
2026-05-04 23:41:04 +08:00
iven
68ced2bae9 feat(web): 班次管理 Web UI — Phase 2a-2
Some checks failed
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
新增班次管理前端页面,接入后端 12 条孤立路由:
- API 模块: shifts.ts(班次 CRUD + 患者分配 + 批量分配 + 交接日志)
- 列表页: ShiftList.tsx(日期/班次/状态筛选 + 统计概览)
- 详情页: ShiftDetail.tsx(班次信息 + 患者分配 Tab + 交接记录 Tab)
- 路由注册: /health/shifts + /health/shifts/:id

权限: health.shifts.list / health.shifts.manage
2026-05-04 23:36:15 +08:00