RIS(Radiology Information System,放射信息系统)保存本地功能允许医务人员将从RIS系统同步过来的检查请求数据批量保存到本地工作列表中,该功能提升了RIS数据的管理效率,实现本地检查流程的无缝衔接。本文档详细描述了该功能的需求规格、实现设计、数据流和测试方案。
实现【RIS保存本地】功能,用于将RIS数据批量保存到本地系统,支持医务人员在worklist视图中批量处理RIS检查请求。
src/API/patient/risActions.ts 中的 saveRisBatch (批量保存本地接口)RisSaveBatchRequest 类型(entry_id 字符串数组)StandardApiResponsesrc/pages/patient/components/ActionPanel.tsx 中新增"保存本地"按钮currentKey 为 'worklist' 时显示该按钮entry_id 不为空)entry_id 形成的数组给后端saveRisBatch(entryIds) 接口组件层:
src/pages/patient/components/ActionPanel.tsx - 主动作面板组件ActionPanel 组件:包含所有按钮和逻辑ActionButton 组件:按钮包装组件API层:
src/API/patient/risActions.ts:RIS相关APIsaveRisBatch(entryIds: RisSaveBatchRequest) - 批量保存接口函数状态管理层:
workSelection slice: selectedIds - worklist选中IDhistorySelection slice: selectedIds - history选中IDBusinessFlow slice: currentKey - 当前面板标识workEntities slice: data - worklist条目数据historyEntities slice: data - history条目数据search slice: 查询条件状态工具函数:
ActionPanel.tsx 中实现)UI元素:
数据模型:
entry_id、StudyID 等字段src/pages/patient/components/ActionPanel.tsx
currentKey === 'worklist' 时显示该按钮handleRisSave 方法:
entry_id 不为空的条目entry_idsaveRisBatch(entryIds)entry_id 检查src/API/patient/risActions.ts
saveRisBatch 函数src/states/patient/worklist/slices/workSlice.ts
fetchWorkThunk 用于自动拉取在 ActionPanel.tsx 中新增:
handleRisSave - 处理RIS保存逻辑的方法showSaveSuccessModal - 显示成功提示弹框的方法(类似现有 showSyncSuccessModal)getRisEnabledSelectedIds - 获取RIS可用选中ID的方法无需新增类型:使用现有 RisSaveBatchRequest 和其他已定义类型
sequenceDiagram
participant 用户
participant ActionPanel组件
participant 状态管理
participant API调用层
participant 后端服务
participant 查询系统
用户->>ActionPanel组件: 点击"保存本地"按钮
ActionPanel组件->>ActionPanel组件: 检查可用性(entry_id不为空的选中项)
ActionPanel组件->>ActionPanel组件: 收集entry_ids数组
ActionPanel组件->>API调用层: 调用saveRisBatch(entryIds)
API调用层->>后端服务: POST /auth/study/ris/batch
后端服务->>API调用层: 返回StandardApiResponse
API调用层->>ActionPanel组件: 成功/失败响应
ActionPanel组件->>状态管理: 更新loading状态
ActionPanel组件->>ActionPanel组件: 显示成功弹框(暂逝)
ActionPanel组件->>ActionPanel组件: 触发triggerSearch函数
triggerSearch->>状态管理: 重置分页(1,10)
triggerSearch->>状态管理: 获取search条件
triggerSearch->>查询系统: 调用fetchWorkThunk
查询系统->>状态管理: 更新workEntities数据
状态管理->>ActionPanel组件: 通知UI更新
数据流:
======================= 输入数据 =======================
├── 用户选中项ID数组 ← workSelection.selectedIds
├── 当前面板标识 ← BusinessFlow.currentKey
├── 工作列表实体数据 ← workEntities.data
└── 查询条件 ← search slice (id, name, acc_no, start_time, end_time)
======================= 中间处理 =======================
├── 过滤逻辑:选中ID + workEntities → 筛选entry_id≠null的条目 → entryIds数组
├── API调用:entryIds → saveRisBatch API → StandardApiResponse
======================= 输出结果 =======================
├── 成功时:暂逝提示弹框 + 触发 fetchWorkThunk 更新列表
└── 失败时:错误提示弹框
type RisSaveBatchRequest = string[]; // entry_id 字符串数组
interface StandardApiResponse {
code: string;
description: string;
solution: string;
data: EmptyResponseData;
}
// Worklist条目
interface WorkItem {
StudyID: string;
entry_id?: string; // RIS条目ID,不为空表示RIS数据
PatientName?: string;
// ... 其他字段
}
// 查询条件
interface SearchState {
id?: string;
name?: string;
acc_no?: string;
start_time?: string;
end_time?: string;
}
起点:用户操作 - 在worklist视图下,选中一条或多条RIS数据后,点击"保存本地"按钮。
currentKey === 'worklist'),选中至少一条含有entry_id的条目saveRisBatch(entryIds),传入entry_id数组StandardApiResponsefetchWorkThunkclassDiagram
class ActionPanel {
+currentKey: string
+workSelectedIds: string[]
+workEntities: WorkItem[]
+searchState: SearchState
+risSaving: boolean
+handleRisSave()
+getRisSelectedIds()
+showSaveSuccessModal(count)
+triggerSearch()
}
class RisManager {
+<<static>> isRisEnabled(): Promise~boolean~
+<<static>> saveAllRisEntries(): Promise~number~
+<<static>> syncTodayRis(): Promise~number~
}
class RisActions {
+saveRisBatch(entryIds): Promise~StandardApiResponse~
+saveRisSingle(params): Promise~RegisterWorkResponse~
+syncRis(params): Promise~RisSyncResponse~
}
class ReduxStore {
+workSelection: WorkSelectionSlice
+workEntities: WorkEntitiesSlice
+search: SearchSlice
+BusinessFlow: BusinessFlowSlice
}
ActionPanel --> RisActions : 调用API
ActionPanel --> ReduxStore : 读取/更新状态
RisActions --> RisManager : 扩展功能
RisManager --> RisActions : 底层调用
正常保存场景
边界条件测试
可用性控制测试
错误处理测试
自动刷新测试
大批量保存测试
并发操作测试