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']);
 }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
 public function searchDoctor($url)
 {
     $query = e(Input::get('q', ''));
     if (!$query && $query == '') {
         return Response::json(array(), 400);
     }
     $doctor = doctor::searchDoctorByName($query)->take(5)->get(array('doctor.userId', 'name', 'surname'));
     $doctor = $this->appendClass($doctor, 'doctor');
     $doctor = $this->appendUrl($doctor, $url);
     return Response::json(array('data' => $doctor));
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 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();
 }
Exemplo n.º 6
0
 public function addHospitalStaffByAdminStore(Request $request)
 {
     $input = $request->all();
     $user = User::create($input);
     $hospitalStaff = $input;
     $hospitalStaff['userId'] = $user->userId;
     $hospitalStaff = hospitalStaff::create($hospitalStaff);
     if ($input['userType'] == "doctor") {
         $doctor = $input;
         $doctor['userId'] = $user->userId;
         $doctor = doctor::create($doctor);
     }
     if ($input['userType'] == "staff") {
         $staff = $input;
         $staff['userId'] = $user->userId;
         $staff = staff::create($staff);
     }
     // send set password e-mail
     return redirect('/');
 }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
 public function viewDoctorScheduleByStaff($doctorId)
 {
     $doctor = doctor::where('userId', $doctorId)->first();
     $dt = schedule::getDateTimeToCalendar($doctorId);
     return view('staff.doctorScheduleByStaff')->with('calendar2', $dt)->with('doctor', $doctor);
 }
Exemplo n.º 9
0
 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;
 }
Exemplo n.º 10
0
 public static function doctorSortByName()
 {
     return doctor::join('users', 'doctor.userId', '=', 'users.userId')->orderBy('name', 'asc')->orderBy('surname', 'asc')->join('hospitalStaff', 'doctor.userId', '=', 'hospitalStaff.userId')->join('department', 'hospitalStaff.departmentId', '=', 'department.departmentId');
 }
Exemplo n.º 11
0
 public function signupdoc(Request $request)
 {
     $this->validate($request, ["name" => "required|min:2", "password" => "required|min:8", "hospital" => "required", "speciality" => "required"]);
     $input = $_POST;
     $doc = new doctor();
     $doc->name = $input["name"];
     $doc->password = Hash::make($input["password"]);
     $doc->hospital = $input["hospital"];
     $doc->save();
     if (session("hospid") == $doc->hospital) {
         $ldoc = new ldoctor();
         $ldoc->id = $doc->id;
         $ldoc->name = $doc->name;
         $ldoc->speciality = $input["speciality"];
         $ldoc->save();
     }
     return redirect("doctor/");
 }