Inheritance: extends BaseActiveRecordVersioned
Exemplo n.º 1
0
 /**
  * Returns a followup value from a patient ticket if present.
  *
  * @param $ticket_id
  *
  * @return array|bool followup value or false if not present
  */
 public function getFollowUp($ticket_id)
 {
     if (!($ticket = Ticket::model()->findByPk((int) $ticket_id))) {
         return false;
     }
     if ($queue_assignments = $ticket->queue_assignments) {
         foreach ($queue_assignments as $queue_assignment) {
             $ticket_fields = json_decode($queue_assignment->details, true);
             if ($ticket_fields) {
                 foreach ($ticket_fields as $ticket_field) {
                     if (@$ticket_field['widget_name'] == 'TicketAssignOutcome') {
                         if (@isset($ticket_field['value']['outcome'])) {
                             if ($ticket_outcome_option = TicketAssignOutcomeOption::model()->findByPk((int) $ticket_field['value']['outcome'])) {
                                 if ($ticket_outcome_option->followup == 1) {
                                     return $ticket_field['value'];
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * Generate string from the widget captured data.
  *
  * @param $data
  *
  * @return string|void
  */
 public function getReportString($data)
 {
     $res = '';
     if ($outcome_id = @$data['outcome']) {
         $outcome = models\TicketAssignOutcomeOption::model()->findByPk((int) $outcome_id);
         $res = $outcome->name;
         if ($outcome->followup) {
             if (@$data['followup_quantity'] == 1 && isset($data['followup_period'])) {
                 $data['followup_period'] = rtrim($data['followup_period'], 's');
             }
             $res .= ' in ' . @$data['followup_quantity'] . ' ' . @$data['followup_period'];
             $res .= ' at ' . @$data['clinic_location'];
         }
     }
     return $res;
 }