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 createBaseAppointment() { $date = Carbon::now()->format('d/m/Y'); $start_hour = Carbon::now()->format('H'); $start_minute = Carbon::now()->format('i'); $end_hour = Carbon::now()->addHour()->format('H'); $end_minute = Carbon::now()->addHour()->format('i'); $appointment = Appointment::addNew(2, 'Base Treatments', $this->id, $this->dentist_id, $date, $start_hour, $start_minute, $end_hour, $end_minute, 'Automatically created during base charting', '0', '1', ''); $appointment->base_appointment = 1; $appointment->save(); return $appointment; }
public function doAddCoTAppointment(Request $request) { $treatment_plan = TreatmentPlan::findOrFail($request->cot_id); $appointment = Appointment::addNew(2, 'CoT #' . $treatment_plan->id, $treatment_plan->patient_id, $treatment_plan->patient->dentist_id, '', '', '', '', '', '', $treatment_plan->id, '0', $treatment_plan->appointments->count() + 1); $vars = ["appointment" => $appointment, "last_appointment" => true, "first_appointment" => false]; $response = ["appointment" => $appointment, "html" => view('backend.partials.cot-appointment-row')->with($vars)->render()]; header('Content-Type: application/json'); return json_encode($response); }