/** * Get the values to populate the form. * @return type result of the queries as an array */ function getFieldValues() { $tid = $this->m_oContext->getSelectedTrackingID(); $oWL = new \raptor\WorklistData($this->m_oContext); $aOneRow = $oWL->getDashboardMap(); //$tid); $nSiteID = $this->m_oContext->getSiteID(); $nIEN = $tid; $nUID = $this->m_oContext->getUID(); $myvalues = array(); $myvalues['tid'] = $tid; $myvalues['procName'] = $aOneRow['Procedure']; $result = db_select('raptor_ticket_collaboration', 'c')->fields('c')->condition('siteid', $nSiteID, '=')->condition('IEN', $nIEN, '=')->condition('active_yn', 1, '=')->execute(); if ($result->rowCount() == 0) { //Initialize all values as empty. $myvalues['prev_collaborator_uid'] = ''; $myvalues['collaborator_uid'] = ''; //This gets filled in by javascript $myvalues['requester_prev_notes_tx'] = ''; $myvalues['requester_notes_tx'] = ''; } else { //Initialize all values with what we found. $record = $result->fetchAssoc(); $myvalues['prev_collaborator_uid'] = $record['collaborator_uid']; $myvalues['collaborator_uid'] = $record['collaborator_uid']; $myvalues['requester_prev_notes_tx'] = $record['requester_notes_tx']; $myvalues['requester_notes_tx'] = ''; } return $myvalues; }
/** * Get the values to populate the form. * @return type result of the queries as an array */ function getFieldValues() { $tid = $this->m_oContext->getSelectedTrackingID(); $oWL = new \raptor\WorklistData($this->m_oContext); $aOneRow = $oWL->getDashboardMap(); //$tid); $nSiteID = $this->m_oContext->getSiteID(); $nIEN = $tid; $nUID = $this->m_oContext->getUID(); $myvalues = array(); $myvalues['tid'] = $tid; $myvalues['procName'] = $aOneRow['Procedure']; $this->m_oContext = \raptor\Context::getInstance(); $myvalues['tid'] = $this->m_oContext->getSelectedTrackingID(); //TODO: Pre-populate values for display return $myvalues; }
/** * Get the values to populate the form. * @return type result of the queries as an array */ function getFieldValues() { $tid = $this->m_oContext->getSelectedTrackingID(); if ($tid == NULL || trim($tid) == '' || trim($tid) == 0) { throw new \Exception('Missing selected ticket number!'); } $oWL = new \raptor\WorklistData($this->m_oContext); $aOneRow = $oWL->getDashboardMap(); //$tid); $nSiteID = $this->m_oContext->getSiteID(); $nIEN = $tid; $nUID = $this->m_oContext->getUID(); $myvalues = array(); $myvalues['tid'] = $tid; $myvalues['procName'] = $aOneRow['Procedure']; $myvalues['reason'] = ''; $myvalues['notes_tx'] = ''; //$myvalues['esig'] = ''; $this->m_oContext = \raptor\Context::getInstance(); $myvalues['tid'] = $this->m_oContext->getSelectedTrackingID(); //TODO: Pre-populate values for display return $myvalues; }
/** * Get the values to populate the form. * @return type result of the queries as an array */ function getFieldValues() { $tid = $this->m_oContext->getSelectedTrackingID(); $oWL = new \raptor\WorklistData($this->m_oContext); $aOneRow = $oWL->getDashboardMap(); //$aOneRow = $oWL->getOneWorklistRow(); //$tid); $nSiteID = $this->m_oContext->getSiteID(); $nIEN = $tid; $nUID = $this->m_oContext->getUID(); $sTrackingID = $this->m_oTT->getTrackingID($nSiteID, $nIEN); $myvalues = array(); $myvalues['tid'] = $tid; $myvalues['procName'] = $aOneRow['Procedure']; $myvalues['PatientName'] = $aOneRow['PatientName']; $myvalues['PatientDOB'] = $aOneRow['PatientDOB']; $myvalues['RequestedDate'] = $aOneRow['RequestedDate']; $myvalues['Urgency'] = $aOneRow['Urgency']; //Get all the available locations. $query = db_select('raptor_schedule_location', 'n'); $query->fields('n')->orderBy('location_tx', 'ASC'); //ORDER BY created $result = $query->execute(); $rooms = array(); while ($record = $result->fetchAssoc()) { $rooms[] = array($record['location_tx'], $record['description_tx']); } $myvalues['rooms'] = $rooms; try { //Get all the available durations. $query = db_select('raptor_schedule_duration', 'n'); $query->fields('n')->orderBy('minutes', 'ASC'); //ORDER BY created $result = $query->execute(); $durations = array(); while ($record = $result->fetchAssoc()) { $durations[] = $record['minutes']; } $myvalues['durations'] = $durations; } catch (\Exception $ex) { //For now keep going $myvalues['durations'] = NULL; } //Get all the available users. $query = db_select('raptor_user_profile', 'n'); $query->fields('n')->orderBy('lastname', 'ASC')->orderBy('firstname', 'ASC'); $query->condition('SWI1', 1, '='); $or = db_or(); $or->condition('SP1', 1, '='); $or->condition('SUWI1', 1, '='); $or->condition('PWI1', 1, '='); $query->condition($or); $query->condition('accountactive_yn', 1, '='); $result = $query->execute(); $options = array(); $options[''] = ''; while ($record = $result->fetchAssoc()) { if (substr($record['role_nm'], 0, 1) == 'R') { $displayinfo = $record['lastname'] . ', ' . $record['firstname'] . ($record['usernametitle'] > '' ? ' / ' . $record['usernametitle'] : '') . ($record['suffix'] > '' ? ' / ' . $record['suffix'] : '') . ($record['role_nm'] > '' ? ' / ' . $record['role_nm'] : ''); $options[$record['uid']] = $displayinfo; } } $myvalues['assignment_options'] = $options; $collabinfo = $this->m_oTT->getCollaborationInfo($sTrackingID); if (is_array($collabinfo)) { $myvalues['suggested_uid'] = $collabinfo['collaborator_uid']; $myvalues['suggested_alreadyset_uid'] = $myvalues['suggested_uid']; $myvalues['suggested_alreadyset_note'] = $collabinfo['requester_notes_tx']; } else { $myvalues['suggested_uid'] = NULL; $myvalues['suggested_alreadyset_uid'] = NULL; $myvalues['suggested_alreadyset_note'] = NULL; } $query = db_select('raptor_schedule_track', 'n'); $query->fields('n'); $query->condition('siteid', $nSiteID, '='); $query->condition('IEN', $nIEN, '='); $result = $query->execute(); if ($result->rowCount() == 1) { $record = $result->fetchAssoc(); $scheduled_dt = $record['scheduled_dt']; if (isset($scheduled_dt)) { $dt = new \DateTime($scheduled_dt); $event_date_tx = $dt->format('m/d/Y'); $event_starttime_tx = $dt->format('H:i'); $myvalues['event_date_tx'] = $event_date_tx; $myvalues['event_starttime_tx'] = $event_starttime_tx; } else { $myvalues['event_date_tx'] = NULL; $myvalues['event_starttime_tx'] = NULL; } $myvalues['duration_am'] = $record['duration_am']; $myvalues['location_tx'] = $record['location_tx']; $myvalues['notes_tx'] = $record['notes_tx']; $myvalues['notes_critical_yn'] = $record['notes_critical_yn']; $myvalues['confirmed_by_patient_dt'] = $record['confirmed_by_patient_dt']; $myvalues['canceled_reason_tx'] = $record['canceled_reason_tx']; $myvalues['canceled_dt'] = $record['canceled_dt']; $aPrevNotes = array(); //TODO -- Query the replaced table for all previous notes. $myvalues['prev_notes'] = $aPrevNotes; } else { $myvalues['event_date_tx'] = NULL; $myvalues['event_starttime_tx'] = NULL; $myvalues['duration_am'] = NULL; $myvalues['location_tx'] = NULL; $myvalues['notes_tx'] = NULL; $myvalues['notes_critical_yn'] = NULL; $myvalues['confirmed_by_patient_dt'] = NULL; $myvalues['canceled_reason_tx'] = NULL; $myvalues['canceled_dt'] = NULL; $myvalues['prev_notes'] = array(); } return $myvalues; }
/** * Add rows to the array of all uncommitted notes items */ function addUncommittedDetailsToNotesArray($nSiteID, $nIEN, $oAllUsers, $prev_commit_dt, &$noteTextArray) { //Get all the VISTA baseline information. $oWL = new \raptor\WorklistData($this->m_oContext); $aOrderInfo = $oWL->getDashboardMap(); $this->addFormattedVistaNoteRow($noteTextArray, 'Order CPRS Title', $aOrderInfo, 'Procedure'); $this->addFormattedVistaNoteRow($noteTextArray, 'Order CPRS Created Date/Time', $aOrderInfo, 'RequestedDate'); $this->addFormattedVistaNoteRow($noteTextArray, 'Order CPRS Embedded Due Date', $aOrderInfo, 'DesiredDate'); if (count($noteTextArray) > 0) { $noteTextArray[] = ''; } //Get all the scheduler information. if (isset($aOrderInfo['ScheduledDate']) && $aOrderInfo['ScheduledDate'] > '') { $scheduled_dt = $aOrderInfo['ScheduledDate']; $this->addFormattedVistaNoteRow($noteTextArray, 'Scheduled Date/Time', $scheduled_dt); } $getvalues = array(); $prevnotes = $this->getSchedulerNotes($nSiteID, $nIEN, $getvalues, $prev_commit_dt); foreach ($prevnotes as $prevnoteinfo) { if (count($noteTextArray) > 0) { $noteTextArray[] = ''; } $author_uid = $prevnoteinfo['author_uid']; $created_dt = $prevnoteinfo['created_dt']; $notes_tx = $prevnoteinfo['notes_tx']; $notes_critical_yn = $prevnoteinfo['notes_critical_yn']; $userinfo = $oAllUsers->getByUID($author_uid); if ($userinfo == NULL) { $fullname = 'RAPTOR user ' . $author_uid; } else { $fullname = $userinfo->getFullName(); } if (trim($notes_tx) == '') { $notes_tx = 'BLANK'; } if ($notes_critical_yn == 1) { $notetype = 'Critical'; } else { $notetype = 'Standard'; } $this->addFormattedVistaNoteRow($noteTextArray, 'Scheduler ' . $notetype . ' Note Date', $created_dt); $this->addFormattedVistaNoteRow($noteTextArray, 'Scheduler ' . $notetype . ' Note Author', $fullname); $this->addFormattedVistaNoteRow($noteTextArray, 'Scheduler ' . $notetype . ' Note Text', $notes_tx); } if (count($noteTextArray) > 0) { $noteTextArray[] = ''; } //Get all the protocol settings $this->loadProtocolFieldValues($nSiteID, $nIEN, $getvalues, $prev_commit_dt); if ($getvalues['protocol_data_from_database']) { $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Settings Approved Date', $getvalues, 'protocol_data_created_dt'); $author_uid = $getvalues['protocol_approval_author_uid']; $userinfo = $oAllUsers->getByUID($author_uid); $fullname = $userinfo->getFullName(); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Settings Approved By', $fullname); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Primary Selection', $getvalues, 'protocol1_nm'); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Secondary Selection', $getvalues, 'protocol2_nm'); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Note Oral Hydration', $getvalues, 'hydration_oral_customtx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Note IV Hydration', $getvalues, 'hydration_iv_customtx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Note Oral Sedation', $getvalues, 'sedation_oral_customtx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Note IV Sedation', $getvalues, 'sedation_iv_customtx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Note Enteric Contrast', $getvalues, 'contrast_enteric_customtx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Note IV Contrast', $getvalues, 'contrast_iv_customtx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Note Enteric Radioisotope', $getvalues, 'radioisotope_enteric_customtx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Note IV Radioisotope', $getvalues, 'radioisotope_iv_customtx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Note Allergy', $getvalues, 'allergy_kw'); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Note Claustrophobic', $getvalues, 'claustrophobic_kw'); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol Note Consent Required', $getvalues, 'consent_req_kw'); } if (count($noteTextArray) > 0) { $noteTextArray[] = ''; } //Collect the protocol notes. $getvalues = array(); $prevnotes = $this->getProtocolNotes($nSiteID, $nIEN, $getvalues, $prev_commit_dt); foreach ($prevnotes as $prevnoteinfo) { if (count($noteTextArray) > 0) { $noteTextArray[] = ''; } $author_uid = $prevnoteinfo['author_uid']; $created_dt = $prevnoteinfo['created_dt']; $notes_tx = $prevnoteinfo['notes_tx']; $userinfo = $oAllUsers->getByUID($author_uid); if ($userinfo == NULL) { $fullname = 'RAPTOR user ' . $author_uid; } else { $fullname = $userinfo->getFullName(); } if (trim($notes_tx) == '') { $notes_tx = 'BLANK'; } $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol General Note Date', $created_dt); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol General Note Author', $fullname); $this->addFormattedVistaNoteRow($noteTextArray, 'Protocol General Note Text', $notes_tx); } if (count($noteTextArray) > 0) { $noteTextArray[] = ''; } //raptor_ticket_contraindication $sRowLabel = '[Contraindication Acknowledgement'; $query = db_select('raptor_ticket_contraindication', 't')->fields('t')->condition('siteid', $nSiteID, '=')->condition('IEN', $nIEN, '='); if ($prev_commit_dt != NULL) { $query->condition('created_dt', $prev_commit_dt, '>'); } $query->orderBy('rule_nm', 'DESC'); $result = $query->execute(); while ($record = $result->fetchAssoc()) { $acknowledged_dt = $record['created_dt']; $rule_nm = $record['rule_nm']; $author_uid = $record['author_uid']; $userinfo = $oAllUsers->getByUID($author_uid); $fullname = $userinfo->getFullName(); $noteTextArray[] = $sRowLabel . $rule_nm . ' acknowledged by ' . $fullname . ' on ' . $acknowledged_dt; } if (count($noteTextArray) > 0) { $noteTextArray[] = ''; } //Collect the exam data. $getvalues = array(); if (count($noteTextArray) > 0) { $noteTextArray[] = ''; } $this->loadExamFieldValues($nSiteID, $nIEN, $getvalues, $prev_commit_dt); if ($getvalues['exam_data_from_database']) { $author_uid = $getvalues['exam_author_uid']; $userinfo = $oAllUsers->getByUID($author_uid); $fullname = $userinfo->getFullName(); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note Author', $fullname); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note Date', $getvalues, 'exam_data_created_dt'); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note Oral Hydration', $getvalues, 'exam_hydration_oral_tx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note IV Hydration', $getvalues, 'exam_hydration_iv_tx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note Oral Sedation', $getvalues, 'exam_sedation_oral_tx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note IV Sedation', $getvalues, 'exam_sedation_iv_tx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note Enteric Contrast', $getvalues, 'exam_contrast_enteric_tx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note IV Contrast', $getvalues, 'exam_contrast_iv_tx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note Enteric Radioisotope', $getvalues, 'exam_radioisotope_enteric_tx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note IV Radioisotope', $getvalues, 'exam_radioisotope_iv_tx'); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note Consent Received', $getvalues, 'exam_consent_received_kw'); $dose_details = $getvalues['exam_radioisotope_radiation_dose_map']; if (is_array($dose_details)) { foreach ($dose_details as $uom => $values) { $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note Radioisotope Radiation UoM', $uom); foreach ($values as $dose_record) { $dose = $dose_record['dose']; $qcd = $dose_record['dose_type_cd']; $qterm = $qcd == 'E' ? ' (Estimate)' : ($qcd == 'A' ? ' (Actual)' : (trim($qcd) > '' ? ' (' . $qcd . ')' : '')); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note Radioisotope Radiation Dose', $dose . ' ' . $uom . $qterm); } } } $dose_details = $getvalues['exam_other_radiation_dose_map']; if (is_array($dose_details)) { foreach ($dose_details as $uom => $values) { $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note Equipment Radiation UoM', $uom); foreach ($values as $dose_record) { $dose = $dose_record['dose']; $qcd = $dose_record['dose_type_cd']; $qterm = $qcd == 'E' ? ' (Estimate)' : ($qcd == 'A' ? ' (Actual)' : (trim($qcd) > '' ? ' (' . $qcd . ')' : '')); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam Note Equipment Radiation Dose', $dose . ' ' . $uom . $qterm); } } } } $prevnotes = $this->getExamNotes($nSiteID, $nIEN, $getvalues, $prev_commit_dt); foreach ($prevnotes as $prevnoteinfo) { if (count($noteTextArray) > 0) { $noteTextArray[] = ''; } $author_uid = $prevnoteinfo['author_uid']; $created_dt = $prevnoteinfo['created_dt']; $notes_tx = $prevnoteinfo['notes_tx']; $userinfo = $oAllUsers->getByUID($author_uid); if ($userinfo == NULL) { $fullname = 'RAPTOR user ' . $author_uid; } else { $fullname = $userinfo->getFullName(); } if (trim($notes_tx) == '') { $notes_tx = 'BLANK'; } $this->addFormattedVistaNoteRow($noteTextArray, 'Exam General Note Date', $created_dt); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam General Note Author', $fullname); $this->addFormattedVistaNoteRow($noteTextArray, 'Exam General Note Text', $notes_tx); } if (count($noteTextArray) > 0) { $noteTextArray[] = ''; } //Get raptor_ticket_interpret_notes $getvalues = array(); $prevnotes = $this->getInterpretationNotes($nSiteID, $nIEN, $getvalues, $prev_commit_dt); foreach ($prevnotes as $prevnoteinfo) { $author_uid = $prevnoteinfo['author_uid']; $created_dt = $prevnoteinfo['created_dt']; $notes_tx = $prevnoteinfo['notes_tx']; $userinfo = $oAllUsers->getByUID($author_uid); if ($userinfo == NULL) { $fullname = 'RAPTOR user ' . $author_uid; } else { $fullname = $userinfo->getFullName(); } if (trim($notes_tx) == '') { $notes_tx = 'BLANK'; } $this->addFormattedVistaNoteRow($noteTextArray, 'Interpretation General Note Date', $created_dt); $this->addFormattedVistaNoteRow($noteTextArray, 'Interpretation General Note Author', $fullname); $this->addFormattedVistaNoteRow($noteTextArray, 'Interpretation General Note Text', $notes_tx); } }