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[0]['id']); $patientmale = Patient::find($patientSaved[1]['id']); $this->assertEquals('F', $patientfemale->getGender()); $this->assertEquals('M', $patientmale->getGender()); }
/** * Remove the specified resource from storage (soft delete). * * @param int $id * @return Response */ public function delete($id) { //Soft delete the patient $patient = Patient::find($id); $patient->delete(); // redirect $url = session('SOURCE_URL'); return redirect()->to($url)->with('message', trans('messages.record-successfully-deleted')); }
/** * Display data after applying the filters on the report uses patient ID * * @return Response */ public function viewPatientReport($id, $visit = null, $testId = null) { $from = Input::get('start'); $to = Input::get('end'); $pending = Input::get('pending'); $date = date('Y-m-d'); $error = ''; $visitId = Input::get('visit_id'); // Check checkbox if checked and assign the 'checked' value if (Input::get('tests') === '1') { $pending = 'checked'; } // Query to get tests of a particular patient if (($visit || $visitId) && $id && $testId) { $tests = Test::where('id', '=', $testId); } else { if (($visit || $visitId) && $id) { $tests = Test::where('visit_id', '=', $visit ? $visit : $visitId); } else { $tests = Test::join('visits', 'visits.id', '=', 'tests.visit_id')->where('patient_id', '=', $id); } } // Begin filters - include/exclude pending tests if ($pending) { $tests = $tests->where('tests.test_status_id', '!=', Test::NOT_RECEIVED); } else { $tests = $tests->whereIn('tests.test_status_id', [Test::COMPLETED, Test::VERIFIED]); } // Date filters if ($from || $to) { if (!$to) { $to = $date; } if (strtotime($from) > strtotime($to) || strtotime($from) > strtotime($date) || strtotime($to) > strtotime($date)) { $error = trans('messages.check-date-range'); } else { $toPlusOne = date_add(new DateTime($to), date_interval_create_from_date_string('1 day')); $tests = $tests->whereBetween('time_created', array($from, $toPlusOne->format('Y-m-d H:i:s'))); } } // Get tests collection $tests = $tests->get(array('tests.*')); // Get patient details $patient = Patient::find($id); // Check if tests are accredited $accredited = $this->accredited($tests); $verified = array(); foreach ($tests as $test) { if ($test->isVerified()) { array_push($verified, $test->id); } else { continue; } } if (Input::has('word')) { $date = date("Ymdhi"); $fileName = "blispatient_" . $id . "_" . $date . ".doc"; $headers = array("Content-type" => "text/html", "Content-Disposition" => "attachment;Filename=" . $fileName); $content = view('reports.patient.export')->with('patient', $patient)->with('tests', $tests)->with('from', $from)->with('to', $to)->with('visit', $visit)->with('accredited', $accredited); return Response::make($content, 200, $headers); } else { return view('reports.patient.report')->with('patient', $patient)->with('tests', $tests)->with('pending', $pending)->with('error', $error)->with('visit', $visit)->with('accredited', $accredited)->with('verified', $verified)->withInput(Input::all()); } }
/** * Display a form for creating a new Test. * * @return Response */ public function create($patientID = 0) { if ($patientID == 0) { $patientID = Input::get('patient_id'); } $testtypes = TestType::where('orderable_test')->orderBy('name', 'asc')->get(); $patient = Patient::find($patientID); //Load Test Create View return view('test.create', compact('testtypes', 'patient')); }