Any fictional television show about a real profession runs the risk of getting things wrong. I work for a newspaper and cringe whenever I see reporters portrayed on TV. (They’re always so self-serving and venal. What’s up with that?) I once interviewed a criminology professor who complained about the stunningly obvious things CSI characters say at crime scenes. Real forensic investigators, he explained, don’t shout, “Look at this! It looks like blood! We’d better send it to the lab!” But if you talk to doctors, they’ll often sing the praises of one medical show in particular, which they say captures the training process, the profession, and the dynamics of a hospital with remarkable accuracy. No, it’s not House, the tale of a misanthrope who happens to be a doctor. It’s not Grey’s Anatomy, a torrid romance novel disguised as a medical show. It’s not even the recently departed ER, which broke television ground with its realistic gore. It’s Scrubs.

After seven seasons on NBC and an eighth on ABC, the series airs tonight what might be its final episode. If it returns next fall—”a coin flip,” at this point, creator Bill Lawrence told me—it will feel like a different show, tracking familiar characters but at a different stage in their lives and careers. Scrubs follows the travails of doctors John “J.D.” Dorian (Zach Braff), Christopher Turk (Donald Faison), and Elliot Reed (Sarah Chalke), who launched their careers in 2001 as interns at the fictional Sacred Heart Hospital.

To the layman, the half-hour sitcom may hardly seem like a paragon of factual accuracy. Its approach isn’t realist or vérité—on the contrary, it’s essentially a live-action cartoon, filled with fantasy cut-aways, bathroom humor, sex jokes, and jiggy dances. At any moment, a Sacred Heart physician might imagine sick patients ballroom dancing through the ward or a scowling malpractice lawyer strutting through the waiting room and tossing out business cards like a blackjack dealer. J.D., meanwhile, has been known to contemplate a tough medical decision while stroking Justin, his stuffed “soul-searching unicorn.”

This probably doesn’t sound like any hospital you’ve visited. But if you look past the cartoonishness, you find a series that’s quite in tune with the real lives of doctors—and unlike your typical medical drama, one that’s not required to end each episode with a climactic surgical procedure or whiz-bang diagnosis. ER, for instance, was about the heroic things doctors do to save lives, and every episode was rife with calamity. Scrubs, on the other hand, is mostly about what happens at hospitals between crises—the way doctors and nurses handle ordinary cases. And doctors say that as a depiction of the residency process, the show hits strikingly familiar emotional notes. J.D. narrates nearly every episode in a voice-over, setting up jokes and transitions between bits, but also describing his thoughts and insecurities. Doctors say they recognize in J.D.’s internal monologue the real thought processes of a young doctor at work.

“He says exactly what a resident feels, day in or day out. ‘Am I hurting the patient? Am I learning what I should? Am I kissing up too much to the attending?’ ” says Jonathan Samuels, an attending rheumatologist at the NYU Hospital for Joint Diseases. “I always thought Scrubs was right on.”

If the show feels like somebody’s real-life experience, that’s probably because it is. Creator Bill Lawrence, the man behind Spin City, Clone High, and the upcoming Cougar Town, built Scrubs around stories from his college friend Jonathan Doris, now a cardiologist in Los Angeles and a medical adviser to the show. He found humor in Doris’ experiences, he says, and also a truth about human nature that’s not often seen in medical shows. “In television, we like our doctors to be very heroic and very dramatic, and they kick doors open, and they say the word stat a lot,” Lawrence says. But: “If your buddy was a funny kind of goofball that made jokes out of everything in college, then as a doctor, he’s the same guy.”

Some moments from Doris’ residency found their way directly onto Scrubs, says Dr. Paul Pirraglia, an internist in Providence, R.I., who was part of Doris’ Brown University resident class. In the pilot, J.D. performs a procedure called a paracentesis to drain fluid from a patient’s distended belly; he turns away for a moment, then looks back to discover a geyser of fluid gushing into the air. It happened—just like that—to a fellow resident at Brown. Lawrence says Doris, like the fictional J.D., also hid in a closet early in his residency to avoid being the first doctor on the scene when a patient was coding.

