コード例 #1
0
 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;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 public function processSendPharmacyAction()
 {
     $pharmacyId = $this->_getParam('pharmacyId');
     $recordChange = $this->_getParam('recordChange');
     $pharmacy = new Pharmacy();
     $pharmacy->pharmacyId = $pharmacyId;
     $pharmacy->populate();
     $pharmacy->RecordChange = $recordChange;
     $ret = $pharmacy->sendPharmacy();
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($ret);
 }