The answer in any medical field (not just surgery) is that your illness can't affect your ability to practice. As part of board, licensing, and credentialing applications you will likely be asked some form of questions like "do you have a physical or mental illness that would limit your ability to practice medicine?" The wording of the question typically would allow someone with depression controlled on medication or something similar to answer no. From a practical standpoint you certainly wouldn't want someone with uncontrolled panic attacks operating on you. On the other hand if we disqualified all surgeons taking SSRIs we'd lose 1/3 our surgical workforce.