The followings are the available columns in table:
상속: extends BaseActiveRecordVersioned
 /**
  * @param \Patient $patient
  * @param bool     $active
  *
  * @return models\Ticket[]
  */
 public function getTicketsForPatient(\Patient $patient, $active = true)
 {
     $criteria = new \CDbCriteria(array('order' => 't.created_date desc'));
     $criteria->addColumnCondition(array('patient_id' => $patient->id));
     $tickets = models\Ticket::model()->with('current_queue')->findAll($criteria);
     if ($active) {
         $res = array();
         foreach ($tickets as $t) {
             if (!$t->is_complete()) {
                 $res[] = $t;
             }
         }
         return $res;
     } else {
         return $tickets;
     }
 }
예제 #2
0
 public function actionUndoLastStep($id)
 {
     if (!($ticket = models\Ticket::model()->findByPk($id))) {
         throw new \Exception("Ticket not found: {$id}");
     }
     $queue_assignments = $ticket->queue_assignments;
     $last_assignment = array_pop($queue_assignments);
     if (!$last_assignment->delete()) {
         throw new \Exception('Unable to remove ticket queue assignment: ' . print_r($last_assignment->errors, true));
     }
     echo '1';
 }
 /**
  * Returns true if current rules allow the patient to be added to the given queueset.
  *
  * @param \Patient $patient
  * @param $queueset_id
  *
  * @return bool
  */
 public function canAddPatientToQueueSet(\Patient $patient, $queueset_id)
 {
     $tickets = models\Ticket::model()->with('current_queue')->findAllByAttributes(array('patient_id' => $patient->id));
     $q_rs = $this->getQueueSetQueues($this->read($queueset_id), false);
     $q_ids = array_map(function ($a) {
         return $a->id;
     }, $q_rs);
     foreach ($tickets as $t) {
         if (in_array($t->current_queue->id, $q_ids)) {
             return false;
         }
     }
     return true;
 }
예제 #4
0
 /**
  * @param \Patient  $patient
  * @param Queue     $initial_queue
  * @param \CWebUser $user
  * @param \Firm     $firm
  * @param $data
  *
  * @throws \Exception
  *
  * @return \OEModule\PatientTicketing\models\Ticket
  */
 public function createTicketForPatient(\Patient $patient, Queue $initial_queue, \CWebUser $user, \Firm $firm, $data)
 {
     $transaction = Yii::app()->db->getCurrentTransaction() === null ? Yii::app()->db->beginTransaction() : false;
     try {
         $ticket = new Ticket();
         $ticket->patient_id = $patient->id;
         $ticket->created_user_id = $user->id;
         $ticket->last_modified_user_id = $user->id;
         $ticket->priority_id = $data['patientticketing__priority'];
         $ticket->save();
         $ticket->audit('ticket', 'create', $ticket->id);
         $initial_queue->addTicket($ticket, $user, $firm, $data);
         if ($transaction) {
             $transaction->commit();
         }
         return $ticket;
     } catch (\Exception $e) {
         if ($transaction) {
             $transaction->rollback();
         }
         throw $e;
     }
 }