a Mary Sue is an idealized or perfect character in a fiction story, often a fan fiction.
Mary Sue's have lots of amazing traits and success, and often are the author inserting themselves in the story (falsely).
the TV show Royal Pains is similar to many, many other TV shows. the main character doesn't really do things wrong. he's a doctor, he always solves cases, usually with hardly any bumps along the way. (compare with House M.D. where there were always a bunch of mistaken guesses before the correct answer)
but it's not really that Mary Sue. he's not perfect. he doesn't have a million good traits. he's just a doctor and when it comes to the medical cases he always cures his patient. it's kind of like a lawyer show where he always wins his cases. it's kind of an optimism and happy endings thing. and anyway it's a social show more than a medical show, so they focus on that. girls do kinda fall into his lap in the first episode. but the rest of the season 1 isn't especially like that, he mostly tries to date one girl and there's ups and downs.
and i don't think the writers are trying to insert themselves into the story.
but i think the show is worse than a Mary Sue. and many other TV shows work in a similar way.
he's so damn passive and generic and everything happens to him, without him having to go get it. he gets all this success with very little initiative.
the first episode actually starts with him getting fired (unfairly is the narrative, but it's not actually obvious and the show doesn't bother arguing its point there). and then his fiancé dumps him because she wanted to marry a successful doctor (actually that was a bit ambiguous too). and then the hospital that fired him supposedly makes it impossible for him to get any job in medicine. and he bums around his apartment and watches Netflix.
so then his brother comes and gets him to go outside and go to a party in The Hamptons. and then success promptly happens to him. a person at the party has a medical problem. and the rich dude throwing the party has a doctor on call, who misdiagnoses. so the main character gets it right and ends up taking over as the rich guy's doctor. and word immediately spreads so other people start hiring him. a career just falls into his lap. and then someone knocks on his door asking to be his underpaid top-quality physician's assistant, before he's even decided he wants to stay in the area and be a highly paid doctor for rich people.
off topic, the show really tries to avoid the issue of money and payment. and kinda treats him like a regular guy dealing with rich people, kinda ignoring how much he could be charging and how much money he could have how quickly in his position. and lots of services he provides it's kinda ambiguous if he's even charging for them (this is extra problematic because the people receiving the services would want to know that clearly).
i think all the TV shows that portray success as happening by luck to passive characters are really bad. it's doing such a disservice to the world, and their viewers, to fake reality so badly. real life requires initiative. real success requires a go-getter attitude. real success requires effort, it doesn't just come to you.
It's worse than a Mary Sue because he isn't perfect, but the writers give him the benefits and rewards a perfect person would earn.
Edit: Another point I want to add is how the world keeps acting in unrealistic ways convenient for the main character. I have a good example. The main character often takes patients to hospitals, or calls ambulances with EMTs, or otherwise is around other doctors. And they basically always just do whatever he says, immediately, as if they were his assistants.
The main character has none of the traits that could make this conceivable. He doesn't have amazing charisma and leadership skills. He doesn't do anything awesome to make people react this way. They just do, contrary to reality.
Another example of faking reality is how he gets hired by Boris, a rich guy with a serious medical problem. He basically does a bad job, is annoying to Boris, has nothing special to offer ... and is hired anyway, and then repeatedly (informally) promoted, for no apparent reason.