MedicalDoctor.php 717 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace app\model;
  3. use support\Model;
  4. class MedicalDoctor extends Model
  5. {
  6. protected $table = 'medical_doctor';
  7. protected $primaryKey = 'doctor_id';
  8. protected $dateFormat = 'U';
  9. public const CREATED_AT = 'doctor_addTime';
  10. public const UPDATED_AT = 'doctor_updateTime';
  11. public function serializeDate(\DateTimeInterface $date)
  12. {
  13. return $date->format('Y-m-d H:i:s');
  14. }
  15. public function dept(){
  16. return $this->hasOne(SysDept::class,'dept_id','doctor_dept_id')->select('dept_id','dept_name');
  17. }
  18. public function user(){
  19. return $this->hasOne(SysUser::class,'user_id','join_doctor_user_id')
  20. ->select('user_id','user_name');
  21. }
  22. }