A court is due to rule whether a man who brutally stabbed a paramedic to death was mentally impaired enough to be found not criminally responsible for murder.