/** * Display the specified resource. * * @param int $id * @return Responsenew */ public function show($id) { $i = 0; $patient = Patient::findOrFail($id); $userDetails = \Auth::user(); return view('doctor.patientTimeline', compact('patient', 'i')); }
public function getAlerts($request) { $patient_ids = array(); $today = Carbon::now(); $today->hour = 0; $today->minute = 0; $today->second = 0; $tomorrow = $today->copy()->addDay(); if ($request->session()->get('global_branch') == 'all') { foreach (Appointment::whereIn('status_id', [3, 4])->where('start_date', '>', $today)->where('end_date', '<', $tomorrow)->get() as $a) { $patient_ids[] = $a->patient_id; } } else { foreach (Appointment::whereIn('status_id', [3, 4])->where('branch_id', $request->session()->get('global_branch'))->where('start_date', '>', $tomorrow)->where('end_date', '<', $today)->get() as $a) { $patient_ids[] = $a->patient_id; } } $alerts = new Collection(); if (count($patient_ids) > 0) { foreach ($patient_ids as $id) { $patient = Patient::findOrFail($id); if ($patient->hasAlert()) { $alerts->push($patient->getAlert()); } } } view()->share('alerts', $alerts); }
public function getPatientAppointments($id) { $patient = Patient::findOrFail($id); $appointments = $patient->appointments; $response = ["appointments" => $appointments->toArray()]; header('Content-type: application/json'); die(json_encode($response)); }
public static function addNew($data) { $treatment_plan = new TreatmentPlan(); $treatment_plan->patient_id = $data['patient_id']; $treatment_plan->save(); $appointment = Appointment::addNew(2, 'CoT #' . $treatment_plan->id, $treatment_plan->patient_id, $treatment_plan->patient->dentist_id, '', '', '', '', '', '', $treatment_plan->id, '0', '1'); $patient = Patient::findOrFail($data['patient_id']); $patient->addHistoryItem("Course of Treatment Added", "A Course of Treatment has been added for this patient", Auth::user()->id, 19); return $treatment_plan; }
public function record($id, $record) { $patient = Patient::findOrFail($id); //$patient->getRecord($record); $record = $patient->getRecord($record); // $bed = $record->bed()->getBed(); // $doctor = $record->doctor()->fullName(); //dd($doctor,$bed); return view('pages.Record.show', compact('record', 'patient')); }
public function changeDentist($dentist_id) { $patient = Patient::findOrFail($this->patient_id); $dentist_obj = User::findOrFail($this->dentist_id); $new_dentist_obj = User::findOrFail($dentist_id); $patient->addHistoryItem("Appointment Dentist Changed", "The appointment on " . $this->start_date->format('d/m/Y') . " at " . $this->start_date->format('H:i') . " with <a href='" . url('user/' . $dentist_obj->id) . "'>" . $dentist_obj->first_name . " " . $dentist_obj->last_name . "</a> has been modified, it is now being performed by <a href='" . url('user/' . $new_dentist_obj->id) . "'>" . $new_dentist_obj->first_name . " " . $new_dentist_obj->last_name . "</a>", Auth::user()->id, 18); $this->dentist_id = $dentist_id; $this->save(); }
public function doAddCoT($id) { $patient = Patient::findOrFail($id); $patient->createTreatmentPlan(); return redirect()->back(); }
public function showEmail($id) { $email = Email::findOrFail($id); $mailbox = Mailbox::findOrFail($email->mailbox_id); $email->markAsRead(); if (!is_null(session('mailbox_view')) && session('mailbox_view') != 'inbox') { switch (session('mailbox_view')) { case 'favourites': $emails = $mailbox->emails()->where('favourited', 1)->orderBy('created_at', 'desc')->get(); $mailbox_heading = "Favourites"; $mailbox_icon = "star"; $mailbox_icon_color = "#454545"; break; case 'patient': $patient = Patient::findOrFail(session('mailbox_view_patient_id')); $emails = $patient->emails; $mailbox_heading = $patient->first_name . ' ' . $patient->last_name; $mailbox_icon = "user"; $mailbox_icon_color = "#454545"; view()->share('show_patient_nav', true); break; case 'tag': $tag = EmailTag::findOrFail(session('mailbox_view_tag_id')); $emails = $tag->emails; $mailbox_heading = $tag->name; $mailbox_icon = "tag"; $mailbox_icon_color = $tag->color_bg; break; case 'unread': $emails = $mailbox->emails()->where('read', 0)->orderBy('created_at', 'desc')->get(); $mailbox_heading = "Unread"; $mailbox_icon = "asterisk"; $mailbox_icon_color = "#454545"; break; default: $emails = $mailbox->emails()->orderBy('created_at', 'desc')->get(); $final_emails = new Collection(); foreach ($emails as $tmp_email) { if ($tmp_email->tags()->count() == 0) { $final_emails->push($tmp_email); } } $emails = $final_emails; $mailbox_heading = "Inbox"; $mailbox_icon = "inbox"; $mailbox_icon_color = "#454545"; break; } } else { $emails = $mailbox->emails()->orderBy('created_at', 'desc')->get(); $final_emails = new Collection(); foreach ($emails as $tmp_email) { if ($tmp_email->tags()->count() == 0) { $final_emails->push($tmp_email); } } $emails = $final_emails; $mailbox_heading = "Inbox"; $mailbox_icon = "inbox"; $mailbox_icon_color = "#454545"; } $vars = ["mailbox_icon" => $mailbox_icon, "mailbox_icon_color" => $mailbox_icon_color, "mailbox_heading" => $mailbox_heading, "active_email" => $id, "mailbox" => $mailbox, "emails" => $emails, "email" => $email, "sidebar" => true]; if (session('mailbox_view') == 'patient') { $vars['patient'] = $patient; $vars['current_nav'] = 9; } return view('backend.page.mailbox-inbox')->with($vars); }
public function doAddTreatmentToAppointment(Request $request) { if ($request->input('appointment_id') == 0) { $patient = Patient::findOrFail($request->input('patient_id')); $appointment = $patient->getBaseAppointment(); } else { $appointment = Appointment::findOrFail($request->input('appointment_id')); } $treatment = Treatment::findOrFail($request->input('treatment_id')); $appointment->addTreatment($treatment); $new_treatment = $appointment->treatments()->where('treatment_id', $treatment->id)->orderBy('pivot_created_at', 'desc')->first(); $vars = ["treatment" => $new_treatment, "patient" => $appointment->patient]; $response = ["html" => view('backend.partials.cot-appointment-treatment-row')->with($vars)->render(), "treatment" => $new_treatment->toArray(), "time_estimate" => $appointment->getEstimatedDuration()]; header('Content-Type: application/json'); return json_encode($response); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $patient = Patient::findOrFail($id); return view('nurse.triageNurse', compact('patient')); }
public function getPatientName() { $patient = Patient::findOrFail($this->alertable_id); return $patient->first_name . " " . $patient->last_name; }
public function update($id, PatientRequest $request) { $patients = Patient::findOrFail($id); $patients->update($request->all()); return redirect('dash'); }
public function doChartingImageSearch(Request $request) { $patient = Patient::findOrFail($request->input('patient_id')); $charting_images = $patient->getChartingImages($request->input('search_string')); $response = []; $html = ''; foreach ($charting_images as $i) { $vars = ["image" => $i]; $html .= view('backend.partials.charting-image-row')->with($vars)->render(); } if (!$html) { $html = '<div class="inner">No results.</div>'; } $response['html'] = $html; header('Content-Type: application/json'); die(json_encode($response)); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $pat = Patient::findOrFail($id); $pat->delete(); flash()->success('Record deleted.'); return redirect('records'); }