2 Corinthians 1:3-4:

Blessed be God, even the Father of our Lord Jesus Christ, the Father of mercies, and the God of all comfort;
Who comforteth us in all our tribulation, that we may be able to comfort them which are in any trouble, by the comfort wherewith we ourselves are comforted of God.

See also:

To Heal the Brokenhearted
What Is “Inner Healing,” and Do I Need It?
What Can You Say to Someone Who Just Lost a Loved One to Sickness?
Objection: Psalm 41:3 Proves That God Permits Sickness but Gives You Grace to Bear It
Condition: Brokenheartedness