Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>PHP Test</title>
- </head>
- <body>
- <?php
- // classes and SOAP Client were auto generated using WSDL2PHP, an open source project: http://sourceforge.net/projects/wsdl2php/
- require_once 'rx.php';
- // CHANGE the URL to be your assigned testing server or the live server once your app is ready to go live
- $client = new rx("http://localhost/RxWs/rx.asmx?wsdl");
- $updateParams = new UpdateDataForScreens();
- //Setup account credentials (account/sub-account/authkeyh)
- $AccountObj = new Account();
- $updateParams->AccountObj = $AccountObj;
- // CHANGE --- Pass in your assigned account id and auth key for authentication
- $AccountObj->AccountId = 0;
- $AccountObj->AccountAuthKey = "auth key";
- // pass in the practice id and practice name of your practice using your system
- // this can be any id/name that you have - if MDToolbox doesnt have this practice on file for your account
- // it will automatically upload it and start a new subaccount for your account
- $AccountObj->PracticeId="1";
- $AccountObj->PracticeName = "ABC Pediatrics";
- // setup/update location(s) - this is where the prescriber(s) prescribe from (will be sent to the pharmacy)
- $LocationObj = new Location();
- $updateParams->Locations = array($LocationObj);
- $LocationObj->ID = "26";
- $LocationObj->Addr1 = "3535 N Main ST";
- $LocationObj->Addr2 = "";
- $LocationObj->City = "Richland";
- $LocationObj->State = "WA";
- $LocationObj->Zip="99354";
- $LocationObj->ClinicName="ABC Pediatrics Main Clinic";
- $LocationObj->Phone="5051211212";
- $LocationObj->Fax="5051211212";
- $LocationObj->Current=true;
- // setup/update prescriber(s) - can pass all prescribers at the practice or current prescriber
- $PrescriberObj = new Prescriber();
- $updateParams->Prescribers = array($PrescriberObj);
- $PrescriberObj->ID="99";
- $PrescriberObj->FirstName="Jack";
- $PrescriberObj->LastName="Smith";
- $PrescriberObj->DEA="AS123764";
- $PrescriberObj->NPI="1234567890";
- $PrescriberObj->Email="Prescriber@example.com";
- $PrescriberObj->UserName="JackS";
- $PrescriberObj->UserId="29";
- $PrescriberObj->Current=true;
- // patient to create/update - the patient the user wants to write prescriptions for
- $updateParams->PatientObj = new Patient();
- $updateParams->PatientObj->ID="123";
- $updateParams->PatientObj->FirstName="Sarah";
- $updateParams->PatientObj->LastName="Smith";
- $updateParams->PatientObj->Gender="F";
- $updateParams->PatientObj->DOB='1980-01-01';
- // other patient info - optionally upload allergies, conditions, etc.
- $AllergyRecord = new AllergyRecord();
- $updateParams->PatientAllergies = array($AllergyRecord);
- $AllergyRecord->AllergyId=45;
- $AllergyRecord->AllergyName="Peanuts";
- $AllergyRecord->SeverityLevel=1;
- // if default values aren't passed in for certain fields
- // then Rx web service tries to convert empty strings into boolean, date/time, and int values.
- // You could provide permanent defaults in rx.php
- $updateParams->CheckPatEligibility = false;
- $updateParams->EligCheckEncounterDate ="2012-10-19";
- $AccountObj->UserPermissionLevel=0;
- //call web service
- $result = $client->UpdateDataForScreens($updateParams);
- // CHANGE the URL to be your assigned testing server or the live server once your app is ready to go live
- if ($result->StatusFlag != "Error"){
- $url = "http://localhost/WebApp1/Access1.aspx?code=".
- $result->UpdateDataForScreensResult.
- "&aid=" .$AccountObj->AccountId .
- "&sid=" . $AccountObj->PracticeId .
- "&user=" . $PrescriberObj->UserName .
- "&did=" . $PrescriberObj->ID .
- "&lid=" . $LocationObj->ID .
- "&page=RX&pid=" . $updateParams->PatientObj->ID .
- "&header=2";
- echo "URL: <span style='color: red'>".$url."</span>";
- echo "<iframe src='".$url."' style='width:100%;height:600px; margin-top: 10px;'></iframe>";
- }
- else{
- echo "<script>alert('".$result->StatusMsg."')</script>";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement