Sayyiduna Abdullah bin Amr (may Allah be pleased with him) narrates that the Prophet (peace and blessings be upon him) said: Whenever any person is afflicted with a trial (that is, an illness) in his body, Allah Almighty commands the angels who guard him, saying: "Record for My servant, every day and night, (reward) according to the good he used to do before, as long as he remains in My bonds (that is, remains ill)."
Ahmad, al-Bazzar and al-Tabarani recorded it in al-Mu'jam al-Kabir. The narrators of Ahmad are the narrators of the Sahih.
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الجنائز / 3809