public function toPharmacist(Request $request, $patientId) { if (!HospitalEmployee::isDoctor()) { return response()->json(["success" => false, "error" => 'notlogin or notvalid']); } $patient = Patient::find($patientId); if (!$patient) { return response()->json(["success" => false, "error" => 'patinet not found']); } $patient->status = 1; $patient->save(); return response()->json(['success' => true, 'patient' => $patient]); }
public function finish(Request $request, $patientId) { if (!HospitalEmployee::isPharmacist()) { return response()->json(["success" => false, "error" => 'notlogin or notvalid']); } $patient = Patient::find($patientId); if (!$patient) { return response()->json(['success' => false, 'message' => 'patient not found']); } $drugs = DrugRecord::where('patient_id', $patient->id)->where('check', 0)->where('created_at', '>=', new \DateTime('today'))->get(); foreach ($drugs as $drug) { $drug->check = 1; $drug->save(); } $patient->status = 0; $patient->save(); return response()->json(['success' => true, 'data' => $patient->drugRecords]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // $data = \App\Patient::find($id); //$data->users()->detach(); $data->delete(); Session::flash('success', "Data pasien berhasil dihapus"); return redirect()->route('admin.patient.index'); }
public function pendingReservations($id) { $patient = Patient::find($id); $reservated = $patient->Reservations->where('status', 'Reservada'); $confirmated = $patient->Reservations->where('status', 'Confirmada'); $reservations = $reservated->merge($confirmated); $view = view('patients.listOfReservations', compact('reservations'))->render(); return response()->json(['respuesta' => true, 'view' => $view]); }
public function calculate($id, $total) { $patient = Patient::find($id); $benefit = $patient->Company->benefit; $discount = round($total * $benefit / 100); $totalToPay = $total - $discount; return response()->json(compact('discount', 'totalToPay')); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(Request $request, $id) { $use = User::find($id); if ($use->patient->id) { $user = Patient::find($use->patient->id); $user->bp = $request->input('bp'); $user->fbs = $request->input('fbs'); $user->complication = $request->input('complication'); if ($request->input('syssuggestion')) { $sd = explode("/", $user->bp); $context = new Context(new OperationCheck()); $levelText = $context->executeStrategy($user->fbs, $sd[0], $sd[1], $user->complication); $user->suggestion = Suggestion::getSuggestion($levelText); } else { $user->suggestion = $request->input('suggestion'); } $user->save(); } return redirect('app/show/admin/' . $id); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $patient = Patient::find($id); $patient->delete(); //Session::flash('flash_message', 'Successfully deleted!'); return redirect()->action('PatientController@index'); }