Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.71 KB | None | 0 0
  1. javascript:(function() { url = location.href; if (url.includes("casemgmt")) { email = findEmail(); } else { email = generateEmail(); } var dummy = document.createElement("textarea"); document.body.appendChild(dummy); dummy.value = email; dummy.select(); document.execCommand("copy"); document.body.removeChild(dummy); function generateEmail() { pharmacyInfo = JSON.parse(document.getElementById("Calcs")[0].value); pharmacyName = pharmacyInfo["name"]; pharmacyAddress = pharmacyInfo["address"]; pharmacyCity = pharmacyInfo["city"]; pharmacyProvince = pharmacyInfo["province"].slice(-2); pharmacyWebsite = pharmacyInfo["notes"]; if (pharmacyName == "" || pharmacyAddress == "" || pharmacyCity == "" || pharmacyProvince == "OT" || pharmacyWebsite == "") { alert("Watch out, one of the pharmacy fields isn't set! Please set it before trying again.") } name = document.getElementById("main-table").rows[0].innerText; name = name.substring(name.lastIndexOf("NAME:") + 6, name.lastIndexOf("AGE")).split(" ")[0]; firstName = name.charAt(0).toUpperCase() + name.slice(1).toLowerCase(); providerName = getProviderName(); rows = document.getElementsByClassName("data-drug-table")[0].rows; var email; if (rows.length == 1) { email = "Hi " + firstName + ",\n\n" + providerName + " reviewed your request.\n\nYour prescription cannot be issued at this time. We went ahead and cancelled your order and applied a full refund to your account.\n\n\--\nBest Regards,\nEssential Clinic\n1-833-668-3763\n" } else { introMessage = "Hi " + firstName + ",\n\n" + providerName + " reviewed and approved your prescription request. The prescription has been faxed to the " + pharmacyName + " near you at " + pharmacyAddress + ", " + pharmacyCity + ", " + pharmacyProvince + ". You can pick it up at any time.\n\nMore info on the pharmacy can be found here: " + pharmacyWebsite + "\n\n"; drugsDict = { "02238213": "finasteride 1mg (90 day supply).\n\n", "02447568": "finasteride 1mg (90 day supply).\n\n", "02447541": "finasteride 5mg (1/4 tab a day - 90 day supply).\n\n", "02010909": "finasteride 5mg (1/4 tab a day - 90 day supply).\n\n", "02247813": "dutasteride 0.5mg (90 day supply).\n\n", "02421712": "dutasteride 0.5mg (90 day supply).\n\n" }; prescriptionMessage = "The prescription is for "; rogainePrescribed = false; shampooPrescribed = false; mostRecentDate = rows[1].cells[0].textContent; for (var i = 1, row; row = rows[i]; i++) { datePrescribed = rows[i].cells[0].textContent; if (mostRecentDate === datePrescribed) { drugCode = rows[i].cells[5].textContent; if (drugCode == "null") { customDrugName = rows[i].cells[4].textContent; if (customDrugName.includes("Selsun Blue")) { shampooPrescribed = true; } /* } else if (drugCode == "02368684") { rogainePrescribed = true;*/ } else if (drugCode == "02320320") { shampooPrescribed = true; } else { prescriptionMessage += drugsDict[drugCode]; } } } prescriptionMessage += "If you haven't already, we also recommend using minoxidil (Rogaine) which is a proven combination to prevent hair loss. Rogaine is a topical solution that can be purchased over the counter.\n\n"; if (shampooPrescribed) { prescriptionMessage += "The clinician also advises you to use Selsun Blue shampoo daily if you're experiencing any dandruff, itchiness and/or tenderness on your scalp. If those symptoms still persist after 1 month, you should follow up with your physician.\n\n"; } endOfMessage = "If this is your first time using hair loss medications, it will take 3-6 months to notice increased hair growth and 1 year before you're able to measure the full result.\n\nIf you chose to auto-renew your prescription you will automatically have your prescription refilled after 3 months, otherwise contact us to renew your prescription or to setup auto-renewal. \n\n\--\nBest Regards,\nEssential Clinic\n1-833-668-3763\n"; email = introMessage + prescriptionMessage + endOfMessage; } return email; } function findEmail() { encounterNotes = document.getElementsByClassName("avs-encounter-note"); for (var i = encounterNotes.length-1; i >= 0; i--) { note = encounterNotes[i].innerText; if (note.includes("Best Regards")) { reg = /Hi[^]+1-833-668-3763/; email = reg.exec(note); return email; } } return "no email"; } function getProviderName() { providerName = localStorage.getItem('providerName'); if (providerName == null) { var input = prompt("One-time setup question: Which provider are you?\n\nEnter 1 for Dr. Omer Chaudhary\nEnter 2 for Anra Clark, NP\nEnter 3 for Lindsay Spence, NP\n",""); if (input == "") { return getProviderName(); } else if (input == 1) { providerName = "Dr. Omer Chaudhary"; } else if (input == 2) { providerName = "Anra Clark, NP"; } else if (input == 3) { providerName = "Lindsay Spence, NP"; } localStorage.setItem('providerName', providerName); } return providerName; } })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement