Is this Reasons to be Cheerful (1997) by Greg Egan...?
A 12-year-old boy develops a deadly brain tumor that inadvertently floods his system with Leu-enkephalin, the neuropeptide that triggers happiness. Unwaveringly optimistic at his chance of survival, the risky surgery that saves his life also ends the euphoric bliss, leaving his brain with a cavernous hole where the pleasure centers used to be. The 18 years of sadness that follow are a downward spiral of despair, and as a last resort he agrees to another treatment that gives him conscious control over what makes him happy. As he attempts to re-enter the world beyond the hospitals and his gloomy apartment, he faces the ultimate dilemma of self-control ... how happy would you be if you could make yourself as happy as you want?
This reader review from Goodreads suggests the story does have mild sci-fi elements.
Such a joy to be a happy, energetic twelve-year-old. But then crisis hits - as thirty-year-old narrator Mark recounts, a MRI scan revealed there was a specific reason for his constantly feeling elated: pressure from a brain tumor caused the chemistry in his brain to release a flood of endorphins.
Something had to be done - and soon. Surgery was the first option but, unfortunately, the odds were not good: only one in every three patients walked out of the hospital. Mark's parents did the research and found a center offering a new treatment: genetically engineered herbs could be injected into the cerebrospinal fluid with no need of surgery. The survival rate was 80 % (please keep in mind we're talking near future and this is science fiction).
Mark underwent treatment: over the course of the next weeks, the tumor shriveled and Mark was finally sent home. However, huge problem: from that day forward, nothing in life gave Mark any pleasure, not even so much as a shred of pleasure. Everything he did was tainted with an overwhelming sense of dread and shame. He tells us he might as well have been staring at the gates of Auschwitz.
So it goes for poor Mark for the next 18 years. 18 whole years! Taking drugs only made him feel like a zombie. Then one day sitting at the computer in his small apartment, Mark opens an email: he's been contacted by a center in South Africa where a Dr. Durrani has created a new, experimental device for people suffering as Mark is suffering, a computerized device inserted into the brain to regulate mood, pleasure and happiness (again, keep in mind this is Greg Egan science fiction).
Long story short: Mark plays the odds and flies to South Africa, meets with Dr. Durrani and undergoes the procedure.