Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Rico Ramirez spent 10 days in a San Francisco hospital's COVID-19 unit, hooked up to oxygen to help him breathe, isolated from family and friends.

"I thought I was going to die alone," Ramirez told NBC affiliate KNTV. "I thought every day I was in there that I was going to die in a room by myself."

Full coverage of the coronavirus outbreak

But coronavirus wasn't the only illness he learned about when he was hospitalized; he also learned he has Type 2 diabetes, putting him at greater risk for complications from the virus.

"I'm just happy to be alive," Ramirez, who's now in recovery, said.

Ramirez joins the estimated 34 million Americans who have diabetes. The disease, in which the body is unable to produce enough insulin to keep blood sugar levels in check, is often listed as an underlying condition for COVID-19 patients sick enough to be hospitalized and put on a ventilator.

Earlier this week, the Centers for Disease Control and Prevention released findings on 178 hospitalized patients who had other chronic health problems. Nearly a third had diabetes.

Patients with diabetes also often have other underlying conditions, such as obesity and high blood pressure, putting them at even greater risk for coronavirus complications. The CDC report found nearly half of those hospitalized patients also had hypertension and/or obesity.

Why the added risk?

Diabetes weakens a person's immune system.

"People with diabetes are more prone to infections, and if they have infections, they're more prone to poor outcomes," Dr. John Buse, the head of endocrinology at the UNC School of Medicine in Chapel Hill, North Carolina, said.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Doctors say this is especially true for those with uncontrolled blood sugar levels.

"Poorly controlled diabetes affects the immune system in various ways," Dr. Mary Vouyiouklis Kellis, an endocrinologist at the Cleveland Clinic, said. When blood glucose levels are too low or too high, it makes it more difficult for the body's army of white blood cells to function effectively, she said.

"That's when the immune system starts to go haywire," Kellis said. "The ability to fight infection is diminished."

The cytokine storm hypothesis

Doctors also hypothesize that the chronic, low levels of inflammation associated with Type 2 diabetes may also worsen outcomes of patients with the coronavirus.

Inflammatory reactions in the body are not necessarily a bad thing and happen as a natural response to injury. For example, the swelling seen after twisting your ankle is an inflammatory response. But this type of response differs from the chronic inflammation seen in people with diabetes, because the swollen ankle eventually shrinks back down to size.

If a person's level of inflammation is chronically elevated, even at low levels, an infection such as the coronavirus may prompt the body to release far too many of those inflammatory chemicals, called cytokines.

"It seems that a lot of the bad outcomes with COVID-19 are related to a hyperinflammatory" response, referred to as a cytokine storm, Buse told NBC News.

"Instead of releasing enough cytokines to control the infection, the body almost overdoes it," Kellis said, "and it becomes too much for the body to handle."

Pandemic precautions

Keeping blood sugar levels in check is critical, doctors say.

"That's really the most important thing," Kellis said. "Get your blood sugar as controlled as possible so if you do see elevations, you can make changes to get it back to where you need to be."

And if you do notice an unexplained rise in blood sugar, that may be an early warning sign of illness.

It's like "an antenna that goes up that says something may be coming," Dr. Robert Eckel, president of medicine and science at the American Diabetes Association, said.

Download the NBC News app for full coverage of the coronavirus outbreak

Eckel explained patients may see a rise in blood sugar 12 to 24 hours before developing symptoms, such as a cough or a fever. This is a known phenomenon that doesn't just apply to COVID-19; it's true for people with diabetes when they develop other illnesses, too.

"If you're used to a fairly stable picture of your blood glucose and now you're seeing an escalation," Eckel said, "pay attention to what may be following."

The American Diabetes Association has other suggestions for people with diabetes now that millions are staying home as much as possible:

Keep an ample amount of testing strips and other supplies on hand

List all medications, including vitamins and supplements, as well as their doses

Have simple carbohydrates, such as honey, hard candies and popsicles, on hand to help keep blood sugar up

Contact the pharmacy to find out if it can deliver prescriptions or other supplies.

Beyond those tips, the basics of infection prevention apply: proper hand washing, social distancing and covering your face in public.

Follow NBC HEALTH on Twitter & Facebook.