public function __construct($tthis, $context, $data) { $this->tthis = $tthis; $this->context = $context; $this->data = $data; $year = 0; if (isset($tthis->_attributes['year'])) { $year = (int) $tthis->_attributes['year']; } if (!$year > 0) { $year = date('Y') - 1; } // default year to previous $this->dateStart = date('Y-m-d', strtotime($year . '-01-01')); $this->dateEnd = date('Y-m-d', strtotime($year . '-12-31')); $this->providerId = (int) Zend_Auth::getInstance()->getIdentity()->personId; $providerId = (int) $this->context; if ($providerId > 0) { $this->providerId = $providerId; } $info = array(); $info['dateStart'] = $this->dateStart; $info['dateEnd'] = $this->dateEnd; $provider = new Provider(); $provider->personId = $this->providerId; $provider->populate(); $info['provider'] = $provider; self::$info = $info; }
public static function generatePQRIXML(array $data) { /*Summary Calculation Calculation is generic to all measures: *) Calculate the final denominator by adding all that meet denominator criteria. *) Subtract from the final denominator all that do not meet numerator criteria yet also meet exclusion criteria. Note some measures do not have exclusion criteria. *) The performance calculation is the number meeting numerator criteria divided by the final denominator. *) For measures with multiple patient populations, repeat this process for each patient population and report each result separately. *) For measures with multiple numerators, calculate each numerator separately within each population using the paired exclusion.*/ $info = NQF::getInfo(); $arr = array(); $arr['visitDateStart'] = $info['dateStart']; $arr['visitDateEnd'] = $info['dateEnd']; $arr['provider'] = $info['provider']; $providerId = $arr['provider']->personId; $zip = new ZipArchive(); $filename = tempnam('/tmp', 'pqri-'); if ($zip->open($filename, ZIPARCHIVE::CREATE) !== true) { trigger_error('Cannot create ' . $filename . ' zip file'); return; } foreach ($data as $queryData) { $contents = array(); foreach ($queryData['rows'] as $row) { $results = array(); $className = null; $value = $row['data'][1]; switch ($row['data'][0]) { case 'gov.cms.nqf.0421': // Core - 1 $className = 'NQF0421'; break; case 'gov.cms.nqf.0013': // Core - 2 $className = 'NQF0013'; break; case 'gov.cms.nqf.0028a': // Core - 3a $className = 'NQF0028a'; break; case 'gov.cms.nqf.0028b': // Core - 3b $className = 'NQF0028b'; break; case 'gov.cms.nqf.0041': // Alt Core - 1 $className = 'NQF0041'; break; case 'gov.cms.nqf.0024': // Alt Core - 2 /* Criteria 1 = D: 3; N1: 2; P1: 66.67%; N2: 0; P2: 0% N3: 0; P3: 0%<br/> Criteria 2 = D: 3; N1: 2; P1: 66.67%; N2: 0; P2: 0% N3: 0; P3: 0%<br/> Criteria 3 = D: 0; N1: 0; P1: 0%; N2: 0; P2: 0% N3: 0; P3: 0% */ $className = 'NQF0024'; break; case 'gov.cms.nqf.0038': // Alt Core - 3 /* D: 0<br/> N1: 0 P1: 0%<br/> N2: 0 P2: 0%<br/> N3: 0 P3: 0%<br/> N4: 0 P4: 0%<br/> N5: 0 P5: 0%<br/> N6: 0 P6: 0%<br/> N7: 0 P7: 0%<br/> N8: 0 P8: 0%<br/> N9: 0 P9: 0%<br/> N10: 0 P10: 0%<br/> N11: 0 P11: 0%<br/> N12: 0 P12: 0% */ $className = 'NQF0038'; break; case 'gov.cms.nqf.0059': // CMS - 1 $className = 'NQF0059'; break; case 'gov.cms.nqf.0064': // CMS - 2 /* D: 1<br/>N1: 0; P1: 0%<br/>N2: 0; P2: 0%<br/>E: 0 */ $className = 'NQF0064'; break; case 'gov.cms.nqf.0061': // CMS - 3 $className = 'NQF0061'; break; } if ($className === null) { continue; } $results = call_user_func_array(array($className, 'getResults'), null); $ctr = count($results); $arr['numberOfFiles'] = $ctr; $arr['measureNumber'] = substr($className, 3); for ($i = 0; $i < $ctr; $i++) { $arr['fileNumber'] = $i + 1; $result = $results[$i]; $arr['denominator'] = $result['denominator']; $arr['numerator'] = $result['numerator']; $arr['exclusions'] = isset($result['exclusions']) ? $result['exclusions'] : 0; $arr['percentage'] = $result['percentage']; $pqri = new PQRIRegistryXML($arr); $contents = $pqri->generate(); $fname = $className; if ($ctr != 1) { $fname .= '-' . $arr['fileNumber']; } $fname .= '.xml'; $zip->addFromString($fname, $contents); } } } $zip->close(); $contents = file_get_contents($filename); @unlink($filename); return $contents; }