Games that doctors play: Two-layered agency problems in a medical system