Merge pull request #22625 from ruchamahabal/fix-encounter-deletion

fix: attribute error while cancelling patient encounter