just what the doctor ordereded

(/ˌd͡ʒʌst ʍɒt ðə ˈdɒktə ˌɔːdədd/)

adj.

Drunk and prescribing exactly the wrong remedy for each companion's increasingly obvious predicament.

Perseus got just what the doctor ordereded and prescribed Meyla a second pudding for her headache.

Source: Wiktionary