Retrospective evaluation of psychiatric diagnosis at the time of discharge of patients from a referral hospital