function smarty_function_amcCollect($params, &$smarty)
{
    $amc_id = $params['amc_id'];
    $patient_id = $params['patient_id'];
    $object_category = $params['object_category'];
    $object_id = $params['object_id'];
    $returnArray = amcCollect($amc_id, $patient_id, $object_category, $object_id);
    $smarty->assign('amcCollectReturn', $returnArray);
}
Example #2
0
 public function test(AmcPatient $patient, $beginDate, $endDate)
 {
     // The number of prescriptions in the denominator transmitted electronically.
     $amcElement = amcCollect('e_prescribe_amc', $patient->id, 'prescriptions', $patient->object['id']);
     if (!empty($amcElement)) {
         return true;
     } else {
         return false;
     }
 }
Example #3
0
 public function test(AmcPatient $patient, $beginDate, $endDate)
 {
     //The number of prescriptions in the denominator generated, queried for a drug formulary and transmitted electronically
     $eprescribe = amcCollect('e_prescribe_amc', $patient->id, 'prescriptions', $patient->object['id']);
     $checkformulary = amcCollect('e_prescribe_chk_formulary_amc', $patient->id, 'prescriptions', $patient->object['id']);
     if (!empty($eprescribe) && !empty($checkformulary)) {
         return true;
     } else {
         return false;
     }
 }
Example #4
0
 public function test(AmcPatient $patient, $beginDate, $endDate)
 {
     // Needs a summary send to place of referral.
     //  (so basically an amc element needs to exist)
     $amcElement = amcCollect('send_sum_amc', $patient->id, 'transactions', $patient->object['id']);
     if (!empty($amcElement)) {
         return true;
     } else {
         return false;
     }
 }
Example #5
0
 public function test(AmcPatient $patient, $beginDate, $endDate)
 {
     // Need a prescription escribed.
     //  (so basically an amc element needs to exist)
     $amcElement = amcCollect('e_prescribe_amc', $patient->id, 'prescriptions', $patient->object['id']);
     if (!empty($amcElement)) {
         return true;
     } else {
         return false;
     }
 }
Example #6
0
 public function test(AmcPatient $patient, $beginDate, $endDate)
 {
     //The number of transitions of care and referrals in the denominator where a summary of care record was provided.
     //  (so basically an amc element needs to exist)
     $amcElement = amcCollect('send_sum_amc', $patient->id, 'transactions', $patient->object['id']);
     if (!empty($amcElement)) {
         return true;
     } else {
         return false;
     }
 }
Example #7
0
 public function test(AmcPatient $patient, $beginDate, $endDate)
 {
     //The number of transitions of care and referrals in the denominator where a summary of care record was electronically transmitted using CEHRT to a recipient.
     //  (so basically both amc elements of send_sum_amc and send_sum_elec_amc needs to exist)
     $amcElement = amcCollect('send_sum_amc', $patient->id, 'transactions', $patient->object['id']);
     $amcElement_elec = amcCollect('send_sum_elec_amc', $patient->id, 'transactions', $patient->object['id']);
     if (!empty($amcElement) && !empty($amcElement_elec)) {
         return true;
     } else {
         return false;
     }
 }
Example #8
0
 public function test(AmcPatient $patient, $beginDate, $endDate)
 {
     // Need patient summary given/sent to patient within 3 business days of each encounter.
     $amcElement = amcCollect('provide_sum_pat_amc', $patient->id, 'form_encounter', $patient->object['encounter']);
     if (!empty($amcElement)) {
         $daysDifference = businessDaysDifference(date("Y-m-d", strtotime($patient->object['date'])), date("Y-m-d", strtotime($amcElement['date_completed'])));
         if ($daysDifference < 4) {
             return true;
         }
     }
     return false;
 }
Example #9
0
 public function test(AmcPatient $patient, $beginDate, $endDate)
 {
     //The number of office visits in the denominator where the patient or a patient authorized Representative is provided a clinical summary of their visit within 1 Business day.
     $amcElement = amcCollect('provide_sum_pat_amc', $patient->id, 'form_encounter', $patient->object['encounter']);
     if (!empty($amcElement)) {
         $daysDifference = businessDaysDifference(date("Y-m-d", strtotime($patient->object['date'])), date("Y-m-d", strtotime($amcElement['date_completed'])));
         if ($daysDifference < 2) {
             return true;
         }
     }
     return false;
 }
Example #10
0
 public function test(AmcPatient $patient, $beginDate, $endDate)
 {
     // Check if prescription is for a controlled substance
     $controlledSubstanceCheck = amcCollect('e_prescribe_cont_subst_amc', $patient->id, 'prescriptions', $patient->object['id']);
     // Exclude controlled substances
     if (empty($controlledSubstanceCheck)) {
         // Not a controlled substance, so include in denominator.
         return true;
     } else {
         // Is a controlled substance, so exclude from denominator.
         return false;
     }
 }
