Fix edi.inc encoding and correct uninitialized variables in modified files
[openemr.git] / library / classes / rulesets / ReportManager.php
blob749da7dc8f4fa0d168a40849f58ef4088d04bb4e
1 <?php
2 // Copyright (C) 2011 Ken Chapple <ken@mi-squared.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 require_once( "ReportTypes.php" );
11 class ReportManager
13 public function __construct()
15 foreach ( glob( dirname(__FILE__)."/library/*.php" ) as $filename ) {
16 require_once( $filename );
19 foreach ( glob( dirname(__FILE__)."/Cqm/*.php" ) as $filename ) {
20 require_once( $filename );
23 foreach ( glob( dirname(__FILE__)."/Amc/*.php" ) as $filename ) {
24 require_once( $filename );
28 public function runReport( $rowRule, $patients, $dateTarget, $options=array() )
30 $ruleId = $rowRule['id'];
31 $patientData = array();
32 foreach( $patients as $patient ) {
33 $patientData []= $patient['pid'];
36 $reportFactory = null;
37 if ( ReportTypes::getType( $ruleId ) == ReportTypes::CQM ) {
38 $reportFactory = new CqmReportFactory();
39 } else if ( ReportTypes::getType( $ruleId ) == ReportTypes::AMC ) {
40 $reportFactory = new AmcReportFactory();
41 } else {
42 throw new Exception( "Unknown rule: ".$ruleId );
45 $report = null;
46 if ( $reportFactory instanceof RsReportFactoryAbstract ) {
47 $report = $reportFactory->createReport( ReportTypes::getClassName( $ruleId ), $rowRule, $patientData, $dateTarget, $options );
50 $results = array();
51 if ( $report instanceof RsReportIF &&
52 !$report instanceof RsUnimplementedIF ) {
53 $report->execute();
54 $results = $report->getResults();
57 return RsHelper::formatClinicalRules( $results );