You can get plenty of serious pain medications in Thailand, over the counter. If one doesn't have what you want, try some others. But I buy tramadol, over the counter, without prescription.
Go see a doctor, if what you say is correct, he will give you a certificate, for immigration. I had 9 months of just that, I had a disc, herniate in my lower back. The orthopaedic surgeon, gave me ongoing certificates, until I could travel again.