From cefe11b02b0f3db29b83e31f64a50001cd9cf203 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 7 Aug 2023 09:06:34 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=82=A3=E8=80=85=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=B8=AD=E7=9A=84=E6=A3=80=E6=B5=8B=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/DetectionController.php | 23 ++++++++++++++++++++++- app/Request/DetectionRequest.php | 3 +++ app/Services/DetectionService.php | 23 +++++++++++++++++++++++ config/routes.php | 3 +++ 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/app/Controller/DetectionController.php b/app/Controller/DetectionController.php index 47538d1..63b759d 100644 --- a/app/Controller/DetectionController.php +++ b/app/Controller/DetectionController.php @@ -54,7 +54,12 @@ class DetectionController extends AbstractController return $this->response->json($data); } - // 创建检测订单 + /** + * 创建检测订单 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ public function addDetectionOrder(): ResponseInterface { $request = $this->container->get(DetectionRequest::class); @@ -64,4 +69,20 @@ class DetectionController extends AbstractController $data = $detectionService->addDetectionOrder(); return $this->response->json($data); } + + /** + * 获取患者进行中的检测订单 + * @return ResponseInterface + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function getDetectionDoctorOrderFirst(): ResponseInterface + { + $request = $this->container->get(DetectionRequest::class); + $request->scene('getDetectionDoctorOrderFirst')->validateResolved(); + + $detectionService = new DetectionService(); + $data = $detectionService->getDetectionDoctorOrderFirst(); + return $this->response->json($data); + } } \ No newline at end of file diff --git a/app/Request/DetectionRequest.php b/app/Request/DetectionRequest.php index eccc0d4..c3329dc 100644 --- a/app/Request/DetectionRequest.php +++ b/app/Request/DetectionRequest.php @@ -21,6 +21,9 @@ class DetectionRequest extends FormRequest 'doctor_id', // 医生id 'client_type', // 客户端类型(1:手机 2:电脑) ], + 'getDetectionDoctorOrderFirst' => [ // 创建检测订单 + 'family_id', + ], ]; /** diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index b04ca59..0f2ebfa 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -470,6 +470,29 @@ class DetectionService extends BaseService return success($result); } + /** + * 获取患者进行中的检测订单 + * @return array + */ + public function getDetectionDoctorOrderFirst(): array + { + $user_info = $this->request->getAttribute("userInfo") ?? []; + + $family_id = $this->request->input("family_id"); + + // 检测是否存在同类型未完成的检测订单 + $params = array(); + $params['patient_id'] = $user_info['client_user_id']; + $params['family_id'] = $family_id; + $order_detection = OrderDetection::getOne($params); + if (empty($order_detection)){ + return success(); + } + + return success($order_detection['order_detection_id']); + + } + /** * 取消未支付检测订单 * @param string|int $order_no 订单编号 diff --git a/config/routes.php b/config/routes.php index 7225f10..f753a31 100644 --- a/config/routes.php +++ b/config/routes.php @@ -275,6 +275,9 @@ Router::addGroup('/patient', function () { ] ); + // 获取患者进行中的检测订单 + Router::get('', [DetectionController::class, 'getDetectionDoctorOrderFirst']); + // 获取检测机构合作医生列表 Router::get('/doctor', [DetectionController::class, 'getDetectionDoctorList']);