public function test(CqmPatient $patient, $beginDate, $endDate) { if (Immunizations::checkHepA($patient, $beginDate, $endDate)) { return true; } return false; }
public function test(CqmPatient $patient, $beginDate, $endDate) { if (Immunizations::checkDtap($patient, $beginDate, $endDate) || Immunizations::checkIpv($patient, $beginDate, $endDate) || Immunizations::checkMmr($patient, $beginDate, $endDate) || Immunizations::checkHib($patient, $beginDate, $endDate) || Immunizations::checkHepB($patient, $beginDate, $endDate) || Immunizations::checkVzv($patient, $beginDate, $endDate) || Immunizations::checkPheumococcal($patient, $beginDate, $endDate) || Immunizations::checkHepA($patient, $beginDate, $endDate) || Immunizations::checkRotavirus_2014($patient, $beginDate, $endDate) || Immunizations::checkInfluenza($patient, $beginDate, $endDate)) { return true; } return false; }
public function test(CqmPatient $patient, $beginDate, $endDate) { if (Immunizations::checkDtap($patient, $beginDate, $endDate) && Immunizations::checkIpv($patient, $beginDate, $endDate) && (Immunizations::checkMmr($patient, $beginDate, $endDate) && !Helper::checkAllergy(Allergy::POLYMYXIN, $patient, $patient->dob, $endDate)) && Immunizations::checkVzv($patient, $beginDate, $endDate) && Immunizations::checkHepB($patient, $beginDate, $endDate)) { return true; } return false; }
private function getObjectiveExtraDataByEid($eid) { $ExtraData = ''; $Medications = new Medications(); $medications = $Medications->getPatientMedicationsByEid($eid); if (!empty($medications)) { $lis = ''; foreach ($medications as $foo) { $lis .= '<li>' . $foo['STR'] . '</li>'; } $ExtraData .= '<p>Medications:</p>'; $ExtraData .= '<ul class="ProgressNote-ul">' . $lis . '</ul>'; } unset($Medications); $Immunizations = new Immunizations(); $immunizations = $Immunizations->getImmunizationsByEncounterID($eid); if (!empty($immunizations)) { $lis = ''; foreach ($immunizations as $foo) { $lis .= '<li>Vaccine name: ' . $foo['vaccine_name'] . '<br>'; $lis .= 'Vaccine ID: (' . $foo['code_type'] . ')' . $foo['code'] . '<br>'; $lis .= 'Manufacturer: ' . $foo['manufacturer'] . '<br>'; $lis .= 'Lot Number: ' . $foo['lot_number'] . '<br>'; $lis .= 'Dose: ' . $foo['administer_amount'] . ' ' . $foo['administer_units'] . '<br>'; $lis .= 'Administered By: ' . $foo['administered_by'] . ' </li>'; } $ExtraData .= '<p>Immunizations:</p>'; $ExtraData .= '<ul class="ProgressNote-ul">' . $lis . '</ul>'; } unset($Immunizations); $Allergies = new Allergies(); $allergies = $Allergies->getPatientAllergiesByEid($eid); if (!empty($allergies)) { $lis = ''; foreach ($allergies as $foo) { $lis .= '<li>Allergy: ' . $foo['allergy'] . ' (' . $foo['allergy_type'] . ')<br>'; $lis .= 'Reaction: ' . $foo['reaction'] . '<br>'; $lis .= 'Severity: ' . $foo['severity'] . '<br>'; $lis .= 'Location: ' . $foo['location'] . '<br>'; $lis .= 'Active?: ' . ($foo['end_date'] != null ? 'Yes' : 'No') . '</li>'; } $ExtraData .= '<p>Allergies:</p>'; $ExtraData .= '<ul class="ProgressNote-ul">' . $lis . '</ul>'; } unset($Allergies); /** * Active Problems found in this Encounter */ $ActiveProblems = new ActiveProblems(); $activeProblems = $ActiveProblems->getPatientActiveProblemByEid($eid); if (!empty($activeProblems)) { $lis = ''; foreach ($activeProblems as $foo) { $lis .= '<li>[' . $foo['code'] . '] - ' . $foo['code_text'] . ' </li>'; } $ExtraData .= '<p>Active Problems:</p>'; $ExtraData .= '<ul class="ProgressNote-ul">' . $lis . '</ul>'; } unset($ActiveProblems); return $ExtraData; }
public function postCompileBilling() { $eid = Session::get('eid'); $pid = Session::get('pid'); $practice_id = Session::get('practice_id'); $row = Demographics::find($pid); $encounterInfo = Encounters::find($eid); $dos1 = $this->human_to_unix($encounterInfo->encounter_DOS); $dos = date('mdY', $dos1); $dos2 = date('m/d/Y', $dos1); $pos = $encounterInfo->encounter_location; $assessment_data = Assessment::find($eid); $icd_pointer = ''; if ($assessment_data->assessment_1 != '') { $icd_pointer .= "A"; } if ($assessment_data->assessment_2 != '') { $icd_pointer .= "B"; } if ($assessment_data->assessment_3 != '') { $icd_pointer .= "C"; } if ($assessment_data->assessment_4 != '') { $icd_pointer .= "D"; } $labsInfo = Labs::find($eid); if ($labsInfo) { if ($labsInfo->labs_ua_urobili != '' || $labsInfo->labs_ua_bilirubin != '' || $labsInfo->labs_ua_ketones != '' || $labsInfo->labs_ua_glucose != '' || $labsInfo->labs_ua_protein != '' || $labsInfo->labs_ua_nitrites != '' || $labsInfo->labs_ua_leukocytes != '' || $labsInfo->labs_ua_blood != '' || $labsInfo->labs_ua_ph != '' || $labsInfo->labs_ua_spgr != '' || $labsInfo->labs_ua_color != '' || $labsInfo->labs_ua_clarity != '') { $this->compile_procedure_billing('81002', $eid, $pid, $dos2, $icd_pointer, $practice_id); } if ($labsInfo->labs_upt != '') { $this->compile_procedure_billing('81025', $eid, $pid, $dos2, $icd_pointer, $practice_id); } if ($labsInfo->labs_strep != '') { $this->compile_procedure_billing('87880', $eid, $pid, $dos2, $icd_pointer, $practice_id); } if ($labsInfo->labs_mono != '') { $this->compile_procedure_billing('86308', $eid, $pid, $dos2, $icd_pointer, $practice_id); } if ($labsInfo->labs_flu != '') { $this->compile_procedure_billing('87804', $eid, $pid, $dos2, $icd_pointer, $practice_id); } if ($labsInfo->labs_glucose != '') { $this->compile_procedure_billing('82962', $eid, $pid, $dos2, $icd_pointer, $practice_id); } } $result9 = Procedure::find($eid); if ($result9) { $this->compile_procedure_billing($result9->proc_cpt, $eid, $pid, $dos2, $icd_pointer, $practice_id); } $result11 = Immunizations::where('eid', '=', $eid)->get(); if ($result11) { foreach ($result11 as $row11) { $this->compile_procedure_billing($row11->cpt, $eid, $pid, $dos2, $icd_pointer, $practice_id); } } echo 'CPT codes complied from the encounter!'; }
protected function page_ccr($pid) { $data['patientInfo'] = Demographics::find($pid); $data['dob'] = date('m/d/Y', $this->human_to_unix($data['patientInfo']->DOB)); $data['insuranceInfo'] = ''; $query_in = Insurance::where('pid', '=', $pid)->where('insurance_plan_active', '=', 'Yes')->get(); if ($query_in) { foreach ($query_in as $row_in) { $data['insuranceInfo'] .= $row_in->insurance_plan_name . '; ID: ' . $row_in->insurance_id_num . '; Group: ' . $row_in->insurance_group . '; ' . $row_in->insurance_insu_lastname . ', ' . $row_in->insurance_insu_firstname . '<br><br>'; } } $body = 'Active Issues:<br />'; $query = Issues::where('pid', '=', $pid)->where('issue_date_inactive', '=', '0000-00-00 00:00:00')->get(); if ($query) { $body .= '<ul>'; foreach ($query as $row) { $body .= '<li>' . $row->issue . '</li>'; } $body .= '</ul>'; } else { $body .= 'None.'; } $body .= '<hr />Active Medications:<br />'; $query1 = Rx_list::where('pid', '=', $pid)->where('rxl_date_inactive', '=', '0000-00-00 00:00:00')->where('rxl_date_old', '=', '0000-00-00 00:00:00')->get(); if ($query1) { $body .= '<ul>'; foreach ($query1 as $row1) { if ($row1->rxl_sig == '') { $body .= '<li>' . $row1->rxl_medication . ' ' . $row1->rxl_dosage . ' ' . $row1->rxl_dosage_unit . ', ' . $row1->rxl_instructions . ' for ' . $row1->rxl_reason . '</li>'; } else { $body .= '<li>' . $row1->rxl_medication . ' ' . $row1->rxl_dosage . ' ' . $row1->rxl_dosage_unit . ', ' . $row1->rxl_sig . ' ' . $row1->rxl_route . ' ' . $row1->rxl_frequency . ' for ' . $row1->rxl_reason . '</li>'; } } $body .= '</ul>'; } else { $body .= 'None.'; } $body .= '<hr />Immunizations:<br />'; $query2 = Immunizations::where('pid', '=', $pid)->orderBy('imm_immunization', 'asc')->orderBy('imm_sequence', 'asc')->get(); if ($query2) { $body .= '<ul>'; foreach ($query2 as $row2) { $sequence = ''; if ($row2->imm_sequence == '1') { $sequence = ', first,'; } if ($row2->imm_sequence == '2') { $sequence = ', second,'; } if ($row2->imm_sequence == '3') { $sequence = ', third,'; } if ($row2->imm_sequence == '4') { $sequence = ', fourth,'; } if ($row2->imm_sequence == '5') { $sequence = ', fifth,'; } $body .= '<li>' . $row2->imm_immunization . $sequence . ' given on ' . date('F jS, Y', $this->human_to_unix($row2->imm_date)) . '</li>'; } $body .= '</ul>'; } else { $body .= 'None.'; } $body .= '<hr />Allergies:<br />'; $query3 = Allergies::where('pid', '=', $pid)->where('allergies_date_inactive', '=', '0000-00-00 00:00:00')->get(); if ($query3) { $body .= '<ul>'; foreach ($query3 as $row3) { $body .= '<li>' . $row3->allergies_med . ' - ' . $row3->allergies_reaction . '</li>'; } $body .= '</ul>'; } else { $body .= 'No known allergies.'; } $body .= '<br />Printed by ' . Session::get('displayname') . '.'; $data['letter'] = $body; return View::make('pdf.ccr_page', $data); }
/** * Method setImmunizationsSection() */ private function setImmunizationsSection() { $Immunizations = new Immunizations(); $immunizationsData = $Immunizations->getPatientImmunizationsByPid($this->pid); unset($Immunizations); if (empty($immunizationsData) || $this->isExcluded('immunizations')) { $immunizations['@attributes'] = ['nullFlavor' => 'NI']; } $immunizations['templateId'] = ['@attributes' => ['root' => $this->requiredImmunization ? '2.16.840.1.113883.10.20.22.2.2.1' : '2.16.840.1.113883.10.20.22.2.2']]; $immunizations['code'] = ['@attributes' => ['code' => '11369-6', 'codeSystemName' => 'LOINC', 'codeSystem' => '2.16.840.1.113883.6.1']]; $immunizations['title'] = 'Immunizations'; $immunizations['text'] = ''; if ($this->isExcluded('immunizations')) { $this->addSection(['section' => $immunizations]); return; } if (!empty($immunizationsData)) { $immunizations['text'] = ['table' => ['@attributes' => ['border' => '1', 'width' => '100%'], 'thead' => ['tr' => [['th' => [['@value' => 'Vaccine'], ['@value' => 'Date'], ['@value' => 'Status']]]]], 'tbody' => ['tr' => []]]]; $immunizations['entry'] = []; foreach ($immunizationsData as $item) { $date = preg_replace('/(\\d{4})-(\\d{2})-(\\d{2}) \\d{2}:\\d{2}:\\d{2}/', '$1$2', $item['administered_date']); $administered_by = $this->User->getUserByUid($item['administered_uid']); $immunizations['text']['table']['tbody']['tr'][] = ['td' => [['@value' => ucwords($item['vaccine_name'])], ['@value' => date('F Y', strtotime($item['administered_date']))], ['@value' => 'Completed']]]; $entry['substanceAdministration'] = ['@attributes' => ['classCode' => 'SBADM', 'moodCode' => 'EVN', 'negationInd' => 'false', 'nullFlavor' => 'NI'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.52']], 'id' => ['@attributes' => ['root' => UUID::v4()]], 'code' => ['@attributes' => ['xsi:type' => 'CE', 'code' => 'IMMUNIZ', 'codeSystem' => '2.16.840.1.113883.5.4', 'codeSystemName' => 'ActCode']], 'statusCode' => ['@attributes' => ['code' => 'completed']], 'effectiveTime' => ['@attributes' => ['value' => $date]]]; if (isset($item['administer_amount']) && $item['administer_amount'] != '') { $entry['substanceAdministration']['doseQuantity'] = ['@attributes' => ['value' => $item['administer_amount'], 'unit' => $item['administer_units']]]; } else { $entry['substanceAdministration']['doseQuantity'] = ['@attributes' => ['nullFlavor' => 'UNK']]; } $entry['substanceAdministration']['consumable'] = ['manufacturedProduct' => ['@attributes' => ['classCode' => 'MANU'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.54']], 'manufacturedMaterial' => ['code' => ['@attributes' => ['code' => $item['code'], 'codeSystemName' => 'CVX', 'codeSystem' => '2.16.840.1.113883.12.292', 'displayName' => ucwords($item['vaccine_name'])]]]]]; if (isset($item['lot_number']) && $item['lot_number'] != '') { $entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturedMaterial']['lotNumberText'] = $item['lot_number']; } else { $entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturedMaterial']['lotNumberText'] = ['@attributes' => ['nullFlavor' => 'UNK']]; } if (isset($item['manufacturer']) && $item['manufacturer'] != '') { $entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturerOrganization'] = ['name' => $item['manufacturer']]; } else { $entry['substanceAdministration']['consumable']['manufacturedProduct']['manufacturerOrganization'] = ['@attributes' => ['nullFlavor' => 'UNK']]; } // administered by... $entry['substanceAdministration']['performer']['assignedEntity'] = ['id' => ['@attributes' => ['root' => 'NA']]]; if ($administered_by !== false) { $entry['substanceAdministration']['performer']['assignedEntity']['code'] = ['@attributes' => ['code' => $administered_by['taxonomy'], 'codeSystem' => '2.16.840.1.114222.4.11.1066', 'codeSystemName' => 'NUCC Health Care Provider Taxonomy', 'displayName' => $administered_by['title'] . ' ' . $administered_by['fname'] . ' ' . $administered_by['mname'] . ' ' . $administered_by['lname']]]; } else { $entry['substanceAdministration']['performer']['assignedEntity']['code'] = ['@attributes' => ['nullFlavor' => 'UNK']]; } // immunization education\ if (isset($item['education_date']) && $item['education_date'] != '0000-00-00') { $entry['substanceAdministration']['entryRelationship'] = ['@attributes' => ['typeCode' => 'SUBJ', 'inversionInd' => 'true'], 'act' => ['@attributes' => ['classCode' => 'ACT', 'moodCode' => 'INT'], 'templateId' => ['@attributes' => ['root' => '2.16.840.1.113883.10.20.22.4.20']], 'code' => ['@attributes' => ['code' => '171044003', 'codeSystem' => '2.16.840.1.113883.6.96', 'displayName' => 'immunization education']], 'statusCode' => ['@attributes' => ['code' => 'completed']]]]; } $immunizations['entry'][] = $entry; } } if ($this->requiredImmunization || isset($immunizations['entry'])) { $this->addSection(['section' => $immunizations]); } unset($immunizationsData, $immunizations); }
function sendVXU($params) { try { // set these globally to be used by MSH and PID $this->to = $params->to; $this->from = $params->from; $this->patient = $params->pid; $this->encounter = isset($params->eid) ? $params->eid : 0; $this->type = 'VXU'; // MSH $msh = $this->setMSH(); $msh->setValue('9.1', 'VXU'); $msh->setValue('9.2', 'V04'); $msh->setValue('9.3', 'VXU_V04'); // PID $this->setPID(); // PV1 $this->setPV1(); // Variable Objects to pass filter to MatchaCup $filters = new stdClass(); $filters->filter[0] = new stdClass(); $filters->filter[1] = new stdClass(); // Load the List option model, to do lookups in the Value Code Sets $ListOptions = MatchaModel::setSenchaModel('App.model.administration.ListOptions'); // PD1 - 3.4.10 PD1 - Patient Additional Demographic Segment // If the Publicity is set, on the patient contacts compile this HL7 Message line $filters = new stdClass(); $filters->filter[0] = new stdClass(); $filters->filter[1] = new stdClass(); $filters->filter[0]->property = 'pid'; $filters->filter[0]->value = $this->patient->pid; $filters->filter[1]->property = 'relationship'; $filters->filter[1]->value = 'SEL'; $ContactRecord = $this->PatientContacts->load($filters)->one(); if ($this->notEmpty($ContactRecord)) { $PD1 = $this->hl7->addSegment('PD1'); $filters->filter[0]->property = 'list_id'; $filters->filter[0]->value = 132; $filters->filter[1]->property = 'code'; $filters->filter[1]->value = $ContactRecord->publicity; $Record = $ListOptions->load($filters)->one(); $PD1->setValue('11.1', $Record['option_value']); $PD1->setValue('11.2', $Record['option_name']); $PD1->setValue('11.3', $Record['code_type']); $PD1->setValue('16', 'A'); $PD1->setValue('17', $this->date($this->patient->create_date, false)); $PD1->setValue('18', $this->date($this->patient->create_date, false)); } // NK1 - 3.4.5 NK1 - Next of Kin / Associated Parties Segment $filters->filter[0]->property = 'pid'; $filters->filter[0]->value = $params->pid; $filters->filter[1] = new stdClass(); $Records = $this->PatientContacts->load($filters)->all(); $transactionID = 0; foreach ($Records as $Record) { $transactionID++; $PD1 = $this->hl7->addSegment('NK1'); $PD1->setValue('1', $transactionID); $PD1->setValue('2.1', $Record['middle_name'] . ' ' . $Record['last_name']); $PD1->setValue('2.2', $Record['first_name']); $PD1->setValue('2.7', 'L'); $PD1->setValue('3.1', $Record['relationship']); $filters->filter[0]->property = 'list_id'; $filters->filter[0]->value = 134; $filters->filter[1]->property = 'option_value'; $filters->filter[1]->value = $Record['relationship']; $List = $ListOptions->load($filters)->one(); $PD1->setValue('3.2', $List['option_name']); $PD1->setValue('3.3', $List['code_type']); $PD1->setValue('4.1', $Record['street_mailing_address']); $PD1->setValue('4.3', $Record['city']); $PD1->setValue('4.4', $Record['state']); $PD1->setValue('4.5', $Record['zip']); $PD1->setValue('4.6', $Record['country']); $PD1->setValue('4.7', 'L'); $PD1->setValue('5.2', 'PRN'); $PD1->setValue('5.3', 'PH'); $PD1->setValue('5.6', $Record['phone_area_code']); $PD1->setValue('5.7', $Record['phone_local_number']); } $this->i = MatchaModel::setSenchaModel('App.model.patient.PatientImmunization'); include_once ROOT . '/dataProvider/Immunizations.php'; include_once ROOT . '/dataProvider/Services.php'; $immunization = new Immunizations(); $EncounterServices = new Services(); // Immunizations loop foreach ($params->immunizations as $i) { $immu = $this->i->load($i)->one(); // ORC - 4.5.1 ORC - Common Order Segment $ORC = $this->hl7->addSegment('ORC'); $ORC->setValue('1', 'RE'); //HL70119 $ORC->setValue('3.1', 'GAIA10001'); $ORC->setValue('3.2', $immu['id']); // RXA - 4.14.7 RXA - Pharmacy/Treatment Administration Segment $RXA = $this->hl7->addSegment('RXA'); $RXA->setValue('3.1', $this->date($immu['administered_date'])); //Date/Time Start of Administration $RXA->setValue('4.1', $this->date($immu['administered_date'])); //Date/Time End of Administration //Administered Code $RXA->setValue('5.1', $immu['code']); //Identifier $RXA->setValue('5.2', $immu['vaccine_name']); //Text $RXA->setValue('5.3', $immu['code_type']); //Name of Coding System if ($this->isPresent($immu['administer_amount'])) { $RXA->setValue('6', $immu['administer_amount']); //Administered Amount $RXA->setValue('7.1', $immu['administer_units']); //Identifier $RXA->setValue('7.2', $immu['administer_units']); // Text $RXA->setValue('7.3', 'UCUM'); //Name of Coding System HL70396 } else { $RXA->setValue('6', '999'); //Administered Amount } $RXA->setValue('15', $immu['lot_number']); //Substance LotNumbers // get immunization manufacturer info $mvx = $immunization->getMvxByCode($immu['manufacturer']); $mText = isset($mvx['manufacturer']) ? $mvx['manufacturer'] : ''; //Substance ManufacturerName $RXA->setValue('17.1', $immu['manufacturer']); //Identifier $RXA->setValue('17.2', $mText); //Text $RXA->setValue('17.3', 'MVX'); //Name of Coding System HL70396 $RXA->setValue('21', 'A'); //Action Code // RXR - 4.14.2 RXR - Pharmacy/Treatment Route Segment $RXR = $this->hl7->addSegment('RXR'); // Route $filters->filter[0]->property = 'list_id'; $filters->filter[0]->value = 6; $filters->filter[1]->property = 'option_value'; $filters->filter[1]->value = $immu['route']; $Record = $ListOptions->load($filters)->one(); $RXR->setValue('1.1', $Record['option_value']); $RXR->setValue('1.2', $Record['option_name']); $RXR->setValue('1.3', $Record['code_type']); // Administration Site $filters->filter[0]->property = 'list_id'; $filters->filter[0]->value = 119; $filters->filter[1]->property = 'code'; $filters->filter[1]->value = $immu['administration_site']; $Record = $ListOptions->load($filters)->one(); $RXR->setValue('2.1', $Record['option_value']); $RXR->setValue('2.2', $Record['option_name']); $RXR->setValue('2.3', $Record['code_type']); // OBX - 7.4.2 OBX - Observation/Result Segment $filters->filter[0]->property = 'eid'; $filters->filter[0]->value = $immu['eid']; $filters->filter[1]->property = 'pid'; $filters->filter[1]->value = $immu['pid']; $Records = $EncounterServices->getEncounterServicesByEIDandPID($filters); $obxCount = 1; foreach ($Records as $Record) { $OBX = $this->hl7->addSegment('OBX'); $OBX->setValue('1', $obxCount); $OBX->setValue('2', 'CE'); $OBX->setValue('3.1', '64994-7'); $OBX->setValue('3.2', 'Vaccine funding program eligibility category'); $OBX->setValue('3.3', 'LN'); $OBX->setValue('4', $Record['eid']); $OBX->setValue('5.1', $Record['financial_class']); $OBX->setValue('5.2', $Record['financial_name']); $OBX->setValue('5.3', $Record['code_type']); $OBX->setValue('11', 'F'); $OBX->setValue('17.1', 'VXC40'); $OBX->setValue('17.2', 'Eligibility captured at the immunization level'); $OBX->setValue('17.3', 'CDCPHINVS'); $obxCount++; } $OBX = $this->hl7->addSegment('OBX'); $OBX->setValue('1', $obxCount); $OBX->setValue('2', 'CE'); $OBX->setValue('3.1', '30956-7'); $OBX->setValue('3.2', 'vaccine type'); $OBX->setValue('3.3', 'LN'); $OBX->setValue('4', $immu['id']); $OBX->setValue('5.1', $immu['code']); $OBX->setValue('5.2', $immu['vaccine_name']); $OBX->setValue('5.3', $immu['code_type']); $OBX->setValue('11', 'F'); $obxCount++; $OBX = $this->hl7->addSegment('OBX'); $OBX->setValue('1', $obxCount); $OBX->setValue('2', 'TS'); $OBX->setValue('3.1', '29768-9'); $OBX->setValue('3.2', 'Date vaccine information statement published'); $OBX->setValue('3.3', 'LN'); $OBX->setValue('4', $immu['id']); $OBX->setValue('5', $this->date($immu['education_doc_published'], false)); $OBX->setValue('11', 'F'); $obxCount++; $OBX = $this->hl7->addSegment('OBX'); $OBX->setValue('1', $obxCount); $OBX->setValue('2', 'TS'); $OBX->setValue('3.1', '29769-7'); $OBX->setValue('3.2', 'Date vaccine information statement presented'); $OBX->setValue('3.3', 'LN'); $OBX->setValue('4', $immu['id']); $OBX->setValue('5', $this->date($immu['education_date'], false)); $OBX->setValue('11', 'F'); } $msgRecord = $this->saveMsg(); if (isset($params->delivery) && ($params->delivery = 'download')) { return; } if ($this->to['route'] == 'file') { $response = $this->Save(); } else { $response = $this->Send(); } $msgRecord->response = $response['message']; if ($response['success']) { $msgRecord->status = 3; $this->m->save($msgRecord); } else { $msgRecord->status = preg_match('/^socket/', $response['message']) ? 2 : 4; // if socket error put back in queue $msgRecord->error = $response['message']; $this->m->save($msgRecord); } return ['success' => true]; } catch (Exception $Error) { return ['success' => false]; } }
public function postImmunizationsList() { $query = Immunizations::where('pid', '=', Session::get('pid'))->orderBy('imm_immunization', 'asc')->orderBy('imm_sequence', 'asc')->get(); $result = ''; if ($query) { $result .= '<ul>'; foreach ($query as $row) { $sequence = ''; if ($row->imm_sequence == '1') { $sequence = ', first'; } if ($row->imm_sequence == '2') { $sequence = ', second'; } if ($row->imm_sequence == '3') { $sequence = ', third'; } if ($row->imm_sequence == '4') { $sequence = ', fourth'; } if ($row->imm_sequence == '5') { $sequence = ', fifth'; } $result .= '<li>' . $row->imm_immunization . $sequence . '</li>'; } $result .= '</ul>'; } else { $result .= ' None.'; } echo $result; }
public function postImmunizationsList($mobile = false) { $query = Immunizations::where('pid', '=', Session::get('pid'))->orderBy('imm_immunization', 'asc')->orderBy('imm_sequence', 'asc')->get(); $result = ''; if ($query) { if ($mobile == false) { $result .= '<ul>'; foreach ($query as $row) { $sequence = ''; if ($row->imm_sequence == '1') { $sequence = ', first'; } if ($row->imm_sequence == '2') { $sequence = ', second'; } if ($row->imm_sequence == '3') { $sequence = ', third'; } if ($row->imm_sequence == '4') { $sequence = ', fourth'; } if ($row->imm_sequence == '5') { $sequence = ', fifth'; } $result .= '<li>' . $row->imm_immunization . $sequence . '</li>'; } $result .= '</ul>'; } else { $list_array = []; $form = []; $i = 1; $columns = Schema::getColumnListing('immunizations'); $row_index = $columns[0]; $list_array[] = ['label' => 'Add Immunization', 'pid' => Session::get('pid'), 'href' => action('AjaxChartController@postMobileEditPage', array('immunizations', $row_index, '0')), 'origin' => '../ajaxchart/immunizations-list/true']; foreach ($query as $row) { $sequence = ''; if ($row->imm_sequence == '1') { $sequence = ', first'; } if ($row->imm_sequence == '2') { $sequence = ', second'; } if ($row->imm_sequence == '3') { $sequence = ', third'; } if ($row->imm_sequence == '4') { $sequence = ', fourth'; } if ($row->imm_sequence == '5') { $sequence = ', fifth'; } $label = $row->imm_immunization . $sequence; $list_array[] = ['label' => $label, 'pid' => Session::get('pid'), 'href' => action('AjaxChartController@postMobileEditPage', array('immunizations', $row_index, $row->{$row_index})), 'origin' => '../ajaxchart/immunizations-list/true']; } $result .= $this->mobile_result_build($list_array, 'mobile_immunizations_list'); } } else { $result .= ' None.'; } echo $result; }
public function get_EncounterTokensData($eid, $allNeededInfo, $tokens) { $params = new stdClass(); $params->eid = $eid; $encounter = $this->encounter->getEncounter($params); if (!isset($encounter['encounter'])) { return $allNeededInfo; } $encounterCodes = $this->encounter->getEncounterCodes($params); $vitals = end($encounter['encounter']['vitals']); $soap = $encounter['encounter']['soap']; if (isset($encounter['encounter']['reviewofsystemschecks'])) { $rosCks = $encounter['encounter']['reviewofsystemschecks']; unset($rosCks['id'], $rosCks['pid'], $rosCks['eid'], $rosCks['uid'], $rosCks['date']); foreach ($rosCks as $rosc => $num) { if ($num == '' || $num == null || $num == 0) { unset($rosCks[$rosc]); } } } if (isset($encounter['encounter']['reviewofsystems'])) { $reviewofsystems = $encounter['encounter']['reviewofsystems']; unset($reviewofsystems['pid'], $reviewofsystems['eid'], $reviewofsystems['uid'], $reviewofsystems['id'], $reviewofsystems['date']); foreach ($reviewofsystems as $ros => $num) { if ($num == '' || $num == null || $num == 'null') { unset($reviewofsystems[$ros]); } } } $cpt = []; $dx = []; $hcpc = []; $cvx = []; if (isset($encounterCodes['rows'])) { foreach ($encounterCodes['rows'] as $code) { if ($code['code_type'] == 'CPT') { $cpt[] = $code; } elseif ($code['code_type'] == 'ICD' || $code['code_type'] == 'ICD9' || $code['code_type'] == 'ICD10') { $dx[] = $code; } elseif ($code['code_type'] == 'HCPC') { $hcpc[] = $code; } elseif ($code['code_type'] == 'CVX') { $cvx[] = $code; } } } $Medications = new Medications(); $medications = $Medications->getPatientMedicationsByEid($eid); unset($Medications); $Immunizations = new Immunizations(); $immunizations = $Immunizations->getImmunizationsByEid($eid); unset($Immunizations); $Allergies = new Allergies(); $allergies = $Allergies->getPatientAllergiesByEid($eid); unset($Allergies); $ActiveProblems = new ActiveProblems(); $activeProblems = $ActiveProblems->getPatientActiveProblemByEid($eid); unset($ActiveProblems); $encounter = $encounter['encounter']; $encounterInformation = ['[ENCOUNTER_START_DATE]' => $encounter['service_date'], '[ENCOUNTER_END_DATE]' => $encounter['close_date'], '[ENCOUNTER_BRIEF_DESCRIPTION]' => $encounter['brief_description'], '[ENCOUNTER_SENSITIVITY]' => $encounter['priority'], '[ENCOUNTER_WEIGHT_LBS]' => $vitals['weight_lbs'], '[ENCOUNTER_WEIGHT_KG]' => $vitals['weight_kg'], '[ENCOUNTER_HEIGHT_IN]' => $vitals['height_in'], '[ENCOUNTER_HEIGHT_CM]' => $vitals['height_cm'], '[ENCOUNTER_BP_SYSTOLIC]' => $vitals['bp_systolic'], '[ENCOUNTER_BP_DIASTOLIC]' => $vitals['bp_diastolic'], '[ENCOUNTER_PULSE]' => $vitals['pulse'], '[ENCOUNTER_RESPIRATION]' => $vitals['respiration'], '[ENCOUNTER_TEMP_FAHRENHEIT]' => $vitals['temp_f'], '[ENCOUNTER_TEMP_CELSIUS]' => $vitals['temp_c'], '[ENCOUNTER_TEMP_LOCATION]' => $vitals['temp_location'], '[ENCOUNTER_OXYGEN_SATURATION]' => $vitals['oxygen_saturation'], '[ENCOUNTER_HEAD_CIRCUMFERENCE_IN]' => $vitals['head_circumference_in'], '[ENCOUNTER_HEAD_CIRCUMFERENCE_CM]' => $vitals['head_circumference_cm'], '[ENCOUNTER_WAIST_CIRCUMFERENCE_IN]' => $vitals['waist_circumference_in'], '[ENCOUNTER_WAIST_CIRCUMFERENCE_CM]' => $vitals['waist_circumference_cm'], '[ENCOUNTER_BMI]' => $vitals['bmi'], '[ENCOUNTER_BMI_STATUS]' => $vitals['bmi_status'], '[ENCOUNTER_SUBJECTIVE]' => isset($soap['subjective']) ? $soap['subjective'] : '', '[ENCOUNTER_OBJECTIVE]' => isset($soap['objective']) ? $soap['objective'] : '', '[ENCOUNTER_ASSESSMENT]' => isset($soap['assessment']) ? $soap['assessment'] : '', '[ENCOUNTER_PLAN]' => isset($soap['plan']) ? $soap['plan'] : '', '[ENCOUNTER_CPT_CODES]' => $this->tokensForEncountersList($cpt, 1), '[ENCOUNTER_ICD_CODES]' => $this->tokensForEncountersList($dx, 2), '[ENCOUNTER_HCPC_CODES]' => $this->tokensForEncountersList($hcpc, 3), '[ENCOUNTER_ALLERGIES_LIST]' => $this->tokensForEncountersList($allergies, 4), '[ENCOUNTER_MEDICATIONS_LIST]' => $this->tokensForEncountersList($medications, 5), '[ENCOUNTER_ACTIVE_PROBLEMS_LIST]' => $this->tokensForEncountersList($activeProblems, 6), '[ENCOUNTER_IMMUNIZATIONS_LIST]' => $this->tokensForEncountersList($immunizations, 7), '[ENCOUNTER_REVIEWOFSYSTEMSCHECKS]' => isset($rosCks) ? $this->tokensForEncountersList($rosCks, 11) : '', '[ENCOUNTER_REVIEWOFSYSTEMS]' => isset($reviewofsystems) ? $this->tokensForEncountersList($reviewofsystems, 12) : '']; foreach ($tokens as $i => $tok) { if (isset($encounterInformation[$tok]) && ($allNeededInfo[$i] == '' || $allNeededInfo[$i] == null)) { $allNeededInfo[$i] = $encounterInformation[$tok]; } } return $allNeededInfo; }
function sendVXU($params) { // set these globally to be used by MSH and PID $this->to = $params->to; $this->from = $params->from; $this->patient = $params->pid; $this->encounter = isset($params->eid) ? $params->eid : 0; $this->type = 'VXU'; // MSH $msh = $this->setMSH(); $msh->setValue('9.1', 'VXU'); $msh->setValue('9.2', 'V04'); // $msh->setValue('9.3', 'VXU_V04'); // PID $this->setPID(); // PV1 $this->setPV1(); $this->i = MatchaModel::setSenchaModel('App.model.patient.PatientImmunization'); include_once ROOT . '/dataProvider/Immunizations.php'; $immunization = new Immunizations(); // immunizations loop foreach ($params->immunizations as $i) { $immu = $this->i->load($i)->one(); // ROC $roc = $this->hl7->addSegment('ORC'); $roc->setValue('1', 'RE'); //HL70119 // RXA $rxa = $this->hl7->addSegment('RXA'); $rxa->setValue('3.1', $this->date($immu['administered_date'])); //Date/Time Start of Administration $rxa->setValue('4.1', $this->date($immu['administered_date'])); //Date/Time End of Administration //Administered Code $rxa->setValue('5.1', $immu['code']); //Identifier $rxa->setValue('5.2', $immu['vaccine_name']); //Text $rxa->setValue('5.3', $immu['code_type']); //Name of Coding System if ($this->isPresent($immu['administer_amount'])) { $rxa->setValue('6', $immu['administer_amount']); //Administered Amount $rxa->setValue('7.1', $immu['administer_amount']); //Identifier $rxa->setValue('7.2', 'millimeters'); //Text $rxa->setValue('7.3', 'ISO+'); //Name of Coding System HL70396 } else { $rxa->setValue('6', '999'); //Administered Amount } $rxa->setValue('15', $immu['lot_number']); //Substance LotNumbers // get immunization manufacturer info $mvx = $immunization->getMvxByCode($immu['manufacturer']); $mText = isset($mvx['manufacturer']) ? $mvx['manufacturer'] : ''; //Substance ManufacturerName $rxa->setValue('17.1', $immu['manufacturer']); //Identifier $rxa->setValue('17.2', $mText); //Text $rxa->setValue('17.3', 'MVX'); //Name of Coding System HL70396 $rxa->setValue('21', 'A'); //Action Code } $msgRecord = $this->saveMsg(); if ($this->to['route'] == 'file') { $response = $this->Save(); } else { $response = $this->Send(); } $msgRecord->response = $response['message']; if ($response['success']) { $msgRecord->status = 3; $this->m->save($msgRecord); } else { $msgRecord->status = preg_match('/^socket/', $response['message']) ? 2 : 4; // if socket error put back in queue $msgRecord->error = $response['message']; $this->m->save($msgRecord); } }