Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>PHP Test</title>
  4. </head>
  5. <body>
  6. <?php
  7. // classes and SOAP Client were auto generated using WSDL2PHP, an open source project: http://sourceforge.net/projects/wsdl2php/
  8. require_once 'rx.php';
  9.  
  10. // CHANGE the URL to be your assigned testing server or the live server once your app is ready to go live
  11. $client = new rx("http://localhost/RxWs/rx.asmx?wsdl");
  12.  
  13. $updateParams = new UpdateDataForScreens();
  14.  
  15. //Setup account credentials (account/sub-account/authkeyh)
  16. $AccountObj = new Account();
  17. $updateParams->AccountObj = $AccountObj;
  18.  
  19. // CHANGE --- Pass in your assigned account id and auth key for authentication
  20. $AccountObj->AccountId = 0;
  21. $AccountObj->AccountAuthKey = "auth key";
  22.  
  23. // pass in the practice id and practice name of your practice using your system
  24. // this can be any id/name that you have - if MDToolbox doesnt have this practice on file for your account
  25. // it will automatically upload it and start a new subaccount for your account
  26. $AccountObj->PracticeId="1";
  27. $AccountObj->PracticeName = "ABC Pediatrics";
  28.  
  29. // setup/update location(s) - this is where the prescriber(s) prescribe from (will be sent to the pharmacy)
  30. $LocationObj = new Location();
  31. $updateParams->Locations = array($LocationObj);
  32.  
  33. $LocationObj->ID = "26";
  34. $LocationObj->Addr1 = "3535 N Main ST";
  35. $LocationObj->Addr2 = "";
  36. $LocationObj->City = "Richland";
  37. $LocationObj->State = "WA";
  38. $LocationObj->Zip="99354";
  39. $LocationObj->ClinicName="ABC Pediatrics Main Clinic";
  40. $LocationObj->Phone="5051211212";
  41. $LocationObj->Fax="5051211212";
  42. $LocationObj->Current=true;
  43.  
  44. // setup/update prescriber(s) - can pass all prescribers at the practice or current prescriber
  45. $PrescriberObj = new Prescriber();
  46. $updateParams->Prescribers = array($PrescriberObj);
  47.  
  48. $PrescriberObj->ID="99";
  49. $PrescriberObj->FirstName="Jack";
  50. $PrescriberObj->LastName="Smith";
  51. $PrescriberObj->DEA="AS123764";
  52. $PrescriberObj->NPI="1234567890";
  53. $PrescriberObj->Email="Prescriber@example.com";
  54. $PrescriberObj->UserName="JackS";
  55. $PrescriberObj->UserId="29";
  56. $PrescriberObj->Current=true;
  57.  
  58. // patient to create/update - the patient the user wants to write prescriptions for
  59. $updateParams->PatientObj = new Patient();
  60. $updateParams->PatientObj->ID="123";
  61. $updateParams->PatientObj->FirstName="Sarah";
  62. $updateParams->PatientObj->LastName="Smith";
  63. $updateParams->PatientObj->Gender="F";
  64. $updateParams->PatientObj->DOB='1980-01-01';
  65.  
  66. // other patient info - optionally upload allergies, conditions, etc.
  67. $AllergyRecord = new AllergyRecord();
  68. $updateParams->PatientAllergies = array($AllergyRecord);
  69.  
  70. $AllergyRecord->AllergyId=45;
  71. $AllergyRecord->AllergyName="Peanuts";
  72. $AllergyRecord->SeverityLevel=1;
  73.  
  74. // if default values aren't passed in for certain fields
  75. // then Rx web service tries to convert empty strings into boolean, date/time, and int values.
  76. // You could provide permanent defaults in rx.php
  77. $updateParams->CheckPatEligibility = false;
  78. $updateParams->EligCheckEncounterDate ="2012-10-19";
  79. $AccountObj->UserPermissionLevel=0;
  80.  
  81. //call web service
  82. $result = $client->UpdateDataForScreens($updateParams);
  83.  
  84. // CHANGE the URL to be your assigned testing server or the live server once your app is ready to go live
  85.  
  86. if ($result->StatusFlag != "Error"){
  87.  
  88. $url = "http://localhost/WebApp1/Access1.aspx?code=".
  89. $result->UpdateDataForScreensResult.
  90. "&aid=" .$AccountObj->AccountId .
  91. "&sid=" . $AccountObj->PracticeId .
  92. "&user=" . $PrescriberObj->UserName .
  93. "&did=" . $PrescriberObj->ID .
  94. "&lid=" . $LocationObj->ID .
  95. "&page=RX&pid=" . $updateParams->PatientObj->ID .
  96. "&header=2";
  97.  
  98. echo "URL: <span style='color: red'>".$url."</span>";
  99.  
  100. echo "<iframe src='".$url."' style='width:100%;height:600px; margin-top: 10px;'></iframe>";
  101. }
  102. else{
  103. echo "<script>alert('".$result->StatusMsg."')</script>";
  104. }
  105.  
  106. ?>
  107.  
  108. </body>
  109. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement