Exemple #1
0
 public function getCCDAComponents($type)
 {
     $components = array();
     $query = "select * from ccda_components where ccda_type = ?";
     $appTable = new ApplicationTable();
     $result = $appTable->zQuery($query, array($type));
     foreach ($result as $row) {
         $components[$row['ccda_components_field']] = $row['ccda_components_name'];
     }
     return $components;
 }
 /**
  * @param array $parameters
  * @return array
  */
 public function getPatients(array $parameters)
 {
     //You can use this function to write whatever rules that you need from the DB
     //$sql="SELECT * FROM patient_data WHERE fname like ".$parameters['fname']." OR lname like ".$parameters['lname'] ." OR DOB like ".$parameters['DOB'];
     $obj = new ApplicationTable();
     $sql = " SELECT * FROM patient_data WHERE fname like  ? OR lname like ? OR DOB like ?  OR pubpid = ?";
     $params = array($parameters['fname'], $parameters['lname'], $parameters['DOB'], isset($parameters['pubpid']) ? $parameters['pubpid'] : '');
     $rowset = $obj->zQuery($sql, $params);
     $results = array();
     foreach ($rowset as $row) {
         $results[] = $row;
     }
     return $results;
 }
 public function getRefferals($pid, $encounter)
 {
     $appTable = new ApplicationTable();
     $referrals = '';
     $query = "SELECT field_value FROM transactions JOIN lbt_data ON form_id=id AND field_id = 'body' WHERE pid = ?";
     $result = $appTable->zQuery($query, array($pid));
     $referrals = '<referral_reason>';
     foreach ($result as $row) {
         $referrals .= '<text>' . htmlspecialchars($row['field_value']) . '</text>';
     }
     $referrals .= '</referral_reason>';
     return $referrals;
 }
Exemple #4
0
 public function update_document_table($document_id, $audit_master_id, $audit_master_approval_status)
 {
     $appTable = new ApplicationTable();
     $query = "UPDATE documents \n              SET audit_master_id = ?,\n                  imported = ?,\n                  audit_master_approval_status=? \n              WHERE id = ?";
     $appTable->zQuery($query, array($audit_master_id, 1, $audit_master_approval_status, $document_id));
 }
Exemple #5
0
 public function update_imported($document_id)
 {
     $appTable = new ApplicationTable();
     $appTable->zQuery("UPDATE documents SET imported = 1 WHERE id = ?", array($document_id));
 }
 public function getRefferals($pid, $encounter)
 {
     $appTable = new ApplicationTable();
     $referrals = '';
     $query = "SELECT body FROM transactions WHERE pid = ?";
     $result = $appTable->zQuery($query, array($pid));
     $referrals = '<referral_reason>';
     foreach ($result as $row) {
         $referrals .= '<text>' . htmlspecialchars($row['body']) . '</text>';
     }
     $referrals .= '</referral_reason>';
     return $referrals;
 }
 public function getList($list_id, $selected = '', $opt = '')
 {
     $appTable = new ApplicationTable();
     $this->listenerObject = new Listener();
     $res = $appTable->zQuery("SELECT * FROM list_options WHERE list_id=? ORDER BY seq, title", array($list_id));
     $i = 0;
     if ($opt == 'search') {
         $rows[$i] = array('value' => 'all', 'label' => $this->listenerObject->z_xlt('All'), 'selected' => TRUE);
         $i++;
     } elseif ($opt == '') {
         $rows[$i] = array('value' => '', 'label' => $this->listenerObject->z_xlt('Unassigned'), 'disabled' => FALSE);
         $i++;
     }
     foreach ($res as $row) {
         $sel = $row['option_id'] == $selected ? TRUE : FALSE;
         $rows[$i] = array('value' => htmlspecialchars($row['option_id'], ENT_QUOTES), 'label' => $this->listenerObject->z_xlt($row['title']), 'selected' => $sel);
         $i++;
     }
     return $rows;
 }
Exemple #8
0
 public function fetchXmlDocuments()
 {
     $obj = new ApplicationTable();
     $query = "SELECT doc.id \n\t    FROM categories_to_documents AS cat_doc\n\t    JOIN documents AS doc ON doc.imported = 0 AND doc.id = cat_doc.document_id AND doc.mimetype = 'text/xml'\n\t    WHERE cat_doc.category_id = 1";
     $result = $obj->zQuery($query);
     $count = 0;
     $module = array();
     foreach ($result as $row) {
         $content = \Documents\Plugin\Documents::getDocument($row['id']);
         $module[$count]['doc_id'] = $row['id'];
         if (preg_match("/<ClinicalDocument/", $content)) {
             if (preg_match("/2.16.840.1.113883.3.88.11.32.1/", $content)) {
                 $module[$count]['doc_type'] = 'CCD';
             } else {
                 $module[$count]['doc_type'] = 'CCDA';
             }
         } elseif (preg_match("/<ccr:ContinuityOfCareRecord/", $content)) {
             $module[$count]['doc_type'] = 'CCR';
         }
         $count++;
     }
     return $module;
 }
