fix(miniprogram): 修复 API 接口字段对齐 — 33 接口端到端验证
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled

P0: submitRecord() 路径修正 POST /follow-up-records → POST /follow-up-tasks/{id}/records
    + 请求体从 {task_id, content:{text}} 改为 {result, patient_condition, executed_date}
P1: ConsultationSession.subject/last_message 改为可选(后端暂不返回)
P1: Appointment.department 改为可选(后端未 JOIN 医生表)
P1: FollowUpRecord 结构对齐后端扁平字段(executed_date/result/medical_advice 等)
P2: Article 增加 status 可选字段
This commit is contained in:
iven
2026-04-27 23:41:50 +08:00
parent 3177a704ff
commit 83162817ce
7 changed files with 87 additions and 31 deletions

View File

@@ -4,7 +4,7 @@ export interface Appointment {
id: string;
patient_name: string;
doctor_name: string;
department: string;
department?: string;
appointment_date: string;
start_time: string;
end_time: string;

View File

@@ -13,6 +13,7 @@ export interface Article {
published_at?: string;
author?: string;
view_count?: number;
status?: string;
}
export interface ArticleCategory {

View File

@@ -6,8 +6,8 @@ export interface ConsultationSession {
doctor_id: string | null;
consultation_type: string;
status: string;
subject: string | null;
last_message: string | null;
subject?: string | null;
last_message?: string | null;
last_message_at: string | null;
unread_count_patient: number;
created_at: string;

View File

@@ -11,15 +11,15 @@ export interface FollowUpTask {
version: number;
}
export interface FollowUpContent {
text: string;
[key: string]: string;
}
export interface FollowUpRecord {
id: string;
task_id: string;
content: FollowUpContent;
executed_by?: string;
executed_date: string;
result?: string;
patient_condition?: string;
medical_advice?: string;
next_follow_up_date?: string;
created_at: string;
}
@@ -36,8 +36,16 @@ export async function getTaskDetail(id: string) {
return api.get<FollowUpTask>(`/health/follow-up-tasks/${id}`);
}
export async function submitRecord(data: { task_id: string; content: FollowUpContent }) {
return api.post<FollowUpRecord>('/health/follow-up-records', data);
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`, {
...data,
executed_date: new Date().toISOString().slice(0, 10),
});
}
export async function listRecords(taskId?: string) {