Пример #1
0
 public function getPatient(Request $request)
 {
     if (!HospitalEmployee::isStaff()) {
         return response()->json(["success" => false, "error" => 'notlogin or notvalid']);
     }
     $firstname = $request->input('firstname');
     $lastname = $request->input('lastname');
     if ($firstname && !$lastname) {
         $lastname = 'unabletoguess';
     }
     if (!$firstname && $lastname) {
         $firstname = 'unabletoguess';
     }
     $patients = Patient::where('firstname', 'LIKE', "%{$firstname}%")->orWhere('lastname', 'LIKE', "%{$lastname}%")->get();
     $b = [];
     foreach ($patients as $patApp) {
         // $patApp[] = $a;
         $c = $patApp->toArray();
         $appointments = $patApp->futureAppointments();
         $appointments_array = [];
         foreach ($appointments as $appointment) {
             $each = $appointment->toArray();
             $each['doctor'] = $appointment->doctor->toArray();
             $appointments_array[] = $each;
         }
         $c['appointments'] = $appointments_array;
         // echo 'kk';
         $b[] = $c;
     }
     return response()->json(["success" => true, "data" => $b]);
 }
Пример #2
0
 public function getPatient(Request $request)
 {
     if (!HospitalEmployee::isNurse()) {
         return response()->json(["success" => false, "error" => 'notlogin or notvalid']);
     }
     $firstname = $request->input('firstname');
     $lastname = $request->input('lastname');
     if ($firstname && !$lastname) {
         $lastname = 'unabletoguess';
     }
     if (!$firstname && $lastname) {
         $firstname = 'unabletoguess';
     }
     $patients = Patient::where('firstname', 'LIKE', "%{$firstname}%")->orWhere('lastname', 'LIKE', "%{$lastname}%")->get();
     $report = [];
     foreach ($patients as $patient) {
         $patientReport = PatientReport::orderBy('report_id', 'desc')->where('patient_id', $patient->id)->get();
         $each = $patient->toArray();
         if (!$patientReport) {
             $each['patientReports'] = [];
         } else {
             $each['patientReports'] = $patientReport;
         }
         $report[] = $each;
     }
     return response()->json(["success" => true, "data" => $report]);
 }
Пример #3
0
 public function attemptLinkToPatient()
 {
     if (Patient::where('email', $this->email_address)->count() > 0) {
         $patient = Patient::where('email', $this->email_address)->first();
         $this->patient_id = $patient->id;
         $this->save();
     }
 }
Пример #4
0
 public function matchToPatient()
 {
     if (Patient::where('email', $this->sender_address)->count() > 0) {
         $patient = Patient::where('email', $this->sender_address)->first();
         $this->patient_id = $patient->id;
         $this->save();
     }
 }
Пример #5
0
 public function activateAccount($code)
 {
     $patient = Patient::where('activation_code', $code)->first();
     if ($patient) {
         $patient->update(['verified' => 1, 'activation_code' => NULL]);
         Auth::login($patient);
         return true;
     }
 }
