Beispiel #1
0
 public static function newAppointmentByDoctor($input, $doctorId, $patientId)
 {
     $newDiagDate = scheduleLog::changeDateFormat($input['nextAppDate']);
     $schedule = schedule::join('scheduleLog', 'schedule.scheduleLogId', '=', 'scheduleLog.scheduleLogId')->where('scheduleLog.doctorId', $doctorId)->where('schedule.diagDate', $newDiagDate)->where('schedule.diagTime', $input['nextAppTime'])->first();
     if ($schedule != null) {
         $appointment = new appointment();
         $appointment->patientId = $patientId;
         $appointment->scheduleId = $schedule->scheduleId;
         $appointment->symptom = $input['nextAppDetail'];
         $appointment->save();
     }
     return $schedule;
 }
Beispiel #2
0
 public function appointmentSorted()
 {
     // return appointment::where('appointment.patientId', '=', $this->userId)
     //            ->join('schedule', 'appointment.scheduleId', '=', 'schedule.scheduleId')
     //            ->orderBy('schedule.diagDate', 'asc')
     //            ->orderBy('schedule.diagTime', 'asc')
     //            ->get();
     return schedule::join('appointment', 'schedule.scheduleId', '=', 'appointment.scheduleId')->where('appointment.patientId', '=', $this->userId)->where('schedule.diagDate', '>', Carbon::now())->orderBy('schedule.diagDate', 'asc')->orderBy('schedule.diagTime', 'asc')->get();
 }
Beispiel #3
0
 public static function getDateTimeToCalendar($userId)
 {
     $query = schedule::join('scheduleLog', 'schedule.scheduleLogId', '=', 'scheduleLog.scheduleLogId')->where('scheduleLog.doctorId', $userId)->get();
     $arr = [];
     foreach ($query as $schedule) {
         $st = "'" . $schedule->getOriginal('diagDate') . '-' . $schedule->getOriginal('diagTime') . "'";
         array_push($arr, $st);
     }
     $textArr = implode(", ", $arr);
     $textArr = "[" . $textArr . "]";
     return $textArr;
 }