Security and privacy of Internet of Things (IoT) data are highly essential for a wide spectrum of applications, on top of which are medical systems. In medical systems, we need to guarantee the confidentiality, integrity, and availability (CIA triad) of the data generated from IoT devices in order to investigate medical malpractices.
Blockchain provides an immutable storage without relying on an external third party to build trust and transparency. Therefore, blockchain is a suitable option to securely store such data. However, the excessive reliance on IoT devices in medical applications results in producing a large amount of data periodically, and thus, makes its solely storage on blockchain extremely expensive. In this paper, we propose a cost-efficient comprehensive framework to store IoT medical devices data on the blockchain by using a data-driven classifier. The classifier in the proposed framework is driven by a range of normal data for each sensor type. All data whether normal or abnormal is stored on a typical cloud. Only data that is classified as abnormal (critical) is stored on the blockchain for cost saving purposes. Furthermore, a distributed file system (IPFS) is utilized for extra cost reduction. Experimental results show that our proposed framework reduces the cost of storing healthcare IoT data by an average of 84\% if compared with solely storing all data on the blockchain.