Over 800 deaths were linked to long emergency department waits in Scotland last year, analysis finds