Patient/doctor confidentiality hasn't exactly helped much here.
Whoever the doctor was signed him off for work. It appears that he suffered from some form of mental illness that led him to intentionally crash a plane full of people. This could have happened at any point in the past 50 years and maybe already has. What are the genuine ways to avoid it? At no point should the doctor be obliged to warn somebody that a pilot has such an illness...?
With this type of illness, surely the doctor should be assessing potential risk to other people...