コード例 #1
0
ファイル: File.php プロジェクト: nagyist/tutus
 /**
  *
  * $params->pid int
  * $params->eid int
  * $params->uid int
  * $params->docType string
  * $params->document string Base64
  *
  * @param object $params
  *
  * @return array
  */
 public function savePatientBase64Document($params)
 {
     $this->validateParams($params);
     if ($this->error) {
         return array('success' => false, 'error' => $this->errorMsg);
     }
     $dir = $this->getDocumentDirByPidAndDocType($params->pid, $params->docType);
     if ($this->error) {
         return array('success' => false, 'error' => $this->errorMsg);
     }
     $file = explode(',', $params->document);
     $ext = $this->fileExt($file[0]);
     if ($this->error) {
         return array('success' => false, 'error' => $this->errorMsg);
     }
     $params->name = $this->getNewFileName($dir, $ext);
     if ($this->error) {
         return array('success' => false, 'error' => $this->errorMsg);
     }
     $src = $this->saveBase64File($dir . $params->name, $file[1]);
     if ($this->error) {
         return array('success' => false, 'error' => $this->errorMsg);
     }
     unset($params->file);
     $params->title = 'No title';
     $params->date = date('Y-m-d H:i:s');
     $params->hash = sha1_file($src);
     $params->url = $this->buildDocumentUrl($params->pid, $params->docType, $params->name);
     $params->encrypted = $this->encrypt;
     $rec = $this->d->save($params);
     if ($rec === false) {
         return array('success' => false, 'error' => 'Unable to save document record');
     }
     return array('success' => true, 'id' => $rec['data']->id);
 }
コード例 #2
0
ファイル: AuditLog.php プロジェクト: songhongji/gaiaehr
 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;
 }
コード例 #3
0
ファイル: AuditLog.php プロジェクト: nagyist/tutus
 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;
 }
コード例 #4
0
ファイル: Globals.php プロジェクト: nagyist/tutus
 /**
  * @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;
 }
コード例 #5
0
 /**
  * Method to get only the Self Contact witch is the Patient Contact information
  * @param $pid
  * @return mixed
  */
 public function getSelfContact($pid)
 {
     return $this->Contacts->sql('SELECT *,
         combo_lists_options.option_name as relationship_name
         FROM patient_contacts
         LEFT JOIN combo_lists_options
         ON relationship = option_value
         WHERE combo_lists_options.list_id=134
         AND patient_contacts.relationship="SEL"
         AND patient_contacts.pid = ' . $pid)->all();
 }
コード例 #6
0
 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;
 }
コード例 #7
0
 /**
  * @param $parentId
  * @return array
  *
  * Here we use the parent id to get the child items and it options
  * using basically the same logic of getFields() function and returning
  * an array of child items
  */
 function getChildItems($parentId)
 {
     $this->setModels();
     $items = [];
     $records = $this->ff->sql("Select * FROM `forms_fields` WHERE `parentId` = '{$parentId}' ORDER BY `x_index` ASC, `id` ASC")->all();
     foreach ($records as $item) {
         $opts = $this->getItemsOptions($item['id']);
         foreach ($opts as $opt => $val) {
             $item[$opt] = $val;
         }
         /**
          * If the item is a combo box lets create a store...
          */
         if ($item['xtype'] == 'combobox') {
             $item = $this->getComboDefaults($item);
             $item['store'] = $this->getStore($item['list_id']);
         }
         if ($item['xtype'] == 'datefield') {
             $item['format'] = 'Y-m-d';
         }
         /**
          * this if what makes this function reclusive this function will keep
          * calling it self
          */
         $item['items'] = $this->getChildItems($item['id']);
         if ($item['items'] == null) {
             unset($item['items']);
         }
         unset($item['id'], $item['form_id'], $item['parentId'], $item['x_index']);
         array_push($items, $item);
     }
     return $items;
 }
コード例 #8
0
ファイル: Sessions.php プロジェクト: nagyist/tutus
 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;
 }
