Abstract
In this article, we analysed the problems of electronic medical records (EMRs) and found that the EMRs generated by different hospitals for the same patient are mutually independent and duplication and data sharing are difficult among hospitals. In order to solve this problem, this paper proposes an efficient and secure cross-domain sharing scheme of EMRs based on edge computing. The program allows the doctor to access the personal history EMRs through the patient’s authorization so that the doctor can understand the patient’s history of illness and, on this basis, generate a new medical record for the patient. Then, the doctor sends the EMRs to the edge server, and the server calculates the ciphertext and adds it to the patient’s personal medical record to complete the case update. Analysis shows that this solution can effectively prevent data tampering and forgery through blockchain and avoid privacy leakage problems in plaintext sharing by using searchable encryption and by relying on edge servers to solve nearby computing tasks and divert the computing capacity of cloud servers to improve efficiency. The security proof shows that the scheme satisfies the complex problem of the BDH assumption. Performance analysis shows that the scheme is feasible and efficient.
1. Introduction
With the rapid development of the Internet of Things and cloud computing, intelligent systems such as intelligent transportation and smart cities are gradually becoming a hot research topic nowadays [1–3]. At the same time, with the sharp increase in medical demand and the gradual intensification of refined hospital management, the development of the informatization of the medical system is also imperative. Compared with paper medical records, EMRs are related to each other, easy to store, more environmentally friendly, and efficient [4, 5]. It effectively solves the problems of paper medical records [3]. So, it is very popular in hospitals.
However, with the rapid growth of EMRs, the problem of data islands in hospitals has become more prominent. When patients go to different hospitals, each hospital will generate a large amount of EMRs and store them in its own hospital independently, which cannot be shared among them. For doctors, it is impossible to understand the patient’s illness history in other hospitals. On this basis, doctors are prone to misdiagnosis and even cause significant problems such as medical malpractice. Moreover, it is also not conducive for the patients to master and understand their health status [5]. In addition, EMRs store the patient’s personal privacy information. If they are attacked, they will face security risks, such as privacy leaks [6].
In recent years, blockchain technology has developed rapidly. Due to the characteristics of immutability, data integrity, and distributed storage, blockchain technology has been widely used in all walks of life [7–9]. Since blockchain technology can ensure privacy and security in the application of EMRs, many scholars have proposed solutions to the current problems of EMRs. Literature [10] proposed blockchain-based healthcare data gateway architecture, enabling the patients to control and share their EMRs easily and securely without violating privacy. It provides a new potential way to improve the intelligence of healthcare systems while keeping patient data private. Literature [11] proposed a blockchain-based EMRs data-sharing framework, using immutability, and built-in autonomy properties of the blockchain sufficiently address the access control challenges associated with sensitive data stored in the cloud. Literature [12] proposed an electronic medical care system based on blockchain, which builds an alliance chain among hospitals. Using the practical Byzantine fault-tolerant algorithm reduces the computational power and ensures the safety and stability of the system, and at the same time, it prevents data tampering and privacy leakage. Literature [13] proposes a framework for sharing medical system data services based on blockchain, which does not rely on a trusted third party and realizes safe storage and privacy protection. Literature [14] used attribute-based encryption and identity-based encryption to ensure data privacy and used blockchain techniques to ensure the integrity and traceability of the EMRs. The most significant advantage of blockchain-based EMRs is that users can securely share the EMRs among hospitals and other institutions. However, most of the existing research only discusses the security search and the data sharing without considering establishing system EMRs for individual patients.
In fact, due to the limited storage space, many medical institutions and enterprises store data on cloud servers. However, with the continuous increase of cloud computing data security issues, it is imperative to upload encrypted data to the cloud server. However, it will face the problem of how to implement ciphertext search when data are shared. In this case, searchable encryption technology came into being [15–18]. It supports ciphertext search while ensuring the security of the data sharing, saving a lot of network and computing costs, and making full use of the enormous computing resources of cloud servers to search for keywords on ciphertexts. Therefore, many electronic medical record sharing schemes use searchable encryption technology to realize ciphertext sharing. Literature [19] proposed a blockchain-based searchable encryption scheme for EMRs. The solution stores the index of EMRs in the blockchain using the blockchain to ensure the integrity, tamper-proof, and traceability of the EMRs index and using searchable encryption to realize ciphertext sharing. Literature [20] constructs a framework based on the blockchain. It uses private chains and alliance chains, combined with searchable technology, to realize the safe search of EMRs while ensuring personal privacy and information security. Literature [21] proposed a blockchain-based secure and privacy-protected EMRs sharing protocol. The scheme mainly uses searchable encryption and proxy reencryption to realize data security, privacy preservation, and access control. Literature [22] combines private chain and consortium chain and uses searchable encryption technology to realize data sharing with significant storage overhead. Literature [23] uses ciphertext strategy attribute-based encryption to encrypt EMRs, and only users with the required attributes can access the data, which can achieve fine-grained access control. The above schemes solved privacy security and ciphertext search through searchable encryption technology but did not consider deduplication.
In response to the above problems, we propose a personal EMRs system with deduplication based on edge server. The plan is to update the EMRs by the doctors in time through the patient’s authorization with deduplication and then complete data update. Moreover, it is through blockchain and searchable encryption to ensure data and personal privacy security, and the edge server can offload the computing tasks of cloud services to improve computing efficiency.
2. Prerequisite
2.1. Bilinearity
Definition 1. Suppose is the additive group, is the multiplicative group, and the prime order is . Define a bilinear operation satisfying the following properties [24]:(1)Bilinear: for any , there is ;(2)Nondegeneracy: there are such that ;(3)Computable: for any , can be calculated.
2.2. Bilinear Diffie–Hellman Hypothesis
Suppose is the additive group, is the multiplicative group, and the prime order is . Define a bilinear operation ; is the generator of group . Given a four-tuple , it is difficult to calculate .
Suppose algorithm is used to solve the BDH problem, and its advantage is defined as , if .
At present, there is no effective algorithm to solve the BDH problem. Therefore, it can be assumed that the BDH problem is complex [24].
2.3. Public Key Encryption with Keyword Search (PEKS) Based on Bilinear Mapping
and are two hash functions.(1). Randomly select and a generator of group , and output ;(2). Randomly select for the keyword , Calculate and output ;(3). Using private key and keyword to generate search trapdoor ;(4). Set ; check if there is , and output the corresponding index if they are equal [24].
2.4. System Model
This paper aims to solve the difficulties in EMRs sharing among hospitals and the problems of isolated and repeated storage of cases. The program mainly uses blockchain and searchable encryption technology to ensure EMRs data and privacy security. The overall idea of the scheme is that when a patient sees a doctor, he first registers with the hospital, and the hospital makes an appointment for the patient. Then, the patient authorizes the doctor to generate EMRs and the doctor sends the EMRs and authorization guarantee to the edge server. The edge server encrypts the EMRs and retrieval information and uploads them to the cloud server and blockchain. When the patient goes to another hospital, the doctor needs to be authorized to visit the personal EMRs. Then, the doctor generates new EMRs after understanding the patient’s history of illness and sends them to the edge server. The edge server marks the repeated case and then adds the newly added case to the patient’s medical record to complete the case update.
The main entities involved in the system are patients, doctors, hospitals, cloud servers, edge server, and blockchain. The system architecture is shown in Figure 1.