Example #11
0
 public function test(AmcPatient $patient, $beginDate, $endDate)
 {
     //The number of transitions of care and referrals in the denominator where a summary of care record was provided.
     //  (so basically an amc element needs to exist)
     $amcElement = amcCollect('send_sum_amc', $patient->id, 'transactions', $patient->object['id']);
     if (!empty($amcElement)) {
         $no_problems = sqlQuery("select count(*) as cnt from lists_touch where pid = ? and type = 'medical_problem'", array($patient->id));
         $problems = sqlQuery("select count(*) as cnt from lists where pid = ? and type = 'medical_problem'", array($patient->id));
         $no_allergy = sqlQuery("select count(*) as cnt from lists_touch where pid = ? and type = 'allergy'", array($patient->id));
         $allergies = sqlQuery("select count(*) as cnt from lists where pid = ? and type = 'allergy'", array($patient->id));
         $no_medication = sqlQuery("select count(*) as cnt from lists_touch where pid = ? and type = 'medication'", array($patient->id));
         $medications = sqlQuery("select count(*) as cnt from lists where pid = ? and type = 'medication'", array($patient->id));
         $prescriptions = sqlQuery("select count(*) as cnt from prescriptions where patient_id = ? ", array($patient->id));
         if (($no_problems['cnt'] > 0 || $problems['cnt'] > 0) && ($no_allergy['cnt'] > 0 || $allergies['cnt'] > 0) && ($no_medication['cnt'] > 0 || $medications['cnt'] > 0 || $prescriptions['cnt'] > 0)) {
             return true;
         }
         return false;
     } else {
         return false;
     }
 }
Example #12
0
 public function test(AmcPatient $patient, $beginDate, $endDate)
 {
     //The number of transitions of care and referrals in the denominator where a summary of care record was electronically transmitted using CEHRT to a recipient.
     //  (so basically both amc elements of send_sum_amc and send_sum_elec_amc needs to exist)
     $amcElement_elec = amcCollect('send_sum_elec_amc', $patient->id, 'transactions', $patient->object['id']);
     $amc_elec_check = sqlQuery('select count(*) as cnt from ccda where pid = ? and emr_transfer = 1', array($patient->id));
     if (!(empty($amcElement_elec) || $amc_elec_check['cnt'] > 0)) {
         $no_problems = sqlQuery("select count(*) as cnt from lists_touch where pid = ? and type = 'medical_problem'", array($patient->id));
         $problems = sqlQuery("select count(*) as cnt from lists where pid = ? and type = 'medical_problem'", array($patient->id));
         $no_allergy = sqlQuery("select count(*) as cnt from lists_touch where pid = ? and type = 'allergy'", array($patient->id));
         $allergies = sqlQuery("select count(*) as cnt from lists where pid = ? and type = 'allergy'", array($patient->id));
         $no_medication = sqlQuery("select count(*) as cnt from lists_touch where pid = ? and type = 'medication'", array($patient->id));
         $medications = sqlQuery("select count(*) as cnt from lists where pid = ? and type = 'medication'", array($patient->id));
         $prescriptions = sqlQuery("select count(*) as cnt from prescriptions where patient_id = ? ", array($patient->id));
         if (($no_problems['cnt'] > 0 || $problems['cnt'] > 0) && ($no_allergy['cnt'] > 0 || $allergies['cnt'] > 0) && ($no_medication['cnt'] > 0 || $medications['cnt'] > 0 || $prescriptions['cnt'] > 0)) {
             return true;
         }
         return false;
     } else {
         return false;
     }
 }
Example #13
0
        ?>
                <input type="checkbox" id="provide_sum_pat_flag">
            <?php 
    }
    ?>
            </td>
            <td>
            <span class="text"><?php 
    echo xl('Provided Clinical Summary?');
    ?>
