Woman alleged not to have left bedroom in nearly two years can be transferred to hospital with use of reasonable force, court rules