John Proctor, 44, was homeless and using drugs when he was found at Hull Royal Infirmary with a "fearsome" and "highly dangerous" wood splitter axe that could have been used to "split someone's head open".
Billy Torbett, prosecuting, said that a woman who worked at Hull Royal Infirmary was on her break at about 1.45am and was smoking outside the hospital's front entrance when Proctor approached the main entrance of Accident and Emergency and began threatening to kick someone's head in.
Judge Mark Bury said that police found the wood splitter in Proctor's jacket and there was also a home-made sheath and some form of strap over his shoulder where he would have kept the knife.
The person who made the initial complaint said that Proctor had thrown the knife behind a bin outside the hospital.
A man who stormed the A&E department of a hospital and made threats with an axe that could have "split someone's head open" has been jailed for 14 months.