</span>
            </td>
            </tr>
            <?php 
    // Display the medication reconciliation checkboxes (AMC prompting)
    $itemAMC = amcCollect("med_reconc_amc", $pid, 'form_encounter', $encounter);
    ?>
            <?php 
    if (!empty($itemAMC)) {
        ?>
                <tr>
                <td>
                <input type="checkbox" id="trans_trand_care" checked>
                </td>
                <td>
                <span class="text"><?php 
        echo xl('Transition/Transfer of Care?');
        ?>
</span>
                </td>
                </tr>
Example #14
0
function amcTrackingRequest($amc_id, $start = '', $end = '', $provider_id = '')
{
    # Collect the patient list first (from the provider)
    $patients = array();
    if (empty($provider)) {
        // Look at entire practice
        $rez = sqlStatement("SELECT `pid`, `fname`, `lname` FROM `patient_data`");
        for ($iter = 0; $row = sqlFetchArray($rez); $iter++) {
            $patients[$iter] = $row;
        }
    } else {
        // Look at one provider
        $rez = sqlStatement("SELECT `pid`, `fname`, `lname` FROM `patient_data` " . "WHERE providerID=?", array($provider));
        for ($iter = 0; $row = sqlFetchArray($rez); $iter++) {
            $patients[$iter] = $row;
        }
    }
    $results = array();
    foreach ($patients as $patient) {
        $tempResults = array();
        if ($amc_id == "send_sum_amc") {
            $sqlBindArray = array();
            array_push($sqlBindArray, $patient['pid']);
            if (!empty($start)) {
                $where = " AND `date`>=? ";
                array_push($sqlBindArray, $start);
            }
            if (!empty($end)) {
                $where .= " AND `date`<=? ";
                array_push($sqlBindArray, $end);
            }
            $rez = sqlStatement("SELECT `id`, `date` FROM `transactions` WHERE `title`='Referral' AND `pid`=? {$where} ORDER BY `date` DESC", $sqlBindArray);
            while ($res = sqlFetchArray($rez)) {
                $amcCheck = amcCollect("send_sum_amc", $patient['pid'], "transactions", $res['id']);
                if (empty($amcCheck)) {
                    // Records have not been sent, so send this back
                    array_push($tempResults, array("pid" => $patient['pid'], "fname" => $patient['fname'], "lname" => $patient['lname'], "date" => $res['date'], "id" => $res['id']));
                }
            }
        } else {
            if ($amc_id == "provide_rec_pat_amc") {
                $sqlBindArray = array();
                array_push($sqlBindArray, $patient['pid']);
                if (!empty($start)) {
                    $where = " AND `date_created`>=? ";
                    array_push($sqlBindArray, $start);
                }
                if (!empty($end)) {
                    $where .= " AND `date_created`<=? ";
                    array_push($sqlBindArray, $end);
                }
                $rez = sqlStatement("SELECT * FROM `amc_misc_data` WHERE `amc_id`='provide_rec_pat_amc' AND `pid`=? AND (`date_completed` IS NULL OR `date_completed`='') {$where} ORDER BY `date_created` DESC", $sqlBindArray);
                while ($res = sqlFetchArray($rez)) {
                    // Records have not been sent, so send this back
                    array_push($tempResults, array("pid" => $patient['pid'], "fname" => $patient['fname'], "lname" => $patient['lname'], "date" => $res['date_created']));
                }
            } else {
                if ($amc_id == "provide_sum_pat_amc") {
                    $sqlBindArray = array();
                    array_push($sqlBindArray, $patient['pid']);
                    if (!empty($start)) {
                        $where = " AND `date`>=? ";
                        array_push($sqlBindArray, $start);
                    }
                    if (!empty($end)) {
                        $where .= " AND `date`<=? ";
                        array_push($sqlBindArray, $end);
                    }
                    $rez = sqlStatement("SELECT `encounter`, `date` FROM `form_encounter` WHERE `pid`=? {$where} ORDER BY `date` DESC", $sqlBindArray);
                    while ($res = sqlFetchArray($rez)) {
                        $amcCheck = amcCollect("provide_sum_pat_amc", $patient['pid'], "form_encounter", $res['encounter']);
                        if (empty($amcCheck)) {
                            // Records have not been given, so send this back
                            array_push($tempResults, array("pid" => $patient['pid'], "fname" => $patient['fname'], "lname" => $patient['lname'], "date" => $res['date'], "id" => $res['encounter']));
                        }
                    }
                } else {
                    // report nothing
                    return;
                }
            }
        }
        // process results
        $results = array_merge($results, $tempResults);
    }
    // send results
    return $results;
}
Example #15
0
	<?php 
echo generate_select_list('title', 'transactions', $form_id, '', '', '', 'titleChanged()');
?>
        </td></tr>
	</table>

<div id='referdiv'>

    <?php 
if ($GLOBALS['enable_amc_prompting'] && 'LBTref' == $form_id) {
    ?>
        <div style='float:right;margin-right:25px;border-style:solid;border-width:1px;'>
            <div style='float:left;margin:5px 5px 5px 5px;'>
                <?php 
    // Display the send records checkbox (AMC prompting)
    $itemAMC = amcCollect("send_sum_amc", $pid, 'transactions', $transid);
    ?>
                <?php 
    if (!empty($itemAMC)) {
        ?>
                    <input type="checkbox" id="send_sum_flag" name="send_sum_flag" checked>
                <?php 
    } else {
        ?>
                    <input type="checkbox" id="send_sum_flag" name="send_sum_flag">
                <?php 
    }
    ?>
                <span class="text"><?php 
    echo xl('Sent Medical Records?');
    ?>