Patient diagnosis and treatment data encryption method, system and equipment based on block chain and medium
By calculating the characteristic values of patient diagnosis and treatment data and storing them on the blockchain node, the data is double encrypted, which solves the problem of data being tampered with on the blockchain node, and achieves high security and integrity of data transmission and storage.
Patent Information
- Application Number
- CN202411764390.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-28
AI Technical Summary
Existing blockchain-based data encryption technology poses a risk of tampering when data is uploaded to blockchain nodes or stored in a single node, resulting in the inability to decrypt and obtain the original data after obtaining the encrypted data from the tampered nodes.
By calculating the characteristic values of the patient's diagnosis and treatment data and storing it on a blockchain node, the diagnosis and treatment data are symmetrically encrypted and stored asymmetrically encrypted. The user performs decryption processing based on permissions and verifies data integrity through secure acquisition.
It improves security during data transmission, ensures that data is not tampered with during transmission and storage, and users can accurately obtain original data, enhancing the guarantee of data integrity.
Smart Images

Figure CN119728177A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data encryption technology, and specifically to a patient diagnosis and treatment data encryption method, system, device and medium based on blockchain. Background Art
[0002] Blockchain is a decentralized distributed ledger that is tamper-proof, secure and reliable, and is stored in a block chain. It combines distributed storage, peer-to-peer transmission, consensus mechanism, cryptography and other technologies to record transactions and information through a growing data block chain to ensure data security and transparency. The characteristics of blockchain include decentralization, immutability, transparency, security and programmability. Each data block is linked to the previous block to form a continuous chain, ensuring the integrity of the transaction history.
[0003] Since blockchain is transparent, any user can see the metadata and methods of calculations on the blockchain. When sensitive information needs to be stored, the information needs to be encrypted to prevent it from being seen by other irrelevant users during the calculation process. For example, in a Chinese patent with invention publication number CN111385301A, a blockchain data sharing encryption and decryption method, device and storage medium are disclosed. This solution encrypts the data in the blockchain so that the information will not be directly leaked; however, in the process of uploading the encrypted information to each node of the blockchain and the information stored in a single node, there is a risk of being tampered with. When the encrypted data is obtained from the tampered node and then decrypted, the same data as when it was originally stored cannot be obtained. In view of this, it is necessary to improve the existing blockchain-based data encryption technology. Summary of the invention
[0004] The present invention aims to solve one of the technical problems in the prior art to at least a certain extent. By improving the blockchain-based data encryption technology, it is used to solve the problem in the prior art that due to the lack of analysis of data tampering during the process of uploading to the blockchain node or in a single node, when the encrypted data is obtained from the tampered node and then decrypted, the same data as when it was originally stored cannot be obtained, so that when the data is tampered, the user cannot accurately obtain the original data every time.
[0005] To achieve the above objectives, in a first aspect, the present invention provides a method for encrypting patient medical data based on blockchain, comprising:
[0006] Obtaining the patient's diagnosis and treatment data, calculating the characteristic values of the diagnosis and treatment data, outputting multiple characteristic values and storing the characteristic values;
[0007] Encrypt the diagnosis and treatment data, output the encrypted ciphertext and the ciphertext key; encrypt the ciphertext key and output the encrypted key; store the encrypted key and the encrypted ciphertext;
[0008] Perform data decryption processing on the encrypted ciphertext based on the user information, and output the diagnosis and treatment data based on the data decryption processing; perform a security acquisition cycle on the diagnosis and treatment data, and output data judgment information based on the security acquisition cycle; and update the access log based on the data judgment information.
[0009] Further, obtaining the patient's diagnosis and treatment data, calculating the characteristic values of the diagnosis and treatment data, outputting a plurality of characteristic values and storing the characteristic values includes:
[0010] Acquire the patient's diagnosis and treatment data, wherein the diagnosis and treatment data includes multiple data items, including name, age, and examination report;
[0011] Convert each Chinese character in the name into binary according to GB2312 encoding to obtain two bytes corresponding to each Chinese character; add the two bytes by removing the carry to obtain the representative value corresponding to each Chinese character;
[0012] Then, the representative values of all Chinese characters in the name are added up by removing the carry to obtain the name feature value;
[0013] Set the characteristic change function y=ax+b, substitute the age into x in the characteristic change function, and get the age characteristic value y, where a and b are both constants;
[0014] Obtain the number of Chinese characters in the inspection report and mark it as the number of characters; calculate the occurrence rate of each Chinese character in the inspection report and mark the Chinese character with the lowest occurrence rate as a keyword;
[0015] Convert the keyword into binary in the GB2312 encoding method to obtain the corresponding two bytes; add the two bytes by removing the carry to obtain the representative value corresponding to the keyword; then delete the digits higher than the tenth digit of the number of characters, mark the digits in the tenth digit of the remaining number of characters as the first digit, and mark the digits in the ones digit as the second digit; multiply the first 4 digits of the representative value of the keyword by the first digit to mark it as the third digit; multiply the last 4 digits of the representative value of the keyword by the second digit to mark it as the fourth digit; mark the result obtained by sorting and combining the third digit and the fourth digit as the report characteristic value;
[0016] All feature values are stored in nodes on the blockchain, including name feature values, age feature values, and report feature values; the node storing the feature values is marked as the first node.
[0017] Furthermore, the diagnosis and treatment data is encrypted, and the output encrypted ciphertext and ciphertext key include:
[0018] Generate a random symmetric encryption key and mark it as encryption key;
[0019] The diagnosis and treatment data is encrypted using an encryption key to obtain an encrypted ciphertext, which is marked as encrypted ciphertext.
[0020] Further, encrypting the ciphertext key and outputting the encrypted key; storing the encrypted key and the encrypted ciphertext includes:
[0021] Asymmetric encryption is used to generate a unique key pair for each doctor and patient, the key pair including a public key and a private key; each doctor is given the authority to obtain the private keys of other patients;
[0022] Encrypt the ciphertext key using the public key corresponding to the name in the medical data, and output the encrypted key;
[0023] The encryption key and encrypted ciphertext are stored on each node of the blockchain, where each node stores the complete encryption key and encrypted ciphertext.
[0024] Further, the user information includes patients, the encrypted ciphertext is decrypted based on the user information, and diagnosis and treatment data is output based on the data decryption; a security acquisition cycle is performed on the diagnosis and treatment data, and data judgment information is output based on the security acquisition cycle; and the access log is updated based on the data judgment information, including:
[0025] When the user who needs to view the diagnosis and treatment data is a patient, a data decryption process is performed, and the data decryption process includes:
[0026] Randomly select a node in the blockchain other than the tampered node, mark it as the second node, and obtain the stored encrypted ciphertext and the stored encryption key from the second node;
[0027] Decrypt the encryption key using the patient's private key to obtain a ciphertext key;
[0028] Decrypt the stored ciphertext using the ciphertext key, output the diagnosis and treatment data, and end the data decryption process;
[0029] Execute a security acquisition cycle, and output data judgment information based on the security acquisition cycle result; the data judgment information includes data security information or data tampering information;
[0030] When the data security information is received, the current time and the patient's name are obtained, and the access log is updated based on the current time and the patient's name.
[0031] Furthermore, the security acquisition cycle includes:
[0032] Calculate the characteristic values of the diagnosis and treatment data and mark them as decrypted values, wherein the decrypted values include the name characteristic value, the age characteristic value and the report characteristic value;
[0033] Obtain the feature value from the first node, and compare whether the name feature value, age feature value, and report feature value in the decrypted value correspond to and are the same as the name feature value, age feature value, and report feature value in the feature value;
[0034] When they are the same, output data security information;
[0035] When they are not the same, the second node is marked as a tampered node and the data tampering information is output; the data processing and security acquisition cycle is performed again.
[0036] Furthermore, the user information also includes a doctor, performing data decryption processing on the encrypted ciphertext based on the user information, and outputting diagnosis and treatment data based on the data decryption processing; performing a security acquisition cycle on the diagnosis and treatment data, and outputting data judgment information based on the security acquisition cycle; and updating the access log based on the data judgment information includes:
[0037] When the user who needs to view the diagnosis and treatment data is a doctor, the data decryption process is performed and the diagnosis and treatment data is output;
[0038] Different from the steps when the user viewing the diagnosis and treatment data is a patient, the data decryption process further includes:
[0039] Use the permission to obtain the private key of the patient you need to view and mark it as the decryption private key;
[0040] Execute a security acquisition cycle, and output data security information or data tampering information based on the security acquisition cycle result;
[0041] When the data security information is received, the current time and the name of the doctor who views the diagnosis and treatment data are obtained, and the access log is updated based on the current time and the name of the doctor who views the diagnosis and treatment data.
[0042] In a second aspect, the present invention also provides a patient diagnosis and treatment data encryption system based on blockchain, including a data encryption module, a data decryption module and a data verification module; the data encryption module is used to obtain the patient's diagnosis and treatment data, calculate the characteristic value of the diagnosis and treatment data, output multiple characteristic values and store the characteristic values; it is also used to encrypt the diagnosis and treatment data, output the encrypted ciphertext and the ciphertext key; encrypt the ciphertext key and output the encryption key; store the encryption key and the encrypted ciphertext;
[0043] The data decryption module is used to perform data decryption processing on the encrypted ciphertext based on the user information, and output the diagnosis and treatment data based on the data decryption processing; perform data decryption processing on the encrypted ciphertext based on the user information, and output the diagnosis and treatment data based on the data decryption processing;
[0044] The data verification module is used to perform a security acquisition cycle on the diagnosis and treatment data, output data judgment information based on the security acquisition cycle; and update the access log based on the data judgment information.
[0045] In a third aspect, the present application provides an electronic device, including a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method described above are executed.
[0046] In a fourth aspect, the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the method described above are executed.
[0047] Beneficial effects of the present invention: The present invention obtains medical data, calculates the characteristic value of each data item in the medical data, and then stores the characteristic value on the node of the blockchain; after symmetrically encrypting the medical data with a large amount of data, asymmetrically encrypts the symmetrical encryption key with a small amount of data; the advantage is that by calculating the characteristic value of each data item, the information of the original data can be prevented from being interpreted after data leakage during data transmission, thereby improving the security of the data transmission process; by encrypting a large amount of medical data in a symmetrical encryption manner, the encryption speed can be increased, and the efficiency of data encryption can be improved; and the symmetrical encryption key is encrypted by a more secure asymmetric encryption, thereby improving the security of the data encryption process;
[0048] The present invention also sets different permissions for patients and doctors, and performs different decryption steps when patients and doctors view medical data to obtain decrypted data; by calculating the characteristic value of each data item after decryption, it is possible to determine whether the decrypted data is the same as the original medical data, and when they are different, the data can be obtained from other nodes of the blockchain for decryption again; the advantage of this is that, through the immutability of blockchain technology, an attacker can only tamper with the information stored in some nodes in the blockchain. When erroneous information happens to be obtained from the tampered node, it can be determined that the information in the node has been tampered with, and data can be obtained from other nodes for decryption until the correct data is obtained, thereby improving the protection of data integrity; by setting different permissions for doctors and patients, it is possible to prevent patients from accessing other people's medical data without authorization, thereby improving the security of stored data. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 is a functional block diagram of the system of the present invention;
[0050] Figure 2 is a flow chart of the steps of the method of the present invention;
[0051] Figure 3Schematic diagram of data storage in the blockchain of the present invention. Detailed implementation manners
[0052] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0053] Embodiment 1, the present invention provides a patient diagnosis and treatment data encryption system based on blockchain, including a data encryption module, a data decryption module, and a data verification module; the data encryption module is used to obtain the diagnosis and treatment data of patients, calculate the eigenvalue of the diagnosis and treatment data, output multiple eigenvalues and store the eigenvalues; it is also used to encrypt the diagnosis and treatment data, output an encrypted ciphertext and a ciphertext key; encrypt the ciphertext key, output an encrypted key; perform storage processing on the encrypted key and the encrypted ciphertext;
[0054] The data encryption module is configured with a feature calculation strategy, and the feature calculation strategy includes:
[0055] Obtain the diagnosis and treatment data of patients, the diagnosis and treatment data includes multiple data items, and the data items include name, age, and inspection report;
[0056] Convert each Chinese character in the name into binary in the way of GB2312 encoding, and obtain two bytes corresponding to each Chinese character; add the two bytes in the way of removing carry to obtain the representative value corresponding to each Chinese character;
[0057] Then add the representative values of all Chinese characters in the name in the way of removing carry to obtain the name eigenvalue;
[0058] In specific implementation, taking the name "Zhang San" as an example, it includes two Chinese characters, namely "Zhang" and "San". After being converted into binary in the way of GB2312 encoding, the binary encoding corresponding to the Chinese character "Zhang" is 1101010111000101, where the first 8 digits are the first subset and the last 8 digits are the second byte; splitting it, two bytes [11010101] and [11000101] are obtained; the way of removing carry means adding the binary bytes in decimal to obtain the representative value of the Chinese character "Zhang" as [22010202];
[0059] The two bytes corresponding to the Chinese character "三" are [11001000] and [11111101], and the corresponding representative values are [22112101]; then calculate the sum of the two representative values to obtain the final result [44122303], that is, the name feature value corresponding to the name "张三" is [44122303]; the purpose of using an 8-digit feature value is to increase the specificity of the calculated name feature value, making it less likely for different names to correspond to the same feature value, thereby reducing the probability that the tampered name feature value happens to be the same as the pre-tampered name feature value after the name data is tampered with.
[0060] Set the feature change function y = ax + b, substitute the age into x in the feature change function to obtain the age feature value y, where both a and b are constants;
[0061] In specific implementation, a is set to 5 and b is set to -100; taking the age of 30 as an example, substituting it into the feature change function gives an age feature value of 50; on the one hand, setting a to a small positive integer facilitates calculation, and on the other hand, setting b to -100 makes it difficult to deduce the original age information after the directly used age feature value for data transmission is leaked.
[0062] Obtain the number of Chinese characters in the inspection report and mark it as the number of words; calculate the appearance rate of each Chinese character in the inspection report and mark the Chinese character with the lowest appearance rate as the keyword;
[0063] Convert the keyword to binary in the GB2312 encoding method to obtain the corresponding two bytes; add the two bytes in a way that removes carry to obtain the representative value corresponding to the keyword; then delete the digits of the number of words higher than the tens place, mark the digit in the tens place of the remaining number of words as the first digit, and the digit in the units place as the second digit; multiply the first 4 digits of the representative value of the keyword by the first digit and mark it as the third digit; multiply the last 4 digits of the representative value of the keyword by the second digit and mark it as the fourth digit; mark the result obtained by sorting and combining the third digit and the fourth digit as the report feature value;
[0064] It should be noted that selecting the Chinese character with the lowest occurrence rate as the keyword can best represent the particularity of each report. For example, in a medical examination report, generally, the characters related to and common in pathological data have a higher occurrence rate. For instance, in a blood-related examination report, the character "blood" appears frequently. When there are multiple Chinese characters with the same and lowest occurrence rate, any one of them can be selected as the keyword. Taking the Chinese character "disease" as an example, the corresponding two bytes are [10110010] and [10100001] respectively. After removing the carry and adding them together, the representative value 20210011 is obtained. If the number of characters is 1234, the digits higher than the tens place of the number of characters are deleted, and the remaining number of characters 34 is obtained, where 3 is the first digit and 4 is the second digit. Multiply the first 4 digits of the representative value by 3 to get the third digit 6063; multiply the last 4 digits by 4 to get the fourth digit 0044. After sorting and combining, the report feature value is 60630044;
[0065] Please refer to Figure 3 as shown Figure 3 Figure 1 shows the multiple nodes in the blockchain and different data storage methods. If the feature value is stored in Node 1, then after storage, Node 1 is marked as the first node;
[0066] All feature values are stored at the nodes on the blockchain. The feature values include name feature values, age feature values, and report feature values; the nodes storing the feature values are marked as the first nodes.
[0067] The data encryption module is also configured with a first encryption policy, and the first encryption policy includes:
[0068] Generate a random symmetric encryption key, marked as the encryption key;
[0069] Use the encryption key to encrypt the diagnosis and treatment data to obtain the encrypted ciphertext, marked as the encrypted ciphertext;
[0070] In specific implementation, the AES symmetric encryption algorithm can be used to generate a random encryption key; compared with the asymmetric encryption method, the diagnosis and treatment data usually has a large data volume, and the symmetric encryption method can significantly improve the encryption speed.
[0071] The data encryption module is also configured with a second encryption policy, and the second encryption policy includes:
[0072] Adopt the asymmetric encryption method to generate a unique key pair for each doctor and patient. The key pair includes a public key and a private key; set the permission for each doctor to obtain the private keys of other patients;
[0073] Use the public key corresponding to the name in the diagnosis and treatment data to encrypt the ciphertext key and output the encryption key;
[0074] The encryption key and encrypted ciphertext are stored on each node of the blockchain, where each node stores the complete encryption key and encrypted ciphertext;
[0075] It should be noted that compared with symmetric encryption, asymmetric encryption has higher security. After the diagnosis and treatment data is symmetrically encrypted, an encryption key is required to correctly decrypt it. The data size of the encryption key is much smaller than the data size of the diagnosis and treatment data. Therefore, asymmetric encryption is used to encrypt the encryption key to improve the protection of the encryption key;
[0076] Storing patients' medical data on multiple nodes of the blockchain network can increase the redundancy of the data. Through the immutability of the blockchain, even if a node fails or is attacked, the data can still be obtained from other nodes.
[0077] The data decryption module is used to perform data decryption processing on the encrypted ciphertext based on user information, and output diagnosis and treatment data based on the data decryption processing;
[0078] The data decryption module is configured with a first decryption strategy, which includes:
[0079] When the user who needs to view the diagnosis and treatment data is a patient, data decryption processing is performed, and the data decryption processing includes:
[0080] Randomly select a node in the blockchain other than the tampered node, mark it as the second node, and obtain the stored encrypted ciphertext and the stored encryption key from the second node;
[0081] Decrypt the encryption key using the patient's private key to obtain a ciphertext key;
[0082] Decrypt the stored ciphertext using the ciphertext key, output the diagnosis and treatment data, and end the data decryption process;
[0083] It should be noted that through the setting of permissions, patients can only use their own private keys to decrypt the encryption keys of the medical data they need to access. If the medical data they need to access is encrypted with the patient's own public key, it can be decrypted correctly. If the medical data being accessed is someone else's medical data, it cannot be decrypted correctly, thereby protecting the privacy of other patients.
[0084] The data decryption module is also configured with a second decryption strategy, which includes:
[0085] When the user who needs to view the diagnosis and treatment data is a doctor, when performing data decryption processing, an additional step is performed to obtain the private key of the patient who needs to view the data using the permission, marked as a step of decrypting the private key, and outputting the diagnosis and treatment data;
[0086] It should be noted that data access rules and authority control can be implemented through blockchain smart contracts. When a patient needs to access other patients' medical data, he can apply to the doctor for access rights. Only after obtaining access rights can he obtain other patients' private keys for decryption; when the doctor needs to view other patients' medical data, he can directly obtain the patient's private key for decryption.
[0087] The data verification module is used to perform a secure acquisition cycle on the diagnosis and treatment data, output data judgment information based on the secure acquisition cycle; and update the access log based on the data judgment information;
[0088] The data verification module is configured with a security judgment strategy, which includes:
[0089] Calculate the characteristic values of the diagnosis and treatment data and mark them as decrypted values, which include the name characteristic value, age characteristic value and report characteristic value;
[0090] Obtain the feature value from the first node, and compare whether the name feature value, age feature value, and report feature value in the decrypted value correspond to and are the same as the name feature value, age feature value, and report feature value in the feature value;
[0091] When they are the same, output data security information;
[0092] When they are not the same, the second node is marked as a tampered node and the data tampering information is output; the data processing and security acquisition cycle is performed again.
[0093] The data verification module is also configured with a log generation strategy, which includes:
[0094] When the accessing user is a doctor: when the data security information is received, the current time and the name of the doctor who views the diagnosis and treatment data are obtained, and the access log is updated based on the current time and the name of the doctor who views the diagnosis and treatment data;
[0095] When the accessing user is a patient: when the data security information is received, the current time and the patient's name are obtained, and the access log is updated based on the current time and the patient's name.
[0096] Example 2, please refer to Figure 2 As shown, the present invention also provides a method for encrypting patient medical data based on blockchain, including: step S1, obtaining the patient's medical data, calculating the characteristic value of the medical data, outputting multiple characteristic values and storing the characteristic values; step S1 also includes the following sub-steps:
[0097] Step S101, obtaining the patient's diagnosis and treatment data, which includes multiple data items, including name, age and examination report;
[0098] Step S102, convert each Chinese character in the name into binary according to GB2312 encoding to obtain two bytes corresponding to each Chinese character; add the two bytes by removing the carry to obtain a representative value corresponding to each Chinese character;
[0099] Step S103, adding the representative values of all Chinese characters in the name by removing the carry, to obtain the name feature value;
[0100] Step S104, setting a characteristic change function y=ax+b, substituting age into x in the characteristic change function to obtain an age characteristic value y, where a and b are both constants;
[0101] Step S105, obtaining the number of Chinese characters in the inspection report and marking it as word count; calculating the occurrence rate of each Chinese character in the inspection report, and marking the Chinese character with the lowest occurrence rate as a keyword;
[0102] Step S106, convert the keyword into binary in the manner of GB2312 encoding to obtain the corresponding two bytes; add the two bytes in a manner of removing the carry to obtain the representative value corresponding to the keyword; then delete the digits higher than the tenth digit of the number of characters, mark the digits at the tenth digit of the remaining number of characters as the first digit, and mark the digits at the ones digit as the second digit; multiply the first 4 digits of the representative value of the keyword by the first digit, and multiply the last 4 digits of the representative value of the keyword by the second digit, and mark the result as the report characteristic value;
[0103] Step S107, store all feature values at the nodes on the blockchain, the feature values include name feature values, age feature values and report feature values; mark the node storing the feature values as the first node.
[0104] Step S2, encrypt the diagnosis and treatment data, output the encrypted ciphertext and the ciphertext key; encrypt the ciphertext key and output the encrypted key; store the encrypted key and the encrypted ciphertext; Step S2 also includes the following sub-steps:
[0105] Step S2011, generating a random symmetric encryption key, marked as an encryption key;
[0106] Step S2012, use the encryption key to encrypt the medical data to obtain the encrypted ciphertext, which is marked as encrypted ciphertext.
[0107] Step S2021, using asymmetric encryption to generate a unique key pair for each doctor and patient, the key pair including a public key and a private key; setting permissions for each doctor to obtain other patients' private keys;
[0108] Step S2022, encrypt the ciphertext key using the public key corresponding to the name in the diagnosis and treatment data, and output the encrypted key;
[0109] Step S2023, storing the encryption key and the encrypted ciphertext on each node of the blockchain, wherein each node stores the complete encryption key and the encrypted ciphertext.
[0110] Step S3, performing data decryption processing on the encrypted ciphertext based on the user information, and outputting the diagnosis and treatment data based on the data decryption processing; performing a security acquisition cycle on the diagnosis and treatment data, and outputting data judgment information based on the security acquisition cycle; and updating the access log based on the data judgment information; Step S3 also includes the following sub-steps:
[0111] Step S301: When the user who needs to view the diagnosis and treatment data is a patient, data decryption processing is performed, and the data decryption processing includes:
[0112] Randomly select a node in the blockchain other than the tampered node, mark it as the second node, and obtain the stored encrypted ciphertext and the stored encryption key from the second node;
[0113] Decrypt the encryption key using the patient's private key to obtain a ciphertext key;
[0114] Decrypt the stored ciphertext using the ciphertext key, output the diagnosis and treatment data, and end the data decryption process;
[0115] Step S302, executing a security acquisition cycle, and outputting data judgment information based on the security acquisition cycle result; the data judgment information includes data security information or data tampering information;
[0116] Step S302 also includes the following sub-steps:
[0117] Step S3021, calculating the characteristic values of the diagnosis and treatment data and marking them as decrypted values, the decrypted values including the name characteristic value, age characteristic value and report characteristic value;
[0118] Step S3022, obtaining a feature value from the first node, and comparing whether the name feature value, age feature value, and report feature value in the decrypted value correspond to and are identical to the name feature value, age feature value, and report feature value in the feature value;
[0119] Step S3023, when they are the same, output data security information; when they are not the same, mark the second node as a tampered node and output data tampering information; perform data processing and security acquisition cycle again;
[0120] Step S303, when the data security information is received, the current time and the patient's name are obtained, and the access log is updated based on the current time and the patient's name;
[0121] Step S304, when the user who needs to view the diagnosis and treatment data is a doctor, perform data decryption processing and output the diagnosis and treatment data; different from the steps when the user who views the diagnosis and treatment data is a patient, the data decryption processing also includes: using the authority to obtain the private key of the patient who needs to view, and marking it as a decryption private key;
[0122] Step S305, executing a security acquisition cycle, and outputting data security information or data tampering information based on the security acquisition cycle result;
[0123] Step S306, when the data security information is received, the current time and the name of the doctor who views the diagnosis and treatment data are obtained, and the access log is updated based on the current time and the name of the doctor who views the diagnosis and treatment data.
[0124] Embodiment 3, the present application provides an electronic device, including a processor and a memory, the memory storing computer-readable instructions, when the computer-readable instructions are executed by the processor, the steps in the above method are executed. Through the above technical solution, the processor and the memory are interconnected and communicate with each other through a communication bus and / or other forms of connection mechanisms, the memory stores a computer program executable by the processor, when the electronic device is running, the processor executes the computer program, and executes the method in any optional implementation of the above embodiment when executing, so as to realize the following functions: obtaining the patient's diagnosis and treatment data, calculating the characteristic value of the diagnosis and treatment data, outputting multiple characteristic values and storing the characteristic values; encrypting the diagnosis and treatment data, outputting the encrypted ciphertext and the ciphertext key; encrypting the ciphertext key, storing the encryption key and the encrypted ciphertext; decrypting the encrypted ciphertext and outputting the diagnosis and treatment data; performing a secure acquisition cycle on the diagnosis and treatment data, and outputting the data judgment information; updating the access log.
[0125] Embodiment 4, the present application provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in any of the above methods are executed. Through the above technical solution, when the computer program is executed by the processor, the method in any optional implementation of the above embodiment is executed to achieve the following functions: obtaining the patient's diagnosis and treatment data, calculating the characteristic value of the diagnosis and treatment data, outputting multiple characteristic values and storing the characteristic values; encrypting the diagnosis and treatment data, outputting the encrypted ciphertext and the ciphertext key; encrypting the ciphertext key, storing the encryption key and the encrypted ciphertext; decrypting the encrypted ciphertext and outputting the diagnosis and treatment data; performing a secure acquisition cycle on the diagnosis and treatment data, and outputting data judgment information; updating the access log.
[0126] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0127] It should be understood by those skilled in the art that the embodiments of the present invention can be provided as methods, systems or computer program products. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program codes. Among them, the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, disk or optical disk. These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0128] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
Claims
1. A method for encrypting patient diagnosis and treatment data based on blockchain, characterized in that: include: Obtaining the patient's diagnosis and treatment data, calculating the characteristic values of the diagnosis and treatment data, outputting multiple characteristic values and storing the characteristic values; Encrypt the diagnosis and treatment data and output the encrypted ciphertext and ciphertext key; Encrypt the ciphertext key and output the encrypted key; Storing and processing encryption keys and encrypted ciphertexts; Performing data decryption processing on the encrypted ciphertext based on the user information, and outputting diagnosis and treatment data based on the data decryption processing; Perform a security acquisition cycle on the diagnosis and treatment data, output data judgment information based on the security acquisition cycle; and update the access log based on the data judgment information.
2. The method for encrypting patient medical data based on blockchain according to claim 1, characterized in that: Obtaining the patient's diagnosis and treatment data, calculating the characteristic values of the diagnosis and treatment data, outputting multiple characteristic values and storing the characteristic values includes: Acquire the patient's diagnosis and treatment data, wherein the diagnosis and treatment data includes multiple data items, including name, age, and examination report; Convert each Chinese character in the name into binary according to GB2312 encoding to obtain two bytes corresponding to each Chinese character; add the two bytes by removing the carry to obtain the representative value corresponding to each Chinese character; Then, the representative values of all Chinese characters in the name are added up by removing the carry to obtain the name feature value; Set the characteristic change function y=ax+b, substitute the age into x in the characteristic change function, and get the age characteristic value y, where a and b are both constants; Obtain the number of Chinese characters in the inspection report and mark it as the number of characters; calculate the occurrence rate of each Chinese character in the inspection report and mark the Chinese character with the lowest occurrence rate as a keyword; Convert the keyword into binary in the GB2312 encoding method to obtain the corresponding two bytes; add the two bytes by removing the carry to obtain the representative value corresponding to the keyword; then delete the digits higher than the tenth digit of the number of characters, mark the digits in the tenth digit of the remaining number of characters as the first digit, and mark the digits in the ones digit as the second digit; multiply the first 4 digits of the representative value of the keyword by the first digit to mark it as the third digit; multiply the last 4 digits of the representative value of the keyword by the second digit to mark it as the fourth digit; mark the result obtained by sorting and combining the third digit and the fourth digit as the report characteristic value; All feature values are stored in nodes on the blockchain, including name feature values, age feature values, and report feature values; the node storing the feature values is marked as the first node.
3. The method for encrypting patient medical data based on blockchain according to claim 2 is characterized in that: Encrypt the diagnosis and treatment data, and output the encrypted ciphertext and ciphertext key including: Generate a random symmetric encryption key and mark it as encryption key; The diagnosis and treatment data is encrypted using an encryption key to obtain an encrypted ciphertext, which is marked as encrypted ciphertext.
4. The method for encrypting patient medical data based on blockchain according to claim 3 is characterized in that: Encrypt the ciphertext key and output the encrypted key; The storage process of the encryption key and the encrypted ciphertext includes: Asymmetric encryption is used to generate a unique key pair for each doctor and patient, the key pair including a public key and a private key; each doctor is given the authority to obtain the private keys of other patients; Encrypt the ciphertext key using the public key corresponding to the name in the medical data, and output the encrypted key; The encryption key and encrypted ciphertext are stored on each node of the blockchain, where each node stores the complete encryption key and encrypted ciphertext.
5. The method for encrypting patient medical data based on blockchain according to claim 4 is characterized in that: The user information includes the patient, the encrypted ciphertext is decrypted based on the user information, and the diagnosis and treatment data is output based on the data decryption; Perform a secure acquisition cycle on the diagnosis and treatment data, and output data judgment information based on the secure acquisition cycle; Based on the data, the information updated in the access log includes: When the user who needs to view the diagnosis and treatment data is a patient, a data decryption process is performed, and the data decryption process includes: Randomly select a node in the blockchain other than the tampered node, mark it as the second node, and obtain the stored encrypted ciphertext and the stored encryption key from the second node; Decrypt the encryption key using the patient's private key to obtain a ciphertext key; Decrypt the stored ciphertext using the ciphertext key, output the diagnosis and treatment data, and end the data decryption process; Execute a security acquisition cycle, and output data judgment information based on the security acquisition cycle result; the data judgment information includes data security information or data tampering information; When the data security information is received, the current time and the patient's name are obtained, and the access log is updated based on the current time and the patient's name.
6. The method for encrypting patient diagnosis and treatment data based on blockchain according to claim 5 is characterized in that: The secure acquisition cycle includes: Calculate the characteristic values of the diagnosis and treatment data and mark them as decrypted values, wherein the decrypted values include the name characteristic value, the age characteristic value and the report characteristic value; Obtain the feature value from the first node, and compare whether the name feature value, age feature value, and report feature value in the decrypted value correspond to and are the same as the name feature value, age feature value, and report feature value in the feature value; When they are the same, output data security information; When they are not the same, the second node is marked as a tampered node and the data tampering information is output; the data processing and security acquisition cycle is performed again.
7. The method for encrypting patient medical data based on blockchain according to claim 5 is characterized in that: The user information also includes a doctor, who performs data decryption processing on the encrypted ciphertext based on the user information and outputs diagnosis and treatment data based on the data decryption processing; Perform a secure acquisition cycle on the diagnosis and treatment data, and output data judgment information based on the secure acquisition cycle; Based on the data, the information updated in the access log includes: When the user who needs to view the diagnosis and treatment data is a doctor, the data decryption process is performed and the diagnosis and treatment data is output; Different from the steps when the user viewing the diagnosis and treatment data is a patient, the data decryption process further includes: Use the permission to obtain the private key of the patient you need to view, and mark it as the decryption private key; Execute a security acquisition cycle, and output data security information or data tampering information based on the security acquisition cycle result; When the data security information is received, the current time and the name of the doctor who views the diagnosis and treatment data are obtained, and the access log is updated based on the current time and the name of the doctor who views the diagnosis and treatment data.
8. A patient diagnosis and treatment data encryption system based on blockchain, applicable to the patient diagnosis and treatment data encryption method based on blockchain according to any one of claims 1 to 7, characterized in that: It includes a data encryption module, a data decryption module and a data verification module; the data encryption module is used to obtain the patient's diagnosis and treatment data, calculate the characteristic value of the diagnosis and treatment data, output multiple characteristic values and store the characteristic values; it is also used to encrypt the diagnosis and treatment data, output the encrypted ciphertext and the ciphertext key; encrypt the ciphertext key and output the encryption key; Storing and processing encryption keys and encrypted ciphertexts; The data decryption module is used to perform data decryption processing on the encrypted ciphertext based on the user information, and output the diagnosis and treatment data based on the data decryption processing; The data verification module is used to perform a security acquisition cycle on the diagnosis and treatment data, output data judgment information based on the security acquisition cycle; and update the access log based on the data judgment information.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method according to any one of claims 1 to 7 are executed.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 7 are executed.
Citation Information
Patent Citations
Blockchain data sharing encryption and decryption method, equipment, and storage medium
CN111385301A