We are in the fantasy section, right?
(Because if not, I probably would lose my medical license, even if they had me get one, just to take it away next.)
For a male patient (or me as shamless self-insert in this fantasy) it would look like this:
After the first suspicion that we have a case of compulsive masturbation at hand, we first have to make this correct. So the patient has to fill out some paperwork - mainly a consent form for advanced diagnosis and treatment, as the usual allergies and meds lists.
Then thorough examination has to follow (who knows what damage the overstimulation has done?).
For this the patient has to be naked and is placed and fixated with segufix-style cuffs on an urological chair. Fixation of course to avoid unwanted self-pleasuring.
Blood pressure is taken and ekg-electrodes (the suction ones with the blue bulbs) are placed and an EEG-cap is placed over the head.
This tight monitoring is essential for the next step of the diagnosis-process. The paraphilia-determination.
Here the patient, properly fixated and monitored is confronted with different objects and elements of known fetishes, ranging from nurses wearing normal gowns, vintage dresses or latex, to different movies showing medical scenes, hetero and homosexual scenes, bdsm and so on.
Monitoring shows more accurate and truthful than the patient ever could or would do, what really stimulates him. (And since House MD we all know, patients lie.)
Of course some cross measurments have to be taken - like measuring circumfence and hardness of the penis.
Once it is clear that the patient indeed is a - vulgarly called - pervert, he is questioned about his masturbation habits (of course by a nurse or doctor with the prefered gender and dress). Again the monitoring shows any deviation from the truth.
At this point, alas it is undeniable, that the patient is a pervert and chronic masturbator. The only known treatment for this - sexual exhaustion therapy.
Depending on the details of the examination and paraphilia-determination, a strict stimulation plan is set up. Including but not limited to manual stimulation by a nurse or male nurse, utilisation of different therapy tools (commonly known as sextoys), electro-stimulation and mechanical milking machines or strokers (like a Serious Kit Milker or a Venus 2000).
In any case the patient is restrained during the whole procedure - because preventing to touch himself is an important part of the therapy.
The goal of each therapy session ranging from about 20 Minutes up to several hours is to completely deplete any sexual desire by causing as many orgasms as possible.
So after the first orgasm - which occurs according to experience mostly in the first ten to twenty minutes and is mostly done in a rather quick way - gloved hands of a trained nurse or using a artificial vagina the patient is granted a short rest - while confronted with arousing movies / sounds and smells.
The next orgasms are harder to achieve and take more time and effort. Here other therapy tools and even the full physical involvment of a nurse or male nurse might be required. For this purpose a wide range of exam tables and beds are available.
The patient has also agreed that therapy sessions could be recorded (for either educational purposes, or as part of other patients paraphilia-determination) and that practicioners, nurses and researchers even might watch the procedures.
For female patients, the examination is roughly identical, physical exam, followed by determining fetishes, and then a multiple orgasm therapy by any means necessary.
However the therapy, still experimental at this point is not meant for healing the issue, mind you. Rather it alleviates the symptoms. Successful treated patients don't suffer from their compulsive masturbation urge for at least three to five days, on average about a week. After that phase the urge is slowly re-apperaring. But until the symptoms become unbearable again, it might take weeks to months, till the next thereapy is needed.
With this therapy we could grant a normal unproblematic life with 10 to 30 therapy sessions a year.