This commit is contained in:
parent
3ef077b261
commit
ee00b23414
@ -1999,74 +1999,33 @@ class PatientOrderService extends BaseService
|
|||||||
$order_prescription = OrderPrescription::getWithPage($params, ['*'], $page, $per_page);
|
$order_prescription = OrderPrescription::getWithPage($params, ['*'], $page, $per_page);
|
||||||
if (!empty($order_prescription['data'])) {
|
if (!empty($order_prescription['data'])) {
|
||||||
foreach ($order_prescription['data'] as &$item) {
|
foreach ($order_prescription['data'] as &$item) {
|
||||||
// 将模型对象转换为数组,避免间接修改重载元素错误
|
|
||||||
if (is_object($item)) {
|
|
||||||
$item = $item->toArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
//处理抄方情况
|
//处理抄方情况
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['order_inquiry_id'] = $item['order_inquiry_id'];
|
$params['order_inquiry_id'] = $item['order_inquiry_id'];
|
||||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("处理抄方情况开始", [
|
|
||||||
'order_prescription_id' => $item['order_prescription_id'] ?? null,
|
|
||||||
'order_inquiry_id' => $item['order_inquiry_id'] ?? null,
|
|
||||||
]);
|
|
||||||
$OrderInquiry = OrderInquiry::getOne($params);
|
$OrderInquiry = OrderInquiry::getOne($params);
|
||||||
if (!empty($OrderInquiry)) {
|
if (!empty($OrderInquiry)) {
|
||||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("查询到OrderInquiry", [
|
|
||||||
'order_inquiry_id' => $OrderInquiry['order_inquiry_id'] ?? null,
|
|
||||||
'transfer_doctor_id' => $OrderInquiry['transfer_doctor_id'] ?? null,
|
|
||||||
]);
|
|
||||||
//为抄方订单
|
//为抄方订单
|
||||||
if (!empty($OrderInquiry['transfer_doctor_id'])) {
|
if (!empty($OrderInquiry['transfer_doctor_id'])) {
|
||||||
$params = array();
|
$params = array();
|
||||||
$params['doctor_id'] = $OrderInquiry['transfer_doctor_id'];
|
//若为抄方订单则显示原订单医生信息
|
||||||
|
$params['doctor_id'] = $OrderInquiry['doctor_id'];
|
||||||
$fields = ['doctor_id','user_name','doctor_title'];
|
$fields = ['doctor_id','user_name','doctor_title'];
|
||||||
|
|
||||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("查询UserDoctor", [
|
|
||||||
'transfer_doctor_id' => $OrderInquiry['transfer_doctor_id'],
|
|
||||||
]);
|
|
||||||
$UserDoctor = UserDoctor::getOne($params, $fields);
|
$UserDoctor = UserDoctor::getOne($params, $fields);
|
||||||
if (!empty($UserDoctor)) {
|
if (!empty($UserDoctor)) {
|
||||||
$item['UserDoctor'] = $UserDoctor->toArray();
|
$item['UserDoctor']['doctor_title'] = DoctorTitleCode::getMessage($UserDoctor['doctor_title']);
|
||||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("成功设置UserDoctor", [
|
|
||||||
'doctor_id' => $UserDoctor['doctor_id'] ?? null,
|
|
||||||
'user_name' => $UserDoctor['user_name'] ?? null,
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->warning("未查询到UserDoctor", [
|
|
||||||
'transfer_doctor_id' => $OrderInquiry['transfer_doctor_id'],
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
} else {
|
}else{
|
||||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("OrderInquiry中transfer_doctor_id为空", [
|
|
||||||
'order_inquiry_id' => $OrderInquiry['order_inquiry_id'] ?? null,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->info("未查询到OrderInquiry", [
|
|
||||||
'order_inquiry_id' => $item['order_inquiry_id'] ?? null,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($item['UserDoctor'])) {
|
if (!empty($item['UserDoctor'])) {
|
||||||
$item['UserDoctor']['doctor_title'] = DoctorTitleCode::getMessage($item['UserDoctor']['doctor_title']);
|
$item['UserDoctor']['doctor_title'] = DoctorTitleCode::getMessage($item['UserDoctor']['doctor_title']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return success($order_prescription);
|
return success($order_prescription);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
|
||||||
Log::getInstance("PatientOrderService-getPatientPrescriptionOrderList")->error("获取处方订单列表异常", [
|
|
||||||
'message' => $e->getMessage(),
|
|
||||||
'file' => $e->getFile(),
|
|
||||||
'line' => $e->getLine(),
|
|
||||||
'trace' => $e->getTraceAsString(),
|
|
||||||
'patient_id' => $user_info['client_user_id'] ?? null,
|
|
||||||
'page' => $this->request->input('page', 1),
|
|
||||||
'per_page' => $this->request->input('per_page', 10),
|
|
||||||
]);
|
|
||||||
return fail(HttpEnumCode::SERVER_ERROR, "获取处方订单列表失败");
|
return fail(HttpEnumCode::SERVER_ERROR, "获取处方订单列表失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user