12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace app\admin\model;
- use app\admin\controller\medical\Subject;
- use support\Db;
- use support\Model;
- /**
- * 医疗产品
- * Class Users
- * @package app\admin\model
- */
- class AppointmentLog extends Model
- {
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected $table = 'medical_care_appointment_log';
- public $timestamps = false;
- /**
- * Notes:获取产品预约列表
- * @param int $page
- * @param int $limit
- * @return array
- * User: QJF
- * Date: 2022/10/22
- */
- public static function geMentLogList(int $page, int $limit)
- {
- $list = static::select('*')
- ->with(['User','Appointment','Subject','Salesman','Visit','DocTor'])
- ->orderBy('log_create_time','DESC')
- ->forPage($page, $limit)
- ->get();
- $count = static::count();
- return [$list, $count];
- }
- //关联用户
- public function User(){
- return $this->belongsTo(User::class,'log_user_id','user_id');
- }
- //关联预约产品
- public function Appointment(){
- return $this->belongsTo(Appointment::class,'log_appointment_id','appointment_id');
- }
- //关联预约科目
- public function Subject(){
- return $this->belongsTo(MedicalCareSubject::class,'log_subject_id','subject_id');
- }
- //关联业务编号
- public function Salesman(){
- return $this->belongsTo(MedicalCareSalesman::class,'log_salesman_id','salesman_id');
- }
- //关联就诊人
- public function Visit(){
- return $this->belongsTo(UserVisit::class,'log_user_visit_id','visit_id');
- }
- //关联医生
- public function DocTor(){
- return $this->belongsTo(MedicalCareDoctor::class,'log_doctor_id','doctor_id');
- }
- //创建时间
- public function getLogtCreateTimeAttribute($value)
- {
- return date('Y-m-d H:i:s', $value);
- }
- //分配时间
- public function getLogDistributionTimeAttribute($value)
- {
- return date('Y-m-d H:i:s', $value);
- }
- //支付时间
- public function getLogPayTimeAttribute($value){
- return date('Y-m-d H:i:s', $value);
- }
- }
|