后端 CreateFollowUpRecordReq 要求 body 中包含 task_id 字段, 小程序端 followup.ts 和 doctor.ts 的 submitRecord/createFollowUpRecord 均未传递 task_id,导致 422 Unprocessable Entity。
59 lines
1.4 KiB
TypeScript
59 lines
1.4 KiB
TypeScript
import { api } from './request';
|
|
|
|
export interface FollowUpTask {
|
|
id: string;
|
|
patient_id?: string;
|
|
patient_name?: string;
|
|
follow_up_type: string;
|
|
content_template?: string;
|
|
status: string;
|
|
planned_date: string;
|
|
version: number;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
export async function listTasks(patientId?: string, status?: string) {
|
|
return api.get<{ data: FollowUpTask[]; total: number }>('/health/follow-up-tasks', {
|
|
page: 1,
|
|
page_size: 50,
|
|
...(patientId && { patient_id: patientId }),
|
|
...(status && { status }),
|
|
});
|
|
}
|
|
|
|
export async function getTaskDetail(id: string) {
|
|
return api.get<FollowUpTask>(`/health/follow-up-tasks/${id}`);
|
|
}
|
|
|
|
export async function submitRecord(taskId: string, data: {
|
|
result?: string;
|
|
patient_condition?: string;
|
|
medical_advice?: string;
|
|
next_follow_up_date?: string;
|
|
}) {
|
|
return api.post<FollowUpRecord>(`/health/follow-up-tasks/${taskId}/records`, {
|
|
task_id: taskId,
|
|
...data,
|
|
executed_date: new Date().toISOString().slice(0, 10),
|
|
});
|
|
}
|
|
|
|
export async function listRecords(taskId?: string) {
|
|
return api.get<{ data: FollowUpRecord[]; total: number }>('/health/follow-up-records', {
|
|
page: 1,
|
|
page_size: 50,
|
|
...(taskId && { task_id: taskId }),
|
|
});
|
|
}
|