<?php

declare(strict_types=1);

namespace App\Model;



use Hyperf\Snowflake\Concern\Snowflake;

/**
 * @property int $id id
 * @property string $uuid 唯一uuid
 * @property string $name 医院名称
 * @property int $prov_id 省份id
 * @property string $prov_name 省份名称
 * @property int $city_id 城市id
 * @property string $city_name 城市名称
 * @property int $county_id 区县id
 * @property string $county_name 区县名称
 * @property string $road 街道
 * @property string $address 详细地址
 * @property string $postcode 邮政编码
 * @property string $lat 纬度
 * @property string $lng 纬度
 * @property string $info 简介
 * @property string $legal_person 法人
 * @property string $office_phone 电话
 * @property int $level 等级（0未知  1三级甲等  2三级医院  3二级医院  4其他）
 * @property string $create_date 创建日期
 */
class TbHospitalMy extends Model
{
    use Snowflake;

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

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'uuid', 'name', 'prov_id', 'prov_name', 'city_id', 'city_name', 'county_id', 'county_name', 'road', 'address', 'postcode', 'lat', 'lng', 'info', 'legal_person', 'office_phone', 'level', 'create_date'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'prov_id' => 'integer', 'city_id' => 'integer', 'county_id' => 'integer', 'level' => 'integer'];

    protected string $primaryKey = "id";

    /**
     * 获取信息-多条
     * @param array $params
     * @param array $fields
     * @param string $order
     * @param string $direction
     * @return object|null
     */
    public static function getList(array $params = [], array $fields = ['*']): object|null
    {
        return self::where($params)->get($fields);
    }

    /**
     * 获取信息-单条
     * @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);
    }

}
