The detection of heartbeat is an important and challenging issue for health care. This work proposes to estimate the QRS complex parameters based on the maximum-likelihood (ML) principle. To this goal, a new signal model and its Bayesian framework are studied. Detectors or estimators based on the Bayesian framework are considered to be optimal in the statistical signal processing point of view. To reduce the complexity of original method, its iterative counterpart is investigated by using the decomposition method. Detailed information of QRS complexes, including the starting point, duration, and period, can be derived by the proposed method for further medical diagnosis. Simulations using the benchmark MIT-BIH Arrhythmia database verify the advantages of the proposed approaches compared to traditional ones.