public function util_keepresult(Request $request)
 {
     $docname = $request->newdocname;
     $docdep = $request->newdocdep;
     $doctorsarray = Doctor::where(['doctor_name' => $docname, 'department_id' => $docdep])->get();
     return view('admin/doctor/doctor')->with('doctors', $doctorsarray);
 }
Example #2
0
 /**
  * Show the application welcome screen to the user.
  *
  * Api for the application
  * 
  * @return Json response
  */
 public function index()
 {
     if (Request::get('task') == "doctorCity") {
         $city = Request::get('city');
         if (is_null($city)) {
             return response()->json(['message' => 'you should pass the paramater city', 'code' => 'error']);
         }
         $doctors = null;
         $doctors = Doctor::where('city', 'LIKE', "%{$city}%")->select('first_name', 'last_name', 'specialization', 'hospital', 'phone')->get();
         return response()->json(['doctors' => $doctors, 'code' => 'ok', 'count' => sizeof($doctors)]);
     } elseif (Request::get('task') == "doctorspecialization") {
         $specialization = Request::get('specialization');
         if (is_null($specialization)) {
             return response()->json(['message' => 'you should pass the paramater specialization', 'code' => 'error']);
         }
         $doctors = null;
         $doctors = Doctor::where('specialization', 'LIKE', "%{$specialization}%")->select('first_name', 'last_name', 'specialization', 'hospital', 'phone')->get();
         return response()->json(['doctors' => $doctors, 'code' => 'ok', 'count' => sizeof($doctors)]);
     } elseif (Request::get('task') == "doctorhospital") {
         $hospital = Request::get('hospital');
         if (is_null($hospital)) {
             return response()->json(['message' => 'you should pass the paramater hospital', 'code' => 'error']);
         }
         $doctors = null;
         $doctors = Doctor::where('hospital', 'LIKE', "%{$hospital}%")->select('first_name', 'last_name', 'specialization', 'hospital', 'phone')->get();
         return response()->json(['doctors' => $doctors, 'code' => 'ok', 'count' => sizeof($doctors)]);
     } else {
         return response()->json(['message' => 'you should pass the paramater task', 'code' => 'error']);
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $province_id = Input::get('province_id');
     $city_id = Input::get('city_id');
     $specialization_id = Input::get('specialization_id');
     $verified = Input::get('verified');
     $data = array();
     if (empty($province_id) && empty($city_id) && empty($specialization_id) && empty($verified)) {
         //menampilkan semua gender
         $data['content'] = \App\Doctor::all();
         $data['province_id'] = null;
         $data['city_id'] = null;
         $data['specialization_id'] = null;
         $data['verified'] = null;
     } else {
         $data['content'] = \App\Doctor::where('city_id', $city_id)->where('specialization_id', $specialization_id)->where('verified', $verified)->get();
         $data['province_id'] = $province_id;
         $data['city_id'] = $city_id;
         $data['specialization_id'] = $specialization_id;
         $data['verified'] = $verified;
     }
     $data['list_province'] = \App\Province::lists('name', 'id');
     $data['list_city'] = \App\City::lists('name', 'id');
     $data['list_specialization'] = \App\Specialization::lists('name', 'id');
     return view('pages.admin.doctor.index')->with('data', $data);
 }
Example #4
0
 public function approveDoctor($doctorId)
 {
     try {
         Doctor::where('userId', $doctorId)->update(['isVerified' => true]);
     } catch (\Exception $e) {
         return array('error' => ['message' => 'Error in updating object', 'code' => 101]);
     }
     return response()->json(['result' => 'success']);
 }
Example #5
0
 public function activateAccount($code)
 {
     $doctor = Doctor::where('activation_code', $code)->first();
     if ($doctor) {
         $doctor->update(['verified' => 1, 'activation_code' => NULL]);
         Auth::login($doctor);
         return true;
     }
 }
 public function fuzzyQuery(Request $request)
 {
     $this->validate($request, ['keyword' => 'required|max:255']);
     $keyword = $request->get('keyword');
     $hospitals = Hospital::where('hospital_name', 'like', "%{$keyword}%")->orwhere('city', 'like', "%{$keyword}%")->orwhere('hospital_level', 'like', "%{$keyword}%")->orwhere('description', 'like', "%{$keyword}%")->get();
     $departments = Department::where('department_name', 'like', "%{$keyword}%")->orwhere('department_description', 'like', "%{$keyword}%")->get();
     $doctors = Doctor::where('doctor_name', 'like', "%{$keyword}%")->orwhere('doctor_level', 'like', "%{$keyword}%")->orwhere('doctor_description', 'like', "%{$keyword}%")->get();
     $response = ['hospitals' => $hospitals, 'department' => $departments, 'doctors' => $doctors];
     return json_encode($response);
 }
Example #7
0
 public function searchProfile($name)
 {
     $name = urldecode($name);
     $data = array();
     $data['article'] = \App\ArticleCategory::with('articles')->get();
     $data['content'] = \App\Doctor::where('name', 'like', '%' . $name . '%')->first();
     if (empty($data['content'])) {
         return redirect()->route('home');
     }
     $data['schedule'] = [];
     for ($i = 0; $i <= 7; $i++) {
         $data['schedule'][$i] = [];
     }
     $schedules = \App\Schedule::where('doctor_id', $data['content']->id)->whereBetween('date', array(date("Y-m-d"), date("Y-m-d", strtotime("+1 week"))))->orderBy('date', 'asc')->orderBy('schedule_start', 'asc')->get();
     foreach ($schedules as $schedule) {
         $len = 60 * 60 * 24;
         $now = date("Y-m-d");
         $tmp = $schedule->date;
         if ((strtotime($tmp) - strtotime($now)) / $len == 0) {
             array_push($data['schedule'][0], $schedule);
         } else {
             if ((strtotime($tmp) - strtotime($now)) / $len == 1) {
                 array_push($data['schedule'][1], $schedule);
             } else {
                 if ((strtotime($tmp) - strtotime($now)) / $len == 2) {
                     array_push($data['schedule'][2], $schedule);
                 } else {
                     if ((strtotime($tmp) - strtotime($now)) / $len == 3) {
                         array_push($data['schedule'][3], $schedule);
                     } else {
                         if ((strtotime($tmp) - strtotime($now)) / $len == 4) {
                             array_push($data['schedule'][4], $schedule);
                         } else {
                             if ((strtotime($tmp) - strtotime($now)) / $len == 5) {
                                 array_push($data['schedule'][5], $schedule);
                             } else {
                                 if ((strtotime($tmp) - strtotime($now)) / $len == 6) {
                                     array_push($data['schedule'][6], $schedule);
                                 } else {
                                     if ((strtotime($tmp) - strtotime($now)) / $len == 7) {
                                         array_push($data['schedule'][7], $schedule);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return view('frontend.pages.home.search-profile', compact('data'));
 }
Example #8
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $wanted = user::where('id', $id)->first();
     if (is_null($wanted)) {
         return "Not Found";
     } else {
         $doctor = Doctor::where('email', '=', $wanted->email)->first();
         $count = tickets::where('userid', $wanted->id)->count();
         $countAppointment = doctorSchedule::where('uid', '=', $wanted->id)->count();
         if (is_null($doctor)) {
             return view('user.profileview')->with('user', Session::get('user'))->with('viewing', $wanted)->with('ticketCount', $count)->with('appointmentCount', $countAppointment);
         } else {
             return view('user.profileview')->with('user', Session::get('user'))->with('viewing', $wanted)->with('doctor', $doctor)->with('ticketCount', $count)->with('appointmentCount', $countAppointment);
         }
     }
 }
 public function getIdByUsername()
 {
     $doctor = Doctor::where('strUsername', $this->strUsername)->first();
     return $doctor->doctorId;
 }
Example #10
0
 /**
  *
  * show the available slots for spefic doctor
  * @return view
  */
 public function show($id)
 {
     $doctor = null;
     $userRequested = null;
     $doctor = Doctor::where('id', $id)->first();
     if (!is_null($doctor)) {
         $userRequested = user::where('email', '=', $doctor->email)->first();
         if (!is_null($userRequested)) {
             $timeSlots = Timeslots::where('doctor_id', '=', $doctor->id)->first();
             if (!is_null($timeSlots) && $doctor->available == 1) {
                 //getting the time period
                 $period = explode(".", $timeSlots->period);
                 if (count($period) != 2) {
                     return view('user.appointmetns.place')->with('user', Session::get('user'))->with('userReq', $userRequested)->with('doctor', $doctor);
                 }
                 $periodMinutes = $period[1];
                 $periodHours = $period[0];
                 $periodMinutes = $periodMinutes + $periodHours * 60;
                 // end of the processing the time format initialiation
                 $dt = Carbon::now('Asia/Colombo');
                 $dt->second = 0;
                 //$dt = Carbon::parse('2012-9-6 23:26:11.123789');
                 $dayCount = 0;
                 $dt->addDays(2);
                 $timetable = array();
                 $timevals = array();
                 while ($dayCount < 7) {
                     $day = array();
                     if ($dt->dayOfWeek == 1) {
                         //echo "monday<br>";
                         $day = $this->stringDateToArray($timeSlots->monday);
                     } elseif ($dt->dayOfWeek == 2) {
                         $day = $this->stringDateToArray($timeSlots->tuesday);
                         //echo "tuesday<br>";
                     } elseif ($dt->dayOfWeek == 3) {
                         $day = $this->stringDateToArray($timeSlots->wednesday);
                         //echo "wedensday<br>";
                     } elseif ($dt->dayOfWeek == 4) {
                         $day = $this->stringDateToArray($timeSlots->thursday);
                         //echo "Thursday<br>";
                     } elseif ($dt->dayOfWeek == 5) {
                         $day = $this->stringDateToArray($timeSlots->friday);
                         //echo "Friday<br>";
                     } elseif ($dt->dayOfWeek == 6) {
                         $day = $this->stringDateToArray($timeSlots->saturday);
                         //echo "Saturday<br>";
                     } elseif ($dt->dayOfWeek == 0) {
                         $day = $this->stringDateToArray($timeSlots->sunday);
                         //echo "Sunday<br>";
                     }
                     if (count($day) != 4) {
                         $dt->addDay();
                         $dayCount++;
                         continue;
                     }
                     $cancelTimeDb = cancelSlots::where('did', '=', $doctor->id)->where('slotdate', '=', $dt->toDateString())->first();
                     $tempCancel = $this->stringDateToArray("0.00-0.00");
                     if (!is_null($cancelTimeDb)) {
                         $tempCancel = $this->stringDateToArray($cancelTimeDb->time);
                         if (count($tempCancel) != 4) {
                             $tempCancel = $this->stringDateToArray("0.00-0.00");
                         }
                     }
                     $key = $dt->toDateString();
                     $returnArray = array();
                     $returnArray = $this->timeCal($day, $tempCancel, $periodMinutes, $dt, $doctor->id);
                     //$timetable[$key]=$this->timeCal($day,$tempCancel,$periodMinutes,$dt,$doctor->id);
                     $timetable[$key] = $returnArray['times'];
                     $timevals[$key] = $returnArray['vals'];
                     $dt->addDay();
                     $dayCount++;
                 }
                 Session::put('requestedDoctor', $doctor->id);
                 Session::put('timeval', $timevals);
                 return view('user.appointmetns.place')->with('user', Session::get('user'))->with('userReq', $userRequested)->with('doctor', $doctor)->with('timetable', $timetable)->with('timevals', $timevals);
             } else {
                 return view('user.appointmetns.place')->with('user', Session::get('user'))->with('userReq', $userRequested)->with('doctor', $doctor);
             }
             return view('user.appointmetns.place')->with('user', Session::get('user'))->with('userReq', $userRequested)->with('doctor', $doctor);
         }
     }
     return view('user.appointmetns.place')->with('user', Session::get('user'));
 }
 /**
  *	This will update the user session, it will update the users session object
  *
  *
  */
 public function updateSession()
 {
     $user = user::where('id', Session::get('userid'))->first();
     Session::put('user', $user);
     if ($user->level == 2) {
         $doctor = Doctor::where('email', '=', $user->email)->first();
         if (!is_null($doctor)) {
             Session::put('doctor', $doctor);
         }
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function getDoctor()
 {
     $doc_id = Input::get('doc_id');
     $doctors = App\Doctor::where('field', '=', $doc_id)->get();
     return Response::json($doctors);
 }
Example #13
0
 /**
  *
  * Take the response from the Google Auth and process it
  *
  **/
 public function gauth()
 {
     $user = user::where('id', Session::get('userid'))->first();
     if (!is_null($user)) {
         return Redirect::to('home');
     }
     session_start();
     if (isset($_SESSION['OAuth_email'])) {
         /**
          *
          * Checking for the sessions variables that is proceced in the FB and Google authentication php
          * files
          *
          **/
         $userEmail = $_SESSION['OAuth_email'];
         $user = user::where('email', $userEmail)->first();
         if (is_null($user)) {
             $newUser = new user();
             $newUser->email = $userEmail;
             $pass = Str::random(10);
             $newUser->password = md5($pass);
             if (isset($_SESSION['OAuth_name'])) {
                 $newUser->name = $_SESSION['OAuth_name'];
             } else {
                 $newUser->name = "User";
             }
             $newUser->level = "1";
             $newUser->active = 1;
             $newUser->verified = 0;
             if ($newUser->save()) {
                 try {
                     Mail::send('mailtemplate/sociallogin', ['name' => $newUser->name, 'pass' => $pass], function ($m) use($newUser) {
                         $m->from('*****@*****.**', 'Native Physician');
                         $m->to($newUser->email, $newUser->name)->subject('New Password!');
                     });
                 } catch (Exception $e) {
                     //echo 'Message: ' .$e->getMessage();
                 }
                 //return "Check the Email Settings or your internet connection";
             } else {
                 return "Check the Email Settings or your internet connection";
             }
             Session::put('userid', $newUser->id);
             Session::put('user', $newUser);
             return Redirect::to('profile');
         } else {
             if ($user->active == 0) {
                 Session::flush();
                 unset($_SESSION['access_token']);
                 unset($_SESSION['OAuth_email']);
                 unset($_SESSION['OAuth_name']);
                 return Redirect::to('login');
             }
             Session::put('userid', $user->id);
             Session::put('user', $user);
             if ($user->level >= 2) {
                 $doctor = Doctor::where('email', '=', $user->email)->first();
                 if (!is_null($doctor)) {
                     Session::put('doctor', $doctor);
                 }
             }
             if (is_null(Session::get('url'))) {
                 return Redirect::to('home');
             } else {
                 return Redirect::to(Session::get('url'));
             }
         }
     } else {
         Session::flush();
         unset($_SESSION['access_token']);
         unset($_SESSION['OAuth_email']);
         unset($_SESSION['OAuth_name']);
         session_regenerate_id();
         return Redirect::to('login');
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     //
     $province_id = Input::get('province_id');
     $city_id = Input::get('city_id');
     $specialization_id = Input::get('specialization_id');
     $verified = Input::get('verified');
     $data = array();
     $data['content'] = \App\Clinic::find($id);
     if (empty($province_id) && empty($city_id) && empty($specialization_id) && empty($verified)) {
         $data['content_doctor'] = \App\Doctor::whereHas('doctor_clinic', function ($q) use($id) {
             $q->where('clinic_id', $id);
         })->get();
         $data['province_id'] = null;
         $data['city_id'] = null;
         $data['specialization_id'] = null;
         $data['verified'] = null;
     } else {
         $data['content_doctor'] = \App\Doctor::where('city_id', $city_id)->where('specialization_id', $specialization_id)->where('verified', $verified)->whereHas('doctor_clinic', function ($q) use($id) {
             $q - $q->where('clinic_id', $id);
         })->get();
         $data['province_id'] = $province_id;
         $data['city_id'] = $city_id;
         $data['specialization_id'] = $specialization_id;
         $data['verified'] = $verified;
     }
     $data['list_province'] = \App\Province::lists('name', 'id');
     $data['list_city'] = \App\City::lists('name', 'id');
     $data['list_specialization'] = \App\Specialization::lists('name', 'id');
     return view('pages.admin.clinic.show', compact('data'));
 }
Example #15
0
 /**
  * Creates account and generates random password for a Formal Physician
  *
  * @return previous view
  */
 public function createDoctorCredentials()
 {
     $doctorID = Request::get('doctors');
     //$password = Str::random(10);
     $password = '******';
     $doctorInfo = Doctor::find($doctorID);
     Doctor::where('id', $doctorID)->update(['has_account' => 1]);
     $newUser = new User();
     $newUser->email = $doctorInfo->email;
     $newUser->name = $doctorInfo->first_name . ' ' . $doctorInfo->last_name;
     $newUser->password = md5($password);
     $newUser->tp = $doctorInfo->phone;
     $newUser->level = 2;
     $newUser->active = 1;
     $newUser->verified = 1;
     $newUser->save();
     Mail::send('mailtemplate/doctorPassword', ['name' => $newUser->name, 'password' => $password], function ($m) use($newUser) {
         $m->from('*****@*****.**', 'Daemon');
         $m->to($newUser->email, $newUser->name)->subject('Wedaduru Doctor Account');
     });
     return redirect()->back();
 }