Here is a Ma’aseh Rav showing that R. Hayyim Joseph David Azulai recited this blessing after recovering from an illness which does not seem to have been particularly dangerous or life-threatening, but merely very uncomfortable. In his diary entry for June 14th, 1776 he writes:
Friday, Shelah: some of the community leaders came to see me concerning ‘our secret’ and I was sullen and annoyed. That morning I was unable to get out of bed. I suffered from vomiting and diarrhoea and fever; and I was in distress all day long.
In the entry for the following say he continues describing his illness:
Saturday, the holy Sabbath: we prayed the evening service at home. And I ate a little. In the morning I forced myself, though suffering greatly, to go to the Synagogue. And by dint of great effort I managed to eat two meals, just a small amount; and the vomit and diarrhoea continued.
Again, the next day:
Sunday, Qorah: I was in distress all day through my illness.
And the next day:
Monday, Qorah: I went to the Synagogue in great pain. And they kept on begging me to take a doctor; I had declined [till now] for various reasons. [But now] there had come from Livorno S. Moses Cohen, grandson of Hakham Rabbi Eliezer Ha-Cohen. He showed me his family genealogy - attested to by the old rabbis of Aram Tsovah [=Lebanon], and among whose archives it was found - going back to OMR Samuel Ha-Cohen of the Beth Din of the RaSHBA in Barcelona: and this doctor gave me a medicine three times and the vomiting ceased. On that same day, the g’vir S. Hakham Rabbi Samuel Hai Cohen came from Mantua to visit me and he invited me to his house in Mantua.
The next day:
Wednesday: the doctor gave me rabarbaro [= rhubarb] and the ‘exiting’ ceased. I ate [just] a little meat and toasted bread soaked in wine, ‘for the hand had failed’ and I had no strength. Later I went by Calesso to take a walk round the walls with my good friends the brothers [sic] S. Minervi and his grandsons ytv.
Thursday: I went to the Synagogue and recited the benediction Hagomel [... who deals bountifully] etc.’ Praise t.L.f.H.i.g.f.H.k.e.f.e.