fix(health): P1 功能缺陷修复 — 8 项后端+小程序问题
- 管理员订单列表:新增 admin_list_orders 不按 patient_id 过滤 - 分配医生:添加 doctor_profile 存在性验证防止孤立关联 - 标签管理:将软删除+插入包裹在事务中防止标签丢失 - HealthDataProvider:标记为 experimental,改进错误消息 - 预约 CAS:添加注释说明匹配字段与唯一索引的关系 - 小程序 DTO:inputVitalSign 映射 indicator_type 到结构化字段 - 小程序数据隔离:listAppointments/listTasks 添加 patient_id 参数 - 小程序字段名:family-add 修复 birthday → birth_date
This commit is contained in:
@@ -28,10 +28,11 @@ export interface DoctorSchedule {
|
||||
available_count: number;
|
||||
}
|
||||
|
||||
export async function listAppointments(page = 1) {
|
||||
export async function listAppointments(patientId?: string, page = 1) {
|
||||
return api.get<{ data: Appointment[]; total: number }>('/health/appointments', {
|
||||
page,
|
||||
page_size: 20,
|
||||
...(patientId && { patient_id: patientId }),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,11 @@ export interface FollowUpRecord {
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export async function listTasks(status?: 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 }),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,8 +19,42 @@ export async function getTodaySummary() {
|
||||
return api.get<TodaySummary>('/health/vital-signs/today');
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交生命体征数据。
|
||||
* 小程序使用简单的 indicator_type + value 模型,
|
||||
* 后端 CreateVitalSignsReq 期望结构化字段(systolic_bp_morning 等)。
|
||||
* 此函数负责将指示器类型映射到后端结构化格式。
|
||||
*/
|
||||
export async function inputVitalSign(patientId: string, data: VitalSignInput) {
|
||||
return api.post(`/health/patients/${patientId}/vital-signs`, data);
|
||||
const today = new Date().toISOString().slice(0, 10);
|
||||
const body: Record<string, unknown> = { record_date: today };
|
||||
|
||||
switch (data.indicator_type) {
|
||||
case 'blood_pressure':
|
||||
if (data.extra?.systolic) body.systolic_bp_morning = data.extra.systolic;
|
||||
if (data.extra?.diastolic) body.diastolic_bp_morning = data.extra.diastolic;
|
||||
break;
|
||||
case 'heart_rate':
|
||||
body.heart_rate = Math.round(data.value);
|
||||
break;
|
||||
case 'weight':
|
||||
body.weight = data.value;
|
||||
break;
|
||||
case 'blood_sugar':
|
||||
body.blood_sugar = data.value;
|
||||
break;
|
||||
case 'water_intake':
|
||||
body.water_intake_ml = Math.round(data.value);
|
||||
break;
|
||||
case 'urine_output':
|
||||
body.urine_output_ml = Math.round(data.value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (data.note) body.notes = data.note;
|
||||
return api.post(`/health/patients/${patientId}/vital-signs`, body);
|
||||
}
|
||||
|
||||
export async function getTrend(indicator: string, range: string) {
|
||||
|
||||
Reference in New Issue
Block a user