A Yorkshire hospitals trust spent almost £17m on wages for locum doctors and nurses last year, new figures have revealed.