修改自动完成服务包订单分成金额计算
This commit is contained in:
@@ -25,6 +25,7 @@ use App\Model\OrderServicePackageCase;
|
||||
use App\Model\OrderServicePackageDetail;
|
||||
use App\Model\OrderServicePackageInquiry;
|
||||
use App\Model\OrderServicePackageProduct;
|
||||
use App\Model\OrderServicePackageRefund;
|
||||
use App\Model\PatientFamily;
|
||||
use App\Model\PatientFamilyHealth;
|
||||
use App\Model\PatientFamilyPersonal;
|
||||
@@ -1656,4 +1657,92 @@ class OrderServicePackageService extends BaseService
|
||||
|
||||
return $order_service_package->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取服务包退款金额
|
||||
* @param string|int $order_service_no
|
||||
* @return string|int
|
||||
*/
|
||||
public function getServicePackageRefundTotal(string|int $order_service_no): string|int
|
||||
{
|
||||
// 获取退款数据
|
||||
$refund_total = 0;
|
||||
|
||||
$params = array();
|
||||
$params['order_service_no'] = $order_service_no;
|
||||
$order_service_package_refunds = OrderServicePackageRefund::getList($params);
|
||||
if (!empty($order_service_package_refunds)) {
|
||||
foreach ($order_service_package_refunds as $order_service_package_refund) {
|
||||
$refund_total = bcadd(
|
||||
(string)$refund_total,
|
||||
(string)$order_service_package_refund['refund_total'],
|
||||
2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $refund_total;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务包订单中医生可分成的问诊金额
|
||||
* @param string|int $order_service_no
|
||||
* @param array|object $order_service_package
|
||||
* @param array|object $order_service_package_detail
|
||||
* @return string
|
||||
*/
|
||||
public function getServicePackageDoctorInquiryAmountTotal(string|int $order_service_no,array|object $order_service_package,array|object $order_service_package_detail): string
|
||||
{
|
||||
// 获取服务包退款金额
|
||||
$refund_total = $this->getServicePackageRefundTotal($order_service_no);
|
||||
|
||||
if ($order_service_package['order_service_type'] == 1){
|
||||
// 健康包
|
||||
// 实际问诊数量
|
||||
$inquiry_count = 0;
|
||||
|
||||
// 获取健康包关联问诊订单
|
||||
$params = array();
|
||||
$params['order_service_no'] = $order_service_package['order_service_no'];
|
||||
$order_service_package_inquirys = OrderServicePackageInquiry::getList($params);
|
||||
foreach ($order_service_package_inquirys as $order_service_package_inquiry){
|
||||
// 获取订单数据
|
||||
$params = array();
|
||||
$params['order_inquiry_id'] = $order_service_package_inquiry['order_inquiry_id'];
|
||||
$order_inquiry = OrderInquiry::getOne($params);
|
||||
if (!empty($order_inquiry)){
|
||||
if (in_array($order_inquiry['inquiry_status'],[4,5,6])){
|
||||
$inquiry_count = $inquiry_count + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$amount_total = bcmul(
|
||||
(string)$inquiry_count,
|
||||
bcmul(
|
||||
(string)$order_service_package_detail['single_inquiry_price'],
|
||||
"0.75",
|
||||
3),
|
||||
3
|
||||
);
|
||||
}else{
|
||||
// 随访包
|
||||
$amount_total = bcsub(
|
||||
(string)$order_service_package['payment_amount_total'],
|
||||
(string)$refund_total,
|
||||
3
|
||||
);
|
||||
}
|
||||
|
||||
$amount_total = bcmul(
|
||||
(string)$amount_total,
|
||||
"0.75",
|
||||
8
|
||||
);
|
||||
return $amount_total;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user