"Let us come before his presence with thanksgiving, and make a joyful noise unto him with psalms." (Ps 95:2)
Giving thanks for what we have been given that we view as "good" is simple. We say "thank you" and mean it from our hearts. Giving thanks for what has been taken away, or what we don't see as a blessing is an entirely different story.
The most important thing to remember is that everything that touches us, passes through God's hands first. Even the things we feel to be painful and unfair, are sent to us with our Father's blessing. Whether it is the loss of a job or the diagnosis of a fatal disease, it has his approval. Yes, we may ask why (as Jesus did while his mortal life literally hung in the balance), but it is through our acceptance of his will for us that we grow in faith.
I believe in miracles. I've seen them. I know that one "medical" miracle was not a "misdiagnosis", but truly the power of God answering a prayer and making my friend a true witness to the power of God. I also know of others who have been dealt what we would consider a "bad hand". Life is not a poker game. We cannot simply "fold" because we do not like the cards we have right now. We do not know what cards may follow. Anything is possible!
Regardless of the pain, the struggle and the appearance, pain and sickness, too, is a gift from God that we should and are told to rejoice in. When we hear the words "death with dignity", we need look no further than the cross for an example of courage and strength.