From df935b6c8262dfadda5fe495ebb04e0b62d52bee Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Wed, 17 Apr 2024 11:46:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E4=BD=BF=E7=94=A8=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/OrderServicePackageProduct.php | 7 ++-- app/Services/InquiryService.php | 5 +++ app/Services/PatientOrderService.php | 44 +++++++++++------------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/app/Model/OrderServicePackageProduct.php b/app/Model/OrderServicePackageProduct.php index b7f5e41..acc979d 100644 --- a/app/Model/OrderServicePackageProduct.php +++ b/app/Model/OrderServicePackageProduct.php @@ -16,9 +16,10 @@ use Hyperf\Snowflake\Concern\Snowflake; * @property int $product_id 商品id * @property string $product_name 商品名称 * @property int $quantity 商品数量 + * @property int $used_quantity 已使用数量 * @property string $discount_product_price 折扣商品价格 - * @property Carbon $created_at 创建时间 - * @property Carbon $updated_at 修改时间 + * @property \Carbon\Carbon $created_at 创建时间 + * @property \Carbon\Carbon $updated_at 修改时间 */ class OrderServicePackageProduct extends Model { @@ -32,7 +33,7 @@ class OrderServicePackageProduct extends Model /** * The attributes that are mass assignable. */ - protected array $fillable = ['service_product_id', 'order_service_id', 'product_id', 'product_name', 'quantity', 'discount_product_price', 'created_at', 'updated_at']; + protected array $fillable = ['service_product_id', 'order_service_id', 'product_id', 'product_name', 'quantity', 'used_quantity', 'discount_product_price', 'created_at', 'updated_at']; protected string $primaryKey = "service_product_id"; diff --git a/app/Services/InquiryService.php b/app/Services/InquiryService.php index 2e55966..1d83b82 100644 --- a/app/Services/InquiryService.php +++ b/app/Services/InquiryService.php @@ -1002,6 +1002,11 @@ class InquiryService extends BaseService } + // 获取服务包当月剩余次数 + + // 获取服务包到期天数 + + $result = array(); $result['doctor_user_id'] = $user_doctor['user_id']; $result['patient_user_id'] = $order_inquiry['user_id']; diff --git a/app/Services/PatientOrderService.php b/app/Services/PatientOrderService.php index 51a6f2a..d8bb6e6 100644 --- a/app/Services/PatientOrderService.php +++ b/app/Services/PatientOrderService.php @@ -2887,30 +2887,28 @@ 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']['used_quantity'] = $used_quantity; +// // 已使用商品数量 +// $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; } - - // 获取药品剩余数量 } return success($result);