parent
3f02c0547e
commit
0c1f78803e
@ -1997,13 +1997,11 @@ class PatientOrderService extends BaseService
|
||||
$params['platform_audit_status'] = 1;
|
||||
$params['is_delete'] = 0;
|
||||
$order_prescription = OrderPrescription::getWithPage($params, ['*'], $page, $per_page);
|
||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("order_prescription", [
|
||||
'order_prescription' => $order_prescription,
|
||||
]);
|
||||
if (!empty($order_prescription['data'])) {
|
||||
foreach ($order_prescription['data'] as &$item) {
|
||||
|
||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("item 原来", [
|
||||
'item["UserDoctor"]' => $item['UserDoctor']->toArray(),
|
||||
]);
|
||||
|
||||
//处理抄方情况
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $item['order_inquiry_id'];
|
||||
@ -2018,39 +2016,24 @@ class PatientOrderService extends BaseService
|
||||
|
||||
$UserDoctor = UserDoctor::getOne($params, $fields);
|
||||
if (!empty($UserDoctor)) {
|
||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("成功设置UserDoctor", [
|
||||
'doctor_id' => $UserDoctor['doctor_id'] ?? null,
|
||||
'user_name' => $UserDoctor['user_name'] ?? null,
|
||||
'doctor_title' => $UserDoctor['doctor_title'] ?? null,
|
||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("修改 UserDoctor", [
|
||||
'UserDoctor' => $UserDoctor->toArray(),
|
||||
]);
|
||||
// 同时使用 setRelation 和数组赋值,确保无论是通过关系访问还是数组访问都能获取到新对象
|
||||
$item->setRelation('UserDoctor', $UserDoctor);
|
||||
$item['UserDoctor'] = $UserDoctor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($item['UserDoctor'])) {
|
||||
// 获取关联对象,优先使用关系访问方式
|
||||
$userDoctor = $item->getRelation('UserDoctor') ?? $item['UserDoctor'];
|
||||
if (is_object($userDoctor)) {
|
||||
// 使用对象属性语法修改
|
||||
$userDoctor->doctor_title = DoctorTitleCode::getMessage($userDoctor->doctor_title);
|
||||
// 确保修改后的对象同时设置到关系和数组中
|
||||
$item->setRelation('UserDoctor', $userDoctor);
|
||||
$item['UserDoctor'] = $userDoctor;
|
||||
} else {
|
||||
// 如果是数组,直接修改数组
|
||||
$item['UserDoctor']['doctor_title'] = DoctorTitleCode::getMessage($item['UserDoctor']['doctor_title']);
|
||||
}
|
||||
$item['UserDoctor']['doctor_title'] = DoctorTitleCode::getMessage($item['UserDoctor']['doctor_title']);
|
||||
}
|
||||
|
||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("item 最终", [
|
||||
'item["UserDoctor"]' => $item['UserDoctor']->toArray(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("order_prescription 最终", [
|
||||
'order_prescription' => $order_prescription,
|
||||
]);
|
||||
|
||||
return success($order_prescription);
|
||||
} catch (\Throwable $e) {
|
||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->error("获取处方订单列表异常", [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user