Trends and determinants of quality of life and self-rated health in the course of medical education among medical students