When I worked 3rd shift consistently, which I did for 5 years, I was ok because I could keep my med routine adjusted for those hours and the same sleep schedule all week to work with it. However, at this new job, they flip you back and forth between all the shifts during the week, and it is playing havoc on my system, cycling faster, problems with insomnia and hypomania, and getting my meds regulated.
A doctor's note alone did not get me out of it. However, it might be sufficient with some employers. I have had to petition for ADA accommodations (which they are dragging their feet on, but which offers the most protection) and FMLA (which I do not think applies but they are pressuring me to file for) to help excuse me from 3rd shift. It is an ongoing issue for me right now.
I wish you well in finding the right balance and what works best for you.