Mental illness and jobs?

So do any of you wonderful people know whether having a history of mental illnesses such as depression affect jobs which someone wishes to pursue e.g. A doctor. I know the military here does a background check to see if a person is mentally stable for the job. I've heard stories about similar things if you wish to work in a hospital. I would like to see a doctor but I'm not sure how it will affect my future if I wish to pursue certain careers? And do you think a mental illness history should affect whether someone gets a job or not.