Thank you for your query and such nice and detailed presentation of your medical history. It appears to be a case of epididymoorchitis none the less, but the issue is its regular recurrence.
I would like to assure you, it does not appear to be related to a
hernia.
Secondly, you need to continue antibiotics for the prescribed period of time religiously, to cure your infection and prevent further worsening of the same.
Thirdly, since there is recurrence, and precipitated by
masturbation, there may be some defect in the uro-genital system, causing reflux of urine into the seminalpathway, which may lead to recurrence of the problem. To diagnose this condition, uroflowmetric studies are needed.
Another explanation may be that every time, the infection is not eliminated completely and hence recurring repeatedly.
You may need to test the bacteria (culture sensitivity) for
antibiotic resistance and also the uroflowmetric studies. I would suggest you to consult an experienced
urologist for a detailed evaluation and management for the same.
Hope I've been able to satisfy your query. Please feel free to ask for any further clarifications. Best of luck.
Dr. Sourav.