A coroner who examined the death of an elderly man in hospital has said there were “shortcomings and missed opportunities” in his treatment after he was left “screaming in pain” after an operation.