当前位置: 首页>>代码示例>>PHP>>正文


PHP Patient::save方法代码示例

本文整理汇总了PHP中Patient::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Patient::save方法的具体用法?PHP Patient::save怎么用?PHP Patient::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Patient的用法示例。


在下文中一共展示了Patient::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 public function create()
 {
     $user = Confide::user();
     //throw new Exception($user);
     if (Request::isMethod('GET')) {
         $patient = Patient::find($user->id);
         return View::make('home/patient/create', compact('user', 'patient'));
     } elseif (Request::isMethod('POST')) {
         // Create a new Appointment with the given data
         $user = Confide::user();
         $user->fill(Input::all());
         $user->save();
         // If patient already exists in system
         $patient = Patient::find($user->id);
         if ($patient != null) {
             // Retreive Patient
         } else {
             // Create a new account for the Patient
             $account = new Account();
             $account->patient_id = $user->id;
             $account->save();
             // Create a new Patient
             $patient = new Patient();
             $patient->fill(Input::all());
             //$patient->dob = new Date();
             $patient->user_id = $user->id;
             $patient->save();
         }
         return Redirect::route('home.index');
     }
 }
开发者ID:carlosqueiroz,项目名称:medical-management-system,代码行数:31,代码来源:PatientController.php

示例2: actionAddPatient

 public function actionAddPatient()
 {
     $this->authenUser();
     $formAddPatient = new formAddPatient();
     $addPatient = new Patient();
     $systemCities = SystemCity::model()->findAll();
     $systemCitiesData = $this->generateSystemCities($systemCities);
     if (isset($_POST['formAddPatient'])) {
         $addPatient->attributes = $_POST['formAddPatient'];
         $addPatient->profile_creator = $this->userId;
         $addPatient->regDate();
         $addPatient->save();
         if ($addPatient->pid != NULL) {
             $patientAddress = $_POST['formAddPatient']['address'];
             $patientCity = $_POST['formAddPatient']['city'];
             if ($patientAddress != '' || $patientCity != '') {
                 $addPatientAddress = new PatientAddress();
                 $addPatientAddress->patient_pid = $addPatient->pid;
                 if ($patientAddress != '') {
                     $addPatientAddress->address = $patientAddress;
                 }
                 if ($patientCity != '') {
                     $addPatientAddress->city_id = $patientCity;
                 }
                 $addPatientAddress->save();
                 $this->redirect(array('manage/selectPatient'));
             }
         }
         Yii::app()->end();
     }
     $formAddPatient->generatePassword();
     $this->render('addPatient', array('formAddPatient' => $formAddPatient, 'systemCitiesData' => $systemCitiesData));
 }
开发者ID:banyan-tree,项目名称:Hospital-Management-System,代码行数:33,代码来源:ManageController.php

示例3: postRegister

 public function postRegister()
 {
     $validationRules = array('email' => 'required|email|unique:users', 'password' => 'required|min:8|confirmed', 'type' => 'required');
     $formValidator = Validator::make(Input::all(), $validationRules);
     if ($formValidator->passes()) {
         // creatting new user
         $createUser = new User();
         $createUser->email = Input::get('email');
         $createUser->type = Input::get('type');
         $createUser->password = Hash::make(Input::get('password'));
         $createUser->status = 'OFF';
         $createUser->save();
         // checking to create if user is patient or physician
         if ($createUser->type == 'PHYSICIAN') {
             $createPhysisician = new Physician();
             $createPhysisician->user_id = $createUser->id;
             $createPhysisician->save();
         }
         if ($createUser->type == 'PATIENT') {
             $createPatient = new Patient();
             $createPatient->user_id = $createUser->id;
             $createPatient->save();
         }
         return Redirect::to('user/login')->with('success', ' Account created, please login');
     } else {
         return Redirect::back()->withInput()->withErrors($formValidator);
     }
 }
