The followings are the available columns in table 'ophtroperationnote_cataract_complications':
public function up() { $pcRupture = OphTrOperationnote_CataractComplications::model()->findByAttributes(array('name' => 'PC rupture')); $vitreousLoss = OphTrOperationnote_CataractComplications::model()->findByAttributes(array('name' => 'Vitreous loss')); $pcRuptureNoLoss = OphTrOperationnote_CataractComplications::model()->findByAttributes(array('name' => 'PC rupture no vitreous loss')); $pcRuptureLoss = OphTrOperationnote_CataractComplications::model()->findByAttributes(array('name' => 'PC rupture with vitreous loss')); foreach (OphTrOperationnote_CataractComplication::model()->findAll('complication_id = :id', array('id' => $pcRupture->id)) as $complication) { $lossCount = Yii::app()->db->createCommand()->select('count(*)')->from('ophtroperationnote_cataract_complication')->where('cataract_id=:id1 and complication_id=:id2', array(':id1' => $complication->cataract_id, ':id2' => $vitreousLoss->id))->queryScalar(); $complication->complication_id = $lossCount == 0 ? $pcRuptureNoLoss->id : $pcRuptureLoss->id; $complication->save(); } $pcRupture->delete(); }
public function description() { $description = 'Operations'; if ($this->surgeon_id) { $description .= ' by ' . User::model()->find($this->surgeon_id)->fullName; } $description .= ' between ' . date('j M Y', strtotime($this->date_from)) . ' and ' . date('j M Y', strtotime($this->date_to)); if (!empty($this->Procedures_procs)) { $description .= "\nwith procedures: "; foreach ($this->Procedures_procs as $i => $proc_id) { if ($i) { $description .= ', '; } $description .= Procedure::model()->findByPk($proc_id)->term; } } if (!empty($this->complications)) { $description .= "\nwith cataract complications: "; foreach ($this->complications as $i => $complication_id) { if ($i) { $description .= ', '; } $description .= OphTrOperationnote_CataractComplications::model()->findByPk($complication_id)->name; } } return $description; }
echo CHtml::dropDownList('surgeon_id', null, $surgeons, array('empty' => 'All surgeons')); ?> </div> </div> <?php $this->widget('application.widgets.ProcedureSelection', array('newRecord' => true, 'last' => true)); ?> <div class="row field-row"> <div class="large-2 column"> <?php echo CHtml::label('Cataract Complications', 'cat_complications'); ?> </div> <div class="large-4 column end"> <?php $this->widget('application.widgets.MultiSelectList', array('field' => 'complications', 'options' => CHtml::listData(OphTrOperationnote_CataractComplications::model()->findAll(), 'id', 'name'), 'htmlOptions' => array('empty' => '- Complications -', 'multiple' => 'multiple', 'nowrapper' => true))); ?> </div> </div> <div class="row field-row"> <div class="large-2 column"> <?php echo CHtml::label('Date From', 'date_from'); ?> </div> <div class="large-4 column end"> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'date_from', 'id' => 'date_from', 'options' => array('showAnim' => 'fold', 'dateFormat' => Helper::NHS_DATE_FORMAT_JS, 'maxDate' => 0, 'defaultDate' => '-1y'), 'value' => @$_GET['date_from'])); ?> </div> </div>
/** * Set complications and operative devices for validation. * * @param $element * @param $data * @param $index */ protected function setComplexAttributes_Element_OphTrOperationnote_Cataract($element, $data, $index) { $complications = array(); if (isset($data['OphTrOperationnote_CataractComplications']) && is_array($data['OphTrOperationnote_CataractComplications'])) { foreach ($data['OphTrOperationnote_CataractComplications'] as $c_id) { $complications[] = OphTrOperationnote_CataractComplications::model()->findByPk($c_id); } } $element->complications = $complications; $devices = array(); if (isset($data['OphTrOperationnote_CataractOperativeDevices'])) { foreach ($data['OphTrOperationnote_CataractOperativeDevices'] as $oa_id) { $devices[] = OphTrOperationnote_CataractComplications::model()->findByPk($oa_id); } } $element->operative_devices = $devices; }
public function getName() { return OphTrOperationnote_CataractComplications::model()->findByPk($this->complication_id)->name; }
echo $form->dropDownList($element, 'incision_type_id', 'OphTrOperationnote_IncisionType', array('empty' => '- Please select -', 'textAttribute' => 'data-value'), false, array('field' => 4)); echo $form->textArea($element, 'report', array(), false, array('rows' => 6)); echo $form->dropDownList($element, 'iol_type_id', array(CHtml::listData(OphTrOperationnote_IOLType::model()->activeOrPk($element->iol_type_id)->findAll(array('condition' => 'private=0', 'order' => 'display_order asc')), 'id', 'name'), CHtml::listData(OphTrOperationnote_IOLType::model()->activeOrPk($element->iol_type_id)->findAll(array('condition' => 'private=1', 'order' => 'display_order')), 'id', 'name')), array('empty' => '- Please select -', 'divided' => true), $element->iol_hidden, array('field' => 4)); ?> <div id="div_Element_OphTrOperationnote_Cataract_iol_power" class="row field-row"> <div class="large-3 column"> <label for="Element_OphTrOperationnote_Cataract_iol_power">IOL power:</label> </div> <div class="large-2 column end"> <input id="Element_OphTrOperationnote_Cataract_iol_power" type="text" name="Element_OphTrOperationnote_Cataract[iol_power]" autocomplete="off" hide="" value="<?php echo $element->iol_power; ?> "> </div> <div class="large-3 column"> <label for="Element_OphTrOperationnote_Cataract_predicted_refraction">Predicted refraction:</label> </div> <div class="large-2 column end"> <input id="Element_OphTrOperationnote_Cataract_predicted_refraction" type="text" name="Element_OphTrOperationnote_Cataract[predicted_refraction]" autocomplete="off" value="<?php echo $element->predicted_refraction; ?> "> </div> </div> <?php echo $form->dropDownList($element, 'iol_position_id', 'OphTrOperationnote_IOLPosition', array('empty' => '- Please select -'), $element->iol_hidden, array('field' => 4)); echo $form->multiSelectList($element, 'OphTrOperationnote_CataractOperativeDevices', 'operative_devices', 'id', $this->getOperativeDeviceList($element), $this->getOperativeDeviceDefaults(), array('empty' => '- Devices -', 'label' => 'Devices'), false, false, null, false, false, array('field' => 4)); echo $form->multiSelectList($element, 'OphTrOperationnote_CataractComplications', 'complications', 'id', CHtml::listData(OphTrOperationnote_CataractComplications::model()->activeOrPk($element->cataractComplicationValues)->findAll(array('order' => 'display_order asc')), 'id', 'name'), null, array('empty' => '- Complications -', 'label' => 'Complications'), false, false, null, false, false, array('field' => 4)); echo $form->textArea($element, 'complication_notes', array(), false, array('rows' => 6)); echo $form->hiddenInput($element, 'pcr_risk');