コード例 #9
0
ファイル: Practice.php プロジェクト: songhongji/gaiaehr
 private function updatePhones($params, $foreignType = '')
 {
     $p = new stdClass();
     $p->id = $params->phone_id;
     $p->country_code = $params->phone_country_code;
     $p->area_code = $params->phone_area_code;
     $p->prefix = $params->phone_prefix;
     $p->number = $params->phone_number;
     $p->number_type = 'phone';
     $p->foreign_type = $foreignType;
     $p->foreign_id = $params->id;
     $record = $this->phone->save($p);
     $params->phone_full = Phone::fullPhone($record['country_code'], $record['area_code'], $record['prefix'], $record['number']);
     unset($p, $record);
     $f = new stdClass();
     $f->id = $params->fax_id;
     $f->country_code = $params->fax_country_code;
     $f->area_code = $params->fax_area_code;
     $f->prefix = $params->fax_prefix;
     $f->number = $params->fax_number;
     $f->number_type = 'fax';
     $f->foreign_type = $foreignType;
     $f->foreign_id = $params->id;
     $record = $this->phone->save($f);
     $params->fax_full = Phone::fullPhone($record['country_code'], $record['area_code'], $record['prefix'], $record['number']);
     unset($f, $record);
     return $params;
 }
コード例 #10
0
ファイル: DocumentHandler.php プロジェクト: igez/gaiaehr
 public function uploadDocument($params, $file)
 {
     $this->setPatientDocumentModel();
     $params = (object) $params;
     $src = $this->getPatientDir($params) . $this->reNameFile($file);
     if (move_uploaded_file($file['filePath']['tmp_name'], $src)) {
         if (isset($params->encrypted) && $params->encrypted) {
             file_put_contents($src, Crypt::encrypt(file_get_contents($src)), LOCK_EX);
         }
         $data = new stdClass();
         $data->pid = $this->pid;
         $data->eid = isset($params->eid) ? $params->eid : 0;
         $data->uid = isset($params->uid) ? $params->uid : $_SESSION['user']['id'];
         $data->docType = $this->docType;
         $data->name = $this->fileName;
         $data->url = $this->getDocumentUrl();
         $data->date = date('Y-m-d H:i:s');
         $data->hash = hash_file('sha256', $src);
         $data->encrypted = $params->encrypted;
         $data = $this->d->save($data);
         return ['success' => true, 'doc' => ['id' => $data['id'], 'name' => $this->fileName, 'url' => $this->getDocumentUrl()]];
     } else {
         return ['success' => false, 'error' => 'File could not be uploaded'];
     }
 }
コード例 #11
0
ファイル: CombosData.php プロジェクト: songhongji/gaiaehr
 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;
 }
コード例 #12
0
ファイル: Vitals.php プロジェクト: andrewbhandari/gaiaehr
 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);
 }
コード例 #13
0
ファイル: CupTest.php プロジェクト: nagyist/tutus
 function cuptest($params)
 {
     $t = new MatchaCUP();
     $t->setModel(array('extend' => 'Ext.data.Model', 'table' => array('name' => 'accvoucher', 'engine' => 'InnoDB', 'autoIncrement' => 1, 'charset' => 'utf8', 'collate' => 'utf8_bin', 'comment' => 'Voucher / Receipt'), 'fields' => array(array('name' => 'id', 'type' => 'int'), array('name' => 'voucherId', 'type' => 'int', 'comment' => 'Voucher'), array('name' => 'accountId', 'type' => 'int', 'comment' => 'Account')), 'associations' => array(array('type' => 'belongsTo', 'model' => 'App.model.account.Voucher', 'foreignKey' => 'voucherId', 'setterName' => 'setVoucher', 'getterName' => 'getVoucher'))));
     //$array = array(
     ////	'id' => 4,
     //	'date' => date('Y-m-d'),
     //	'encounterId' => 2,
     //	'accountId' => 4,
     //	'journalId' => 10
     //);
     //print $t::store($array);
     //print '<br>';
     //print $t::$rowsAffected;
     //print '<br>';
     //print $t::$lastInsertId;
     //		print '<br>';
     //		print_r($t::load($params)->fetch());    					// fetch all
     //		print '<br>';
     //		print_r($t::load(5)->fetchAll());    				// fetch all
     //print '<br>';
     //print '<br>';
     //$t::load(5);    						            // fetch all columns where id = 5
     //print '<br>';
     //print '<br>';
     //$t::load(5,array('id','name'));    			    // fetch id and name where id = 5
     //print '<br>';
     //print '<br>';
     //$t::load(array('voucherId'=>3));    			    // fetch all columns where voucherId = 5
     //print '<br>';
     //print '<br>';
     //$t::load(array('voucherId'=>3),array('id','name'));	// fetch id and name where voucherId = 5
     //print '<br>';
     //print '<br>';
     //$t::load(array('voucherId' =>3,'userId' =>5),array('id','name'));	// fetch id and name where voucherId = 5
     //print '<br>';
     //print '<br>';
     //$t::load(array('voucherId'=>3, 'OR', 'userId'=>7),array('id','name'));	// fetch id and name where voucherId = 5
     //
     //print '<br>';
     //print_r($t::$model->table->name);
     //	SELECT `id`,`name` FROM `accvoucher` WHERE `voucherId`='3' AND `userId`='7' OR (`hello`='4' AND `hello2`='5' )
     return array();
 }
