Physical functioning and mental health in patients with chronic medical conditions