/** * kirjaa käyttäjän ulos palvelusta. Poistaa user_islogged, logged_user, logged_user_email sessiot käytöstä. * Ja jos harjoittelu on käynnissä niin lopetetaan harjoittelu */ public function logout() { unset($_SESSION['user_is_logged']); unset($_SESSION['logged_user']); unset($_SESSION['logged_user_email']); //jos harjoitus ollut käynnissä, päätetään se if (isset($_SESSION['practice_id'])) { require_once 'classes/Practice.class.php'; $practice = new Practice(); $practice->endp(); $practice = NULL; } }
public function run() { if (!$this->model || !$this->attribute) { return null; } $extraData = $this->model->isNewRecord ? ['sign' => $this->model->sign] : ['id' => $this->model->id]; $previewImages = []; $previewImagesConfig = []; $existModelImages = EntityToFile::find()->where('entity_model_name = :emn', [':emn' => $this->model->formName()]); if ($this->saveAttribute !== null) { $existModelImages->andWhere('attribute = :attr', [':attr' => $this->saveAttribute]); } $existModelImages = $this->model->isNewRecord ? $existModelImages->andWhere('temp_sign = :ts', [':ts' => $this->model->sign]) : $existModelImages->andWhere('entity_model_id = :id', [':id' => $this->model->id]); $existModelImages = $existModelImages->orderBy('position DESC')->all(); /** * @var \common\models\EntityToFile $file */ foreach ($existModelImages as $image) { $fileName = $image->file->base_name . '.' . $image->file->extension; $previewImages[] = Html::img(FPM::originalSrc($image->file_id), ['class' => 'file-preview-image', 'id' => 'preview-image-' . $image->file_id]); $previewImagesConfig[] = ['caption' => $fileName, 'width' => '120px', 'url' => ImagesUploadModel::deleteImageUrl(['id' => $image->id]), 'key' => $image->id]; } $output = Html::hiddenInput('urlForSorting', ImagesUploadModel::sortImagesUrl(), ['id' => 'urlForSorting']); $output .= Html::hiddenInput('aspectRatio', $this->aspectRatio, ['class' => 'aspect-ratio']); $output .= FileInput::widget(['model' => $this->model, 'attribute' => $this->attribute, 'options' => ['multiple' => $this->multiple, 'accept' => 'image/*'], 'pluginOptions' => ['dropZoneEnabled' => false, 'browseClass' => 'btn btn-success', 'browseIcon' => '<i class="glyphicon glyphicon-picture"></i> ', 'removeClass' => "btn btn-danger", 'removeIcon' => '<i class="glyphicon glyphicon-trash"></i> ', 'uploadClass' => "btn btn-info", 'uploadIcon' => '<i class="glyphicon glyphicon-upload"></i> ', 'uploadUrl' => Url::to($this->uploadUrl), 'allowedFileTypes' => ['image'], 'allowedPreviewTypes' => ['image'], 'uploadExtraData' => $extraData, 'initialPreview' => $previewImages, 'initialPreviewConfig' => $previewImagesConfig, 'overwriteInitial' => false, 'showRemove' => false, 'otherActionButtons' => $this->render('_crop_button'), 'fileActionSettings' => ['indicatorSuccess' => $this->render('_success_buttons_template')]], 'pluginEvents' => ['fileuploaded' => 'function(event, data, previewId, index) { var elem = $("#"+previewId).find(".file-actions .file-upload-indicator .kv-file-remove"); var cropElem = $("#"+previewId).find(".file-actions .crop-link"); var img = $("#"+previewId).find("img"); //id for cropped image replace img.attr("id", "preview-image-"+data.response.imgId); elem.attr("data-url", data.response.deleteUrl); elem.attr("data-key", data.response.id); cropElem.attr("href", data.response.cropUrl); //Resort images saveSort(); //Fix crop url for old images fixMultiUploadImageCropUrl(); }', 'fileloaded' => 'function(file, previewId, index, reader) { //Fix url for old images fixMultiUploadImageCropUrl(); }']]); $output .= '<br>'; $output .= $this->render('_modal'); return $output; }
public function editPracticeAction() { $id = (int) $this->_getParam('id'); $enumerationId = (int) $this->_getParam('enumerationId'); $orm = new Practice(); if ($id > 0) { $orm->practiceId = $id; $orm->populate(); } $form = new WebVista_Form(array('name' => 'edit-practice')); $form->setAction(Zend_Registry::get('baseUrl') . 'facilities.raw/process-edit-practice'); $form->loadORM($orm, 'Practice'); $form->setWindow('windowEditPracticeId'); $this->view->form = $form; $this->view->enumerationId = $enumerationId; $this->render('edit-practice'); }
public function setFilters(array $filters) { if (!is_array($filters) || empty($filters)) { throw new Exception(__('Invalid filters')); } $filtersArray = array(); foreach ($filters as $filter) { if (!class_exists($filter)) { $msg = __("Filter {$filter} does not exists"); throw new Exception($msg); } $class = new $filter(); if (!$class instanceof WebVista_Model_ORM) { $msg = __("Filter {$filter} is not an instance of WebVista_Model_ORM"); throw new Exception($msg); } $filtersArray[$filter] = $filter; } $this->_rows = array(); $enumeration = new Enumeration(); $enumeration->populateByUniqueName(self::ENUM_NAME); $enumerationClosure = new EnumerationClosure(); if (isset($filtersArray['Practice'])) { $practices = $enumerationClosure->getAllDescendants($enumeration->enumerationId, 1); foreach ($practices as $enumPractice) { if (!$enumPractice->ormId > 0 || $enumPractice->ormClass != 'Practice') { continue; } $practice = new Practice(); $practice->practiceId = $enumPractice->ormId; $practice->populate(); if (isset($filtersArray['Building'])) { $buildings = $enumerationClosure->getAllDescendants($enumPractice->enumerationId, 1); foreach ($buildings as $enumBuilding) { if (!$enumBuilding->ormId > 0 || $enumBuilding->ormClass != 'Building') { continue; } $building = new Building(); $building->buildingId = $enumBuilding->ormId; $building->populate(); if (isset($filtersArray['Room'])) { $rooms = $enumerationClosure->getAllDescendants($enumBuilding->enumerationId, 1); foreach ($rooms as $enumRoom) { if (!$enumRoom->ormId > 0 || $enumRoom->ormClass != 'Room') { continue; } $room = new Room(); $room->roomId = $enumRoom->ormId; $room->populate(); $this->_rows[] = array('Practice' => $practice, 'Building' => $building, 'Room' => $room); } } else { $this->_rows[] = array('Practice' => $practice, 'Building' => $building); } } } else { $this->_rows[] = $practice; } } } else { if (isset($filtersArray['Building'])) { $buildings = $enumerationClosure->getAllDescendants($enumPractice->enumerationId, 1); foreach ($buildings as $enumBuilding) { if (!$enumBuilding->ormId > 0 || $enumBuilding->ormClass != 'Building') { continue; } $building = new Building(); $building->buildingId = $enumBuilding->ormId; $building->populate(); if (isset($filtersArray['Room'])) { $rooms = $enumerationClosure->getAllDescendants($enumBuilding->enumerationId, 1); foreach ($rooms as $enumRoom) { if (!$enumRoom->ormId > 0 || $enumRoom->ormClass != 'Room') { continue; } $room = new Room(); $room->roomId = $enumRoom->ormId; $room->populate(); $this->_rows[] = array('Building' => $building, 'Room' => $room); } } else { $this->_rows[] = $building; } } } else { if (isset($filtersArray['Room'])) { $rooms = $enumerationClosure->getAllDescendants($enumBuilding->enumerationId, 1); foreach ($rooms as $enumRoom) { if (!$enumRoom->ormId > 0 || $enumRoom->ormClass != 'Room') { continue; } $room = new Room(); $room->roomId = $enumRoom->ormId; $room->populate(); $this->_rows[] = $room; } } } } return $this; }
/** * Imports the 'CcgAssignment' file. * * @param array $data * * @throws Exception If Failed to save commissioning body assignment */ private function importCcgAssignment(array $data) { $practice = Practice::model()->findByAttributes(array('code' => $data['practice_code'])); $ccg = CommissioningBody::model()->findByAttributes(array('code' => $data['ccg_code'], 'commissioning_body_type_id' => $this->cbtId)); if (!$practice || !$ccg) { return; } $found = false; foreach ($practice->commissioningbodyassigments as $assignment) { if ($assignment->commissioning_body_id == $ccg->id) { $found = true; } else { if ($assignment->commissioning_body->commissioning_body_type_id == $this->cbtId) { if ($assignment->delete() && $this->audit !== 'false') { Audit::add('ProcessHscicDataCommand', 'Assignment Deleted'); } } } } if (!$found) { $assignment = new CommissioningBodyPracticeAssignment(); $assignment->commissioning_body_id = $ccg->id; $assignment->practice_id = $practice->id; if (!$assignment->save()) { throw new Exception('Failed to save commissioning body assignment: ' . print_r($assignment->errors, true)); } if ($this->audit !== 'false') { Audit::add('ProcessHscicDataCommand', 'Assignment Saved'); } } }
<?php session_start(); include 'initclasses.php'; if (isset($_SESSION['practice_start_time'])) { $practice = new Practice(); $practice->endp(); $practice = NULL; } header('Location: main.php');
protected static function _getPatientData($patient, $includeProvider = true, $providerId = null, $roomId = null) { $maritalStatusMap = array('SEPARATED' => 'A', 'DIVORCED' => 'D', 'MARRIED' => 'M', 'SINGLE' => 'S', 'WIDOWED' => 'W'); if (!$patient instanceof Patient) { $patientId = (int) $patient; $patient = new Patient(); $patient->personId = $patientId; $patient->populate(); } $personId = (int) $patient->personId; $person = $patient->person; $maritalStatus = $person->maritalStatus; if (isset($maritalStatusMap[$maritalStatus])) { $maritalStatus = $maritalStatusMap[$maritalStatus]; } $ethnicities = array(); $ethnicities['1'] = 1; $ethnicities['Hispanic/Latino'] = 1; $ethnicities['2'] = 2; $ethnicities['Not Hispanic/Latino'] = 2; $ethnicities['3'] = 3; $ethnicities['Unreported / Refused to Report'] = 3; $races = array(); $races['A'] = 'A'; $races['Asian'] = 'A'; $races['N'] = 'N'; $races['Native Hawaiian'] = 'N'; $races['P'] = 'P'; $races['Other Pacific Islander'] = 'P'; $races['B'] = 'B'; $races['Black / African American'] = 'B'; $races['I'] = 'I'; $races['American Indian / Alaska Native'] = 'I'; $races['W'] = 'C'; $races['White'] = 'C'; $races['M'] = 'M'; $races['More than one race'] = 'M'; $races['E'] = 'E'; $races['Unreported / Refused to Report'] = 'E'; $statistics = PatientStatisticsDefinition::getPatientStatistics($personId); $race = ''; if (isset($statistics['Race'])) { $race = $statistics['Race']; } if (isset($statistics['race'])) { $race = $statistics['race']; } $race = isset($races[$race]) ? $races[$race] : 'E'; $ethnicity = ''; if (isset($statistics['Ethnicity'])) { $ethnicity = $statistics['Ethnicity']; } if (isset($statistics['ethnicity'])) { $ethnicity = $statistics['ethnicity']; } $ethnicity = isset($ethnicities[$ethnicity]) ? $ethnicities[$ethnicity] : '3'; $language = ''; if (isset($statistics['Language'])) { $language = $statistics['Language']; } if (isset($statistics['language'])) { $language = $statistics['language']; } $language = ''; // temporarily set to empty $patientData = array(); $patientData['recordNumber'] = $patient->recordNumber; $patientData['lastName'] = $person->lastName; $patientData['firstName'] = $person->firstName; $patientData['middleName'] = $person->middleName; $patientData['suffix'] = $person->suffix; $patientData['dateOfBirth'] = date('Ymd', strtotime($person->dateOfBirth)); $patientData['gender'] = $person->gender; $patientData['race'] = $race; $patientData['ethnicity'] = $ethnicity; $address = $person->address; $patientData['line1'] = $address->line1; $patientData['line2'] = $address->line2; $patientData['city'] = $address->city; $patientData['state'] = $address->state; $patientData['zip'] = $address->postalCode; $homePhone = ''; $businessPhone = ''; $phoneNumber = new PhoneNumber(); $phoneNumber->personId = $personId; $phones = $phoneNumber->getPhoneNumbers(false); foreach ($phones as $phone) { if ($homePhone == '' && $phone['type'] == 'HP') { $homePhone = $phone['number']; } if ($businessPhone == '' && $phone['type'] == 'TE') { $businessPhone = $phone['number']; } if ($homePhone != '' && $businessPhone != '') { break; } } $patientData['homePhone'] = $homePhone; $patientData['businessPhone'] = $businessPhone; $patientData['language'] = $language; $patientData['maritalStatus'] = $maritalStatus; $patientData['accountNumber'] = ''; $patientData['ssn'] = $patient->person->identifierType == 'SSN' ? $patient->identifier : ''; if (!$includeProvider) { return $patientData; } $data = array(); $data['patient'] = $patientData; if ($providerId === null) { $providerId = (int) $patient->defaultProvider; } $provider = new Provider(); $provider->personId = $providerId; $provider->populate(); $provider->populate(); $providerData = array(); $providerData['id'] = $provider->personId; $providerData['lastName'] = $provider->person->lastName; $providerData['firstName'] = $provider->person->firstName; $providerData['middleName'] = $provider->person->middleName; $providerData['suffix'] = $provider->person->suffix; $room = new Room(); if ($roomId !== null && $roomId > 0) { $room->roomId = (int) $roomId; $room->populate(); $building = $room->building; $practice = $building->practice; //trigger_error('room: '.$roomId.':'.$room->name); } else { $practice = new Practice(); $building = new Building(); $practiceId = (int) $patient->person->primaryPracticeId; $practice->practiceId = $practiceId; $practice->populate(); //trigger_error('primary practice: '.$practiceId.':'.$practice->name); } $providerData['practice'] = $practice->name; $providerData['building'] = $building->name; $providerData['room'] = $room->name; $data['provider'] = $providerData; return $data; }
protected static function _generate4010A1($claimId, array $claim) { static $ctr = 0; static $visits = array(); static $practices = array(); static $insurancePrograms = array(); static $providers = array(); static $patients = array(); $claimId = (int) $claimId; $claimLine = new ClaimLine(); $claimLine->populateByClaimId($claimId); $visitId = (int) $claimLine->visitId; if (!isset($visits[$visitId])) { $visit = new Visit(); $visit->visitId = $visitId; $visit->populate(); $visits[$visitId] = $visit; } $visit = $visits[$visitId]; $patientId = (int) $visit->patientId; if (!isset($patients[$patientId])) { $patient = new Patient(); $patient->personId = $patientId; $patient->populate(); $patients[$patientId] = $patient; } $patient = $patients[$patientId]; $practiceId = (int) $visit->practiceId; if (!isset($practices[$practiceId])) { $practice = new Practice(); $practice->practiceId = $practiceId; $practice->populate(); $practices[$practiceId] = $practice; } $practice = $practices[$practiceId]; $insuranceProgramId = (int) $visit->activePayerId; if (!isset($insurancePrograms[$insuranceProgramId])) { $insurance = new InsuranceProgram(); $insurance->insuranceProgramId = $insuranceProgramId; $insurance->populate(); $insurancePrograms[$insuranceProgramId] = $insurance; } $insuranceProgram = $insurancePrograms[$insuranceProgramId]; $providerId = (int) $visit->treatingPersonId; if (!isset($providers[$providerId])) { $provider = new Provider(); $provider->personId = $providerId; $provider->populate(); $providers[$providerId] = $provider; } $provider = $providers[$providerId]; $billAs = (int) $provider->billAs; if ($billAs > 0) { $providerId = $billAs; if (!isset($providers[$providerId])) { $provider = new Provider(); $provider->personId = $providerId; $provider->populate(); $providers[$providerId] = $provider; } $provider = $providers[$providerId]; } $subscribers = array(); $enumeration = new Enumeration(); $enumeration->populateByUniqueName(InsuranceProgram::INSURANCE_ENUM_NAME); $enumerationClosure = new EnumerationClosure(); foreach ($enumerationClosure->getAllDescendants($enumeration->enumerationId, 1, true) as $enum) { $rowset = $enumerationClosure->getAllDescendants($enum->enumerationId, 1, true); if ($enum->key == InsuranceProgram::INSURANCE_SUBSCRIBER_ENUM_KEY) { foreach ($rowset as $row) { $subscribers[$row->key] = $row->name; } break; } } $insuredRelationship = new InsuredRelationship(); $db = Zend_Registry::get('dbAdapter'); $sqlSelect = $db->select()->from($insuredRelationship->_table)->where('insurance_program_id = ?', (int) $insuranceProgram->insuranceProgramId)->where('person_id = ?', (int) $patientId)->where('active = 1')->order('program_order')->limit(1); if ($row = $db->fetchRow($sqlSelect)) { $insuredRelationship->populateWithArray($row); } $subs = $insuredRelationship->subscriber; $subscriberAddr = $subs->address; $relationship = null; $relationshipCode = $insuredRelationship->subscriberToPatientRelationship; if (isset($subscribers[$relationshipCode])) { $relationship = $subscribers[$relationshipCode]; } if ($relationship === null) { $relationship = 'Self'; $relationshipCode = 18; $subs = new Person(); $subs->personId = $insuredRelationship->personId; $subs->populate(); } $subscriber = array('id' => (int) $subs->personId, 'relationship_code' => $relationshipCode, 'group_number' => $insuredRelationship->groupNumber, 'group_name' => $insuredRelationship->groupName, 'relationship' => $relationship, 'last_name' => $subs->lastName, 'first_name' => $subs->firstName, 'middle_name' => $subs->middleName, 'address' => array('line1' => $subscriberAddr->line1, 'line2' => $subscriberAddr->line2, 'city' => $subscriberAddr->city, 'state' => $subscriberAddr->state, 'zip' => $subscriberAddr->zipCode), 'date_of_birth' => date('Ymd', strtotime($subs->dateOfBirth)), 'gender' => $subs->gender, 'contract_type_code' => '', 'contract_amount' => '', 'contract_percent' => '', 'contract_code' => '', 'contract_discount_percent' => '', 'contract_version' => ''); $practiceAddr = $practice->primaryAddress; $room = new Room(); $room->roomId = (int) $visit->roomId; $room->populate(); $facility = $room->building; $phoneNumber = PhoneNumber::autoFixNumber($practice->mainPhone->number); $phoneLen = strlen($phoneNumber); if ($phoneLen < 10) { $phoneNumber = str_pad($phoneNumber, 10, '0', STR_PAD_LEFT); } else { if ($phoneLen > 10) { $phoneNumber = substr($phoneNumber, -10); } } $identifierType = ''; $identifier = $practice->identifier; if (strlen($identifier) > 0) { $identifierType = 'XX'; } //24'; $data = array('hlCount' => ++$ctr); $data['practice'] = array('name' => $practice->name, 'identifier_type' => $identifierType, 'identifier' => $identifier, 'address' => array('line1' => $practiceAddr->line1, 'line2' => $practiceAddr->line2, 'city' => $practiceAddr->city, 'state' => $practiceAddr->state, 'zip' => $practiceAddr->zipCode), 'phoneNumber' => $phoneNumber); $data['treating_facility'] = array('identifier' => $facility->identifier); $dateOfTreatment = date('Ymd', strtotime($visit->dateOfTreatment)); $payer2Id = $insuranceProgram->insuranceProgramId; if (strlen($payer2Id) < 2) { $payer2Id = str_pad($payer2Id, 2, '0', STR_PAD_LEFT); } $identifierType = ''; $identifier = $provider->person->identifier; if (strlen($identifier) > 0) { $identifierType = 'XX'; } //34'; $claimData = array('claim' => $claim, 'patient' => array('date_of_initial_treatment' => $dateOfTreatment, 'date_of_onset' => $dateOfTreatment, 'comment_type' => '', 'comment' => ''), 'treating_facility' => array('facility_code' => $facility->facilityCodeId, 'name' => $facility->name, 'address' => array('line1' => $facility->line1, 'line2' => $facility->line2, 'city' => $facility->city, 'state' => $facility->state, 'zip' => $facility->zipCode)), 'provider' => array('signature_on_file' => 'Y', 'accepts_assignment' => 'A', 'last_name' => $provider->person->lastName, 'first_name' => $provider->person->firstName, 'identifier_type' => $identifierType, 'identifier' => $identifier, 'identifier_2' => ''), 'billing_facility' => array('clia_number' => ''), 'subscriber' => $subscriber, 'clearing_house' => array('credit_max_amount' => '', 'repricing_method' => '', 'allowed_amount' => '', 'savings_amount' => '', 'identifier' => '', 'rate' => '', 'apg_code' => '', 'apg_amount' => '', 'reject_code' => '', 'compliance_code' => '', 'exception_code' => ''), 'referring_provider' => array('last_name' => '', 'first_name' => '', 'referral_type' => '', 'identifier_type' => '', 'identifier' => '', 'taxonomy_code' => ''), 'supervising_provider' => array('last_name' => '', 'first_name' => '', 'identifier_type' => '', 'identifier' => ''), 'payer2' => array('id' => $payer2Id, 'name' => $insuranceProgram->name)); $clm = array(); $iterator = new ClaimLineIterator(); $iterator->setFilters(array('claimId' => $claimId)); foreach ($iterator as $row) { $baseFee = (double) $row->baseFee; $adjustedFee = (double) $row->adjustedFee; $paid = (double) $row->paid; $billed = $row->totalMiscCharge; if ($baseFee > 0) { $billed += $baseFee - $adjustedFee; } $balance = abs($billed) - $paid; $clm[] = array('claim' => $claimData['claim'], 'patient' => $claimData['patient'], 'claim_line' => array('amount' => $balance, 'diagnosis1' => preg_replace('/[\\.]/', '', $row->diagnosisCode1), 'diagnosis2' => preg_replace('/[\\.]/', '', $row->diagnosisCode2), 'diagnosis3' => preg_replace('/[\\.]/', '', $row->diagnosisCode3), 'diagnosis4' => preg_replace('/[\\.]/', '', $row->diagnosisCode4), 'diagnosis5' => preg_replace('/[\\.]/', '', $row->diagnosisCode5), 'diagnosis6' => preg_replace('/[\\.]/', '', $row->diagnosisCode6), 'diagnosis7' => preg_replace('/[\\.]/', '', $row->diagnosisCode7), 'diagnosis8' => preg_replace('/[\\.]/', '', $row->diagnosisCode8), 'procedure' => $row->procedureCode, 'modifier1' => $row->modifier1, 'modifier2' => $row->modifier2, 'modifier3' => $row->modifier3, 'modifier4' => $row->modifier4, 'units' => str_replace('.00', '', $row->units), 'date_of_treatment' => $dateOfTreatment, 'clia_number' => ''), 'treating_facility' => $claimData['treating_facility'], 'provider' => $claimData['provider'], 'billing_facility' => $claimData['billing_facility'], 'subscriber' => $subscriber, 'clearing_house' => $claimData['clearing_house'], 'referring_provider' => $claimData['referring_provider'], 'supervising_provider' => $claimData['supervising_provider'], 'payer2' => $claimData['payer2']); } $hl2 = array(); $hl2[] = array('hlCount' => $ctr, 'hlCount2' => ++$ctr, 'payer' => array('responsibility' => 'P'), 'subscriber' => $subscriber, 'patient' => array('weight' => '', 'last_name' => $patient->lastName, 'first_name' => $patient->firstName), 'responsible_party' => array('last_name' => '', 'first_name' => '', 'address' => array('line1' => '', 'line2' => '', 'city' => '', 'state' => '', 'zip' => '')), 'CLM' => $clm); $data['HL2'] = $hl2; return $data; }
public static function handlereFaxSourceData(Audit $audit) { $data = array(); if ($audit->objectClass != 'ESignature') { return $data; } $eSignature = new ESignature(); $eSignature->eSignatureId = $audit->objectId; $eSignature->populate(); if ($eSignature->objectClass != 'Medication') { return $data; } $data['_audit'] = $audit; $medication = new Medication(); $medication->medicationId = $eSignature->objectId; $medication->populate(); $data['transmissionId'] = (int) $medication->medicationId; $data['recipients'] = array(); $patient = new Patient(); $patient->personId = $medication->personId; $patient->populate(); $pharmacyId = $patient->defaultPharmacyId; $provider = new Provider(); $provider->personId = $medication->prescriberPersonId; $provider->populate(); // recipients MUST be a pharmacy? $pharmacy = new Pharmacy(); $pharmacy->pharmacyId = $pharmacyId; $pharmacy->populate(); //$data['recipients'][] = array('fax'=>$pharmacy->Fax,'name'=>$pharmacy->StoreName,'company'=>$pharmacy->StoreName); // temporarily comment out the above recipient and use the hardcoded recipient $data['recipients'][] = array('fax' => '6022976632', 'name' => 'Jay Walker', 'company' => 'ClearHealth Inc.'); $prescription = new Prescription(); $prescription->prescriberName = $provider->firstName . ' ' . $provider->lastName . ' ' . $provider->title; $prescription->prescriberStateLicenseNumber = $provider->stateLicenseNumber; $prescription->prescriberDeaNumber = $provider->deaNumber; // Practice Info $primaryPracticeId = $provider->primaryPracticeId; $practice = new Practice(); $practice->id = $primaryPracticeId; $practice->populate(); $address = $practice->primaryAddress; $prescription->practiceName = $practice->name; $prescription->practiceAddress = $address->line1 . ' ' . $address->line2; $prescription->practiceCity = $address->city; $prescription->practiceState = $address->state; $prescription->practicePostalCode = $address->postalCode; $attachment = new Attachment(); $attachment->attachmentReferenceId = $provider->personId; $attachment->populateWithAttachmentReferenceId(); if ($attachment->attachmentId > 0) { $db = Zend_Registry::get('dbAdapter'); $sqlSelect = $db->select()->from('attachmentBlobs')->where('attachmentId = ?', (int) $attachment->attachmentId); if ($row = $db->fetchRow($sqlSelect)) { $tmpFile = tempnam('/tmp', 'ch30_sig_'); file_put_contents($tmpFile, $row['data']); $signatureFile = $tmpFile; $prescription->prescriberSignature = $signatureFile; } } $prescription->patientName = $patient->lastName . ', ' . $patient->firstName; $address = $patient->homeAddress; $prescription->patientAddress = $address->line1 . ' ' . $address->line2; $prescription->patientCity = $address->city; $prescription->patientState = $address->state; $prescription->patientPostalCode = $address->postalCode; $prescription->patientDateOfBirth = date('m/d/Y', strtotime($patient->dateOfBirth)); $prescription->medicationDatePrescribed = date('m/d/Y', strtotime($medication->datePrescribed)); $prescription->medicationDescription = $medication->description; $prescription->medicationComment = $medication->comment; $prescription->medicationQuantity = $medication->quantity; $prescription->medicationRefills = $medication->refills; $prescription->medicationDirections = $medication->directions; $prescription->medicationSubstitution = $medication->substitution; $prescription->create(); $filename = $prescription->imageFile; $fileType = pathinfo($filename, PATHINFO_EXTENSION); $data['files'] = array(); $contents = file_get_contents($filename); unlink($filename); $data['files'][] = array('contents' => base64_encode($contents), 'type' => $fileType); return $data; }
<!DOCTYPE html> <?php session_start(); include 'initclasses.php'; $crag = new Crag(); //jos ei ole aloitettu reeniä, niin aloitetaan if (!isset($_SESSION['practice_start_time'])) { $practice = new Practice(); $practice->start(1); //parametri: 1=ulkona, 0=sisällä $practice = NULL; } ?> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=no"> <link href='http://fonts.googleapis.com/css?family=Droid+Sans:700' rel='stylesheet' type='text/css'> <link rel="stylesheet" type="text/css" href="styles/normalize.css"> <link rel="stylesheet" type="text/css" href="styles/ulko.css"> <script src="libraries/jquery-2.1.3.js"></script> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAHM5-PHCencLLC0cgbV74whHNPoFDu0uE"></script> <script src="libraries/geolocationmarker-compiled.js"></script> <script src="scripts/ulko.js"></script> <title>ulko</title> </head> <body> <div id="map-canvas"></div> <div id="container">
public function populateXML(SimpleXMLElement $xml = null, $checked = true) { if ($xml === null) { $xml = new SimpleXMLElement('<data/>'); } $personId = (int) $this->person_id; $person = $this->person; $picture = ''; if ($person->activePhoto > 0) { $attachment = new Attachment(); $attachment->attachmentId = (int) $person->activePhoto; $attachment->populate(); $picture = base64_encode($attachment->rawData); } $xmlPatient = $xml->addChild('patient'); $xmlPerson = $xmlPatient->addChild('person'); $this->_addChild($xmlPerson, 'picture', $picture, $checked); $this->_addChild($xmlPerson, 'lastName', $person->lastName, $checked); $this->_addChild($xmlPerson, 'firstName', $person->firstName, $checked); $this->_addChild($xmlPerson, 'middleName', $person->middleName, $checked); $identifier = ''; if ($person->identifierType == 'SSN') { $identifier = $person->identifier; } $this->_addChild($xmlPerson, 'identifier', $identifier, $checked); $this->_addChild($xmlPerson, 'gender', $person->gender, $checked); $dateOfBirth = explode(' ', date('m d Y', strtotime($person->dateOfBirth))); $this->_addChild($xmlPerson, 'dobMonth', $dateOfBirth[0], $checked); $this->_addChild($xmlPerson, 'dobDay', $dateOfBirth[1], $checked); $this->_addChild($xmlPerson, 'dobYear', $dateOfBirth[2], $checked); $statistics = PatientStatisticsDefinition::getPatientStatistics($personId); $race = ''; if (isset($statistics['Race'])) { $race = $statistics['Race']; } else { if (isset($statistics['race'])) { $race = $statistics['race']; } } $this->_addChild($xmlPerson, 'race', $race, $checked); $maritalStatus = $person->maritalStatus ? $person->maritalStatus : 'Other'; $this->_addChild($xmlPerson, 'maritalStatus', $maritalStatus, $checked); $addresses = Address::listAddresses($personId); foreach ($addresses as $address) { switch ($address->type) { case Address::TYPE_MAIN: $type = 'mainAddress'; break; case Address::TYPE_SEC: $type = 'secondaryAddress'; break; case Address::TYPE_HOME: $type = 'homeAddress'; break; case Address::TYPE_EMPLOYER: $type = 'employerAddress'; break; case Address::TYPE_BILLING: $type = 'billingAddress'; break; case Address::TYPE_OTHER: default: $type = 'otherAddress'; break; } $xmlAddress = $xmlPatient->addChild($type); $this->_addChild($xmlAddress, 'line1', $address->line1, $checked); $this->_addChild($xmlAddress, 'city', $address->city, $checked); $this->_addChild($xmlAddress, 'state', $address->state, $checked); $this->_addChild($xmlAddress, 'zip', $address->postalCode, $checked); } $phoneNumbers = PhoneNumber::listPhoneNumbers($personId); foreach ($phoneNumbers as $phoneNumber) { switch ($phoneNumber->type) { case PhoneNumber::TYPE_HOME: $type = 'homePhone'; break; case PhoneNumber::TYPE_WORK: $type = 'workPhone'; break; case PhoneNumber::TYPE_BILLING: $type = 'billingPhone'; break; case PhoneNumber::TYPE_EMPLOYER: $type = 'employerPhone'; break; case PhoneNumber::TYPE_MOBILE: $type = 'mobilePhone'; break; case PhoneNumber::TYPE_EMERGENCY: $type = 'emergencyPhone'; break; case PhoneNumber::TYPE_FAX: $type = 'faxPhone'; break; case PhoneNumber::TYPE_HOME_EVE: $type = 'homeEvePhone'; break; case PhoneNumber::TYPE_HOME_DAY: $type = 'homeDayPhone'; break; case PhoneNumber::TYPE_BEEPER: $type = 'beeperPhone'; break; default: $type = 'otherPhone'; break; } $xmlPhone = $xmlPatient->addChild($type); $this->_addChild($xmlPhone, 'number', $phoneNumber->number, $checked); } if ($person->primaryPracticeId > 0) { $practice = new Practice(); $practice->practiceId = (int) $person->primaryPracticeId; $practice->populate(); $address = $practice->primaryAddress; $xmlPractice = $xmlPatient->addChild('practice'); $this->_addChild($xmlPractice, 'name', $practice->name, $checked); $xmlPrimaryAddress = $xmlPractice->addChild('primaryAddress'); $this->_addChild($xmlPrimaryAddress, 'line1', $address->line1, $checked); $this->_addChild($xmlPrimaryAddress, 'city', $address->city, $checked); $this->_addChild($xmlPrimaryAddress, 'state', $address->state, $checked); $this->_addChild($xmlPrimaryAddress, 'zip', $address->postalCode, $checked); $this->_addChild($xmlPractice, 'mainPhone', $practice->mainPhone->number, $checked); $this->_addChild($xmlPractice, 'faxNumber', $practice->fax->number, $checked); } $insuredRelationship = new InsuredRelationship(); $insuredRelationshipIterator = $insuredRelationship->getIteratorByPersonId($personId); $primary = null; $secondary = null; foreach ($insuredRelationshipIterator as $item) { if (!$item->active) { continue; } if ($primary === null) { $primary = $item; } else { if ($secondary === null) { $secondary = $item; } else { break; } } } $xmlPayer = $xmlPatient->addChild('payer'); if ($primary !== null) { $this->_addChild($xmlPayer, 'medicareNumber', $primary->insuranceProgram->payerIdentifier, $checked); } if ($secondary !== null) { $this->_addChild($xmlPayer, 'medicaidNumber', $secondary->insuranceProgram->payerIdentifier, $checked); } return $xml; }
public function paymentReceiptAction() { // d96de46c-be90-45b0-b5f9-0b4abee76483 $referenceId = $this->_getParam('referenceId'); $personId = (int) $this->_getParam('personId'); $visitId = (int) $this->_getParam('visitId'); $data = $this->_getAttachmentData($referenceId); $patient = new Patient(); $patient->personId = $personId; if ($personId > 0) { $patient->populate(); } $person = $patient->person; $visit = new Visit(); $visit->visitId = $visitId; if ($visitId > 0) { $visit->populate(); } $practiceId = (int) $visit->practiceId; if (!$practiceId > 0) { $buildingId = (int) $visit->buildingId; if ($buildingId > 0) { $building = new Building(); $building->buildingId = $buildingId; $building->populate(); $practiceId = (int) $building->practiceId; } else { $roomId = (int) $visit->roomId; if ($roomId > 0) { $room = new Room(); $room->roomId = $roomId; $room->populate(); $practiceId = (int) $room->building->practiceId; } } } $practice = new Practice(); $practice->practiceId = $practiceId; if ($practiceId > 0) { $practice->populate(); } $primaryAddress = $practice->primaryAddress; $xml = new SimpleXMLElement('<data/>'); $xmlPractice = $xml->addChild('practice'); $this->_addChild($xmlPractice, 'name', $practice->name); $this->_addChild($xmlPractice, 'primaryLine1', $primaryAddress->line1); $primaryCityStateZip = $primaryAddress->city . ' ' . $primaryAddress->state . ' ' . $primaryAddress->postalCode; $this->_addChild($xmlPractice, 'primaryCityStateZip', $primaryCityStateZip); $this->_addChild($xmlPractice, 'mainPhone', $practice->mainPhone->number); $xmlPatient = $xml->addChild('patient'); $name = $person->firstName . ' ' . $person->middleName . ' ' . $person->lastName; $this->_addChild($xmlPatient, 'name', $name); $addresses = Address::listAddresses($personId); if (isset($addresses[Address::TYPE_BILLING])) { $address = $addresses[Address::TYPE_BILLING]; } else { if (isset($addresses[Address::TYPE_HOME])) { $address = $addresses[Address::TYPE_HOME]; } else { if (isset($addresses[Address::TYPE_MAIN])) { $address = $addresses[Address::TYPE_MAIN]; } else { if (isset($addresses[Address::TYPE_SEC])) { $address = $addresses[Address::TYPE_SEC]; } else { if (isset($addresses[Address::TYPE_OTHER])) { $address = $addresses[Address::TYPE_OTHER]; } else { $address = array_pop($addresses); } } } } } $billingCityStateZip = $address->city . ' ' . $address->state . ' ' . $address->postalCode; $this->_addChild($xmlPatient, 'billingLine1', $address->line1); $this->_addChild($xmlPatient, 'billingCityStateZip', $billingCityStateZip); $iterator = new PatientProcedureIterator(); $iterator->setFilters(array('visitId' => $visitId)); $procedures = array(); foreach ($iterator as $row) { $procedures[] = $row->code; } $iterator = new PatientDiagnosisIterator(); $iterator->setFilters(array('visitId' => $visitId)); $diagnoses = array(); foreach ($iterator as $row) { $diagnoses[] = $row->code; } $xmlNotes = $xmlPatient->addChild('notes'); $note = implode(',', $procedures) . " \t " . implode(',', $diagnoses) . " \t " . date('m/d/y', strtotime($visit->dateOfTreatment)); $this->_addChild($xmlNotes, 'note', $note); $today = date('Y-m-d'); $todaysTotal = 0; $iterator = new PaymentIterator(); $iterator->setFilters(array('visitId' => $visitId, 'company' => 'System', 'paymentDate' => $today)); $payments = array(); foreach ($iterator as $row) { $payments[] = $row; } $iterator->setFilters(array('personId' => $personId, 'unallocated' => true, 'paymentDate' => $today)); foreach ($iterator as $row) { $payments[] = $row; } foreach ($payments as $row) { $xmlPayment = $xmlPatient->addChild('payments'); $paymentDate = date('m/d/y', strtotime($row->paymentDate)); $this->_addChild($xmlPayment, 'date', $paymentDate); $this->_addChild($xmlPayment, 'description', $row->title . ' .... Thank You'); $this->_addChild($xmlPayment, 'method', $row->paymentType); $amount = (double) $row->amount; $todaysTotal += $amount; $this->_addChild($xmlPayment, 'amount', '-' . number_format($amount, 2)); $this->_addChild($xmlPayment, 'insurance', $row->insuranceDisplay); } $fees = $visit->calculateFees(); $previousBalance = $fees['total']; $this->_addChild($xmlPatient, 'previousBalance', number_format($previousBalance, 2)); $this->_addChild($xmlPatient, 'todaysTotal', '-' . number_format($todaysTotal, 2)); $totalDue = $previousBalance - $todaysTotal; $this->_addChild($xmlPatient, 'totalDue', number_format($totalDue, 2)); $totalDueFromPatient = $previousBalance; $this->_addChild($xmlPatient, 'totalDueFromPatient', number_format($totalDueFromPatient, 2)); try { $content = ReportBase::mergepdfset($xml, $data); $this->getResponse()->setHeader('Content-Type', 'application/pdf'); } catch (Exception $e) { $content = '<script>alert("' . $e->getMessage() . '")</script>'; } $this->view->content = $content; $this->render('binary-template'); }
/*include("small_menu_start.php");*/ $mySql = new MySql(); if (isset($_SESSION[Session::C_SESSION_USER])) { $session = new Session($_SESSION[Session::C_SESSION_USER], $_SESSION[Session::C_SESSION_PASS], $mySql); } if (!isset($session) or !$session->IsConnected()) { header('Location: index.php'); exit; } ?> <!-- MAIN SECTION --> <section class="main-section"> <div class="small-12 columns"> <div class="row"> <h4>horaire - <?php $practice = new Practice(); if (isset($_POST["date"])) { $practice->initProperty($_POST["MyId"], $_POST["seasonId"], $_POST["teamId"], strtotime($_POST["date"]), $_POST["stade"], $mySql); $practice->PageMode = $_POST["pageMode"]; $practice->validate($mySql); if (!$practice->getHasError()) { if ($practice->PageMode == Constants::PAGE_MODE_EDIT) { $practice->update($mySql); } else { $practice->addNew($mySql); } } header('Location: practice.php'); exit; } else { if (isset($_GET["id"])) {
<!DOCTYPE html> <?php include 'initclasses.php'; $practice = new Practice(); if (!isset($_SESSION['practice_start_time'])) { $practice->start(0); //parametri: 1=ulkona, 0=sisällä } ?> <html> <head> <title>Climbingtime - sisäharjoittelu</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=no"> <link type="text/css" rel="stylesheet" href="styles/normalize.css"> <link type="text/css" rel="stylesheet" href="styles/main.css"> <link type="text/css" rel="stylesheet" href="styles/sisa.css"> <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'> <script src="libraries/jquery-2.1.3.js"></script> </head> <body> <div id="container"> <?php include "navbar.php"; ?> <div id="content"> <div id="toppaus"> <h3>Toppaus</h3> <?php echo $practice->printAddForm('top');
<div class="small-12 columns"> <div class="row"> <h4>horaire - pratique</h4> </div> <div class="row"> <table id="saison" width="100%"> <thead> <tr> <th>Action</th><th>Date</th><th>Équipe</th></th><th>Stade</th> </tr> </thead> <tbody> <?php if ($result = $mySql->execute("SELECT p.* FROM practice AS p \n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t INNER JOIN season AS s ON p.seasonId = s.year\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE s.IsCurrent\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ORDER BY Date ASC")) { while ($row = $result->fetch_object("Practice")) { $practice = new Practice(); $practice->initDB($row->Id, $mySql); ?> <tr> <td> <a title="Modifier" href="practice_edit.php?id=<?php echo $row->Id; ?> "> <i class="fi-page-edit size-32"> </i> </a> <a title="Supprimer" onclick="javascript:return confirm('Voulez-vous supprimer l\'enregistrement?');" href='practice.php?delete=<?php echo $row->Id; ?>
public function transmitEprescriptionAction() { $medicationId = (int) $this->_getParam('medicationId'); $medication = new Medication(); $medication->medicationId = $medicationId; $medication->populate(); //echo $medication->toString(); //echo $medicationId; $data = $medication->toArray(); $practice = new Practice(); $practice->practiceId = MainController::getActivePractice(); $practice->populate(); $data['practiceName'] = $practice->name; $pharmacy = new Pharmacy(); $pharmacy->pharmacyId = $medication->pharmacyId; $pharmacy->populate(); $data['pharmacy'] = $pharmacy->toArray(); $prescriber = new Provider(); $prescriber->personId = $medication->prescriberPersonId; $prescriber->populate(); $prescriber->person->populate(); $data['prescriber'] = $prescriber->toArray(); $data['prescriber']['agentFirstName'] = ''; $data['prescriber']['agentLastName'] = ''; $data['prescriber']['agentSuffix'] = ''; $addressIterator = new AddressIterator(); $addressIterator->setFilters(array('class' => 'person', 'personId' => $prescriber->personId)); $data['prescriber']['address'] = $addressIterator->first()->toArray(); $phoneIterator = new PhoneNumberIterator(); $phoneIterator->setFilters(array('class' => 'person', 'personId' => $prescriber->personId)); $data['prescriber']['phone'] = $phoneIterator->first()->toArray(); $patient = new Patient(); $patient->personId = $medication->personId; $patient->populate(); $data['patient'] = $patient->toArray(); $phoneIterator->setFilters(array('class' => 'person', 'personId' => $patient->personId)); $data['patient']['phone'] = $phoneIterator->first()->toArray(); //var_dump($data);exit; $data = $this->makePostArray($data); //var_dump($this->makePostArray($data));exit; //var_dump($data);exit; $transmitEPrescribeURL = Zend_Registry::get('config')->healthcloud->URL; $transmitEPrescribeURL .= "SSRX/NewRx?apiKey=" . Zend_Registry::get('config')->healthcloud->apiKey; $cookieFile = tempnam(sys_get_temp_dir(), "ssddcookies_"); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $transmitEPrescribeURL); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); $output = curl_exec($ch); echo $output; exit; }
private function mapPractice(\Patient $patient) { if ($code = $this->getAssignedProperty('PracticeCode')) { if ($practice = \Practice::model()->findByAttributes(array('code' => $code))) { $patient->practice_id = $practice->id; } else { $this->addWarning("Could not find Practice for code " . $code); } } else { if (!$this->partial_record) { $patient->practice_id = null; } } }
public function addProcessAction() { $dateActiveStart = strtotime($this->_getParam('dateActiveStart')); $dateActiveEnd = strtotime($this->_getParam('dateActiveEnd')); $serviceLevel = (int) $this->_getParam('serviceLevel'); $personId = (int) $this->_getParam('personId'); $provider = new Provider(); $provider->person_id = $personId; $provider->populate(); $provider->serviceLevel = $serviceLevel; if ($dateActiveStart > 0 && $dateActiveEnd > 0) { $provider->dateActiveStart = date('Y-m-d H:i:s', $dateActiveStart); $provider->dateActiveEnd = date('Y-m-d H:i:s', $dateActiveEnd); } $person = new Person(); $person->person_id = $personId; $person->populate(); $address = new Address(); $address->person_id = $personId; $address->populateWithPersonId($personId); $phoneNumber = new PhoneNumber(); $phoneNumber->person_id = $personId; $phoneNumber->populateWithType(4); $practice = new Practice(); $practice->practiceId = $person->primaryPracticeId; $practice->populate(); $data = array(); $data['deaNumber'] = $provider->deaNumber; $data['stateLicenseNumber'] = $provider->stateLicenseNumber; //$data['portalId'] = Zend_Registry::get('config')->sureScripts->portalId; //$data['accountId'] = Zend_Registry::get('config')->sureScripts->accountId; $data['clinicName'] = '' . $practice->name; $data['lastName'] = $person->last_name; $data['firstName'] = $person->first_name; $address = new Address(); $address->personId = $provider->personId; $address->populateWithType(4); $data['addressLine1'] = $address->line1; $data['addressLine2'] = $address->line2; $data['addressCity'] = $address->city; $data['addressState'] = $address->state; $data['addressZipCode'] = $address->zipCode; $data['email'] = $person->email; $phoneNumber = new PhoneNumber(); $phoneNumber->personId = $provider->personId; /* $phoneNumberIterator = $phoneNumber->getIteratorByPatientId(); $phones = array(); foreach ($phoneNumberIterator as $number) { if (!strlen($number->number) > 0) continue; // SS Type options: BN - Beeper, CP - Cellular, FX - Fax, HP - Home, NP - Night, TE – Telephone*, WP – Work $type = ''; switch ($number->type) { case PhoneNumber::TYPE_HOME: $type = 'HP'; case PhoneNumber::TYPE_WORK: $type = 'WP'; break; case PhoneNumber::TYPE_MOBILE: $type = 'CP'; break; case PhoneNumber::TYPE_FAX: $type = 'FX'; break; case PhoneNumber::TYPE_EMERGENCY: case PhoneNumber::TYPE_EMPLOYER: case PhoneNumber::TYPE_BILLING: $type = 'TE'; break; default: continue; } $phones[$type] = array('number'=>$number->number,'type'=>$type); } $te = null; if (isset($phones['TE'])) { $te = $phones['TE']; unset($phones['TE']); } $fx = null; if (isset($phones['FX'])) { $fx = $phones['FX']; unset($phones['FX']); } if ($te === null) { if (count($phones) > 0) { $te = array_unshift($phones); } else if ($fx !== null) { $te = $fx; } } if ($fx === null) { if (count($phones) > 0) { $fx = array_unshift($phones); } else if ($te !== null) { $fx = $te; } } $data['phones'] = array(); if ($te !== null) { $data['phones'][] = $te; } if ($fx !== null) { $data['phones'][] = $fx; } foreach ($phones as $p) { $data['phones'][] = $p; } */ $data['phones'] = $phoneNumber->phoneNumbers; /*$phoneNumbers = $phoneNumber->phoneNumbers; $fax = ''; if (isset($phoneNumbers['FAX'])) { $fax = $phoneNumbers['FAX']; unset($phoneNumbers['FAX']); } $phone = $fax; if (count($phoneNumbers) > 0) { $phone = array_pop($phoneNumbers); } $data['phoneNumber'] = $phone; $data['faxNumber'] = $fax;*/ $data['specialtyCode'] = $provider->specialty; $specialtyQualifier = ''; if (strlen($provider->specialty) > 0) { $specialtyQualifier = 'AM'; } $data['specialtyQualifier'] = $specialtyQualifier; $data['serviceLevel'] = $provider->serviceLevel; $now = strtotime('now'); $days30 = strtotime('+30 days', $now); $activeStartTime = gmdate("Y-m-d\\TH:i:s.0", $now) . 'Z'; $activeEndTime = gmdate("Y-m-d\\TH:i:s.0", $days30) . 'Z'; $data['activeStartTime'] = $provider->dateActiveStartZ; $data['activeEndTime'] = $provider->dateActiveEndZ; $dateActiveEnd = strtotime(date('Y-m-d', strtotime($provider->dateActiveEndZ))); if ($dateActiveEnd <= strtotime(date('Y-m-d'))) { // to disable a prescriber ActiveEndTime must be set to current date and ServiceLevel must be set to zero. $data['activeEndTime'] = date('Y-m-d'); $data['serviceLevel'] = 0; $provider->serviceLevel = 0; } $provider->persist(); $identifierType = $provider->identifierType; if (strlen($identifierType) > 0) { $data[$identifierType] = $provider->identifier; } /* foreach ($data as $k=>$v) { if (!strlen(trim($v)) > 0) { $tmp = ' '; if ($k == 'addressState') { $tmp = 'AZ'; } if ($k == 'addressZipCode') { $tmp = '12345'; } $data[$k] = $tmp; } }*/ $messaging = new Messaging(); //$messaging->messagingId = ''; $type = 'add'; $messaging->messageType = 'AddPrescriber'; if (strlen($provider->sureScriptsSPI) > 0) { $messaging->messageType = 'UpdatePrescriber'; $data['SPI'] = $provider->sureScriptsSPI; $type = 'update'; } $messaging->populate(); //$messaging->objectId = ''; //$messaging->objectClass = ''; $messaging->status = 'Sending'; $messaging->note = 'Sending prescriber data'; $messaging->dateStatus = date('Y-m-d H:i:s'); //$messaging->auditId = ''; $messaging->persist(); $query = http_build_query(array('type' => $type, 'data' => $data)); $ch = curl_init(); $ePrescribeURL = Zend_Registry::get('config')->healthcloud->URL; $ePrescribeURL .= 'ss-manager.raw/edit-prescriber?apiKey=' . Zend_Registry::get('config')->healthcloud->apiKey; curl_setopt($ch, CURLOPT_URL, $ePrescribeURL); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $query); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $output = curl_exec($ch); trigger_error('OUTPUT: ' . $output, E_USER_NOTICE); $error = ""; $prescriberSPI = ''; $messaging->status = 'Sent'; $messaging->note = 'Prescriber data sent'; if (!curl_errno($ch)) { try { $responseXml = simplexml_load_string($output); if (isset($responseXml->error)) { $errorCode = (string) $responseXml->error->code; $errorMsg = (string) $responseXml->error->message; if (isset($responseXml->error->errorCode)) { $errorCode = (string) $responseXml->error->errorCode; } if (isset($responseXml->error->errorMsg)) { $errorMsg = (string) $responseXml->error->errorMsg; } $error = $errorMsg; trigger_error('There was an error enabling an ePresciber, Error code: ' . $errorCode . ' Error Message: ' . $errorMsg, E_USER_NOTICE); } elseif (isset($responseXml->data)) { $xml = new SimpleXMLElement($responseXml->data); $prescriber = $xml->AddPrescriberResponse->Prescriber; if (isset($xml->AddPrescriberLocationResponse)) { $prescriber = $xml->AddPrescriberLocationResponse->Prescriber; } $prescriberSPI = (string) $prescriber->Identification->SPI; } if (isset($responseXml->rawMessage)) { $messaging->rawMessage = base64_decode((string) $responseXml->rawMessage); $messaging->rawMessageResponse = base64_decode((string) $responseXml->rawMessageResponse); } } catch (Exception $e) { $error = __("There was an error connecting to HealthCloud to enable ePrescribing for this provider. Please try again or contact the system administrator."); trigger_error("There was an error enabling an ePresciber, the response couldn't be parsed as XML: " . $output, E_USER_NOTICE); } } else { $error = __("There was an error connecting to HealthCloud to enable ePrescribing for this provider. Please try again or contact the system administrator."); trigger_error("Curl error connecting to healthcare enabled an ePrescribe record: " . curl_error($ch), E_USER_NOTICE); } curl_close($ch); if (strlen($error) > 0) { $messaging->status = 'Error'; $messaging->note = $error; $ret = false; } if ($messaging->resend) { $messaging->resend = 0; } $messaging->retries++; $messaging->dateStatus = date('Y-m-d H:i:s'); $messaging->persist(); $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $this->view->error = $error; if (strlen($error) > 0) { //$this->getResponse()->setHttpResponseCode(500); $json->direct(array('error' => $error)); return; } if ($type == 'add') { $provider->sureScriptsSPI = trim($prescriberSPI); $provider->persist(); } else { $prescriberSPI = $provider->sureScriptsSPI; } $this->view->message = "ePrescribing Information Saved for Provider, assigned SPI Number: " . $prescriberSPI; $this->view->prescriberSPI = $prescriberSPI; $json->direct(array('message' => $this->view->message, 'prescriberSPI' => $prescriberSPI, 'error' => $error)); }
<?php include 'initclasses.php'; $pstats = new Practice(); $estats = new Exercise(); if ($_GET['section'] == 'outdoor') { $result = $pstats->getPractices(1); //tulostetaan ulkoharjoitukset foreach ($result as $row) { echo "<a class='stat-link' href='statistics.php?section=outdoor&id={$row['PracticeId']}'><div class='practice'>"; echo "<div class='practice_date'>"; $startTime = strtotime($row['StartTime']); $endTime = strtotime($row['EndTime']); echo date("d.m.Y", $startTime) . " klo " . date("H:i", $startTime) . " - " . date("H:i", $endTime); echo "</div>"; echo "<ul>"; echo "<li>Toppaukset: " . $estats->countExercises($row['PracticeId'], "outdoor-top") . "</li>"; echo "<li>Yritykset: " . $estats->countExercises($row['PracticeId'], "outdoor-attempt") . "</li>"; echo "</ul>"; echo "</div></a>"; } } else { $result = $pstats->getPractices(0); //tulostetaan sisäharjoitukset foreach ($result as $row) { echo "<a class='stat-link' href='statistics.php?section=indoor&id={$row['PracticeId']}'><div class='practice'>"; echo "<div class='practice_date'>"; $startTime = strtotime($row['StartTime']); $endTime = strtotime($row['EndTime']); echo date("d.m.Y", $startTime) . " klo " . date("H:i", $startTime) . " - " . date("H:i", $endTime); echo "</div>";
protected function _syncLocation(EPrescriber $ePrescriber) { $ret = true; $dateActiveStart = strtotime($ePrescriber->dateActiveStart); $dateActiveEnd = strtotime($ePrescriber->dateActiveEnd); $serviceLevel = (int) $ePrescriber->serviceLevel; $personId = (int) $ePrescriber->providerId; $provider = new Provider(); $provider->personId = $personId; $provider->populate(); $provider->serviceLevel = $serviceLevel; if ($dateActiveStart > 0 && $dateActiveEnd > 0) { $provider->dateActiveStart = date('Y-m-d H:i:s', $dateActiveStart); $provider->dateActiveEnd = date('Y-m-d H:i:s', $dateActiveEnd); } $person = new Person(); $person->personId = $personId; $person->populate(); $practice = new Practice(); $practice->practiceId = $person->primaryPracticeId; $practice->populate(); $data = array(); $data['deaNumber'] = $provider->deaNumber; $data['stateLicenseNumber'] = $provider->stateLicenseNumber; //$data['portalId'] = Zend_Registry::get('config')->sureScripts->portalId; //$data['accountId'] = Zend_Registry::get('config')->sureScripts->accountId; $data['clinicName'] = '' . $practice->name; $data['lastName'] = $person->lastName; $data['firstName'] = $person->firstName; $address = $ePrescriber->building; $data['addressLine1'] = $address->line1; $data['addressLine2'] = $address->line2; $data['addressCity'] = $address->city; $data['addressState'] = $address->state; $data['addressZipCode'] = $address->zipCode; $data['email'] = $person->email; $data['phones'] = array(array('number' => PhoneNumber::autoFixNumber($address->phoneNumber), 'type' => 'TE'), array('number' => PhoneNumber::autoFixNumber($address->fax), 'type' => 'FX')); $data['specialtyCode'] = $provider->specialty; $specialtyQualifier = ''; if (strlen($provider->specialty) > 0) { $specialtyQualifier = 'AM'; } $data['specialtyQualifier'] = $specialtyQualifier; $data['serviceLevel'] = $provider->serviceLevel; $now = strtotime('now'); $days30 = strtotime('+30 days', $now); $activeStartTime = gmdate("Y-m-d\\TH:i:s.0", $now) . 'Z'; $activeEndTime = gmdate("Y-m-d\\TH:i:s.0", $days30) . 'Z'; $data['activeStartTime'] = $provider->dateActiveStartZ; $data['activeEndTime'] = $provider->dateActiveEndZ; $dateActiveEnd = strtotime(date('Y-m-d', strtotime($provider->dateActiveEndZ))); if ($dateActiveEnd <= strtotime(date('Y-m-d'))) { // to disable a prescriber ActiveEndTime must be set to current date and ServiceLevel must be set to zero. $data['activeEndTime'] = date('Y-m-d'); $data['serviceLevel'] = 0; $provider->serviceLevel = 0; } $provider->persist(); $identifierType = $provider->identifierType; if (strlen($identifierType) > 0) { $data[$identifierType] = $provider->identifier; } $messaging = new Messaging(); //$messaging->messagingId = ''; $type = 'add'; $messaging->messageType = 'AddPrescriber'; if (strlen($ePrescriber->SSID) > 0) { $messaging->messageType = 'UpdatePrescriber'; $data['SPI'] = $ePrescriber->SSID; $type = 'update'; } else { if (strlen($provider->sureScriptsSPI) > 0) { $messaging->messageType = 'AddPrescriberLocation'; $data['SPI'] = substr($provider->sureScriptsSPI, 0, -3); $type = 'addLocation'; } } // backupPortalId must be supplied if type is updateLocation $messaging->populate(); //$messaging->objectId = ''; //$messaging->objectClass = ''; $messaging->status = 'Sending'; $messaging->note = 'Sending prescriber data'; $messaging->dateStatus = date('Y-m-d H:i:s'); //$messaging->auditId = ''; $messaging->persist(); $query = http_build_query(array('type' => $type, 'data' => $data)); $ch = curl_init(); $ePrescribeURL = Zend_Registry::get('config')->healthcloud->URL; $ePrescribeURL .= 'ss-manager.raw/edit-prescriber?apiKey=' . Zend_Registry::get('config')->healthcloud->apiKey; curl_setopt($ch, CURLOPT_URL, $ePrescribeURL); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $query); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $output = curl_exec($ch); trigger_error('OUTPUT: ' . $output, E_USER_NOTICE); $error = ""; $prescriberSPI = ''; $messaging->status = 'Sent'; $messaging->note = 'Prescriber data sent'; if (!curl_errno($ch)) { try { $responseXml = simplexml_load_string($output); if (isset($responseXml->error)) { $errorCode = (string) $responseXml->error->code; $errorMsg = (string) $responseXml->error->message; if (isset($responseXml->error->errorCode)) { $errorCode = (string) $responseXml->error->errorCode; } if (isset($responseXml->error->errorMsg)) { $errorMsg = (string) $responseXml->error->errorMsg; } $error = $errorMsg; trigger_error('There was an error enabling an ePresciber, Error code: ' . $errorCode . ' Error Message: ' . $errorMsg, E_USER_NOTICE); } elseif (isset($responseXml->data)) { $xml = new SimpleXMLElement($responseXml->data); $prescriber = $xml->AddPrescriberResponse->Prescriber; //if ($type == 'addLocation') { if (isset($xml->AddPrescriberLocationResponse)) { $prescriber = $xml->AddPrescriberLocationResponse->Prescriber; } $prescriberSPI = (string) $prescriber->Identification->SPI; if (!strlen($prescriberSPI) > 0) { $error = 'Registration failed for location ' . $ePrescriber->building->name; } } if (isset($responseXml->rawMessage)) { $messaging->rawMessage = base64_decode((string) $responseXml->rawMessage); $messaging->rawMessageResponse = base64_decode((string) $responseXml->rawMessageResponse); } } catch (Exception $e) { $error = __("There was an error connecting to HealthCloud to enable ePrescribing for this provider. Please try again or contact the system administrator."); trigger_error("There was an error enabling an ePresciber, the response couldn't be parsed as XML: " . $output, E_USER_NOTICE); } } else { $error = __("There was an error connecting to HealthCloud to enable ePrescribing for this provider. Please try again or contact the system administrator."); trigger_error("Curl error connecting to healthcare enabled an ePrescribe record: " . curl_error($ch), E_USER_NOTICE); } curl_close($ch); if (strlen($error) > 0) { $messaging->status = 'Error'; $messaging->note = $error; $ret = false; } if ($messaging->resend) { $messaging->resend = 0; } $messaging->retries++; $messaging->dateStatus = date('Y-m-d H:i:s'); $messaging->persist(); if (strlen($error) > 0) { return $error; } if (!strlen($provider->sureScriptsSPI) > 0) { // handler of the first SPI $provider->sureScriptsSPI = $prescriberSPI; $provider->persist(); } if ($type == 'add' || $type == 'addLocation') { $ePrescriber->SSID = $prescriberSPI; $ePrescriber->persist(); } return $ret; }
public function getVisitInfoAction() { $visitId = (int) $this->_getParam('visitId'); $visit = new Visit(); $visit->visitId = $visitId; $visit->populate(); $practice = new Practice(); $practice->practiceId = $visit->practiceId; $practice->populate(); $data = array(); $data['currentPractice'] = $practice->name . ''; $data['selectedVisit'] = substr($visit->dateOfTreatment, 0, 10) . ''; $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }
protected function _generateXMLStatements(SimpleXMLElement $xml, $claimId) { $iterator = new ClaimLineIterator(); $iterator->setFilters(array('claimId' => $claimId)); $visitId = null; $totalPayments = 0; $totalCharges = 0; $claims = array(); foreach ($iterator as $claimLine) { $claimLineId = (int) $claimLine->claimLineId; $visitId = (int) $claimLine->visitId; $payerId = (int) $claimLine->insuranceProgramId; $procedureCode = $claimLine->procedureCode; $charges = (double) $claimLine->baseFee; $totalCharges += $charges; if (!isset($visit)) { $visit = new Visit(); $visit->visitId = $visitId; $visit->populate(); } if (!isset($patientName)) { $patientId = (int) $visit->patientId; $patient = new Patient(); $patient->personId = $patientId; $patient->populate(); $patientName = $patient->person->firstName . ' ' . $patient->person->middleName . ' ' . $patient->person->lastName; } if (!isset($providerName)) { $providerId = (int) $visit->providerId; $provider = new Provider(); $provider->personId = $providerId; $provider->populate(); $providerName = $provider->person->firstName . ' ' . $provider->person->middleName . ' ' . $provider->person->lastName; } $claim = array(); $claim['date'] = date('m/d/Y', strtotime($claimLine->dateTime)); $claim['patient'] = $patientName; $claim['provider'] = $providerName; $claim['description'] = $claimLine->procedure; $claim['charges'] = number_format($charges, 2); $claim['credits'] = ''; if (!isset($claims[$visitId])) { $claims[$visitId] = array(); } $claims[$visitId][] = $claim; } if ($visitId === null) { return; } $miscCharge = new MiscCharge(); $iterator = $miscCharge->getIteratorByVisitId($visitId); foreach ($iterator as $charge) { $amount = (double) $charge->amount; $totalCharges += $amount; $claim = array(); $claim['date'] = date('m/d/Y', strtotime($charge->chargeDate)); $claim['patient'] = $patientName; $claim['provider'] = $providerName; $description = $charge->chargeType; $title = $charge->title; if (strlen($title) > 0) { $description .= ': ' . $title; } $claim['description'] = $description; $claim['charges'] = number_format($amount, 2); $claim['credits'] = ''; $id = (int) $charge->miscChargeId; if (!isset($claims[$id])) { $claims[$id] = array(); } $claims[$id][] = $claim; } $iterator = new PostingJournalIterator(); $iterator->setFilters(array('visitId' => $visitId)); foreach ($iterator as $journal) { $amount = (double) $journal->amount; $totalPayments += $amount; $claim = array(); $claim['date'] = date('m/d/Y', strtotime($journal->datePosted)); $claim['patient'] = $patientName; $claim['provider'] = $providerName; $claim['description'] = $journal->note; $claim['charges'] = ''; $claim['credits'] = number_format($amount, 2); $id = (int) $journal->postingJournalId; if (!isset($claims[$id])) { $claims[$id] = array(); } $claims[$id][] = $claim; } $iterator = new WriteOffIterator(); $iterator->setFilters(array('visitId' => $visitId)); foreach ($iterator as $writeoff) { $amount = (double) $writeoff->amount; $totalPayments += $amount; $claim = array(); $claim['date'] = date('m/d/Y', strtotime($writeoff->timestamp)); $claim['patient'] = $patientName; $claim['provider'] = $providerName; $claim['description'] = $writeoff->title; $claim['charges'] = ''; $claim['credits'] = number_format($amount, 2); $id = (int) $writeoff->writeOffId; if (!isset($claims[$id])) { $claims[$id] = array(); } $claims[$id][] = $claim; } $practiceId = (int) $visit->practiceId; if (!$practiceId > 0) { $practiceId = (int) $provider->person->primaryPracticeId; } $practice = new Practice(); $practice->practiceId = $practiceId; $practice->populate(); $practiceName = $practice->name; $practicePrimaryLine1 = $practice->primaryAddress->line1; $practicePrimaryCityStateZip = $practice->primaryAddress->city . ', ' . $practice->primaryAddress->state . ' ' . $practice->primaryAddress->postalCode; $practiceMainPhone = $practice->mainPhone->number; $xmlPractice = $xml->addChild('practice'); $this->_addChild($xmlPractice, 'name', $practiceName); $this->_addChild($xmlPractice, 'primaryLine1', $practicePrimaryLine1); $this->_addChild($xmlPractice, 'primaryCityStateZip', $practicePrimaryCityStateZip); $this->_addChild($xmlPractice, 'mainPhone', $practiceMainPhone); $insuredRelationship = InsuredRelationship::filterByPayerPersonIds($payerId, $patientId); $subscriberId = (int) $insuredRelationship->subscriberId; if ($subscriberId > 0) { $subscriber = $insuredRelationship->subscriber; } else { $subscriber = $insuredRelationship->person; } $xmlSubscriber = $xml->addChild('subscriber'); $subscriberName = $subscriber->firstName . ' ' . $subscriber->middleName . ' ' . $subscriber->lastName; $this->_addChild($xmlSubscriber, 'name', $subscriberName); $address = $subscriber->address; $this->_addChild($xmlSubscriber, 'line1', $address->line1); $subscriberCityStateZip = $address->city . ', ' . $address->state . ' ' . $address->postalCode; $this->_addChild($xmlSubscriber, 'cityStateZip', $subscriberCityStateZip); $xmlBiller = $xml->addChild('biller'); $this->_addChild($xmlBiller, 'name', $practiceName); $this->_addChild($xmlBiller, 'line1', $practicePrimaryLine1); $this->_addChild($xmlBiller, 'cityStateZip', $practicePrimaryCityStateZip); $xmlClaims = $xml->addChild('claims'); $claim = array(); $claim['date'] = ' '; $claim['patient'] = ' '; $claim['provider'] = ' '; $claim['description'] = ' '; $claim['charges'] = ' '; $claim['credits'] = ' '; ksort($claims); $claims = array_pad($claims, 12, array($claim)); foreach ($claims as $key => $values) { foreach ($values as $claim) { $xmlClaimsDetails = $xmlClaims->addChild('details'); $this->_addChild($xmlClaimsDetails, 'date', $claim['date']); $this->_addChild($xmlClaimsDetails, 'patientName', $claim['patient']); $this->_addChild($xmlClaimsDetails, 'providerName', $claim['provider']); $this->_addChild($xmlClaimsDetails, 'description', $claim['description']); $this->_addChild($xmlClaimsDetails, 'charges', $claim['charges']); $this->_addChild($xmlClaimsDetails, 'credits', $claim['credits']); } } $date = date('m/d/Y'); $accountNumber = $patient->recordNumber; $totalOutstanding = $totalCharges - $totalPayments; $pendingInsurance = 0; $amount = $totalOutstanding - $pendingInsurance; $patientResponsibility = $amount; $current = $amount; $pastDue = 0; $amountDue = $amount; $xmlClaimsInfo = $xmlClaims->addChild('info'); $this->_addChild($xmlClaimsInfo, 'statement', $date); $this->_addChild($xmlClaimsInfo, 'accountNo', $accountNumber); $this->_addChild($xmlClaimsInfo, 'amount', number_format($amountDue, 2)); $xmlClaimsSummary = $xmlClaims->addChild('summary'); $this->_addChild($xmlClaimsSummary, 'accountNumber', $accountNumber); $this->_addChild($xmlClaimsSummary, 'totalOutstanding', number_format($totalOutstanding, 2)); $this->_addChild($xmlClaimsSummary, 'patientResponsibility', number_format($patientResponsibility, 2)); $this->_addChild($xmlClaimsSummary, 'pendingInsurance', number_format($pendingInsurance, 2)); $this->_addChild($xmlClaimsSummary, 'current', number_format($current, 2)); $this->_addChild($xmlClaimsSummary, 'pastDue', number_format($pastDue, 2)); $this->_addChild($xmlClaimsSummary, 'amountDue', number_format($amountDue, 2)); file_put_contents('/tmp/claims.xml', $xml->asXML()); }