public function getAmendments($params) { Matcha::pauseLog(true); $records = $this->a->load($params)->leftJoin(['title' => 'response_title', 'fname' => 'response_fname', 'mname' => 'response_mname', 'lname' => 'response_lname'], 'users', 'response_uid', 'id')->all(); Matcha::pauseLog(false); return $records; }
function getXMLDocument() { try { $this->conn = Matcha::getConn(); $filePointer = "../reports/{$this->reportDir}/reportStatement.sql"; // Important connection parameter, this will allow multiple // prepare tags with the same name. $this->conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); if (file_exists($filePointer) && is_readable($filePointer)) { // Get the SQL content $fileContent = file_get_contents($filePointer); $RunSQL = $this->conn->prepare($fileContent); // Copy all the request variables into the ExecuteValues foreach ($this->request as $field) { $PrepareField[':' . $field['name']] = $field['value']; } // Also copy all the request variables to Return variable to XML foreach ($this->request as $field) { $ReturnFilter[$field['name']] = $field['value']; } $RunSQL->execute($PrepareField); $records = $RunSQL->fetchAll(PDO::FETCH_ASSOC); $ExtraAttributes['xml-stylesheet'] = 'type="text/xsl" href="report.xsl"'; Array2XML::init('1.0', 'UTF-8', true, $ExtraAttributes); $xml = Array2XML::createXML('records', array('filters' => $ReturnFilter, 'record' => $records)); return $xml->saveXML(); } else { throw new Exception('Error: Not SQL Statement file was found or is readable.'); } } catch (Exception $Error) { error_log(print_r($Error, true)); return $Error; } }
function __construct() { $this->conn = Matcha::getConn(); if (!isset($this->s)) { $this->s = MatchaModel::setSenchaModel('App.model.patient.EncounterService'); } }
function __construct() { $this->conn = Matcha::getConn(); $this->patient = new Patient(); $this->poolArea = new PoolArea(); $this->diagnosis = new DiagnosisCodes(); $this->FamilyHistory = new FamilyHistory(); if (!isset($this->e)) { $this->e = MatchaModel::setSenchaModel('App.model.patient.Encounter'); } if (!isset($this->ros)) { $this->ros = MatchaModel::setSenchaModel('App.model.patient.ReviewOfSystems'); } if (!isset($this->soap)) { $this->soap = MatchaModel::setSenchaModel('App.model.patient.SOAP'); } if (!isset($this->d)) { $this->d = MatchaModel::setSenchaModel('App.model.patient.Dictation'); } if (!isset($this->hcfa)) { $this->hcfa = MatchaModel::setSenchaModel('App.model.patient.HCFAOptions'); } if (!isset($this->edx)) { $this->edx = MatchaModel::setSenchaModel('App.model.patient.EncounterDx'); } }
/** * Creates the MatchaHelper instance */ function __construct() { $this->db = new MatchaHelper(); $this->conn = Matcha::getConn(); if (!isset($this->ff)) { $this->ff = MatchaModel::setSenchaModel('App.model.administration.FormField'); } }
function __construct() { $this->conn = Matcha::getConn(); if (!isset($this->i)) { $this->i = MatchaModel::setSenchaModel('App.model.patient.PatientImmunization'); } return; }
public function logoutSession() { $id = $_SESSION['session_id']; $logout = time(); $conn = Matcha::getConn(); $conn->exec("UPDATE `users_sessions` SET `logout` = '{$logout}' WHERE `id` = '{$id}'"); return true; }
function __construct() { $this->conn = Matcha::getConn(); $this->db = new MatchaHelper(); if (!isset($this->LO)) { $this->LO = MatchaModel::setSenchaModel('App.model.administration.LabObservations'); } return; }
function __construct() { $this->db = new MatchaHelper(); $this->conn = Matcha::getConn(); $this->labs = new Laboratories(); $this->immu = new Immunizations(); $this->serv = new Services(); return; }
function __construct() { parent::__construct(); $this->conn = \Matcha::getConn(); $this->user = new \User(); $this->patient = new \Patient(); $this->encounter = new \Encounter(); return; }
public static function getGeoLocation($ip) { $conn = Matcha::getConn(); $sql = 'SELECT * FROM `geo_ip_location` WHERE ? BETWEEN `ip_start_num` AND `ip_end_num`'; $ip_number = self::isIpV4($ip) ? self::getIpV4Number($ip) : self::getIpV6Number($ip); $sth = $conn->prepare($sql); $sth->execute([$ip_number]); return $sth->fetch(PDO::FETCH_ASSOC); }
public function setLog(stdClass $params) { $params->date = date('Y-m-d H:i:s'); $params->fid = $_SESSION['user']['facility']; $params->uid = $_SESSION['user']['id']; Matcha::pauseLog(true); $record = $this->l->save($params); Matcha::pauseLog(false); return $record; }
function __construct() { $this->conn = Matcha::getConn(); $this->db = new MatchaHelper(); // if($this->LP == null) $this->LO = MatchaModel::setSenchaModel('App.model.administration.LabPanels'); if ($this->LO == null) { $this->LO = MatchaModel::setSenchaModel('App.model.administration.LabObservations'); } return; }
public function updateSession() { $data = new stdClass(); $data->id = $_SESSION['session_id']; $data->last_request = $_SESSION['inactive']['timeout'] = time(); Matcha::pauseLog(true); $this->s->save($data); Matcha::pauseLog(false); unset($data); return true; }
function getXMLDocument() { try { $filePointer = "../reports/{$this->reportDir}/reportStatement.sql"; if (file_exists($filePointer) && is_readable($filePointer)) { // Important connection parameter, this will allow multiple // prepare tags with the same name. $this->conn = Matcha::getConn(); $this->conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); // Get the report SQL statement content $fileContent = file_get_contents($filePointer); // Copy all the request variables into the Prepared Values, // also check if it came from the grid form and normal form. // This because we need to do a POST-PREPARE the SQL statement foreach ($this->request as $field) { $PrepareField[':' . $field['name']]['operator'] = isset($field['operator']) ? $field['operator'] : '='; $PrepareField[':' . $field['name']]['value'] = $field['value']; } // Copy all the request filter variables to the XML, // also check if it came from the grid form and normal form. // This because we need to do a POST-PREPARE the SQL statement foreach ($this->request as $field) { $ReturnFilter[$field['name']]['operator'] = isset($field['operator']) ? $field['operator'] : '='; $ReturnFilter[$field['name']]['value'] = $field['value']; } // Prepare all the variable fields in the SQL Statement $PreparedSQL = $this->PostPrepare($fileContent, $PrepareField); $Queries = explode(';', $PreparedSQL); // Run all the SQL Statement separated by `;` in the file foreach ($Queries as $Query) { if (strlen(trim($Query)) > 0) { $SQL = $this->conn->prepare($Query); $SQL->execute(); $records[] = $SQL->fetchAll(PDO::FETCH_ASSOC); } } $ExtraAttributes['xml-stylesheet'] = 'type="text/xsl" href="report.xsl"'; Array2XML::init('1.0', 'UTF-8', true, $ExtraAttributes); $xml = Array2XML::createXML('records', array('filters' => $ReturnFilter, 'record' => $records[count($records) - 1])); return $xml->saveXML(); } else { throw new Exception('Error: Not SQL Statement file was found or readable.'); } } catch (Exception $Error) { error_log(print_r($Error, true)); return $Error; } }
public function patientLiveSearch(stdClass $params) { $this->setPatientModel(); $conn = Matcha::getConn(); $whereValues = []; $where = []; $queries = explode(' ', $params->query); foreach ($queries as $index => $query) { $query = trim($query); $where[] = " (pubpid REGEXP :pubpid{$index} OR fname LIKE :fname{$index} OR lname LIKE :lname{$index} OR mname LIKE :mname{$index} OR DOB LIKE :DOB{$index} OR pid LIKE :pid{$index} OR SS LIKE :ss{$index}) "; $whereValues[':fname' . $index] = $query . '%'; $whereValues[':lname' . $index] = $query . '%'; $whereValues[':mname' . $index] = $query . '%'; if ($index == 0) { if (preg_match('/^(.)-(.*)-(.{2})$/', $query, $matches)) { $whereValues[':pubpid' . $index] = '^' . $matches[1] . '-' . str_pad($matches[2], 15, '0', STR_PAD_LEFT) . '-' . $matches[3] . '$'; } elseif (preg_match('/^(.)-(.*)$/', $query, $matches)) { $whereValues[':pubpid' . $index] = '^' . $matches[1] . '-' . str_pad($matches[2], 15, '0', STR_PAD_LEFT); } elseif (preg_match('/(.*)-(.{2})$/', $query, $matches)) { $whereValues[':pubpid' . $index] = str_pad($matches[1], 15, '0', STR_PAD_LEFT) . '-' . $matches[2]; } else { $whereValues[':pubpid' . $index] = trim($query, '-') . '-.{2}$'; } } else { $whereValues[':pubpid' . $index] = trim($query, '-') . '-.{2}$'; } $whereValues[':DOB' . $index] = $query . '%'; $whereValues[':pid' . $index] = $query . '%'; $whereValues[':ss' . $index] = '%' . $query; } $sth = $conn->prepare('SELECT pid, pubpid, fname, lname, mname, DOB, SS, sex FROM `patient` WHERE ' . implode(' AND ', $where) . ' LIMIT 300'); $sth->execute($whereValues); $patients = $sth->fetchAll(PDO::FETCH_ASSOC); return ['totals' => count($patients), 'rows' => array_slice($patients, $params->start, $params->limit)]; }
function __construct() { $this->db = Matcha::getConn(); }
/** * @return string */ private function getAssigningAuthority() { return 'GAIA-' . Matcha::getInstallationNumber(); }
foreach ($vars as $var) { utf8_encode_deep($input->{$var}); } } } } } $response = null; if (is_array($data)) { $response = array(); foreach ($data as $d) { $response[] = doRpc($d); } } else { $response = doRpc($data); } utf8_encode_deep($response); if ($isForm && $isUpload) { print '<html><body><textarea>'; $json = htmlentities(json_encode($response), ENT_NOQUOTES | ENT_SUBSTITUTE, 'UTF-8'); $json = mb_convert_encoding($json, 'UTF-8', 'UTF-8'); print $json; print '</textarea></body></html>'; } else { header('Content-Type: application/json; charset=utf-8'); $json = htmlentities(json_encode($response), ENT_NOQUOTES | ENT_SUBSTITUTE, 'UTF-8'); $json = mb_convert_encoding($json, 'UTF-8', 'UTF-8'); print $json; } Matcha::$__conn = null;
private function setRules($alertType, $category = 'C') { $params = new stdClass(); $params->filter[0] = new stdClass(); $params->filter[0]->property = 'active'; $params->filter[0]->value = 1; $params->filter[1] = new stdClass(); $params->filter[1]->property = 'alert_type'; $params->filter[1]->value = $alertType; $params->filter[2] = new stdClass(); $params->filter[2]->property = 'category'; $params->filter[2]->value = $category; $this->rules = $this->getDecisionSupportRules($params); $this->rules = $this->rules['data']; // unset filter[2] to use $params to filter concepts unset($params->filter[2]); // change property to filter concepts $params->filter[0]->property = 'rule_id'; $params->filter[1]->property = 'concept_type'; Matcha::pauseLog(true); foreach ($this->rules as $i => $rule) { $params->filter[0]->value = $rule['id']; $params->filter[1]->value = 'PROC'; $this->rules[$i]['concepts']['PROC'] = $this->getDecisionSupportRuleConcepts($params); $params->filter[1]->value = 'PROB'; $this->rules[$i]['concepts']['PROB'] = $this->getDecisionSupportRuleConcepts($params); $params->filter[1]->value = 'SOCI'; $this->rules[$i]['concepts']['SOCI'] = $this->getDecisionSupportRuleConcepts($params); $params->filter[1]->value = 'MEDI'; $this->rules[$i]['concepts']['MEDI'] = $this->getDecisionSupportRuleConcepts($params); $params->filter[1]->value = 'ALLE'; $this->rules[$i]['concepts']['ALLE'] = $this->getDecisionSupportRuleConcepts($params); $params->filter[1]->value = 'LAB'; $this->rules[$i]['concepts']['LAB'] = $this->getDecisionSupportRuleConcepts($params); $params->filter[1]->value = 'VITA'; $this->rules[$i]['concepts']['VITA'] = $this->getDecisionSupportRuleConcepts($params); } // unset params since will not be use again unset($params); Matcha::pauseLog(false); }
$records = $recordSet->fetchAll($fetchStyle); $err = $recordSet->errorInfo(); if ($err[2]) { return $err; } return $records; } /** * @brief Row Count * @details This methods is used to query an statement and return the rows * coount using PDO * * @author Ernesto J. Rodriguez (Certun) <*****@*****.**> * @version Vega 1.0 * * @note count($sql) should be use instead of this method. * please refer to @ref Logs::getLogs() to see an example * of how to use count(); * * @return int The number of rows in a table */ function rowCount() { $recordSet = self::$__conn->query($this->sql_statement); return $recordSet->rowCount(); } } $conn = Matcha::getConn(); if (!isset($conn)) { new MatchaHelper(); }
/** * @param string $freeze */ public static function setFreeze($freeze) { self::$__freeze = $freeze; }
/** * @param {string} $category * @param {array} $permissions * @param {bool} $install */ public static function updateModulePermissions($category, $permissions, $install) { self::$conn = Matcha::getConn(); self::setPermissionModel(); foreach ($permissions as $permission) { $permission = (object) $permission; $sth = self::$conn->prepare('SELECT * FROM `acl_permissions` WHERE perm_key = ?'); $sth->execute([$permission->key]); $record = $sth->fetch(PDO::FETCH_ASSOC); if ($install && $record === false) { $sth = self::$conn->prepare('INSERT INTO `acl_permissions` (`perm_cat`, `perm_name`, `perm_key`, `active`, `seq`) VALUES (?,?,?,?,?)'); $sth->execute([$category, $permission->title, $permission->key, '1', isset($permission->seq) ? $permission->seq : '0']); } elseif ($install) { $record = (object) $record; $sth = self::$conn->prepare('UPDATE `acl_permissions` SET `perm_cat` = ?, `perm_name` = ?, `perm_key` = ?, `active` = ?, `seq` = ? WHERE id = ?'); $sth->execute([$category, $permission->title, $permission->key, '1', isset($permission->seq) ? $permission->seq : '0', $record->id]); } elseif ($record !== false) { $record = (object) $record; $sth = self::$conn->prepare('UPDATE `acl_permissions` SET `active` = ? WHERE id = ?'); $sth->execute(['0', $record->id]); } } }
<?php /** * Created by IntelliJ IDEA. * User: ernesto * Date: 12/10/13 * Time: 1:17 PM */ date_default_timezone_set('America/Puerto_Rico'); include_once dirname(dirname(dirname(dirname(__FILE__)))) . '/Matcha/Matcha.php'; Matcha::connect(array('host' => 'localhost', 'name' => 'matchatest', 'user' => 'matchatest', 'pass' => '123456', 'app' => dirname(dirname(__FILE__)) . '/app'));
/** * Form now this is just getting the latest open encounter for all the patients. * * @param $params * * @return array */ public function getPatientsByPoolAreaAccess($params) { Matcha::pauseLog(true); if (is_numeric($params)) { $uid = $params; } elseif (!is_numeric($params) && isset($params->eid)) { $uid = $params->eid; } elseif (!isset($_SESSION['user']['id'])) { return []; } else { $uid = $_SESSION['user']['id']; } $this->acl = new ACL($uid); $pools = []; if ($this->acl->hasPermission('use_pool_areas')) { $this->setPatient(); $activeAreas = $this->getFacilityActivePoolAreas(); $areas = []; $pools = []; if (!empty($activeAreas)) { foreach ($activeAreas as $activeArea) { if ($activeArea['id'] == 1 && $this->acl->hasPermission('access_poolcheckin') || $activeArea['id'] == 2 && $this->acl->hasPermission('access_pooltriage') || $activeArea['id'] == 3 && $this->acl->hasPermission('access_poolphysician') || $activeArea['id'] == 4 && $this->acl->hasPermission('access_poolcheckout')) { $areas[] = 'pp.area_id = \'' . $activeArea['id'] . '\''; } } $whereAreas = '(' . implode(' OR ', $areas) . ')'; $sql = "SELECT pp.*, p.fname, p.lname, p.mname, pa.title\n\t\t\t\t\t FROM `patient_pools` AS pp\n\t\t\t\t LEFT JOIN `patient` AS p ON pp.pid = p.pid\n\t\t\t\t LEFT JOIN `pool_areas` AS pa ON pp.area_id = pa.id\n\t\t\t\t WHERE {$whereAreas}\n\t\t\t\t\t AND pp.time_out IS NULL\n\t\t\t\t\t AND pp.in_queue = '1'\n\t\t\t ORDER BY pp.time_in\n\t\t\t LIMIT 25"; $patientPools = $this->pa->sql($sql)->all(); $pools = []; foreach ($patientPools as $patientPool) { $patientPool['name'] = ($patientPool['eid'] != null ? '*' : '') . Person::fullname($patientPool['fname'], $patientPool['mname'], $patientPool['lname']); $patientPool['shortName'] = Person::ellipsis($patientPool['name'], 15); $patientPool['poolArea'] = $patientPool['title']; $patientPool['patient'] = $this->patient->getPatientDemographicDataByPid($patientPool['pid']); $patientPool['floorPlanId'] = $this->getFloorPlanIdByPoolAreaId($patientPool['area_id']); $z = $this->getPatientCurrentZoneInfoByPid($patientPool['pid']); $pools[] = empty($z) ? $patientPool : array_merge($patientPool, $z); } $pools = array_slice($pools, 0, 25); } } Matcha::pauseLog(false); return $pools; }
/** * This is create a sequenced unique ID {string} of 38 characters * @return mixed */ public function newId() { try { return strtoupper(str_replace('.', '', uniqid(date('Uu'), true))) . Matcha::getInstallationNumber(); } catch (PDOException $e) { return MatchaErrorHandler::__errorProcess($e); } }
private function getGraphCurves($type, $sex) { $conn = Matcha::getConn(); $sth = $conn->prepare("SELECT * FROM vector_graphs WHERE type = :type AND sex = :sex"); $sth->execute(array(':type' => $type, ':sex' => $sex)); $records = array(); foreach ($sth->fetchAll(PDO::FETCH_ASSOC) as $row) { unset($row['type'], $row['sex'], $row['L'], $row['M'], $row['S']); foreach ($row as $key => $val) { if ($val == null) { unset($row[$key]); } } $records[] = $row; } return $records; }
function __construct() { $this->conn = Matcha::getConn(); $this->setTables(); }
/** * this method will insert the new active modules in site database if * does not exist */ private function setNewModules() { Matcha::pauseLog(true); foreach (FileManager::scanDir($this->modulesDir) as $module) { $ModuleConfig = $this->getModuleConfig($module); if ($ModuleConfig['active']) { $moduleRecord = $this->m->load(['name' => $ModuleConfig['name']])->one(); if (empty($moduleRecord)) { $data = new stdClass(); $data->title = $ModuleConfig['title']; $data->name = $ModuleConfig['name']; $data->description = $ModuleConfig['description']; $data->enable = '0'; $data->installed_version = $ModuleConfig['version']; $this->m->save($data); } } } Matcha::pauseLog(false); return; }
function __construct() { $this->hl7 = new HL7(); $this->conn = Matcha::getConn(); if (!isset($this->p)) { $this->p = MatchaModel::setSenchaModel('App.model.patient.Patient'); } if (!isset($this->PatientContacts)) { $this->PatientContacts = MatchaModel::setSenchaModel('App.model.patient.PatientContacts'); } if (!isset($this->EncounterServices)) { $this->EncounterServices = MatchaModel::setSenchaModel('App.model.patient.EncounterService'); } if (!isset($this->e)) { $this->e = MatchaModel::setSenchaModel('App.model.patient.Encounter'); } if (!isset($this->u)) { $this->u = MatchaModel::setSenchaModel('App.model.administration.User'); } if (!isset($this->r)) { $this->r = MatchaModel::setSenchaModel('App.model.administration.ReferringProvider'); } if (!isset($this->m)) { $this->m = MatchaModel::setSenchaModel('App.model.administration.HL7Message'); } if (!isset($this->c)) { $this->c = MatchaModel::setSenchaModel('App.model.administration.HL7Client'); } if (!isset($this->f)) { $this->f = MatchaModel::setSenchaModel('App.model.administration.Facility'); } }