The number of patients waiting for a hospital appointment has jumped by more than 40,000 people in 2019.