<?php
/**
 * Created by PhpStorm.
 * User: zilongs
 * Date: 20-9-29
 * Time: 下午2:35
 */

namespace App\Models;

class Organization extends BaseModel
{
    CONST HOSPITOAL = 1, ORGANIZATION = 2, CLINC = 3;

    protected static $_getType = [
        self::HOSPITOAL => '医院',
        self::ORGANIZATION => '机构',
        self::CLINC => '医院',
    ];

    public  static  function  getType()
    {
        return self::$_getType;
    }
    public function docter()
    {
        return $this->belongsToMany(Docter::class);
    }

    public function vaccines()
    {
        return $this->belongsToMany(Vaccines::class,'vaccines_id');
    }

    public function user()
    {
        return $this->hasOne(CdmsUsers::class,'org_id','id');
    }
    public function communityNotice()
    {
        return $this->hasOne(CommunityNotice::class, 'organization_id', 'id');
    }
    public function offices(){
        return $this->hasMany(Office::class,'org_id','id');
    }
}
