修正医生体现数据
This commit is contained in:
+69
-7
@@ -22,7 +22,7 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property int $pay_channel 支付渠道(1:小程序支付 2:微信扫码支付 3:模拟支付)
|
||||
* @property int $pay_status 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||
* @property string $pay_time 支付时间
|
||||
* @property int $refund_status 订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
|
||||
* @property int $refund_status 订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 7:部分退款)
|
||||
* @property string $order_no 系统订单编号
|
||||
* @property string $escrow_trade_no 第三方支付流水号
|
||||
* @property string $amount_total 订单金额
|
||||
@@ -32,8 +32,12 @@ use Hyperf\Snowflake\Concern\Snowflake;
|
||||
* @property string $cancel_time 订单取消时间
|
||||
* @property string $cancel_remarks 取消订单备注
|
||||
* @property string $order_remarks 订单备注
|
||||
* @property Carbon $created_at 创建时间
|
||||
* @property Carbon $updated_at 修改时间
|
||||
* @property int $is_withdrawal 是否提现(0:否 1:是 2:提现中 3:无需提现)
|
||||
* @property string $withdrawal_time 提现时间
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
* @property-read OrderInquiry|null $OrderInquiry
|
||||
* @property-read OrderServicePackage|null $OrderServicePackage
|
||||
*/
|
||||
class Order extends Model
|
||||
{
|
||||
@@ -47,7 +51,7 @@ class Order extends Model
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['order_id', 'user_id', 'patient_id', 'doctor_id', 'order_type', 'is_delete', 'pay_channel', 'pay_status', 'pay_time', 'refund_status', 'order_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'cancel_status', 'cancel_time', 'cancel_remarks', 'order_remarks', 'created_at', 'updated_at'];
|
||||
protected array $fillable = ['order_id', 'user_id', 'patient_id', 'doctor_id', 'order_type', 'is_delete', 'pay_channel', 'pay_status', 'pay_time', 'refund_status', 'order_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'cancel_status', 'cancel_time', 'cancel_remarks', 'order_remarks', 'is_withdrawal', 'withdrawal_time', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "order_id";
|
||||
|
||||
@@ -122,7 +126,9 @@ class Order extends Model
|
||||
*/
|
||||
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);
|
||||
$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){
|
||||
@@ -166,7 +172,8 @@ class Order extends Model
|
||||
*/
|
||||
public static function getDoctorDayAmountTotal(array $params, array $date_params,string|int $is_platform_deep_cooperation): int|null|string
|
||||
{
|
||||
$query = self::where($params);
|
||||
$query = self::where($params)
|
||||
->whereIn('order_type',[1,4,5]);
|
||||
|
||||
// 问诊订单
|
||||
$query = $query->where(function ($query) use ($date_params,$is_platform_deep_cooperation){
|
||||
@@ -208,7 +215,8 @@ class Order extends Model
|
||||
*/
|
||||
public static function getDoctorDayCompletedAmountTotal(array $params, array $date_params,string|int $is_platform_deep_cooperation): int|null|string
|
||||
{
|
||||
$query = self::where($params);
|
||||
$query = self::where($params)
|
||||
->whereIn('order_type',[1,4,5]);
|
||||
|
||||
// 问诊订单
|
||||
$query = $query->where(function ($query) use ($date_params,$is_platform_deep_cooperation){
|
||||
@@ -240,4 +248,58 @@ class Order extends Model
|
||||
->sum("amount_total");;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可提现订单列表
|
||||
* @param array $params
|
||||
* @param string|int $is_platform_deep_cooperation
|
||||
* @param array $fields
|
||||
* @param int|null $page
|
||||
* @param int|null $per_page
|
||||
* @return array
|
||||
*/
|
||||
public static function getDoctorWithdrawalOrderList(array $params, string|int $is_platform_deep_cooperation,array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||
{
|
||||
$query = self::with(['OrderInquiry', 'OrderServicePackage'])
|
||||
->where($params)
|
||||
->whereIn('order_type',[1,4,5]);
|
||||
|
||||
// 问诊订单
|
||||
$query = $query->where(function ($query) use ($is_platform_deep_cooperation){
|
||||
$query->whereExists(function ($subQuery) use ($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', [6])
|
||||
->whereIn('inquiry_refund_status', [0,3])
|
||||
->whereRaw('gdxz_order.order_id = gdxz_order_inquiry.order_id');
|
||||
})
|
||||
->orWhereExists(function ($subQuery) {
|
||||
$subQuery->from('order_service_package')
|
||||
->whereRaw('gdxz_order.order_id = gdxz_order_service_package.order_id')
|
||||
->whereIn('refund_status', [0,3])
|
||||
->where('pay_status', 2)
|
||||
->where('start_time', 2)
|
||||
->whereIn('order_service_status', [4,5])
|
||||
->WhereExists(function ($subQuery){
|
||||
$subQuery->from("order_service_package_inquiry")
|
||||
->whereRaw('gdxz_order_service_package.order_service_id = gdxz_order_service_package_inquiry.order_service_id');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$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