From my memory of taking my 3rd class medical its trust based, if you don't have a written record in your med file of mental problems or tell the doc you have problems then there's no way for them to know.
Also from memory a 1st class was pretty much a 3rd class with stricter limits and an electrocardiogram which is why it costs microscopically more. At least in the old days if you got a 1st after it expired, it acted like a 2nd for the remainder of the year, and a 3rd for the next year, but a 1st cost more, so I didn't bother (not expecting to achieve ATP cert within 6 months of my solo LOL)
Crudely and inexactly but more or less true, you need a valid 3rd to be a general aviation pilot, a valid 2nd to haul cargo or be a bush pilot, and a valid 1st to work for an airline. Things will be slightly different in Germany but less different than you'd think... we have trust agreements to allow them to fly here and us to fly there so things are vaguely similar but it doesn't matter if my details are slightly off.
http://flighttraining.aopa.org/students/presolo/special/medi...
Finally you have to be realistic. If 25% of the population experiences a mental health issue at some point in their life or whatever ridiculously high percentage, then given the huge fraction of the population flying with issues, issues obviously almost never cause a problem, its right up there with meteor strikes. So you end up with false positive/negative issues. If you assume all men have been dumped by a girlfriend at least once that means roughly 3e9 false positive if you assume all dumped dudes are going to mass murder an entire airplane, a false positive rate of eight nines I think? That idea would be up there with banning German pilots, after all one of them apparently did kill a lot of people and the false postive rate is staggeringly lower than banning all people with mere claustrophobia or a bad attitude or whatever.