Hospitals, in my direct experience, won't let you take your own medications, or have them in the room, Rx or OTC. Way they enforce that is to tell you you can't. If you reject that, then they threaten to discharge you. They "explain" all (their) reasons why you can't leave. I haven't had one actually say they'll physically restrain me - but they did imply it. Mostly, they'll let you use your own diåpers.
Your regular Rxs mean nothing to them - you can only take what THEY give you. They know your medical history and ignore any part they want to ignore. Now, if they'd deign to explain? I've been lucky. All my other hospitals were good.
ERs are different. An ER nurse can tell the doctor to write a "now" Rx for you, knowing how hard it is to make ends meet; they have to, also, after all. Just have you promise to take that first one ASAP.
There is one hospital that I will have to be unconscious to go there - and upon coming back to consciousness, will leave if I have to do so in their gown.
Of course, if your spouse smuggles them in, the hospital will put their meds on the bill, anyway, even though you didn't take them. So you tell Medicare and the Insurance Company that the hospital is engaging in fraud. Boy, does that wake Medicare up! If you don't take theirs, the nurse freaks out and the docs get nasty. Well, "distant".
You go home and there are 12 Rxs waiting at the pharmacy - which they didn't tell you would happen. You have no way to understand. They prescribe ones you already take and the Insurance Company has a litter of kittens because your supply of the old (but the same thing) isn't out, yet. You have to explain to the pharmacist, and then he and you go over them, and he takes back (actually has to trash) the "overage", and you ask your real doctors and that pharmacist about the meds you didn't take before. Most get canceled. I went through exactly that. The lesson: pay Attention! Don't actually take home or accept whatever you don't understand or that you know is overage. The pharmacist knows that, if you are not sure. If necessary, call the Insurance Company. They'll help you so they get out of the cost. I had to go back for a check-visit. Just told the Doc: the Insurance didn't cover it and I'm not buying it. He was sorrowful; I was not so broke.
I'm not sure there is a way to win, but some of those drugs were pricey and I didn't have to pay for them. I didn't make medical decisions by myself, just let MY docs do that, and consult with me. One called the hospital Doc, and still didn't have me take one Med. I had good docs, I think.