A gunman shot a doctor to death outside a Chicago hospital yesterday before storming the facility and killing a pharmaceutical assistant and a police officer during an exchange of gunfire, officials said.

The shooter knew the doctor he shot outside Mercy Hospital, Chicago Police Superintendent Eddie Johnson said at a news conference, describing that initial killing as an act of domestic violence.

The gunman was the ex-fiancé of the doctor, Chicago media outlets reported, with one witness saying he demanded a ring back.

The shooting sent doctors and patients streaming out of the facility, some with their hands up as heavily armed police officers sought to secure the hospital.

"The city of Chicago lost a doctor, a pharmaceutical assistant and a police officer, all going about their day, all doing what they love," Chicago Mayor Rahm Emanuel told reporters.

"This tears at the soul of our city. It is the face and consequence of evil," Mayor Emanuel said.

The gunman, after killing the doctor, fired at arriving police officers with a single handgun, Supt Johnson said.

The gunman, whose name has not been released, then ran into the hospital. Officers followed him inside and exchanged gunfire with him for several minutes, Supt Johnson said.

Officer Samuel Jimenez, who joined the Chicago police force last year, died during the gun fight, officials said.

The 28-year-old was married with children and the second Chicago officer killed in the line of duty this year.

Ambulance carrying the body of Officer Jimenez passes a guard of honour

"There’s no doubt in my mind that all of those officers who responded were heroes and they saved a lot of lives, because we just don’t know how much damage he (the gunman) was prepared to do," Supt Johnson said.

In a sign of the random nature of the shooting, the pharmacy assistant shot by the gunman just happened to be coming out of a lift, Supt Johnson said. Her name has not been released.

Local media identified the doctor killed outside the hospital as Tamara O’Neal.

The gunman also died but it was not immediately clear if he shot himself or was struck by a police officer’s bullet, Supt Johnson said. Another officer was spared injury when a bullet lodged itself in his holster.

In Denver, another shooting left one person dead and three others wounded yesterday. At least one suspect remained at large after the shooting.