public function showDiagnosisHistory(Request $request) { $input = $request->all(); $doctor = doctor::where('userId', Auth::user()->userId)->first(); $stats = $doctor->getDiagStats($input['year'] - 543, $input['month']); return view('doctor.showDiagnosisHistory')->with('stats', $stats)->with('year', $input['year'])->with('month', schedule::getMonthName($input['month']))->with('rawYear', $input['year'] - 543)->with('rawMonth', $input['month']); }
public function showDiagnosisHistoryPdf($year, $month) { $doctor = doctor::where('userId', Auth::user()->userId)->first(); $stats = $doctor->getDiagStats($year, $month); $data = ['month' => schedule::getMonthName($month), 'date' => schedule::formatDiagDate(Carbon::now()->format('Y-m-d')), 'doctorName' => $doctor->fullname(), 'department' => $doctor->department()->departmentName, 'diag' => $stats]; $pdf = PDF::loadView('doctor/showDiagnosisHistoryPdf', $data)->setOption('page-size', 'A4'); return $pdf->stream(); }
public function testfunc() { echo '<!DOCTYPE html> <meta charset="utf-8">'; $pp = patient::where('userId', 3)->first(); $app = appointment::where('appointmentId', 1)->first(); $doc = doctor::where('userId', 4)->first(); $schedule = schedule::where('scheduleId', 1)->first(); $dep = department::where('departmentId', 2)->first(); // $doc->getScheduleInRange(2015, 12); $results = $doc->getDiagStats(2015, 12); foreach ($results as $date) { echo $date['date'] . ' ' . $date['morning'] . ' ' . $date['afternoon'] . ' ' . $date['sum'] . '<br>'; } // return view('testSearch')->with('patient', $pp)->with('ap', $app)->with('doctor', $doc)->with('sc', $schedule)->with('idd', $schedule->scheduleId)->with('department', $dep); }
public static function deleteStaff($staffId) { $user = user::where('userId', $staffId)->first(); if ($user->userType == 'doctor') { $doctor = doctor::where('userId', $staffId)->first(); $doctor->delete(); } else { if ($user->userType == 'staff') { $staff = staff::where('userId', $staffId)->first(); $staff->delete(); } } $hospitalStaff = hospitalStaff::where('userId', $staffId)->first(); $hospitalStaff->delete(); $user->delete(); }
public function editDoctorProfile(Request $request) { $input = $request; $doctor = doctor::where('userId', Auth::user()->userId)->first(); $doctor->editDoctorProfile($input); return redirect('doctorProfile'); }
public static function viewDoctorAppointment($doctorId) { $appointments = doctor::where('doctor.userId', $doctorId)->join('scheduleLog', 'doctor.userId', '=', 'scheduleLog.doctorId')->join('schedule', 'scheduleLog.scheduleLogId', '=', 'schedule.scheduleLogId')->join('appointment', 'schedule.scheduleId', '=', 'appointment.scheduleId')->join('users', 'appointment.patientId', '=', 'users.userId')->get(); return $appointments; }
public function viewDoctorScheduleByStaff($doctorId) { $doctor = doctor::where('userId', $doctorId)->first(); $dt = schedule::getDateTimeToCalendar($doctorId); return view('staff.doctorScheduleByStaff')->with('calendar2', $dt)->with('doctor', $doctor); }
public static function requestDate($input) { // get appointment from a department or a doctor if ($input['doctorId'] != '0') { $doctor = doctor::where('userId', $input['doctorId'])->first(); $schedule = $doctor->schedules()->join('users', 'scheduleLog.doctorId', '=', 'users.userId'); } else { if ($input['departmentId'] != '0') { $schedule = schedule::join('scheduleLog', 'schedule.scheduleLogId', '=', 'scheduleLog.scheduleLogId')->join('doctor', 'scheduleLog.doctorId', '=', 'doctor.userId')->join('hospitalStaff', 'doctor.userId', '=', 'hospitalStaff.userId')->join('users', 'hospitalStaff.userId', '=', 'users.userId')->join('department', 'hospitalStaff.departmentId', '=', 'department.departmentId')->where('department.departmentId', $input['departmentId']); } } // get appointment from specific date or choose only the fastest appointment if ($input['date'] == '') { $appointments = $schedule->where('diagDate', '>', Carbon::now())->orderBy('diagDate', 'asc')->orderBy('diagTime', 'asc')->orderBy('name', 'asc')->orderBy('surname', 'asc')->take(10)->get(); } else { $input['date'] = scheduleLog::changeDateFormat($input['date']); $appointments = $schedule->where('diagDate', $input['date'])->orderBy('diagTime', 'asc')->orderBy('name', 'asc')->orderBy('surname', 'asc')->get(); } return $appointments; }