Files
Mdeical_Sur_Report/工程分析/测试方案-2026-04-17-09-57-08.md
admin 9e75e86454 feat: add 4 post-op fields to default template with auto-merge for existing configs
- Add postOpCondition, specimenDescription, pathologySent, frozenPathology
  to Report type and DEFAULT_FORM_FIELDS
- Replace static placeholders in defaultContent.ts with smartField() calls
- Auto-merge missing fields from DEFAULT_FORM_FIELDS into existing
  formFieldsConfig in ReportEditor and TemplateManage
2026-04-17 10:11:48 +08:00

49 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 测试方案 — 模板新增术后字段2026-04-17-09-57-08
## 一、编译检查
- 执行 `npm run lint``tsc --noEmit`),确保全量 TypeScript 无编译错误。
## 二、功能验证步骤
### 测试 1新用户首次使用默认模板加载
1. 浏览器 DevTools → Application → Local Storage → 清空本站所有 key。
2. 刷新页面,用 `admin / 123456` 登录。
3. 进入【模板管理】→ 确认默认模板底部 4 处文本已变为可编辑的智能方框:
- 手术后情况
- 切除标本描述
- 是否送检病理
- 冰冻病理结果
4. 点击【新建报告】→ 确认右侧【基本信息】表单出现:
- 手术后情况(下拉单选,默认选项 1 条)
- 切除标本描述(下拉单选,暂无选项,显示"暂无选项"
- 是否送检病理(下拉单选,选项:是 / 否)
- 冰冻病理结果(文本输入框)
5. 在表单中修改"是否送检病理"为"否",观察编辑器中对应方框实时变为"否"。
6. 在编辑器中直接点击"冰冻病理结果"方框并输入"良性",观察右侧表单实时变为"良性"。
### 测试 2老用户字段升级自动补全
1. DevTools Console 执行:
```js
localStorage.setItem('formFieldsConfig', JSON.stringify([
{ key: 'patientName', label: '患者姓名', category: '填空', type: 'text', visibleInForm: true, isSystemLocked: true },
{ key: 'hospitalId', label: '住院号', category: '填空', type: 'text', visibleInForm: true, isSystemLocked: true }
]));
```
2. 刷新页面,进入【新建报告】。
3. 确认右侧表单中除了"患者姓名"、"住院号"外,还自动出现了本次新增的 4 个字段以及其他默认字段(共 18 条)。
4. DevTools 中查看 `formFieldsConfig`,确认 key 列表包含 `postOpCondition`、`specimenDescription`、`pathologySent`、`frozenPathology`。
### 测试 3持久化验证
1. 在【新建报告】中填写 4 个新字段的值。
2. 切换到【报告管理】再返回【新建报告】。
3. 确认 4 个新字段的值在表单和编辑器中均被正确恢复。
## 三、预期结果
- `npm run lint` 0 错误。
- 新建报告时模板底部 4 处为智能方框,右侧表单出现对应控件。
- 表单 ↔ 编辑器双向同步正常。
- 老用户自动补全字段成功,无数据丢失。
- 路由切换后4 个新字段的值能被自动保存/恢复。