Defenders of Catholic teaching would answer that in the latter case, the patient intends to end his life, and that is wrong, whereas in the former case, the patient merely intends to avoid the additional burden that treatment brings. Death is, of course, a foreseeable consequence of avoiding that burden, but it is a byproduct that is not directly intended.