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

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
+3 -2
View File
@@ -115,9 +115,10 @@ class DoctorAccountDay extends Model
*/
public static function getDoctorMonth(array $params,array $fields = ['*']): \Hyperf\Collection\Collection
{
return self::select(['month',Db::raw('SUM(total_amount) AS `total_amount`')])
return self::select(['year','month',Db::raw('SUM(total_amount) AS `total_amount`')])
->where($params)
->groupBy(['month'])
->groupBy(['year','month'])
->orderBy('year')
->orderBy('month')
->get($fields);
}
+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;
}
}
+5 -1
View File
@@ -292,11 +292,15 @@ class OrderInquiry extends Model
* @param array $params
* @param array $reception_time 接诊时间区间
* @param array $inquiry_status_params inquiry_status字段搜索条件
* @param array $inquiry_type_not_params
* @return int|mixed|string
*/
public static function getDoctorAmountTotal(array $params, array $reception_time, array $inquiry_status_params): mixed
public static function getDoctorAmountTotal(array $params, array $reception_time, array $inquiry_status_params,array $inquiry_type_not_params = []): mixed
{
return self::where($params)
->when($inquiry_type_not_params, function ($query, $inquiry_type_not_params) {
$query->whereNotIn('inquiry_type', $inquiry_type_not_params);
})
->whereIn('inquiry_status', $inquiry_status_params)
->whereBetween('reception_time', $reception_time)
->orderBy('reception_time')
+35 -1
View File
@@ -171,7 +171,7 @@ class OrderServicePackage extends Model
/**
* 获取某一时间段服务包订单-结束时间
* @param array $params
* @param array $finish_time_params 接诊时间区间
* @param array $finish_time_params 结束时间区间
* @return Collection|array
*/
public static function getInquiryWithFinishTime(array $params, array $finish_time_params): Collection|array
@@ -181,4 +181,38 @@ class OrderServicePackage extends Model
->orderBy('finish_time')
->get();
}
/**
* 获取医生当日的服务包订单
* @param array $params
* @param array $order_service_status_params
* @param array $start_time_params 开始时间区间
* @return Collection|array
*/
public static function getDoctorDayOrderServiceWithStartTime(array $params, array $order_service_status_params,array $start_time_params): Collection|array
{
return self::where($params)
->whereIn('order_service_status',$order_service_status_params)
->whereIn('refund_status',[0,4,5])
->whereBetween('start_time', $start_time_params)
->orderBy('start_time')
->get();
}
/**
* 获取医生当日未结束的服务包订单
* @param array $params
* @param array $order_service_status_params
* @param string $finish_time_params 当前时间
* @return Collection|array
*/
public static function getDoctorDayNoFinishOrderService(array $params, array $order_service_status_params,string $finish_time_params): Collection|array
{
return self::where($params)
->whereIn('order_service_status',$order_service_status_params)
->whereIn('refund_status',[0,4,5])
->where('finish_time','>', $finish_time_params)
->orderBy('start_time')
->get();
}
}