From 2159400c445f71ee193c201bb760b372ab199af2 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 4 Aug 2023 17:42:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E6=88=90=E5=8A=9F=E9=80=9A=E7=9F=A5=20=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/PatientOrderController.php | 11 ++++++ app/Services/DetectionService.php | 3 +- app/Services/MessagePush.php | 2 +- app/Services/PatientOrderService.php | 41 +++++++++++++++++++++++ config/routes.php | 3 -- 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/app/Controller/PatientOrderController.php b/app/Controller/PatientOrderController.php index d4c2817..7a491e4 100644 --- a/app/Controller/PatientOrderController.php +++ b/app/Controller/PatientOrderController.php @@ -287,4 +287,15 @@ class PatientOrderController extends AbstractController $data = $PatientOrderService->putCancelPatientDetectionOrder(); return $this->response->json($data); } + + /** + * 检测订单取消支付 + * @return ResponseInterface + */ + public function putPatientDetectionOrderCancelPay(): ResponseInterface + { + $PatientOrderService = new PatientOrderService(); + $data = $PatientOrderService->putPatientDetectionOrderCancelPay(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 47c01d7..b04ca59 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -240,9 +240,8 @@ class DetectionService extends BaseService $user_doctors = UserDoctor::getDiagnoCoopDoctorList($params,$hospital_params,$fields); if (!empty($user_doctors)){ foreach ($user_doctors as &$value){ - $doctor = array(); if (!empty($value['Hospital'])){ - $doctor['hospital_name'] = $value['Hospital']['hospital_name']; + $value['hospital_name'] = $value['Hospital']['hospital_name']; } unset($value['Hospital']); diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 2b97394..433dfe0 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -2263,7 +2263,7 @@ class MessagePush extends BaseService $sub_data = array(); $sub_data['push_user_id'] = $this->user['user_id']; $sub_data['wx_template_id'] = "5aJSrO8SU5rxqdB99zzl4rMVgcOTjt5mQh56cpZI1Hg";//咨询提醒 - $sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id="; + $sub_data['params']['page'] = "/pages/checkOrderDetail/checkOrderDetail?order_detection_id=" . $order_detection['order_detection_id']; $sub_data['params']['data'] = [ "thing1" => $order_detection['patient_name'],// 就诊人 "thing7" => (string)$detection_project['detection_project_name'],// 服务项目 diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index ba0e297..9dbc50e 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -1869,6 +1869,47 @@ class PatientOrderService extends BaseService return success(); } + /** + * 检测订单取消支付 + * @return array + */ + public function putPatientDetectionOrderCancelPay(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $order_detection_id = $this->request->route('order_detection_id'); + + Db::beginTransaction(); + + try { + // 获取订单数据 + $params = array(); + $params['patient_id'] = $user_info['client_user_id']; + $params['order_detection_id'] = $order_detection_id; + $params['is_delete'] = 0; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)) { + return fail(); + } + + // 检测订单取消 + // 取消订单原因(1:主动取消 2:客服取消 3:支付超时) + $DetectionService = new DetectionService(); + $result = $DetectionService->cancelUnpayDetectionOrder($order_detection['detection_no'], 3, "支付超时"); + if ($result['status'] != 1) { + Db::rollBack(); + return fail(); + } + + Db::commit(); + } catch (\Exception $e) { + Db::rollBack(); + return fail(HttpEnumCode::HTTP_ERROR, $e->getMessage()); + } + + return success(); + } + /** * 获取患者未完成订单 * @param string $patient_id diff --git a/config/routes.php b/config/routes.php index c2fd465..7225f10 100644 --- a/config/routes.php +++ b/config/routes.php @@ -278,9 +278,6 @@ Router::addGroup('/patient', function () { // 获取检测机构合作医生列表 Router::get('/doctor', [DetectionController::class, 'getDetectionDoctorList']); - // 获取患者进行中的订单 - Router::get('/progress-order', [DetectionController::class, 'getDetectionDoctorList']); - // 检测项目 Router::addGroup('/project', function () { // 获取合作公司检测项目列表