Juan Lopez, 32, the gunman in a shooting at Chicago's Mercy Hospital on Monday, was killed during a firefight with Chicago police. The Cook County Medical Examiner said Lopez was killed by a police bullet - shot in the abdomen - despite also having a self-inflicted gunshot wound to his head.
According to court records from 2014 and '15 obtained by the ABC7 I-Team, Lopez's ex-wife accused him of brandishing a weapon against several people and threatening to show up at her workplace and cause trouble.
RELATED: 3 ways to survive an active shooter incident
As the I-Team first reported Monday, the hospital siege began when Lopez accosted his ex-fiancé Tamara O'Neal, 38, an emergency room physician at Mercy Hospital, who was leaving after her shift.
Lopez shot O'Neal numerous times, investigators said, prior to the gunman storming the hospital and continuing his assault -- perhaps firing as many as three dozen rounds from a 9mm pistol according to police and witness accounts.
O'Neal and Lopez were engaged to be married in late October, the I-Team reported, an engagement that was scrapped in September. On Tuesday Chicago police said that Lopez showed up at the hospital to retrieve the engagement ring he had given to O'Neal.
"He came over there because they had broken off their engagement and he wanted his engagement ring back," said Chicago Police Superintendent Eddie Johnson.
Lopez was currently enrolled as graduate student at DePaul University. A DePaul spokesperson told the I-Team that he was "seeking a master's degree in public service. He earned a bachelor's degree here in 2013."
The shooter's history also includes a 2014 attempt to become a Chicago firefighter. A spokesperson for the CFD says that he was terminated from the training academy because of improper conduct about two months after starting his training.
The conduct involved workplace violence, according to CFD spokesman Larry Langford who says Lopez was accused of shoving female cadets.
Also Tuesday, officials at the Chicago Housing Authority said Lopez was hired as an associate program specialist in February of this year. He worked in the customer care center in the Loop.
CHA management said all housing agency employees are subject to background checks before being hired and that Lopez's hire was approved after undergoing background checks. Lopez did not have a history of complaints while he was employed there, officials said.
In a statement, CHA CEO Eugene Jones Jr. said, "This was an unthinkable act of violence. We are filled with overwhelming sadness and our hearts go out to the families of those who died, and to all affected by this horrific tragedy."
At the time of Monday's fatal shootings, Lopez was still entangled in a domestic court case with his ex-wife Monica De Asa. The couple was married in 2008 and had one child. They had a date scheduled in Cook County court on November 27 concerning financial questions in their child support agreement.
Prior to filing for divorce from Lopez, Ms. De Asa obtained an emergency order of protection against her husband in 2014. In the court file obtained by the I-Team, De Asa claimed that her husband "has slept with pistol under his pillow" and that the gun was "accessible" to their young child.
She also detailed that on two occasions in 2014 he "pulled out his gun with intent to harm," once on a neighbor and on another occasion pointing his weapon at a realtor.
According to the court file, on December 1, 2014 Lopez "began sending threats via text message to come to my job and cause a scene."
In the 2015 divorce filing, De Asa accused her husband of "constant infidelity and abuse."
Lopez also had ongoing child support issues according to court records. Documents state that he had a difficult time keeping a job and refused to inform De Asa where he was working or living.
Court documents reveal that in 2015 Lopez worked in security at Illinois Masonic Hospital in Chicago.
Records also reveal that Lopez was employed in 2014 at Ingalls Hospital in south suburban Harvey. The I-Team has calls into administrators for both hospitals concerning his past employment.
Lopez had a valid Illinois Firearm Owners Identification card and a Concealed Carry permit. Police investigators say he had purchased four weapons within the past five years.