AppointmentApplication.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class AppointmentApplication extends Model
  5. {
  6. protected $updateTime = false;
  7. const STATUS_NOT_SIGN = 0;
  8. const STATUS_SIGN = 1;
  9. const STATUS_NOT_COME = 2;
  10. const STATUS = [
  11. self::STATUS_NOT_SIGN => '未签到',
  12. self::STATUS_SIGN => '已签到',
  13. self::STATUS_NOT_COME => '爽约',
  14. ];
  15. const SEX_UNKNOW = 0;
  16. const SEX_MAN = 1;
  17. const SEX_WOMAN = 2;
  18. const SEXS = [
  19. self::SEX_UNKNOW => '未知',
  20. self::SEX_MAN => '男',
  21. self::SEX_WOMAN => '女'
  22. ];
  23. //sex_text
  24. public function getSexTextAttr($value, $data)
  25. {
  26. return self::SEXS[$data['sex']]??'';
  27. }
  28. //finish_time
  29. public function getFinishTimeAttr($value, $data)
  30. {
  31. return $value ? date('Y-m-d H:i:s', $value) : '';
  32. }
  33. //status_text
  34. public function getStatusTextAttr($value, $data)
  35. {
  36. return self::STATUS[$data['status']]??'';
  37. }
  38. //关联地址
  39. public function address()
  40. {
  41. return $this->belongsTo('Address');
  42. }
  43. //关联专家
  44. public function specialist()
  45. {
  46. return $this->belongsTo('Specialist', 'provider_id');
  47. }
  48. }