Inheritance: extends Object
コード例 #1
0
 public function activate($code, Patient $patient)
 {
     if ($patient->activateAccount($code)) {
         return 'Akun pasien Anda berhasil diaktivasi';
     }
     return 'Akun pasien Anda gagal diaktivasi';
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 protected function _createAudit($providerId, $personId, $visitId, $type)
 {
     $providerId = (int) $providerId;
     $personId = (int) $personId;
     $visitId = (int) $visitId;
     $audit = array();
     $audit['objectClass'] = 'GenericAccessAudit';
     $audit['objectId'] = $personId . ';' . $visitId;
     $audit['type'] = (int) $type;
     $audit['userId'] = $providerId;
     $audit['patientId'] = $personId;
     $values = array();
     $provider = new Provider();
     $provider->personId = $audit['userId'];
     $provider->populate();
     $values['provider'] = $provider->toArray();
     $patient = new Patient();
     $patient->personId = $personId;
     $patient->populate();
     $values['patient'] = $patient->toArray();
     $values['personId'] = $patient->personId;
     $visit = new Visit();
     $visit->visitId = $visitId;
     $visit->populate();
     $values['visit'] = $visit->toArray();
     $values['visitId'] = $visit->visitId;
     $audit['auditValues'] = $values;
     Audit::persistManualAuditArray($audit);
 }
コード例 #4
0
ファイル: patients.php プロジェクト: unisexx/imac
 function approve($id)
 {
     if ($_POST) {
         $rs = new Patient($id);
         $rs->from_array($_POST);
         $rs->save();
     }
 }
コード例 #5
0
 /**
  * get the prescription letter text for the latest prescription in the episode for the patient.
  *
  * @param Patient $patient
  * @param Episode $episode
  *
  * @return string
  */
 public function getLetterPrescription($patient)
 {
     if ($episode = $patient->getEpisodeForCurrentSubspecialty()) {
         if ($details = $this->getElementForLatestEventInEpisode($episode, 'Element_OphDrPrescription_Details')) {
             return $details->getLetterText();
         }
     }
 }
コード例 #6
0
 public function myAlertsAction()
 {
     $personId = Zend_Auth::getInstance()->getIdentity()->personId;
     $team = new TeamMember();
     $teamId = $team->getTeamByPersonId($personId);
     $rows = array();
     if (true) {
         $alertMsg = new GeneralAlert();
         $alertMsgIterator = $alertMsg->getIteratorByTeam($teamId);
         foreach ($alertMsgIterator as $alert) {
             $tmp = array();
             $tmp['id'] = $alert->generalAlertId;
             $tmp['data'][] = '<img src="' . $this->view->baseUrl . '/img/medium.png' . '" alt="' . $alert->urgency . '" /> ' . $alert->urgency;
             // below are temporary data
             $objectClass = $alert->objectClass;
             if (!class_exists($objectClass)) {
                 continue;
             }
             $obj = new $objectClass();
             foreach ($obj->_primaryKeys as $key) {
                 $obj->{$key} = $alert->objectId;
             }
             $obj->populate();
             $patient = new Patient();
             $patient->personId = $obj->personId;
             $patient->populate();
             $tmp['data'][] = $patient->person->getDisplayName();
             // patient
             $tmp['data'][] = '';
             // location
             $tmp['data'][] = date('m/d/Y H:i', strtotime($alert->dateTime));
             $tmp['data'][] = $alert->message;
             $forwardedBy = '';
             if ($alert->forwardedBy > 0) {
                 $person = new Person();
                 $person->personId = (int) $alert->forwardedBy;
                 $person->populate();
                 $forwardedBy = $person->displayName;
             }
             $tmp['data'][] = $forwardedBy;
             // forwarded
             $tmp['data'][] = $alert->comment;
             // comment
             $controllerName = call_user_func($objectClass . "::" . "getControllerName");
             $jumpLink = call_user_func_array($controllerName . "::" . "buildJSJumpLink", array($alert->objectId, $alert->userId, $objectClass));
             $js = "function jumpLink{$objectClass}(objectId,patientId) {\n{$jumpLink}\n}";
             $tmp['data'][] = $js;
             $tmp['data'][] = $objectClass . ':' . $alert->objectId . ':' . $patient->personId;
             $rows[] = $tmp;
         }
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(array('rows' => $rows));
 }
コード例 #7
0
 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'));
             }
         }
     }
 }
