diff --git a/app/Services/OrderServicePackageService.php b/app/Services/OrderServicePackageService.php index 357ceb4..e9b78bb 100644 --- a/app/Services/OrderServicePackageService.php +++ b/app/Services/OrderServicePackageService.php @@ -1248,7 +1248,7 @@ class OrderServicePackageService extends BaseService { $params = array(); $params['package_id'] = $package_id; - $health_package_products = HealthPackage::getList($params); + $health_package_products = HealthPackageProduct::getList($params); if (empty($health_package_products)){ return []; } @@ -1258,22 +1258,16 @@ class OrderServicePackageService extends BaseService /** * 获取服务包内某一药品的总数量 + * @param string|int $package_id * @param string|int $product_id * @return int */ - public function getOrderServiceProductTotalQuantity(string|int $product_id): int + public function getOrderServiceProductTotalQuantity(string|int $package_id,string|int $product_id): int { $total_quantity = 0; - // 获取健康包内容 $params = array(); - $health_package = HealthPackage::getOne($params); - if (empty($health_package)){ - return $total_quantity; - } - - $params = array(); - $params['package_id'] = $health_package['package_id']; + $params['package_id'] = $package_id; $params['product_id'] = $product_id; $health_package_product = HealthPackage::getOne($params); if (empty($health_package_product)){ diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index c6248ae..b4f3f0e 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -3147,11 +3147,8 @@ class PatientOrderService extends BaseService $health_package_products = $OrderServicePackageService->getOrderServiceProduct($order_service_package_detail['package_id']); if (!empty($health_package_products)) { foreach ($health_package_products as $health_package_product) { - // 获取服务包内某一药品的总数量 - $total_quantity = $OrderServicePackageService->getOrderServiceProductTotalQuantity($health_package_product['product_id']); - // 获取服务包内某一药品的剩余数量 - $result['order_service_package_detail']['remaining_quantity'] = $OrderServicePackageService->getOrderServiceProductCanUseQuantity($order_service_package['order_service_id'],$health_package_product['product_id'],$total_quantity); + $result['order_service_package_detail']['remaining_quantity'] = $OrderServicePackageService->getOrderServiceProductCanUseQuantity($order_service_package['order_service_id'],$health_package_product['product_id'],$health_package_product['quantity']); } } }