コード例 #14
0
ファイル: Allergies.php プロジェクト: igez/gaiaehr
 public function searchAllergiesData($params)
 {
     if (!isset($params->query)) {
         return array();
     }
     $this->setAdminAllergyModel();
     $sql = "SELECT * FROM `allergies` WHERE `allergy` LIKE '%{$params->query}%' GROUP BY `allergy_code`\tLIMIT 100";
     $records = $this->d->sql($sql)->all();
     return array('total' => count($records), 'data' => array_slice($records, $params->start, $params->limit));
 }
コード例 #15
0
ファイル: Medications.php プロジェクト: igez/gaiaehr
 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;
 }
コード例 #16
0
ファイル: User.php プロジェクト: igez/gaiaehr
 public function getUsersByAcl($acl)
 {
     $acls = explode('&', $acl);
     foreach ($acls as &$acl) {
         $acl = '`ap`.`perm_key` = \'' . $acl . '\'';
     }
     $count = count($acls);
     $where = implode(' OR ', $acls);
     $sql = "SELECT `u`.*, `ar`.`role_name` AS role FROM users AS u\n                 \tLEFT JOIN `acl_roles` AS ar ON `ar`.`id` = `u`.`role_id`\n \t\t\t\t\tWHERE `u`.`id` IN (\n\t\t\t\t\t    SELECT  `up`.`id` FROM `users` AS up\n\t\t\t\t\t    LEFT JOIN `acl_role_perms` AS arp ON `arp`.`role_id` = `up`.`role_id`\n\t\t\t\t\t    LEFT JOIN `acl_permissions` AS ap ON `ap`.`id` = `arp`.`perm_id`\n \t\t\t\t\t\tWHERE `arp`.`value` = 1 AND ( {$where} )\n\t\t\t\t\t   \tGROUP BY `up`.`id`\n\t\t\t\t\t    HAVING COUNT(`up`.`id`) = {$count}\n\t\t\t\t\t) AND (\n\t\t                active = 1\n\t                )";
     $records = $this->u->sql($sql)->all();
     return ['total' => count($records), 'data' => $records];
 }
コード例 #17
0
ファイル: Patient.php プロジェクト: songhongji/gaiaehr
 /**
  * @param $params
  * @param $includeDateOfBirth
  *
  * @return mixed
  */
 public function getPossibleDuplicatesByDemographic($params, $includeDateOfBirth = false)
 {
     $this->setPatientModel();
     $sql = "SELECT *\n\t\t\t\t  FROM `patient`\n \t\t\t\t WHERE `fname` SOUNDS LIKE '{$params->fname}'\n \t\t\t\t   AND `lname` SOUNDS LIKE '{$params->lname}'\n \t\t\t\t   AND `sex` = '{$params->sex}'";
     if ($includeDateOfBirth) {
         $sql = " AND `DOB` = '{$params->DOB}'";
     }
     if (isset($params->pid) && $params->pid != 0) {
         $sql .= " AND `pid` != '{$params->pid}'";
     }
     $results = $this->p->sql($sql)->all();
     return ['total' => count($results), 'data' => $results];
 }
コード例 #18
0
ファイル: Immunizations.php プロジェクト: igez/gaiaehr
 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;
 }
コード例 #19
0
ファイル: Laboratories.php プロジェクト: igez/gaiaehr
 public function getActiveLaboratoryTypes()
 {
     $records = [];
     $sqlStatement['SELECT'] = "id, code_text_short, parent_name, loinc_name";
     $sqlStatement['WHERE'] = "id = parent_id AND active = '1'";
     $sqlStatement['ORDER'] = "parent_name ASC";
     foreach ($this->LO->buildSQL($sqlStatement)->all() as $row) {
         $row->label = $row->code_text_short == '' || $row->code_text_short == null ? $row->parent_name : $row->code_text_short;
         $row->fields = $this->getLabObservationFieldsByParentId($row->id);
         $records[] = $row;
     }
     return $records;
 }