コード例 #8
0
 /**
  * @param $patientId
  * @param $side
  * @param $element
  * @return array
  */
 public function getPCRData($patientId, $side, $element)
 {
     $pcr = array();
     $this->patient = \Patient::model()->findByPk((int) $patientId);
     $patientAge = $this->patient->getAge();
     $ageGroup = 0;
     if ($patientAge < 60) {
         $ageGroup = 1;
     } elseif ($patientAge >= 60 && $patientAge < 70) {
         $ageGroup = 2;
     } elseif ($patientAge >= 70 && $patientAge < 80) {
         $ageGroup = 3;
     } elseif ($patientAge >= 80 && $patientAge < 90) {
         $ageGroup = 4;
     } elseif ($patientAge >= 90) {
         $ageGroup = 5;
     }
     $gender = ucfirst($this->patient->getGenderString());
     $is_diabetic = 'N';
     if ($this->patient->getDiabetes()) {
         $is_diabetic = 'Y';
     }
     $is_glaucoma = 'N';
     if (strpos($this->patient->getSdl(), 'glaucoma') !== false) {
         $is_glaucoma = 'Y';
     }
     $risk = \PatientRiskAssignment::model()->findByAttributes(array("patient_id" => $patientId));
     $user = Yii::app()->session['user'];
     $user_id = $user->id;
     if (strpos(get_class($element), 'OphTrOperationnote') !== false) {
         $user_id = $this->getOperationNoteSurgeonId($patientId);
     }
     $user_data = \User::model()->findByPk($user_id);
     $doctor_grade_id = $user_data['originalAttributes']['doctor_grade_id'];
     $pcr['patient_id'] = $patientId;
     $pcr['side'] = $side;
     $pcr['age_group'] = $ageGroup;
     $pcr['gender'] = $gender;
     $pcr['diabetic'] = $is_diabetic;
     $pcr['glaucoma'] = $is_glaucoma;
     $pcr['lie_flat'] = $this->getCannotLieFlat($patientId);
     $no_view = 'N';
     $no_view_data = $this->getOpticDisc($patientId, $side);
     if (count($no_view_data) >= 1) {
         $no_view = 'Y';
     }
     $pcr['noview'] = $no_view;
     $pcr['allod'] = $this->getOpticDisc($patientId, $side, true);
     $pcr['anteriorsegment'] = $this->getPatientAnteriorSegment($patientId, $side);
     $pcr['doctor_grade_id'] = $doctor_grade_id;
     $pcr['axial_length_group'] = $this->getAxialLength($patientId, $side);
     return $pcr;
 }
コード例 #9
0
 public function _setActivePatient($personId)
 {
     if (!$personId > 0) {
         return;
     }
     $patient = new Patient();
     $patient->personId = (int) $personId;
     $patient->populate();
     $patient->person->populate();
     $this->_patient = $patient;
     //$this->_visit = null;
     $this->view->patient = $this->_patient;
 }
コード例 #10
0
 public function execute($parameters = [])
 {
     $result = [];
     if (!isset($parameters['action'])) {
         $result = ['Result' => 'ERROR', 'Message' => 'Faltan parámetros'];
         return json_encode($result);
     }
     switch ($parameters['action']) {
         case 'patients_list':
             if (!User::isLogged()) {
                 $result = ['Result' => 'ERROR', 'Message' => 'No esta loguedo'];
             }
             extract($parameters);
             $jtStartIndex = isset($jtStartIndex) ? $jtStartIndex : 0;
             $jtPageSize = isset($jtPageSize) ? $jtPageSize : 10;
             $jtSorting = isset($jtSorting) ? $jtSorting : 'name ASC';
             $result['Result'] = 'OK';
             $result['Records'] = Patient::getPaginatePatients($jtStartIndex, $jtPageSize, $jtSorting);
             $result['TotalRecordCount'] = Patient::getTotal();
             return $result;
             break;
         case 'patient_create':
             if (!User::isLogged()) {
                 $result = ['Result' => 'ERROR', 'Message' => 'No esta loguedo'];
             }
             $p = new Patient();
             $result = $p->patient($parameters);
             return $result;
             break;
         case 'patient_update':
             if (!User::isLogged()) {
                 $result = ['Result' => 'ERROR', 'Message' => 'No esta loguedo'];
             }
             $p = new Patient();
             $result = $p->uPatient($parameters);
             return $result;
             break;
         case 'patient_delete':
             if (!User::isLogged()) {
                 $result = ['Result' => 'ERROR', 'Message' => 'No esta loguedo'];
             }
             extract($parameters);
             $result = [];
             return $result;
             break;
         default:
             $result = ['Result' => 'ERROR', 'Message' => 'Acción no definida'];
             return json_encode($result);
     }
 }
