From 73119fe0267cd73ebbbc27ef3346b82b5b666e85 Mon Sep 17 00:00:00 2001 From: iven Date: Fri, 1 May 2026 17:20:45 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E4=B8=89=E7=AB=AF=E5=AE=A1=E8=AE=A1?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9E=E6=96=BD=E8=AE=A1=E5=88=92=20Phase?= =?UTF-8?q?=202=20=E2=80=94=206=20=E4=B8=AA=20Task=20(#7-#11)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Chunk 2: 体验补全阶段 - Task 9: 患者详情快捷导航卡片 - Task 10: 5 个列表页支持 URL patient_id 过滤 - Task 11: AI 分析列表患者 Link - Task 12: 小程序 AI 建议跳转修复 - Task 13: 小程序通知 Tab 对接 erp-message API - Task 14: 小程序咨询功能入口 --- .../2026-05-01-tri-platform-audit-fix-plan.md | 321 ++++++++++++++++++ 1 file changed, 321 insertions(+) diff --git a/docs/superpowers/plans/2026-05-01-tri-platform-audit-fix-plan.md b/docs/superpowers/plans/2026-05-01-tri-platform-audit-fix-plan.md index 12b7f59..ccb923c 100644 --- a/docs/superpowers/plans/2026-05-01-tri-platform-audit-fix-plan.md +++ b/docs/superpowers/plans/2026-05-01-tri-platform-audit-fix-plan.md @@ -787,3 +787,324 @@ git commit -m "fix(server): 事件清理保留期从 90 天调整为 7 天" - [ ] `cd apps/web && pnpm build` — 前端构建通过 - [ ] 浏览器验证:登录页品牌信息、侧边栏菜单图标、主题设置品牌编辑 - [ ] `git push` — 推送到远程 + +--- + +## Chunk 2: Phase 2 — 体验补全 (#7-#11) + +### Task 9: 患者详情快捷导航卡片 + +**Files:** +- Modify: `apps/web/src/pages/health/PatientDetail.tsx:222-224` + +- [ ] **Step 1: 在 PatientDetail.tsx 插入快捷导航卡片** + +在第 222 行(患者信息卡片 `` 闭合标签)和第 224 行(Tabs `` 开始标签)之间插入: + +```tsx + {/* 快捷导航 */} + + + 快捷跳转: + + + + + + + +``` + +确认 `Button`、`Space`、`Text` 已在文件顶部 import(通常已导入)。确认 `navigate` 来自 `useNavigate()`。 + +- [ ] **Step 2: 验证编译** + +Run: `cd apps/web && pnpm build` +Expected: 构建成功 + +- [ ] **Step 3: 提交** + +```bash +git add apps/web/src/pages/health/PatientDetail.tsx +git commit -m "feat(web): 患者详情页增加快捷导航卡片 — 预约/咨询/透析/随访/AI" +``` + +--- + +### Task 10: 列表页面支持 URL 参数 patient_id 过滤 + +**Files:** +- Modify: `apps/web/src/pages/health/AppointmentList.tsx` +- Modify: `apps/web/src/pages/health/ConsultationList.tsx` +- Modify: `apps/web/src/pages/health/DialysisManageList.tsx` +- Modify: `apps/web/src/pages/health/FollowUpTaskList.tsx` +- Modify: `apps/web/src/pages/health/AiAnalysisList.tsx` + +这 5 个页面需要支持从 URL 读取 `patient_id` 参数作为默认筛选条件。统一模式如下: + +- [ ] **Step 1: 逐一检查各页面当前的筛选逻辑** + +对每个页面,确认: +- 是否已使用 `useSearchParams()` 或 `useLocation()` 读取 URL 参数 +- 筛选器状态如何初始化(useState 初始值) +- API 调用的参数传递方式 + +> 此步骤为调研,不修改代码。根据调研结果决定每个页面的具体修改方案。 + +- [ ] **Step 2: 为每个页面添加 URL patient_id 读取** + +统一模式:在组件初始化时从 URL 读取 `patient_id`,设为筛选器默认值。 + +```typescript +import { useSearchParams } from 'react-router-dom'; + +// 在组件函数体内 +const [searchParams] = useSearchParams(); +const urlPatientId = searchParams.get('patient_id'); + +// 在筛选器状态中设置默认值 +const [filters, setFilters] = useState({ + // ... 已有筛选器 + patient_id: urlPatientId || undefined, +}); +``` + +如果页面使用 `PatientSelect` 组件,将 `urlPatientId` 作为初始值传入。 + +- [ ] **Step 3: 验证编译** + +Run: `cd apps/web && pnpm build` +Expected: 构建成功 + +- [ ] **Step 4: 提交** + +```bash +git add apps/web/src/pages/health/AppointmentList.tsx \ + apps/web/src/pages/health/ConsultationList.tsx \ + apps/web/src/pages/health/DialysisManageList.tsx \ + apps/web/src/pages/health/FollowUpTaskList.tsx \ + apps/web/src/pages/health/AiAnalysisList.tsx +git commit -m "feat(web): 5 个列表页支持 URL 参数 patient_id 自动筛选" +``` + +--- + +### Task 11: AI 分析列表添加患者 Link + +**Files:** +- Modify: `apps/web/src/pages/health/AiAnalysisList.tsx:1-2,316-323` + +- [ ] **Step 1: 添加 Link 导入** + +在 `apps/web/src/pages/health/AiAnalysisList.tsx` 顶部 import 区域添加: + +```typescript +import { Link } from 'react-router-dom'; +``` + +- [ ] **Step 2: 修改 patient_id 列渲染** + +将第 316-323 行的列定义从: + +```tsx +{ + title: '患者 ID', + dataIndex: 'patient_id', + key: 'patient_id', + width: 120, + render: (v: string) => ( + {v.slice(0, 8)} + ), +}, +``` + +改为: + +```tsx +{ + title: '患者', + dataIndex: 'patient_id', + key: 'patient_id', + width: 140, + render: (v: string) => ( + + {v.slice(0, 8)} + + ), +}, +``` + +- [ ] **Step 3: 验证编译** + +Run: `cd apps/web && pnpm build` +Expected: 构建成功 + +- [ ] **Step 4: 提交** + +```bash +git add apps/web/src/pages/health/AiAnalysisList.tsx +git commit -m "feat(web): AI 分析列表患者 ID 改为可点击 Link 跳转详情" +``` + +--- + +### Task 12: 小程序 AI 建议跳转修复 + +**Files:** +- Modify: `apps/miniprogram/src/pages/health/index.tsx:178` + +- [ ] **Step 1: 修改 AI 建议卡片 onClick** + +在 `apps/miniprogram/src/pages/health/index.tsx` 第 178 行,将: + +```tsx + Taro.navigateTo({ url: '/pages/pkg-profile/settings/index' })}> +``` + +改为: + +```tsx + { + const firstSuggestion = aiSuggestions[0]; + if (firstSuggestion?.suggestion_type === 'appointment') { + Taro.navigateTo({ url: `/pages/pkg-appointment/create/index?patientId=${firstSuggestion.patient_id}` }); + } else if (firstSuggestion?.suggestion_type === 'followup') { + Taro.navigateTo({ url: `/pages/pkg-profile/followups/index` }); + } else { + Taro.navigateTo({ url: '/pages/health/index' }); + } +}}> +``` + +> **注意**: 卡片整体只有一个 onClick,跳转基于第一条建议的类型。如果需要每条建议单独点击,需要将 onClick 移到 `ai-suggestion-item` 上并传入具体 item。 + +- [ ] **Step 2: 验证小程序编译** + +Run: `cd apps/miniprogram && pnpm build:weapp` +Expected: 构建成功 + +- [ ] **Step 3: 提交** + +```bash +git add apps/miniprogram/src/pages/health/index.tsx +git commit -m "fix(miniprogram): AI 建议卡片按 suggestion_type 跳转 — 而非统一跳设置页" +``` + +--- + +### Task 13: 小程序通知 Tab 对接消息 API + +**Files:** +- Create: `apps/miniprogram/src/services/notification.ts` +- Modify: `apps/miniprogram/src/pages/messages/index.tsx:34-38` + +- [ ] **Step 1: 创建通知服务** + +创建 `apps/miniprogram/src/services/notification.ts`: + +```typescript +import { api } from './request'; + +export const notificationService = { + list: (params?: { page?: number; page_size?: number }) => + api.get('/messages', params as Record), + markRead: (id: string) => + api.put(`/messages/${id}/read`), + markAllRead: () => + api.put('/messages/read-all'), + getUnreadCount: () => + api.get('/messages/unread-count'), +}; +``` + +- [ ] **Step 2: 替换硬编码空数组** + +在 `apps/miniprogram/src/pages/messages/index.tsx` 中: + +1. 在顶部添加导入: +```typescript +import { notificationService } from '../../services/notification'; +``` + +2. 将第 35-38 行的 `else` 分支从: +```typescript +} else { + // 通知目前从咨询中提取状态变化作为示例 + // 后续可对接独立通知 API + setNotifications([]); +} +``` + +改为: +```typescript +} else { + const res = await notificationService.list({ page: 1, page_size: 20 }); + setNotifications(res?.data || []); +} +``` + +- [ ] **Step 3: 验证小程序编译** + +Run: `cd apps/miniprogram && pnpm build:weapp` +Expected: 构建成功 + +- [ ] **Step 4: 提交** + +```bash +git add apps/miniprogram/src/services/notification.ts apps/miniprogram/src/pages/messages/index.tsx +git commit -m "feat(miniprogram): 通知 Tab 对接 erp-message 消息 API — 替换空壳" +``` + +--- + +### Task 14: 小程序咨询功能入口 + +**Files:** +- Modify: `apps/miniprogram/src/pages/profile/index.tsx:8-22,24-38` + +- [ ] **Step 1: 在 MENU_ITEMS 添加在线咨询** + +在 `apps/miniprogram/src/pages/profile/index.tsx` 的 `MENU_ITEMS` 数组(第 21 行 "设置" 之前)添加: + +```typescript + { label: '我的预约', icon: '📅', bg: '#E8F0F8' }, + { label: '在线咨询', icon: '💬', bg: '#E8F0E8' }, +``` + +- [ ] **Step 2: 在 MENU_PATHS 添加路径映射** + +在 `MENU_PATHS`(第 24-38 行)添加对应路径: + +```typescript +'我的预约': '/pages/pkg-appointment/index', +'在线咨询': '/pages/consultation/index', +``` + +> **注意**: 需确认 `/pages/pkg-appointment/index` 路径存在。如果预约页面路径不同,按实际路径填写。 + +- [ ] **Step 3: 验证小程序编译** + +Run: `cd apps/miniprogram && pnpm build:weapp` +Expected: 构建成功 + +- [ ] **Step 4: 提交** + +```bash +git add apps/miniprogram/src/pages/profile/index.tsx +git commit -m "feat(miniprogram): 个人中心添加我的预约+在线咨询入口" +``` + +--- + +## Phase 2 验证清单 + +完成所有 Task 后执行: + +- [ ] `cd apps/web && pnpm build` — Web 前端构建通过 +- [ ] `cd apps/miniprogram && pnpm build:weapp` — 小程序构建通过 +- [ ] 浏览器验证:患者详情快捷导航 → 目标页面自动过滤 +- [ ] 浏览器验证:AI 分析列表患者 Link 跳转正常 +- [ ] 小程序验证:AI 建议卡片跳转到正确页面(非设置页) +- [ ] 小程序验证:消息页通知 Tab 展示后端消息数据 +- [ ] 小程序验证:个人中心出现"在线咨询"入口 +- [ ] `git push` — 推送到远程