Files
hms/apps/web/src/api/health/followUp.ts
iven 778ae79d84 feat(web): 健康模块 API 服务层 6 文件 47 端点
- patients.ts: 患者CRUD/标签/家庭/医护关联 14端点
- healthData.ts: 体征/化验/健康档案CRUD + 趋势 18端点
- appointments.ts: 预约CRUD + 排班管理 + 日历 8端点
- followUp.ts: 随访任务/记录CRUD 7端点
- consultations.ts: 咨询会话/消息CRUD + 导出 6端点
- doctors.ts: 医护CRUD 5端点
2026-04-25 00:37:59 +08:00

132 lines
3.0 KiB
TypeScript

import client from '../client';
import type { PaginatedResponse } from '../types';
// --- Types ---
export interface FollowUpTask {
id: string;
patient_id: string;
assigned_to?: string;
follow_up_type: string;
planned_date: string;
status: string;
content_template?: string;
related_appointment_id?: string;
created_at: string;
updated_at: string;
version: number;
}
export interface CreateFollowUpTaskReq {
patient_id: string;
assigned_to?: string;
follow_up_type: string;
planned_date: string;
content_template?: string;
related_appointment_id?: string;
}
export interface UpdateFollowUpTaskReq {
assigned_to?: string;
follow_up_type?: string;
planned_date?: string;
content_template?: string;
status?: string;
}
export interface FollowUpRecord {
id: string;
task_id: string;
executed_by?: string;
executed_date: string;
result?: string;
patient_condition?: string;
medical_advice?: string;
next_follow_up_date?: string;
created_at: string;
updated_at: string;
version: number;
}
export interface CreateFollowUpRecordReq {
task_id: string;
executed_by?: string;
executed_date: string;
result?: string;
patient_condition?: string;
medical_advice?: string;
next_follow_up_date?: string;
}
// --- API ---
export const followUpApi = {
// Tasks
listTasks: async (params: {
page?: number;
page_size?: number;
patient_id?: string;
assigned_to?: string;
status?: string;
}) => {
const { data } = await client.get<{
success: boolean;
data: PaginatedResponse<FollowUpTask>;
}>('/health/follow-up-tasks', { params });
return data.data;
},
getTask: async (id: string) => {
const { data } = await client.get<{
success: boolean;
data: FollowUpTask;
}>(`/health/follow-up-tasks/${id}`);
return data.data;
},
createTask: async (req: CreateFollowUpTaskReq) => {
const { data } = await client.post<{
success: boolean;
data: FollowUpTask;
}>('/health/follow-up-tasks', req);
return data.data;
},
updateTask: async (
id: string,
req: UpdateFollowUpTaskReq & { version: number },
) => {
const { data } = await client.put<{
success: boolean;
data: FollowUpTask;
}>(`/health/follow-up-tasks/${id}`, req);
return data.data;
},
deleteTask: async (id: string, version: number) => {
await client.delete(`/health/follow-up-tasks/${id}`, {
data: { version },
});
},
// Records
listRecords: async (params: {
page?: number;
page_size?: number;
task_id?: string;
patient_id?: string;
}) => {
const { data } = await client.get<{
success: boolean;
data: PaginatedResponse<FollowUpRecord>;
}>('/health/follow-up-records', { params });
return data.data;
},
createRecord: async (taskId: string, req: Omit<CreateFollowUpRecordReq, 'task_id'>) => {
const { data } = await client.post<{
success: boolean;
data: FollowUpRecord;
}>(`/health/follow-up-tasks/${taskId}/records`, { ...req, task_id: taskId });
return data.data;
},
};