public function closing()
{
$criteria = new \CDbCriteria();
$criteria->select = $this->getTableAlias(true) . '.*, count(oc.id) oc_ct';
$criteria->join = 'left outer join patientticketing_queueoutcome oc on ' . $this->getTableAlias(true) . '.id = oc.queue_id';
$criteria->group = $this->getTableAlias(true) . '.id';
$criteria->having = 'oc_ct = 0';
$this->getDbCriteria()->mergeWith($criteria);
return $this;
}