I would obey the law/court, whatever that was. It is not the decision of a healthcare provider to take away self-determination, nor should it be.
Being an authorized decision-maker for an individual jw who is incapacitated is a different matter. If I was given that decision I would follow the medical recommendation, even if the brainwashed individual didn't want it.