From 962ed9b7b316e2dbfceb91c94ae9a72091f4add8 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 28 Aug 2023 16:40:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=82=A3=E8=80=85=E4=B8=AA=E4=BA=BA=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=EF=BC=8C=E6=A3=80=E6=B5=8B=E8=AE=A2=E5=8D=95=E6=95=B0?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/OrderDetection.php | 10 ++++++++++ app/Services/DetectionService.php | 14 ++++++++++++++ app/Services/UserPatientService.php | 5 +++++ 3 files changed, 29 insertions(+) diff --git a/app/Model/OrderDetection.php b/app/Model/OrderDetection.php index b2da6ba..cae0655 100644 --- a/app/Model/OrderDetection.php +++ b/app/Model/OrderDetection.php @@ -155,4 +155,14 @@ class OrderDetection extends Model return $data; } + + /** + * 获取数量 + * @param array $params + * @return int + */ + public static function getCount(array $params): int + { + return self::where($params)->count(); + } } diff --git a/app/Services/DetectionService.php b/app/Services/DetectionService.php index 4ca2a58..60db330 100644 --- a/app/Services/DetectionService.php +++ b/app/Services/DetectionService.php @@ -953,4 +953,18 @@ class DetectionService extends BaseService $params['order_detection_id'] = $order_detection['order_detection_id']; OrderDetection::editOrderDetection($params, $data); } + + /** + * 获取患者某一状态下的检测订单数量 + * @param string $patient_id 患者id + * @param int $detection_status 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) + * @return int + */ + public function getPatientDetectionWithStatus(string $patient_id,int $detection_status): int + { + $params = array(); + $params['patient_id'] = $patient_id; + $params['detection_status'] = $detection_status; + return OrderDetection::getCount($params); + } } \ No newline at end of file diff --git a/app/Services/UserPatientService.php b/app/Services/UserPatientService.php index 6e2de0a..1df621b 100644 --- a/app/Services/UserPatientService.php +++ b/app/Services/UserPatientService.php @@ -59,6 +59,10 @@ class UserPatientService extends BaseService $OrderProductService = new OrderProductService(); $order_product_count = $OrderProductService->getPatientProductWithStatus($user_patient['patient_id'],1); + // 获取检测数量-待支付 + $detectionService = new DetectionService(); + $order_detection_count = $detectionService->getPatientDetectionWithStatus($user_patient['patient_id'],1); + // 处理头像 $user_patient['avatar'] = addAliyunOssWebsite($user_patient['avatar']); @@ -70,6 +74,7 @@ class UserPatientService extends BaseService $result['order_inquiry_count'] = $order_inquiry_count; $result['order_prescription_count'] = $order_prescription_count; $result['order_product_count'] = $order_product_count; + $result['order_detection_count'] = $order_detection_count; return success($result); }