Files
hms/apps/miniprogram/src/services/followup.ts
iven fbb28e655d
Some checks failed
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled
CI / rust-check (push) Has been cancelled
fix(miniprogram): submitRecord 补充 task_id 字段 — 后端 CreateFollowUpRecordReq 必填
后端 CreateFollowUpRecordReq 要求 body 中包含 task_id 字段,
小程序端 followup.ts 和 doctor.ts 的 submitRecord/createFollowUpRecord
均未传递 task_id,导致 422 Unprocessable Entity。
2026-04-28 00:16:21 +08:00

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 }),
});
}