Healthcare data analysis has emerged as one of the most promising fields of study in recent years. There are different types of data in the healthcare industry, such as medical test results, blood reports, medical reports, X-rays, CT, MRI, ultrasound, clinical data, omics data, and sensor data. One of the most important and useful techniques for analysing this complicated medical data is machine learning (ML). ML is proving to be a useful artificial intelligence (AI) technique for data analysis. To accurately predict the outcomes of healthcare data, ML employs a variety of statistical techniques and cutting-edge algorithms. In recent years, different ML approaches have been applied to a variety of medical data for disease diagnosis. The paper provides a comprehensive literature survey based on ML techniques to diagnose various diseases. ML importance in the analysis of medical data is discussed with applications. This paper will motivate advanced research in machine intelligence-driven healthcare by showing its potential in healthcare data analysis. We also discuss the challenges that arise when applying ML to healthcare data. Furthermore, this study introduces a new approach to ensemble learning through explainable stacking. By integrating explainable artificial intelligence (XAI) techniques with the stacking method, we aim to not only enhance predictive accuracy but also improve the interpretability of the stacking model. The proposed predictive model outperforms the existing categorisation models, enhancing both the performance and efficiency of the diagnostic process. In addition, we suggest several future directions for further work in this area.