コード例 #20
0
ファイル: Vitals.php プロジェクト: igez/gaiaehr
 /**
  * @param stdClass $params
  * @return stdClass
  */
 public function updateVitals($params)
 {
     $record = $this->v->save($params);
     if (is_array($params)) {
         foreach ($record as $i => $rec) {
             $record[$i] = $rec = (object) $rec;
             if (isset($rec->uid)) {
                 $record[$i]->administer_by = $rec->uid != 0 ? $this->User->getUserNameById($rec->uid) : '';
             }
             if (isset($rec->auth_uid)) {
                 $record[$i]->authorized_by = $rec->auth_uid != 0 ? $this->User->getUserNameById($rec->auth_uid) : '';
             }
         }
     } else {
         $record = (object) $record;
         if (isset($record->uid)) {
             $record->administer_by = $record->uid != 0 ? $this->User->getUserNameById($record->uid) : '';
         }
         if (isset($record->auth_uid)) {
             $record->authorized_by = $record->auth_uid != 0 ? $this->User->getUserNameById($record->auth_uid) : '';
         }
     }
     return $record;
 }
コード例 #21
0
ファイル: Medical.php プロジェクト: igez/gaiaehr
 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;
 }
コード例 #22
0
ファイル: CPT.php プロジェクト: igez/gaiaehr
 public function query($params)
 {
     $sql = "SELECT *, 'CPT4' as code_type FROM cpt_codes WHERE isRadiology = '1'";
     if (isset($params->onlyActive) && $params->onlyActive) {
         $sql .= " AND active = '1' ";
     }
     if (isset($params->isRadiology) && $params->isRadiology) {
         $sql .= " AND isRadiology = '1' ";
     }
     $this->c->reset();
     $sql .= ' AND (code LIKE ' . $this->c->where($params->query . '%') . ' OR code_text LIKE ' . $this->c->where('%' . $params->query . '%') . ' OR code_text_short LIKE ' . $this->c->where('%' . $params->query . '%') . ' OR code_text_medium LIKE ' . $this->c->where('%' . $params->query . '%') . ')';
     $records = $this->c->sql($sql)->all();
     return array('total' => count($records), 'data' => array_slice($records, $params->start, $params->limit));
 }
コード例 #23
0
ファイル: Providers.php プロジェクト: igez/gaiaehr
 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();
 }
コード例 #24
0
ファイル: ActiveProblems.php プロジェクト: songhongji/gaiaehr
 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;
 }
コード例 #25
0
ファイル: File.php プロジェクト: songhongji/gaiaehr
 /**
  *
  * $params->pid int
  * $params->eid int
  * $params->uid int
  * $params->docType string
  * $params->document string Base64
  *
  * @param object $params
  *
  * @return array
  */
 public function savePatientBase64Document($params)
 {
     $this->validateParams($params);
     if ($this->error) {
         return array('success' => false, 'error' => $this->errorMsg);
     }
     if ($this->fileSystemStore) {
         $dir = $this->getDocumentDirByPidAndDocType($params->pid, $params->docType);
         if ($this->error) {
             return array('success' => false, 'error' => $this->errorMsg);
         }
     }
     $file = explode(',', $params->document);
     $ext = $this->fileExt($file[0]);
     if ($this->error) {
         return array('success' => false, 'error' => $this->errorMsg);
     }
     if (isset($dir)) {
         $params->name = $this->getNewFileName($dir, $ext);
         if ($this->error) {
             return array('success' => false, 'error' => $this->errorMsg);
         }
         $src = $this->saveBase64File($dir . $params->name, $file[1]);
         if ($this->error) {
             return array('success' => false, 'error' => $this->errorMsg);
         }
     }
     unset($params->file);
     $params->title = isset($params->title) ? $params->title : '';
     $params->date = date('Y-m-d H:i:s');
     $params->hash = isset($src) ? sha1_file($src) : sha1($file[1]);
     $params->name = isset($params->name) ? $params->name : 'unnamed' . $ext;
     $params->encrypted = $this->encrypt;
     if ($this->fileSystemStore) {
         $params->url = $this->buildDocumentUrl($params->pid, $params->docType, $params->name);
     } else {
         $params->document = $this->encrypt ? MatchaUtils::__encrypt($file[1]) : $file[1];
     }
     $rec = $this->d->save($params);
     if ($rec === false) {
         return array('success' => false, 'error' => 'Unable to save document record');
     }
     return array('success' => true, 'id' => $rec['data']->id);
 }
