diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index c343ff8..2c326a0 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -3106,8 +3106,9 @@ class PatientOrderService extends BaseService } // 获取服务包当月已问诊次数 - if ($order_service_package['order_service_status'] == 2){ - $result['order_service_package']['month_inquiry_count'] = 1; + if (!empty($order_service_package['pay_time'])){ + $OrderServicePackageService = new OrderServicePackageService(); + $result['order_service_package_detail']['month_inquiry_count'] = $OrderServicePackageService->getCurrentMonthInquiryCount($order_service_package['pay_time'], $order_service_package['order_service_type'], $order_service_package['user_id'], $order_service_package['doctor_id']); } // 健康包数据 @@ -3145,27 +3146,11 @@ class PatientOrderService extends BaseService $result['order_product'] = $order_products->toArray(); } -// // 已使用商品数量 -// $used_quantity = 0; -// foreach ($order_products as $order_product){ -// // 获取详情item -// $params = array(); -// $params['order_product_id'] = $order_product['order_product_id']; -// $order_product_items = OrderProductItem::getList($params); -// if (empty($order_product_items)){ -// return fail(HttpEnumCode::SERVER_ERROR); -// } -// -// foreach ($order_product_items as $order_product_item){ -// $used_quantity = $order_product_item["amount"]; -// } -// } -// -// if ($used_quantity > 30){ -// $used_quantity = 30; -// } -// -// $result['order_service_package_product'][0]['remaining_quantity'] = $used_quantity; + // 获取服务包内某一药品的总数量 + $total_quantity = $OrderServicePackageService->getOrderServiceProductTotalQuantity($order_service_package_product['product_id']); + + // 获取服务包内某一药品的剩余数量 + $result['order_service_package_detail']['remaining_quantity'] = $OrderServicePackageService->getOrderServiceProductCanUseQuantity($order_service_package['order_service_id'],$order_service_package_product['product_id'],$total_quantity); } }