获取服务包关联问诊订单消息内页基础数据增加剩余药品数量字段返回
This commit is contained in:
parent
b1ee69453b
commit
36f22db82f
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user