feat(web): 行动收件箱前端 — API + Drawer + 列表页 + 路由
- actionInbox.ts: API 调用层,list + getThread - ActionThreadDrawer: 上下文线程抽屉,时间线 + 操作按钮 - ActionInbox: 列表页,Tabs 筛选 + 分页 + 点击打开 Drawer - App.tsx: 注册 /health/action-inbox 路由
This commit is contained in:
66
apps/web/src/api/health/actionInbox.ts
Normal file
66
apps/web/src/api/health/actionInbox.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import client from '../client';
|
||||
import type { PaginatedResponse } from '../types';
|
||||
|
||||
export type ActionType = 'ai_suggestion' | 'alert' | 'followup' | 'data_anomaly';
|
||||
export type ActionPriority = 'urgent' | 'high' | 'medium' | 'low';
|
||||
export type ActionStatus = 'pending' | 'in_progress' | 'completed' | 'dismissed';
|
||||
|
||||
export interface ActionItem {
|
||||
id: string;
|
||||
action_type: ActionType;
|
||||
priority: ActionPriority;
|
||||
status: ActionStatus;
|
||||
title: string;
|
||||
summary: string;
|
||||
patient_id: string;
|
||||
patient_name: string;
|
||||
source_ref: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface ThreadEvent {
|
||||
step: string;
|
||||
label: string;
|
||||
status: ActionStatus;
|
||||
detail?: string;
|
||||
timestamp?: string;
|
||||
operator?: string;
|
||||
link_to?: string;
|
||||
}
|
||||
|
||||
export interface ActionDefinition {
|
||||
key: string;
|
||||
label: string;
|
||||
variant: 'primary' | 'danger' | 'default';
|
||||
api_endpoint?: string;
|
||||
}
|
||||
|
||||
export interface ThreadResponse {
|
||||
action_item: ActionItem;
|
||||
thread: ThreadEvent[];
|
||||
available_actions: ActionDefinition[];
|
||||
}
|
||||
|
||||
export const actionInboxApi = {
|
||||
list: async (params?: {
|
||||
status?: string;
|
||||
type?: string;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}) => {
|
||||
const { data } = await client.get<{
|
||||
success: boolean;
|
||||
data: PaginatedResponse<ActionItem>;
|
||||
}>('/health/action-inbox', { params });
|
||||
return data.data;
|
||||
},
|
||||
|
||||
getThread: async (sourceRef: string) => {
|
||||
const { data } = await client.get<{
|
||||
success: boolean;
|
||||
data: ThreadResponse;
|
||||
}>(`/health/action-inbox/${encodeURIComponent(sourceRef)}/thread`);
|
||||
return data.data;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user