First, I would not tell her that she can’t go home. I would say instead, “You can go home after the doctors say it’s okay,” or, “We can take you home in a little while.” When she remembers she can’t leave, it upsets her. It prevents her from engaging in other things.
Are there things she can do in her room? Not everyone is social, but you can also designate a staff member (like the activity director) to bring her out for a couple things daily. Even when she says “I don’t want to” have the person say, “I want you to join me, I don’t see you enough! If you hate it in 10 minutes, lets go back to your room.”