/** * Display a listing of the resource. * * @return Response */ public function index() { $patientsList = Patient::orderBy(Config::get('constants.PATIENT.ATTRS.PATIENT_ID'))->get(); if (!$patientsList->count()) { return $this->notDataFound(); } return $this->respondWithCollection($patientsList, new PatientTransformer()); }
/** * Tests the update function in the PatientController * @depends testStore * @param void * @return void */ public function testDelete() { $this->be(User::first()); $this->runStore($this->input); $patientSaved = Patient::orderBy('id', 'desc')->take(1)->get()->toArray(); $patient = new PatientController(); $patient->delete($patientSaved[0]['id']); $patientsDeleted = Patient::withTrashed()->find($patientSaved[0]['id']); $this->assertNotNull($patientsDeleted->deleted_at); }
public function testGetGender() { $data = array(array('patient_number' => '6666', 'name' => 'Paul Mamboleo', 'dob' => '1930-07-05', 'gender' => '0', 'email' => '*****@*****.**', 'address' => 'Godric Hollows', 'phone_number' => '+189012402938', 'created_at' => '0000-00-00', 'updated_at' => '0000-00-00'), array('patient_number' => '5555', 'name' => 'Akellus Judith Pocos Black', 'dob' => '1900-07-05', 'gender' => '1', 'email' => '*****@*****.**', 'address' => '12 Grimmauld Place', 'phone_number' => '+18966602938', 'created_at' => '0000-00-00', 'updated_at' => '0000-00-00')); Patient::insert($data); $patientSaved = Patient::orderBy('id', 'desc')->take(2)->get()->toArray(); $patientfemale = Patient::find($patientSaved[1]['id']); $patientmale = Patient::find($patientSaved[0]['id']); $this->assertEquals('F', $patientfemale->getGender()); $this->assertEquals('M', $patientmale->getGender()); }
public function newPatient() { $input = Input::all(); if (!is_numeric($input['address'])) { $input['address'] = DB::table('address')->insertGetId(array('address' => $input['address'])); } $patient = DB::table('patients')->where('full_name', $input['fullName'])->where('address', $input['address'])->first(); // if (! Until::isNull($patient) && ! Input::has('patientId') ) { // if (! Input::has('ok')){ // return 'false'; // } // } $fullName = $input['fullName']; $ary = explode(" ", $fullName); $pop = array_pop($ary); $patient = new Patient(); if (Input::has('patientId') && !Until::isNull($input['patientId'])) { $patient = Patient::where('id', $input['patientId'])->first(); } else { $temp = Patient::orderBy('id', 'desc')->first(); $pat_id = 1; if (!Until::isNull($temp)) { $pat_id += $temp->id; } $patient->patient_id = Until::convertIntToString($pat_id); } $patient->first_name = implode(" ", $ary) . ' '; $patient->last_name = $pop; $patient->full_name = $input['fullName']; $patient->age = $input['age']; $patient->is_month = false; if (Input::has('isMonth')) { $patient->is_month = true; } $patient->weight = $input['weight']; $patient->address = $input['address']; $patient->relatives = $input['parent']; $patient->phone = $input['phone']; $patient->save(); return Response::json(array('id' => $patient->id)); }