Definition 2. The scheme is composed of the following algorithms: Initialization: generate system parameters; Key generation: generate the entity’s keys; Registration: the patient registers with the hospital; the hospital makes an appointment for the doctor. Authorization: the patient authorizes the doctor to generate EMRs. Generation and storage of electronic medical records: the doctor generates EMRs for the patient and sends them to the edge server. Then, the edge server calculates the ciphertext and index and uploads it; Access: the doctor views the patient’s previous EMRs. The doctor applies for an access request to the edge server and the edge server accesses the blockchain and cloud to obtain the information and then returns it to the doctor. Update: the doctor deletes duplicate EMRs and sends them to edge server; the edge server updates and uploads them to cloud storage and blockchain.
2.5. Security Model
We define the formalized security model of the proposed scheme by the following games.
2.6. Keyword Privacy Security Game
If there is no adversary who can infer the plaintext of the keywords from the ciphertext or trapdoor in probabilistic polynomial time, the privacy of the keywords can be guaranteed. Define the keywords privacy and security game as follows:(1)Initialization: given the secure parameter , simulation challenger executes the initialization algorithm to generate .(2)Phase 1: adversary runs the trapdoor generation algorithm multiple times.(3)Challenge: adversary randomly selects two keywords from the keyword space and sends them to the simulation challenger. The simulation challenger executes the trapdoor generation algorithm and then randomly selects a trapdoor and sends it to .(4)Guess: After adversary inquires times for the different keywords, it analyzes and guesses. If the can guess the trapdoor, then adversary wins the game.
2.7. Proof of Bilinear Diffie–Hellman Hypothesis for Difficult Problems
If there is an adversary who can solve the solution with an advantage in polynomial time, then the adversary can solve the BDH difficult problem with an advantage in polynomial time. Define the two-linear Diffie–Hellman hypothesis that the difficult problem specification is proved as follows:(1)Initialization: given the group , and the mapping . Simulate challenger randomly generates and sets .(2)Phase 1: adversary runs the encryption algorithm multiple times.(3)Challenge: the simulate challenger randomly selects the plaintext , requires that is not queried in stage 1, generates the ciphertext , and transmits the ciphertext to the adversary .(4)Guess: the adversary analyzes and decrypts the ciphertext . If the adversary can decrypt the ciphertext and get the correct plaintext , then the adversary wins the game.(5)Proof: if adversary can decrypt the ciphertext, adversary can also solve the difficult problem of bilinear Diffie–Hellman assumption.
3. The Proposed
The program mainly includes the following essential roles: patients, hospitals, doctors, cloud storage servers, edge server, and alliance chain. The description of symbols in the text is shown in Table 1.
3.1. Initialization
The key generation center according to the security parameter generates the public parameter , where and are the cyclic group of prime order , the generator of group is , satisfies , and and are two hash functions.
3.2. Key Generation
The patient randomly selects and calculates , so the keys of are . Similarly, the doctors and randomly select and and calculate and , so the keys of and are and .
3.3. Registration
The patient registers with the hospital , and the stores the patient’s identification , randomly selects the treatment key , and sends the encrypted to . The hospital makes an appointment with the attending doctor for the patient and encrypts the appointment information with the and sends it to . The patient uses to decrypt the and obtains the doctor’s , department , and other auxiliary information . At the same time, the hospital sends to the attending doctor .
3.4. Authorization
The patient authorizes the doctor to generate EMRs. generates an authorization guarantee , , while signing it with the personal private key and encrypting it with the doctor’s public key , and then sends to . The doctor decrypts with the personal private key to obtain the and the signature , and then the doctor verifies the correctness of the authorization with the patient’s public key .
3.5. Generation and Storage of Electronic Medical Records
When the verification is passed, the doctor generates EMRs for and sends them to edge server. The edge server calculates the ciphertext and then randomly selects and calculates , , , where . Finally, it uploads to the cloud server and uploads to the blockchain, here is the file number returned by the cloud server.
3.6. Access
When registers and sees a doctor in the hospital , first authorizes to access his EMRs through the authorization guarantee and encrypts it as , where . The doctor sends to edge server, the edge server decrypts with the personal private key to obtain the and the signature and then verifies the correctness of the authorization with the patient’s public key .
When the verification is passed, the edge server calculates and sends to the blockchain nodes. The blockchain nodes execute matching algorithms through and return the corresponding file number . The finds the corresponding ciphertext through the file number and returns it to edge server. The edge server sends it to the doctor . views the patient’s history EMRs by the access key within the limited access time .
3.7. Update
When the doctor obtains the patient’s EMRs with the access key , he first understands the patient’s medical history through historical EMRs and generates a new EMRs on this basis and sends them to edge server. Then, the edge server checks whether the new EMRs have duplicate data by comparing them with the historical EMRs. If there are duplicates, the edge server adds a mark and a date based on the historical EMRs and then encrypts the updated EMRs to ciphertext with and adds the newly EMRs to the patient’s personal EMRs system in order to complete the update of the EMRs.
When registers and sees a doctor in the hospital , repeat the above process.
4. Analysis
4.1. Correctness
Theorem 1. In the search phase, the blockchain nodes need to verify the identity of the visitor and secondly verify whether the trapdoor submitted by the edge server has corresponding index and other information, that is, needs to verify whether the equation is established. If the equation holds, the corresponding index is returned for the doctor; otherwise, the visit is denied.
Proof. According to the above, we knowIfthenSo,Through the proof, we can find that the verification equation is established, the ciphertext retrieval verification is successful, and the result is correct. So, it can retrieve the index information corresponding to the patient’s history EMRs, and the correctness of the scheme is verified.
4.2. Security
The scheme satisfies the difficult problem of the BDH assumption; the proof is as follows.
Theorem 2. Assuming that the BDH problem is difficult, the scheme is indistinguishable under adaptive chosen ciphertext attacks (IND-CCA2).
Suppose and are two random oracles; is the adversary of the superior attack scheme. At any time, A can ask or and ask at most and times, respectively. Constructing the simulator can solve the BDH problem with at least the advantage of and the running time of .
Proof. Suppose the simulator has known and simulate the challenger, with as the adversary, and the goal is to calculate .
For simplicity, suppose (1) will not initiate the same query to twice, and (2) if requests a trapdoor for keyword , it has already asked before.(1)System establishment: the simulator builds the system, generates the safety parameter , runs the algorithm setup , obtains the safety parameter , and generates the keys and keeps the private key . The simulator chooses , setup . The simulator challenger returns the parameters and the public key to adversary , and asks the simulator with random oracles.(2) and query: randomly chooses . is the guess value of , and the -th query to corresponds to the final attack result of . At any time, can ask or and ask at most and times, respectively.(1)Inquire : creates an , initially empty, and the element is . When initiates the -th query (set the query value as ), responds as follows: If is already in the list , takes out the 3-tuple and responds with . Otherwise, chooses a random and calculates as follows: if , calculates ; otherwise, calculates . Then, adds to and responds to with .(2)Inquire : similarly, creates a list (initially empty) with element type , can query at any time, and responds as follows: If is already in , answer with ; otherwise, choose randomly, answer with , and add to .(3)Trapdoor query (at most times): when requests the trapdoor corresponding to the keyword , let satisfy , and represents the query value of the -th query to . answers the query as follows: If , then there is a 3-tuple in , calculate and return . If , then interrupt.(4)Challenge: initiates a challenge. Suppose the keywords of ’s challenge are and , and randomly selects and responds with . Note that this response implicitly defines . In other words, . According to this definition, is a valid trapdoor for the keyword .(5)Trapdoor query: can continue to do trapdoor queries for the keyword ; the only restriction is that , and responds as before.(6)Guess: outputs the guess , and randomly selects from and outputs as his guess of , where is the value used in the challenge phase. This is because contains a pair of , where . If chooses this pair from , then . The advantage of choosing the correct result is , so the probability that breaks the security of the proposed scheme is .
4.3. Performance
By comparing Table 2, we can find that all the above schemes are based on blockchain and realized access control and privacy protection functions. But none of the literatures [11, 20, 22, 23] can implement data deduplication. In addition, reference [11] did not use searchable encryption technology to realize ciphertext search, and reference [20] did not realize data sharing. Therefore, the function of this scheme is better.
Nowadays, there are many researches on EMRs, but it still faces many problems to be solved urgently. For example, we are familiar with privacy protection, access control, and data-sharing issues. With the development of science and technology, more problems have been exposed between the increasing demand of people and the actual status of EMRs. For example, there are no systematic EMRs for patients, and the storage of patients’ EMRs is relatively scattered and unsystematic, which makes patients unable to understand personal health systematically. In addition, given the huge data storage and limited storage space of EMRs, deduplication is particularly important. Deduplication can effectively reduce storage consumption and improve storage efficiency. Therefore, it is also one of the urgent problems to be solved in EMRs. In response to the above problems, this article provides some solutions, as shown in the following.
According to Table 3, the plan allows the doctor to update the patient’s previous EMRs, so the EMRs system can store the latest medical record in time which ensures the timeliness of the data and realizes integrity and systematic of the patient’s EMRs data. Secondly, the deletion of duplicate data effectively improves storage efficiency and reduces storage overhead.
4.4. Simulation
The operating system used in the simulation experiment in this article is Windows 10, Intel CPU i7-9750H, and MyEclipse 2015 CI. From the initialization, key generation, encryption, decryption, indexing, and trapdoor generation stages, the execution efficiency of the scheme is investigated. The initialization phase is the configuration of system parameters. The key generation stage is mainly used to generate participants’ personal keys. The encryption and decryption use symmetric encryption algorithms. Indexes and trapdoors are used for file query and retrieval. The program selected documents [22, 23] for comparison, and the selected documents were all EMRs sharing schemes based on the blockchain. The comparison results of each stage are shown in Figure 2.

