12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace app\admin\model;
- use support\Db;
- use support\Model;
- /**
- * 用户医嘱模型
- * Class Users
- * @package app\admin\model
- */
- class UserDoctorsLog extends Model
- {
- /**
- * The table associated with the model.
- *
- * @var string
- */
- protected $table = 'user_doctors_log';
- public $timestamps = false;
- /**
- * Notes:获取会员医生医嘱列表
- * @param int $log_user_id
- * @param int $page
- * @param int $limit
- * @return array
- * User: ZQ
- * Date: 2022/12/8
- */
- public static function doctorLogList(int $log_user_id, int $page, int $limit)
- {
- $list = static::where('user_doctors_log.log_user_id', '=', $log_user_id)
- ->select('user_doctors_log.*','medical_care_doctor.doctor_name','medical_care_subject.subject_name','user.user_real_name','user.user_phone')
- ->orderBy('user_doctors_log.log_add_time', 'desc')
- ->leftJoin('medical_care_doctor','doctor_id','=','user_doctors_log.log_doctor_id')
- ->leftJoin('medical_care_subject','subject_id','=','user_doctors_log.log_subject_id')
- ->leftJoin('user','user_id','=','user_doctors_log.log_user_id')
- ->forPage($page, $limit)
- ->get()
- ->toArray();
- $count = static::where('user_doctors_log.log_user_id', '=', $log_user_id)
- ->count();
- return [$list, $count];
- }
- }
|