The antidote to worrisome thoughts is worshipful thoughts. That is, thinking on and trusting in our Master, Father, and King. Isaiah 26-3 says, -You will keep him in perfect peace, whose mind is stayed on You, because he trusts in You.-
James is not referring to physical sickness and healing, but spiritual weakness and restoration. Therefore, this passage isn't just applicable for the hospital room or hospice patient, but is meaningful to all of us in the course of our Christian lives.