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 可选字段
63 lines
1.5 KiB
TypeScript
63 lines
1.5 KiB
TypeScript
import { api } from './request';
|
|
|
|
export interface ConsultationSession {
|
|
id: string;
|
|
patient_id: string;
|
|
doctor_id: string | null;
|
|
consultation_type: string;
|
|
status: string;
|
|
subject?: string | null;
|
|
last_message?: string | null;
|
|
last_message_at: string | null;
|
|
unread_count_patient: number;
|
|
created_at: string;
|
|
}
|
|
|
|
export interface ConsultationMessage {
|
|
id: string;
|
|
session_id: string;
|
|
sender_id: string;
|
|
sender_role: string;
|
|
content_type: string;
|
|
content: string;
|
|
is_read: boolean;
|
|
created_at: string;
|
|
}
|
|
|
|
export async function listConsultations(params?: {
|
|
page?: number;
|
|
page_size?: number;
|
|
}) {
|
|
return api.get<{ data: ConsultationSession[]; total: number }>(
|
|
'/health/consultation-sessions',
|
|
params,
|
|
);
|
|
}
|
|
|
|
export async function getSession(sessionId: string) {
|
|
return api.get<ConsultationSession>(`/health/consultation-sessions/${sessionId}`);
|
|
}
|
|
|
|
export async function listMessages(sessionId: string, params?: {
|
|
page?: number;
|
|
page_size?: number;
|
|
after_id?: string;
|
|
}) {
|
|
return api.get<{ data: ConsultationMessage[]; total: number }>(
|
|
`/health/consultation-sessions/${sessionId}/messages`,
|
|
params,
|
|
);
|
|
}
|
|
|
|
export async function sendMessage(sessionId: string, content: string, contentType = 'text') {
|
|
return api.post<ConsultationMessage>('/health/consultation-messages', {
|
|
session_id: sessionId,
|
|
content_type: contentType,
|
|
content,
|
|
});
|
|
}
|
|
|
|
export async function markSessionRead(sessionId: string) {
|
|
return api.put<void>(`/health/consultation-sessions/${sessionId}/read`);
|
|
}
|