コード例 #11
0
 /**
  * Return the list of procedures as a string for use in correspondence for the given patient and episode.
  * if the $snomed_terms is true, return the snomed_term, otherwise the standard text term.
  *
  * @param Patient $patient
  * @param Episode $episode
  * @param bool    $snomed_terms
  *
  * @return string
  */
 public function getLetterProcedures($patient)
 {
     $return = '';
     if ($episode = $patient->getEpisodeForCurrentSubspecialty()) {
         if ($plist = $this->getElementForLatestEventInEpisode($episode, 'Element_OphTrOperationnote_ProcedureList')) {
             foreach ($plist->procedures as $i => $procedure) {
                 if ($i) {
                     $return .= ', ';
                 }
                 $return .= $plist->eye->adjective . ' ' . $procedure->term;
             }
         }
     }
     return $return;
 }
コード例 #12
0
 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();
 }
コード例 #13
0
 public function pidLookupAction()
 {
     $hl7 = $this->_getParam('DATA');
     $fields = split("\\|", $hl7);
     $personId = 0;
     if (count($fields) > 18) {
         $personId = (int) $fields[19];
         //field containing the MRN
     }
     $patient = new Patient();
     $patient->personId = $personId;
     if ($personId > 0 && $patient->populate()) {
         urlencode($this->render('pid-lookup.phtml'));
     }
     return urlencode($this->render('not-found'));
 }
コード例 #14
0
 public function patientList()
 {
     //appel des composants en base
     $patients = Patient::all();
     //retour de la vue
     return View::make('backend.patient.list', compact('patients'));
 }
コード例 #15
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Patient::create([]);
     }
 }
コード例 #16
0
 public function actionReconcile($args)
 {
     $hfa_cmd = Yii::app()->db_visualfields->createCommand();
     $hfa_cmd->select('imagelocation, Test_Date, TestTime, patkey');
     $hfa_cmd->from('hfa_data');
     $hfa_cmd->where('test_date >= :test_date', array(':test_date' => '2014-07-15'));
     $hfa_records = $hfa_cmd->queryAll();
     $matched = 0;
     foreach ($hfa_records as $hfa) {
         $patient = Patient::model()->noPas()->findByAttributes(array('pas_key' => $hfa['patkey']));
         $error = null;
         if (!$patient) {
             $error = 'Patient not found';
         } else {
             /*
                             $vf = OphInVisualfields_Field_Measurement::model()->with('patient_measurement')->findAllByAttributes(array(
                                             'patient_measurement.patient_id' => $patient->id,
                                             't.study_datetime' => $hfa['Test_Date'] . ' ' . $hfa['TestTime']));
             */
             $vf_cmd = Yii::app()->db->createCommand()->select('count(*) as ct')->from('ophinvisualfields_field_measurement')->join('patient_measurement', 'patient_measurement.id = ophinvisualfields_field_measurement.patient_measurement_id')->where('patient_measurement.patient_id = :patient_id AND ophinvisualfields_field_measurement.study_datetime = :dt', array(':patient_id' => $patient->id, ':dt' => $hfa['Test_Date'] . ' ' . $hfa['TestTime']));
             $vf_ct = $vf_cmd->queryRow();
             if ($vf_ct['ct'] == 0) {
                 $error = 'Missing VF';
             } elseif ($vf_ct['ct'] > 1) {
                 $error = 'Duplicate ' . $vf_ct['ct'] . 'VF';
             } else {
                 ++$matched;
             }
         }
         if ($error) {
             echo "{$error}: hosnum: {$hfa['patkey']} at " . $hfa['Test_Date'] . ' ' . $hfa['TestTime'] . '. File: ' . $hfa['imagelocation'] . "\n";
         }
     }
     echo 'MATCHED:' . $matched . "\n";
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($id)
 {
     LoginForm::checkLogin();
     $this->pageTitle = "Create Maternal Health Record";
     if (!Patient::model()->findByPk($id)) {
         Alert::alertMessage('danger', 'Patient does not exist.');
         Yii::app()->getController()->redirect(array('patient/index'));
     }
     if (MaternalHealth::model()->findByAttributes(array('patient_id' => $id))) {
         Alert::alertMessage('danger', 'Maternal Health Record for this patient already exists.');
         Yii::app()->getController()->redirect(array('patient/view', 'id' => $id));
     }
     $model = new MaternalHealth();
     $patient_model = Patient::model()->findByPk($id);
     $model->patient_id = $patient_model->id;
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['MaternalHealth'])) {
         $model->attributes = $_POST['MaternalHealth'];
         if (isset($_POST['MaternalHealth']['checklist']) && $_POST['MaternalHealth']['checklist'] !== "") {
             $model->checklist = implode(';', $_POST['MaternalHealth']['checklist']);
         }
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     if (isset($model->checklist) && $model->checklist !== '') {
         $model->checklist = explode(';', $model->checklist);
     }
     $this->render('create', array('model' => $model, 'patient_model' => $patient_model));
 }
