我的账户数据修改-获取我的账户数据

This commit is contained in:
2024-04-22 14:30:46 +08:00
parent 155ce8d7aa
commit 5d79f4795b
9 changed files with 426 additions and 205 deletions
+86 -2
View File
@@ -118,9 +118,9 @@ class Order extends Model
* @param array $fields
* @param int|null $page
* @param int|null $per_page
* @return int|mixed|string
* @return array
*/
public static function getDoctorCreatedDateOrderInquiryPage(array $params, array $date_params,string|int $is_platform_deep_cooperation,array $fields = ["*"], int $page = null, ?int $per_page = 10): mixed
public static function getDoctorCreatedDateOrderInquiryPage(array $params, array $date_params,string|int $is_platform_deep_cooperation,array $fields = ["*"], int $page = null, ?int $per_page = 10): array
{
$query = self::with(['OrderInquiry', 'OrderServicePackage'])->where($params);
@@ -156,4 +156,88 @@ class Order extends Model
return $data;
}
/**
* 获取医生当日预计的订单金额
* @param array $params
* @param array $date_params 时间区间
* @param string|int $is_platform_deep_cooperation
* @return int|null|string
*/
public static function getDoctorDayAmountTotal(array $params, array $date_params,string|int $is_platform_deep_cooperation): int|null|string
{
$query = self::where($params);
// 问诊订单
$query = $query->where(function ($query) use ($date_params,$is_platform_deep_cooperation){
$query->whereExists(function ($subQuery) use ($date_params,$is_platform_deep_cooperation){
$subQuery->from('order_inquiry');
if ($is_platform_deep_cooperation == 1){
$subQuery->whereNotIn('inquiry_type', [2,4]);
}
$subQuery->whereNotIn('inquiry_mode', [7,8,9])
->whereIn('inquiry_status', [4,5])
->whereBetween('reception_time', $date_params)
->where('inquiry_refund_status', 0)
->where('inquiry_pay_status', 2)
->where('is_withdrawal', 0)
->whereRaw('gdxz_order.order_id = gdxz_order_inquiry.order_id');
})
->orWhereExists(function ($subQuery) use ($date_params) {
$subQuery->from('order_service_package')
->whereRaw('gdxz_order.order_id = gdxz_order_service_package.order_id')
->whereIn('order_service_status', [3])
->whereBetween('start_time', $date_params)
->where('refund_status', 0)
->where('pay_status', 2);
});
});
$result = $query->orderBy('created_at')
->sum("amount_total");;
return $result;
}
/**
* 获取医生当日已完成待入帐的订单金额
* @param array $params
* @param array $date_params 时间区间
* @param string|int $is_platform_deep_cooperation
* @return int|null|string
*/
public static function getDoctorDayCompletedAmountTotal(array $params, array $date_params,string|int $is_platform_deep_cooperation): int|null|string
{
$query = self::where($params);
// 问诊订单
$query = $query->where(function ($query) use ($date_params,$is_platform_deep_cooperation){
$query->whereExists(function ($subQuery) use ($date_params,$is_platform_deep_cooperation){
$subQuery->from('order_inquiry');
if ($is_platform_deep_cooperation == 1){
$subQuery->whereNotIn('inquiry_type', [2,4]);
}
$subQuery->whereNotIn('inquiry_mode', [7,8,9])
->whereIn('inquiry_status', [5])
->whereBetween('reception_time', $date_params)
->where('inquiry_refund_status', 0)
->where('inquiry_pay_status', 2)
->where('is_withdrawal', 0)
->whereRaw('gdxz_order.order_id = gdxz_order_inquiry.order_id');
})
->orWhereExists(function ($subQuery) use ($date_params) {
$subQuery->from('order_service_package')
->whereRaw('gdxz_order.order_id = gdxz_order_service_package.order_id')
->whereIn('order_service_status', [3])
->where('finish_time','>', $date_params[0])
->where('refund_status', 0)
->where('pay_status', 2);
});
});
$result = $query->orderBy('created_at')
->sum("amount_total");;
return $result;
}
}