feat(miniprogram): 实现知情同意页面 — 查看/撤回/签署
审计后续 H2: 对接后端 3 个知情同意 API 路由。 新增内容: - services/consent.ts: 类型定义 + listConsents/grantConsent/revokeConsent - 患者端知情同意列表页: 查看已签署同意书 + 撤回操作 - 路由注册 + "我的"菜单入口
This commit is contained in:
48
apps/miniprogram/src/services/consent.ts
Normal file
48
apps/miniprogram/src/services/consent.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
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 });
|
||||
}
|
||||
Reference in New Issue
Block a user