开发者ID:Crucifix-Fiesta,项目名称:umhcs,代码行数:28,代码来源:UserController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $rules = array('patient_number' => 'required|unique:patients,patient_number', 'name' => 'required', 'gender' => 'required', 'dob' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput(Input::all());
     } else {
         // store
         $patient = new Patient();
         $patient->patient_number = Input::get('patient_number');
         $patient->name = Input::get('name');
         $patient->gender = Input::get('gender');
         $patient->dob = Input::get('dob');
         $patient->email = Input::get('email');
         $patient->address = Input::get('address');
         $patient->phone_number = Input::get('phone_number');
         $patient->created_by = Auth::user()->id;
         try {
             $patient->save();
             $url = Session::get('SOURCE_URL');
             return Redirect::to($url)->with('message', 'Successfully created patient!');
         } catch (QueryException $e) {
             Log::error($e);
         }
         // redirect
     }
 }
开发者ID:BaobabHealthTrust,项目名称:iBLIS,代码行数:33,代码来源:PatientController.php

示例5: approve

 function approve($id)
 {
     if ($_POST) {
         $rs = new Patient($id);
         $rs->from_array($_POST);
         $rs->save();
     }
 }
开发者ID:unisexx,项目名称:imac,代码行数:8,代码来源:patients.php

