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; }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(PatientRequest $request) { // // $request = Request::all(); // $rules = [ // 'plname' => 'required|alpha', // 'pfname' => 'required|alpha', // 'pmname' => 'alpha', // 'paddress' => 'alpha', // 'pbirth' => 'alpha', // 'pcontact' => 'alpha', // 'regdate' => 'alpha' // ]; // $messages = [ // ]; // $validation = Validator::make($request,$rules); // if($validation->passes()) // { $patient = new Patient(); $patient->plname = $request['plname']; $patient->pfname = $request['pfname']; $patient->pmname = $request['pmname']; $patient->paddress = $request['paddress']; $patient->pbirth = $request['pbirth']; $patient->pcontact = $request['pcontact']; $patient->save(); return Redirect::to('pis/patient'); // } // else{ // return Redirect::back()->withInput(); // } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $input = $request->only(['firstname', 'lastname', 'address', 'rut', 'phone', 'email', 'type']); $data = $request->only(['dataToSave']); $rules = ['firstname' => 'required', 'lastname' => 'required', 'address' => 'required', 'rut' => 'required', 'phone' => 'required', 'email' => 'required|email', 'type' => 'required', 'company_id' => 'required|numeric']; if ($input['type'] == "Titular") { $input['company_id'] = $data['dataToSave']; $validation = \Validator::make($input, $rules); if ($validation->passes()) { $patient = new Patient($input); $patient->save(); return response()->json(["respuesta" => "Guardado"]); } $messages = $validation->errors(); return response()->json($messages); } elseif ($input['type'] == "Carga") { $incumbent = Patient::find($data['dataToSave']); $input['company_id'] = $incumbent->Company->id; $validation = \Validator::make($input, $rules); if ($validation->passes()) { $patient = new Patient($input); $patient->save(); //crear relacion $inputRelationship = ['incumbent' => $incumbent->id, 'burden' => $patient->id]; $relationship = new Relationship($inputRelationship); $relationship->save(); return response()->json(["respuesta" => "Guardado"]); } $messages = $validation->errors(); return response()->json($messages); } else { //error, no especifico el tipo } }
/** * 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(); }
/** * Create a new patient record. * * @return JSON */ public function create() { // $patient = new Patient(); $patient->created_by = Auth::user()->id; $patient->concrete = false; if ($patient->save()) { return response()->json(["status" => "success", "patient" => $patient->toArray()]); } else { return response()->json(["status" => "failure", "message" => "Couldn't save new patient record."], 422); } }
/** * 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'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { //data validation $messages = ['required' => 'This field MUST not be empty.', 'unique' => 'The data EXISTED already.', 'regex' => 'IC is invalid. The format is xxxxxx-xx-xxxx', 'alpha' => 'Alphabet only', 'numeric' => 'Number only']; $rules = ['pt_ic' => 'required|unique:patients|regex:/^[0-9]{6}-[0-9]{2}-[0-9]{4}$/', 'pt_name' => 'required|alpha', 'pt_contactNo' => 'required|numeric']; $validation = Validator::make($request->all(), $rules, $messages); if ($validation->fails()) { return redirect()->back()->withErrors($validation)->withInput($request->all()); } $pIc = $request->input('pt_ic'); $pName = $request->input('pt_name'); $pCont = $request->input('pt_contactNo'); $pDob = $request->input('pt_dob'); $pGend = $request->input('pt_gender'); $pPan = $request->input('pt_panel'); $pRace = $request->input('pt_race'); $pAddr = $request->input('pt_address'); $pPost = $request->input('pt_postcode'); $pCity = $request->input('pt_city'); $pState = $request->input('pt_state'); $patient = new Patient(); $patient->pt_ic = $pIc; $patient->pt_name = $pName; $patient->pt_contactNo = $pCont; $patient->pt_dob = $pDob; $patient->pt_gender = $pGend; $patient->pt_panel = $pPan; $patient->pt_race = $pRace; $patient->pt_address = $pAddr; $patient->pt_postcode = $pPost; $patient->pt_city = $pCity; $patient->pt_state = $pState; $patient->save(); $queue = new Queue(); $queue->pt_ic = $pIc; $queue->name = $pName; $queue->status = 'Waiting'; $queue->save(); Alert::success('Registered!')->autoclose(2000); return redirect()->action('StaffController@index'); }
/** * 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; }
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 store_data(PatientFormRequest $request) { $patient = new Patient(array('patient_name' => strtolower($request->get('patient_name')), 'patient_id' => $request->get('patient_id'), 'father_name' => $request->get('father_name'), 'consult_dr' => $request->get('consult_dr'), 'address' => $request->get('address'), 'phone_number' => $request->get('phone_number'), 'gender' => $request->get('gender'), 'age' => $request->get('age'), 'admission_date' => $request->get('admission_date'), 'reffered_dr' => $request->get('reffered_dr'), 'digital_xray' => $request->get('digital_xray'), 'ultrasonogram' => $request->get('ultrasonogram'), 'ecg' => $request->get('ecg'), 'digital_ecg' => $request->get('digital_ecg'), 'endoscopy' => $request->get('endoscopy'), 'blood_grouping' => $request->get('blood_grouping'), 'blood_cs' => $request->get('blood_cs'), 'blood_cbc' => $request->get('blood_cbc'), 'urine' => $request->get('urine'), 'hbs_normal' => $request->get('hbs_normal'), 'ct_scan' => $request->get('ct_scan'), 'stool' => $request->get('stool'), 'commision' => $request->get('commision'))); $patient->save(); return redirect(action('PatientsController@edit_report', $patient->patient_id))->with('status', 'Your Information has been inserted!'); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create(Request $request) { $patient = new Patient(); $patient['name'] = $request->input('name'); $patient['dob'] = $request->input('dob'); $patient['gender'] = $request->input('gender'); $patient['maritalStatus'] = $request->input('maritalStatus'); $patient['address'] = $request->input('address'); $patient['homePhoneNumber'] = $request->input('homePhoneNumber'); $patient['mobileNumber'] = $request->input('mobileNumber'); $patient['email'] = $request->input('email'); $patient['annualIncome'] = $request->input('annualIncome'); $patient['occupation'] = $request->input('occupation'); $patient['education'] = $request->input('education'); $patient['religion'] = $request->input('religion'); $patient['aliveChildrenCount'] = $request->input('aliveChildrenCount'); $patient['deceasedChildrenCount'] = $request->input('deceasedChildrenCount'); $patient['voterId'] = $request->input('voterId'); $patient['adharId'] = $request->input('adharId'); $missingParameters = array(); if ($patient['name'] == null) { $missingParameters[] = 'name'; } if ($patient['dob'] == null) { $missingParameters[] = 'dob'; } if ($patient['gender'] == null) { $missingParameters[] = 'gender'; } if ($patient['maritalStatus'] == null) { $missingParameters[] = 'maritalStatus'; } if ($patient['address'] == null) { $missingParameters[] = 'address'; } if ($patient['mobileNumber'] == null) { $missingParameters[] = 'mobileNumber'; } if ($patient['annualIncome'] == null) { $missingParameters[] = 'annualIncome'; } if ($patient['occupation'] == null) { $missingParameters[] = 'occupation'; } if ($patient['education'] == null) { $missingParameters[] = 'education'; } if ($patient['religion'] == null) { $missingParameters[] = 'religion'; } if ($patient['aliveChildrenCount'] == null) { $missingParameters[] = 'aliveChildrenCount'; } if ($patient['deceasedChildrenCount'] == null) { $missingParameters[] = 'deceasedChildrenCount'; } if ($request->input('eventId') == null) { $missingParameters[] = 'eventId'; } if (count($missingParameters) > 0) { $missing = ''; foreach ($missingParameters as $parameters) { $missing .= ' ' . $parameters; } return response()->json(['error' => ['message' => 'Missing parameters:' . $missing, 'code' => 400]]); } DB::beginTransaction(); try { $patient->save(); } catch (\Exception $e) { DB::rollback(); return response()->json(['error' => ['message' => 'Error while saving Patient', 'code' => 400]]); } try { $patientHistory['patientId'] = $patient->id; $patientHistory['eventId'] = $request->input('eventId'); $patientHistory['registeredBy'] = $request->input('registeredBy'); $patientHistory['diagnosis_status'] = 'Pending'; DB::table('patient_history')->insert($patientHistory); } catch (\Exception $e) { DB::rollback(); return response()->json(['error' => ['message' => 'Error while saving Patient', 'code' => 400]]); } DB::commit(); return $this->show($patient->id); }