Did any of the Church Fathers write about what today with modern medicine we know to be mental illnesses?
Perhaps, but not as psychology might understand it today. Mental illness was generally thought to be caused by demonic possession, or by some sort of spiritual shortcoming like falling to temptations or passions. There was of course no thought of a biological basis for mental illness like a chemical imbalance.
Mark 5:1-20 tells the story of Jesus exorcising a man who had an "unclean spirit," who was constantly crying out and self-harming(!) "cutting himself with stones." The demons asked to be cast into a nearby swine instead, and Jesus does this; subsequently, "about two thousand" pigs ran into the sea. (Bible text)
In the comments to the question, Lesley lamented that it would be difficult to corral Church Fathers on any particular verse. Luckily, I came across a great collection of commentary on Mark on Google Books. (Full disclosure: I discovered this book while looking for sources for the quotations collected in the wonderful Catena app.) It is heartening to read the commentary on this text, for the Church Fathers emphasize Jesus' compassion for the man possessed by demons:
[The man possessed by demons] asked for respite, without deception, in his anguish, and our Lord in his kindness granted this request. His compassion for the demoniac is a rebuke to the demons, showing how much anguish his love suffers in desiring that humans should live.
--St. Ephrem the Syrian, Hymns on Paradise
You energumens, afflicted with unclean spirits, pray, and let us all earnestly pray for them, that God, the lover of humankind, through Christ, may rebuke the unclean and wicked spirits, and deliver the faithful from the dominion from the adversary.
--Constitutions of the Holy Apostles
It's unlikely that you will find the Church Fathers talk about depression or anxiety using those words, but you do find references to acedia. Acedia has been defined as lack of care, a sort of spiritual listlessness. It was particularly dangerous to monks, Evagrius of Pontius thought; it lead to monks imagining themselves fantasizing about their former lives and other work. Acedia makes them at once restless and the days long, but also lazy and resentful of their fellow monks (source for long quotation):
First of all he makes it seem that the sun barely moves, if at all, and that the day is fifty hours long. Then he constrains the monk to look constantly out the windows, to walk outside the cell, to gaze carefully at the sun to determine how far it stands from the ninth hour [or lunchtime], to look this way and now that to see if perhaps [one of the brethren appears from his cell]. Then too he instills in the heart of the monk a hatred for the place, a hatred for his very life itself, a hatred for manual labor. He leads him to reflect that charity has departed from among the brethren, that there is no one to give encouragement. Should there be someone at this period who happens to offend him in some way or other, this too the demon uses to contribute further to his hatred.
The monastic John Cassian rendered acedia (perhaps more sympathetically) as "weariness or dejection of heart".
The aforementioned Evagrius of Pontius also wrote about sadness (I encourage you to read the whole thing):
"A prisoner of barbarians is bound in irons; a prisoner of the passions is bound with sadness. [...] One who is continuously afflicted by sadness but pretends to impassibility is like a sick person who feigns health. As a sick person is shown up by the colour of his complexion, so one who is caught in the passions is exposed by sadness. [...] The sunrise is pleasant for all people, but the soul caught in sadness takes scant pleasure even in this."
The 4th century St. Ephrahim the Syrian wrote a prayer, frequently recited during Great Lent, whose Slavonic version asks to take from us a spirit of despondency.
St. Luke, Archbishop of Crimea (1877-1961) wrote more about despondency, but perhaps not in a way that's very palatable to modern psychology, saying:
Despondency is a great danger that waylays a Christian on his path to Christ. It is a diabolical temptation. All the saints were subjected to these attacks from the spirits of darkness, and in the vast majority of cases, by prayer, fasting, and vigils Christians have conquered the spirit of despondency brought on by the devil.
For an excellent reconciliation of the Church Fathers and our modern understanding of psychology and therapy, see here:
The Church Fathers taught that healing takes determination and resolve. St. Gregory of Sinai, for example, noted: “We energize [virtues] according to our resolve ...” Some of the Fathers taught that determination arises from the incensive power of the soul. St. Nikitas Stithatos wrote: “Our incensive power ... serves as a weapon” that provokes determination and resolve and thus is in accord with the will of God. He continued: “When our desire and our intelligence, in a way that accords with nature, aspire to what is divine, then our intensiveness is for both of them a weapon of righteousness ...” (Philokalia IV). For the Christian efficacy is not only “self efficacy” but ‘God-empowered efficacy.’ The words of the psalmist come to mind: “He who dwells in the shelter of the Most High, who abides in the shadow of the Almighty, will say to the Lord, ‘My refuge and my fortress; my God, in whom I trust.’ For he will deliver you from the snare of the fowler and from the deadly pestilence …” (Ps 90:1–3). The Christian can follow the spiritual wheat that was gleaned from our holy western Church Father, the Blessed Augustine: “Pray as if everything depends on God, and work as if everything depends on us.”xi
The efficacy of the therapeutic synergy of clinical science and the healing mysteries of Christ is our trust and dependency on the living God who sustains and governs all that occurs in the universe.