106 lines
4.8 KiB
PHP
106 lines
4.8 KiB
PHP
<?php
|
||
|
||
declare(strict_types=1);
|
||
|
||
namespace App\Model;
|
||
|
||
|
||
|
||
use Hyperf\Snowflake\Concern\Snowflake;
|
||
|
||
/**
|
||
* @property int $order_inquiry_id 主键id
|
||
* @property int $user_id 用户id-患者
|
||
* @property int $patient_id 患者id
|
||
* @property int $doctor_id 医生id(未分配时为null)
|
||
* @property int $family_id 家庭成员id(就诊用户)
|
||
* @property int $inquiry_type 订单类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||
* @property int $inquiry_mode 订单问诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||
* @property int $inquiry_status 问诊订单状态(1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消)
|
||
* @property int $is_delete 删除状态(0:否 1:是)
|
||
* @property int $inquiry_refund_status 问诊订单退款状态(0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
|
||
* @property int $inquiry_pay_channel 支付渠道(1:小程序支付 2:微信扫码支付)
|
||
* @property int $inquiry_pay_status 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||
* @property int $inquiry_no 订单编号
|
||
* @property string $escrow_trade_no 第三方支付流水号
|
||
* @property string $amount_total 订单金额
|
||
* @property string $payment_amount_total 实际付款金额
|
||
* @property string $pay_time 支付时间
|
||
* @property string $reception_time 接诊时间(已接诊)
|
||
* @property string $complete_time 订单完成时间(问诊完成时间)
|
||
* @property string $settlement_amount_total 订单与医生结算金额
|
||
* @property int $settlement_status 订单与医生结算状态(0:未结算 1:已结算)
|
||
* @property string $settlement_time 订单与医生结算时间
|
||
* @property int $cancel_reason 取消订单原因(1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时)
|
||
* @property string $cancel_remarks 取消订单备注(自动添加)
|
||
* @property string $patient_name 患者姓名-就诊人
|
||
* @property string $patient_name_mask 患者姓名-就诊人(掩码)
|
||
* @property int $patient_sex 患者性别-就诊人(0:未知 1:男 2:女)
|
||
* @property int $patient_age 患者年龄-就诊人
|
||
* @property \Carbon\Carbon $created_at 创建时间
|
||
* @property \Carbon\Carbon $updated_at 修改时间
|
||
*/
|
||
class OrderInquiry extends Model
|
||
{
|
||
use Snowflake;
|
||
|
||
/**
|
||
* The table associated with the model.
|
||
*/
|
||
protected ?string $table = 'order_inquiry';
|
||
|
||
/**
|
||
* The attributes that are mass assignable.
|
||
*/
|
||
protected array $fillable = ['order_inquiry_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'inquiry_type', 'inquiry_mode', 'inquiry_status', 'is_delete', 'inquiry_refund_status', 'inquiry_pay_channel', 'inquiry_pay_status', 'inquiry_no', 'escrow_trade_no', 'amount_total', 'payment_amount_total', 'pay_time', 'reception_time', 'complete_time', 'settlement_amount_total', 'settlement_status', 'settlement_time', 'cancel_reason', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'created_at', 'updated_at'];
|
||
|
||
/**
|
||
* The attributes that should be cast to native types.
|
||
*/
|
||
protected array $casts = ['order_inquiry_id' => 'integer', 'user_id' => 'integer', 'patient_id' => 'integer', 'doctor_id' => 'integer', 'family_id' => 'integer', 'inquiry_type' => 'integer', 'inquiry_mode' => 'integer', 'inquiry_status' => 'integer', 'is_delete' => 'integer', 'inquiry_refund_status' => 'integer', 'inquiry_pay_channel' => 'integer', 'inquiry_pay_status' => 'integer', 'inquiry_no' => 'integer', 'settlement_status' => 'integer', 'cancel_reason' => 'integer', 'patient_sex' => 'integer', 'patient_age' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
||
|
||
protected string $primaryKey = "order_inquiry_id";
|
||
|
||
/**
|
||
* 获取问诊订单-单条
|
||
* @param array $params
|
||
* @param array $fields
|
||
* @return object|null
|
||
*/
|
||
public static function getOne(array $params, array $fields = ['*']): object|null
|
||
{
|
||
return self::where($params)->first($fields);
|
||
}
|
||
|
||
/**
|
||
* 新增问诊订单-批量
|
||
* @param array $data 新增数据
|
||
* @return \Hyperf\Database\Model\Model|OrderInquiry
|
||
*/
|
||
public static function addUserDoctor(array $data): \Hyperf\Database\Model\Model|OrderInquiry
|
||
{
|
||
return self::create($data);
|
||
}
|
||
|
||
/**
|
||
* 获取信息-多条
|
||
* @param array $params
|
||
* @param array $fields
|
||
* @return object|null
|
||
*/
|
||
public static function getList(array $params, array $fields = ['*']): object|null
|
||
{
|
||
return self::where($params)->get($fields);
|
||
}
|
||
|
||
/**
|
||
* 获取数量
|
||
* @param array $params
|
||
* @return int
|
||
*/
|
||
public static function getCount(array $params): int
|
||
{
|
||
return self::where($params)->count();
|
||
}
|
||
}
|