The followings are the available columns in table:
Inheritance: extends BaseActiveRecordVersioned
Ejemplo n.º 1
0
 /**
  * Set the default options based on episode and injection status for the patient.
  *
  * (non-PHPdoc)
  *
  * @see parent::setElementOptions($action)
  */
 protected function setElementOptions($action)
 {
     parent::setElementOptions($action);
     if ($action != 'create') {
         return;
     }
     // set any calculated defaults on the elements
     $therapy_api = Yii::app()->moduleAPI->get('OphCoTherapyapplication');
     $injection_api = Yii::app()->moduleAPI->get('OphTrIntravitrealinjection');
     $exam_api = Yii::app()->moduleAPI->get('OphCiExamination');
     $default_eye = Eye::BOTH;
     $default_left_drug = null;
     $default_right_drug = null;
     $since = new DateTime();
     $since->setTime(0, 0, 0);
     if ($this->episode && $exam_api && ($imc = $exam_api->getLatestInjectionManagementComplex($this->episode, $since))) {
         if ($side = $imc->getInjectionSide()) {
             $default_eye = $side;
             $default_left_drug = $imc->left_treatment;
             $default_right_drug = $imc->right_treatment;
         }
     } elseif ($this->episode && $therapy_api && ($side = $therapy_api->getLatestApplicationSide($this->patient, $this->episode))) {
         $default_eye = $side;
     } elseif ($this->episode && $this->episode->eye_id) {
         $default_eye = $this->episode->eye_id;
     }
     // if we haven't got the default drug from the imc, try therapy application
     if ($therapy_api) {
         if ($default_eye != Eye::RIGHT && !$default_left_drug) {
             $default_left_drug = $therapy_api->getLatestApplicationDrug($this->patient, $this->episode, 'left');
         }
         if ($default_eye != Eye::LEFT && !$default_right_drug) {
             $default_right_drug = $therapy_api->getLatestApplicationDrug($this->patient, $this->episode, 'right');
         }
     }
     // set up the values for the potentially allergy restricted drugs in treatment
     $pre_skin_default = OphTrIntravitrealinjection_SkinDrug::getDefault();
     $pre_anti_default = OphTrIntravitrealinjection_AntiSepticDrug::getDefault();
     if ($pre_skin_default) {
         foreach ($pre_skin_default->allergies as $allergy) {
             if ($this->patient->hasAllergy($allergy)) {
                 $pre_skin_default = null;
             }
         }
     }
     if ($pre_anti_default) {
         foreach ($pre_anti_default->allergies as $allergy) {
             if ($this->patient->hasAllergy($allergy)) {
                 $pre_anti_default = null;
             }
         }
     }
     foreach ($this->open_elements as $element) {
         if ($element->hasAttribute('eye_id')) {
             $element->eye_id = $default_eye;
         }
         if (get_class($element) == 'Element_OphTrIntravitrealinjection_Treatment') {
             if ($therapy_api) {
                 // get the latest drug that has been applied for and set it as default (for the appropriate eye)
                 if ($default_left_drug) {
                     $element->left_drug_id = $default_left_drug->id;
                     $previous = $injection_api->previousInjections($this->patient, $this->episode, 'left', $default_left_drug);
                     $element->left_number = count($previous) + 1;
                 }
                 if ($default_right_drug) {
                     $element->right_drug_id = $default_right_drug->id;
                     $previous = $injection_api->previousInjections($this->patient, $this->episode, 'right', $default_right_drug);
                     $element->right_number = count($previous) + 1;
                 }
             }
             $element->left_pre_skin_drug_id = $pre_skin_default ? $pre_skin_default->id : null;
             $element->right_pre_skin_drug_id = $pre_skin_default ? $pre_skin_default->id : null;
             $element->left_pre_antisept_drug_id = $pre_anti_default ? $pre_anti_default->id : null;
             $element->right_pre_antisept_drug_id = $pre_anti_default ? $pre_anti_default->id : null;
             $element->left_injection_given_by_id = Yii::app()->user->id;
             $element->right_injection_given_by_id = Yii::app()->user->id;
         }
         if (get_class($element) == 'Element_OphTrIntravitrealinjection_Site') {
             $element->site_id = $this->selectedSiteId;
         }
     }
 }
 protected function getPreAntiseptDrugString($drug_id)
 {
     if (!$drug_id) {
         return 'N/A';
     }
     if ($drug = OphTrIntravitrealinjection_AntiSepticDrug::model()->findByPk($drug_id)) {
         return $drug->name;
     } else {
         return 'UNKNOWN';
     }
 }
Ejemplo n.º 3
0
				<div class="large-4 column end">
					<?php 
echo CHtml::dropDownList('drug_id', '', CHtml::listData(OphTrIntravitrealinjection_Treatment_Drug::model()->findAll(array('order' => 'name asc')), 'id', 'name'), array('empty' => '- Please select -'));
?>
				</div>
			</div>

			<div class="row field-row">
				<div class="large-2 column">
					<?php 
echo CHtml::label('Pre Injection Antiseptic', 'pre_antisept_drug_id');
?>
				</div>
				<div class="large-4 column end">
					<?php 
echo CHtml::dropDownList('pre_antisept_drug_id', '', CHtml::listData(OphTrIntravitrealinjection_AntiSepticDrug::model()->findAll(array('order' => 'name asc')), 'id', 'name'), array('empty' => '- Please select -'));
?>
				</div>
			</div>

			<div class="row field-row">
				<div class="large-2 column">
					&nbsp;
				</div>
				<div class="large-4 column end">
					<input type="hidden" name="summary" value="0" />
					<?php 
echo CHtml::checkBox('summary');
?>
					<?php 
echo CHtml::label('Summarise patient data', 'summary');
 * This file is part of OpenEyes.
 * OpenEyes is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 * OpenEyes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License along with OpenEyes in a file titled COPYING. If not, see <http://www.gnu.org/licenses/>.
 *
 * @link http://www.openeyes.org.uk
 *
 * @author OpenEyes <*****@*****.**>
 * @copyright Copyright (c) 2008-2011, Moorfields Eye Hospital NHS Foundation Trust
 * @copyright Copyright (c) 2011-2013, OpenEyes Foundation
 * @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0
 */
?>

<?php 
$antiseptic_drugs = OphTrIntravitrealinjection_AntiSepticDrug::model()->with('allergies')->activeOrPk($element->{$side . '_pre_antisept_drug_id'})->findAll();
$antiseptic_drugs_opts = array('empty' => '- Please select -', 'nowrapper' => true, 'options' => array());
$antiseptic_allergic = false;
foreach ($antiseptic_drugs as $drug) {
    $opts = array();
    foreach ($drug->allergies as $allergy) {
        if ($this->patient->hasAllergy($allergy)) {
            $opts['data-allergic'] = 1;
            if ($drug->id == $element->{$side . '_pre_antisept_drug_id'}) {
                $antiseptic_allergic = true;
            }
        }
    }
    $antiseptic_drugs_opts['options'][(string) $drug->id] = $opts;
}
$skin_drugs = OphTrIntravitrealinjection_SkinDrug::model()->with('allergies')->activeOrPk($element->{$side . '_pre_skin_drug_id'})->findAll();