Electrocardiographic signals (ECG) are used in many healthcare applications, including at-home monitoring of vital signs. These applications often rely on wearable technology and provide low quality ECG signals. Although many methods have been proposed for denoising the ECG to boost its quality and enable clinical interpretation, these methods typically fall short for ECG data obtained with wearable technology, because of either their limited tolerance to noise or their limited flexibility to capture ECG dynamics. This paper presents HKF, a hierarchical Kalman filtering method, that leverages a patient-specific learned structured prior of the ECG signal, and integrates it into a state space model to yield filters that capture both intra- and inter-heartbeat dynamics. HKF is demonstrated to outperform previously proposed methods such as the model-based Kalman filter and data-driven autoencoders, in ECG denoising task in terms of mean-squared error, making it a suitable candidate for application in extramural healthcare settings.