function getLabsGraphValues() { $oDD = new \raptor\DashboardData($this->m_oContext); $aDD = $oDD->getDashboardDetails(); $selectedPatient = array('ethnicity' => $aDD['PatientEthnicity'], 'gender' => $aDD['PatientGender'], 'age' => $aDD['PatientAge']); $labsResult = MdwsUtils::getChemHemLabs($this->m_oContext->getMdwsClient()); //Pass in selected patient and egfr formula if one is defined $result = MdwsUtils::convertSoapLabsToGraph($selectedPatient, NULL, $labsResult, 3); error_log('getLabsGraphValues patient>>>' . print_r($selectedPatient, TRUE)); error_log('getLabsGraphValues labs>>>' . print_r($labsResult, TRUE)); error_log('getLabsGraphValues filtered>>>' . print_r($result, TRUE)); if (!is_array($result)) { $result = array(); } return $result; }
/** * Get all the form contents for rendering * @return type renderable array */ function getForm($form, &$form_state, $disabled, $myvalues) { $form["data_entry_area1"] = array('#prefix' => "\n<section class='protocollib-admin raptor-dialog-table'>\n", '#suffix' => "\n</section>\n"); $form["data_entry_area1"]['table_container'] = array('#type' => 'item', '#prefix' => '<div class="raptor-dialog-table-container">', '#suffix' => '</div>', '#tree' => TRUE); $oDD = new \raptor\DashboardData($this->m_oContext); $oPSD = new \raptor\ProtocolSupportingData($this->m_oContext); $radiology_reports_detail = $oPSD->getRadiologyReportsDetail(); $raptor_protocoldashboard = $oDD->getDashboardDetails(); $patientDFN = $raptor_protocoldashboard['PatientID']; $patientICN = $raptor_protocoldashboard['mpiPid']; $rows = ''; foreach ($radiology_reports_detail as $data_row) { $reportID = $data_row['ReportID']; $caseNumber = $data_row['CaseNumber']; $rows .= "\n" . '<tr>' . '<td>' . $data_row["Title"] . '</td>' . '<td>' . $data_row["ReportedDate"] . '</td>' . '<td><a href="#" class="raptor-details">' . $data_row["Snippet"] . '</a>' . GetRadiologyReportsTab::raptor_print_details($data_row["Details"]) . '</td>' . '<td>' . GetRadiologyReportsTab::getImageInfoAsHTML($this->m_oContext, $patientDFN, $patientICN, $reportID, $caseNumber) . '</td>' . '</tr>'; } $form["data_entry_area1"]['table_container']['reports'] = array('#type' => 'item', '#markup' => '<table id="my-raptor-dialog-table" class="dataTable">' . '<thead>' . '<tr>' . '<th>Title</th>' . '<th>Date</th>' . '<th>Details</th>' . '<th>Existing Images</th>' . '</tr>' . '</thead>' . '<tbody>' . $rows . '</tbody>' . '</table>'); return $form; }
/** * Saves values when in exam mode. * @return boolean */ public function saveAllExamFieldValues($nSiteID, $nIEN, $nUID, $sCWFS, $sNewWFS, $updated_dt, $myvalues) { $patientDFN = NULL; try { $oDD = new \raptor\DashboardData($this->m_oContext); $raptor_protocoldashboard = $oDD->getDashboardDetails(); $patientDFN = $raptor_protocoldashboard['PatientID']; } catch (\Exception $ex) { throw new \Exception('Failed to get the dashboard to save exam fields', 91111, $ex); } //Create the raptor_ticket_exam_settings record now $bSuccess = TRUE; try { //See if we already have a record of values. $result = db_select('raptor_ticket_exam_settings', 'p')->fields('p')->condition('siteid', $nSiteID, '=')->condition('IEN', $nIEN, '=')->execute(); $nRows = $result->rowCount(); if ($nRows > 0) { //Replace the record but save the values. error_log('Replacing exam information SITEID=' . $nSiteID . ' IEN=' . $nIEN . ' UID=' . $nUID . ' CWFS=' . $sCWFS . ' NWFS=' . $sNewWFS); $record = $result->fetchAssoc(); $oInsert = db_insert('raptor_ticket_exam_settings_replaced')->fields(array('siteid' => $record['siteid'], 'IEN' => $record['IEN'], 'current_workflow_state_cd' => $record['current_workflow_state_cd'], 'hydration_none_yn' => $record['hydration_none_yn'], 'hydration_oral_tx' => $record['hydration_oral_tx'], 'hydration_iv_tx' => $record['hydration_iv_tx'], 'sedation_none_yn' => $record['sedation_none_yn'], 'sedation_oral_tx' => $record['sedation_oral_tx'], 'sedation_iv_tx' => $record['sedation_iv_tx'], 'contrast_none_yn' => $record['contrast_none_yn'], 'contrast_enteric_tx' => $record['contrast_enteric_tx'], 'contrast_iv_tx' => $record['contrast_iv_tx'], 'radioisotope_none_yn' => $record['radioisotope_none_yn'], 'radioisotope_enteric_tx' => $record['radioisotope_enteric_tx'], 'radioisotope_iv_tx' => $record['radioisotope_iv_tx'], 'consent_received_kw' => $record['consent_received_kw'], 'author_uid' => $record['author_uid'], 'original_created_dt' => $record['created_dt'], 'replaced_dt' => $updated_dt))->execute(); $nDeleted = db_delete('raptor_ticket_exam_settings')->condition('siteid', $nSiteID, '=')->condition('IEN', $nIEN, '=')->execute(); } $hydration_oral_value = trim($myvalues['exam_hydration_oral_tx']); $hydration_iv_value = trim($myvalues['exam_hydration_iv_tx']); $hydration_none_yn = $hydration_oral_value == '' && $hydration_iv_value == '' ? 1 : 0; $sedation_oral_value = trim($myvalues['exam_sedation_oral_tx']); $sedation_iv_value = trim($myvalues['exam_sedation_iv_tx']); $sedation_none_yn = $sedation_oral_value == '' && $sedation_iv_value == '' ? 1 : 0; $contrast_enteric_value = trim($myvalues['exam_contrast_enteric_tx']); $contrast_iv_value = trim($myvalues['exam_contrast_iv_tx']); $contrast_none_yn = $contrast_enteric_value == '' && $contrast_iv_value == '' ? 1 : 0; $radioisotope_enteric_value = trim($myvalues['exam_radioisotope_enteric_tx']); $radioisotope_iv_value = trim($myvalues['exam_radioisotope_iv_tx']); $radioisotope_none_yn = $radioisotope_enteric_value == '' && $radioisotope_iv_value == '' ? 1 : 0; $consent_received_kw = isset($myvalues['exam_consent_received_kw']) ? $myvalues['exam_consent_received_kw'] : NULL; $oInsert = db_insert('raptor_ticket_exam_settings')->fields(array('siteid' => $nSiteID, 'IEN' => $nIEN, 'hydration_none_yn' => $hydration_none_yn, 'hydration_oral_tx' => $hydration_oral_value, 'hydration_iv_tx' => $hydration_iv_value, 'sedation_none_yn' => $sedation_none_yn, 'sedation_oral_tx' => $sedation_oral_value, 'sedation_iv_tx' => $sedation_iv_value, 'contrast_none_yn' => $contrast_none_yn, 'contrast_enteric_tx' => $contrast_enteric_value, 'contrast_iv_tx' => $contrast_iv_value, 'radioisotope_none_yn' => $radioisotope_none_yn, 'radioisotope_enteric_tx' => $radioisotope_enteric_value, 'radioisotope_iv_tx' => $radioisotope_iv_value, 'consent_received_kw' => $consent_received_kw, 'current_workflow_state_cd' => $sCWFS, 'author_uid' => $nUID, 'created_dt' => $updated_dt))->execute(); } catch (\Exception $ex) { error_log('Failed to create raptor_ticket_exam_settings: ' . print_r($ex, TRUE)); drupal_set_message('Failed to save exam information for this ticket because ' . $ex->getMessage(), 'error'); $bSuccess = FALSE; } if ($bSuccess) { //Now write the dose information. $radiation_dose_tx = isset($myvalues['exam_ctdivol_radiation_dose_tx']) ? trim($myvalues['exam_ctdivol_radiation_dose_tx']) : ''; $uom = isset($myvalues['exam_ctdivol_radiation_dose_uom_tx']) ? trim($myvalues['exam_ctdivol_radiation_dose_uom_tx']) : ''; $dose_type_cd = isset($myvalues['exam_ctdivol_radiation_dose_type_cd']) ? trim($myvalues['exam_ctdivol_radiation_dose_type_cd']) : ''; if ($radiation_dose_tx != '') { $nPatientID = $patientDFN; $dose_type_cd = $dose_type_cd; $dose_source_cd = 'C'; $data_provider = 'tech during exam'; $dose_dt = $updated_dt; $this->writeRadiationDoseDetails($nSiteID, $nIEN, $nPatientID, $nUID, $radiation_dose_tx, $uom, $dose_dt, $dose_type_cd, $dose_source_cd, $data_provider, $updated_dt); } $radiation_dose_tx = isset($myvalues['exam_dlp_radiation_dose_tx']) ? trim($myvalues['exam_dlp_radiation_dose_tx']) : ''; $uom = isset($myvalues['exam_dlp_radiation_dose_uom_tx']) ? trim($myvalues['exam_dlp_radiation_dose_uom_tx']) : ''; $dose_type_cd = isset($myvalues['exam_dlp_radiation_dose_type_cd']) ? trim($myvalues['exam_dlp_radiation_dose_type_cd']) : ''; if ($radiation_dose_tx != '') { $nPatientID = $patientDFN; $dose_type_cd = $dose_type_cd; $dose_source_cd = 'D'; $data_provider = 'tech during exam'; $dose_dt = $updated_dt; $this->writeRadiationDoseDetails($nSiteID, $nIEN, $nPatientID, $nUID, $radiation_dose_tx, $uom, $dose_dt, $dose_type_cd, $dose_source_cd, $data_provider, $updated_dt); } $radiation_dose_tx = isset($myvalues['exam_other_radiation_dose_tx']) ? trim($myvalues['exam_other_radiation_dose_tx']) : ''; $uom = isset($myvalues['exam_other_radiation_dose_uom_tx']) ? trim($myvalues['exam_other_radiation_dose_uom_tx']) : ''; $dose_type_cd = isset($myvalues['exam_other_radiation_dose_type_cd']) ? trim($myvalues['exam_other_radiation_dose_type_cd']) : ''; if ($radiation_dose_tx != '') { $nPatientID = $patientDFN; $dose_type_cd = $dose_type_cd; $dose_source_cd = 'E'; $data_provider = 'tech during exam'; $dose_dt = $updated_dt; $this->writeRadiationDoseDetails($nSiteID, $nIEN, $nPatientID, $nUID, $radiation_dose_tx, $uom, $dose_dt, $dose_type_cd, $dose_source_cd, $data_provider, $updated_dt); } $radiation_dose_tx = isset($myvalues['exam_radioisotope_radiation_dose_tx']) ? trim($myvalues['exam_radioisotope_radiation_dose_tx']) : ''; $uom = isset($myvalues['exam_radioisotope_radiation_dose_uom_tx']) ? trim($myvalues['exam_radioisotope_radiation_dose_uom_tx']) : ''; $dose_type_cd = isset($myvalues['exam_radioisotope_radiation_dose_type_cd']) ? trim($myvalues['exam_radioisotope_radiation_dose_type_cd']) : ''; if ($radiation_dose_tx != '') { $nPatientID = $patientDFN; $dose_type_cd = $dose_type_cd; $dose_source_cd = 'R'; $data_provider = 'tech during exam'; $dose_dt = $updated_dt; $this->writeRadiationDoseDetails($nSiteID, $nIEN, $nPatientID, $nUID, $radiation_dose_tx, $uom, $dose_dt, $dose_type_cd, $dose_source_cd, $data_provider, $updated_dt); } } if ($bSuccess) { //Create the raptor_ticket_exam_notes record now try { if (isset($myvalues['exam_notes_tx']) && trim($myvalues['exam_notes_tx']) !== '') { $oInsert = db_insert('raptor_ticket_exam_notes')->fields(array('siteid' => $nSiteID, 'IEN' => $nIEN, 'notes_tx' => $myvalues['exam_notes_tx'], 'author_uid' => $nUID, 'created_dt' => $updated_dt))->execute(); } } catch (\Exception $e) { error_log('Failed to create raptor_ticket_exam_notes: ' . $e); form_set_error('exam_notes_tx', 'Failed to save notes for this ticket!'); $bSuccess = FALSE; } } if ($bSuccess && $sNewWFS != $sCWFS) { $this->changeTicketWorkflowStatus($nSiteID, $nIEN, $nUID, $sNewWFS, $sCWFS, $updated_dt); } return $bSuccess; }
/** * Setup all the global variables that are part of the form context. */ function setupFormContext() { global $raptor_protocoldashboard; global $raptor_protocol_content; global $raptor_context; $userinfo = $this->m_oContext->getUserInfo(); $userprivs = $userinfo->getSystemPrivileges(); $raptor_context = $this->m_oContext; if ($userinfo->getUserID() < 0 || $userinfo->getUserID() == NULL) { //This is not a valid user session, this can happen on kickout and things like that. $errormsg = 'Did not have a valid user id (' . $userinfo->getUserID() . ')'; error_log($errormsg); die($errormsg); } module_load_include('php', 'raptor_datalayer', 'core/data_dashboard'); module_load_include('php', 'raptor_datalayer', 'core/data_protocolsupport'); module_load_include('php', 'raptor_datalayer', 'core/data_listoptions'); module_load_include('php', 'raptor_graph', 'core/GraphData'); if (!$this->m_oContext->hasSelectedTrackingID()) { //This can happen when we are done with a personal batch or somethning like that. die('Did NOT find a selected Tracking ID. Go back to the worklist.'); } //Set all the Protocol page values $oDD = new \raptor\DashboardData($this->m_oContext); $raptor_protocoldashboard = $oDD->getDashboardDetails(); $oPSD = new \raptor\ProtocolSupportingData($this->m_oContext); $oGD = new \raptor\GraphData($this->m_oContext); $oLO = new \raptor\ListOptions(); $raptor_protocol_content = array(); //$formContent = raptor_glue_protocolinfo_form_inputarea(); $raptor_protocol_content['Input']['Protocol'] = '<h1>THIS GLOBAL ENTRY HAS BEEN DEPRECATED!</h1>'; //drupal_render($formContent); $raptor_protocol_content['Reference']['OrderOverview'] = $oPSD->getOrderOverview(); $raptor_protocol_content['Reference']['VitalsSummary'] = $oPSD->getVitalsSummary(); $raptor_protocol_content['Reference']['MedicationsDetail'] = $oPSD->getMedicationsDetail(); $raptor_protocol_content['Reference']['VitalsDetail'] = $oPSD->getVitalsDetail(); $raptor_protocol_content['Reference']['AllergiesDetail'] = $oPSD->getAllergiesDetail(); $raptor_protocol_content['Reference']['ProcedureLabsDetail'] = $oPSD->getProcedureLabsDetail(); $raptor_protocol_content['Reference']['DiagnosticLabsDetail'] = $oPSD->getDiagnosticLabsDetail(); $raptor_protocol_content['Reference']['DoseHxDetail'] = $oPSD->getDoseHxDetail(); $raptor_protocol_content['Reference']['PathologyReportsDetail'] = $oPSD->getPathologyReportsDetail(); $raptor_protocol_content['Reference']['SurgeryReportsDetail'] = $oPSD->getSurgeryReportsDetail(); $raptor_protocol_content['Reference']['ProblemsListDetail'] = $oPSD->getProblemsListDetail(); $raptor_protocol_content['Reference']['NotesDetail'] = $oPSD->getNotesDetail(); $raptor_protocol_content['Reference']['RadiologyReportsDetail'] = $oPSD->getRadiologyReportsDetail(); $raptor_protocol_content['Reference']['Graph']['Thumbnail'] = $oGD->getThumbnailGraphValues(); $raptor_protocol_content['Reference']['Graph']['Labs'] = $oGD->getLabsGraphValues(); $raptor_protocol_content['Reference']['Graph']['Vitals'] = $oGD->getVitalsGraphValues(); $raptor_protocol_content['AtRiskMeds'] = $oLO->getAtRiskMedsKeywords(); }