Cardioformer: Advancing AI in ECG Analysis with Multi-Granularity Patching and ResNet