示例6: doSave

 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aPatient !== null) {
             if ($this->aPatient->isModified() || $this->aPatient->isNew()) {
                 $affectedRows += $this->aPatient->save($con);
             }
             $this->setPatient($this->aPatient);
         }
         if ($this->aVisit !== null) {
             if ($this->aVisit->isModified() || $this->aVisit->isNew()) {
                 $affectedRows += $this->aVisit->save($con);
             }
             $this->setVisit($this->aVisit);
         }
         if ($this->aPharma !== null) {
             if ($this->aPharma->isModified() || $this->aPharma->isNew()) {
                 $affectedRows += $this->aPharma->save($con);
             }
             $this->setPharma($this->aPharma);
         }
         if ($this->aDosage !== null) {
             if ($this->aDosage->isModified() || $this->aDosage->isNew()) {
                 $affectedRows += $this->aDosage->save($con);
             }
             $this->setDosage($this->aDosage);
         }
         if ($this->isNew()) {
             $this->modifiedColumns[] = VisitMedicinePeer::ID;
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = VisitMedicinePeer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setId($pk);
                 //[IMV] update autoincrement primary key
                 $this->setNew(false);
             } else {
                 $affectedRows += VisitMedicinePeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:lejacome,项目名称:hospital-mgt,代码行数:69,代码来源:BaseVisitMedicine.php

示例7: store

 /**
  * Store a newly created patient in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Patient::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $patient = new Patient();
     $patient->name = Input::get('name');
     //  $patient->save();
     $patient->dob = Input::get('dob');
     //$patient->save();
     if (Input::has('email')) {
         $patient->email = Input::get('email');
         //  $patient->save();
     } else {
         $patient->email = 'N/A';
         //$patient->save();
     }
     $patient->gender = Input::get('gender');
     //$patient->save();
     $patient->age = Input::get('age');
     //$patient->save();
     $patient->city = Input::get('city');
     //$patient->save();
     $patient->country = Input::get('country');
     // $patient->save();
     $patient->address = Input::get('address');
     //$patient->save();
     if (Input::get('phone') == '') {
         $patient->phone = 'N/A';
     } else {
         $patient->phone = Input::get('phone');
     }
     // $patient->save();
     if (Input::get('cnic') == '') {
         $patient->cnic = 'N/A';
     } else {
         $patient->cnic = Input::get('cnic');
     }
     //$patient->save();
     if (Input::get('note') == '') {
         $patient->note = 'N/A';
     } else {
         $patient->note = Input::get('note');
     }
     //$patient->save();
     $patient->status = "OPD";
     $patient->patient_id = "P0" . $patient->id;
     $patient->save();
     if (Input::has('email')) {
         $data = ['name' => Input::get('name')];
         Mail::queue('emails.patient_welcome', $data, function ($message) {
             $message->to(Input::get('email'), Input::get('name'))->subject('Welcome to EMR!');
         });
     }
     return Redirect::route('patients.index');
 }
开发者ID:saqibtalib,项目名称:EMR-ex-,代码行数:62,代码来源:PatientsController.php

示例8: insert

 public function insert()
 {
     //echo "in insert controller";
     include 'model/patient.php';
     $patient = new Patient($_POST["username"], $_POST["password"], $_POST["name"], $_POST["age"], $_POST["contact"], $_POST["doctor"], $_POST["hospital"]);
     // var_dump($patient);
     // die();
     $patient->save();
     header('location: view/patient/registered.php');
 }
开发者ID:Anugrahaa,项目名称:medical_record_system,代码行数:10,代码来源:patient_controller.php

示例9: store

 public function store()
 {
     if (Request::ajax()) {
         $data = array("agenda_id" => Input::get("agenda_id"), "patient" => Input::get("patient"), "reason" => Input::get("reason"), "fecha" => Input::get("fecha"), "start" => Input::get("start"), "end" => Input::get("end"));
         $rules = array("agenda_id" => 'required', "patient" => 'required|min:2|max:100', "reason" => 'required|min:2|max:200', "fecha" => 'required|min:1|max:100', "start" => 'required|min:1|max:100', "end" => 'required|min:1|max:100');
         $messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.', 'numeric' => 'El campo :attribute debe contener solo numeros', 'mimes' => 'El formato de la imagen logo debe ser jpg, git, png');
         $validation = Validator::make(Input::all(), $rules, $messages);
         //si la validación falla redirigimos al formulario de registro con los errores
         if ($validation->fails()) {
             return Response::json(array('success' => false, 'errors' => $validation->getMessageBag()->toArray()));
         } else {
             $agenda = Agenda::find(Input::get('agenda_id'));
             $user = User::where('email', Input::get('patient'))->orWhere('username', Input::get('patient'))->first();
             if ($user) {
                 $patient = Patient::where('user_id', $user->id)->first();
                 if (!$patient) {
                     $patient = new Patient();
                     $patient->user_id = $user->id;
                     $patient->save();
                 }
                 $docPatient = DoctorPatient::where('patient_id', $patient->id)->where('doctor_id', $agenda->doctor_id)->first();
                 if (!$docPatient) {
                     $docPatient = new DoctorPatient();
                     $docPatient->patient_id = $patient->id;
                     $docPatient->doctor_id = $agenda->doctor_id;
                     $docPatient->save();
                 }
                 $apo = new Appointment();
                 $apo->patient_id = $patient->id;
                 $apo->agenda_id = $agenda->id;
                 $apo->day = Input::get("fecha");
                 $apo->start_date = Input::get('start');
                 $apo->end_date = Input::get('end');
                 $apo->reason = Input::get('reason');
                 if ($agenda->appointment_state == 0) {
                     $apo->state = 'confirmed';
                 } else {
                     $apo->state = 'pending';
                 }
                 $apo->save();
                 if ($apo) {
                     if ($agenda->appointment_state == 0) {
                         $mgs = new MgsAppointment();
                         $mgs->appointment_id = $apo->id;
                         $mgs->text = "Su cita fue Confirmada";
                         $mgs->save();
                     }
                     return Response::json(array('success' => true));
                 }
             } else {
                 return Response::json(array('success' => false, 'errors' => 'El usuario no existe'));
             }
         }
     }
 }
开发者ID:jnicolasbc,项目名称:admin_swp_com,代码行数:55,代码来源:AppointmentsController.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $response = null;
     $patient = new Patient();
     // se valida que la petición sea por post
     if (Request::isMethod('POST')) {
         // se validan las entradas antes de intentar crear un nuevo usuario
         Log::info(Input::all());
         if ($this->isValidForAdd()) {
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.IDENTIFICATION_TYPE_ID')))) {
                 $patient->identificationTypeId = Input::get(Config::get('constants.PATIENT.ATTRS.IDENTIFICATION_TYPE_ID'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.MARITAL_STATUS_ID')))) {
                 $patient->maritalStatusId = Input::get(Config::get('constants.PATIENT.ATTRS.MARITAL_STATUS_ID'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.NAME')))) {
                 $patient->name = Input::get(Config::get('constants.PATIENT.ATTRS.NAME'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.LASTNAME')))) {
                 $patient->lastname = Input::get(Config::get('constants.PATIENT.ATTRS.LASTNAME'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.IDENTIFICATION_NUMBER')))) {
                 $patient->identificationNumber = Input::get(Config::get('constants.PATIENT.ATTRS.IDENTIFICATION_NUMBER'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.PLACEBIRTH')))) {
                 $patient->placebirth = Input::get(Config::get('constants.PATIENT.ATTRS.PLACEBIRTH'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.BIRTHDATE')))) {
                 $patient->birthdate = Input::get(Config::get('constants.PATIENT.ATTRS.BIRTHDATE'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.GENDER')))) {
                 $patient->gender = Input::get(Config::get('constants.PATIENT.ATTRS.GENDER'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.OCCUPATION')))) {
                 $patient->occupation = Input::get(Config::get('constants.PATIENT.ATTRS.OCCUPATION'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.RESIDENCE_CITY')))) {
                 $patient->residenceCity = Input::get(Config::get('constants.PATIENT.ATTRS.RESIDENCE_CITY'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.ADDRESS')))) {
                 $patient->address = Input::get(Config::get('constants.PATIENT.ATTRS.ADDRESS'));
             }
             $patient->save();
             // seguardan los datos de los responsables
             $custodians = Input::get(Config::get('constants.CUSTODIANS'));
             foreach ($custodians as $custodian) {
                 $this->storeCustodian($custodian, $patient->patientId);
             }
             $response = $this->responseCreatedSuccessfulElement($patient, new PatientTransformer());
         } else {
             $response = $this->respondWithError($this->getErrors(), self::CODE_WRONG_ARGUMENTS);
         }
     }
     return $response;
 }
开发者ID:jhoansebastianlara,项目名称:esclinicadigital,代码行数:60,代码来源:PatientController.php

示例11: actionSeed

 public function actionSeed()
 {
     $patients = new Patient();
     $patients->attributes = array('name' => '鍾**', 'sex' => 1, 'birthday' => '1989-10-21', 'birth_weight' => 3000, 'telphone' => '08-735****', 'cellphone' => '0917******', 'address' => '屏東市**********', 'doctor_id' => 1, 'icd' => '');
     $patients->save();
     $patients = new Patient();
     $patients->attributes = array('name' => '林**', 'sex' => 1, 'birthday' => '1989-08-12', 'birth_weight' => 3000, 'telphone' => '08-735****', 'cellphone' => '0917******', 'address' => '新北市*******', 'doctor_id' => 1, 'icd' => '');
     $patients->save();
     $icd = new Icd();
     $icd->attributes = array('name' => '1號疾病', 'description' => '');
     $icd->save();
     $icd = new Icd();
     $icd->attributes = array('name' => '2號疾病', 'description' => '');
     $icd->save();
 }
开发者ID:luckily,项目名称:casehistory,代码行数:15,代码来源:RelationController.php

示例12: actionPatients

 /**
  * 匯入病歷
  */
 public function actionPatients()
 {
     $this->currentActive = '病歷';
     $excel = new ExcelUploadForm();
     $rows = array();
     $errors = array();
     if (isset($_POST['ExcelUploadForm'])) {
         $excel->attributes = $_POST['ExcelUploadForm'];
         $excel->file = CUploadedFile::getInstance($excel, 'file');
         $transaction = Yii::app()->db->beginTransaction();
         try {
             if ($excel->validate()) {
                 $rows = $excel->getContents();
                 foreach ($rows as $i => $row) {
                     if ($i != ExcelUploadForm::HEADER) {
                         $patient = new Patient();
                         $patient->id = $row[1];
                         $patient->name = $row[2];
                         $patient->sex = $this->_getConvertSexData($row[3]);
                         $patient->birthday = $row[4];
                         $patient->telphone = $row[5];
                         $patient->cellphone = $row[6];
                         $patient->address = $row[7];
                         $patient->birth_weight = $row[8];
                         $patient->family_history = $row[9];
                         $patient->pregnancy_history = $row[10];
                         $patient->fetus = $row[11];
                         if (!$patient->save()) {
                             $errorData = array($patient->name => $patient->getErrors());
                             $errors[] = $errorData;
                         }
                     }
                 }
                 $transaction->commit();
             } else {
                 $errors[] = array('Excel' => $excel->getErrors());
             }
         } catch (Exception $e) {
             $transaction->rollBack();
             $errors = $e->getMessage();
         }
         $this->_setFlashMessage($errors);
         $this->redirect($this->createUrl("/excel/import/{$this->action->id}"));
     }
     $this->render('upload', array('excel' => $excel));
 }
开发者ID:luckily,项目名称:casehistory,代码行数:49,代码来源:ImportController.php

示例13: registration

 /**
  * Display a listing of the resource.
  * GET /patientregistration
  *
  * @return Response
  */
 public function registration()
 {
     $destinationPath = public_path('patient_image/');
     $link_address = "/view/patients_managment/appointment";
     $patient_id = null;
     $rules = array('field_email' => 'required|email', 'field_password' => 'required|min:3|confirmed', 'field_password' => 'required|min:3', 'field_name' => 'required', 'field_dob' => 'required', 'field_gender' => 'required', 'field_religion' => 'required', 'field_visitNo' => 'required');
     $data = Input::all();
     // Create a new validator instance.
     $validator = Validator::make($data, $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator);
     } else {
         if (!Input::hasFile('field_image')) {
             return Redirect::back()->withErrors("Image is required");
         } else {
             $photo_fileName = null;
             if (Input::hasFile('field_image')) {
                 $photo = Input::file('field_image');
                 $photo_fileName = strtotime(date('Y-m-d H:i:s')) . md5($photo->getClientOriginalName()) . "." . $photo->getClientOriginalExtension();
                 $photo->move($destinationPath, $photo_fileName);
             }
             $user = new User();
             $user->email = Input::get('field_email');
             $user->password = Hash::make(Input::get('field_password'));
             $user->access_level = '4';
             if ($user->save()) {
                 $patient = new Patient();
                 $patient->name = $data['field_name'];
                 $patient->dob = $data['field_dob'];
                 $patient->gender = $data['field_gender'];
                 $patient->religion = $data['field_religion'];
                 $patient->no_of_visit = $data['field_visitNo'];
                 $patient->image = $photo_fileName;
                 $patient->report = $user->id;
                 if ($patient->save()) {
                     return Redirect::route('login');
                 } else {
                     return Redirect::back()->withErrors('Something Went wrong, please try again');
                 }
             } else {
                 return Redirect::back()->withErrors('Something Went wrong, please try again');
             }
         }
     }
 }
