/** * Display the specified patient. * * @param int $id * @return Response */ public function show($id) { $patient = Patient::findOrFail($id); $tests = Test::select('tests.id', 'test', 'result', 'diagnosis', 'tests.created_at', 'item')->where('patient_id', '=', $id)->join('billings', 'billings.id', '=', 'tests.test')->get(); $medications = Medication::select('medications.id', 'prescription', 'dosage', 'start_date', 'end_date', 'item')->where('patient_id', '=', $id)->join('billings', 'billings.id', '=', 'medications.prescription')->get(); $visit = Visit::where('patient_id', '=', $id)->first(); return View::make('patients.show', compact('patient', 'tests', 'medications', 'visit')); }
/** * Medication bills helper function * * @return array */ public function getMedicationBills($id) { return Medication::select('item', 'type', 'price', 'prescription', 'dosage', 'medications.created_at')->where('medications.visit_id', '=', $this->getVisit($id)->id)->join('billings', 'billings.id', '=', 'prescription')->where('medications.patient_id', '=', $id)->get(); }