-1
You can use the clause WITH to reuse its query and bring only the greatest result of COUNT:
WITH quantidade AS (
[SUA QUERY]
)
SELECT q1.*
FROM quantidade q1
WHERE NOT EXISTS(SELECT 1
FROM quantidade q2
WHERE q2.id = q1.id
AND q2.count < q1.count)
The basic value of SELECT in WITH is to break down Complicated queries into Simpler Parts.
In free translation:
The basic goal of SELECT within WITH is to break complicated quries into simpler parts.

Have you tried removing the
apdr.id_antibiotic_prescriptionofGROUP BY?– Marcelo Shiniti Uchimura
I tried yes, the result is VERY similar to expected but it takes the HIGHEST value of Count...
ID | COUNT
1 2
2 0
3 11
4 4
5 3– Retiorts
How NOT to Ask Questions Manual - Post Code as Image
– Sorack