Improving ECG-based COVID-19 diagnosis and mortality predictions using pre-pandemic medical records at population-scale