I'm not a lawyer, but I've spent a few decades watching the impenetrable antics of the legal system. In general, I see that the courts can find a way to argue that any proposition, no matter how perverse it may seem to some of us, is unassailably anchored in the Constitution, precedent, and existing law. It comes down to what they want the law to be. This is why we make such a fuss about who gets to be judges, even though if the system worked the way we tell our children in school that it's supposed to, it wouldn't matter that much.
From a liberal prospective, individual rights matter, and a contract that gives up indefinite rights is repugnant and in some cases invalid on its face.
From a libertarian prospective, contracts matter, and any contract entered into legitimately is valid and supersedes the rules that would otherwise apply.
From a conservative* prospective, the rights of the rich matter, so a case would tend to come down to whether the individual getting bad treatment has more money than the medical establishment.
How the dispute is settled depends on which prospective is in control.
*The original definition of conservative is seeking to conserve the rights of the aristocracy. We don't have a hereditary aristocracy in America, but we do have a privileged rich class which is functionally equivalent, and if we try to explain what conservative means today in terms of advancing the interests of that rich class, we get a very good match of what they actually do -- certainly better than the definitions they tend to espouse in their propaganda.