His (Sallallahu ‘Alayhi wa Sallam) Guidance in Treating Afflictions
Excerpt from the Book: Provisions for the Hereafter
by Ibn Qayyim
Allah, Most High says:"And certainly, We shall test you with something of fear, hunger, loss of wealth, lives and fruits, but give glad tidings to As-Sabirun (the patient). Who, when afflicted with calamity, say: "Truly, to Allah we belong and truly, to Him we shall return." They are those on whom are the Salawat (i.e. who are blessed and will be forgiven) from their Lord, and (they are those who) receive His Mercy, and it is they who are the guided' ones." 
Then he (i.e. Ibn Al-Qayyim) mentioned the Hadeeth of Al-Istirja'  and then he said: This expression is one of the most effective and most beneficial treatments for one who is afflicted by calamities, because it contains two fundamental principles, which if they are realized, the slave will be consoled thereby from his calamity.
The first of them is that the slave and his wealth belong to Allah and He has given it to him as a loan.
The second of them is that the return is to Allah and it is inevitable that he will leave the life of this world behind; so if this is his beginning and his end, then his thinking about them is one of the greatest treatments for this illness and a part of his treatment is that he knows that what was ordained to afflict him cannot miss him and what was ordained to miss him cannot afflict him.
And a part of it is that his Lord has set aside for him the like of that which he missed or better and He has stored up for him that which is many times better than the calamity and that if He had willed, He could have made the calamity greater than it was.
Another part of it is His extinguishing the fire of his misfortune by the coolness of comfort and consolation, so he should look to his right and to his left (i.e. at the world around him) and he should know that the pleasures of this life are an illusion, though they may cause him to laugh a little, they will cause him to weep much.
Also a part of it is the knowledge that discontent does not alleviate the misfortune; indeed, it increases it.
And another part of it is the knowledge that losing the reward which Allah has guaranteed for patience and Istirja' is greater than it.
And another part of the treatment is the knowledge that discontent causes his enemy to take pleasure and grieves his friend and makes his Lord Angry.
Still another part of it is the knowledge that the pleasure which follows patient perseverance and the expectation of Allah's Reward is many times greater than that which he would have experienced from the thing which he lost, if it had remained with him.
Another part of it is that he should soothe his heart by seeking recompense for it from Allah.
And a part of it is the knowledge that his reaction to the calamity will determine what happens to him, for whoever accepts (Allah's Qadar), Allah will be pleased with him and whoever is angry at it, Allah will be Angry with him.
Also a part of the treatment is the knowledge that even if he was patient sometime after the calamity struck, that being the patience of one who is resigned, that is not praiseworthy and it is not rewarded.
And another part of it is the knowledge that one of the most effective medicines is the success granted by Allah in attaining that which He loves and which is pleasing to Him and that it is the essence of love.
Another part of it is for him to compare between the greater and the lesser of the two pleasures: between the pleasure which he enjoys due to (his acceptance of) the calamity which befell him and the pleasure which he enjoys due to the reward of Allah (which he receives due to his acceptance and patient perseverance).
And a part of it is the knowledge that the One Who puts him to trial is the Best of judges and the Most Merciful of those who show mercy and that He has not subjected him to misfortune in order to destroy him, but in order to test him and to hear entreaties and see him prostrating at His door.
Another part of it is the knowledge that misfortunes are a means of preventing sickness which will cause his destruction, such as pride, arrogance, and hardness of heart.
Still another part of it is the knowledge that the bitterness of this life is the sweetness of the afterlife and vice versa. And if this is not apparent to you, examine the words of the truthful one, whose words are believed:"Paradise is surrounded by hardships and the Hell-Fire is surrounded by temptations." 
And in this matter, the minds of mankind are at fault and the reality of men is made clear (i.e. that they prefer the temporary pleasures of this world to the everlasting pleasures of the Hereafter).
 Surah Al-Baqarah 2:155-157
 Al-Istirja': Saying the words: "Inna Lillahi Wa Inna Ilaihi Raji'un" (Verily, we are for Allah and to Him we shall return). This Hadeeth was narrated by Muslim and Ahmad, on the authority of Umm Salamah
 Narrated Muslim, At-Tirmidhi, Ahmad and Ad-Darimi, on the authority of Anas Ibn Malik