Пример #6
0
 /**
  * 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]);
 }
Пример #7
0
 public function doPatientSuggestions(Request $request)
 {
     $search_str = $request->input('search_str');
     $patients = Patient::where('first_name', 'LIKE', '%' . $search_str . '%')->orWhere('last_name', 'LIKE', '%' . $search_str . '%')->orWhere(DB::raw('CONCAT(first_name," ",last_name)'), 'LIKE', '%' . $search_str . '%')->take(10)->get();
     $vars = array("patients" => $patients);
     if ($request->has('links') && $request->input('links')) {
         return view('backend.partials.patient-suggestion-link-list')->with($vars);
     } else {
         return view('backend.partials.patient-suggestion-list')->with($vars);
     }
 }
Пример #8
0
 public function show($id)
 {
     $data = Queue::find($id);
     $data->status = 'Consulting';
     $data->save();
     $ic = $data->pt_ic;
     $data2 = Patient::where('pt_ic', $ic)->first();
     //$data3 = Record::where('pt_id', $data2);
     $inventory = Inventory::all();
     return view('doctor.newcase')->with('data', $data)->with('data2', $data2)->with('inventory', $inventory);
     //->with('history',$data3);
 }
 public function getPatient(Request $request)
 {
     if (!HospitalEmployee::isPharmacist()) {
         return response()->json(["success" => false, "error" => 'notlogin or notvalid']);
     }
     $patients = Patient::where('status', 1)->get();
     $result = [];
     foreach ($patients as $patient) {
         $each = $patient->toArray();
         $each['drugRecords'] = DrugRecord::where('patient_id', $patient->id)->where('check', 0)->where('created_at', '>=', new \DateTime('today'))->get();
         $result[] = $each;
     }
     return response()->json(['success' => true, 'data' => $result]);
 }
Пример #10
0
 /**
  * Search existing patient records.
  *
  * @return JSON
  */
 public function search(SearchPatientsRequest $request)
 {
     switch ($request->by) {
         case "name":
             return response()->json(["status" => "success", "patients" => Patient::where('first_name', 'LIKE', '%' . $request->for . '%')->orWhere('last_name', 'LIKE', '%' . $request->for . '%')->orderBy('id', 'desc')->get()->toArray()]);
             break;
         case "forceptID":
             return response()->json(["status" => "success", "patients" => Patient::where('id', '=', $request->for)->where('concrete', '=', 1)->orderBy('id', 'desc')->get()->toArray()]);
             break;
         case "fieldNumber":
             // return response()->json( Patient::where('') )
             break;
         default:
             return response()->json(["status" => "failure", "message" => sprintf("Searching by %s is not supported.", $request->by), "patients" => []], 422);
             break;
     }
 }
Пример #11
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $gender = Input::get('gender');
     //dd($gender);
     $verified = Input::get('verified');
     $data = array();
     if (empty($gender) && empty($verified)) {
         //menampilkan semua gender
         $data['content'] = \App\Patient::all();
         $data['gender'] = null;
         $data['verified'] = null;
         //dd($data['content']);
     } else {
         $data['content'] = \App\Patient::where('gender', $gender)->where('verified', $verified)->get();
         $data['gender'] = $gender;
         $data['verified'] = $verified;
         //dd($verified);
     }
     $data['list_gender'][0] = 'L';
     $data['list_gender'][1] = 'P';
     return view('pages.admin.patient.index')->with('data', $data);
 }
Пример #12
0
 public function dispense($ic, $name)
 {
     $getID = Patient::where('pt_ic', $ic)->first();
     //whole row
     $deID = $getID->id;
     //get the id from the ic
     $getcaseID = Record::where('pt_id', $deID)->first();
     $caseID = $getcaseID->id;
     $disData = Dispensary::where('case_ref', $caseID)->first();
     //xpe pakai first() sbb setiap case unik, case lain xpakai id ni
     $arrQty = explode("#", $disData->dispensed_quantity);
     $arrDrug = explode("#", $disData->dispensed_drug_code);
     //need declare $prices array x?
     $prices = array();
     for ($x = 0; $x < count($arrDrug) - 1; $x++) {
         //get price of each drug into an array
         $hehe = Inventory::where('drug_name', $arrDrug[$x])->first();
         $prices[$x] = $hehe->spu;
     }
     // $arrOne = count($arrDrug);
     // arr1 = druglist , arr2= respective qty of drug, arr3= respective price of drug
     $panel = Panel::all();
     return view('staff.dispensary')->with('name', $name)->with('arr2', $arrQty)->with('arr1', $arrDrug)->with('arr3', $prices)->with('panel', $panel)->with('ptid', $deID);
 }
Пример #13
0
 /**
  * Fetch visits for specified stage ID
  */
 public function fetch(Stage $stage)
 {
     $response;
     $visits = Visit::where('stage', '=', $stage->id)->get()->keyBy('id')->toArray();
     $rootStageFields = Stage::where('root', true)->first()->inputFields;
     foreach ($visits as $visitID => $visitData) {
         $models = array();
         foreach ($visitData['patients'] as $patientID) {
             $patient = Patient::where('id', $patientID);
             if ($patient->count() > 0) {
                 $models[$patientID] = $patient->first()->toArray();
             }
         }
         $visits[$visitID]['patient_models'] = $models;
     }
     if (count($visits) > 0) {
         $response = ["status" => "success", "message" => "Visits found.", "visits" => $visits];
     } else {
         $response = ["status" => "success", "message" => "No visits are currently at stage " . $stage->name . "."];
     }
     return response()->json($response);
 }