コード例 #18
0
 public static function fromFhir($fhirObject)
 {
     $report = parent::fromFhir($fhirObject);
     $patient = \Patient::model()->find('id=?', array($report->patient_id));
     $report->patient_id = $patient->id;
     $eye = 'Right';
     if ($report->eye == 'L') {
         $eye = 'Left';
     } elseif ($report->eye == 'B') {
         $eye = 'Both';
     }
     $report->eye_id = \Eye::model()->find('name=:name', array(':name' => $eye))->id;
     if (isset($fhirObject->xml_file_data)) {
         $report->xml_file_data = base64_decode($fhirObject->xml_file_data);
     }
     $title = $report->file_reference;
     if (\ProtectedFile::model()->find('name = ?', array($title))) {
         throw new EverythingsFine("Duplicate filename: {$title} (patient ID {$report->patient_id})");
     }
     $protected_file = \ProtectedFile::createForWriting($title);
     $protected_file->name = $title;
     file_put_contents($protected_file->getPath(), base64_decode($report->image_scan_data));
     $protected_file->mimetype = 'image/gif';
     $protected_file->save();
     $cropped_file = \ProtectedFile::createForWriting($title);
     // all content is base64 encoded, so decode it:
     file_put_contents($cropped_file->getPath(), base64_decode($report->image_scan_crop_data));
     $cropped_file->mimetype = 'image/gif';
     $cropped_file->name = $title;
     $cropped_file->save();
     $report->scanned_field_id = $protected_file->id;
     $report->scanned_field_crop_id = $cropped_file->id;
     return $report;
 }
コード例 #19
0
 public function importPatientsAction()
 {
     $f = fopen('/tmp/Pacientes.csv', 'r');
     $counter = 0;
     //"recordNumber","lastName","firstName","middleName","gender (M, F, O)","initials","dateOfBirth (YYY-MM-DD)","email","defaultIdentifier","defaultIdentifierType (SHORT ALL CAPS IDENTIFIED FOR ID)","maritalStatus (S, M, D)"
     while (($data = fgetcsv($f)) !== FALSE) {
         if ($counter == 0) {
             $counter++;
             continue;
         }
         $patient = new Patient();
         $patient->_shouldAudit = false;
         $patient->confidentiality = "DEFAULT";
         $patient->recordNumber = $data[0];
         $patient->person->lastName = $data[1];
         $patient->person->firstName = $data[2];
         $patient->person->middleName = $data[3];
         $patient->person->gender = $data[4];
         $patient->person->initials = $data[5];
         $patient->person->dateOfBirth = $data[6];
         $patient->person->email = $data[7];
         $patient->person->defaultIdentifier = $data[8];
         $patient->person->defaultIdentifierType = $data[9];
         $patient->person->maritalStatus = $data[10];
         //echo "<pre>" . $patient->toString() . "<br /></pre>";
         echo $patient->person->firstName . " " . $patient->person->lastName . "<br />";
         $patient->persist();
         //echo $user->toString();
         $counter++;
     }
     fclose($f);
     exit;
 }
コード例 #20
0
 /**
  * Display a listing of diagonosticprocedures
  *
  * @return Response
  */
 public function index()
 {
     $patient_id = Input::get('id');
     $patient = Patient::find($patient_id);
     $appointments = $patient->appointments()->has('diagonosticprocedure')->get();
     return View::make('diagonosticprocedures.index', compact('appointments'));
 }
コード例 #21
0
 /**
  * Display a listing of checkupfees
  *
  * @return Response
  */
 public function index()
 {
     $patient_id = Input::get('id');
     $patient = Patient::find($patient_id);
     $appointments = $patient->appointments()->has('checkupfee')->get();
     return View::make('checkupfees.index', compact('appointments'));
 }