In fact, Lawrence says, nearly every medical scenario on the show has originated with a real-life situation, tweaked a little bit for drama and the constraints of half-hour comedy. Each year, he assigns his writers to interview five doctors and report back with story ideas. Doctors often volunteer funny stories as well, he says, though many of them involve objects that patients manage to insert in their rear ends—a plotline Lawrence and his crew could use only once. (For Scrubs purposes, it was a light bulb.)

But Pirraglia and other doctors say what makes Scrubs resonate isn’t the specific scenarios so much as the broader themes. The show tracks the tensions between surgical and internal medicine residents—the jocks vs. the chess club, as J.D. puts it in the pilot. It captures the allure of private practice—in Season 6, Elliot takes that route and enjoys the fruits of an inflated salary. It explores the risks and rewards of intra-hospital romance, through the on-again, off-again relationship between Elliot and J.D.—which is currently quite on. It dramatizes the ways hospitals struggle to allocate resources—Dr. Kelso, Sacred Heart’s chief of medicine, has more than once ordered a patient without insurance to go untreated. And it pokes fun at the way residents jockey to get plum assignments—in one episode, residents race down a hallway like Pamplona bulls for the right to treat a member of the hospital board, trampling one another and several patients in the process.

Even these fantasy sequences can be seen as an element of the show’s verisimilitude, suggesting a sort of survival tactic, a way to endure the grueling rhythms of life on 36-hour shifts. Scrubs captures the agony of hunger and fatigue those shifts force doctors to endure, says Dr. Svetlana Krasnokutsky, another attending rheumatologist at NYU and Samuels’ fiancee. (Hospital romance does happen in real life; there’s hope for J.D. and Elliot yet.) She recalls watching a Scrubs doctor eat food off a comatose patient’s tray. Krasnokutsky says she’s never gone that far, but she’s thought about it.

Krasnokutsky says she, too, identifies with J.D.’s constant self-reflection and self-doubt. In the pilot, J.D. declares, “I don’t know jack,” and the show in many ways has been an ongoing exposition of that point. Residents often feel like they know nothing, Pirraglia says, yet they’re suddenly invested with huge amounts of responsibility, expected to give orders to much-more-experienced nurses, required to make quick decisions with life-or-death consequences.

“Being a resident is a strange place between officially being a doctor, which you are, but also really not knowing it all,” he says. “You get this level of authority that you don’t think you deserve. All of a sudden you’re the doctor and people are going to listen to you.”

What helps—and also comes through on Scrubs, he says—is the support of fellow doctors. A seminal moment in his own residency came when he was called to a patient with a serious gastrointestinal bleed. Blood poured over the table. Time was running out. And suddenly, the room was filled with fellow residents, offering unsolicited help. Over and over again, even when they’re mired in hospital politics or a relationship squabble, Elliot and J.D. do the same for each other. In the Season 4 episode “My Office,” they snipe at each other relentlessly after being named co-chief residents. But when a patient codes, they work together without a second thought. “The best thing about this place,” J.D. says in his voice-over, “is that when somebody’s really in trouble, all the pettiness melts away.”

Despite the dogged efforts of the medical staff, however, the patients on the show sometimes die anyway—sometimes because the Scrubs doctors have made fatal mistakes. Scrubs isn’t a procedural built around dramatic recoveries, and many of the episodes, as goofy as they are, end on notes that are wistful or just plain sad. “You never promise a patient they’re gonna be fine,” the abrasive Dr. Cox growls to J.D. in the Season 4 episode “My Best Moment.” “God hates doctors. He truly does. …”

That case had a happy outcome—it was a Christmas episode, after all. Unflinching as it often is, Scrubs also maintains an unabashedly sentimental perspective on medicine. That could well be something else that doctors love about the show and a reason Lawrence is asked to speak at medical school graduations. J.D and his colleagues may be by turns blustery and mired in secret self-doubt, but they’re also uniformly human and well-meaning; even the supposedly hard-hearted, penny-pinching Dr. Kelso has turned out to be a softie in the end. God might hate doctors, but Scrubs loves them, and the feeling is mutual.