/** * @param stdClass $params * @return array */ public function addPatientImmunization($params) { $immunization = $this->i->save($params); // add service if ($immunization !== false && isset($params->eid) && $params->eid > 0) { $service = new stdClass(); $service->pid = $params->pid; $service->eid = $params->eid; $service->uid = $params->uid; $service->code = $this->immunizations->getCptByCvx($params->code); $dx_pointers = array(); foreach ($this->diagnosis->getICDByEid($params->eid, true) as $dx) { $dx_children[] = $dx; $dx_pointers[] = $dx['code']; } $service->dx_pointers = implode(',', $dx_pointers); $this->services->addCptCode($service); } return $immunization; }
/** * @param $eid * @return array * Naming: "closePatientEncounter" */ public function getProgressNoteByEid($eid) { $record = $this->getEncounter($eid, true, false); unset($filters); $encounter = (array) $record['encounter']; $user = new User(); $encounter['service_date'] = date('F j, Y, g:i a', strtotime($encounter['service_date'])); $encounter['patient_name'] = $this->patient->getPatientFullNameByPid($encounter['pid']); $encounter['open_by'] = $user->getUserNameById($encounter['open_uid']); $encounter['signed_by'] = $user->getUserNameById($encounter['provider_uid']); unset($user); /** * Add vitals to progress note */ if ($_SESSION['globals']['enable_encounter_vitals']) { if (count($encounter['vitals']) == 0) { unset($encounter['vitals']); } } /** * Add Review of Systems to progress note */ if ($_SESSION['globals']['enable_encounter_review_of_systems']) { $foo = []; foreach ($encounter['reviewofsystems'] as $key => $value) { if ($key != 'id' && $key != 'pid' && $key != 'eid' && $key != 'uid' && $key != 'date') { if ($value != null && $value != 'null') { $value = $value == 1 || $value == '1' ? 'Yes' : 'No'; $foo[] = ['name' => $key, 'value' => $value]; } } } if (!empty($foo)) { $encounter['reviewofsystems'] = $foo; } } /** * Add SOAP to progress note */ if ($_SESSION['globals']['enable_encounter_soap']) { $dxCodes = $this->diagnosis->getICDByEid($eid, true); if (count($dxCodes) > 0) { $dxOl = ''; $dxGroups = []; foreach ($dxCodes as $dxCode) { $dxGroups[$dxCode['dx_group']][] = $dxCode; } foreach ($dxGroups as $dxGroup) { $dxOl .= '<p>Dx Group ' . $dxGroup[0]['dx_group'] . '</p>'; $dxOl .= '<ol class="ProgressNote-ol">'; foreach ($dxGroup as $dxCode) { $dxOl .= '<li><span style="font-weight:bold; text-decoration:none">' . $dxCode['code'] . '</span> - ' . $dxCode['long_desc'] . '</li>'; } $dxOl .= '</ol>'; } } $soap = $this->getSoapByEid($eid); $soap['assessment'] = isset($soap['assessment']) ? $soap['assessment'] : ''; $soap['objective'] = (isset($soap['objective']) ? $soap['objective'] : '') . $this->getObjectiveExtraDataByEid($eid); $soap['assessment'] = $soap['assessment'] . (isset($dxOl) ? $dxOl : ''); $encounter['soap'] = $soap; } /** * Add Dictation to progress note */ if ($_SESSION['globals']['enable_encounter_dictation']) { $speech = $this->getDictationByEid($eid); if ($speech['dictation']) { $encounter['speechdictation'] = $speech; } } return $encounter; }
/** * @param $eid * @return array * Naming: "closePatientEncounter" */ public function getProgressNoteByEid($eid) { $this->db->setSQL("SELECT * FROM encounters WHERE eid = '{$eid}'"); $encounter = $this->db->fetchRecord(PDO::FETCH_ASSOC); $encounter['service_date'] = date('F j, Y, g:i a', strtotime($encounter['service_date'])); $encounter['patient_name'] = $this->patient->getPatientFullNameByPid($encounter['pid']); $encounter['open_by'] = $this->user->getUserNameById($encounter['open_uid']); $encounter['signed_by'] = $this->user->getUserNameById($encounter['provider_uid']); /** * Add vitals to progress note */ $vitals = $this->getVitalsByEid($eid); if (count($vitals)) { $encounter['vitals'] = $vitals; } /** * Add Review of Systems to progress note */ $ros = $this->getReviewOfSystemsByEid($eid); $foo = array(); foreach ($ros as $key => $value) { if ($key != 'id' && $key != 'pid' && $key != 'eid' && $key != 'uid' && $key != 'date') { if ($value != null && $value != 'null') { $value = $value == 1 || $value == '1' ? 'Yes' : 'No'; $foo[] = array('name' => $key, 'value' => $value); } } } if (!empty($foo)) { $encounter['reviewofsystems'] = $foo; } /** * Add Review of Systems Checks to progress note */ $rosck = $this->getReviewOfSystemsChecksByEid($eid); $foo = array(); foreach ($rosck[0] as $key => $value) { if ($key != 'id' && $key != 'pid' && $key != 'eid' && $key != 'uid' && $key != 'date') { if ($value != null && $value != 'null' && $value != '0' || $value != 0) { $value = $value == 1 || $value == '1' ? 'Yes' : 'No'; $foo[] = array('name' => $key, 'value' => $value); } } } if (!empty($foo)) { $encounter['reviewofsystemschecks'] = $foo; } /** * Add SOAP to progress note */ $icdxs = ''; foreach ($this->diagnosis->getICDByEid($eid) as $code) { $icdxs .= '<li><span style="font-weight:bold; text-decoration:none">' . $code['code'] . '</span> - ' . $code['long_desc'] . '</li>'; } //$icdxs = substr($icdxs, 0, -2); $soap = $this->getSoapByEid($eid); $soap['objective'] .= $this->getObjectiveExtraDataByEid($eid); $soap['assessment'] = $soap['assessment'] . '<ul class="ProgressNote-ul">' . $icdxs . '</ul>'; $encounter['soap'] = $soap; /** * Add Dictation to progress note */ $speech = $this->getDictationByEid($eid); if ($speech['dictation']) { $encounter['speechdictation'] = $speech; } /** * return the encounter array of data */ return $encounter; }