Hi there
I don't really know too much about the aviation industry but one of my friends is training to become a pilot.
I know that their medicals and alcohol/drug testing is by far the most thorough and strictest of any work role. My friend says that in some jobs, such as becoming an air traffic controller, you have to disclose your full medical history from birth. I would assume that if you've had any issues with mental health and even alcohol misuse from years gone by, I think any role of that nature is a no no.
I don't think the railway industry is that intensive but certainly any medical problems need to be addressed. If you're already working in the aviation industry then this is something you've nailed already and will not be a problem in getting a railway job.
C J