コード例 #22
0
ファイル: DecisionSupport.php プロジェクト: igez/gaiaehr
 /**
  * @param $rule
  * @return bool
  */
 private function ckVitals($rule)
 {
     if (isset($rule['concepts']['VITA']) && !empty($rule['concepts']['VITA'])) {
         $count = 0;
         foreach ($rule['concepts']['VITA'] as $concept) {
             $vitals = $this->Vitals->getVitalsByPid($this->Patient->getPatientPid());
             $codes = $this->Vitals->getCodes();
             $frequency = 0;
             foreach ($vitals as $vital) {
                 $mapping = $codes[$concept['concept_code']]['mapping'];
                 if ($concept['value_operator'] == '' || $this->compare($vital[$mapping], $concept['value_operator'], $concept['value'])) {
                     if ($this->isWithInterval($vital['date'], $concept['frequency_interval'], $concept['frequency_operator'], 'Y-m-d H:i:s')) {
                         $frequency++;
                         //if($concept['frequency'] == $frequency) break;
                     }
                 }
             }
             if ($concept['frequency_operator'] == '' || $this->compare($frequency, $concept['frequency_operator'], $concept['frequency'])) {
                 $count++;
             }
         }
         return $count == count($rule['concepts']['VITA']);
     }
     return true;
 }
コード例 #23
0
 public function store(Request $request)
 {
     $input = $request->all();
     // $input['timestamp'] = Carbon::now();
     // Patient::create($input);
     Patient::createNewPatient($input);
     return redirect('');
 }
コード例 #24
0
ファイル: OptController.php プロジェクト: saqibtalib/EMR-ex-
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $doctors = Employee::where('role', 'Doctor')->where('status', 'active')->get();
     $patients = Patient::all();
     $opt = Opt::find($id);
     $timeslot = $opt->timeslot->first()->where('dutyday_id', $opt->timeslot->dutyday_id)->lists('slot', 'id');
     return View::make('opt.edit', compact('timeslot', 'opt', 'doctors', 'patients'));
 }
コード例 #25
0
 /**
  * 匯入病歷
  */
 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));
 }
コード例 #26
0
 /**
  * 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');
             }
         }
     }
 }
コード例 #27
0
 public function detailAction()
 {
     $personId = (int) $this->_getParam('personId');
     if (!$personId > 0) {
         $this->_helper->autoCompleteDojo($personId);
     }
     $db = Zend_Registry::get('dbAdapter');
     $patient = new Patient();
     $patient->personId = (int) $personId;
     $patient->populate();
     $patient->person->populate();
     $outputArray = $patient->toArray();
     $outputArray['displayGender'] = $patient->displayGender;
     $outputArray['age'] = $patient->age;
     $acj = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $acj->suppressExit = true;
     $acj->direct($outputArray);
 }
コード例 #28
0
 public function getIndex()
 {
     $user = Confide::user();
     if (!$user->isStaff() && Patient::find($user->id) == null) {
         return Redirect::route('patient.create');
     } else {
         return View::make('home/index', compact('user'));
     }
 }
コード例 #29
0
ファイル: PatientZone.php プロジェクト: igez/gaiaehr
 public function getPatientsZonesByFloorPlanId($FloorPlanId)
 {
     $Patient = new Patient();
     $Pool = new PoolArea();
     $zones = $this->pz->sql("SELECT pz.id AS patientZoneId,\n\t\t\t\t\t\t\t\t  pz.pid,\n\t\t\t\t\t\t\t\t  pz.uid,\n\t\t\t\t\t\t\t\t  pz.zone_id AS zoneId,\n\t\t\t\t\t\t\t\t  time_in AS zoneTimerIn,\n\t\t\t\t\t\t\t\t  fpz.floor_plan_id AS floorPlanId\n\t\t\t\t\t\t\t FROM patient_zone AS pz\n\t\t\t\t\t\tLEFT JOIN floor_plans_zones AS fpz ON pz.zone_id = fpz.id\n\t\t\t\t\t\t\tWHERE fpz.floor_plan_id = {$FloorPlanId} AND pz.time_out IS NULL")->all();
     foreach ($zones as $i => $zone) {
         $zone['patient'] = $Patient->getPatientDemographicDataByPid($zone['pid']);
         $zone['name'] = $Patient->getPatientFullName();
         $zone['warning'] = $Patient->getPatientArrivalLogWarningByPid($zone['pid']);
         $pool = $Pool->getCurrentPatientPoolAreaByPid($zone['pid']);
         $zone['poolArea'] = $pool['poolArea'];
         $zone['priority'] = $pool['priority'];
         $zone['eid'] = $pool['eid'];
         $zones[$i] = $zone;
     }
     unset($Patient, $Pool);
     return $zones;
 }
コード例 #30
0
ファイル: PatientController.php プロジェクト: huynt57/soyba
 public function actionDetail()
 {
     $request = Yii::app()->request;
     $patient_id = StringHelper::filterString($request->getQuery("patient_id"));
     $patient_info = Patient::model()->findByAttributes(array('patient_id' => $patient_id));
     // $patient_info = Patient::model()->getPatientDetailAdmin($patient_id);
     // echo CJSON::encode($patient_info);
     $this->render('detail', array('patient_info' => $patient_info));
 }