protected function _getLabResults($filters)
 {
     $labs = array();
     $showCalcLabs = (bool) $this->_getParam('showCalcLabs', false);
     $calcLabsArray = array();
     if (true) {
         $calcLabs = new CalcLabs();
         $calcLabsArray = $calcLabs->getAllCalcLabsArray($filters['patientId']);
     }
     $labs = $calcLabsArray;
     $labsIterator = new LabsIterator();
     $labsIterator->setFilters($filters);
     foreach ($labsIterator as $lab) {
         $tmpArr = array();
         $tmpArr[] = $lab->observationTime;
         $tmpArr[] = $lab->description;
         $tmpArr[] = $lab->value;
         $tmpArr[] = $lab->units;
         $tmpArr[] = $lab->referenceRange;
         $tmpArr[] = $lab->abnormalFlag;
         $tmpArr[] = $lab->resultStatus;
         $tmpValue = $lab->value;
         if (!is_numeric($tmpValue)) {
             if (strtolower($lab->abnormalFlag) != "abnormal") {
                 // normal
                 $tmpValue = 1;
             } else {
                 // abnormal
                 $tmpValue = 0;
             }
         }
         $tmpArr[] = date('Y-m-d', strtotime($lab->observationTime)) . '::' . $tmpValue;
         $labs[$lab->labResultId] = $tmpArr;
     }
     $rows = $this->_toJsonArray($labs);
     return $rows;
 }
 protected function _getLabResults($filters)
 {
     $order = $this->_getParam('order');
     if (strlen($order) > 0) {
         $orders = explode(';', $order);
         $values = array();
         foreach ($orders as $val) {
             $x = explode(':', $val);
             if (!isset($x[1])) {
                 $x[1] = 'ASC';
             }
             $values[] = $x;
         }
         $filters['orders'] = $values;
     }
     $labs = array();
     $showCalcLabs = (bool) $this->_getParam('showCalcLabs', false);
     $calcLabsArray = array();
     if (false) {
         $calcLabs = new CalcLabs();
         $calcLabsArray = $calcLabs->getAllCalcLabsArray($filters['patientId']);
     }
     $labs = $calcLabsArray;
     $labsIterator = new LabsIterator();
     $labsIterator->setFilters($filters);
     foreach ($labsIterator as $lab) {
         $tmpArr = array();
         $tmpArr[] = $lab->observationTime;
         $tmpArr[] = $lab->description;
         $tmpArr[] = $lab->value;
         $tmpArr[] = $lab->units;
         $tmpArr[] = $lab->referenceRange;
         $tmpArr[] = $lab->abnormalFlag;
         $tmpArr[] = $lab->resultStatus;
         $tmpArr[] = $lab->labTest->clia_disclosure;
         $tmpValue = $lab->value;
         if (!is_numeric($tmpValue)) {
             if (strtolower($lab->abnormalFlag) != '' || strtolower($lab->abnormalFlag) != 'n') {
                 // normal
                 $tmpValue = 1;
             } else {
                 // abnormal
                 $tmpValue = 0;
             }
         }
         $tmpArr[] = date('Y-m-d', strtotime($lab->observationTime)) . '::' . $tmpValue;
         $sign = (int) $lab->labTest->labOrder->hasSigningEntry();
         $tmpArr[] = (int) $sign . '::' . $lab->labTest->labOrder->labOrderId;
         $labs[$lab->labResultId] = $tmpArr;
     }
     $rows = $this->_toJsonArray($labs);
     return $rows;
 }