예제 #1
0
파일: Fees.php 프로젝트: igez/gaiaehr
 /**
  * Function: getPaymentsBySearch
  */
 public function getPaymentsBySearch(stdClass $params)
 {
     $patientPayments = array();
     $whereClause = '';
     // Look between date the payment was created
     if (isset($params->datefrom) && isset($params->dateto)) {
         $whereClause .= chr(13) . " AND date_created BETWEEN '" . substr($params->datefrom, 0, -9) . " 00:00:00' AND '" . substr($params->dateto, 0, -9) . " 23:00:00'";
     }
     // Look for the Paying Entity
     if (isset($params->payingEntityCombo)) {
         $whereClause .= chr(13) . " AND paying_entity = '" . $params->payingEntityCombo . "'";
     }
     // Look for the Patient
     if (isset($params->patientSearch)) {
         $whereClause .= chr(13) . " AND paying_entity = '" . $params->payingEntityCombo . "'";
     }
     // If the whereClause variable is used go ahead and
     // and add the where command.
     if ($whereClause != '') {
         $whereClause = 'WHERE ' . $whereClause;
     }
     $sql = "SELECT\n\t\t\t\t\tpatient.fname,\n\t\t\t\t\tpatient.mname,\n\t\t\t\t\tpatient.lname,\n\t\t\t\t\tpatient.pid,\n\t\t\t\t\tpayments.dtime,\n\t\t\t\t\tpayments.encounter,\n\t\t\t\t\tpayments.user,\n\t\t\t\t\tpayments.method,\n\t\t\t\t\tpayments.source,\n\t\t\t\t\tpayments.amount1,\n\t\t\t\t\tpayments.amount2,\n\t\t\t\t\tpayments.posted1,\n\t\t\t\t\tpayments.posted2\n\t\t\t\tFROM\n\t\t\t\t\tpayments\n\t\t\t\tINNER JOIN\n\t\t\t\t\tpatient\n\t\t\t\tON\n\t\t\t\t\tpatient.pid = payments.pid\n\t\t\t\t{$whereClause}";
     $this->db->setSQL($sql);
     // Loop through the results.
     // in here you can do calculations or other stuff.
     foreach ($this->db->fetchRecords(PDO::FETCH_ASSOC) as $row) {
         $patientPayments[] = $row;
     }
     $total = count($patientPayments);
     // Return the results back to ExtJS.
     return array('totals' => $total, 'rows' => $patientPayments);
 }
예제 #2
0
파일: Medical.php 프로젝트: igez/gaiaehr
 public function getLabsLiveSearch(stdClass $params)
 {
     $this->db->setSQL("SELECT id,\n\t\t\t\t\t\t\t\t  parent_loinc,\n\t\t\t\t\t\t\t\t  loinc_number,\n\t\t\t\t\t\t\t\t  loinc_name\n\t\t\t\t\t\t\tFROM  labs_panels\n\t\t\t\t\t\t\tWHERE parent_loinc <> loinc_number\n\t\t\t\t\t\t\t  AND loinc_name      LIKE'{$params->query}%'");
     $records = $this->db->fetchRecords(PDO::FETCH_ASSOC);
     $total = count($records);
     $records = array_slice($records, $params->start, $params->limit);
     return array('totals' => $total, 'rows' => $records);
 }
예제 #3
0
 public function removeAllowBlank($table)
 {
     $this->db->setSQL("Select `id`, `options` FROM {$table}");
     foreach ($this->db->fetchRecords(PDO::FETCH_ASSOC) as $row) {
         $options = json_decode($row['options'], true);
         if (isset($options['allowBlank'])) {
             unset($options['allowBlank']);
             $id = $row['id'];
             $data['options'] = json_encode($options);
             $this->db->setSQL($this->db->sqlBind($data, $table, 'U', array('id' => $id)));
             $this->db->execOnly();
         }
     }
 }
예제 #4
0
 public function getPreventiveCareDismissedAlertsByPid(stdClass $params)
 {
     $this->db->setSQL("SELECT pcig.id,\n                                  pcig.preventive_care_id,\n                                  pcig.reason,\n                                  pcig.dismiss,\n                                  pcig.date,\n                                  pcig.observation,\n                                  pcg.description\n                           FROM preventive_care_inactive_patient AS pcig\n                           LEFT JOIN preventive_care_guidelines  AS pcg ON pcig.preventive_care_id = pcg.id\n                           WHERE pcig.pid = '{$params->pid}'\n                           AND  pcig.dismiss = 1");
     return $this->db->fetchRecords();
 }
예제 #5
0
 /**
  * @return array
  */
 public function getCptUsedByClinic()
 {
     $this->db->setSQL("SELECT DISTINCT cpt.code, cpt.code_text, cpt.code_text_medium, cpt.code_text_short\n                             FROM encounter_services AS ecc\n                        LEFT JOIN cpt_codes AS cpt ON ecc.code = cpt.code\n                         ORDER BY cpt.code DESC");
     $records = $this->db->fetchRecords(PDO::FETCH_ASSOC);
     return ['totals' => count($records), 'rows' => $records];
 }