There is very little canon dealing with the treatment of mentally ill witches or wizards. It seems, strictly based on canon, that there are spells and isolation used.
There are Shock Spells which are used to treat mental illness.
‘This one’s from a bloke who thinks you’re off your rocker,’ said Ron, glancing down his letter. ‘Ah well ...’
‘This woman recommends you try a good course of Shock Spells at St Mungo’s,’ said Hermione, looking disappointed and crumpling up a second.
Order of the Phoenix - chapter 26 - Seen and Unforeseen
Also, a link to the HP Lexicon's spell syllabary.
The two areas of St. Mungo's that would likely treat mental illness are . . . well, there's mainly one: Spell Damages on the fourth floor, which deals with unliftable jinxes, hexes, incorrectly applied charms, etc. If a person were mentally ill enough to not know who they were or where they were, the welcomewitch could help direct them: If you are unsure where to go, incapable of normal speech, or unable to remember why you are here, our welcomewitch will be pleased to help you. Order of the Phoenix - chapter 22 - St. Mungo's Hospital for Magical Maladies and Injuries
[The Dumbledores' father] never said why he’d done it, because if the Ministry had known what Ariana had become, she’d have been locked up in St Mungo’s for good. They’d have seen her as a serious threat to the International Statute of Secrecy, unbalanced like she was, with magic exploding out of her at moments when she couldn’t keep it in any longer. We had to keep her safe, and quiet. We moved house, put it about she was ill, and my mother looked after her, and tried to keep her calm and happy.
Deathly Hallows - Chapter 28 - The Missing Mirror
Unfortunately, it seems as if mental illness is as stigmatized in the wizarding world as it is in the Muggle world. Based on what we see, individuals with mental illness and brain damage are kept on a locked ward in St. Mungo's and treated with a variety of spells and TLC. Shock Spells are also available and if they're analagous to Electro Convulsive Therapy (i.e. Muggle shock treatment) they may be helpful.