If unfit to attend court for a medical reason send the doctor's certificate to that effect to Gardai first, as Judge is likely to ask Gardai if they can confirm that you are ill.
In my experience very few people really like being in court either as a witness or as a litigant, so many judges are sceptical of certificates. The certificate would need to show a relatively serious condition - not just "stress" "severe cold" "back pain".
It depends on how essential your evidence is in proving the state case.