Nationwide, donations to hospitals exceeded $10.4 billion in 2017, up from $6 billion in 2004, according to the Association for Healthcare Philanthropy.

“Grateful patients have always been there, but we did not always do as good a job of inviting them to be part of our missions as we are now doing,” Alice Ayres, the trade group’s chief executive officer, said. She attributed the increased fund-raising to grateful patients programs as well as to a shift away from event-driven efforts, a focus on larger gifts and overall economic growth in the United States.

A 2013 change in federal health privacy law made it easier for hospitals to target their patients for donations. It enabled hospital records departments to share with staff fund-raisers some personal details of patients, including their health insurance status, the department treating them, the name of their physician and the outcome of their care.

When patients are admitted, they typically sign a raft of papers that include permission for the hospital to use this information for fund-raising. While the 2013 law required hospitals to inform patients that they could decline to be solicited by fund-raisers, few patients are aware of this, said Deven McGraw, a former deputy director of health information privacy at the federal Department of Health and Human Services. And, she said, few appear to realize that their wealth may be assessed for fund-raising.

Many hospitals send solicitation letters to all of their insured patients, including those with little desire — or ability — to make donations.

St. Clair Hospital in Pittsburgh treated Marcy Grupp in its emergency room for three hours in May for a painful kidney stone, providing a computerized tomography scan, among other tests. Medicare paid the bill.

A month later, the hospital sent Ms. Grupp, a retired television engineer, a letter asking for a donation to honor a doctor or other caregiver. “We encourage you to please consider honoring their efforts with a ‘gift of gratitude,’ by making a donation to St. Clair Hospital,” the letter said.