Description AMC

From OpenEMR Project Wiki
Revision as of 09:21, 6 October 2011 by Bradymiller (talk | contribs)

Patient(s) selection

The first thing that is done is the selection of patients if a physician is chosen for the calculations.

  • Pertinent code from the library/clinical_rules.php file (test_rules_clinic() function)
  // Collect all patient ids
  $patientData = array();
  if (!empty($patient_id)) {
    // only look at the selected patient
    $patientData[0]['pid'] = $patient_id;
  }
  else {
    if (empty($provider)) {
      // Look at entire practice
      $rez = sqlStatement("SELECT `pid` FROM `patient_data`");
      for($iter=0; $row=sqlFetchArray($rez); $iter++) {
       $patientData[$iter]=$row;
      } 
    }
    else {
      // Look at one provider
      $rez = sqlStatement("SELECT `pid` FROM `patient_data` " .
        "WHERE providerID=?", array($provider) );
      for($iter=0; $row=sqlFetchArray($rez); $iter++) {
       $patientData[$iter]=$row;
      }
    }
  }