I took the liberty of changing the datatype of dat and changed the name of group to groupe.
WITH modified_medical
AS (SELECT hospital, pid, dat
FROM medical
WHERE groupe = 'A3')
SELECT *
FROM medical a, modified_medical b
WHERE b.hospital = a.hospital
AND b.pid = a.pid
AND a.dat BETWEEN b.dat AND b.dat + 20
ORDER BY a.hospital, a.pid, a.dat;
Sample fiddle here.