From 36f22db82f021c87075c9449ec331a21a3a80a7c Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Wed, 17 Apr 2024 14:55:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=9C=8D=E5=8A=A1=E5=8C=85?= =?UTF-8?q?=E5=85=B3=E8=81=94=E9=97=AE=E8=AF=8A=E8=AE=A2=E5=8D=95=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=86=85=E9=A1=B5=E5=9F=BA=E7=A1=80=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=89=A9=E4=BD=99=E8=8D=AF=E5=93=81=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E5=AD=97=E6=AE=B5=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/InquiryService.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 1e9fd86..0f11c10 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -32,6 +32,7 @@ use App\Model\OrderProductCoupon; use App\Model\OrderServicePackage; use App\Model\OrderServicePackageDetail; use App\Model\OrderServicePackageInquiry; +use App\Model\OrderServicePackageProduct; use App\Model\PatientFamily; use App\Model\PatientFamilyHealth; use App\Model\PatientFamilyPersonal; @@ -1551,11 +1552,26 @@ class InquiryService extends BaseService $finish_day = ceil((strtotime($order_service_package['finish_time']) - time()) / 60 / 60 / 24); } + // 获取剩余药品数量 + $remaining_quantity = 0; + if ($order_service_package['order_service_type'] == 1){ + // 健康包商品数据 + $params = array(); + $params['order_service_id'] = $order_service_package['order_service_id']; + $order_service_package_product = OrderServicePackageProduct::getList($params); + if (!empty($order_service_package_product)){ + $remaining_quantity = $order_service_package_product['quantity'] - $order_service_package_product['used_quantity']; + if ($remaining_quantity < 0){ + $remaining_quantity = 0; + } + } + } $result = array(); $result['finish_time'] = $finish_day; // 剩余服务天数 $result['month_inquiry_count'] = $month_inquiry_count; // 服务包当月已问诊次数 $result['monthly_frequency'] = $order_service_package_detail['monthly_frequency']; // 每月次数(0表示不限次) + $result['remaining_quantity'] = $remaining_quantity; // 剩余药品数量 return success($result); }