<?php

declare(strict_types=1);

namespace App\Model;



use Hyperf\Snowflake\Concern\Snowflake;

/**
 * @property int $audit_statistics_id 主键id
 * @property int $pharmacist_id 药师id
 * @property string $statistics_date 统计日期
 * @property int $audit_number 审核数量
 * @property int $not_pass_number 审核不通过数量
 * @property \Carbon\Carbon $created_at 创建时间
 * @property \Carbon\Carbon $updated_at 修改时间
 */
class PharmacistAuditStatistic extends Model
{
    use Snowflake;

    /**
     * The table associated with the model.
     */
    protected ?string $table = 'pharmacist_audit_statistics';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['audit_statistics_id', 'pharmacist_id', 'statistics_date', 'audit_number', 'not_pass_number', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['audit_statistics_id' => 'integer', 'pharmacist_id' => 'integer', 'audit_number' => 'integer', 'not_pass_number' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    protected string $primaryKey = "audit_statistics_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
     * @return int
     */
    public static function getCount(array $params): int
    {
        return self::where($params)->count();
    }
}
