Files
hms/apps/miniprogram/src/services/patient.ts
iven c38967a36e fix(mp): 修复小程序角色路由 + 前后端字段对齐 + E2E 测试报告
- 修复 stores/auth.ts 三种登录方式从错误路径提取 roles(resp.roles → resp.user.roles)
- 首页添加医护人员自动跳转医生端(useDidShow + isMedicalStaff)
- services/auth.ts credentialLogin 返回类型补全 roles 字段
- Web 前端 healthData.ts 字段对齐后端 DTO(indicators→items, content→overall_assessment)
- Web 前端 medicationReminders.ts 字段对齐(time_slots→reminder_times)
- 小程序 report.ts / reports 页面字段对齐后端(indicators→items, doctor_interpretation→doctor_notes)
- 小程序 patient.ts / followup.ts / alert.ts 补全缺失字段
- 后端 stats_handler.rs 权限码修正(health.patient.list→health.dashboard.manage)
- 新增 V1 E2E 测试报告和五专家组评审报告
2026-05-17 01:51:02 +08:00

52 lines
1.1 KiB
TypeScript

import { api } from './request';
export interface Patient {
id: string;
name: string;
gender?: string;
birth_date?: string;
blood_type?: string;
id_number?: string;
allergy_history?: string;
medical_history_summary?: string;
emergency_contact_name?: string;
emergency_contact_phone?: string;
phone?: string;
relation?: string;
status?: string;
verification_status?: string;
source?: string;
notes?: string;
version: number;
}
export async function listPatients() {
return api.get<{ data: Patient[]; total: number }>('/health/patients', {
page: 1,
page_size: 100,
});
}
export async function createPatient(data: {
name: string;
gender?: string;
birth_date?: string;
phone?: string;
id_number?: string;
}) {
return api.post<Patient>('/health/patients', data);
}
export interface PatientUpdateInput {
name?: string;
gender?: string;
birth_date?: string;
phone?: string;
id_number?: string;
relation?: string;
}
export async function updatePatient(id: string, data: PatientUpdateInput, version: number) {
return api.put<Patient>(`/health/patients/${id}`, { ...data, version });
}