From 802a5081fbff7585110df112dccd3e335332aa76 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 13 Mar 2023 11:06:35 +0800 Subject: [PATCH] 1 --- app/Controller/PatientOrderController.php | 11 +++++++++++ app/Model/OrderPrescription.php | 19 +++++++++++++++++++ app/Services/PatientOrderService.php | 23 +++++++++++++++++++++++ app/Services/UserDoctorService.php | 2 +- config/routes.php | 2 +- 5 files changed, 55 insertions(+), 2 deletions(-) diff --git a/app/Controller/PatientOrderController.php b/app/Controller/PatientOrderController.php index fad55a9..ebbfaaf 100644 --- a/app/Controller/PatientOrderController.php +++ b/app/Controller/PatientOrderController.php @@ -173,4 +173,15 @@ class PatientOrderController extends AbstractController $data = $PatientOrderService->getPatientPrescriptionOrderList(); return $this->response->json($data); } + + /** + * 获取处方订单详情 + * @return ResponseInterface + */ + public function getPatientPrescriptionOrderInfo(): ResponseInterface + { + $PatientOrderService = new PatientOrderService(); + $data = $PatientOrderService->getPatientPrescriptionOrderInfo(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Model/OrderPrescription.php b/app/Model/OrderPrescription.php index ff0933b..b7896ea 100644 --- a/app/Model/OrderPrescription.php +++ b/app/Model/OrderPrescription.php @@ -213,4 +213,23 @@ class OrderPrescription extends Model return $data; } + /** + * 单条 + * 处方疾病表 + * 处方商品表 + * @param array $params + * @param array $fields + * @param int|null $page + * @param int|null $per_page + * @return object|null + */ + public static function getWithOne(array $params, array $fields = ["*"], int $page = null, ?int $per_page = 10): object|null + { + return self::with([ + "UserDoctor:doctor_id,user_name,doctor_title", + "OrderPrescriptionIcd:prescription_icd_id,order_prescription_id,icd_name", + "OrderPrescriptionProduct:prescription_product_id,order_prescription_id,product_name,product_spec" + ]) + ->where($params)->first($fields); + } } diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index b227f36..90bc761 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -706,6 +706,10 @@ class PatientOrderService extends BaseService return success(); } + /** + * 获取处方订单列表 + * @return array + */ public function getPatientPrescriptionOrderList(): array { $user_info = $this->request->getAttribute("userInfo") ?? []; @@ -729,4 +733,23 @@ class PatientOrderService extends BaseService return success($order_prescription); } + + public function getPatientPrescriptionOrderInfo(){ + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $order_prescription_id = $this->request->route('order_prescription_id'); + + // 获取处方数据 + $fields = [ + 'order_prescription_id', + 'prescription_status', + ]; + $params = array(); + $params['order_prescription_id'] = $order_prescription_id; + $params['patient_id'] = $user_info['client_user_id']; + $params['pharmacist_audit_status'] = 1; + $params['platform_audit_status'] = 1; + $params['is_delete'] = 0; + $order_prescription = OrderPrescription::getWithOne($params); + } } \ No newline at end of file diff --git a/app/Services/UserDoctorService.php b/app/Services/UserDoctorService.php index 6bd570f..0f0c439 100644 --- a/app/Services/UserDoctorService.php +++ b/app/Services/UserDoctorService.php @@ -412,7 +412,7 @@ class UserDoctorService extends BaseService $params['doctor_id'] = $user_info['client_user_id']; $params['pharmacist_audit_status'] = $pharmacist_audit_status; $params['is_delete'] = 0; - $order_prescriptions = OrderPrescription::getWithIcdPage($params,$page,$per_page); + $order_prescriptions = OrderPrescription::getWithIcdPage($params,['*'],$page,$per_page); if (empty($order_prescriptions)) { return success($order_prescriptions); } diff --git a/config/routes.php b/config/routes.php index f0da549..9029418 100644 --- a/config/routes.php +++ b/config/routes.php @@ -318,7 +318,7 @@ Router::addGroup('/patient', function () { Router::get('', [PatientOrderController::class, 'getPatientPrescriptionOrderList']); // 获取处方订单详情 - Router::post('/8', [PatientOrderController::class, 'imCallBack']); + Router::get('/{order_prescription_id:\d+}', [PatientOrderController::class, 'getPatientPrescriptionOrderInfo']); // 获取处方订单支付页详情-处方管理 Router::post('/16', [PatientOrderController::class, 'imCallBack']);