开发者ID:Nishikanto,项目名称:Website,代码行数:51,代码来源:PatientRegistration.php

示例14: actionCreate

 public function actionCreate()
 {
     $patient = new Patient();
     $doctors = Doctor::model()->findAll();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($patient);
     if (isset($_POST['Patient'])) {
         if (empty($_POST['Patient']['id'])) {
             unset($_POST['Patient']['id']);
         }
         $patient->attributes = $_POST['Patient'];
         if ($patient->save()) {
             Yii::app()->user->setFlash('success', '儲存成功.');
             $this->redirect(array('update', 'id' => $patient->id));
         }
     }
     $this->render('create', array('patient' => $patient, 'doctors' => $doctors));
 }
开发者ID:luckily,项目名称:casehistory,代码行数:18,代码来源:PatientController.php

示例15: executeAddPatient

 public function executeAddPatient(sfWebRequest $request)
 {
     if ($request->isMethod('Post')) {
         /*$a = new Criteria();
         		$designation_record = DesignationPeer::DoSelectOne($a);
         		$department_id = $designation_record->getDepartmentId();*/
         $patient = new Patient();
         $dob = $this->getRequestParameter('dob[year]') . '-' . $this->getRequestParameter('dob[month]') . '-' . $this->getRequestParameter('dob[day]');
         $patient->setName($this->getRequestParameter('name'));
         $patient->setCnic($this->getRequestParameter('cnic'));
         $patient->setDob($dob);
         $patient->setGender($this->getRequestParameter('gender[0]'));
         $patient->setContactCell($this->getRequestParameter('contact_cell'));
         $patient->setStatus(Constant::RECORD_STATUS_ACTIVE);
         $patient->save();
         $this->getUser()->setFlash('SUCCESS_MESSAGE', 'Patient Added Successfully');
         $this->redirect('Patient/list');
     }
     // end if
 }
开发者ID:lejacome,项目名称:hospital-mgt,代码行数:20,代码来源:actions.class.php


注:本文中的Patient::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。