Lili Elbe made history as the first person to undergo male-to-female sex reassignment surgery—and then everyone promptly forgot about her. David Ebershoff found a casual mention of Lili in a text and wondered who this person was and why everyone didn't know about her (source).
Inspired by the story, Ebershoff created his novel. Many facts are taken from Lili/Einar's life, but other characters are created, which is the whole point of historical fiction. It's not a biography, it's a novel, so Ebershoff changed plenty of details—Einar's wife Gerda became Greta, for instance, and he took the liberty of having her hail from California—to illustrate his themes.
One of the most entertaining parts of historical fiction are the details the, well, historical details, particularly those that leave you shaking your head at how people used to roll. And archaic medicine is one of the best ways to get this kind of entertainment value.
Carlisle takes Einar to a variety of doctors who, viewed from today's lens, are pretty much a parade of malpracticing idiots. Dr. Hexler thinks his X-Ray will "drive this desire" (11.55) out of Einar and believes it's possible that what he sees to be Einar's gay desire might even be a demon. Adding insult to injury (or injury to insult, as the case may be) the X-Ray leaves a "small surface burn" (12.9) on Einar's body. Ouch. It's a wonder these doctors don't kill Einar before he becomes Lili.
Hexler's probably the worst, but there's also Dr. McBride, who tells Einar to just ignore his urges. (Ignore it and it'll go away is the worst medical advice ever.) Dr. Christophe Mai diagnoses Einar as schizophrenic and wants him committed. And Dr. Buson wants him to have a lobotomy. Who's his nurse? Nurse Ratched?
It's a relief that Greta finds Professor Bolk, but the ultimate irony is that Bolk's final procedure ends up being fatal. That's one drawback to historical fiction: Sometimes it doesn't have a happy ending.