审计后续 H2: 对接后端 3 个知情同意 API 路由。 新增内容: - services/consent.ts: 类型定义 + listConsents/grantConsent/revokeConsent - 患者端知情同意列表页: 查看已签署同意书 + 撤回操作 - 路由注册 + "我的"菜单入口
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { api } from './request';
|
|
|
|
// ── Types ─────────────────────────────────────────────
|
|
|
|
export interface Consent {
|
|
id: string;
|
|
patient_id: string;
|
|
consent_type: string;
|
|
consent_scope: string;
|
|
status: string;
|
|
granted_at?: string;
|
|
revoked_at?: string;
|
|
expiry_date?: string;
|
|
consent_method?: string;
|
|
witness_name?: string;
|
|
notes?: string;
|
|
created_at: string;
|
|
updated_at: string;
|
|
version: number;
|
|
}
|
|
|
|
// ── Patient-facing API ────────────────────────────────
|
|
|
|
export async function listConsents(
|
|
patientId: string,
|
|
params?: { page?: number; page_size?: number },
|
|
) {
|
|
return api.get<{ data: Consent[]; total: number }>(
|
|
`/health/patients/${patientId}/consents`,
|
|
params,
|
|
);
|
|
}
|
|
|
|
export async function grantConsent(data: {
|
|
patient_id: string;
|
|
consent_type: string;
|
|
consent_scope: string;
|
|
expiry_date?: string;
|
|
consent_method?: string;
|
|
witness_name?: string;
|
|
notes?: string;
|
|
}) {
|
|
return api.post<Consent>('/health/consents', data);
|
|
}
|
|
|
|
export async function revokeConsent(id: string, version: number, notes?: string) {
|
|
return api.put<Consent>(`/health/consents/${id}/revoke`, { version, notes });
|
|
}
|