public function forUserLoadAction(Request $request)
 {
     $id = $request->getSession()->get('userId');
     $active = $request->get('active') == "0" ? false : true;
     $collection = new PatientServiceCollection();
     $data = array();
     $data['items'] = $collection->getUserItemsData($id, $active);
     $data['total'] = count($data['items']);
     return new Response(json_encode($data));
 }
 public function indexAction(Request $request)
 {
     $this->check();
     $id = $request->get('id');
     $patient = new Patient();
     $patient->load($id);
     $diseases = new PatientDiseaseCollection();
     $services = new PatientServiceCollection();
     if ($patient->getId()) {
         return $this->render('PatientBundle:Default:patient.html.twig', array('patient' => $patient->getData(), 'user' => $this->getUserDataHeader($request->getSession()), 'edit_action' => $this->check('patient_edit', false), 'delete_action' => $this->check('patient_delete', false), 'patient_disease_new' => $this->check('patient_disease_new', false), 'patient_service_new' => $this->check('patient_service_new', false), 'diseases' => $diseases->getPatientItemsData($patient->getId(), true), 'services' => $services->getPatientItemsData($patient->getId(), true)));
     }
     return $this->generate404($request->getSession(), 'Patient');
 }