From c7a0ea5e44f4678ee0280fffd87f4912525ea38b Mon Sep 17 00:00:00 2001 From: bradymiller Date: Tue, 14 Jun 2011 17:22:17 -0700 Subject: [PATCH] CDR engine: age calculation bug fix --- .../Cqm/reports/NFQ_0024/InitialPatientPopulation1.php | 1 - .../Cqm/reports/NFQ_0024/InitialPatientPopulation2.php | 1 - .../Cqm/reports/NFQ_0024/InitialPatientPopulation3.php | 1 - library/clinical_rules.php | 14 ++++++++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/library/classes/rulesets/Cqm/reports/NFQ_0024/InitialPatientPopulation1.php b/library/classes/rulesets/Cqm/reports/NFQ_0024/InitialPatientPopulation1.php index dd53cf394..a5d501fd0 100644 --- a/library/classes/rulesets/Cqm/reports/NFQ_0024/InitialPatientPopulation1.php +++ b/library/classes/rulesets/Cqm/reports/NFQ_0024/InitialPatientPopulation1.php @@ -16,7 +16,6 @@ class NFQ_0024_InitialPatientPopulation1 implements CqmFilterIF public function test( CqmPatient $patient, $beginDate, $endDate ) { // filter for Patient characteristic: birth dateÓ (age) >=2 and <=16 years - // utilize the convertDobtoAgeYearDecimal() function from library/clinical_rules.php $age = $patient->calculateAgeOnDate( $beginDate ); if ( $age >= 2 && $age <= 18 ) { diff --git a/library/classes/rulesets/Cqm/reports/NFQ_0024/InitialPatientPopulation2.php b/library/classes/rulesets/Cqm/reports/NFQ_0024/InitialPatientPopulation2.php index 60a801670..dfdf7a21c 100644 --- a/library/classes/rulesets/Cqm/reports/NFQ_0024/InitialPatientPopulation2.php +++ b/library/classes/rulesets/Cqm/reports/NFQ_0024/InitialPatientPopulation2.php @@ -16,7 +16,6 @@ class NFQ_0024_InitialPatientPopulation2 implements CqmFilterIF public function test( CqmPatient $patient, $beginDate, $endDate ) { // filter for Patient characteristic: birth dateÓ (age) >=2 and <=16 years - // utilize the convertDobtoAgeYearDecimal() function from library/clinical_rules.php $age = $patient->calculateAgeOnDate( $beginDate ); if ( $age >= 2 && $age <= 10 ) { diff --git a/library/classes/rulesets/Cqm/reports/NFQ_0024/InitialPatientPopulation3.php b/library/classes/rulesets/Cqm/reports/NFQ_0024/InitialPatientPopulation3.php index 66d1eb3ca..230524be2 100644 --- a/library/classes/rulesets/Cqm/reports/NFQ_0024/InitialPatientPopulation3.php +++ b/library/classes/rulesets/Cqm/reports/NFQ_0024/InitialPatientPopulation3.php @@ -16,7 +16,6 @@ class NFQ_0024_InitialPatientPopulation3 implements CqmFilterIF public function test( CqmPatient $patient, $beginDate, $endDate ) { // filter for Patient characteristic: birth dateÓ (age) >=2 and <=16 years - // utilize the convertDobtoAgeYearDecimal() function from library/clinical_rules.php $age = $patient->calculateAgeOnDate( $beginDate ); if ( $age >= 11 && $age <= 16 ) { diff --git a/library/clinical_rules.php b/library/clinical_rules.php index 9cf57ab65..5dad5fb77 100644 --- a/library/clinical_rules.php +++ b/library/clinical_rules.php @@ -1741,9 +1741,12 @@ function convertCompSql($comp) { // Return: decimal, years(decimal) from dob to target(date) function convertDobtoAgeYearDecimal($dob,$target) { - // Grab year, month, and day from dob and dateTarget + // Prepare dob (Y M D) $dateDOB = explode(" ",$dob); - $dateTarget = explode(" ",$target); + + // Prepare target (Y-M-D H:M:S) + $dateTargetTemp = explode(" ",$target); + $dateTarget = explode("-",$dateTargetTemp[0]); // Collect differences $iDiffYear = $dateTarget[0] - $dateDOB[0]; @@ -1769,9 +1772,12 @@ function convertDobtoAgeYearDecimal($dob,$target) { // Return: decimal, months(decimal) from dob to target(date) function convertDobtoAgeMonthDecimal($dob,$target) { - // Grab year, month, and day from dob and dateTarget + // Prepare dob (Y M D) $dateDOB = explode(" ",$dob); - $dateTarget = explode(" ",$target); + + // Prepare target (Y-M-D H:M:S) + $dateTargetTemp = explode(" ",$target); + $dateTarget = explode("-",$dateTargetTemp[0]); // Collect differences $iDiffYear = $dateTarget[0] - $dateDOB[0]; -- 2.11.4.GIT