From e928edbcb9a590b36eefe945b9893c0a16abae18 Mon Sep 17 00:00:00 2001 From: Ken Chapple Date: Thu, 12 May 2011 09:44:29 -0700 Subject: [PATCH] added ability to check for any encounter type, removed unused files, some more report implementation --- library/classes/ClinicalTypes/Allergy.php | 19 +- library/classes/ClinicalTypes/ClinicalType.php | 2 +- library/classes/ClinicalTypes/Diagnosis.php | 13 + library/classes/ClinicalTypes/Encounter.php | 15 +- library/classes/ClinicalTypes/Helper.php | 42 + library/classes/ClinicalTypes/Medication.php | 37 +- library/classes/ClinicalTypes/codes.php | 88 +- library/classes/rulesets/Cqm/reports/NFQ_0038.php | 8 + .../rulesets/Cqm/reports/NFQ_0038/Numerator1.php | 10 + .../rulesets/Cqm/reports/NFQ_0038/Numerator2.php | 11 + .../rulesets/Cqm/reports/NFQ_0038/Numerator3.php | 35 + .../rulesets/Cqm/reports/NFQ_0038/Numerator4.php | 7 + .../Cqm/reports/NFQ_0038/PopulationCriteria.php | 41 + library/classes/rulesets/ruleSet.class.php | 1263 -------------------- 14 files changed, 298 insertions(+), 1293 deletions(-) create mode 100644 library/classes/rulesets/Cqm/reports/NFQ_0038.php create mode 100644 library/classes/rulesets/Cqm/reports/NFQ_0038/PopulationCriteria.php delete mode 100644 library/classes/rulesets/ruleSet.class.php diff --git a/library/classes/ClinicalTypes/Allergy.php b/library/classes/ClinicalTypes/Allergy.php index a3bc88990..dc161a348 100644 --- a/library/classes/ClinicalTypes/Allergy.php +++ b/library/classes/ClinicalTypes/Allergy.php @@ -3,7 +3,16 @@ require_once( 'ClinicalType.php' ); class Allergy extends ClinicalType { - const MED_ALLERGY_DTAP = 'med_allergy_dtap'; + const DTAP_VAC = 'med_allergy_dtap_vac'; + const IPV = 'med_allergy_ipv'; + const NEOMYCIN = 'med_allergy_neomycin'; + const STREPTOMYCIN = 'med_allergy_streptomycin'; + const POLYMYXIN = 'med_allergy_polymyxin'; + const HIB = 'med_allergy_hib'; + const MUMPS_VAC = 'med_allergy_mumps_vac'; + const MEASLES_VAC = 'med_allergy_measles_vac'; + const RUBELLA_VAC = 'med_allergy_rubella_vac'; + const MMR = 'med_allergy_mmr'; public function getType() { return 'allergy'; @@ -13,8 +22,8 @@ class Allergy extends ClinicalType return 'Clinical_Rules_Allergy_Types'; } - public function doPatientCheck( RsPatient $patient, $beginMeasurement = null, $endMeasurement = null, $options = null ) { - return true; + public function doPatientCheck( RsPatient $patient, $beginDate = null, $endDate = null, $options = null ) { + // TODO check for allergy (wherever it exists... lists 'allergy' type probably.) + return false; } - -} \ No newline at end of file +} diff --git a/library/classes/ClinicalTypes/ClinicalType.php b/library/classes/ClinicalTypes/ClinicalType.php index 2ad2e835a..e31f98358 100644 --- a/library/classes/ClinicalTypes/ClinicalType.php +++ b/library/classes/ClinicalTypes/ClinicalType.php @@ -17,7 +17,7 @@ abstract class ClinicalType const CHARACTERISTIC = 'Characteristic'; const PHYSICAL_EXAM = 'PhysicalExam'; - private $_optionId; + private $_optionId; private $_title; private $_notes; diff --git a/library/classes/ClinicalTypes/Diagnosis.php b/library/classes/ClinicalTypes/Diagnosis.php index 693b00ca9..4335ac93c 100644 --- a/library/classes/ClinicalTypes/Diagnosis.php +++ b/library/classes/ClinicalTypes/Diagnosis.php @@ -3,10 +3,23 @@ require_once( 'ClinicalType.php' ); class Diagnosis extends ClinicalType { + const OPTION_STATE = 'state'; + const STATE_ACTIVE = 'active'; + const STATE_INACTIVE = 'inactive'; + const STATE_RESOLVED = 'resolved'; + const HYPERTENSION = 'diag_hypertension'; const PREGNANCY = 'diag_pregnancy'; const ENCEPHALOPATHY = 'diag_encephalopathy'; const PROG_NEURO_DISORDER = 'diag_prog_neuro_disorder'; + const CANCER_LYMPH_HIST = 'diag_cancer_lypmh_hist'; + const ASYMPTOMATIC_HIV = 'diag_asymptomatic_hiv'; + const MULT_MYELOMA = 'diag_mult_myeloma'; + const LUKEMIA = 'diag_lukemia'; + const IMMUNODEF = 'diag_immunodef'; + const MEASLES = 'diag_measles'; + const MUMPS = 'diag_mumps'; + const RUBELLA = 'diag_rubella'; public function getListType() { return 'medical_problem'; diff --git a/library/classes/ClinicalTypes/Encounter.php b/library/classes/ClinicalTypes/Encounter.php index e21288df1..b8e7dbd29 100644 --- a/library/classes/ClinicalTypes/Encounter.php +++ b/library/classes/ClinicalTypes/Encounter.php @@ -18,6 +18,19 @@ class Encounter extends ClinicalType const ENC_OUT_PCP_OBGYN = 'enc_out_pcp_obgyn'; const ENC_PREGNANCY = 'enc_pregnancy'; + public static function getEncounterTypes() + { + $oClass = new ReflectionClass( 'Encounter' ); + $constants = $oClass->getConstants(); + $encounters = array(); + foreach ( $constants as $constant ) { + if ( strpos( $constant, 'enc' ) === 0 ) { + $encounters[]= $constant; + } + } + return $encounters; + } + public function getListId() { return "rule_enc_types"; @@ -52,4 +65,4 @@ class Encounter extends ClinicalType return true; } } -} \ No newline at end of file +} diff --git a/library/classes/ClinicalTypes/Helper.php b/library/classes/ClinicalTypes/Helper.php index fc734da1c..8e51e77c2 100644 --- a/library/classes/ClinicalTypes/Helper.php +++ b/library/classes/ClinicalTypes/Helper.php @@ -3,6 +3,37 @@ require_once( 'ClinicalType.php' ); class Helper { + public static function checkAllergy( $subType, RsPatient $patient, $beginDate = null, $endDate = null, $options = null ) + { + return self::check( ClinicalType::ALLERGY, $subType, $patient, $beginDate, $endDate , $options ); + } + + public static function checkDiagActive( $subType, RsPatient $patient, $beginDate = null, $endDate = null, $options = null ) + { + // TODO append options array + return self::check( ClinicalType::DIAGNOSIS, $subType, $patient, $beginDate, $endDate , array( Diagnosis::OPTION_STATE => Diagnosis::STATE_ACTIVE ) ); + } + + public static function checkDiagInactive( $subType, RsPatient $patient, $beginDate = null, $endDate = null, $options = null ) + { + return self::check( ClinicalType::DIAGNOSIS, $subType, $patient, $beginDate, $endDate , array( Diagnosis::OPTION_STATE => Diagnosis::STATE_INACTIVE ) ); + } + + public static function checkDiagResolved( $subType, RsPatient $patient, $beginDate = null, $endDate = null, $options = null ) + { + return self::check( ClinicalType::DIAGNOSIS, $subType, $patient, $beginDate, $endDate , array( Diagnosis::OPTION_STATE => Diagnosis::STATE_RESOLVED ) ); + } + + public static function checkEncounter( $subType, RsPatient $patient, $beginDate = null, $endDate = null, $options = null ) + { + return self::check( ClinicalType::ENCOUNTER, $subType, $patient, $beginDate, $endDate, $options ); + } + + public static function checkMed( $subType, RsPatient $patient, $beginDate = null, $endDate = null, $options = null ) + { + return self::check( ClinicalType::MEDICATION, $subType, $patient, $beginDate, $endDate , $options ); + } + public static function check( $type, $subType, RsPatient $patient, $beginDate = null, $endDate = null, $options = null ) { $typeObj = new $type( $subType ); @@ -18,4 +49,15 @@ class Helper $encounter = new Encounter( $encounterType ); return $encounter->fetchDates( $patient, $beginDate, $endDate ); } + + public static function checkAnyEncounter( RsPatient $patient, $beginDate = null, $endDate = null, $options = null ) + { + $encounters = Encounter::getEncounterTypes(); + foreach ( $encounters as $encounter ) { + if ( self::checkEncounter( $encounter, $patient, $beginDate, $endDate, $options ) ) { + return true; + } + } + return false; + } } diff --git a/library/classes/ClinicalTypes/Medication.php b/library/classes/ClinicalTypes/Medication.php index c8ba19a23..6e0ef2a57 100644 --- a/library/classes/ClinicalTypes/Medication.php +++ b/library/classes/ClinicalTypes/Medication.php @@ -6,6 +6,7 @@ require_once( 'ClinicalType.php' ); class Medication extends ClinicalType { const OPTION_COUNT = 'count'; + const OPTION_UNIQUE_DATES = 'unique'; const DTAP = 'med_dtap'; const HEP_A = 'med_hep_a_vac'; @@ -15,8 +16,8 @@ class Medication extends ClinicalType const MMR = 'med_mmr'; const IPV = 'med_ipv'; const MUMPS = 'med_mumps_vac'; - const PNEUMOCOCCAL = 'mad_pneumococcal_vac'; - const ROTAVIRUS = 'mad_rotavirus_vac'; + const PNEUMOCOCCAL = 'med_pneumococcal_vac'; + const ROTAVIRUS = 'med_rotavirus_vac'; const RUBELLA = 'med_rubella_vac'; const VZV = 'med_vzv'; @@ -24,7 +25,35 @@ class Medication extends ClinicalType return "Clinical_Rules_Med_Types"; } - public function doPatientCheck( RsPatient $patient, $beginMeasurement = null, $endMeasurement = null, $options = null ) { - return true; + public function doPatientCheck( RsPatient $patient, $beginDate = null, $endDate = null, $options = null ) + { + $return = false; + $listOptions = Codes::lookup( $this->getOptionId(), 'OPTION_ID' ); + if ( count( $listOptions ) > 0 ) + { + $query = "SELECT immunizations.administered_date, immunizations.patient_id, immunizations.immunization_id, list_options.title, patient_data.pid, patient_data.DOB " . + "FROM immunizations " . + "LEFT JOIN list_options " . + "ON immunizations.immunization_id = list_options.option_id AND list_id = immunizations" . + "LEFT JOIN patient_data " . + "ON immunizations.patient_id = patient_data.pid " . + "WHERE immunizations.patient_id = ? " . + "AND DATE( immunizations.administered_date ) >= ? " . + "AND DATE( immunizations.administered_date ) < ? " . + "AND ( "; + foreach( $listOptions as $option_id ) { + $query.= "list_options.option_id = ".$option_id." "; + } + $query.= " ) "; + $result = sqlStatement( $query, array( $patient->id, $beginDate, $endDate ) ); + if ( isset( $options[self::OPTION_COUNT] ) && + count( $result ) >= $options[self::OPTION_COUNT] ) { + $return = true; + } else if ( count( $result ) > 0 ) { + $return = true; + } + } + + return $return; } } \ No newline at end of file diff --git a/library/classes/ClinicalTypes/codes.php b/library/classes/ClinicalTypes/codes.php index 7fb35351c..d31e9588d 100644 --- a/library/classes/ClinicalTypes/codes.php +++ b/library/classes/ClinicalTypes/codes.php @@ -1,6 +1,10 @@ array( - 'ICD9' => array( 'V65.3' - ) ), + 'ICD9' => array( 'V65.3' ) + ), Communication::COUNS_PHYS_ACTIVITY => array( - 'ICD9' => array( 'V65.41' - ) ), - Encounter::ENC_OUT_PCP_OBGYN => array( - 'ICD9' => array( 'V24','V25','V26','V27','V28','V45.5','V61.5','V61.6','V61.7','V69.2','V72.3','V72.4' - ) ), - Encounter::ENC_OUTPATIENT => array( - 'ICD9' => array( 'V70.0','V70.3','V70.5','V70.6','V70.8','V70.9' - ) ), - Encounter::ENC_PREGNANCY => array( - 'ICD9' => array( 'V24','V24.0','V24.2','V25','V25.01','V25.02','V25.03','V25.09','V26.81','V28','V28.3','V28.81','V28.82','V72.4','V72.40','V72.41','V72.42' - ) ), + 'ICD9' => array( 'V65.41' ) + ), Diagnosis::PREGNANCY => array( - 'ICD9', array( '630','631','632','633','633.0','633.00','633.01','633.1','633.10','633.11','633.2','633.20','633.21','633.8','633.80','633.81','633.9','633.90','633.91','634','634.0','634.00','634.01','634.02','634.1','634.10','634.11','634.12','634.2','634.20','634.21','634.22','634.3','634.30','634.31','634.32','634.4','634.40','634.41','634.42','634.5','634.50','634.51','634.52','634.6','634.60','634.61','634.62','634.7','634.70','634.71','634.72','634.8','634.80','634.81','634.82','634.9','634.90','634.91','634.92','635','635.0','635.00','635.01','635.02','635.1','635.10','635.11','635.12','635.2','635.20','635.21','635.22','635.3','635.30','635.31','635.32','635.4','635.40','635.41','635.42','635.5','635.50','635.51','635.52','635.6','635.60','635.61','635.62','635.7','635.70','635.71','635.72','635.8','635.80','635.81','635.82','635.9','635.90','635.91','635.92','636','636.0','636.00','636.01','636.02','636.1','636.10','636.11','636.12','636.2','636.20','636.21','636.22','636.3','636.30','636.31','636.32','636.4','636.40','636.41','636.42','636.5','636.50','636.51','636.52','636.6','636.60','636.61','636.62','636.7','636.70','636.71','636.72','636.8','636.80','636.81','636.82','636.9','636.90','636.91','636.92','637','637.0','637.00','637.01','637.02','637.1','637.10','637.11','637.12','637.2','637.20','637.21','637.22','637.3','637.30','637.31','637.32','637.4','637.40','637.41','637.42','637.5','637.50','637.51','637.52','637.6','637.60','637.61','637.62','637.7','637.70','637.71','637.72','637.8','637.80','637.81','637.82','637.9','637.90','637.91','637.92','638','638.0','638.1','638.2','638.3','638.4','638.5','638.6','638.7','638.8','638.9','639','639.0','639.1','639.2','639.3','639.4','639.5','639.6','639.8','639.9','640','640.0','640.00','640.01','640.03','640.8','640.80','640.81','640.83','640.9','640.90','640.91','640.93','641','641.0','641.00','641.01','641.03','641.1','641.10','641.11','641.13','641.2','641.20','641.21','641.23','641.3','641.30','641.31','641.33','641.8','641.80','641.81','641.83','641.9','641.90','641.91','641.93','642','642.0','642.00','642.01','642.02','642.03','642.04','642.1','642.10','642.11','642.12','642.13','642.14','642.2','642.20','642.21','642.22','642.23','642.24','642.3','642.30','642.31','642.32','642.33','642.34','642.4','642.40','642.41','642.42','642.43','642.44','642.5','642.50','642.51','642.52','642.53','642.54','642.6','642.60','642.61','642.62','642.63','642.64','642.7','642.70','642.71','642.72','642.73','642.74','642.9','642.90','642.91','642.92','642.93','642.94','643','643.0','643.00','643.01','643.03','643.1','643.10','643.11','643.13','643.2','643.20','643.21','643.23','643.8','643.80','643.81','643.83','643.9','643.90','643.91','643.93','644','644.0','644.00','644.03','644.1','644.10','644.13','644.2','644.20','644.21','645','645.1','645.10','645.11','645.13','645.2','645.20','645.21','645.23','646','646.0','646.00','646.01','646.03','646.1','646.10','646.11','646.12','646.13','646.14','646.2','646.20','646.21','646.22','646.23','646.24','646.3','646.30','646.31','646.33','646.4','646.40','646.41','646.42','646.43','646.44','646.5','646.50','646.51','646.52','646.53','646.54','646.6','646.60','646.61','646.62','646.63','646.64','646.7','646.70','646.71','646.73','646.8','646.80','646.81','646.82','646.83','646.84','646.9','646.90','646.91','646.93','647','647.0','647.00','647.01','647.02','647.03','647.04','647.1','647.10','647.11','647.12','647.13','647.14','647.2','647.20','647.21','647.22','647.23','647.24','647.3','647.30','647.31','647.32','647.33','647.34','647.4','647.40','647.41','647.42','647.43','647.44','647.5','647.50','647.51','647.52','647.53','647.54','647.6','647.60','647.61','647.62','647.63','647.64','647.8','647.80','647.81','647.82','647.83','647.84','647.9','647.90','647.91','647.92','647.93','647.94','648','648.0','648.00','648.01','648.02','648.03','648.04','648.1','648.10','648.11','648.12','648.13','648.14','648.2','648.20','648.21','648.22','648.23','648.24','648.3','648.30','648.31','648.32','648.33','648.34','648.4','648.40','648.41','648.42','648.43','648.44','648.5','648.50','648.51','648.52','648.53','648.54','648.6','648.60','648.61','648.62','648.63','648.64','648.7','648.70','648.71','648.72','648.73','648.74','648.8','648.80','648.81','648.82','648.83','648.84','648.9','648.90','648.91','648.92','648.93','648.94','649','649.0','649.00','649.01','649.02','649.03','649.04','649.1','649.10','649.11','649.12','649.13','649.14','649.2','649.20','649.21','649.22','649.23','649.24','649.3','649.30','649.31','649.32','649.33','649.34','649.4','649.40','649.41','649.42','649.43','649.44','649.5','649.50','649.51','649.53','649.6','649.60','649.61','649.62','649.63','649.64','649.7','649.70','649.71','649.73','650','651','651.0','651.00','651.01','651.03','651.1','651.10','651.11','651.13','651.2','651.20','651.21','651.23','651.3','651.30','651.31','651.33','651.4','651.40','651.41','651.43','651.5','651.50','651.51','651.53','651.6','651.60','651.61','651.63','651.7','651.70','651.71','651.73','651.8','651.80','651.81','651.83','651.9','651.90','651.91','651.93','652','652.0','652.00','652.01','652.03','652.1','652.10','652.11','652.13','652.2','652.20','652.21','652.23','652.3','652.30','652.31','652.33','652.4','652.40','652.41','652.43','652.5','652.50','652.51','652.53','652.6','652.60','652.61','652.63','652.7','652.70','652.71','652.73','652.8','652.80','652.81','652.83','652.9','652.90','652.91','652.93','653','653.0','653.00','653.01','653.03','653.1','653.10','653.11','653.13','653.2','653.20','653.21','653.23','653.3','653.30','653.31','653.33','653.4','653.40','653.41','653.43','653.5','653.50','653.51','653.53','653.6','653.60','653.61','653.63','653.7','653.70','653.71','653.73','653.8','653.80','653.81','653.83','653.9','653.90','653.91','653.93','654','654.0','654.00','654.01','654.02','654.03','654.04','654.1','654.10','654.11','654.12','654.13','654.14','654.2','654.20','654.21','654.23','654.3','654.30','654.31','654.32','654.33','654.34','654.4','654.40','654.41','654.42','654.43','654.44','654.5','654.50','654.51','654.52','654.53','654.54','654.6','654.60','654.61','654.62','654.63','654.64','654.7','654.70','654.71','654.72','654.73','654.74','654.8','654.80','654.81','654.82','654.83','654.84','654.9','654.90','654.91','654.92','654.93','654.94','655','655.0','655.00','655.01','655.03','655.1','655.10','655.11','655.13','655.2','655.20','655.21','655.23','655.3','655.30','655.31','655.33','655.4','655.40','655.41','655.43','655.5','655.50','655.51','655.53','655.6','655.60','655.61','655.63','655.7','655.70','655.71','655.73','655.8','655.80','655.81','655.83','655.9','655.90','655.91','655.93','656','656.0','656.00','656.01','656.03','656.1','656.10','656.11','656.13','656.2','656.20','656.21','656.23','656.3','656.30','656.31','656.33','656.4','656.40','656.41','656.43','656.5','656.50','656.51','656.53','656.6','656.60','656.61','656.63','656.7','656.70','656.71','656.73','656.8','656.80','656.81','656.83','656.9','656.90','656.91','656.93','657','657.0','657.00','657.01','657.03','658','658.0','658.00','658.01','658.03','658.1','658.10','658.11','658.13','658.2','658.20','658.21','658.23','658.3','658.30','658.31','658.33','658.4','658.40','658.41','658.43','658.8','658.80','658.81','658.83','658.9','658.90','658.91','658.93','659','659.0','659.00','659.01','659.03','659.1','659.10','659.11','659.13','659.2','659.20','659.21','659.23','659.3','659.30','659.31','659.33','659.4','659.40','659.41','659.43','659.5','659.50','659.51','659.53','659.6','659.60','659.61','659.63','659.7','659.70','659.71','659.73','659.8','659.80','659.81','659.83','659.9','659.90','659.91','659.93','660','660.0','660.00','660.01','660.03','660.1','660.10','660.11','660.13','660.2','660.20','660.21','660.23','660.3','660.30','660.31','660.33','660.4','660.40','660.41','660.43','660.5','660.50','660.51','660.53','660.6','660.60','660.61','660.63','660.7','660.70','660.71','660.73','660.8','660.80','660.81','660.83','660.9','660.90','660.91','660.93','661','661.0','661.00','661.01','661.03','661.1','661.10','661.11','661.13','661.2','661.20','661.21','661.23','661.3','661.30','661.31','661.33','661.4','661.40','661.41','661.43','661.9','661.90','661.91','661.93','662','662.0','662.00','662.01','662.03','662.1','662.10','662.11','662.13','662.2','662.20','662.21','662.23','662.3','662.30','662.31','662.33','663','663.0','663.00','663.01','663.03','663.1','663.10','663.11','663.13','663.2','663.20','663.21','663.23','663.3','663.30','663.31','663.33','663.4','663.40','663.41','663.43','663.5','663.50','663.51','663.53','663.6','663.60','663.61','663.63','663.8','663.80','663.81','663.83','663.9','663.90','663.91','663.93','664','664.0','664.00','664.01','664.04','664.1','664.10','664.11','664.14','664.2','664.20','664.21','664.24','664.3','664.30','664.31','664.34','664.4','664.40','664.41','664.44','664.5','664.50','664.51','664.54','664.6','664.60','664.61','664.64','664.8','664.80','664.81','664.84','664.9','664.90','664.91','664.94','665','665.0','665.00','665.01','665.03','665.1','665.10','665.11','665.2','665.20','665.22','665.24','665.3','665.30','665.31','665.34','665.4','665.40','665.41','665.44','665.5','665.50','665.51','665.54','665.6','665.60','665.61','665.64','665.7','665.70','665.71','665.72','665.74','665.8','665.80','665.81','665.82','665.83','665.84','665.9','665.90','665.91','665.92','665.93','665.94','666','666.0','666.00','666.02','666.04','666.1','666.10','666.12','666.14','666.2','666.20','666.22','666.24','666.3','666.30','666.32','666.34','667','667.0','667.00','667.02','667.04','667.1','667.10','667.12','667.14','668','668.0','668.00','668.01','668.02','668.03','668.04','668.1','668.10','668.11','668.12','668.13','668.14','668.2','668.20','668.21','668.22','668.23','668.24','668.8','668.80','668.81','668.82','668.83','668.84','668.9','668.90','668.91','668.92','668.93','668.94','669','669.0','669.00','669.01','669.02','669.03','669.04','669.1','669.10','669.11','669.12','669.13','669.14','669.2','669.20','669.21','669.22','669.23','669.24','669.3','669.30','669.32','669.34','669.4','669.40','669.41','669.42','669.43','669.44','669.5','669.50','669.51','669.6','669.60','669.61','669.7','669.70','669.71','669.8','669.80','669.81','669.82','669.83','669.84','669.9','669.90','669.91','669.92','669.93','669.94','670','670.0','670.00','670.02','670.04','671','671.0','671.00','671.01','671.02','671.03','671.04','671.1','671.10','671.11','671.12','671.13','671.14','671.2','671.20','671.21','671.22','671.23','671.24','671.3','671.30','671.31','671.33','671.4','671.40','671.42','671.44','671.5','671.50','671.51','671.52','671.53','671.54','671.8','671.80','671.81','671.82','671.83','671.84','671.9','671.90','671.91','671.92','671.93','671.94','672','672.0','672.00','672.02','672.04','673','673.0','673.00','673.01','673.02','673.03','673.04','673.1','673.10','673.11','673.12','673.13','673.14','673.2','673.20','673.21','673.22','673.23','673.24','673.3','673.30','673.31','673.32','673.33','673.34','673.8','673.80','673.81','673.82','673.83','673.84','674','674.0','674.00','674.01','674.02','674.03','674.04','674.1','674.10','674.12','674.14','674.2','674.20','674.22','674.24','674.3','674.30','674.32','674.34','674.4','674.40','674.42','674.44','674.5','674.50','674.51','674.52','674.53','674.54','674.8','674.80','674.82','674.84','674.9','674.90','674.92','674.94','675','675.0','675.00','675.01','675.02','675.03','675.04','675.1','675.10','675.11','675.12','675.13','675.14','675.2','675.20','675.21','675.22','675.23','675.24','675.8','675.80','675.81','675.82','675.83','675.84','675.9','675.90','675.91','675.92','675.93','675.94','676','676.0','676.00','676.01','676.02','676.03','676.04','676.1','676.10','676.11','676.12','676.13','676.14','676.2','676.20','676.21','676.22','676.23','676.24','676.3','676.30','676.31','676.32','676.33','676.34','676.4','676.40','676.41','676.42','676.43','676.44','676.5','676.50','676.51','676.52','676.53','676.54','676.6','676.60','676.61','676.62','676.63','676.64','676.8','676.80','676.81','676.82','676.83','676.84','676.9','676.90','676.91','676.92','676.93','676.94','677','678','678.0','678.00','678.01','678.03','678.1','678.10','678.11','678.13','679','679.0','679.00','679.01','679.02','679.03','679.04','679.1','679.10','679.11','679.12','679.13','679.14','V22','V22.0','V22.1','V22.2','V23','V23.0','V23.1','V23.2','V23.3','V23.4','V23.41','V23.49','V23.5','V23.7','V23.8','V23.81','V23.82','V23.83','V23.84','V23.85','V23.86','V23.89','V23.9','V28','V28.0','V28.1','V28.2','V28.3','V28.4','V28.5','V28.6','V28.8','V28.81','V28.82','V28.89','V28.9' - ) ), + 'ICD9', array( '630','631','632','633','633.0','633.00','633.01','633.1','633.10','633.11','633.2','633.20','633.21','633.8','633.80','633.81','633.9','633.90','633.91','634','634.0','634.00','634.01','634.02','634.1','634.10','634.11','634.12','634.2','634.20','634.21','634.22','634.3','634.30','634.31','634.32','634.4','634.40','634.41','634.42','634.5','634.50','634.51','634.52','634.6','634.60','634.61','634.62','634.7','634.70','634.71','634.72','634.8','634.80','634.81','634.82','634.9','634.90','634.91','634.92','635','635.0','635.00','635.01','635.02','635.1','635.10','635.11','635.12','635.2','635.20','635.21','635.22','635.3','635.30','635.31','635.32','635.4','635.40','635.41','635.42','635.5','635.50','635.51','635.52','635.6','635.60','635.61','635.62','635.7','635.70','635.71','635.72','635.8','635.80','635.81','635.82','635.9','635.90','635.91','635.92','636','636.0','636.00','636.01','636.02','636.1','636.10','636.11','636.12','636.2','636.20','636.21','636.22','636.3','636.30','636.31','636.32','636.4','636.40','636.41','636.42','636.5','636.50','636.51','636.52','636.6','636.60','636.61','636.62','636.7','636.70','636.71','636.72','636.8','636.80','636.81','636.82','636.9','636.90','636.91','636.92','637','637.0','637.00','637.01','637.02','637.1','637.10','637.11','637.12','637.2','637.20','637.21','637.22','637.3','637.30','637.31','637.32','637.4','637.40','637.41','637.42','637.5','637.50','637.51','637.52','637.6','637.60','637.61','637.62','637.7','637.70','637.71','637.72','637.8','637.80','637.81','637.82','637.9','637.90','637.91','637.92','638','638.0','638.1','638.2','638.3','638.4','638.5','638.6','638.7','638.8','638.9','639','639.0','639.1','639.2','639.3','639.4','639.5','639.6','639.8','639.9','640','640.0','640.00','640.01','640.03','640.8','640.80','640.81','640.83','640.9','640.90','640.91','640.93','641','641.0','641.00','641.01','641.03','641.1','641.10','641.11','641.13','641.2','641.20','641.21','641.23','641.3','641.30','641.31','641.33','641.8','641.80','641.81','641.83','641.9','641.90','641.91','641.93','642','642.0','642.00','642.01','642.02','642.03','642.04','642.1','642.10','642.11','642.12','642.13','642.14','642.2','642.20','642.21','642.22','642.23','642.24','642.3','642.30','642.31','642.32','642.33','642.34','642.4','642.40','642.41','642.42','642.43','642.44','642.5','642.50','642.51','642.52','642.53','642.54','642.6','642.60','642.61','642.62','642.63','642.64','642.7','642.70','642.71','642.72','642.73','642.74','642.9','642.90','642.91','642.92','642.93','642.94','643','643.0','643.00','643.01','643.03','643.1','643.10','643.11','643.13','643.2','643.20','643.21','643.23','643.8','643.80','643.81','643.83','643.9','643.90','643.91','643.93','644','644.0','644.00','644.03','644.1','644.10','644.13','644.2','644.20','644.21','645','645.1','645.10','645.11','645.13','645.2','645.20','645.21','645.23','646','646.0','646.00','646.01','646.03','646.1','646.10','646.11','646.12','646.13','646.14','646.2','646.20','646.21','646.22','646.23','646.24','646.3','646.30','646.31','646.33','646.4','646.40','646.41','646.42','646.43','646.44','646.5','646.50','646.51','646.52','646.53','646.54','646.6','646.60','646.61','646.62','646.63','646.64','646.7','646.70','646.71','646.73','646.8','646.80','646.81','646.82','646.83','646.84','646.9','646.90','646.91','646.93','647','647.0','647.00','647.01','647.02','647.03','647.04','647.1','647.10','647.11','647.12','647.13','647.14','647.2','647.20','647.21','647.22','647.23','647.24','647.3','647.30','647.31','647.32','647.33','647.34','647.4','647.40','647.41','647.42','647.43','647.44','647.5','647.50','647.51','647.52','647.53','647.54','647.6','647.60','647.61','647.62','647.63','647.64','647.8','647.80','647.81','647.82','647.83','647.84','647.9','647.90','647.91','647.92','647.93','647.94','648','648.0','648.00','648.01','648.02','648.03','648.04','648.1','648.10','648.11','648.12','648.13','648.14','648.2','648.20','648.21','648.22','648.23','648.24','648.3','648.30','648.31','648.32','648.33','648.34','648.4','648.40','648.41','648.42','648.43','648.44','648.5','648.50','648.51','648.52','648.53','648.54','648.6','648.60','648.61','648.62','648.63','648.64','648.7','648.70','648.71','648.72','648.73','648.74','648.8','648.80','648.81','648.82','648.83','648.84','648.9','648.90','648.91','648.92','648.93','648.94','649','649.0','649.00','649.01','649.02','649.03','649.04','649.1','649.10','649.11','649.12','649.13','649.14','649.2','649.20','649.21','649.22','649.23','649.24','649.3','649.30','649.31','649.32','649.33','649.34','649.4','649.40','649.41','649.42','649.43','649.44','649.5','649.50','649.51','649.53','649.6','649.60','649.61','649.62','649.63','649.64','649.7','649.70','649.71','649.73','650','651','651.0','651.00','651.01','651.03','651.1','651.10','651.11','651.13','651.2','651.20','651.21','651.23','651.3','651.30','651.31','651.33','651.4','651.40','651.41','651.43','651.5','651.50','651.51','651.53','651.6','651.60','651.61','651.63','651.7','651.70','651.71','651.73','651.8','651.80','651.81','651.83','651.9','651.90','651.91','651.93','652','652.0','652.00','652.01','652.03','652.1','652.10','652.11','652.13','652.2','652.20','652.21','652.23','652.3','652.30','652.31','652.33','652.4','652.40','652.41','652.43','652.5','652.50','652.51','652.53','652.6','652.60','652.61','652.63','652.7','652.70','652.71','652.73','652.8','652.80','652.81','652.83','652.9','652.90','652.91','652.93','653','653.0','653.00','653.01','653.03','653.1','653.10','653.11','653.13','653.2','653.20','653.21','653.23','653.3','653.30','653.31','653.33','653.4','653.40','653.41','653.43','653.5','653.50','653.51','653.53','653.6','653.60','653.61','653.63','653.7','653.70','653.71','653.73','653.8','653.80','653.81','653.83','653.9','653.90','653.91','653.93','654','654.0','654.00','654.01','654.02','654.03','654.04','654.1','654.10','654.11','654.12','654.13','654.14','654.2','654.20','654.21','654.23','654.3','654.30','654.31','654.32','654.33','654.34','654.4','654.40','654.41','654.42','654.43','654.44','654.5','654.50','654.51','654.52','654.53','654.54','654.6','654.60','654.61','654.62','654.63','654.64','654.7','654.70','654.71','654.72','654.73','654.74','654.8','654.80','654.81','654.82','654.83','654.84','654.9','654.90','654.91','654.92','654.93','654.94','655','655.0','655.00','655.01','655.03','655.1','655.10','655.11','655.13','655.2','655.20','655.21','655.23','655.3','655.30','655.31','655.33','655.4','655.40','655.41','655.43','655.5','655.50','655.51','655.53','655.6','655.60','655.61','655.63','655.7','655.70','655.71','655.73','655.8','655.80','655.81','655.83','655.9','655.90','655.91','655.93','656','656.0','656.00','656.01','656.03','656.1','656.10','656.11','656.13','656.2','656.20','656.21','656.23','656.3','656.30','656.31','656.33','656.4','656.40','656.41','656.43','656.5','656.50','656.51','656.53','656.6','656.60','656.61','656.63','656.7','656.70','656.71','656.73','656.8','656.80','656.81','656.83','656.9','656.90','656.91','656.93','657','657.0','657.00','657.01','657.03','658','658.0','658.00','658.01','658.03','658.1','658.10','658.11','658.13','658.2','658.20','658.21','658.23','658.3','658.30','658.31','658.33','658.4','658.40','658.41','658.43','658.8','658.80','658.81','658.83','658.9','658.90','658.91','658.93','659','659.0','659.00','659.01','659.03','659.1','659.10','659.11','659.13','659.2','659.20','659.21','659.23','659.3','659.30','659.31','659.33','659.4','659.40','659.41','659.43','659.5','659.50','659.51','659.53','659.6','659.60','659.61','659.63','659.7','659.70','659.71','659.73','659.8','659.80','659.81','659.83','659.9','659.90','659.91','659.93','660','660.0','660.00','660.01','660.03','660.1','660.10','660.11','660.13','660.2','660.20','660.21','660.23','660.3','660.30','660.31','660.33','660.4','660.40','660.41','660.43','660.5','660.50','660.51','660.53','660.6','660.60','660.61','660.63','660.7','660.70','660.71','660.73','660.8','660.80','660.81','660.83','660.9','660.90','660.91','660.93','661','661.0','661.00','661.01','661.03','661.1','661.10','661.11','661.13','661.2','661.20','661.21','661.23','661.3','661.30','661.31','661.33','661.4','661.40','661.41','661.43','661.9','661.90','661.91','661.93','662','662.0','662.00','662.01','662.03','662.1','662.10','662.11','662.13','662.2','662.20','662.21','662.23','662.3','662.30','662.31','662.33','663','663.0','663.00','663.01','663.03','663.1','663.10','663.11','663.13','663.2','663.20','663.21','663.23','663.3','663.30','663.31','663.33','663.4','663.40','663.41','663.43','663.5','663.50','663.51','663.53','663.6','663.60','663.61','663.63','663.8','663.80','663.81','663.83','663.9','663.90','663.91','663.93','664','664.0','664.00','664.01','664.04','664.1','664.10','664.11','664.14','664.2','664.20','664.21','664.24','664.3','664.30','664.31','664.34','664.4','664.40','664.41','664.44','664.5','664.50','664.51','664.54','664.6','664.60','664.61','664.64','664.8','664.80','664.81','664.84','664.9','664.90','664.91','664.94','665','665.0','665.00','665.01','665.03','665.1','665.10','665.11','665.2','665.20','665.22','665.24','665.3','665.30','665.31','665.34','665.4','665.40','665.41','665.44','665.5','665.50','665.51','665.54','665.6','665.60','665.61','665.64','665.7','665.70','665.71','665.72','665.74','665.8','665.80','665.81','665.82','665.83','665.84','665.9','665.90','665.91','665.92','665.93','665.94','666','666.0','666.00','666.02','666.04','666.1','666.10','666.12','666.14','666.2','666.20','666.22','666.24','666.3','666.30','666.32','666.34','667','667.0','667.00','667.02','667.04','667.1','667.10','667.12','667.14','668','668.0','668.00','668.01','668.02','668.03','668.04','668.1','668.10','668.11','668.12','668.13','668.14','668.2','668.20','668.21','668.22','668.23','668.24','668.8','668.80','668.81','668.82','668.83','668.84','668.9','668.90','668.91','668.92','668.93','668.94','669','669.0','669.00','669.01','669.02','669.03','669.04','669.1','669.10','669.11','669.12','669.13','669.14','669.2','669.20','669.21','669.22','669.23','669.24','669.3','669.30','669.32','669.34','669.4','669.40','669.41','669.42','669.43','669.44','669.5','669.50','669.51','669.6','669.60','669.61','669.7','669.70','669.71','669.8','669.80','669.81','669.82','669.83','669.84','669.9','669.90','669.91','669.92','669.93','669.94','670','670.0','670.00','670.02','670.04','671','671.0','671.00','671.01','671.02','671.03','671.04','671.1','671.10','671.11','671.12','671.13','671.14','671.2','671.20','671.21','671.22','671.23','671.24','671.3','671.30','671.31','671.33','671.4','671.40','671.42','671.44','671.5','671.50','671.51','671.52','671.53','671.54','671.8','671.80','671.81','671.82','671.83','671.84','671.9','671.90','671.91','671.92','671.93','671.94','672','672.0','672.00','672.02','672.04','673','673.0','673.00','673.01','673.02','673.03','673.04','673.1','673.10','673.11','673.12','673.13','673.14','673.2','673.20','673.21','673.22','673.23','673.24','673.3','673.30','673.31','673.32','673.33','673.34','673.8','673.80','673.81','673.82','673.83','673.84','674','674.0','674.00','674.01','674.02','674.03','674.04','674.1','674.10','674.12','674.14','674.2','674.20','674.22','674.24','674.3','674.30','674.32','674.34','674.4','674.40','674.42','674.44','674.5','674.50','674.51','674.52','674.53','674.54','674.8','674.80','674.82','674.84','674.9','674.90','674.92','674.94','675','675.0','675.00','675.01','675.02','675.03','675.04','675.1','675.10','675.11','675.12','675.13','675.14','675.2','675.20','675.21','675.22','675.23','675.24','675.8','675.80','675.81','675.82','675.83','675.84','675.9','675.90','675.91','675.92','675.93','675.94','676','676.0','676.00','676.01','676.02','676.03','676.04','676.1','676.10','676.11','676.12','676.13','676.14','676.2','676.20','676.21','676.22','676.23','676.24','676.3','676.30','676.31','676.32','676.33','676.34','676.4','676.40','676.41','676.42','676.43','676.44','676.5','676.50','676.51','676.52','676.53','676.54','676.6','676.60','676.61','676.62','676.63','676.64','676.8','676.80','676.81','676.82','676.83','676.84','676.9','676.90','676.91','676.92','676.93','676.94','677','678','678.0','678.00','678.01','678.03','678.1','678.10','678.11','678.13','679','679.0','679.00','679.01','679.02','679.03','679.04','679.1','679.10','679.11','679.12','679.13','679.14','V22','V22.0','V22.1','V22.2','V23','V23.0','V23.1','V23.2','V23.3','V23.4','V23.41','V23.49','V23.5','V23.7','V23.8','V23.81','V23.82','V23.83','V23.84','V23.85','V23.86','V23.89','V23.9','V28','V28.0','V28.1','V28.2','V28.3','V28.4','V28.5','V28.6','V28.8','V28.81','V28.82','V28.89','V28.9' ) + ), Diagnosis::HYPERTENSION => array( 'CUSTOM' => array( 'HTN' ), - 'ICD9' => array( '401.0','401.1','401.9','402.00','402.01','402.10','402.11','402.90','402.91','403.00','403.01','403.10','403.11','403.90','403.91','404.00','404.01','404.02','404.03','404.10','404.11','404.12','404.13','404.90','404.91','404.92','404.93' - ) ), + 'ICD9' => array( '401.0','401.1','401.9','402.00','402.01','402.10','402.11','402.90','402.91','403.00','403.01','403.10','403.11','403.90','403.91','404.00','404.01','404.02','404.03','404.10','404.11','404.12','404.13','404.90','404.91','404.92','404.93' ) + ), + Diagnosis::ENCEPHALOPATHY => array( + 'ICD9' => array( '323.51' ) + ), + Diagnosis::PROG_NEURO_DISORDER => array( + 'ICD9' => array( '' ) + ), + Encounter::ENC_OUT_PCP_OBGYN => array( + 'ICD9' => array( 'V24','V25','V26','V27','V28','V45.5','V61.5','V61.6','V61.7','V69.2','V72.3','V72.4' ) + ), + Encounter::ENC_OUTPATIENT => array( + 'ICD9' => array( 'V70.0','V70.3','V70.5','V70.6','V70.8','V70.9' ) + ), + Encounter::ENC_PREGNANCY => array( + 'ICD9' => array( 'V24','V24.0','V24.2','V25','V25.01','V25.02','V25.03','V25.09','V26.81','V28','V28.3','V28.81','V28.82','V72.4','V72.40','V72.41','V72.42' ) + ), + Medication::DTAP => array( + 'OPTION_ID' => array( 1, 2, 3, 4, 5, ), + 'CVX' => array() + ), + Medication::HEP_A => array( + 'OPTION_ID' => array( 33, 34 ), + 'CVX' => array() + ), + Medication::HEP_B => array( + 'OPTION_ID' => array( 27, 28, 29 ), + 'CVX' => array() + ), + Medication::HIB => array( + 'OPTION_ID' => array( 15, 16, 17, 18 ), + 'CVX' => array() + ), + Medication::IPV => array( + 'OPTION_ID' => array( 11, 12, 13, 14 ), + 'CVX' => array() + ), + Medication::MEASLES => array( // TODO + 'OPTION_ID' => array(), + 'CVX' => array() + ), + Medication::MMR => array( + 'OPTION_ID' => array( 23, 24 ), + 'CVX' => array() + ), + Medication::MUMPS => array( // TODO + 'OPTION_ID' => array(), + 'CVX' => array() + ), + Medication::PNEUMOCOCCAL => array( + 'OPTION_ID' => array( 19, 20, 21, 22 ), + 'CVX' => array() + ), + Medication::RUBELLA => array( // TODO + 'OPTION_ID' => array(), + 'CVX' => array() + ), PhysicalExam::FINDING_BMI_PERC => array( - 'ICD9' => array( 'V85.5','V85.51','V85.52','V85.53','V85.54' - ) ) + 'ICD9' => array( 'V85.5','V85.51','V85.52','V85.53','V85.54' ) + ), ); public $obgyn_codes = array( diff --git a/library/classes/rulesets/Cqm/reports/NFQ_0038.php b/library/classes/rulesets/Cqm/reports/NFQ_0038.php new file mode 100644 index 000000000..692e4ea28 --- /dev/null +++ b/library/classes/rulesets/Cqm/reports/NFQ_0038.php @@ -0,0 +1,8 @@ +dob ) ) ); + $dobPlus2Years = date( 'Y-m-d 00:00:00', strtotime( '+2 year', strtotime( $patient->dob ) ) ); + $options = array( Medication::OPTION_COUNT => 4, Medication::OPTION_UNIQUE_DATES => true ); + if ( Helper::check( ClinicalType::MEDICATION, Medication::DTAP, $patient, $dobPlus42Days, $dobPlus2Years, $options ) && + !( Helper::check( ClinicalType::ALLERGY, Allergy::DTAP_VAC, $patient ) || + Helper::check( ClinicalType::DIAGNOSIS, Diagnosis::ENCEPHALOPATHY, $patient, $dateBegin, $dateEnd ) || + Helper::check( ClinicalType::DIAGNOSIS, Diagnosis::PROG_NEURO_DISORDER, $patient, $dateBegin, $dateEnd ) ) ) { + return true; + } + return false; } } diff --git a/library/classes/rulesets/Cqm/reports/NFQ_0038/Numerator2.php b/library/classes/rulesets/Cqm/reports/NFQ_0038/Numerator2.php index e934947c2..6a1b283d7 100644 --- a/library/classes/rulesets/Cqm/reports/NFQ_0038/Numerator2.php +++ b/library/classes/rulesets/Cqm/reports/NFQ_0038/Numerator2.php @@ -7,6 +7,17 @@ class NFQ_0038_Numerator2 implements CqmFilterIF public function test( CqmPatient $patient, $dateBegin, $dateEnd ) { + $dobPlus42Days = date( 'Y-m-d 00:00:00', strtotime( '+42 day', strtotime( $patient->dob ) ) ); + $dobPlus2Years = date( 'Y-m-d 00:00:00', strtotime( '+2 year', strtotime( $patient->dob ) ) ); + $options = array( Medication::OPTION_COUNT => 3, Medication::OPTION_UNIQUE_DATES => true ); + if ( Helper::check( ClinicalType::MEDICATION, Medication::IPV, $patient, $dobPlus42Days, $dobPlus2Years, $options ) && + !( Helper::check( ClinicalType::ALLERGY, Allergy::IPV, $patient ) || + Helper::check( ClinicalType::ALLERGY, Allergy::NEOMYCIN, $patient ) || + Helper::check( ClinicalType::ALLERGY, Allergy::STREPTOMYCIN, $patient ) || + Helper::check( ClinicalType::ALLERGY, Allergy::POLYMYXIN, $patient ) ) ) { + return true; + } + return false; } } diff --git a/library/classes/rulesets/Cqm/reports/NFQ_0038/Numerator3.php b/library/classes/rulesets/Cqm/reports/NFQ_0038/Numerator3.php index c5ab1e4b3..ed846e070 100644 --- a/library/classes/rulesets/Cqm/reports/NFQ_0038/Numerator3.php +++ b/library/classes/rulesets/Cqm/reports/NFQ_0038/Numerator3.php @@ -7,6 +7,41 @@ class NFQ_0038_Numerator3 implements CqmFilterIF public function test( CqmPatient $patient, $dateBegin, $dateEnd ) { + $dobPlus1Year = date( 'Y-m-d 00:00:00', strtotime( '+1 year', strtotime( $patient->dob ) ) ); + $dobPlus2Years = date( 'Y-m-d 00:00:00', strtotime( '+2 year', strtotime( $patient->dob ) ) ); + $options = array( Medication::OPTION_COUNT => 1 ); + if ( Helper::checkMed( Medication::MMR, $patient, $dobPlus1Year, $dobPlus2Years, $options ) || + ( Helper::checkMed( Medication::MUMPS, $patient, $patient->dob, $dobPlus2Years ) && + !Helper::checkAllergy( Allergy::MUMPS_VAC, $patient ) && + Helper::checkMed( Medication::MEASLES, $patient, $patient->dob, $dobPlus2Years ) && + !Helper::checkAllergy( Allergy::MEASLES_VAC, $patient ) && + Helper::checkMed( Medication::RUBELLA, $patient, $patient->dob, $dobPlus2Years ) && + !Helper::checkAllergy( Allergy::RUBELLA_VAC, $patient ) ) || + ( Helper::checkDiagResolved( Diagnosis::MEASLES, $patient ) && + Helper::checkMed( Medication::MUMPS, $patient, $patient->dob, $dobPlus2Years ) && + !Helper::checkAllergy( Allergy::MUMPS_VAC, $patient ) && + Helper::checkMed( Medication::RUBELLA, $patient, $patient->dob, $dobPlus2Years ) && + !Helper::checkAllergy( Allergy::RUBELLA_VAC, $patient ) ) || + ( Helper::checkDiagResolved( Diagnosis::MUMPS, $patient ) && + Helper::checkMed( Medication::MEASLES, $patient, $patient->dob, $dobPlus2Years ) && + !Helper::checkAllergy( Allergy::MEASLES_VAC, $patient ) && + Helper::checkMed( Medication::RUBELLA, $patient, $patient->dob, $dobPlus2Years ) && + !Helper::checkAllergy( Allergy::RUBELLA_VAC, $patient ) ) || + ( Helper::checkDiagResolved( Diagnosis::RUBELLA, $patient ) && + Helper::checkMed( Medication::MUMPS, $patient, $patient->dob, $dobPlus2Years ) && + !Helper::checkAllergy( Allergy::MUMPS_VAC, $patient ) && + Helper::checkMed( Medication::MEASLES, $patient, $patient->dob, $dobPlus2Years ) && + !Helper::checkAllergy( Allergy::MEASLES_VAC, $patient ) ) && + !( Helper::checkDiagActive( Diagnosis::CANCER_LYMPH_HIST, $patient, $dateBegin, $dateEnd ) || + Helper::checkDiagInactive( Diagnosis::CANCER_LYMPH_HIST, $patient, $dateBegin, $dateEnd ) || + Helper::checkDiagActive( Diagnosis::ASYMPTOMATIC_HIV, $patient, $dateBegin, $dateEnd ) || + Helper::checkDiagActive( Diagnosis::MULT_MYELOMA, $patient, $dateBegin, $dateEnd ) || + Helper::checkDiagActive( Diagnosis::LUKEMIA, $patient, $dateBegin, $dateEnd ) || + Helper::checkAllergy( Allergy::MMR, $patient ) || + Helper::checkDiagActive( Diagnosis::IMMUNODEF, $patient, $dateBegin, $dateEnd ) ) ) { + return true; + } + return false; } } diff --git a/library/classes/rulesets/Cqm/reports/NFQ_0038/Numerator4.php b/library/classes/rulesets/Cqm/reports/NFQ_0038/Numerator4.php index 9d04e5608..13cc19c32 100644 --- a/library/classes/rulesets/Cqm/reports/NFQ_0038/Numerator4.php +++ b/library/classes/rulesets/Cqm/reports/NFQ_0038/Numerator4.php @@ -7,6 +7,13 @@ class NFQ_0038_Numerator4 implements CqmFilterIF public function test( CqmPatient $patient, $dateBegin, $dateEnd ) { + $options = array( Medication::OPTION_COUNT => 2 ); + $dobPlus42Days = date( 'Y-m-d 00:00:00', strtotime( '+42 day', strtotime( $patient->dob ) ) ); + $dobPlus2Years = date( 'Y-m-d 00:00:00', strtotime( '+2 year', strtotime( $patient->dob ) ) ); + if ( Helper::checkMed( Medication::HIB, $dobPlus42Days, $dobPlus2Years, $options ) && + !Helper::checkAllergy( Allergy::HIB, $patient ) ) { + return true; + } return false; } } diff --git a/library/classes/rulesets/Cqm/reports/NFQ_0038/PopulationCriteria.php b/library/classes/rulesets/Cqm/reports/NFQ_0038/PopulationCriteria.php new file mode 100644 index 000000000..47f6868e3 --- /dev/null +++ b/library/classes/rulesets/Cqm/reports/NFQ_0038/PopulationCriteria.php @@ -0,0 +1,41 @@ + -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. - -require_once(dirname(__FILE__) . "/../../clinical_rules.php"); -require_once(dirname(__FILE__) . "/../../forms.inc"); -require_once(dirname(__FILE__) . "/../../patient.inc"); -require_once( 'codes.php' ); - -class ruleSet -{ - // Main input variables: - // $rule - array containing rule information - // $dateTarget - target date - // $patientData - array of pertinent patients - - // These variables hold the results data elements, note they are all - // arrays that need to all contain the same number of elements. - // $group_label - array of titles for each group (usually only one group) TODO: get this working for when there are multiple groups - // $total_patients - array of total patients for each group - // $pass_filter - array of patients that pass filters for each group - // $exclude_filter - array of patients that are excluded for each group - // $pass_target - array of patients that pass target for each group - // $percentage - array of percentage of patients that pass target for each group - - // Main processed results variable: - // $results - holds the result array used in reports - - private $codes; // code lookup class - - // Construction function - public function __construct( $rule, $dateTarget, $patientData ) { - $this->codes = new Code_Lookup(); - $this->rule = $rule; - $this->dateTarget = $dateTarget; - $this->patientData = $patientData; - $this->process_rule(); - $this->process_results(); - } - - // Function to return the results - public function return_results() { - return $this->results; - } - - // Straightforward function to call the correct rule functions - private function process_rule() { - $rule_id=$this->rule['id']; - // process specific rule - switch ($rule_id) { - case "rule_htn_bp_measure_cqm": - // Hypertension: Blood Pressure Measurement - // NQF 0013 - $this->rule_htn_bp_measure_cqm(); - break; - case "rule_tob_use_assess_cqm": - // Tobacco Use Assessment - // NQF 0028a - $this->rule_tob_use_assess_cqm(); - break; - case "rule_tob_cess_inter_cqm": - // Tobacco Cessation Intervention - // NQF 0028b - $this->rule_tob_cess_inter_cqm(); - break; - case "rule_adult_wt_screen_fu_cqm": - // Adult Weight Screening and Follow-Up - // NQF 0421 - // PQRI 128 - $this->rule_adult_wt_screen_fu_cqm(); - break; - case "rule_wt_assess_couns_child_cqm": - // Weight Assessment and Counseling for Children and Adolescents - // NQF 0024 - $this->rule_wt_assess_couns_child_cqm(); - break; - case "rule_influenza_ge_50_cqm": - // Influenza Immunization for Patients >= 50 Years Old - // NQF 0041 - // PQRI 110 - $this->rule_influenza_ge_50_cqm(); - break; - case "rule_child_immun_stat_cqm": - // Childhood immunization Status - // NQF 0038 - $this->rule_child_immun_stat_cqm(); - break; - case "rule_pneumovacc_ge_65_cqm": - // Pneumonia Vaccination Status for Older Adults - // NQF 0043 - // PQRI 111 - $this->rule_pneumovacc_ge_65_cqm(); - break; - case "rule_dm_eye_cqm": - // Diabetes: Eye Exam - // NQF 0055 - // PQRI 117 - $this->rule_dm_eye_cqm(); - break; - case "rule_dm_foot_cqm": - // Diabetes: Foot Exam - // NQF 0056 - // PQRI 163 - $this->rule_dm_foot_cqm(); - break; - case "rule_dm_bp_control_cqm": - // Diabetes: Blood Pressure Management - // NQF 0061 - // PQRI 3 - $this->rule_dm_bp_control_cqm(); - break; - case "rule_dm_a1c_cqm": - // Diabetes: HbA1c Poor Control - // NQF 0059 - // PQRI 1 - $this->rule_dm_a1c_cqm(); - break; - case "rule_dm_ldl_cqm": - // Diabetes: LDL Management & Control - // NQF 0064 - // PQRI 2 - $this->rule_dm_ldl_cqm(); - break; - case "problem_list_amc": - // Maintain an up-to-date problem list of current and active diagnoses. - // 170.302(c) - $this->problem_list_amc(); - break; - case "med_list_amc": - // Maintain active medication list. - // 170.302(d) - $this->med_list_amc(); - break; - case "med_allergy_list_amc": - // Maintain active medication allergy list. - // 170.302(e) - $this->med_allergy_list_amc(); - break; - case "record_vitals_amc": - // Record and chart changes in vital signs. - // 170.302(f) - $this->record_vitals_amc(); - break; - case "record_smoke_amc": - // Record smoking status for patients 13 years old or older. - // 170.302(g) - $this->record_smoke_amc(); - break; - case "lab_result_amc": - // Incorporate clinical lab-test results into certified EHR technology as structured data. - // 170.302(h) - $this->lab_result_amc(); - break; - case "med_reconc_amc": - // The EP, eligible hospital or CAH who receives a patient from another setting of care or provider of care or believes an encounter is relevant should perform medication reconciliation. - // 170.302(j) - $this->med_reconc_amc(); - break; - case "patient_edu_amc": - // Use certified EHR technology to identify patient-specific education resources and provide those resources to the patient if appropriate. - // 170.302(m) - $this->patient_edu_amc(); - break; - case "cpoe_med_amc": - // Use CPOE for medication orders directly entered by any licensed healthcare professional who can enter orders into the medical record per state, local and professional guidelines. - // 170.304(a) - $this->cpoe_med_amc(); - break; - case "e_prescribe_amc": - // Generate and transmit permissible prescriptions electronically. - // 170.304(b) - $this->e_prescribe_amc(); - break; - case "record_dem_amc": - // Record demographics. - // 170.304(c) - $this->record_dem_amc(); - break; - case "send_reminder_amc": - // Send reminders to patients per patient preference for preventive/follow up care. - // 170.304(d) - $this->send_reminder_amc(); - break; - case "provide_rec_pat_amc": - // Provide patients with an electronic copy of their health information (including diagnostic test results, problem list, medication lists, medication allergies), upon request. - // 170.304(f) - $this->provide_rec_pat_amc(); - break; - case "timely_access_amc": - // Provide patients with timely electronic access to their health information (including lab results, problem list, medication lists, medication allergies) within four business days of the information being available to the EP. - // 170.304(g) - $this->timely_access_amc(); - break; - case "provide_sum_pat_amc": - // Provide clinical summaries for patients for each office visit. - // 170.304(h) - $this->provide_sum_pat_amc(); - break; - case "send_sum_amc": - // The EP, eligible hospital or CAH who transitions their patient to another setting of care or provider of care or refers their patient to another provider of care should provide summary of care record for each transition of care or referral. - // 170.304(i) - $this->send_sum_amc(); - break; - default: - break; - } - } - - // Function to process the results - private function process_results() { - // if applicable, need to iterate through each group of data - for($i=0;$igroup_label);$i++) { - $newRow=array( 'is_main'=>TRUE, // TO DO: figure out way to do this when multiple groups. - 'total_patients'=>($this->total_patients[$i]), - 'excluded'=>($this->exclude_filter[$i]), - 'pass_filter'=>($this->pass_filter[$i]), - 'pass_target'=>($this->pass_target[$i]), - 'percentage'=>($this->percentage[$i]) ); - $newRow=array_merge($newRow,$this->rule); - $this->results[] = $newRow; - } - } - - // Function to set a results element - // Param: - // $group_lab - Label of element - // $total_pat - Total number of patients considered - // $pass_filt - Number of patients that pass filter - // $exclude_filt - Number of patients that are excluded - // $pass_targ - Number of patients that pass target - // $perc - Calculated percentage - private function set_result($group_lab,$total_pat,$pass_filt,$exclude_filt,$pass_targ,$perc) { - $this->group_label[] = $group_lab; - $this->total_patients[] = $total_pat; - $this->pass_filter[] = $pass_filt; - $this->exclude_filter[] = $exclude_filt; - $this->pass_target[] = $pass_targ; - $this->percentage[] = $perc; - } - - // Function to see if encounters exist - // Parameters: - // $patient_id - patient id - // $encounter_label - encounter id from list_options - // $begin_date - begin of date to search (if blank, then will not limit to a begin date) - // $end_date - end of date to search - // $number - number of encounters needed - private function exist_encounter($patient_id,$encounter_label,$begin_date='',$end_date,$number) { - // use the getEncounters() function from library/forms.inc - $encounters = getEncounters($patient_id,$begin_date,$end_date,$encounter_label); - (empty($encounters)) ? $totalNumberAppt = 0 : $totalNumberAppt = count($encounters); - if ( $totalNumberAppt < $number ) { - return false; - } - else { - return true; - } - } - - - // Function to get patient dob - // Parameter: - // $patient_id - patient id - // Return: DOB (string) - private function get_DOB($patient_id) { - $dob = getPatientData($patient_id, "DATE_FORMAT(DOB,'%Y %m %d') as TS_DOB"); - return $dob['TS_DOB']; - } - - // Function to get patient id from the patient array - // Paramter: - // $array_patient - array holding patient id in the 'id' column - private function get_patient_id($array_patient) { - return $array_patient['pid']; - } - - // Hypertension: Blood Pressure Measurement (NQF 0013) - // - // (note it only needs to process one group) - // (Measurement for 12 months from 1/1/20?? to 12/31/20??) - // - // 1) Calculate number that pass the filter - // -Age greater than 18 (before the beginning of the measurement period). - // -Diagnosis of HTN (before or during the measurement period) - // -At least two encounters (of a specified type and within the measurement - // period) - // 2) Deal with exclusions: - // -No exclusions - // 3) Then from patients that pass the filter (and are not excluded), calculate - // the number that have the target. - // -Measurement of a SBP and a DBP within the measurment period (needs - // to be on same day as specified encounter type) - // 4) Then calculate the percentage, which is number that meet the target - // divided by the number of patients that pass the filter (and are not excluded). - // - private function rule_htn_bp_measure_cqm() { - $rule_id=$this->rule['id']; - $dateTarget = $this->dateTarget; - $patientData = $this->patientData; - - // Calculate measurement period - $tempDateArray = explode("-",$dateTarget); - $tempYear = $tempDateArray[0]; - $begin_measurement = $tempDateArray[0] . "-01-01 00:00:00"; - $end_measurement = $tempDateArray[0] . "-12-31 23:59:59"; - - // Collect results - $total_pat = 0; - $pass_filt = 0; - $exclude_filt = 0; - $pass_targ = 0; - $perc = 0; - foreach ( $patientData as $rowPatient ) { - // increment total patients counter - $total_pat++; - - // get patient id - $patient_id = $this->get_patient_id($rowPatient); - - // filter for age greater than 18 - // utilize the convertDobtoAgeYearDecimal() function from library/clinical_rules.php - if (convertDobtoAgeYearDecimal( $this->get_DOB($patient_id), $begin_measurement ) < 18) continue; - - // filter for diagnosis of HTN - // utlize the exist_lists_item() function from library/clinical_rules.php - if (!( (exist_lists_item($patient_id,'medical_problem','CUSTOM::HTN',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::401.0',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::401.1',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::401.9',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::402.00',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::402.01',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::402.10',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::402.11',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::402.90',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::402.91',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::403.00',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::403.01',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::403.10',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::403.11',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::403.90',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::403.91',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::404.00',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::404.01',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::404.02',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::404.03',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::404.10',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::404.11',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::404.12',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::404.13',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::404.90',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::404.91',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::404.92',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::404.93',$end_measurement)) )) { - continue; - } - - // filter for 2 specified encounters - // make a function for this and wrap in the encounter titles - if (!( ($this->exist_encounter($patient_id,'enc_outpatient',$begin_measurement,$end_measurement,2)) || - ($this->exist_encounter($patient_id,'enc_nurs_fac',$begin_measurement,$end_measurement,2)) )) { - - continue; - } - - // Filter has been passed - $pass_filt++; - - // See if BP has been done within the measurement period (on a day of a specified encounter) - $query = "SELECT form_vitals.bps, form_vitals.bpd " . - "FROM `form_vitals` " . - "LEFT JOIN `form_encounter` " . - "ON ( DATE(form_vitals.date) = DATE(form_encounter.date)) " . - "LEFT JOIN `enc_category_map` " . - "ON (enc_category_map.main_cat_id = form_encounter.pc_catid) " . - "WHERE form_vitals.pid = ?" . - "AND form_vitals.bps IS NOT NULL " . - "AND form_vitals.bpd IS NOT NULL " . - "AND form_vitals.date >= ? " . - "AND form_vitals.date <= ? " . - "AND ( enc_category_map.rule_enc_id = 'enc_outpatient' OR enc_category_map.rule_enc_id = 'enc_nurs_fac' )"; - $res = sqlStatement($query, array($patient_id,$begin_measurement,$end_measurement) ); - $number = sqlNumRows($res); - if ($number < 1) continue; - - error_log("passed target",0); - - // Target has been passed - $pass_targ++; - } - - // Calculate Percentage (use calculate_percentage() function from library/clinical_rules.php - $perc = calculate_percentage($pass_filt,$exclude_filt,$pass_targ); - - // Set results - $this->set_result($rule_id,$total_pat,$pass_filt,$exclude_filt,$pass_targ,$perc); - } - - // Tobacco Use Assessment (NQF 0028a) - private function rule_tob_use_assess_cqm() { - $rule_id=$this->rule['id']; - $dateTarget = $this->dateTarget; - $patientData =$this->patientData; - - // Calculate measurement period - $tempDateArray = explode("-",$dateTarget); - $tempYear = $tempDateArray[0]; - $begin_measurement = $tempDateArray[0] . "-01-01 00:00:00"; - $end_measurement = $tempDateArray[0] . "-12-31 23:59:59"; - - // Collect results - $total_pat = 0; - $pass_filt = 0; - $exclude_filt = 0; - $pass_targ = 0; - $perc = 0; - foreach ( $patientData as $rowPatient ) { - $patient_id = $this->get_patient_id($rowPatient); - // increment total patients counter - $total_pat++; - - // filter for age greater than 18 - // utilize the convertDobtoAgeYearDecimal() function from library/clinical_rules.php - $age = convertDobtoAgeYearDecimal( $this->get_DOB( $patient_id ), $begin_measurement ); - if ( $age < 18) continue; - - // filter for 2 specified encounters of some types, and 1 for others - // make a function for this and wrap in the encounter titles - if (!( ($this->exist_encounter($patient_id,'enc_off_vis',$begin_measurement,$end_measurement,2)) || - ($this->exist_encounter($patient_id,'enc_hea_and_beh',$begin_measurement,$end_measurement,2)) || - ($this->exist_encounter($patient_id,'enc_occ_ther',$begin_measurement,$end_measurement,2)) || - ($this->exist_encounter($patient_id,'enc_psych_and_psych',$begin_measurement,$end_measurement,2)) || - ($this->exist_encounter($patient_id,'enc_pre_med_ser_18_older',$begin_measurement,$end_measurement,1)) || - ($this->exist_encounter($patient_id,'enc_pre_ind_counsel',$begin_measurement,$end_measurement,1)) || - ($this->exist_encounter($patient_id,'enc_pre_med_group_counsel',$begin_measurement,$end_measurement,1)) || - ($this->exist_encounter($patient_id,'enc_pre_med_other_serv',$begin_measurement,$end_measurement,1)) )) { - continue; - } - - // Filter has been passed - $pass_filt++; - - // See if user has been a tobacco user before or sumultaneosly to the encounter within two years (24 months) - $begin_24_months_before_time = strtotime( '-24 month' , strtotime ( $begin_measurement ) ); - $begin_24_months_before = date( 'Y-m-d 00:00:00' , $begin_24_months_before_time ); - $tobaccoHistory = getHistoryData( $patient_id, "tobacco", $begin_24_months_before, $end_measurement ); - if ( !isset( $tobaccoHistory['tobacco'] ) ) { - continue; - } - - // Target has been passed - $pass_targ++; - } - - // Calculate Percentage (use calculate_percentage() function from library/clinical_rules.php - $perc = calculate_percentage($pass_filt,$exclude_filt,$pass_targ); - - // Set results - $this->set_result($rule_id,$total_pat,$pass_filt,$exclude_filt,$pass_targ,$perc); - } - - // TODO - // Tobacco Cessation Intervention (NQF 0028b) - private function rule_tob_cess_inter_cqm() { - - } - - // Adult Weight Screening and Follow-Up (NQF 0421) (PQRI 128) - private function rule_adult_wt_screen_fu_cqm() { - $rule_id=$this->rule['id']; - $dateTarget = $this->dateTarget; - $patientData =$this->patientData; - - // Calculate measurement period - $tempDateArray = explode("-",$dateTarget); - $tempYear = $tempDateArray[0]; - $begin_measurement = $tempDateArray[0] . "-01-01 00:00:00"; - $end_measurement = $tempDateArray[0] . "-12-31 23:59:59"; - - // Collect results - $total_pat = 0; - $pass_filt = 0; - $exclude_filt = 0; - $pass_targ = 0; - $perc = 0; - foreach ( $patientData as $rowPatient ) { - $patient_id = $this->get_patient_id( $rowPatient ); - // increment total patients counter - $total_pat++; - - // filter for age greater than 65 - // utilize the convertDobtoAgeYearDecimal() function from library/clinical_rules.php - $age = convertDobtoAgeYearDecimal( $this->get_DOB( $patient_id ), $begin_measurement ); - if ( $age < 65 ) continue; - - // filter for 1 specified encounters - // make a function for this and wrap in the encounter titles - // doesn't say anything about encounter date, so check for any encounter - if (!( ( $this->exist_encounter($patient_id,'enc_outpatient',$begin_measurement,$end_measurement,1)) )) { - continue; - } - - $pass_filt++; - - // Flow of control loop - $bContinue = true; - do { - // See if BMI has been recorded between >=22kg/m2 and <30kg/m2 6 months before, or simultanious to the encounter - $query = "SELECT form_vitals.BMI " . - "FROM `form_vitals` " . - "LEFT JOIN `form_encounter` " . - "ON ( form_vitals.pid = form_encounter.pid ) " . - "LEFT JOIN `enc_category_map` " . - "ON (enc_category_map.main_cat_id = form_encounter.pc_catid) " . - "WHERE form_vitals.BMI IS NOT NULL " . - "AND form_vitals.BMI IS NOT NULL " . - "AND form_vitals.pid = ? AND form_vitals.BMI >= 22 AND form_vitals.BMI < 30 " . - "AND DATE( form_vitals.date ) >= DATE_ADD( form_encounter.date, INTERVAL -6 MONTH ) " . - "AND DATE( form_vitals.date ) <= DATE( form_encounter.date ) " . - "AND ( enc_category_map.rule_enc_id = 'enc_outpatient' )"; - $res = sqlStatement( $query, array( $patient_id ) ); - $number = sqlNumRows($res); - if ( $number >= 1 ) { - $bContinue = false; - break; - } - - // See if BMI has been recorded >=30kg/m2 6 months before, or simultanious to the encounter - // TODO AND ÒCare goal: follow-up plan BMI managementÓ OR ÒCommunication provider to provider: dietary consultation orderÓ - $query = "SELECT form_vitals.BMI " . - "FROM `form_vitals` " . - "LEFT JOIN `form_encounter` " . - "ON ( form_vitals.pid = form_encounter.pid ) " . - "LEFT JOIN `enc_category_map` " . - "ON (enc_category_map.main_cat_id = form_encounter.pc_catid) " . - "WHERE form_vitals.BMI IS NOT NULL " . - "AND form_vitals.BMI IS NOT NULL " . - "AND form_vitals.pid = ? AND form_vitals.BMI >= 30 " . - "AND ( DATE( form_vitals.date ) >= DATE_ADD( form_encounter.date, INTERVAL -6 MONTH ) ) " . - "AND ( DATE( form_vitals.date ) <= DATE( form_encounter.date ) ) " . - "AND ( enc_category_map.rule_enc_id = 'enc_outpatient' )"; - $res = sqlStatement( $query, array( $patient_id ) ); - $number = sqlNumRows($res); - if ( $number >= 1 ) { - $bContinue = false; - break; - } - - // See if BMI has been recorded <22kg/m2 6 months before, or simultanious to the encounter - // TODO AND ÒCare goal: follow-up plan BMI managementÓ OR ÒCommunication provider to provider: dietary consultation orderÓ - $query = "SELECT form_vitals.BMI " . - "FROM `form_vitals` " . - "LEFT JOIN `form_encounter` " . - "ON ( form_vitals.pid = form_encounter.pid ) " . - "LEFT JOIN `enc_category_map` " . - "ON (enc_category_map.main_cat_id = form_encounter.pc_catid) " . - "WHERE form_vitals.BMI IS NOT NULL " . - "AND form_vitals.BMI IS NOT NULL " . - "AND form_vitals.pid = ? AND form_vitals.BMI < 22 " . - "AND ( DATE( form_vitals.date ) >= DATE_ADD( form_encounter.date, INTERVAL -6 MONTH ) ) " . - "AND ( DATE( form_vitals.date ) <= DATE( form_encounter.date ) ) " . - "AND ( enc_category_map.rule_enc_id = 'enc_outpatient' )"; - $res = sqlStatement( $query, array( $patient_id ) ); - $number = sqlNumRows($res); - if ( $number >= 1 ) { - $bContinue = false; - break; - } - } while( false ); - - if ( $bContinue ) { - continue; - } - - // TODO Exclusions - // OR:ÒPatient characteristic: Terminal illnessÓ<=6 months before or simultaneously to ÒEncounter: encounter outpatientÓ; - // OR:ÒPhysical exam not done: patient reasonÓ; - // OR:ÒPhysical exam not done: medical reasonÓ; - // OR:ÒPhysical rationale physical exam not done: system reasonÓ; - if ( $this->codes->check_for_pregnancy( $patient_id, $end_measurement ) ) { - $exclude_filt++; - } - - $pass_targ++; - } - - // Calculate Percentage (use calculate_percentage() function from library/clinical_rules.php - $perc = calculate_percentage($pass_filt,$exclude_filt,$pass_targ); - - // Set results - $this->set_result($rule_id,$total_pat,$pass_filt,$exclude_filt,$pass_targ,$perc); - - // *** Population criteria 2 *** - // reset counters - $total_pat = 0; - $pass_filt = 0; - $exclude_filt = 0; - $pass_targ = 0; - $perc = 0; - foreach ( $patientData as $rowPatient ) { - $patient_id = $this->get_patient_id( $rowPatient ); - // increment total patients counter - $total_pat++; - - // filter for >= 18 and <= 64 - // utilize the convertDobtoAgeYearDecimal() function from library/clinical_rules.php - $age = convertDobtoAgeYearDecimal( $this->get_DOB( $patient_id ), $begin_measurement ); - if ( $age < 18 || $age > 65 ) continue; - - // Denominator= - // AND: ÒAll patients in the initial patient populationÓ; - // AND: >=1 count(s) of ÒEncounter: encounter outpatientÓ; - if (!( ( $this->exist_encounter($patient_id,'enc_outpatient',$begin_measurement,$end_measurement,1)) )) { - continue; - } - - $pass_filt++; - - // Flow of control loop - $bContinue = true; - do { - // See if BMI has been recorded between >=18.5kg/m2 and <25kg/m2 6 months before, or simultanious to the encounter - $query = "SELECT form_vitals.BMI " . - "FROM `form_vitals` " . - "LEFT JOIN `form_encounter` " . - "ON ( form_vitals.pid = form_encounter.pid ) " . - "LEFT JOIN `enc_category_map` " . - "ON (enc_category_map.main_cat_id = form_encounter.pc_catid) " . - "WHERE form_vitals.BMI IS NOT NULL " . - "AND form_vitals.BMI IS NOT NULL " . - "AND form_vitals.pid = ? AND form_vitals.BMI >= 18.5 AND form_vitals.BMI < 25 " . - "AND DATE( form_vitals.date ) >= DATE_ADD( form_encounter.date, INTERVAL -6 MONTH ) " . - "AND DATE( form_vitals.date ) <= DATE( form_encounter.date ) " . - "AND ( enc_category_map.rule_enc_id = 'enc_outpatient' )"; - $res = sqlStatement( $query, array( $patient_id ) ); - $number = sqlNumRows($res); - if ( $number >= 1 ) { - $bContinue = false; - break; - } - - // See if BMI has been recorded >=25kg/m2 6 months before, or simultanious to the encounter - // TODO AND ÒCare goal: follow-up plan BMI managementÓ OR ÒCommunication provider to provider: dietary consultation orderÓ - $query = "SELECT form_vitals.BMI " . - "FROM `form_vitals` " . - "LEFT JOIN `form_encounter` " . - "ON ( form_vitals.pid = form_encounter.pid ) " . - "LEFT JOIN `enc_category_map` " . - "ON (enc_category_map.main_cat_id = form_encounter.pc_catid) " . - "WHERE form_vitals.BMI IS NOT NULL " . - "AND form_vitals.BMI IS NOT NULL " . - "AND form_vitals.pid = ? AND form_vitals.BMI >= 25 " . - "AND ( DATE( form_vitals.date ) >= DATE_ADD( form_encounter.date, INTERVAL -6 MONTH ) ) " . - "AND ( DATE( form_vitals.date ) <= DATE( form_encounter.date ) ) " . - "AND ( enc_category_map.rule_enc_id = 'enc_outpatient' )"; - $res = sqlStatement( $query, array( $patient_id ) ); - $number = sqlNumRows($res); - if ( $number >= 1 ) { - $bContinue = false; - break; - } - - } while( false ); - - if ( $bContinue ) { - continue; - } - - // TODO Exclusions - // OR:ÒPatient characteristic: Terminal illnessÓ<=6 months before or simultaneously to ÒEncounter: encounter outpatientÓ; - // OR:ÒPhysical exam not done: patient reasonÓ; - // OR:ÒPhysical exam not done: medical reasonÓ; - // OR:ÒPhysical rationale physical exam not done: system reasonÓ; - if ( $this->codes->check_for_pregnancy( $patient_id, $end_measurement ) ) { - $exclude_filt++; - } - - $pass_targ++; - } - - // Calculate Percentage (use calculate_percentage() function from library/clinical_rules.php - $perc = calculate_percentage($pass_filt,$exclude_filt,$pass_targ); - - // Set results - $this->set_result($rule_id,$total_pat,$pass_filt,$exclude_filt,$pass_targ,$perc); - - } - - // Weight Assessment and Counseling for Children and Adolescents (NQF 0024) - private function rule_wt_assess_couns_child_cqm() { - $rule_id=$this->rule['id']; - $dateTarget = $this->dateTarget; - $patientData =$this->patientData; - - // Calculate measurement period - $tempDateArray = explode("-",$dateTarget); - $tempYear = $tempDateArray[0]; - $begin_measurement = $tempDateArray[0] . "-01-01 00:00:00"; - $end_measurement = $tempDateArray[0] . "-12-31 23:59:59"; - - // *** Patient Criteria 1 *** - // Collect results - $total_pat = 0; - $pass_filt = 0; - $exclude_filt = 0; - $pass_targ = array( 1 => 0, 2 => 0, 3 => 0 ); - $perc = 0; - foreach ( $patientData as $rowPatient ) { - $patient_id = $this->get_patient_id( $rowPatient ); - // increment total patients counter - $total_pat++; - - // filter for Patient characteristic: birth dateÓ (age) >=2 and <=16 years - // utilize the convertDobtoAgeYearDecimal() function from library/clinical_rules.php - $age = convertDobtoAgeYearDecimal( $this->get_DOB( $patient_id ), $begin_measurement ); - if ( $age < 2 || $age > 17 ) continue; - - // filter for 1 specified encounters - // make a function for this and wrap in the encounter titles - if ( ( !( $this->exist_encounter($patient_id,'enc_out_pcp_obgyn',$begin_measurement,$end_measurement,1) ) ) || - ( $this->codes->check_for_pregnancy( $patient_id, $end_measurement ) || - ( $this->exist_encounter($patient_id,'enc_pregnancy',$begin_measurement,$end_measurement,1) ) ) ) { - continue; - } - - $pass_filt++; - - // numerator 1: Physical exam finding: BMI percentile - if ( ( (exist_lists_item($patient_id,'medical_problem','CUSTOM::BMI',$end_measurement)) || // TODO where should this come from? - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.5',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.51',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.52',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.53',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.54',$end_measurement)) )) { - $pass_targ[1]++; - } - - // numerator 2: Communication to patient: counseling for nutrition - if ( exist_lists_item( $patient_id,'medical_problem','ICD9::V65.3',$end_measurement ) ) { // TODO where should this come from? - $pass_targ[2]++; - } - - // numerator 3: Communication to patient: counseling for physical activity - if ( exist_lists_item( $patient_id,'medical_problem','ICD9::V65.41',$end_measurement ) ) { // TODO where should this come from? - $pass_targ[3]++; - } - } - - foreach ( $pass_targ as $pass_targ_count ) { - // Calculate Percentage (use calculate_percentage() function from library/clinical_rules.php - $perc = calculate_percentage($pass_filt,$exclude_filt,$pass_targ_count); - // Set results - $this->set_result($rule_id,$total_pat,$pass_filt,$exclude_filt,$pass_targ_count,$perc); - } - - // *** Patient Criteria 2 *** - // reset counters - $total_pat = 0; - $pass_filt = 0; - $exclude_filt = 0; - $pass_targ = array( 1 => 0, 2 => 0, 3 => 0 ); - $perc = 0; - foreach ( $patientData as $rowPatient ) { - $patient_id = $this->get_patient_id( $rowPatient ); - // increment total patients counter - $total_pat++; - - // filter for Patient characteristic: birth dateÓ (age) >=2 and <=16 years - // utilize the convertDobtoAgeYearDecimal() function from library/clinical_rules.php - $age = convertDobtoAgeYearDecimal( $this->get_DOB( $patient_id ), $begin_measurement ); - if ( $age < 2 || $age > 11 ) continue; - - // filter for 1 specified encounters - // make a function for this and wrap in the encounter titles - if ( ( !( $this->exist_encounter($patient_id,'enc_out_pcp_obgyn',$begin_measurement,$end_measurement,1) ) ) || - ( $this->codes->check_for_pregnancy( $patient_id, $end_measurement ) || - ( $this->exist_encounter($patient_id,'enc_pregnancy',$begin_measurement,$end_measurement,1) ) ) ) { - continue; - } - - $pass_filt++; - - // numerator 1: Physical exam finding: BMI percentile - if ( ( (exist_lists_item($patient_id,'medical_problem','CUSTOM::BMI',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.5',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.51',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.52',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.53',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.54',$end_measurement)) )) { - $pass_targ[1]++; - } - - // numerator 2: Communication to patient: counseling for nutrition - if ( exist_lists_item( $patient_id,'medical_problem','ICD9::V65.3',$end_measurement ) ) { - $pass_targ[2]++; - } - - // numerator 3: Communication to patient: counseling for physical activity - if ( exist_lists_item( $patient_id,'medical_problem','ICD9::V65.41',$end_measurement ) ) { - $pass_targ[3]++; - } - } - - foreach ( $pass_targ as $pass_targ_count ) { - // Calculate Percentage (use calculate_percentage() function from library/clinical_rules.php - $perc = calculate_percentage($pass_filt,$exclude_filt,$pass_targ_count); - // Set results - $this->set_result($rule_id,$total_pat,$pass_filt,$exclude_filt,$pass_targ_count,$perc); - } - - // *** Patient Criteria 3 *** - // reset counters - $total_pat = 0; - $pass_filt = 0; - $exclude_filt = 0; - $pass_targ = array( 1 => 0, 2 => 0, 3 => 0 ); - $perc = 0; - foreach ( $patientData as $rowPatient ) { - $patient_id = $this->get_patient_id( $rowPatient ); - // increment total patients counter - $total_pat++; - - // filter for Patient characteristic: birth dateÓ (age) >=2 and <=16 years - // utilize the convertDobtoAgeYearDecimal() function from library/clinical_rules.php - $age = convertDobtoAgeYearDecimal( $this->get_DOB( $patient_id ), $begin_measurement ); - if ( $age < 12 || $age > 17 ) continue; - - // filter for 1 specified encounters - // make a function for this and wrap in the encounter titles - if ( ( !( $this->exist_encounter($patient_id,'enc_out_pcp_obgyn',$begin_measurement,$end_measurement,1) ) ) || - ( $this->codes->check_for_pregnancy( $patient_id, $end_measurement ) || - ( $this->exist_encounter($patient_id,'enc_pregnancy',$begin_measurement,$end_measurement,1) ) ) ) { - continue; - } - - $pass_filt++; - - // numerator 1: Physical exam finding: BMI percentile - if ( ( (exist_lists_item($patient_id,'medical_problem','CUSTOM::BMI',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.5',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.51',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.52',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.53',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::V85.54',$end_measurement)) )) { - $pass_targ[1]++; - } - - // numerator 2: Communication to patient: counseling for nutrition - if ( exist_lists_item( $patient_id,'medical_problem','ICD9::V65.3',$end_measurement ) ) { - $pass_targ[2]++; - } - - // numerator 3: Communication to patient: counseling for physical activity - if ( exist_lists_item( $patient_id,'medical_problem','ICD9::V65.41',$end_measurement ) ) { - $pass_targ[3]++; - } - } - - foreach ( $pass_targ as $pass_targ_count ) { - // Calculate Percentage (use calculate_percentage() function from library/clinical_rules.php - $perc = calculate_percentage($pass_filt,$exclude_filt,$pass_targ_count); - // Set results - $this->set_result($rule_id,$total_pat,$pass_filt,$exclude_filt,$pass_targ_count,$perc); - } - - } - - // TODO - // Influenza Immunization for Patients >= 50 Years Old (NQF 0041) (PQRI 110) - private function rule_influenza_ge_50_cqm() { - - } - - // TODO - // Childhood immunization Status (NQF 0038) - private function rule_child_immun_stat_cqm() { - $rule_id=$this->rule['id']; - $dateTarget = $this->dateTarget; - $patientData =$this->patientData; - - // Calculate measurement period - $tempDateArray = explode("-",$dateTarget); - $tempYear = $tempDateArray[0]; - $begin_measurement = $tempDateArray[0] . "-01-01 00:00:00"; - $end_measurement = $tempDateArray[0] . "-12-31 23:59:59"; - - // Collect results - $total_pat = 0; - $pass_filt = 0; - $exclude_filt = 0; - $pass_targ = array( 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 0, 11 => 0, 12 => 0 ); - $perc = 0; - foreach ( $patientData as $rowPatient ) { - $patient_id = $this->get_patient_id( $rowPatient ); - // increment total patients counter - $total_pat++; - - // filter for ÒPatient characteristic: birth dateÓ (age) >=1 year and <2 years - // utilize the convertDobtoAgeYearDecimal() function from library/clinical_rules.php - $age = convertDobtoAgeYearDecimal( $this->get_DOB( $patient_id ), $begin_measurement ); - if ( $age >= 2 || $age < 1 ) continue; - - if ( ( !( $this->exist_encounter($patient_id,'enc_out_pcp_obgyn',$begin_measurement,$end_measurement,1) ) ) ) { - continue; - } - - $pass_filt++; - - // Numerator 1 - $query = "SELECT immunizations.administered_date, immunizations.patient_id, immunizations.immunization_id, list_options.title, patient_data.pid, patient_data.DOB " . - "FROM immunizations " . - "LEFT JOIN list_options " . - "ON immunizations.immunization_id = list_options.option_id AND list_id = immunizations" . - "LEFT JOIN patient_data " . - "ON immunizations.patient_id = patient_data.pid " . - "WHERE immunizations.patient_id = ? " . - "AND ( list_options.option_id = 1 ". // Check for DTap list option ids (1-5) - "OR list_options.option_id = 2 ". - "OR list_options.option_id = 3 ". - "OR list_options.option_id = 4 ". - "OR list_options.option_id = 5 ) " . - "AND DATE( immunizations.administered_date ) >= DATE_ADD( patient_data.DOB, INTERVAL 42 DAY ) " . - "AND DATE( immunizations.administered_date ) < DATE_ADD( patient_data.DOB, INTERVAL 2 YEAR ) "; - - $result = sqlStatement( $query, array( $patient_id ) ); - if ( count( $result ) >= 4 && - !( $this->codes->check_for_dtap_allergy( $patient_id, $end_measurement ) ) && - !( exist_lists_item( $patient_id, 'medical_problem', 'ICD9::323.51', $end_measurement ) ) && - !( $this->codes->check_for_progressive_neurological_disorder( $patient_id, $end_measurement ) ) ) { - $pass_targ[1]++; - } - - // Numerator 2 - $query = "SELECT immunizations.administered_date, immunizations.patient_id, immunizations.immunization_id, list_options.title, patient_data.pid, patient_data.DOB " . - "FROM immunizations " . - "LEFT JOIN list_options " . - "ON immunizations.immunization_id = list_options.option_id AND list_id = immunizations" . - "LEFT JOIN patient_data " . - "ON immunizations.patient_id = patient_data.pid " . - "WHERE immunizations.patient_id = ? " . - "AND ( list_options.option_id = 13 ". // Check for IPV list option ids (11-14) - "OR list_options.option_id = 11 ". - "OR list_options.option_id = 12 ". - "OR list_options.option_id = 14 ". - "AND DATE( immunizations.administered_date ) >= DATE_ADD( patient_data.DOB, INTERVAL 42 DAY ) " . - "AND DATE( immunizations.administered_date ) < DATE_ADD( patient_data.DOB, INTERVAL 2 YEAR ) "; - - $result = sqlStatement( $query, array( $patient_id ) ); - if ( count( $result ) >= 3 && - !( $this->codes->check_for_ipv_allergy( $patient_id, $end_measurement ) ) && - !( $this->codes->check_for_neomycin_allergy( $patient_id, $end_measurement ) ) && - !( $this->codes->check_for_streptomycin_allergy( $patient_id, $end_measurement ) ) && - !( $this->codes->check_for_polymyxin_allergy( $patient_id, $end_measurement ) ) ) { - $pass_targ[2]++; - } - } - - // Numerator 3 - - // Numerator 4 - $query = "SELECT immunizations.administered_date, immunizations.patient_id, immunizations.immunization_id, list_options.title, patient_data.pid, patient_data.DOB " . - "FROM immunizations " . - "LEFT JOIN list_options " . - "ON immunizations.immunization_id = list_options.option_id AND list_id = immunizations" . - "LEFT JOIN patient_data " . - "ON immunizations.patient_id = patient_data.pid " . - "WHERE immunizations.patient_id = ? " . - "AND ( list_options.option_id = 80 ". // Check for HiB list option ids - "OR list_options.option_id = 85 ". - "OR list_options.option_id = 90 ". - "AND DATE( immunizations.administered_date ) >= DATE_ADD( patient_data.DOB, INTERVAL 42 DAY ) " . - "AND DATE( immunizations.administered_date ) < DATE_ADD( patient_data.DOB, INTERVAL 2 YEAR ) "; - - $result = sqlStatement( $query, array( $patient_id ) ); - if ( count( $result ) >= 2 && - !( $this->codes->check_for_hib_allergy( $patient_id, $end_measurement ) ) ) { - $pass_targ[4]++; - } - - foreach ( $pass_targ as $pass_targ_count ) { - // Calculate Percentage (use calculate_percentage() function from library/clinical_rules.php - $perc = calculate_percentage($pass_filt,$exclude_filt,$pass_targ_count); - // Set results - $this->set_result($rule_id,$total_pat,$pass_filt,$exclude_filt,$pass_targ_count,$perc); - } - } - - // TODO - // Pneumonia Vaccination Status for Older Adults (NQF 0043) (PQRI 111) - private function rule_pneumovacc_ge_65_cqm() { - - } - - // TODO - // Diabetes: Eye Exam (NQF 0055) (PQRI 117) - private function rule_dm_eye_cqm() { - - } - - // TODO - // Diabetes: Foot Exam (NQF 0056) (PQRI 163) - private function rule_dm_foot_cqm() { - - } - - // TODO - // Diabetes: Blood Pressure Management (NQF 0061) (PQRI 3) - private function rule_dm_bp_control_cqm() { - - } - - // Diabetes: HbA1c Poor Control (NQF 0059) (PQRI 1) - private function rule_dm_a1c_cqm() { - $rule_id=$this->rule['id']; - $dateTarget = $this->dateTarget; - $patientData =$this->patientData; - - // Calculate measurement period - $tempDateArray = explode("-",$dateTarget); - $tempYear = $tempDateArray[0]; - $begin_measurement = $tempDateArray[0] . "-01-01 00:00:00"; - $end_measurement = $tempDateArray[0] . "-12-31 23:59:59"; - - // Collect results - $total_pat = 0; - $pass_filt = 0; - $exclude_filt = 0; - $pass_targ = 0; - $perc = 0; - foreach ( $patientData as $rowPatient ) { - // increment total patients counter - $total_pat++; - - // get patient id - $patient_id = $this->get_patient_id($rowPatient); - - // filter for age less than 18 AND greater than 75 - // utilize the convertDobtoAgeYearDecimal() function from library/clinical_rules.php - if ( (convertDobtoAgeYearDecimal( $this->get_DOB($patient_id), $begin_measurement ) < 18) || - (convertDobtoAgeYearDecimal( $this->get_DOB($patient_id), $begin_measurement ) > 75) ) { - continue; - } - - // filter for diagnosis of Diabetes - // utlize the exist_lists_item() function from library/clinical_rules.php - if (!( (exist_lists_item($patient_id,'medical_problem','CUSTOM::diabetes',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.0',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.00',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.02',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.03',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.10',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.11',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.13',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.20',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.21',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.22',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.23',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.30',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.31',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.32',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.33',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.40',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.41',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.42',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.43',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.50',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.51',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.52',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.53',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.60',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.61',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.62',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.31',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.7',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.70',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.71',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.72',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.73',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.80',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.81',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.82',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.83',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.9',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.90',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.91',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.92',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::250.93',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::357.2',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::362.0',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::362.01',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::362.02',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::362.03',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::362.04',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::362.05',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::362.05',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::366.41',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::648.0',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::648.00',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::648.01',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::648.02',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::648.03',$end_measurement)) || - (exist_lists_item($patient_id,'medical_problem','ICD9::648.04',$end_measurement)) )) { - continue; - } - - // Filter has been passed - $pass_filt++; - - // collect specific items that fulfill request(Hemoglobin A1C >9.0%) - $proc_code = "CPT4:83036";// CPT Code for Hemoglobin A1C - $sql = sqlStatement("SELECT procedure_result.result " . - "FROM `procedure_type`, " . - "`procedure_order`, " . - "`procedure_report`, " . - "`procedure_result` " . - "WHERE procedure_type.procedure_type_id = procedure_order.procedure_type_id " . - "AND procedure_order.procedure_order_id = procedure_report.procedure_order_id " . - "AND procedure_report.procedure_report_id = procedure_result.procedure_report_id " . - "AND procedure_type.standard_code = ? " . - "AND procedure_result.result <= 9 " . - "AND procedure_order.patient_id = ? ", array($proc_code,$patient_id) ); - $number = sqlNumRows($sql); - if ($number < 1) continue; - - - error_log("passed target",0); - - // Target has been passed - $pass_targ++; - } - - // Calculate Percentage (use calculate_percentage() function from library/clinical_rules.php - $perc = calculate_percentage($pass_filt,$exclude_filt,$pass_targ); - - // Set results - $this->set_result($rule_id,$total_pat,$pass_filt,$exclude_filt,$pass_targ,$perc); - } - - // TODO - // Diabetes: LDL Management & Control (NQF 0064) (PQRI 2) - private function rule_dm_ldl_cqm() { - - } - - // TODO - // Maintain an up-to-date problem list of current and active diagnoses. - // 170.302(c) - private function problem_list_amc() { - - } - - // TODO - // Maintain active medication list. - // 170.302(d) - private function med_list_amc() { - - } - - // TODO - // Maintain active medication allergy list. - // 170.302(e) - private function med_allergy_list_amc() { - - } - - // TODO - // Record and chart changes in vital signs. - // 170.302(f) - private function record_vitals_amc() { - - } - - // TODO - // Record smoking status for patients 13 years old or older. - // 170.302(g) - private function record_smoke_amc() { - - } - - // TODO - // Incorporate clinical lab-test results into certified EHR technology as structured data. - // 170.302(h) - private function lab_result_amc() { - - } - - // TODO - // The EP, eligible hospital or CAH who receives a patient from another setting of care or provider of care or believes an encounter is relevant should perform medication reconciliation. - // 170.302(j) - private function med_reconc_amc() { - - } - - // TODO - // Use certified EHR technology to identify patient-specific education resources and provide those resources to the patient if appropriate. - // 170.302(m) - private function patient_edu_amc() { - - } - - // TODO - // Use CPOE for medication orders directly entered by any licensed healthcare professional who can enter orders into the medical record per state, local and professional guidelines. - // 170.304(a) - private function cpoe_med_amc() { - - } - - // TODO - // Generate and transmit permissible prescriptions electronically. - // 170.304(b) - private function e_prescribe_amc() { - - } - - // TODO - // Record demographics. - // 170.304(c) - private function record_dem_amc() { - - } - - // TODO - // Send reminders to patients per patient preference for preventive/follow up care. - // 170.304(d) - private function send_reminder_amc() { - - } - - // TODO - // Provide patients with an electronic copy of their health information (including diagnostic test results, problem list, medication lists, medication allergies), upon request. - // 170.304(f) - private function provide_rec_pat_amc() { - - } - - // TODO - // Provide patients with timely electronic access to their health information (including lab results, problem list, medication lists, medication allergies) within four business days of the information being available to the EP. - // 170.304(g) - private function timely_access_amc() { - - } - - // TODO - // Provide clinical summaries for patients for each office visit. - // 170.304(h) - private function provide_sum_pat_amc() { - - } - - // TODO - // The EP, eligible hospital or CAH who transitions their patient to another setting of care or provider of care or refers their patient to another provider of care should provide summary of care record for each transition of care or referral. - // 170.304(i) - private function send_sum_amc() { - - } - -} -?> - -- 2.11.4.GIT