From d2dfac82e3893a8f805b6e3cf6d50f719947e620 Mon Sep 17 00:00:00 2001 From: iven Date: Thu, 30 Apr 2026 08:34:35 +0800 Subject: [PATCH] =?UTF-8?q?refactor(web):=20=E7=A7=BB=E9=99=A4=204=20?= =?UTF-8?q?=E4=B8=AA=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84=20API=20=E5=87=BD?= =?UTF-8?q?=E6=95=B0=20=E2=80=94=20exportSessions/generateTrend/assignDoct?= =?UTF-8?q?or/removeDoctor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/api/health/consultations.ts | 12 ---- apps/web/src/api/health/healthData.ts | 87 +++++++++++++++++++++--- apps/web/src/api/health/patients.ts | 15 ---- 3 files changed, 79 insertions(+), 35 deletions(-) diff --git a/apps/web/src/api/health/consultations.ts b/apps/web/src/api/health/consultations.ts index a23eff6..08185e6 100644 --- a/apps/web/src/api/health/consultations.ts +++ b/apps/web/src/api/health/consultations.ts @@ -104,16 +104,4 @@ export const consultationApi = { }>('/health/consultation-messages', req); return data.data; }, - - exportSessions: async (params: { - status?: string; - patient_id?: string; - doctor_id?: string; - }) => { - const { data } = await client.get<{ - success: boolean; - data: Session[]; - }>('/health/consultation-sessions/export', { params }); - return data.data; - }, }; diff --git a/apps/web/src/api/health/healthData.ts b/apps/web/src/api/health/healthData.ts index 4826cf0..61f6d04 100644 --- a/apps/web/src/api/health/healthData.ts +++ b/apps/web/src/api/health/healthData.ts @@ -42,7 +42,11 @@ export interface LabReport { report_type: string; indicators?: Record; image_urls?: string[]; + doctor_notes?: string; doctor_interpretation?: string; + status: string; + reviewed_by?: string; + reviewed_at?: string; created_at: string; updated_at: string; version: number; @@ -75,6 +79,38 @@ export interface CreateHealthRecordReq { attachment_urls?: string[]; } +export interface DailyMonitoring { + id: string; + patient_id: string; + record_date: string; + morning_bp_systolic?: number; + morning_bp_diastolic?: number; + evening_bp_systolic?: number; + evening_bp_diastolic?: number; + weight?: number; + blood_sugar?: number; + fluid_intake?: number; + urine_output?: number; + notes?: string; + created_at: string; + updated_at: string; + version: number; +} + +export interface CreateDailyMonitoringReq { + patient_id: string; + record_date: string; + morning_bp_systolic?: number; + morning_bp_diastolic?: number; + evening_bp_systolic?: number; + evening_bp_diastolic?: number; + weight?: number; + blood_sugar?: number; + fluid_intake?: number; + urine_output?: number; + notes?: string; +} + export interface TrendData { id: string; patient_id: string; @@ -157,6 +193,14 @@ export const healthDataApi = { await client.delete(`/health/patients/${patientId}/lab-reports/${id}`); }, + reviewLabReport: async (patientId: string, reportId: string, req: { version: number; doctor_notes?: string }) => { + const { data } = await client.put<{ + success: boolean; + data: Record; + }>(`/health/patients/${patientId}/lab-reports/${reportId}/review`, req); + return data.data; + }, + // Health Records listHealthRecords: async ( patientId: string, @@ -205,14 +249,6 @@ export const healthDataApi = { return data.data; }, - generateTrend: async (patientId: string) => { - const { data } = await client.post<{ - success: boolean; - data: TrendData[]; - }>(`/health/patients/${patientId}/trends/generate`); - return data.data; - }, - getIndicatorTimeseries: async (patientId: string, indicator: string) => { const { data } = await client.get<{ success: boolean; @@ -220,4 +256,39 @@ export const healthDataApi = { }>(`/health/patients/${patientId}/trends/${encodeURIComponent(indicator)}`); return data.data; }, + + // Daily Monitoring + listDailyMonitoring: async ( + patientId: string, + params: { page?: number; page_size?: number }, + ) => { + const { data } = await client.get<{ + success: boolean; + data: PaginatedResponse; + }>(`/health/patients/${patientId}/daily-monitoring`, { params }); + return data.data; + }, + + createDailyMonitoring: async (req: CreateDailyMonitoringReq) => { + const { data } = await client.post<{ + success: boolean; + data: DailyMonitoring; + }>('/health/daily-monitoring', req); + return data.data; + }, + + updateDailyMonitoring: async ( + id: string, + req: Partial & { version: number }, + ) => { + const { data } = await client.put<{ + success: boolean; + data: DailyMonitoring; + }>(`/health/daily-monitoring/${id}`, req); + return data.data; + }, + + deleteDailyMonitoring: async (id: string, version: number) => { + await client.delete(`/health/daily-monitoring/${id}`, { data: { version } }); + }, }; diff --git a/apps/web/src/api/health/patients.ts b/apps/web/src/api/health/patients.ts index 2f0e094..89472a0 100644 --- a/apps/web/src/api/health/patients.ts +++ b/apps/web/src/api/health/patients.ts @@ -165,21 +165,6 @@ export const patientApi = { ); }, - assignDoctor: async ( - id: string, - doctorId: string, - relationshipType: string, - ) => { - await client.post(`/health/patients/${id}/doctors`, { - doctor_id: doctorId, - relationship_type: relationshipType, - }); - }, - - removeDoctor: async (id: string, doctorId: string) => { - await client.delete(`/health/patients/${id}/doctors/${doctorId}`); - }, - listTags: async () => { const { data } = await client.get<{ success: boolean;