/** * @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; }
/** * @covers Patient::getAge * @todo Implement testGetAge(). */ public function testGetAge() { Yii::app()->params['pseudonymise_patient_details'] = false; $attributes = array('hos_num' => 5550101, 'first_name' => 'Rod', 'last_name' => 'Flange', 'dob' => '1979-09-08', 'title' => 'MR', 'primary_phone' => '0208 1111111', 'address_id' => 1); $patient = new Patient(); $patient->setAttributes($attributes); $patient->save(); $age = date('Y') - 1979; if (date('md') < '0908') { $age--; // have not had a birthday yet } $this->assertEquals($age, $patient->getAge()); }
} if ($patient->getPhone()) { echo HTML::section(3, _("Telefone de contato")); echo HTML::para(nl2br($patient->getPhone())); } echo HTML::section(3, _("Sexo")); echo HTML::para($patient->getSex() == 'V' ? _("Male") : _("Female")); if ($patient->getRace()) { echo HTML::section(3, _("Raça/Cor")); echo HTML::para($patient->getRace()); } if ($patient->getBirthDate() != "" && $patient->getBirthDate() != "0000-00-00") { echo HTML::section(3, _("Data nascimento")); echo HTML::para(I18n::localDate($patient->getBirthDate())); echo HTML::section(3, _("Idade")); echo HTML::para($patient->getAge()); } if ($patient->getBirthPlace()) { echo HTML::section(3, _("Cidade em que nasceu")); echo HTML::para($patient->getBirthPlace()); } if ($patient->getDeceaseDate() != "" && $patient->getDeceaseDate() != "0000-00-00") { echo HTML::section(3, _("Data de saída do benefício")); echo HTML::para(I18n::localDate($patient->getDeceaseDate())); } if ($patient->getNTS()) { echo HTML::section(3, _("RG")); echo HTML::para($patient->getNTS()); } if ($patient->getNSS()) { echo HTML::section(3, _("CPF"));