Length of stay, referral to aftercare, and rehospitalization among psychiatric inpatients.