The Messenger of Allah ﷺ said, "There is no Muslim afflicted with an illness in his body except that Allah commands the guardian angels who watch over him, 'Record for My servant the same good deeds he used to do while he was healthy, for as long as he remains held in My bond.'"Ishaq's version reads, "Record for My servant every day and night."
حدثنا وكيع وإسحاق يعني الأزرق قالا حدثنا سفيان عن علقمة بن مرثد عن القاسم بن مخيمرة
قال رسول الله ﷺ ما أحد من المسلمين يبتلى ببلاء في جسده إلا أمر الله عز وجل الحفظة الذين يحفظونه اكتبوا لعبدي مثل ما كان يعمل وهو صحيح ما دام محبوسا في وثاقي وقال إسحاق اكتبوا لعبدي في كل يوم وليلة
Both of its chains are sahih. It is a repetition of 6482, narrated from Ishaq Azraq alone, with this same chain. It was also narrated by Hakim in Al-Mustadrak 1:348, with two chains through Sufyan Thawri, and he said, "Sahih according to the criteria of the two Shaykhs, but they did not narrate it," and Dhahabi agreed with him.