示例#1
0
 public function getPatientChart($id, $cot_id = 0)
 {
     $patient = Patient::findOrFail($id);
     $patient->checkTeethData();
     $treatment_plans = TreatmentPlanRepository::forPatient($patient);
     if ($treatment_plans->count() == 0) {
         $treatment_plans->push($patient->createTreatmentPlan());
     }
     if ($cot_id) {
         $active_treatment_plan = TreatmentPlan::find($cot_id);
     } else {
         $active_treatment_plan = $treatment_plans->first();
     }
     if (!is_object($active_treatment_plan)) {
         return redirect()->to(url('patient/' . $patient->id . '/chart'));
     }
     $treatments = Treatment::all();
     $recent_treatments = Auth::user()->getRecentChartingTreatments();
     $favourite_treatments = Auth::user()->getFavouriteChartingTreatments();
     $templates = TreatmentTemplate::all();
     $charting_images = $patient->getChartingImages();
     $base_treatments = [];
     foreach ($patient->appointments as $appointment) {
         foreach ($appointment->treatments()->wherePivot('completed', 1)->get() as $treatment) {
             $base_treatments[] = $treatment;
         }
     }
     view()->share('show_patient_nav', true);
     $vars = array('current_nav' => 3, 'patient' => $patient, 'treatments' => $treatments, 'recent_treatments' => $recent_treatments, 'favourite_treatments' => $favourite_treatments, 'templates' => $templates, 'treatment_plans' => $treatment_plans, 'active_treatment_plan' => $active_treatment_plan, 'base_treatments' => $base_treatments, 'charting_images' => $charting_images);
     return view('backend.page.patient-chart')->with($vars);
 }
示例#2
0
 protected function setTreatment(Request $request)
 {
     if ($request->isMethod('post')) {
         $data = $request->input();
         $treatment = Treatment::create(['organization_id' => $data['organization_id'], 'user_id' => $data['user_id'], 'therapist_id' => $data['therapist_id'], 'description' => $data['description']]);
         return json_encode(array('message' => 'ok'));
     }
 }
 public static function forSearchTerm($search_term)
 {
     return Treatment::where('name', 'LIKE', '%' . $search_term . '%')->orderBy('created_at', 'asc')->get();
 }
 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);
 }
示例#5
0
 public function getAllTherapistTreatments($therapistId)
 {
     $treatments = Treatment::where('therapist_id', '=', $therapistId);
     return $treatments;
 }
 /**
  * Inserts a new Treatment into the Pending Treatments table
  *
  */
 public function insertNew()
 {
     $input = Request::all();
     $user = Session::get('user');
     $Treatment = new DoctorTreatment();
     $Treatment->name = Request::get('tname');
     $Treatment->doctor_id = $user->id;
     $Treatment->description = Request::get('description');
     $Treatment->conditions1 = Request::get('wsigns');
     $Treatment->conditions2 = Request::get('condition');
     $Treatment->save();
     if (\Input::hasFile('image1')) {
         $file = \Input::file('image1');
         $format = explode('.', $file->getClientOriginalName());
         $filepath = 'uploads/treatments/' . $Treatment->id . '-1.' . $format[sizeof($format) - 1];
         $file->move('uploads/treatments', $Treatment->id . '-1.' . $format[sizeof($format) - 1]);
         $Treatment->image1 = Request::get('image1');
         DoctorTreatment::where('id', $Treatment->id)->update(['image1' => $filepath]);
     }
     if (\Input::hasFile('image2')) {
         $file = \Input::file('image2');
         $format = explode('.', $file->getClientOriginalName());
         $filepath = 'uploads/treatments/' . $Treatment->id . '-2.' . $format[sizeof($format) - 1];
         $file->move('uploads/treatments', $Treatment->id . '-2.' . $format[sizeof($format) - 1]);
         $Treatment->image1 = Request::get('image2');
         DoctorTreatment::where('id', $Treatment->id)->update(['image2' => $filepath]);
     }
     if (\Input::hasFile('image3')) {
         $file = \Input::file('image3');
         $format = explode('.', $file->getClientOriginalName());
         $filepath = 'uploads/treatments/' . $Treatment->id . '-3.' . $format[sizeof($format) - 1];
         $file->move('uploads/treatments', $Treatment->id . '-3.' . $format[sizeof($format) - 1]);
         $Treatment->image1 = Request::get('image3');
         DoctorTreatment::where('id', $Treatment->id)->update(['image3' => $filepath]);
     }
     if (\Input::hasFile('image4')) {
         $file = \Input::file('image4');
         $format = explode('.', $file->getClientOriginalName());
         $filepath = 'uploads/treatments/' . $Treatment->id . '-4.' . $format[sizeof($format) - 1];
         $file->move('uploads/treatments', $Treatment->id . '-4.' . $format[sizeof($format) - 1]);
         $Treatment->image1 = Request::get('image4');
         DoctorTreatment::where('id', $Treatment->id)->update(['image4' => $filepath]);
     }
     $treatments = Treatment::all();
     return redirect()->back()->with('message', 'Successfully Entered!');
 }
 /**
  * Display specified treatment.
  *
  * @param $slug
  * @return \Illuminate\View\View
  */
 public function show($slug)
 {
     $treatment = Treatment::whereSlug($slug)->firstOrFail();
     return view('pages.treatments.show', compact('treatment'));
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Treatment::create(['name' => 'Roller Shades', 'description' => 'A simple and elegant way to cover your windows. Both practical and stylish, roller shades are available in over 200 exclusive materials.']);
     Treatment::create(['name' => 'Solar Shades', 'description' => 'Glare reduction and UV protection. Choose solar shades to make the sun a little more manageable. 80 eco-friendly materials available.']);
 }
示例#9
0
 public function getFavouriteChartingTreatments()
 {
     $treatments = new Collection();
     $ids = DB::table('user_favourite_treatments')->select('treatment_id')->where('user_id', $this->id)->orderBy('created_at', 'desc')->get();
     foreach ($ids as $id) {
         if (Treatment::where('id', $id->treatment_id)->count() > 0) {
             $treatment = Treatment::findOrFail($id->treatment_id);
             $treatments->push($treatment);
         }
     }
     return $treatments;
 }