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(); } } }
public function addPatientLabsResult(stdClass $params) { $lab['pid'] = $params->pid; $lab['uid'] = $_SESSION['user']['id']; $lab['document_id'] = $params->document_id; $lab['date'] = date('Y-m-d H:i:s'); $lab['parent_id'] = $params->parent_id; $this->db->setSQL($this->db->sqlBind($lab, 'patient_labs', 'I')); $this->db->execLog(); $patient_lab_id = $this->db->lastInsertId; foreach ($this->laboratories->getLabObservationFieldsByParentId($params->parent_id) as $result) { $foo = array(); $foo['patient_lab_id'] = $patient_lab_id; $foo['observation_loinc'] = $result->loinc_number; $foo['observation_value'] = null; $foo['unit'] = $result->default_unit; $this->db->setSQL($this->db->sqlBind($foo, 'patient_labs_results', 'I')); $this->db->execOnly(); } return $params; }
public function createNewEmergency() { $patient = $this->patient->createNewPatientOnlyName('EMER'); if ($patient['success']) { $this->pid = $patient['patient']['pid']; /** * send new patient to the emergency pool area */ $params = new stdClass(); $params->pid = $this->pid; $params->priority = $this->priority; $params->sendTo = 3; $this->poolArea->sendPatientToPoolArea($params); /** * create new encounter */ $params = new stdClass(); $params->pid = $this->pid; $params->brief_description = '***EMERGENCY***'; $params->visit_category = 'Emergency'; $params->priority = $this->priority; $params->service_date = Time::getLocalTime(); $params->open_uid = $_SESSION['user']['id']; $encounter = $this->encounter->createEncounter($params); $this->eid = $encounter['encounter']['eid']; /** * log the emergency */ $this->logEmergency(); /* * update patient first name to EMERGENCY- encounter id */ $data['fname'] = 'EMER-' . $this->emergencyId; $this->db->setSQL($this->db->sqlBind($data, 'patient', 'U', array('pid' => $this->pid))); $this->db->execOnly(); return array('success' => true, 'emergency' => array('pid' => $this->pid, 'eid' => $this->eid, 'name' => 'EMER-' . $this->emergencyId, 'priority' => $params->priority)); } else { return array('success' => false, 'error' => $patient['error']); } }
echo '<pre>'; $db = new MatchaHelper(); $file_handle = fopen("HCPC2013_A-N.csv", "r"); $rows = array(); $buff = array('code' => null, 'code_text' => null, 'code_text_short' => null); $count = 0; while (!feof($file_handle)) { $line = fgets($file_handle); $data = array(); $foo = explode("\t", $line); if ($count == 0) { $buff = array('code' => $foo[0], 'code_text' => $foo[3], 'code_text_short' => $foo[4]); } elseif ($buff['code'] != $foo[0]) { $rows[] = $buff; $buff = array('code' => $foo[0], 'code_text' => $foo[3], 'code_text_short' => $foo[4]); } else { $buff['code_text'] = $buff['code_text'] . ' ' . $foo[3]; } $count++; // $db->setSQL($db->sqlBind($data,'codes_icds','I')); // $db->execOnly(); } if (feof($file_handle)) { print 'The End!'; } fclose($file_handle); foreach ($rows as $row) { $db->setSQL($db->sqlBind($row, 'hcpcs_codes', 'I')); $db->execOnly(); } print_r($rows);
{ if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != "..") { if (filetype($dir . "/" . $object) == "dir") { RemoveReclusiveDir($dir . "/" . $object); } else { unlink($dir . "/" . $object); } } } reset($objects); rmdir($dir); } return true; } //print '<h1>SQL Clean Up!</h1>'; foreach ($tables as $table) { $db->setSQL("TRUNCATE TABLE {$table}"); $err = $db->execOnly(); $msg = isset($err[1]) ? 'FAIL!' : 'PASS!'; //print 'Empty `' . $table . '` ' . $msg . '<br>'; } //print '<h1>Patient Directories Clean Up!</h1>'; $path = site_path . '/patients/'; $patientsDir = getDirectoryList($path); foreach ($patientsDir as $dir) { RemoveReclusiveDir($path . $dir); } print 'Factory Reset Complete!';