I'm not sure that the example given is in line with the usual usage of the term "code" as it relates to a hospital setting. "To code" is usually to be in critical condition, requiring immediate help. I believe a better phrase in the example sentence would have been "How long do hospitals try before they pronounce them dead?"
(Perhaps the example is using the word "call" as in "to call off", so the phrase was actually meant as "How long do hospitals try before they call off the code?". Similar to the usage of "call" as when someone says, "That's it. I'm calling it.")
In other words, the patient was already "coding," which is why (or synonymous to) the hospital workers were performing life-saving actions.
According to WebMD for "code":
Technically, there's no formal definition for a code, but doctors often use the term as slang for a cardiopulmonary arrest happening to a patient in a hospital or clinic, requiring a team of providers (sometimes called a code team) to rush to the specific location and begin immediate resuscitative efforts.
There may be a button in the patient's room that anyone can press to "code" the patient, which will alert hospital staff to the patient's critical condition, and nurses, doctor's, and other support personnel will quickly come to provide immediate, potentially life-saving, care. In addition, if a patient is connected to certain monitoring devices, the devices may "code" the patient if certain conditions occur (e.g., no heartbeat).