From left: Laurie Metcalf, Niecy Nash and Alex Borstein in HBO’s “Getting On.” (Lacey Terrell/HBO)

In its three short seasons, I feel I’ve done a slight disservice to HBO’s textured and poignantly funny “Getting On” (which returns for its final six episodes Sunday night) by not praising it more. The show, about a doctor and nurses who work in the neglected geriatrics wing of a badly managed Long Beach, Calif., hospital, successfully portrays the pitfalls of American health care as we know it — especially when it comes to caring for the elderly, who are most vulnerable to the system’s shortcomings.

But more than that, “Getting On,” created by Mark V. Olsen and Will Scheffer (who adapted it from a British show), is a fabulous study in character and situational morals. The show’s second season ended calamitously with what seemed to be the certain firing of the self-aggrandizing gerontologist and stool-sample expert, Dr. ­Jenna James (Laurie Metcalf), as well as her main nurses, DiDi Ortley and Dawn Forchette (Niecy Nash and Alex Borstein), who were all unwittingly implicated in a scam to enroll patients in a for-profit hospice program.

That scandal was apparently nothing that several hours of remedial ethics training videos and threats of lawsuits or union actions couldn’t clear up. Duly chastised, everyone is back in their old jobs (James is now conducting medical trials with a dreadful new device called the Barbet anal horn), but each woman is facing a new personal crisis that will clearly see her story to a fitting — if melancholy — conclusion. (Patsy De La ­Serda, the closeted nurse supervisor played by Mel Rodriguez, also seems destined to find his own definition of closure.)

The first four episodes of this new season are among the series’s best. “Getting On” is filled with horrifically hilarious images and subtle digs at corporatized displays of sympathy (such as the visiting therapy dog licking vomit off the floor and then licking the face of the next cuddle­-seeker), but it is also rich with surprising moments of compassion, even for those who don’t necessarily deserve it.

It’s a small show with a deceptively big heart; in its way, ­“Getting On” was the perfect ointment to the wounds left by the Obamacare debate. Network trauma dramas come and go — and with them a lot of serious doctors and nurses and miserable patients — but rarely do we see a show that understands life in a hospital as well as “Getting On” did.

Getting On (30 minutes) returns Sunday at 10 p.m. on HBO.