parent
3f02c0547e
commit
0c1f78803e
@ -1997,13 +1997,11 @@ class PatientOrderService extends BaseService
|
|||||||
$params['platform_audit_status'] = 1;
|
$params['platform_audit_status'] = 1;
|
||||||
$params['is_delete'] = 0;
|
$params['is_delete'] = 0;
|
||||||
$order_prescription = OrderPrescription::getWithPage($params, ['*'], $page, $per_page);
|
$order_prescription = OrderPrescription::getWithPage($params, ['*'], $page, $per_page);
|
||||||
|
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("order_prescription", [
|
||||||
|
'order_prescription' => $order_prescription,
|
||||||
|
]);
|
||||||
if (!empty($order_prescription['data'])) {
|
if (!empty($order_prescription['data'])) {
|
||||||
foreach ($order_prescription['data'] as &$item) {
|
foreach ($order_prescription['data'] as &$item) {
|
||||||
|
|
||||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("item 原来", [
|
|
||||||
'item["UserDoctor"]' => $item['UserDoctor']->toArray(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
//处理抄方情况
|
//处理抄方情况
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['order_inquiry_id'] = $item['order_inquiry_id'];
|
$params['order_inquiry_id'] = $item['order_inquiry_id'];
|
||||||
@ -2018,38 +2016,23 @@ class PatientOrderService extends BaseService
|
|||||||
|
|
||||||
$UserDoctor = UserDoctor::getOne($params, $fields);
|
$UserDoctor = UserDoctor::getOne($params, $fields);
|
||||||
if (!empty($UserDoctor)) {
|
if (!empty($UserDoctor)) {
|
||||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("成功设置UserDoctor", [
|
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("修改 UserDoctor", [
|
||||||
'doctor_id' => $UserDoctor['doctor_id'] ?? null,
|
'UserDoctor' => $UserDoctor->toArray(),
|
||||||
'user_name' => $UserDoctor['user_name'] ?? null,
|
|
||||||
'doctor_title' => $UserDoctor['doctor_title'] ?? null,
|
|
||||||
]);
|
]);
|
||||||
// 同时使用 setRelation 和数组赋值,确保无论是通过关系访问还是数组访问都能获取到新对象
|
|
||||||
$item->setRelation('UserDoctor', $UserDoctor);
|
|
||||||
$item['UserDoctor'] = $UserDoctor;
|
$item['UserDoctor'] = $UserDoctor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($item['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 最终", [
|
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("order_prescription 最终", [
|
||||||
'item["UserDoctor"]' => $item['UserDoctor']->toArray(),
|
'order_prescription' => $order_prescription,
|
||||||
]);
|
]);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return success($order_prescription);
|
return success($order_prescription);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user