获取我的账户数据-获取医生服务包每月账单数据

This commit is contained in:
2024-05-07 18:13:03 +08:00
parent cef772f53c
commit 1a164b7cea
4 changed files with 123 additions and 34 deletions
+22 -15
View File
@@ -116,7 +116,7 @@ class Order extends Model
/**
* 获取医生某一时间段收益明细分页数据
* @param array $params
* @param string|int $doctor_id
* @param array $date_params 时间区间
* @param string|int $is_platform_deep_cooperation
* @param array $fields
@@ -124,27 +124,34 @@ class Order extends Model
* @param int|null $per_page
* @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): array
public static function getDoctorCreatedDateOrderInquiryPage(string|int $doctor_id, array $date_params,string|int $is_platform_deep_cooperation,array $fields = ["*"], int $page = null, ?int $per_page = 10): array
{
$params = array();
$params['doctor_id'] = $doctor_id;
$query = self::with(['OrderInquiry', 'OrderServicePackage'])
->whereIn('order_type',[1,4,5])
->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]);
}
$query = $query->where(function ($query) use ($date_params,$is_platform_deep_cooperation,$doctor_id){
$query->whereExists(function ($subQuery) use ($date_params,$is_platform_deep_cooperation,$doctor_id){
$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', [6,7])
->whereBetween('reception_time', $date_params)
->whereRaw('gdxz_order.order_id = gdxz_order_inquiry.order_id');
})
->orWhereExists(function ($subQuery) use ($date_params) {
$subQuery->from('order_service_package')
$subQuery->where('doctor_id', $doctor_id)
->whereNotIn('inquiry_mode', [7,8,9])
->where('doctor_id', $doctor_id)
->whereIn('inquiry_status', [6,7])
->whereBetween('reception_time', $date_params)
->whereRaw('gdxz_order.order_id = gdxz_order_inquiry.order_id');
})
->orWhereExists(function ($subQuery) use ($date_params,$doctor_id) {
$subQuery->from('order_service_package');
$subQuery->where('doctor_id', $doctor_id)
->whereRaw('gdxz_order.order_id = gdxz_order_service_package.order_id')
->whereIn('order_service_status', [4,5,6,7])
->whereBetween('start_time', $date_params);