Judge rules as unlawful government plans to downgrade services at Lewisham hospital