Cardiologists have worked hard to remove heart blockages faster for patients coming into the emergency room. But they’ve overlooked patients who have heart attacks while they’re already in the hospital.

If you had to have a heart attack, you’d probably choose to have it in the hospital, where you would have immediate access to a surgeon, just in case.

But it turns out that among those who have a type of heart attack called a STEMI, or ST-elevation myocardial infarction, patients already in the hospital are three times more likely to die, according to a paper published today in the Journal of the American Medical Association.

About one in five heart attacks is a STEMI, a major episode in which an artery is completely blocked. Doctors recognize a STEMI by a pattern on the patient’s electrocardiogram (ECG) reading. Treatment usually involves surgery to restore blood flow through the artery.

A patient’s chance of survival depends heavily on speedy access to diagnosis and medical intervention to unblock the artery.

Learn More About Heart Attack Treatments »

So why do patients in the hospital fare worse than those who have to wait for an ambulance?

“Historically, we’ve focused almost exclusively on the patients who come in from the outside,” said study author Dr. Prashant Kaul, an interventional cardiologist at the University of North Carolina, Chapel Hill.

The vast majority of patients have heart attacks at home, at work, or in the grocery store. Most other studies have gathered data on patients who were brought to the hospital already in the throes of a heart attack. One key data point in the effort to speed up care is “door-to-balloon time” — looking at how fast patients are diagnosed and treated after they come in the emergency room doors. That time has gone down by 30 percent.

Yet patients who are already admitted have been ignored, though they make up 5 percent of STEMI cases.

The researchers looked at the medical records of more than 60,000 STEMI patients in 300 California hospitals between 2008 and 2011. The patients who were already in the hospital when they had the heart attack were less likely to undergo cardiac catheterization to unblock their artery. They also stayed in the hospital almost two weeks for heart attack care, compared to the outside patients’ five days. The cost of their heart care was around $245,000, compared to the other patients’ $129,000.