Пример #14
0
 public static function getAppointmentDoctor($doctor_id)
 {
     // $doctor_id = $doctor->input('doctor_id');
     if ($doctor_id == null) {
         return ["success" => false, "message" => 'doctor_not_found'];
     }
     $appointments = Appointment::orderBy('time', 'desc')->where('emp_id', $doctor_id)->get();
     $result = [];
     foreach ($appointments as $appointment) {
         $patient = Patient::where('id', $appointment->patient_id)->first();
         $result[] = ["patient" => $patient, "appointment" => $appointment];
     }
     if (sizeof($appointments) > 0) {
         return $result;
     } else {
         return [];
     }
 }
Пример #15
0
 public function addToQueue(Request $request)
 {
     $queue = new Queue();
     $queue->pt_ic = $request->input('pt_id');
     $data = Patient::where('pt_ic', $request->input('pt_id'))->first();
     $queue->name = $data->pt_name;
     $queue->status = 'Waiting';
     $queue->save();
     Alert::success('Added to queue!')->autoclose(2000);
     return redirect()->action('StaffController@index');
 }
 public function getAllPatient()
 {
     $patientList = Patient::where('boolStatus', 1)->get();
     return view('view-patient')->with('patientList', $patientList);
 }
Пример #17
0
 public static function wherePID($pid)
 {
     return $pat = Patient::where('pid', '=', $pid)->firstOrFail();
 }
Пример #18
0
 public function getPhoto($patient_id)
 {
     $patient = Patient::where('id', $patient_id)->first();
     $file = Storage::disk('local')->get($patient_id . '.' . $patient->photo_extension);
     $ext = $patient->photo_extension;
     if ($ext == 'jpeg') {
         return (new Response($file, 200))->header('Content-Type', 'image/jpeg');
     } else {
         if ($ext == 'jpg') {
             return (new Response($file, 200))->header('Content-Type', 'image/jpeg');
         } else {
             if ($ext == 'gif') {
                 return (new Response($file, 200))->header('Content-Type', 'image/gif');
             } else {
                 if ($ext == 'png') {
                     return (new Response($file, 200))->header('Content-Type', 'image/png');
                 }
             }
         }
     }
 }
Пример #19
0
 public function incumbentsToAdd()
 {
     $incumbents = Patient::where('type', '=', 'Titular')->orderBy('firstname')->get();
     $vista = view('patients.listOfIncumbents', compact('incumbents'));
     return $vista;
 }
Пример #20
0
| Application Routes
|--------------------------------------------------------------------------
|
| 
|
*/
use App\Patient;
/**
 * routes for the contact and about pages
 */
Route::get('/', 'appController@index');
Route::get('io', 'appController@about');
Route::get('dash', 'patientController@index');
/*
Resourceful controllers.
*/
Route::resource('patient', 'patientController');
Route::resource('nurse', 'nurseController');
Route::resource('doctor', 'doctorController');
Route::resource('admin', 'adminController');
Route::get('doctor/create/{id}', 'doctorController@create');
Route::get('admin/{id}/delete', 'adminController@delete');
/**
 * Route for authentication.
 */
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
Route::post('dash', function () {
    $keyword = trim(Input::get('keyword'));
    $name = Patient::where('firstName', 'LIKE', '%' . $keyword . '%')->get();
    return view('patients.search', compact('name'));
});
Пример #21
0
 public function drugAllergic(Request $request, $patientId)
 {
     if (!HospitalEmployee::isDoctor()) {
         return response()->json(["success" => false, "error" => 'notlogin or notvalid']);
     }
     $drugAllergic = $request->input('drugAllergic');
     $error = [];
     if (!$drugAllergic) {
         $error[] = 'drugAllergic_not_found';
     }
     if (sizeof($error) != 0) {
         return response()->json(["success" => false, "message" => $error]);
     }
     $drAllergic = Patient::where('id', $patientId)->first();
     $drAllergic->drugAllergic = $drugAllergic;
     $drAllergic->save();
     return response()->json(["success" => true, "message" => 'saved drugAllergic record']);
 }
 public function deactivatePatient()
 {
     Patient::where('patientId', $this->patientId)->where('boolStatus', 1)->update(['boolStatus' => 0]);
     return "success";
 }