It is narrated from Sayyiduna Khawwat bin Jubayr (may Allah be pleased with him); he said: I fell ill and the Prophet (peace and blessings be upon him) came to visit me. When I recovered, he (peace and blessings be upon him) said: "Whoever falls ill makes some vow and intends some good deed; so fulfil this promise of yours to Allah."
Hadith Referenceالمعجم الكبير للطبراني / باب الخاء / 4133