AppointmentLog.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace app\admin\model;
  3. use app\admin\controller\medical\Subject;
  4. use support\Db;
  5. use support\Model;
  6. /**
  7. * 医疗产品
  8. * Class Users
  9. * @package app\admin\model
  10. */
  11. class AppointmentLog extends Model
  12. {
  13. /**
  14. * The table associated with the model.
  15. *
  16. * @var string
  17. */
  18. protected $table = 'medical_care_appointment_log';
  19. public $timestamps = false;
  20. /**
  21. * Notes:获取产品预约列表
  22. * @param int $page
  23. * @param int $limit
  24. * @return array
  25. * User: QJF
  26. * Date: 2022/10/22
  27. */
  28. public static function geMentLogList(int $page, int $limit)
  29. {
  30. $list = static::select('*')
  31. ->with(['User','Appointment','Subject','Salesman','Visit','DocTor'])
  32. ->orderBy('log_create_time','DESC')
  33. ->forPage($page, $limit)
  34. ->get();
  35. $count = static::count();
  36. return [$list, $count];
  37. }
  38. //关联用户
  39. public function User(){
  40. return $this->belongsTo(User::class,'log_user_id','user_id');
  41. }
  42. //关联预约产品
  43. public function Appointment(){
  44. return $this->belongsTo(Appointment::class,'log_appointment_id','appointment_id');
  45. }
  46. //关联预约科目
  47. public function Subject(){
  48. return $this->belongsTo(MedicalCareSubject::class,'log_subject_id','subject_id');
  49. }
  50. //关联业务编号
  51. public function Salesman(){
  52. return $this->belongsTo(MedicalCareSalesman::class,'log_salesman_id','salesman_id');
  53. }
  54. //关联就诊人
  55. public function Visit(){
  56. return $this->belongsTo(UserVisit::class,'log_user_visit_id','visit_id');
  57. }
  58. //关联医生
  59. public function DocTor(){
  60. return $this->belongsTo(MedicalCareDoctor::class,'log_doctor_id','doctor_id');
  61. }
  62. //创建时间
  63. public function getLogtCreateTimeAttribute($value)
  64. {
  65. return date('Y-m-d H:i:s', $value);
  66. }
  67. //分配时间
  68. public function getLogDistributionTimeAttribute($value)
  69. {
  70. return date('Y-m-d H:i:s', $value);
  71. }
  72. //支付时间
  73. public function getLogPayTimeAttribute($value){
  74. return date('Y-m-d H:i:s', $value);
  75. }
  76. }