Medical image encryption is essential to protect the privacy and confidentiality of patients' medical records. Deep learning-based encryption, which leverages the nonlinear characteristics of neural networks, has emerged as a promising new method for protecting medical images. In this paper, we present insights into deep learning-based medical image encryption and propose a novel end-to-end medical image encryption scheme based on these insights that leverage feature encoding and decoding for encrypting and decrypting images. Firstly, we explore a method that combines keys generated by the Logistic Map with encoded plaintext image features to improve network diffusion performance. Secondly, we employ a reversible neural network to enhance plaintext image reconstruction while maintaining encryption effectiveness. Finally, we propose a series of novel loss functions to measure the cost with the ideal cryptographic algorithm and continuously optimize our network. Experimental results demonstrate that our scheme improves the performance of image encryption and decryption and resists brute force attacks, statistical attacks, noise and cropping attacks.