I do not know it except that he traced it back to the Prophet. Affan reported from Thawban, tracing it back to the Prophet ﷺ, who said, "The one who visits the sick is in the gardens of Paradise." Ibn Mahdi had no doubt about it.
حدثنا يونس وعفان قالا حدثنا حماد عن أيوب عن أبي قلابة عن أبي أسماء
لا أعلمه إلا قد رفعه قال عفان عن ثوبان رفعه إلى النبي ﷺ قال عائد المريض في مخرفة الجنة ولم يشك فيه ابن مهدي