Online health consultations are becoming more popular as a result of technological improvements. Patients routinely look for information about medical disorders online, which could jeopardize the privacy of medical records and increase the workload of healthcare professionals. Nonetheless, academics continue to be extremely concerned about issues related to the quality characteristics that relate to the current architectural models, such as energy consumption, latency, resource utilization, scalability, and packet loss. This method, however, also results in a significant strain being placed on medical experts who must sort through vast amounts of medical records to extract certain information. This paper presents a novel ciphertext policy attribute-based encryption method coupled with fuzzy logic to overcome these issues. This solution uses a hybrid structure of IPFS and blockchain to store data and enables complex bidirectional access control. Before being added to IPFS, medical records are encrypted. To ensure data integrity, related IPFS hash indexes are then added to the blockchain. Utilizing attribute-based technology, users’ data is encrypted to give them fine-grained bidirectional access control. A thorough security analysis proves the system’s resilience, especially when faced with chosen plaintext assaults inside the random oracle model. Tests for this study were conducted using 10–50 attribute sets. This paper’s technique solely makes use of a hash operation. All things considered; the study demonstrates that the proposed design is more efficient than earlier schemes. Thus, from the comparison study above, it can be concluded that the system presented in this work is more efficient. Results from simulations provide additional support for the suggested methodology by highlighting the improved computing efficiency of users as compared to baseline conventional systems. This study demonstrates how technological advancement and healthcare requirements can coexist harmoniously, paving the way for secure and effective online medical consultations that are powered by fuzzy logic.