Hadith 13501

(حديث قدسي) حَدَّثَنَا حَسَنٌ ، حَدَّثَنَا حَمَّادُ بْنُ سَلَمَةَ ، عَنْ أَبِي رَبِيعَةَ ، عَنْ أَنَسِ بْنِ مَالِكٍ : أَنّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ ، قَالَ : " مَا مِنْ عَبْدٍ يَبْتَلِيهِ اللَّهُ بِبَلَاءٍ فِي جَسَدِهِ ، إِلَّا قَالَ اللَّهُ لِلْمَلَكِ : اكْتُبْ لَهُ صَالِحَ عَمَلِهِ الَّذِي كَانَ يَعْمَلُهُ ، فَإِنْ شَفَاهُ اللَّهُ ، غَسَلَهُ وَطَهَّرَهُ ، وَإِنْ قَبَضَهُ ، غَفَرَ لَهُ وَرَحِمَهُ " .
It is narrated from Hazrat Anas (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) said: When Allah Almighty afflicts any Muslim servant with a physical illness, He commands the angels to continue recording the reward of all the good deeds that he used to do. Then, if He grants him recovery, Allah has cleansed and purified him, and if He calls him back to Himself, He forgives him and has mercy on him.
Hadith Reference مسند احمد / مسند المكثرين من الصحابة / 13501
Hadith Grading حکم دارالسلام: صحيح لغيره، وهذا إسناد حسن