public static function create(array $attributes = []) { $patient = new Patient(); $patient->personal_id = $attributes['personal_id']; $patient->firstname = $attributes['firstname']; $patient->lastname = $attributes['lastname']; $patient->birthdate = $attributes['birthdate']; $patient->address = $attributes['address']; $patient->gender = $attributes['gender']; $patient->religion = $attributes['religion']; $patient->nationality = $attributes['nationality']; $patient->bloodtype = $attributes['bloodtype']; $patient->tel = $attributes['tel']; $patient->email = $attributes['email']; $patient->remark = $attributes['remark']; $patient->save(); // this will also create the User for authentication $user = new User(); // duplicate personal id to username $user->username = $patient->personal_id; $user->password = Hash::make($attributes['password']); $user->userable_id = $patient->id; $user->userable_type = 'App\\Patient'; $user->save(); return $patient; }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('patients')->delete(); $patient = new Patient(['empId' => '4001', 'deptId' => '1', 'roomNo' => '101', 'docId' => '2001', 'insId' => '1', 'allergy' => 'Penacillin', 'notes' => 'Smokes', 'relDate' => '']); $patient->save(); $patient = new Patient(['empId' => '4002', 'deptId' => '1', 'roomNo' => '102', 'docId' => '2002', 'insId' => '2', 'allergy' => 'Dairy', 'notes' => 'Smokes', 'relDate' => '']); $patient->save(); $patient = new Patient(['empId' => '4003', 'deptId' => '2', 'roomNo' => '202', 'docId' => '2003', 'insId' => '2', 'allergy' => 'None', 'notes' => 'Sleep Troubles', 'relDate' => '2015-12-25']); $patient->save(); $patient = new Patient(['empId' => '4004', 'deptId' => '3', 'roomNo' => '303', 'docId' => '2004', 'insId' => '3', 'allergy' => 'None', 'notes' => 'Stroke', 'relDate' => '2015-01-18']); $patient->save(); }
public function deactivatePatient(Request $request) { try { $patient = new Patient(); $patient->patientId = $request->patientId; $strStatus = $patient->deactivatePatient(); } catch (Exception $e) { dd($e); $strStatus = "error"; } if ($strStatus === "success") { return redirect()->action('PatientController@getAllPatient'); } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { //dd($request); $patient = new Patient([]); $patient->save(); $patient_info = new PersonalInformation(['patient_id' => $patient->id, 'last_name' => $request->get('last_name'), 'first_name' => $request->get('first_name'), 'middle_name' => $request->get('middle_name'), 'birth_date' => $request->get('birth_date'), 'gender' => $request->get('gender'), 'civil_status' => $request->get('civil_status'), 'house_no' => $request->get('address'), 'street' => $request->get('address'), 'barangay' => $request->get('address'), 'municipality' => $request->get('address'), 'province' => $request->get('address')]); $patient_info->save(); $referral = new Referral(['urgent' => $request->get('urgent'), 'reason' => $request->get('referral_reason'), 'patient_id' => $patient->id, 'chief_complaint' => $request->get('chief_complaint'), 'history' => $request->get('history'), 'exams_performed' => $request->get('exams_performed'), 'treatment_medication' => 'treatment_medication', 'operation_performed' => $request->get('operation_performed'), 'diagnosis' => $request->get('diagnosis'), 'remarks' => $request->get('remarks')]); $referral->save(); //dd($referral); $user_referral = new UserReferral(['referral_id' => $referral->id, 'user_id' => Auth::user()->id, 'placeholder_id' => 1, 'is_read' => 0, 'is_important' => $referral->urgent, 'receiver_id' => $request->get('referred_to')]); //dd($user_referral); $user_referral->save(); return redirect('hhway/referrals'); }
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]); }
/** * Display the specified resource. * * @param int $id * @return Responsenew */ public function show($id) { $i = 0; $patient = Patient::findOrFail($id); $userDetails = \Auth::user(); return view('doctor.patientTimeline', compact('patient', 'i')); }
public function getAlerts($request) { $patient_ids = array(); $today = Carbon::now(); $today->hour = 0; $today->minute = 0; $today->second = 0; $tomorrow = $today->copy()->addDay(); if ($request->session()->get('global_branch') == 'all') { foreach (Appointment::whereIn('status_id', [3, 4])->where('start_date', '>', $today)->where('end_date', '<', $tomorrow)->get() as $a) { $patient_ids[] = $a->patient_id; } } else { foreach (Appointment::whereIn('status_id', [3, 4])->where('branch_id', $request->session()->get('global_branch'))->where('start_date', '>', $tomorrow)->where('end_date', '<', $today)->get() as $a) { $patient_ids[] = $a->patient_id; } } $alerts = new Collection(); if (count($patient_ids) > 0) { foreach ($patient_ids as $id) { $patient = Patient::findOrFail($id); if ($patient->hasAlert()) { $alerts->push($patient->getAlert()); } } } view()->share('alerts', $alerts); }
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]); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if ($this->auth->guest()) { if ($request->ajax()) { return response('Unauthorized.', 401); } else { return redirect()->guest('auth/login'); } } else { if ($this->auth->user()->doctor) { $queue = Queue::all(); $patient = Patient::all(); return view('doctor.dashboard')->with('queue', $queue)->with('patient', $patient); } else { if ($this->auth->user()->admin) { $queue = Queue::all(); $patient = Patient::all(); return view('doctor.dashboard')->with('queue', $queue)->with('patient', $patient); } else { $queue = Queue::all(); $patient = Patient::all(); return view('staff.dashboard')->with('queue', $queue)->with('patient', $patient); } } } return $next($request); }
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(); } }
public function getPatientAppointments($id) { $patient = Patient::findOrFail($id); $appointments = $patient->appointments; $response = ["appointments" => $appointments->toArray()]; header('Content-type: application/json'); die(json_encode($response)); }
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(); } }
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; } }
public function storeName(Request $request) { // $patient = Patient::firstOrNew(['name' => $request->input('name')]); $patient->name = $request->input('name'); $patient->save(); //echo $patient; return redirect()->route('questionNr', [$patient->name, 'questionNr' => 1]); }
public function removeQueue(Request $request) { $queue = Queue::all(); $patient = Patient::all(); //insert delete from queue $queue = Queue::find($request->input('pt_id')); //$queue->delete(); return redirect()->action('StaffController@index')->with('queue', $queue)->with('patient', $patient); //return view('staff.dashboard'); }
public static function addNew($data) { $treatment_plan = new TreatmentPlan(); $treatment_plan->patient_id = $data['patient_id']; $treatment_plan->save(); $appointment = Appointment::addNew(2, 'CoT #' . $treatment_plan->id, $treatment_plan->patient_id, $treatment_plan->patient->dentist_id, '', '', '', '', '', '', $treatment_plan->id, '0', '1'); $patient = Patient::findOrFail($data['patient_id']); $patient->addHistoryItem("Course of Treatment Added", "A Course of Treatment has been added for this patient", Auth::user()->id, 19); return $treatment_plan; }
public static function getNewHospitalNo() { $maxHN = Patient::max('hospitalNo'); if ($maxHN == null) { $newHN = 1; } else { $newHN = $maxHN + 1; } return $newHN; }
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); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function companies() { $dummyCompanies = DummyCompany::all(); $diccionario = []; foreach ($dummyCompanies as $dummyCompany) { $dataCompany = ['name' => $dummyCompany->name, 'rut' => $dummyCompany->rut, 'phone' => $dummyCompany->phone, 'email' => $dummyCompany->email, 'benefit' => 0, 'amount' => 0, 'month' => 1]; $company = new Company($dataCompany); $company->save(); $diccionario[$dummyCompany->id] = $company->id; } $dummyPatients = dummyPatient::all(); foreach ($dummyPatients as $dummyPatient) { if (!isset($diccionario[$dummyPatient->company_id])) { $diccionario[$dummyPatient->company_id] = 1; } $dataPatient = ['firstname' => $dummyPatient->first_name, 'lastname' => $dummyPatient->last_name, 'address' => $dummyPatient->address, 'rut' => $dummyPatient->rut, 'phone' => $dummyPatient->phone, 'email' => $dummyPatient->email, 'type' => "Titular", 'company_id' => $diccionario[$dummyPatient->company_id]]; $patient = new Patient($dataPatient); $patient->save(); } echo ":S"; }
public function saveObject(Request $request) { if (isset($request->id) && !empty($request->id)) { $object = Patient::whereRaw('patient_no = ? or id = ?', array($request->id, $request->id))->first(); } else { $object = new Patient(); } $object->patient_no = $request->patient_no; $object->lastname = $request->lastname; $object->firstname = $request->firstname; $object->address = $request->address; $object->contact = $request->contact; $object->email = $request->email; $object->gender = $request->gender; $object->birthday = $request->birthday; $object->bloodtype = $request->bloodtype; $object->occupancy = $request->occupancy; $object->status = $request->status; $object->contact_person = $request->contact_person; $object->save(); return 200; }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function post_register(PatientRegRequest $request) { // $input = $request->all(); $password = bcrypt($request->input('password')); $input['password'] = $password; $input['activation_code'] = str_random(60) . $request->input('email'); $register = \App\Patient::create($input); $data = ['first_name' => $input['first_name'], 'last_name' => $input['last_name'], 'code' => $input['activation_code']]; $this->sendEmail($data, $input); Session::flash('success', "Cek email untuk mengaktivasi akun"); return redirect()->route('patient.register'); }
/** * Bootstrap any application services. * * @return void */ public function boot() { // Add app config values config(['app.nonInputFieldTypes' => ['header'], 'app.version' => "v1.0-beta"]); Patient::saving(function ($patient) { if (Auth::check()) { $patient->last_modified_by = Auth::user()->id; } }); Resource::creating(function ($resource) { if (Auth::check()) { $resource->uploaded_by = Auth::user()->id; } }); }
/** * Run the database seeds. * * @return void */ public function run() { if (App::environment() === 'production') { exit('Do not seed in production environment'); } DB::statement('SET FOREIGN_KEY_CHECKS = 0'); // disable foreign key constraints DB::table('patients')->truncate(); Patient::create(['id' => 1, 'name' => 'S. Sudarshan', 'dob' => '1980-12-01', 'gender' => 'male', 'maritalStatus' => 'married', 'address' => 'lorem ipsum', 'homePhoneNumber' => null, 'mobileNumber' => '981890899', 'email' => null, 'annualIncome' => 300000, 'occupation' => 'bussiness', 'education' => 'College', 'religion' => 'Hindu', 'voterId' => 'qw12340', 'adharId' => null, 'aliveChildrenCount' => 2, 'deceasedChildrenCount' => 0]); $patientHistory['patientId'] = 1; $patientHistory['eventId'] = 2; $patientHistory['registeredBy'] = 2; $patientHistory['diagnosis_status'] = 'Pending'; DB::table('patient_history')->insert($patientHistory); DB::statement('SET FOREIGN_KEY_CHECKS = 1'); // enable foreign key constraints }
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]); }
public static function addNew($patient_id, $title, $first_name, $last_name, $prefered_name, $dob, $gender, $nhs_number, $occupation, $ni_number, $home_phone, $work_phone, $mobile_phone, $email_address, $doctor, $acquisition_source, $payment_plan, $dentist_id, $hygienist_id, $receive_emails, $receive_sms, $dentist_recall_interval, $dental_recall_date, $hygienist_recall_interval, $hygienist_recall_date, $recall_method, $creator_id) { $patient = new Patient(); $patient->patient_id = $patient_id; $patient->title = $title; $patient->first_name = $first_name; $patient->last_name = $last_name; $patient->prefered_name = $prefered_name; $patient->dob = $dob->format('Y-m-d H:i:s'); $patient->gender = $gender; $patient->nhs_number = $nhs_number; $patient->occupation = $occupation; $patient->ni_number = $ni_number; $patient->home_phone = $home_phone; $patient->work_phone = $work_phone; $patient->mobile_phone = $mobile_phone; $patient->email = $email_address; $patient->doctor = $doctor; $patient->acquisition_source_id = $acquisition_source; $patient->payment_plan_id = $payment_plan; $patient->dentist_id = $dentist_id; $patient->hygienist_id = $hygienist_id; $patient->receive_emails = $receive_emails; $patient->receive_sms = $receive_sms; $patient->dentist_recall_interval = $dentist_recall_interval; $patient->creator_id = $creator_id; if ($dental_recall_date != '') { $patient->dental_recall_date = $dental_recall_date->format('Y-m-d H:i:s'); } else { $patient->dental_recall_date = ''; } $patient->hygienist_recall_interval = $hygienist_recall_interval; if ($hygienist_recall_date != '') { $patient->hygienist_recall_date = $hygienist_recall_date->format('Y-m-d H:i:s'); } else { $patient->hygienist_recall_date = ''; } $patient->recall_method = $recall_method; $patient->save(); Patient::incrementPatientStats(); $patient->addHistoryItem("Patient Added", "This patient was added to the system.", Auth::user()->id, 3); return $patient; }
public function record($id, $record) { $patient = Patient::findOrFail($id); //$patient->getRecord($record); $record = $patient->getRecord($record); // $bed = $record->bed()->getBed(); // $doctor = $record->doctor()->fullName(); //dd($doctor,$bed); return view('pages.Record.show', compact('record', 'patient')); }
public function index() { $data = Patient::all(); return view('patient/index')->with('data', $data); }
public function changeDentist($dentist_id) { $patient = Patient::findOrFail($this->patient_id); $dentist_obj = User::findOrFail($this->dentist_id); $new_dentist_obj = User::findOrFail($dentist_id); $patient->addHistoryItem("Appointment Dentist Changed", "The appointment on " . $this->start_date->format('d/m/Y') . " at " . $this->start_date->format('H:i') . " with <a href='" . url('user/' . $dentist_obj->id) . "'>" . $dentist_obj->first_name . " " . $dentist_obj->last_name . "</a> has been modified, it is now being performed by <a href='" . url('user/' . $new_dentist_obj->id) . "'>" . $new_dentist_obj->first_name . " " . $new_dentist_obj->last_name . "</a>", Auth::user()->id, 18); $this->dentist_id = $dentist_id; $this->save(); }
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 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'); } } } } }