Exemplo n.º 1
0
 function viewInstitutePatient($id)
 {
     $adminId = Session::get('admin_id');
     if (!isset($adminId)) {
         return json_encode(array('message' => 'not logged'));
     }
     $patient = Patient::find($id);
     $institute_id = Session::get('institute_id');
     $parents = InstituteConnection::where('connection_id', $institute_id)->where('status', 'active')->get();
     $hasParents = isset($parents) && count($parents) > 0;
     if (isset($patient)) {
         Session::set('current_patient_id', $patient->id);
         return View::make('patient.institute-patient')->with('found', true)->with('patient', $patient)->with('hasParents', $hasParents)->with('parents', $parents);
     } else {
         return View::make('patient.institute-patient')->with('found', false);
     }
 }
Exemplo n.º 2
0
 public function getInstituteConnections($instituteId, $status = 'active', $page = 1)
 {
     $adminId = Session::get('admin_id');
     if (!isset($adminId)) {
         return json_encode(array('message' => 'not logged'));
     }
     $connections = InstituteConnection::where('status', $status)->where('$institute_id', $instituteId)->get();
     if (isset($connections) && count($connections) > 0) {
         $connectionArray = array();
         foreach ($connections as $connection) {
             $connectionFromName = InstituteConnection::find($connection->connection_id);
             $connectionToName = InstituteConnection::find($connection->institute_id);
             if (isset($connectionFromName) && isset($connectionToName)) {
                 $connectionArray[] = array('id' => $connection->id, 'connection_from' => $connectionFromName, 'connection_to' => $connectionToName);
             }
         }
         return json_encode(array('message' => 'found', 'connections' => $connectionArray));
     } else {
         return json_encode(array('message' => 'empty'));
     }
 }