Exemple #9
0
 /**
  * deleteDocument - remove document from list
  * @param Int $docid
  */
 public function deleteDocument($docid)
 {
     $obj = new ApplicationTable();
     $sql = "UPDATE \n           `documents` \n           SET\n          `activity` = ? \n          WHERE `id` = ?";
     $obj->zQuery($sql, array(0, $docid));
 }
 public function getListtitle($listId, $listOptionId)
 {
     $appTable = new ApplicationTable();
     $sql = "SELECT title FROM list_options WHERE list_id = ? AND option_id = ? ";
     $result = $appTable->zQuery($sql, array($listId, $listOptionId));
     $row = $result->current();
     $return = xl_list_label($row['title']);
     return $return;
 }
Exemple #11
0
 public function updateExistingMappedFields($values)
 {
     $appTable = new ApplicationTable();
     $res = $appTable->zQuery("update ccda_table_mapping set deleted = 1 where id <= ? and user_id = ?", $values);
 }
 /**
  *Update document category using category name
  *@param $category_name - Name of the category to which the document has to be moved
  *@param $document_id - Documents whose category has to be updated with $category_name
  */
 public function updateDocumentCategoryUsingCatname($category_name, $document_id)
 {
     $obj = new ApplicationTable();
     $sql = "UPDATE categories_to_documents \n            JOIN categories ON `name` = ?\n            SET category_id=id\n            WHERE document_id = ?";
     $result = $obj->zQuery($sql, array($category_name, $document_id));
 }
 public function getList($list)
 {
     $appTable = new ApplicationTable();
     $query = "SELECT title,option_id,notes,codes FROM list_options WHERE list_id = ?";
     $result = $appTable->zQuery($query, array($list));
     $records = array();
     foreach ($result as $row) {
         $records[] = $row;
     }
     return $records;
 }
Exemple #14
0
 public function deleteACLSections($module_id)
 {
     $obj = new ApplicationTable();
     $sql = "DELETE FROM module_acl_sections WHERE module_id =? AND parent_section <> 0";
     $obj->zQuery($sql, array($module_id));
     $sqsl = "DELETE FROM modules_settings WHERE mod_id =? AND fld_type = 1";
     $obj->zQuery($sql, array($module_id));
 }
 public function getLatestEncounter($pid)
 {
     $encounter = '';
     $appTable = new ApplicationTable();
     $query = "SELECT encounter FROM form_encounter  WHERE pid = ? ORDER BY id DESC LIMIT 1";
     $result = $appTable->zQuery($query, array($pid));
     foreach ($result as $row) {
         $encounter = $row['encounter'];
     }
     return $encounter;
 }
 public function AddNewUSer($data = array())
 {
     $fname = $data['fname'];
     $lname = $data['lname'];
     $direct_address = $data['direct_address'];
     $appTable = new ApplicationTable();
     $query = "INSERT INTO users SET username = ? ,password = ? ,authorized = ?,fname = ?,lname = ?,email = ?,active = ?,abook_type = ?";
     $appTable->zQuery($query, array('', '', 0, $fname, $lname, $direct_address, 1, 'emr_direct'));
 }
Exemple #17
0
 public function getModuleSections($module_id)
 {
     $sql = "SELECT * FROM module_acl_sections WHERE module_id = ?";
     $obj = new ApplicationTable();
     $result = $obj->zQuery($sql, array($module_id));
     return $result;
 }
 public function getCodes($option_id, $list_id)
 {
     $appTable = new ApplicationTable();
     if ($option_id) {
         $query = "SELECT notes \n                    FROM list_options \n                    WHERE list_id=? AND option_id=?";
         $result = $appTable->zQuery($query, array($list_id, $option_id));
         $res_cur = $result->current();
     }
     return $res_cur['notes'];
 }
 public function getCareTeamProviderId($pid)
 {
     $appTable = new ApplicationTable();
     $query = "SELECT care_team FROM patient_data WHERE `pid`  = ?";
     $result = $appTable->zQuery($query, array($pid));
     $row = $result->current();
     return $row['care_team'];
 }