The Messenger of Allah ﷺ said, "When you visit a sick person, give him hope of a long life. That will not change anything from what is decreed, but it will comfort his heart."
حدثنا أبو بكر بن أبي شيبة حدثنا عقبة بن خالد السكوني عن موسى بن محمد بن إبراهيم التيمي عن أبيه
قال رسول الله ﷺ إذا دخلتم على المريض فنفسوا له في الأجل فإن ذلك لا يرد شيئا وهو يطيب بنفس المريض
Its isnad is extremely daif. Tirmidhi transmitted it in Kitab al-Tibb, chapter on comforting the sick person, no. 2087, from the hadith of Uqbah with this wording, and he said it is gharib. Musa bin Muhammad Taymi is munkar al-hadith, as stated in Taqrib and elsewhere.