Aviation medicine is practiced by a recognized aeromedical examiner (AME). In military aviation these doctors are called flight surgeons. It is one of many disciplines for medical doctors. The health and safety of all who fly is of the upmost importance to the AME. This includes pilots and cabin crew, as well as passengers. Furthermore, it's also the job of the AME to pursue a just and evidence based selection procedure and to guide and aid the (future) pilot in this process.
Here you can find more information about the EASA classes for aviation
Here you can find more information about the medical examination
Here you can find out when to consult you aeromedical examiner
Here you can find more information about a Fit-To-Fly advice for travelers