<?php

namespace app\model;

use support\Model;

class MedicalDoctor extends Model
{
    protected $table = 'medical_doctor';

    protected $primaryKey = 'doctor_id';

    protected $dateFormat = 'U';

    public const CREATED_AT = 'doctor_addTime';

    public const UPDATED_AT = 'doctor_updateTime';

    public function serializeDate(\DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }
    public function dept(){
        return $this->hasOne(SysDept::class,'dept_id','doctor_dept_id')->select('dept_id','dept_name');
    }

    public function user(){
        return $this->hasOne(SysUser::class,'user_id','join_doctor_user_id')
            ->select('user_id','user_name');
    }
}