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


PHP Patient::model方法代码示例

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


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

示例1: actionReconcile

 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";
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:35,代码来源:ReconcileImportCommand.php

示例2: fromFhir

 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;
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:34,代码来源:MeasurementVisualFieldHumphrey.php

示例3: actionCreate

 /**
  * 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));
 }
开发者ID:rlaput,项目名称:integrated-municipality-management-system,代码行数:35,代码来源:MaternalhealthController.php

示例4: actionDetail

 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));
 }
开发者ID:huynt57,项目名称:soyba,代码行数:9,代码来源:PatientController.php

示例5: initForPatient

 /**
  * Initialisation function for specific patient id
  * Used for ajax actions.
  *
  * @param $patient_id
  *
  * @throws CHttpException
  */
 protected function initForPatient($patient_id)
 {
     if (!($this->patient = Patient::model()->findByPk($patient_id))) {
         throw new CHttpException(403, 'Invalid patient_id.');
     }
     if (!($this->episode = $this->getEpisode($this->firm, $patient_id))) {
         throw new CHttpException(403, 'Invalid request for this patient.');
     }
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:17,代码来源:DefaultController.php

示例6: delete

 /**
  * Delete the practice from the database, first unassociating it with any patients.
  *
  * @param int $id
  */
 public function delete($id)
 {
     if (!($prac = $this->model->findByPk($id))) {
         throw new NotFound("Practice with ID '{$id}' not found");
     }
     $crit = new \CDbCriteria();
     $crit->compare('practice_id', $id);
     \Patient::model()->updateAll(array('practice_id' => null), $crit);
     $prac->delete();
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:15,代码来源:PracticeService.php

示例7: loadData

 /**
  * Collate the data and persist it to the table.
  *
  * @param $id
  *
  * @throws CHttpException
  * @throws Exception
  */
 public function loadData($id)
 {
     $booking = Element_OphTrOperationbooking_Operation::model()->find('event_id=?', array($id));
     $eye = Eye::model()->findByPk($booking->eye_id);
     if ($eye->name === 'Both') {
         throw new CHttpException(400, 'Can\'t display whiteboard for dual eye bookings');
     }
     $eyeLabel = strtolower($eye->name);
     $event = Event::model()->findByPk($id);
     $episode = Episode::model()->findByPk($event->episode_id);
     $patient = Patient::model()->findByPk($episode->patient_id);
     $contact = Contact::model()->findByPk($patient->contact_id);
     $biometryCriteria = new CDbCriteria();
     $biometryCriteria->addCondition('patient_id = :patient_id');
     $biometryCriteria->params = array('patient_id' => $patient->id);
     $biometryCriteria->order = 'last_modified_date DESC';
     $biometryCriteria->limit = 1;
     $biometry = Element_OphTrOperationnote_Biometry::model()->find($biometryCriteria);
     $examination = $event->getPreviousInEpisode(EventType::model()->findByAttributes(array('name' => 'Examination'))->id);
     //$management = new \OEModule\OphCiExamination\models\Element_OphCiExamination_Management();
     //$anterior = new \OEModule\OphCiExamination\models\Element_OphCiExamination_AnteriorSegment();
     $risks = new \OEModule\OphCiExamination\models\Element_OphCiExamination_HistoryRisk();
     if ($examination) {
         //$management = $management->findByAttributes(array('event_id' => $examination->id));
         //$anterior = $anterior->findByAttributes(array('event_id' => $examination->id));
         $risks = $risks->findByAttributes(array('event_id' => $examination->id));
     }
     $labResult = Element_OphInLabResults_Inr::model()->findPatientResultByType($patient->id, '1');
     $allergies = Yii::app()->db->createCommand()->select('a.name as name')->from('patient_allergy_assignment pas')->leftJoin('allergy a', 'pas.allergy_id = a.id')->where("pas.patient_id = {$episode->patient_id}")->order('a.name')->queryAll();
     $allergyString = 'None';
     if ($allergies) {
         $allergyString = implode(',', array_column($allergies, 'name'));
     }
     $operation = Yii::app()->db->createCommand()->select('proc.term as term')->from('et_ophtroperationbooking_operation op')->leftJoin('ophtroperationbooking_operation_procedures_procedures opp', 'opp.element_id = op.id')->leftJoin('proc', 'opp.proc_id = proc.id')->where("op.event_id = {$id}")->queryAll();
     $this->event_id = $id;
     $this->booking = $booking;
     $this->eye_id = $eye->id;
     $this->eye = $eye;
     $this->predicted_additional_equipment = $booking->special_equipment_details;
     $this->comments = '';
     $this->patient_name = $contact['title'] . ' ' . $contact['first_name'] . ' ' . $contact['last_name'];
     $this->date_of_birth = $patient['dob'];
     $this->hos_num = $patient['hos_num'];
     $this->procedure = implode(',', array_column($operation, 'term'));
     $this->allergies = $allergyString;
     $this->iol_model = $biometry ? $biometry->attributes['lens_description_' . $eyeLabel] : 'Unknown';
     $this->iol_power = $biometry ? $biometry->attributes['iol_power_' . $eyeLabel] : 'none';
     $this->predicted_refractive_outcome = $biometry ? $biometry->attributes['predicted_refraction_' . $eyeLabel] : 'Unknown';
     $this->alpha_blockers = $patient->hasRisk('Alpha blockers');
     $this->anticoagulants = $patient->hasRisk('Anticoagulants');
     $this->alpha_blocker_name = $risks ? $risks->alpha_blocker_name : '';
     $this->anticoagulant_name = $risks ? $risks->anticoagulant_name : '';
     $this->inr = $labResult ? $labResult : 'None';
     $this->save();
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:63,代码来源:OphTrOperationbooking_Whiteboard.php

示例8: getPCRData

 /**
  * @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;
 }
开发者ID:across-health,项目名称:OphCiExamination,代码行数:59,代码来源:PcrRisk.php

示例9: getHistoryByPatient

 public function getHistoryByPatient($patient_id)
 {
     $patient = Patient::model()->findByPk($patient_id);
     if ($patient) {
         $reminds = MedicineRemind::model()->findAllByAttributes(array('patient_id' => $patient->patient_id));
         $returnArr = array();
         if ($reminds) {
             foreach ($reminds as $remind) {
                 $history = HistoryRemind::model()->findAllByAttributes(array('remind_id' => $remind->id));
                 $returnArr[] = $history;
             }
             return $returnArr;
         }
     }
 }
开发者ID:huynt57,项目名称:soyba,代码行数:15,代码来源:HistoryRemind.php

示例10: actionCreate

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

示例11: actionDetail

 public function actionDetail()
 {
     $this->retVal = new stdClass();
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST)) {
         try {
             $id = StringHelper::filterString($request->getPost('id'));
             $patient_info = Patient::model()->getPatientInfo($id);
             $this->retVal->patient_info = $patient_info;
         } catch (exception $e) {
             $this->retVal->message = $e->getMessage();
         }
         echo CJSON::encode($this->retVal);
         Yii::app()->end();
     }
 }
开发者ID:huynt57,项目名称:soyba,代码行数:16,代码来源:UserController.php

示例12: authenticate

 /**
  * Authenticates a user.
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     if ($this->user_type == 1 || $this->user_type == 2) {
         $criteria = new CDbCriteria();
         $criteria->condition = 'LOWER(mid)=' . strtolower($this->username) . ' AND management_user_level_id=' . $this->user_type;
         $user = Management::model()->find($criteria);
     } else {
         if ($this->user_type == 4) {
             $user = Doctor::model()->find('LOWER(did)=?', array(strtolower($this->username)));
         } else {
             if ($this->user_type == 3) {
                 $user = Patient::model()->find('LOWER(pid)=?', array(strtolower($this->username)));
             } else {
                 $user = Nurses::model()->find('LOWER(nid)=?', array(strtolower($this->username)));
             }
         }
     }
     if ($user === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } else {
         if (!($user->pass == $this->password)) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             if ($this->user_type == 1 || $this->user_type == 2) {
                 $this->_id = $user->mid;
                 $this->username = $user->mid;
             } else {
                 if ($this->user_type == 4) {
                     $this->_id = $user->did;
                     $this->username = $user->did;
                 } else {
                     if ($this->user_type == 3) {
                         $this->_id = $user->pid;
                         $this->username = $user->pid;
                     } else {
                         $this->_id = $user->nid;
                         $this->username = $user->nid;
                     }
                 }
             }
             $this->_type = $this->user_type;
             $this->errorCode = self::ERROR_NONE;
             $this->setState("type", $this->_type);
         }
     }
     return $this->errorCode == self::ERROR_NONE;
 }
开发者ID:banyan-tree,项目名称:Hospital-Management-System,代码行数:51,代码来源:UserIdentity.php

示例13: actionCreate

 /**
  * 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 NTP Treatment Card";
     if (!Patient::model()->findByPk($id)) {
         Alert::alertMessage('danger', 'Patient does not exist.');
         Yii::app()->getController()->redirect(array('patient/index'));
     }
     $model = new NtpTreatmentCard();
     $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['NtpTreatmentCard'])) {
         $model->attributes = $_POST['NtpTreatmentCard'];
         if (isset($_POST['NtpTreatmentCard']['type_of_patient']) && $_POST['NtpTreatmentCard']['type_of_patient'] !== "") {
             $model->type_of_patient = implode(';', $_POST['NtpTreatmentCard']['type_of_patient']);
         }
         if (isset($_POST['NtpTreatmentCard']['category_1']) && $_POST['NtpTreatmentCard']['category_1'] !== "") {
             $model->category_1 = implode(';', $_POST['NtpTreatmentCard']['category_1']);
         }
         if (isset($_POST['NtpTreatmentCard']['category_2']) && $_POST['NtpTreatmentCard']['category_2'] !== "") {
             $model->category_2 = implode(';', $_POST['NtpTreatmentCard']['category_2']);
         }
         if (isset($_POST['NtpTreatmentCard']['category_3']) && $_POST['NtpTreatmentCard']['category_3'] !== "") {
             $model->category_3 = implode(';', $_POST['NtpTreatmentCard']['category_3']);
         }
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     if (isset($model->type_of_patient) && $model->type_of_patient !== '') {
         $model->type_of_patient = explode(';', $model->type_of_patient);
     }
     if (isset($model->category_1) && $model->category_1 !== '') {
         $model->category_1 = explode(';', $model->category_1);
     }
     if (isset($model->category_2) && $model->category_2 !== '') {
         $model->category_2 = explode(';', $model->category_2);
     }
     if (isset($model->category_3) && $model->category_3 !== '') {
         $model->category_3 = explode(';', $model->category_3);
     }
     $this->render('create', array('model' => $model, 'patient_model' => $patient_model));
 }
开发者ID:rlaput,项目名称:integrated-municipality-management-system,代码行数:49,代码来源:NtptreatmentcardController.php

示例14: actionUpdateDetailCalendar

 public function actionUpdateDetailCalendar()
 {
     $this->retVal = new stdClass();
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST)) {
         try {
             $id = StringHelper::filterString($request->getPost('id'));
             //   $name = StringHelper::filterString($request->getPost('name'));
             $date = StringHelper::filterString($request->getPost('date'));
             $note = StringHelper::filterString($request->getPost('note'));
             $done = StringHelper::filterString($request->getPost('done'));
             Patient::model()->updatePatientCalendar($id, $done, $date, $note);
         } catch (Exception $ex) {
             $this->retVal->message = $ex->getMessage();
         }
     }
     echo CJSON::encode($this->retVal);
     Yii::app()->end();
 }
开发者ID:huynt57,项目名称:soyba,代码行数:19,代码来源:CalendarController.php

示例15: actionCreate

 /**
  * 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 NTP Laboratory Request";
     if (!Patient::model()->findByPk($id)) {
         Alert::alertMessage('danger', 'Patient does not exist.');
         Yii::app()->getController()->redirect(array('patient/index'));
     }
     $model = new NtpLaboratoryRequest();
     $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['NtpLaboratoryRequest'])) {
         $model->attributes = $_POST['NtpLaboratoryRequest'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model, 'patient_model' => $patient_model));
 }
开发者ID:rlaput,项目名称:integrated-municipality-management-system,代码行数:25,代码来源:NtplaboratoryrequestController.php


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