The commercialization of 5G has greatly promoted the development of medical Internet of Things (IoT). More medical devices connected to the Internet may further increase the communication power consumption. Meanwhile, privacy protection technique in cloud computing cannot match the rapid development of medical applications. Therefore, exploring secure, balanced and energy-efficient data transmission between medical devices and cloud servers is extremely challenging. This paper focuses on the security and energy consumption of medical electronic health record (EHR) data transmission and storage between cloud server and IoT device users. We build a secure energy-saving communication and encrypted storage model by adding secure energy-saving communication scheme and encryption algorithm to the traditional medical cloud model. Specifically, we propose a communication authentication algorithm MedGreen based on elliptic curve and bilinear pair. In the algorithm, the two communication parties can complete the key establishment and identity authentication only after one communication, which effectively balances the resource overhead of the key center and the user, and resists the Man-in-the-middle attack. Aiming at the characteristics of large repetition and high sensitivity of medical data, we present a secure data storage algorithm MedSecrecy based on Huffman compression and RC4. The algorithm not only maintains the RC4 encryption efficiency, reduces the amount of cipher text data, but also improves confidentiality, randomness and security of the key stream. Comprehensive analysis and simulations show that our system is secure, energy-saving and highly efficient for EHR. INDEX TERMS Electronic health records (EHR), Internet of Things (IoT), secure communication, data encryption, privacy protection.