Former president Jair Bolsonaro had been hospitalised for more than a week as he underwent surgery for a groin hernia and treatment for recurring hiccups.