It can be seen from Figure 2 that the execution efficiency of this article is relatively higher than that of documents [22, 23], and documents [22] need to be improved in terms of efficiency. In the index generation stage, the cost of this article is slightly higher than literature [23], while other stages are lower than the comparative literature. This is because literature [23] does not require bilinear operation in the index generation stage, while the solution of this paper needs to perform the bilinear operation, which makes the efficiency relatively lower than literature [23]. In the encryption and decryption stages, literatures [22, 23] require complex operations with the high cost of bilinear pairing and modular idempotence. While this scheme only needs one hash and one inverse operation, computational efficiency is relatively high. In the trapdoor generation stage, the solution in this paper only needs to perform power operation and hash operation, which is more efficient than the comparative literature.
In addition, to further verify the program’s performance, the program uses keywords as variables to compare the execution efficiency of the index, trapdoor generation, and search phrases. Figure 3 is the execution time of the index generation phase, Figure 4 is the execution time of the trapdoor generation phase, and Figure 5 is the execution time of the retrieval phase.



It can be seen from Figures 3–5 that with the increase of keywords, the running time of the trapdoor, indexing and retrieval phases in this article, and the comparative literature show an increasing trend. Literature [23] has a higher running time cost with the increase of keywords in the three stages. The running time cost of this article and the literature [22] is relatively consistent, and its execution efficiency is relatively low. Compared with literature [22], the keyword ciphertext matching of this scheme belongs to exact matching, while literature [22] belongs to fuzzy matching. So, the keyword matching result of this scheme is more accurate than literature [22].
5. Conclusions
This article proposes a cross-domain sharing of EMRs among different hospitals based on blockchain and edge computing, which solves the difficulty of EMRs data sharing among hospitals and the problem of isolated and duplicated storage. Through patient authorization, cross-domain secure sharing of EMRs is realized and making the patient’s personal EMRs more systematic and complete. The use of blockchain technology ensures that the data cannot be tampered with, and the use of searchable encryption ensures the security of EMRs and personal privacy. Edge servers offload the computing tasks of cloud services and improve computing efficiency. By analysis, it is found that the security of the scheme is proved based on the BDH assumption. Performance analysis and simulation experiments show that the computational complexity is relatively low and has high execution efficiency.
Data Availability
The data used to support the findings of this study are included within the article.
Conflicts of Interest
The authors declare that there are no conflicts of interest regarding the publication of this paper.
Acknowledgments
This research was supported by the Open Foundation of State Key Laboratory of Networking and Switching Technology (Beijing University of Posts and Telecommunications) (SKLNST-2020-1-09), Henan Key Research Projects of Universities (20A520043 and 21B520022), Natural Science Foundation of Henan Province (202300410510), and National Key Research and Development Program of China (2020YFB1005404).