/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $name = Patient::where(DB::raw('CONCAT_WS(" ", last, first, middle)'), 'LIKE', '%' . $id . '%')->orWhere(DB::raw('CONCAT_WS(" ", first, middle, last)'), 'LIKE', '%' . $id . '%')->orWhere(DB::raw('CONCAT_WS(" ", first, last)'), 'LIKE', '%' . $id . '%'); $pos = Patient::where('position', 'LIKE', '%' . $id . '%'); $ags = Patient::select('patients.*')->join('agencies', 'agencies.id', '=', 'patients.agency_id')->where('agencies.code', 'LIKE', '%' . $id . '%')->orWhere('agencies.name', 'LIKE', '%' . $id . '%'); $patients = Patient::with('agency')->where('pid', '=', $id)->union($name)->union($pos)->union($ags)->simplePaginate($this->recPerPage); $pageTitle = 'ODRMS - Patient Dental Records'; return view('patient.index', ['pats' => $patients, 'pageTitle' => $pageTitle]); }
/** * Get all patient records [within a range]. * * @return JSON */ public function fetch(Request $request) { return response()->json(["status" => "success", "patients" => Patient::with('visit')->concrete()->limit(50)->orderBy('id', 'desc')->get()->toArray()]); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($pid, $tno) { $pat = Patient::with('agency')->where('pid', '=', $pid)->firstOrFail(); $dents = Auth::user()->dentists_options; $result = Dental::whereTNO($tno); $data = array('pat' => $pat, 'dentists' => $dents, 'result' => $result, 'pageTitle' => 'ODRMS - Patient Dental Records - ' . $pat->name . ' - Edit :' . $result->trans_no); return view('patient.results.dental.edit', $data); }