hospital-applets-api/app/Model/OrderServicePackage.php

126 lines
4.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare(strict_types=1);
namespace App\Model;
use Carbon\Carbon;
use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;
/**
* @property int $order_service_id 主键id
* @property int $order_id 订单id
* @property int $user_id 用户id-患者
* @property int $patient_id 患者id
* @property int $doctor_id 医生id
* @property int $family_id 家庭成员id就诊用户
* @property int $order_service_type 服务包类型1:健康包 2:随访包)
* @property int $order_service_status 订单状态1:待支付 2:未开始 3:服务中 4:服务完成 5:服务取消)
* @property int $is_delete 删除状态0:否 1:是)
* @property int $refund_status 订单退款状态0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
* @property int $pay_channel 支付渠道1:小程序支付 2:微信扫码支付 3:模拟支付)
* @property int $pay_status 支付状态1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
* @property string $order_service_no 系统订单编号
* @property string $escrow_trade_no 第三方支付流水号
* @property string $amount_total 订单金额
* @property string $coupon_amount_total 优惠卷总金额
* @property string $payment_amount_total 实际付款金额
* @property string $pay_time 支付时间
* @property string $start_time 开始服务时间
* @property string $finish_time 结束服务时间
* @property string $cancel_time 订单取消时间
* @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 $created_at 创建时间
* @property Carbon $updated_at 修改时间
*/
class OrderServicePackage extends Model
{
use Snowflake;
/**
* The table associated with the model.
*/
protected ?string $table = 'order_service_package';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['order_service_id', 'order_id', 'user_id', 'patient_id', 'doctor_id', 'family_id', 'order_service_type', 'order_service_status', 'is_delete', 'refund_status', 'pay_channel', 'pay_status', 'order_service_no', 'escrow_trade_no', 'amount_total', 'coupon_amount_total', 'payment_amount_total', 'pay_time', 'start_time', 'finish_time', 'cancel_time', 'cancel_remarks', 'patient_name', 'patient_name_mask', 'patient_sex', 'patient_age', 'created_at', 'updated_at'];
protected string $primaryKey = "order_service_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 $params
* @param array $fields
* @return Collection|array
*/
public static function getList(array $params, array $fields = ['*']): Collection|array
{
return self::where($params)->get($fields);
}
/**
* 新增
* @param array $data
* @return OrderServicePackage|\Hyperf\Database\Model\Model
*/
public static function addOrderServicePackage(array $data): \Hyperf\Database\Model\Model|OrderServicePackage
{
return self::create($data);
}
/**
* 修改
* @param array $params
* @param array $data
* @return int
*/
public static function edit(array $params = [], array $data = []): int
{
return self::where($params)->update($data);
}
/**
* 获取某一状态下的订单-多条
* @param array $params
* @param array $order_service_status
* @param array $fields
* @return Collection|array
*/
public static function getStatusList(array $params = [],array $order_service_status = [], array $fields = ['*']): Collection|array
{
return self::where($params)->whereIn('order_service_status',$order_service_status)->get($fields);
}
/**
* 获取某一状态下的订单-单条
* @param array $params
* @param array $order_service_status
* @param array $fields
* @return object|null
*/
public static function getStatusOne(array $params = [],array $order_service_status = [], array $fields = ['*']): object|null
{
return self::where($params)->whereIn('order_service_status',$order_service_status)->first($fields);
}
}