The integration of Health IoT (H-IoT) and blockchain technologies are being heavily exploited and used in many domains, especially for e-healthcare to collect the data i.e electronic health record (EHR) from the patient. The H-IoT devices have the ability to provide real-time sensory data from patients to be processed and analyzed, and distributed. Blockchain is providing decentralized computation, distribution and storage for EHR data. Therefore, the integration of H-IoT and Blockchain technologies can become a reasonable choice for the design of decentralized H-IoT-based e-healthcare systems. But the H-IoT network has some intrinsic challenges like low computation, energy constraint, security, energy optimization, data storage, and real-time data analytic. Also, conventional EHR-based systems suffer from issues such as the potential loss of data, inadequate security and consensus on the unchangeable nature of health records, fragmented connections between different institutions, and ineffective clinical data retrieval methods, among other challenges. In this article, first, we study the performance of blockchain technology in the healthcare system. Second, we propose an improved Harris Hawk Optimization algorithm (HHO) based clustering mechanism for the collection and sharing of EHR. The proposed system was tested and validated using the Hyperledger-fabric based electronic healthcare record (EHR) sharing system along with Matlab. The proposed system achieves 12%, and 7% incremental improvement in terms of latency, throughput for the Blockchain networks. While the proposed clustering technique achieves 10%, 12%, 14%, and 16% improvements in alive node, energy consumption, throughput and average transmission delay compared to existing state of the art.