<?php

declare(strict_types=1);

namespace App\Model;



use Hyperf\Database\Model\Collection;
use Hyperf\Snowflake\Concern\Snowflake;

/**
 * @property int $department_custom_id 主键id
 * @property int $department_id 医院科室-标准id
 * @property string $department_custom_name 科室名称-自定义
 * @property string $department_name 科室名称-标准
 * @property string $department_code 科室编码-标准
 * @property int $department_status 状态（1:正常 2:删除）
 * @property \Carbon\Carbon $created_at 创建时间
 * @property \Carbon\Carbon $updated_at 修改时间
 */
class HospitalDepartmentCustom extends Model
{
    use Snowflake;

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

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['department_custom_id', 'department_id', 'department_custom_name', 'department_name', 'department_code', 'department_status', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['department_custom_id' => 'string', 'department_id' => 'integer', 'department_status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    protected string $primaryKey = "department_custom_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);
    }
}
