- Stripped 11 business crates (health, ai, dialysis, plugins) - Cleaned AppState, AppConfig, main.rs from business coupling - Reduced migrations from 169 to 53 (base-only) - Removed health_provider trait from erp-core - Removed business integration tests - Removed gateway rate limiting middleware - Base capabilities: auth, RBAC, JWT, config, workflow, message, plugin, audit, crypto, RLS, multi-tenant Cargo check: OK Cargo test: OK
76 lines
1.9 KiB
TypeScript
76 lines
1.9 KiB
TypeScript
import client from '../client';
|
|
import type { PaginatedResponse } from '../types';
|
|
|
|
// --- Types ---
|
|
|
|
export interface MedicationReminder {
|
|
id: string;
|
|
patient_id: string;
|
|
medication_name: string;
|
|
dosage?: string;
|
|
frequency: string;
|
|
reminder_times: unknown;
|
|
start_date?: string;
|
|
end_date?: string;
|
|
is_active: boolean;
|
|
notes?: string;
|
|
created_at: string;
|
|
updated_at: string;
|
|
version: number;
|
|
}
|
|
|
|
export interface CreateMedicationReminderReq {
|
|
patient_id: string;
|
|
medication_name: string;
|
|
dosage?: string;
|
|
frequency?: string;
|
|
reminder_times?: unknown;
|
|
start_date?: string;
|
|
end_date?: string;
|
|
is_active?: boolean;
|
|
notes?: string;
|
|
}
|
|
|
|
export interface UpdateMedicationReminderReq {
|
|
medication_name?: string;
|
|
dosage?: string;
|
|
frequency?: string;
|
|
reminder_times?: unknown;
|
|
start_date?: string;
|
|
end_date?: string;
|
|
is_active?: boolean;
|
|
notes?: string;
|
|
}
|
|
|
|
// --- API ---
|
|
|
|
export const medicationReminderApi = {
|
|
list: async (patientId: string, params?: { page?: number; page_size?: number }) => {
|
|
const { data } = await client.get<{
|
|
success: boolean;
|
|
data: PaginatedResponse<MedicationReminder>;
|
|
}>(`/health/patients/${patientId}/medication-reminders`, { params });
|
|
return data.data;
|
|
},
|
|
|
|
create: async (req: CreateMedicationReminderReq) => {
|
|
const { data } = await client.post<{
|
|
success: boolean;
|
|
data: MedicationReminder;
|
|
}>('/health/medication-reminders', req);
|
|
return data.data;
|
|
},
|
|
|
|
update: async (id: string, req: UpdateMedicationReminderReq & { version: number }) => {
|
|
const { data } = await client.put<{
|
|
success: boolean;
|
|
data: MedicationReminder;
|
|
}>(`/health/medication-reminders/${id}`, req);
|
|
return data.data;
|
|
},
|
|
|
|
delete: async (id: string, version: number) => {
|
|
await client.delete(`/health/medication-reminders/${id}`, { data: { version } });
|
|
},
|
|
};
|