Fog computing and the Internet of Things (IoT) have revolutionized healthcare monitoring systems, enabling real-time health data collection and transmission while overcoming cloud computing limitations. However, efficiently selecting fog nodes for application modules with varying deadline requirements and ensuring adherence to quality of service (QoS) criteria pose significant challenges due to resource constraints and device limitations. In this paper, we present a novel two-layered hierarchical design for fog devices, leveraging cluster aggregation to optimize the selection of fog nodes for healthcare applications. We introduce three efficient algorithms to minimize system latency and reduce energy consumption in fog computing environments. Our proposed model is rigorously evaluated using the iFogSim toolkit and compared with cloud-based and latency-aware model [Mahmud R, Ramamohanarao K, Buyya R in ACM Transactions on Internet Technology.19, 2018, 10.1145/3186592]. In four distinct network topologies, our model exhibits an average latency reduction of at least 87% and energy consumption reduction of at least 76% when compared to the Cloud-based model. Similarly, when compared to the Latency-aware model proposed in [Mahmud R, Ramamohanarao K, Buyya R in ACM Transactions on Internet Technology. 19, 2018, 10.1145/3186592], our model showcases a minimum reduction of 43% in average latency and 27% in energy consumption. Our contribution lies in addressing the complexity of selecting fog nodes for application modules with diverse deadline requirements, while ensuring QoS. This work advances the field of real-time healthcare monitoring systems, promising substantial improvements in efficiency and effectiveness.