Bree and the psychiatric hospital

I don’t know much about psychiatric hospitals and the rules, but were they allowed to not let Bree leave because she was refusing treatment/therapy even though she checked herself in? Or was that something the show just did to add more suspense and drama by making Bree unable to get to Danielle when her daughter was in danger?