/**
  * @param $id
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function patient($id)
 {
     $patient = Patient::where('BCI_ID', $id)->first();
     $eventSpecialties = new EventSpecialtyCode();
     if ($patient == null) {
         return view('frontend/patient/notFound');
     }
     $patientEvents = $patient->getEvents();
     // This will be used to return patient data
     // The id here will be inserted into the template to post to the above function
     // That will then be rendered onto the patients page
     return view('frontend/patient/timeline', array('patientId' => $id, 'patientEvents' => $patientEvents, 'timeLineClusterMaxSettings' => TimeLineSettings::where('setting_code', 'cluster_max')->first(), 'activeSpecialties' => $eventSpecialties->getEnabledEventSpecialties(), 'patient' => $patient));
 }
 /**
  * @return array
  * @throws Exception
  */
 public function getEvents()
 {
     $patientData = array();
     foreach ($this->events() as $event) {
         $clinicalEvent = new EventSpecialtyCode();
         $content = $event->EVENT_DETAIL != '' ? $event->EVENT_DETAIL : 'Unknown';
         if ($clinicalEvent->checkEventIsNotExcluded($event->CLINICAL_SPECIALTY)) {
             $dateTime = explode(' ', $event->EVENT_DATE);
             $dateArray = explode('-', $dateTime[0]);
             $timeArray = explode(':', $dateTime[1]);
             $patientData[] = array('content' => $content, 'start' => array('year' => $dateArray[0], 'month' => $dateArray[1], 'day' => $dateArray[2], 'hour' => $timeArray[0], 'minute' => $timeArray[1], 'second' => 0), 'group' => $event->CLINICAL_SPECIALTY, 'cssClass' => str_replace(' ', '-', $event->CLINICAL_SPECIALTY), 'type' => 'box', 'id' => $event->UNIQUE_ID);
         }
     }
     return $patientData;
 }
 /**
  * @param Request $request
  * @return mixed
  */
 public function updateSpecialtySetting(Request $request)
 {
     $event = EventSpecialtyCode::where('id', $request->input('specialtyId'))->first();
     $return = $event->updateEventStatus();
     return response(json_encode($return['responseBody']), $return['status'])->header('Content-Type', 'application/json');
 }