コード例 #26
0
ファイル: Modules.php プロジェクト: igez/gaiaehr
 /**
  * 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;
 }
コード例 #27
0
ファイル: Patient.php プロジェクト: igez/gaiaehr
 /**
  * @param $params
  * @param $includeDateOfBirth
  *
  * @return mixed
  */
 public function getPossibleDuplicatesByDemographic($params, $includeDateOfBirth = false)
 {
     $this->setPatientModel();
     $sql = "SELECT *\n\t\t\t\t  FROM `patient`\n \t\t\t\t WHERE `fname` SOUNDS LIKE '{$params->fname}'\n \t\t\t\t   AND `lname` SOUNDS LIKE '{$params->lname}'\n \t\t\t\t   AND `sex` = '{$params->sex}'";
     $this->patientContacts = new PatientContacts();
     if ($includeDateOfBirth) {
         $sql = " AND `DOB` = '{$params->DOB}'";
     }
     if (isset($params->pid) && $params->pid != 0) {
         $sql .= " AND `pid` != '{$params->pid}'";
     }
     $results = $this->p->sql($sql)->all();
     foreach ($results as $index => $record) {
         $contact = $this->patientContacts->getSelfContact($record['pid']);
         $results[$index]['name'] = Person::fullname($record['fname'], $record['mname'], $record['lname']);
         if (isset($contact)) {
             $results[$index]['fulladdress'] = Person::fulladdress(isset($contact['street_mailing_address']) ? $contact['street_mailing_address'] : '', null, isset($contact['city']) ? $contact['city'] : '', isset($contact['state']) ? $contact['state'] : '', isset($contact['zip']) ? $contact['zip'] : '');
             $results[$index]['phones'] = isset($contact['phone_local_number']) ? $contact['phone_use_code'] . '-' . $contact['phone_area_code'] . '-' . $contact['phone_local_number'] : '';
         }
     }
     return ['total' => count($results), 'data' => $results];
 }
コード例 #28
0
ファイル: User.php プロジェクト: rrabadia89/gaiaehr
    public function userLiveSearch($params)
    {
        $acls = isset($params->acl) ? explode('&', $params->acl) : false;
        if ($acls === false) {
            $params->query = $params->query . '%';
            $this->u->sql('SELECT `u`.*, `ar`.`role_name` AS role FROM users as u
					    LEFT JOIN `acl_roles` AS ar ON `ar`.`id` = `u`.`role_id`
						    WHERE `u`.`fname` LIKE ?
						       OR `u`.`lname` LIKE ?
						       OR `u`.`username` LIKE ?');
            $records = $this->u->all([$params->query, $params->query, $params->query]);
        } else {
            foreach ($acls as &$acl) {
                $acl = '`ap`.`perm_key` = \'' . $acl . '\'';
            }
            $count = count($acls);
            $where = implode(' OR ', $acls);
            $sql = "SELECT `u`.*, `ar`.`role_name` AS role FROM users AS u\n                 \tLEFT JOIN `acl_roles` AS ar ON `ar`.`id` = `u`.`role_id`\n \t\t\t\t\tWHERE `u`.`id` IN (\n\t\t\t\t\t    SELECT  `up`.`id` FROM `users` AS up\n\t\t\t\t\t    LEFT JOIN `acl_role_perms` AS arp ON `arp`.`role_id` = `up`.`role_id`\n\t\t\t\t\t    LEFT JOIN `acl_permissions` AS ap ON `ap`.`id` = `arp`.`perm_id`\n \t\t\t\t\t\tWHERE `arp`.`value` = 1 AND ( {$where} )\n\t\t\t\t\t   \tGROUP BY `up`.`id`\n\t\t\t\t\t    HAVING COUNT(`up`.`id`) = {$count}\n\t\t\t\t\t) AND (\n\t\t                fname LIKE ? OR lname LIKE ? OR username LIKE ?\n\t                )";
            $this->u->sql($sql);
            $params->query = $params->query . '%';
            $records = $this->u->all([$params->query, $params->query, $params->query]);
        }
        return ['total' => count($records), 'data' => array_slice($records, $params->start, $params->limit)];
    }
コード例 #29
0
ファイル: Specialties.php プロジェクト: igez/gaiaehr
 public function deleteSpecialty($params)
 {
     return $this->s->destroy($params);
 }
コード例 #30
0
ファイル: Encounter.php プロジェクト: igez/gaiaehr
 public function destroyEncounterDx($params)
 {
     return $this->edx->destroy($params);
 }