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; }
public function getLog($params) { $record = $this->t->load($params)->leftJoin(['title' => 'user_title', 'fname' => 'user_fname', 'mname' => 'user_mname', 'lname' => 'user_lname'], 'users', 'uid', 'id')->leftJoin(['title' => 'patient_title', 'fname' => 'patient_fname', 'mname' => 'patient_mname', 'lname' => 'patient_lname'], 'patient', 'pid', 'pid')->one(); if ($record !== false) { $checksum = crc32($record['uid'] . $record['fid'] . $record['data']['date'] . $record['data']['table_name'] . $record['data']['sql_string'] . serialize($record['data']['data'])); $record['data']['is_valid'] = $record['data']['checksum'] == $checksum; } return $record; }
/** * @return array */ public static function getGlobalsArray() { if (self::$g == null) { self::$g = MatchaModel::setSenchaModel('App.model.administration.Globals'); } $gs = array(); foreach (self::$g->load()->all() as $g) { $gs[$g['gl_name']] = $g['gl_value']; } return $gs; }
public function getProviderCredentializationForDate($provider_id, $insurance_id, $date = null) { $this->getProviderCredentializationModel(); $this->pc->addFilter('provider_id', $provider_id); $this->pc->addFilter('insurance_company_id', $insurance_id); if (isset($date)) { $this->pc->addFilter('start_date', $date, '<='); $this->pc->addFilter('end_date', $date, '>='); } return $this->pc->load()->one(); }
public function getSoapSnippets($params) { $this->setSnippetModel(); if (isset($params->filter)) { return $this->Snippet->load($params)->all(); } elseif (isset($params->id)) { return $this->Snippet->load(['parentId' => $params->id])->all(); } else { return []; } }
/** * @param stdClass $params * @return array */ public function getVitals(stdClass $params) { $records = $this->v->load($params)->all(); foreach ($records as $i => $record) { $records[$i]['height_in'] = isset($record['height_in']) ? intval($record['height_in']) : ''; $records[$i]['height_cm'] = isset($record['height_cm']) ? intval($record['height_cm']) : ''; $records[$i]['administer_by'] = $record['uid'] != null ? $this->User->getUserNameById($record['uid']) : ''; $records[$i]['authorized_by'] = $record['auth_uid'] != null ? $this->User->getUserNameById($record['auth_uid']) : ''; } return $records; }
public function getFacilities($record) { $foo = new stdClass(); $foo->filter[0] = new stdClass(); $foo->filter[0]->property = 'referring_provider_id'; if (isset($record['data']) && $record['data'] !== false) { $foo->filter[0]->value = $record['data']['id']; $record['data']['facilities'] = $this->f->load($foo)->all(); } elseif ($record !== false) { $foo->filter[0]->value = $record['id']; $record['facilities'] = $this->f->load($foo)->all(); } return $record; }
public function logoutInactiveUsers() { $now = time(); $users = array(); $params = new stdClass(); $params->filter[0] = new stdClass(); $params->filter[0]->property = 'last_request'; $params->filter[0]->operator = '<'; $params->filter[0]->value = $now - $_SESSION['inactive']['time']; $params->filter[1] = new stdClass(); $params->filter[1]->property = 'logout'; $params->filter[1]->value = null; $sessions = $this->s->load($params)->all(); foreach ($sessions as $session) { if (isset($user['id'])) { $users[] = array('uid' => $session['uid']); $data = new stdClass(); $data->id = $session['id']; $data->logout = $now; $this->s->save($data); unset($data); } } unset($params); return $users; }
public function getCodeValueByListIdAndOptionValue($listId, $optionValue) { if ($this->CLO == null) { $this->CLO = MatchaModel::setSenchaModel('App.model.administration.ListOptions'); } $foo = $this->CLO->load(['list_id' => $listId, 'option_value' => $optionValue])->one(); return $foo !== false ? $foo['code'] : $optionValue; }
public function G2($params) { $pid = $params->pid; $start = $params->start; $end = $params->end; $provider = $params->provider; $records = $this->v->load($params)->all(); return array('D' => 'asdasdsadasdsadsad', 'N' => '', 'records' => $records); }
public function getEncounterDx($params) { $record = $this->edx->load($params)->one(); if ($record !== false) { $code = $this->diagnosis->getICDDataByCode($record['code'], $record['code_type']); if (is_array($code)) { $record = array_merge($record, $code); } } return $record; }
public function getPatientActiveMedicationsByPidAndCode($pid, $code) { $this->m->addFilter('pid', $pid); $this->m->addFilter('RXCUI', $code); $records = $this->m->load()->leftJoin(['title', 'fname', 'mname', 'lname'], 'users', 'administered_uid', 'id')->all(); foreach ($records as $i => $record) { if ($record['end_date'] != '0000-00-00' && strtotime($record['end_date']) < strtotime(date('Y-m-d'))) { unset($records[$i]); } } return $records; }
public function sendVXU($params) { $model = MatchaModel::setSenchaModel('App.model.patient.Patient'); $model->addFilter('pid', $params->pid); $data = []; $data['to'] = $params->to; $data['patient'] = $model->load()->one(); $data['immunizations'] = []; foreach ($params->immunizations as $i) { $data['immunizations'][] = $this->i->load($i)->one(); } return $data; }
public function sendVXU($params) { $p = new stdClass(); $p->filters = array(); $p->filters[0] = new stdClass(); $p->filters[0]->property = 'pid'; $p->filters[0]->value = $params->pid; $data = array(); $data['to'] = $params->to; $data['patient'] = $this->p->load($p)->one(); $data['immunizations'] = array(); foreach ($params->immunizations as $i) { $data['immunizations'][] = $this->i->load($i)->one(); } return $data; }
/** * @param $params * * @return array|mixed */ public function transferTempDocument($params) { $this->setPatientDocumentModel(); $this->setPatientDocumentTempModel(); $record = $this->t->load($params)->one(); if ($record == false) { return ['success' => false]; } $params->document = $record['document']; $params->date = date('Y-m-d H:i:s'); $params->name = 'transferred.pdf'; unset($params->id); $params = $this->addPatientDocument($params); unset($params['data']->document); return ['success' => true, 'record' => $params['data']]; }
public function getPatientActiveProblemByPidAndCode($pid, $code) { $params = new stdClass(); $params->filter[0] = new stdClass(); $params->filter[0]->property = 'pid'; $params->filter[0]->value = $pid; $params->filter[2] = new stdClass(); $params->filter[2]->property = 'code'; $params->filter[2]->value = $code; $records = $this->a->load($params)->all(); unset($params); foreach ($records as $i => $record) { if (strtotime($record['end_date']) < strtotime(date('Y-m-d')) && $record['end_date'] != '0000-00-00') { unset($records[$i]); } } return $records; }
private function getPhones($record) { $p = $this->phone->load($record['phone_id'])->one(); $record['phone_country_code'] = $p['country_code']; $record['phone_area_code'] = $p['area_code']; $record['phone_prefix'] = $p['prefix']; $record['phone_number'] = $p['number']; $record['phone_full'] = Phone::fullPhone($p['country_code'], $p['area_code'], $p['prefix'], $p['number']); unset($p); $f = $this->phone->load($record['fax_id'])->one(); $record['fax_country_code'] = $f['country_code']; $record['fax_area_code'] = $f['area_code']; $record['fax_prefix'] = $f['prefix']; $record['fax_number'] = $f['number']; $record['fax_full'] = Phone::fullPhone($f['country_code'], $f['area_code'], $f['prefix'], $f['number']); unset($f); return $record; }
/** * 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; }
public function getUserRolesByCurrentUserOrUserId($uid = null) { $user = $this->u->load($uid == null ? $_SESSION['user']['id'] : $uid)->one(); return $user; }
public function getPatientComplementaryInsuranceByPid($pid) { $this->pi->addFilter('pid', $pid); $this->pi->addFilter('insurance_type', 'C'); return $this->pi->load()->one(); }
/** * @param HL7 $hl7 * @param ADT $msg * @param stdClass $msgRecord */ protected function ProcessADT($hl7, $msg, $msgRecord) { $evt = $hl7->getMsgEventType(); if ($evt == 'A01') { /** * Admit Visit */ } elseif ($evt == 'A04') { /** * Register a Patient */ $patientData = $this->PidToPatient($msg->data['PID'], $hl7); $patient = $this->p->load($patientData[$this->updateKey])->one(); if ($patient === false) { $this->ackStatus = 'AR'; $this->ackMessage = 'Unable to find patient ' . $patientData[$this->updateKey]; } $patient = array_merge($patient, $patientData); $patient = $this->p->save((object) $patient); $this->InsuranceGroupHandler($msg->data['INSURANCE'], $hl7, $patient); return; } elseif ($evt == 'A08') { /** * Update Patient Information */ $patientData = $this->PidToPatient($msg->data['PID'], $hl7); $patient = $this->p->load($patientData[$this->updateKey])->one(); if ($patient === false) { $this->ackStatus = 'AR'; $this->ackMessage = 'Unable to find patient ' . $patientData[$this->updateKey]; } $patient = array_merge($patient, $patientData); $patient = $this->p->save((object) $patient); $this->InsuranceGroupHandler($msg->data['INSURANCE'], $hl7, $patient); return; } elseif ($evt == 'A09') { /** * Patient Departing - Tracking * PV1-3 - Assigned Patient Location * PV1-6 - Prior Patient Location * PV1-11 - Temporary Location * PV1-42 - Pending Location * PV1-43 - Prior Temporary Location */ $PID = $msg->data['PID']; $PV1 = $msg->data['PV1']; $filter = array(); if ($PID[3][4][1] == $this->getAssigningAuthority()) { $filter['pid'] = $PID[3][1]; } else { $filter['pubpid'] = $PID[3][1]; } $patient = $this->p->load($filter)->one(); if ($patient === false) { $this->ackStatus = 'AR'; $this->ackMessage = 'Unable to find patient ' . $PID[3][1]; } $newAreaId = $PV1[3][1]; //$oldAreaId = $PV1[6][1]; $PoolArea = new PoolArea(); $areas = $PoolArea->getAreasArray(); if (!array_key_exists($newAreaId, $areas)) { $this->ackStatus = 'AR'; $this->ackMessage = 'Unable to find Area ID ' . $newAreaId; return; } $params = new stdClass(); $params->pid = $patient['pid']; $params->sendTo = $newAreaId; $PoolArea->sendPatientToPoolArea($params); unset($params); return; } elseif ($evt == 'A10') { /** * Patient Arriving - Tracking * PV1-3 - As signed Patient Location * PV1-6 - Prior Patient Location * PV1-11 - Temporary Location * PV1-43 - Prior Temporary Location */ $PID = $msg->data['PID']; $PV1 = $msg->data['PV1']; $filter = array(); if ($PID[3][4][1] == $this->getAssigningAuthority()) { $filter['pid'] = $PID[3][1]; } else { $filter['pubpid'] = $PID[3][1]; } $patient = $this->p->load($filter)->one(); if ($patient === false) { $this->ackStatus = 'AR'; $this->ackMessage = 'Unable to find patient ' . $PID[3][1]; } $newAreaId = $PV1[3][1]; //$oldAreaId = $PV1[6][1]; $PoolArea = new PoolArea(); $areas = $PoolArea->getAreasArray(); if (!array_key_exists($newAreaId, $areas)) { $this->ackStatus = 'AR'; $this->ackMessage = 'Unable to find Area ID ' . $newAreaId; return; } $params = new stdClass(); $params->pid = $patient['pid']; $params->sendTo = $newAreaId; $PoolArea->sendPatientToPoolArea($params); unset($params); return; } elseif ($evt == 'A18') { /** * Merge Patient Information * PID-2.1 <= MRG-4.1 */ $pid = $msg->data['PATIENT']['PID'][2][1]; $mrg = $msg->data['PATIENT']['MRG'][4][1]; $aPatient = $this->p->load(array('pubpid' => $pid))->one(); $bPatient = $this->p->load(array('pubpid' => $mrg))->one(); $this->MergeHandler($aPatient, $bPatient, $pid, $mrg); return; } elseif ($evt == 'A28') { /** * Add Person or Patient Information * PID-2.1 <= MRG-4.1 */ $patientData = $this->PidToPatient($msg->data['PID'], $hl7); $patientData['pubpid'] = $patientData['pid']; $patientData['pid'] = 0; $patient = $this->p->save((object) $patientData); $this->InsuranceGroupHandler($msg->data['INSURANCE'], $hl7, $patient); return; } elseif ($evt == 'A29') { /** * Delete Person Information */ } elseif ($evt == 'A31') { /** * Update Person Information */ $patientData = $this->PidToPatient($msg->data['PID'], $hl7); $patient = $this->p->load($patientData[$this->updateKey])->one(); if ($patient === false) { $this->ackStatus = 'AR'; $this->ackMessage = 'Unable to find patient ' . $patientData[$this->updateKey]; } $patient = array_merge($patient, $patientData); $patient = $this->p->save((object) $patient); $this->InsuranceGroupHandler($msg->data['INSURANCE'], $hl7, $patient); return; } elseif ($evt == 'A32') { /** Cancel Patient Arriving - Tracking **/ return; } elseif ($evt == 'A33') { /** Cancel Patient Departing - Tracking **/ return; } elseif ($evt == 'A39') { /** * Merge Person - Patient ID (Using External ID) * PID-2.1 <= MRG-4.1 */ $pid = $msg->data['PATIENT']['PID'][2][1]; $mrg = $msg->data['PATIENT']['MRG'][4][1]; $aPatient = $this->p->load(array('pubpid' => $pid))->one(); $bPatient = $this->p->load(array('pubpid' => $mrg))->one(); $this->MergeHandler($aPatient, $bPatient, $pid, $mrg); return; } elseif ($evt == 'A40') { /** * Merge Patient - Patient Identifier List * PID-3.1 <= MRG-1.1 */ $pid = $msg->data['PATIENT']['PID'][3][1]; $mrg = $msg->data['PATIENT']['MRG'][1][1]; $aPatient = $this->p->load(array('pid' => $pid))->one(); $bPatient = $this->p->load(array('pid' => $mrg))->one(); $this->MergeHandler($aPatient, $bPatient, $pid, $mrg); return; } elseif ($evt == 'A41') { /** * Merge Account - Patient Account Number * PID-18.1 <= MRG-3.1 */ $pid = $msg->data['PATIENT']['PID'][18][1]; $mrg = $msg->data['PATIENT']['MRG'][3][1]; $aPatient = $this->p->load(array('pubaccount' => $pid))->one(); $bPatient = $this->p->load(array('pubaccount' => $mrg))->one(); $this->MergeHandler($aPatient, $bPatient, $pid, $mrg); return; } /** * Un handle event error */ $this->ackStatus = 'AR'; $this->ackMessage = 'Unable to handle ADT_' . $evt; }
public function getReminder($params) { return $this->r->load($params)->one(); }
public function loadProcedures($params) { return $this->p->load($params)->all(); }
public function getNote($params) { return $this->n->load($params)->one(); }
public function getPatientPhotoSrcIdByPid($pid) { $this->setPatientModel(); $patient = $this->p->load($pid)->one(); return $patient['image']; }
public function getPatientCarePlanGoalsByPid($pid) { $this->c->addFilter('pid', $pid); return $this->c->load()->all(); }
public function getPatientAdvanceDirective($params) { return $this->a->load($params)->one(); }
public function getTemplatePanelTemplate($params) { return $this->i->load($params)->one(); }
public function getSpecialty($params) { return $this->s->load($params)->one(); }
public function getPatientReferralByEid($eid) { $this->r->addFilter('eid', $eid); return $this->r->load()->one(); }