2 // Copyright (C) 2011 Ken Chapple <ken@mi-squared.com>
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.
9 require_once( "ReportTypes.php" );
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();
42 throw new Exception( "Unknown rule: ".$ruleId );
46 if ( $reportFactory instanceof RsReportFactoryAbstract
) {
47 $report = $reportFactory->createReport( ReportTypes
::getClassName( $ruleId ), $rowRule, $patientData, $dateTarget, $options );
51 if ( $report instanceof RsReportIF
&&
52 !$report instanceof RsUnimplementedIF
) {
54 $results = $report->getResults();
57 return RsHelper
::formatClinicalRules( $results );