A man who exposed himself and directed lewd comments towards staff at a Belfast hospital has been jailed for six months.