获取我的账户月账单明细数据数据修改
This commit is contained in:
+66
-2
@@ -8,6 +8,8 @@ namespace App\Model;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Database\Model\Relations\HasOne;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
@@ -30,8 +32,8 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $cancel_time 订单取消时间
|
||||
* @property string $cancel_remarks 取消订单备注
|
||||
* @property string $order_remarks 订单备注
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
*/
|
||||
class Order extends Model
|
||||
{
|
||||
@@ -49,6 +51,22 @@ class Order extends Model
|
||||
|
||||
protected string $primaryKey = "order_id";
|
||||
|
||||
/**
|
||||
* 关联问诊订单表
|
||||
*/
|
||||
public function OrderInquiry(): HasOne
|
||||
{
|
||||
return $this->hasOne(OrderInquiry::class, 'order_id', 'order_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联服务包订单表
|
||||
*/
|
||||
public function OrderServicePackage(): HasOne
|
||||
{
|
||||
return $this->hasOne(OrderServicePackage::class, 'order_id', 'order_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息-单条
|
||||
* @param array $params
|
||||
@@ -92,4 +110,50 @@ class Order extends Model
|
||||
return self::where($params)->update($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生某一时间段收益明细分页数据
|
||||
* @param array $params
|
||||
* @param array $date_params 时间区间
|
||||
* @param string|int $is_platform_deep_cooperation
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return int|mixed|string
|
||||
*/
|
||||
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
|
||||
{
|
||||
$query = self::with(['OrderInquiry', 'OrderServicePackage'])->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,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')
|
||||
->whereRaw('gdxz_order.order_id = gdxz_order_service_package.order_id')
|
||||
->whereIn('order_service_status', [4,5,6,7])
|
||||
->whereBetween('start_time', $date_params);
|
||||
});
|
||||
});
|
||||
|
||||
$result = $query->paginate($per_page, $fields, "page", $page);
|
||||
|
||||
$data = array();
|
||||
$data['current_page'] = $result->currentPage();// 当前页码
|
||||
$data['total'] = $result->total();//数据总数
|
||||
$data['data'] = $result->items();//数据
|
||||
$data['per_page'] = $result->perPage();//每页个数
|
||||
$data['last_page'] = $result->lastPage();//最后一页
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user