/** * The eye of the procedure is stored in the parent procedure list element. * * @return Eye */ public function getEye() { return Element_OphTrOperationnote_ProcedureList::model()->find('event_id=?', array($this->event_id))->eye; }
<div class="data-value"><?php echo $supervising_surg_name; ?> </div> </div> </div> <!-- <div class="operationMeta"> <div class="detailRow leftAlign"> <div class="label"> Operation(s) Performed: </div> <div class="value pronounced"> <?php $operations_perf = Element_OphTrOperationnote_ProcedureList::model()->find('event_id = ?', array($this->event->id)); foreach ($operations_perf->procedures as $procedure) { echo "<strong>{$operations_perf->eye->name} {$procedure->term}</strong><br>"; } ?> </div> </div> <div class="surgeonList"> <?php $surgeon_element = Element_OphTrOperationnote_Surgeon::model()->find('event_id = ?', array($this->event->id)); $surgeon_name = ($surgeon = User::model()->findByPk($surgeon_element->surgeon_id)) ? $surgeon->getFullNameAndTitle() : 'Unknown'; $assistant_name = ($assistant = User::model()->findByPk($surgeon_element->assistant_id)) ? $assistant->getFullNameAndTitle() : 'None'; $supervising_surg_name = ($supervising_surg = User::model()->findByPk($surgeon_element->supervising_surgeon_id)) ? $supervising_surg->getFullNameAndTitle() : 'None'; ?> <div> First Surgeon
/** * Returns the Opertion notes belongs to a patient. * * @return array list of op notes */ public function getOperationNoteList() { $patient_id = \Yii::app()->request->getParam('patient_id'); if (!$patient_id) { $patient_id = $this->event->episode->patient->id; } $response = array(); if ($patient_id) { $short_format = array(); $event_type = \EventType::model()->find("name = 'Operation Note'"); $criteria = new \CDbCriteria(); $event = new \Event(); $criteria->addCondition('patient_id = :patient_id'); $criteria->addCondition('event_type_id = :event_type_id'); $criteria->params['patient_id'] = $patient_id; $criteria->params['event_type_id'] = $event_type->id; $criteria->order = 't.created_date DESC'; $eventLists = $event->with('episode')->findAll($criteria); foreach ($eventLists as $event) { $procedureListModel = new \Element_OphTrOperationnote_ProcedureList(); $criteria = new \CDbCriteria(); $criteria->addCondition('event_id = :event_id'); $criteria->params['event_id'] = $event->id; $procedureList = $procedureListModel->findAll($criteria); $date = new \DateTime($event->created_date); $name = $date->format('d M Y') . ' '; $short_format = array(); foreach ($procedureList as $procesdures) { $name .= ($procesdures->eye_id != \Eye::BOTH ? $procesdures->eye->name : '') . ' '; foreach ($procesdures->procedures as $procesdure) { $short_format[] = $procesdure->short_format; } $name .= implode(' + ', $short_format); if (strlen($name) > 60) { $name = substr($name, 0, 57); $name .= '...'; } } $response[$event->id] = $name; } } return $response; }
protected function appendBookingValues(&$record, $event_id, $booking_diagnosis, $theatre, $bookingcomments, $surgerydate) { if ($api = Yii::app()->moduleAPI->get('OphTrOperationbooking')) { $procedure = Element_OphTrOperationnote_ProcedureList::model()->find('event_id=:event_id', array(':event_id' => $event_id)); $bookingEventID = $procedure['booking_event_id']; foreach (array('booking_diagnosis', 'theatre', 'bookingcomments', 'surgerydate') as $k) { if (${$k}) { $record[$k] = ''; } } if ($bookingEventID) { $operationElement = $api->getOperationForEvent($bookingEventID); $latestBookingID = $operationElement['latest_booking_id']; $operationBooking = OphTrOperationbooking_Operation_Booking::model()->find('id=:id', array('id' => $latestBookingID)); if ($booking_diagnosis) { $diag_el = $operationElement->getDiagnosis(); $disorder = $diag_el->disorder(); if ($disorder) { $record['booking_diagnosis'] = $diag_el->eye->adjective . ' ' . $disorder->term; } else { $record['booking_diagnosis'] = 'Unknown'; } } if ($this->theatre && $operationElement && $operationBooking) { $theatreName = $operationElement->site['name'] . ' ' . $operationBooking->theatre['name']; $record['theatre'] = $theatreName; } if ($this->bookingcomments) { $record['bookingcomments'] = $operationElement['comments']; } if ($this->surgerydate) { $record['surgerydate'] = $operationBooking['session_date']; } } } }
/** * Helper method to get the site for the operation booking on this event. * * (currently only supports events that have been saved) */ public function findBookingSite() { if ($pl = Element_OphTrOperationnote_ProcedureList::model()->find('event_id=?', array($this->event->id))) { if ($pl->bookingEvent) { if ($api = Yii::app()->moduleAPI->get('OphTrOperationbooking')) { return $api->findSiteForBookingEvent($pl->bookingEvent); } } } return; }