55
Some checks are pending
Build Docker / build (push) Waiting to run

This commit is contained in:
haomingming 2025-12-26 13:31:47 +08:00
parent 3e28a4291f
commit c7841f87f8

View File

@ -2023,13 +2023,24 @@ class PatientOrderService extends BaseService
'user_name' => $UserDoctor['user_name'] ?? null,
'doctor_title' => $UserDoctor['doctor_title'] ?? null,
]);
$item['UserDoctor'] = $UserDoctor;
// 使用 setRelation 方法确保关联对象正确设置
$item->setRelation('UserDoctor', $UserDoctor);
}
}
}
if (!empty($item['UserDoctor'])) {
$item['UserDoctor']['doctor_title'] = DoctorTitleCode::getMessage($item['UserDoctor']['doctor_title']);
// 获取关联对象,优先使用关系访问方式
$userDoctor = $item->getRelation('UserDoctor') ?? $item['UserDoctor'];
if (is_object($userDoctor)) {
// 使用对象属性语法修改
$userDoctor->doctor_title = DoctorTitleCode::getMessage($userDoctor->doctor_title);
// 确保修改后的对象重新设置到关系中
$item->setRelation('UserDoctor', $userDoctor);
} else {
// 如果是数组,直接修改数组
$item['UserDoctor']['doctor_title'] = DoctorTitleCode::getMessage($item['UserDoctor']['doctor_title']);
}
}
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("item 最终", [