MedicalCareDoctorAppointment.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace app\admin\model;
  3. use support\Db;
  4. use support\Model;
  5. /**
  6. * 医疗服务-医生每天预约数量设置
  7. * Class MedicalCareSubject
  8. * @package app\admin\model
  9. */
  10. class MedicalCareDoctorAppointment extends Model
  11. {
  12. const DEL_NO = 0;
  13. const DEL_YES = 1;
  14. const APPOINTMENT_DEL = [
  15. self::DEL_NO => '未删除',
  16. self::DEL_YES => '已删除'
  17. ];
  18. const WORK_MONDAY = '一';
  19. const WORK_TUESDAY = '二';
  20. const WORK_WEDNESDAY = '三';
  21. const WORK_THURSDAY = '四';
  22. const WORK_FRIDAY = '五';
  23. const WORK_SATURDAY = '六';
  24. const WORK_SUNDAY = '日';
  25. const WORK_TIME = [
  26. self::WORK_MONDAY => 'appointment_monday',
  27. self::WORK_TUESDAY => 'appointment_tuesday',
  28. self::WORK_WEDNESDAY => 'appointment_wednesday',
  29. self::WORK_THURSDAY => 'appointment_thursday',
  30. self::WORK_FRIDAY => 'appointment_friday',
  31. self::WORK_SATURDAY => 'appointment_saturday',
  32. self::WORK_SUNDAY => 'appointment_sunday'
  33. ];
  34. const WORK_TIME_ARR = ['一', '二', '三', '四', '五', '六', '日'];
  35. /**
  36. * The table associated with the model.
  37. *
  38. * @var string
  39. */
  40. protected $table = 'medical_care_doctor_appointment';
  41. public $timestamps = false;
  42. /**
  43. * Notes:获取医生设置详情
  44. * @param int $doctor_id
  45. * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
  46. * User: yym
  47. * Date: 2022/9/27
  48. */
  49. public static function getDoctorAppointment(int $doctor_id)
  50. {
  51. return static::where(['appointment_doctor_id' => $doctor_id, 'appointment_del' => static::DEL_NO])->first();
  52. }
  53. /**
  54. * Notes:插入数据
  55. * @param array $data
  56. * @return int
  57. * User: yym
  58. * Date: 2022/9/27
  59. */
  60. public static function insertData(array $data)
  61. {
  62. return static::insertGetId($data);
  63. }
  64. /**
  65. * Notes:更新数据
  66. * @param int $doctor_id
  67. * @param array $data
  68. * @return int
  69. * User: yym
  70. * Date: 2022/9/27
  71. */
  72. public static function updateData(int $doctor_id, array $data)
  73. {
  74. return static::where(['appointment_doctor_id' => $doctor_id])->update($data);
  75. }
  76. }