CN111599425B - Hierarchical electronic medical record storage method and device based on block chain oriented node dynamics - Google Patents

Hierarchical electronic medical record storage method and device based on block chain oriented node dynamics Download PDF

Info

Publication number
CN111599425B
CN111599425B CN202010344869.3A CN202010344869A CN111599425B CN 111599425 B CN111599425 B CN 111599425B CN 202010344869 A CN202010344869 A CN 202010344869A CN 111599425 B CN111599425 B CN 111599425B
Authority
CN
China
Prior art keywords
node
data
medical record
verification
blockchain
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010344869.3A
Other languages
Chinese (zh)
Other versions
CN111599425A (en
Inventor
樊玉琦
伍唤宇
平润润
李亚茹
鲍齐龙
穆罕默德·埃尔霍塞尼
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hefei University of Technology
Original Assignee
Hefei University of Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hefei University of Technology filed Critical Hefei University of Technology
Priority to CN202010344869.3A priority Critical patent/CN111599425B/en
Publication of CN111599425A publication Critical patent/CN111599425A/en
Application granted granted Critical
Publication of CN111599425B publication Critical patent/CN111599425B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16HHEALTHCARE INFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR THE HANDLING OR PROCESSING OF MEDICAL OR HEALTHCARE DATA
    • G16H10/00ICT specially adapted for the handling or processing of patient-related medical or healthcare data
    • G16H10/60ICT specially adapted for the handling or processing of patient-related medical or healthcare data for patient-specific data, e.g. for electronic patient records
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6227Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database where protection concerns the structure of data, e.g. records, types, queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2107File encryption
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2151Time stamp
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Bioethics (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Public Health (AREA)
  • Primary Health Care (AREA)
  • Medical Informatics (AREA)
  • Epidemiology (AREA)
  • Databases & Information Systems (AREA)
  • Medical Treatment And Welfare Office Work (AREA)

Abstract

本发明公开了一种基于区块链面向节点动态的分层电子病历存储方法及装置,其可根据病人发送的调取请求,通过数据共识处理、数据同步处理、数据传播处理,读取相关数据;根据病人发送的授权和密钥,将前述读取的相关数据发送至对应科室医生;根据前述的病人授权,允许医生对对应病历进行数据写入管理;将前述医生对病历的管理操作反馈至数据池;该发明通过两种验证机制,保证了数据读取的实时正确性,以及节点本地数据库的完整性,可保证区块链中的数据不被篡改,且即使被改动也会有迹可循,留下篡改证据;另外,对于密钥的设置,病人可以将密钥分成秘密份额,分发给自己的亲朋好友或者第三方机构,以备意外情况发生时的备案启动。

The invention discloses a node-dynamic hierarchical electronic medical record storage method and device based on blockchain, which can read relevant data through data consensus processing, data synchronization processing, and data dissemination processing according to the retrieval request sent by the patient. ; According to the authorization and key sent by the patient, the aforementioned read relevant data is sent to the corresponding department doctor; according to the aforementioned patient authorization, the doctor is allowed to write and manage the data of the corresponding medical record; the aforementioned doctor's management operation of the medical record is fed back to Data pool; this invention ensures the real-time correctness of data reading and the integrity of the node's local database through two verification mechanisms, ensuring that the data in the blockchain will not be tampered with, and even if it is modified, there will be traces. Follow-up, leaving evidence of tampering; in addition, for the setting of the key, the patient can divide the key into secret shares and distribute it to his relatives, friends or third-party organizations to prepare for the activation of registration when unexpected situations occur.

Description

基于区块链面向节点动态的分层电子病历存储方法及装置Hierarchical electronic medical record storage method and device based on blockchain for node dynamics

技术领域Technical field

本发明涉及计算机技术领域,具体的涉及一种基于区块链面向节点动态的分层电子病历存储方法及装置。The present invention relates to the field of computer technology, and specifically relates to a node dynamic oriented hierarchical electronic medical record storage method and device based on blockchain.

背景技术Background technique

电子病历的发展已经有近六十年,我国的医院开始将病历电子化至今也有二十余年。电子病历与传统纸质病历相比,有内容充分、病历标准和规范、病历管理质量、存储简易查阅方便、有利于病历共享等优点。电子病历与HIS系统相辅相成,可以提高医疗工作效率,提升用药安全、提供电子病历的数据挖掘。随着大数据、机器学习的快速发展,目前的电子病历与EMR、LIS、PACS等系统进行融合,实现系统间数据共享,打破信息孤岛。Electronic medical records have been developed for nearly sixty years, and it has been more than twenty years since hospitals in my country began to digitize medical records. Compared with traditional paper medical records, electronic medical records have the advantages of sufficient content, medical record standards and specifications, quality of medical record management, easy storage and convenient access, and conducive to the sharing of medical records. Electronic medical records and HIS systems complement each other and can improve medical work efficiency, enhance medication safety, and provide data mining for electronic medical records. With the rapid development of big data and machine learning, current electronic medical records are integrated with systems such as EMR, LIS, and PACS to realize data sharing between systems and break down information silos.

但是目前来看已经应用的电子病历主要关注对工作效率和管理规范,目前较新设计的电子病历设计也只是增加了对数据共享、数据挖掘等最新热点的探讨和支持,仍都是集中式的存储机制,部署在医院内部,病历完全由医院系统管理员掌握,非常容易遭到篡改。然而,电子病历目前的真实性证明非常困难,因为目前电子病历防篡改的证明主要有:主张电子病历有安全的防入侵设施、有严格的访问控制、有密码技术防止篡改。但是这些主张从技术上看都不足以证明电子病历没有被篡改。目前电子病历的真实性证明方法还存在缺陷。However, the current electronic medical records that have been applied mainly focus on work efficiency and management standards. The current newer electronic medical record designs only add discussion and support for the latest hot topics such as data sharing and data mining, and are still centralized. The storage mechanism is deployed inside the hospital. Medical records are completely controlled by the hospital system administrator and are very easy to be tampered with. However, it is very difficult to prove the authenticity of electronic medical records at present, because the current evidence of tamper-proof electronic medical records mainly includes: claiming that electronic medical records have secure anti-intrusion facilities, strict access control, and cryptographic technology to prevent tampering. But these claims are not technically sufficient to prove that electronic medical records have not been tampered with. The current method of proving the authenticity of electronic medical records still has shortcomings.

近年来随着区块链技术的兴起,不少学者和企业开始将电子病历安全的希望转向区块链技术,希望借助区块链技术的防篡改特性来解决电子病历可能被篡改以及篡改无法检测的现状。目前有许多基于区块链设计的电子病历和电子存证系统,但绝大部分采用PBFT算法,就目前来看,这些系统或产品或多或少都存在一些问题,无法解决或适配本系统的应用场景的需求。首先是共识算法方面:相当一部分系统采用了自己的共识算法或者新提出的共识算法,但总是存在一定的问题,算法的安全性和实用性,及并不保证连续性、完整性;其次是框架设计方面,有一部分框架并不适用于直接应用在现有的医疗系统中,难以推行应用。且有些系统采用了现有的共识协议算法或者框架,考虑了应用层面的设计和功能,但缺乏针对区块链节点可能不在线的情况进行共识算法适配。还有一部分基于PBFT算法的共识协议没有考虑到网络分区的情况,相对静态,缺乏针对节点动态加入和离开的处理。还有部分研究考虑在医疗系统中引入代币,将医疗记录的数据转化为价值,主要考虑数据的共享和交易,但对数据防篡改的考虑不足。In recent years, with the rise of blockchain technology, many scholars and companies have begun to turn their hopes for the security of electronic medical records to blockchain technology, hoping to use the anti-tampering characteristics of blockchain technology to solve the problem that electronic medical records may be tampered with and the tampering cannot be detected. current situation. There are currently many electronic medical records and electronic certificate storage systems designed based on blockchain, but most of them use the PBFT algorithm. At present, these systems or products have more or less problems that cannot be solved or adapted to this system. requirements of application scenarios. The first is the consensus algorithm: quite a few systems use their own consensus algorithm or a newly proposed consensus algorithm, but there are always certain problems. The security and practicality of the algorithm do not guarantee continuity and integrity; secondly, In terms of framework design, some frameworks are not suitable for direct application in existing medical systems and are difficult to implement. And some systems adopt existing consensus protocol algorithms or frameworks, taking into account the design and functions at the application level, but lack consensus algorithm adaptation for situations where blockchain nodes may not be online. There are also some consensus protocols based on the PBFT algorithm that do not take into account network partitions, are relatively static, and lack processing for dynamic joining and leaving of nodes. There are also some studies that consider introducing tokens into the medical system to convert medical record data into value. They mainly consider data sharing and transactions, but there is insufficient consideration for data tamper resistance.

为此,针对上述所述弊端,设计一种方法/装置,用于医院间基于区块链的分布式电子病历存储的部署领域,特别是有小型医疗机构比如诊所、私人医院等大量轻量级可能存在离线或者维护等操作的环境下的区块链应用方法,并可同时解决上述存在的问题,成为了目前技术人员的创新设计理念。To this end, in view of the above-mentioned disadvantages, a method/device is designed for the deployment of blockchain-based distributed electronic medical record storage between hospitals, especially when there are a large number of lightweight medical institutions such as small medical institutions such as clinics and private hospitals. There may be blockchain application methods in the environment of offline or maintenance operations, and can solve the above existing problems at the same time, which has become an innovative design concept for current technicians.

发明内容Contents of the invention

为克服现有技术的缺陷,本发明的目的在于:提供一种基于区块链面向节点动态的分层电子病历存储方法及装置,解决了现有技术中因为网络原因以及节点可能离线等原因,可能出现不存在大多数节点值相同的情况,采用PBFT算法无法达到共识,相对静态的PBFT算法难以应用在此场景;另外,区块链虽然可以保证数据不被篡改,但是无法保证在取出数据的时候数据是否为正确的数据,在本地区块链的数据受到改动时,无法实时感知数据的修改,继而在读取时读取到被篡改的数据,无法依靠区块链的防篡改性实时发现改动等上述问题。In order to overcome the shortcomings of the existing technology, the purpose of the present invention is to provide a node dynamic hierarchical electronic medical record storage method and device based on blockchain, which solves the problem of network reasons and possible offline nodes in the existing technology. There may be situations where most nodes have the same values, and the PBFT algorithm cannot reach consensus. The relatively static PBFT algorithm is difficult to apply in this scenario. In addition, although the blockchain can ensure that the data is not tampered with, it cannot guarantee that the data will not be tampered with. Whether the data is correct at the time, when the data in the local blockchain is modified, it is impossible to detect the modification of the data in real time, and then the tampered data is read when reading, and it is impossible to rely on the tamper resistance of the blockchain to detect it in real time. Changes and other issues mentioned above.

鉴于上述问题,本发明提供一种基于区块链面向节点动态的分层电子病历存储方法及装置。In view of the above problems, the present invention provides a node dynamic oriented hierarchical electronic medical record storage method and device based on blockchain.

第一方面,本发明提供一种基于区块链面向节点动态的分层电子病历存储方法,所述方法具体步骤包括:In a first aspect, the present invention provides a node-dynamic hierarchical electronic medical record storage method based on blockchain. The specific steps of the method include:

步骤一:根据病人发送的调取请求,通过数据共识处理、数据同步处理、数据传播处理,读取相关数据;Step 1: According to the retrieval request sent by the patient, read relevant data through data consensus processing, data synchronization processing, and data dissemination processing;

步骤二:根据病人发送的授权和密钥,将步骤一中读取的相关数据发送至对应科室医生;Step 2: Based on the authorization and key sent by the patient, send the relevant data read in step 1 to the doctor in the corresponding department;

步骤三:根据步骤二中的病人授权,允许医生对对应病历进行数据写入管理;Step 3: Based on the patient authorization in Step 2, allow doctors to write and manage data on the corresponding medical records;

步骤四:将步骤三中医生对病历的管理操作反馈至数据池;Step 4: Feed back the doctor’s medical record management operations in Step 3 to the data pool;

区块链分层方案:将拥有足够算力和更高可信度的大型医院设置为主要节点,将算力不足以及可能经常离线和上线的私人医院、卫生所节点设置为边缘节点,边缘节点只存储区块头,而主要节点存储完整数据;Blockchain layering scheme: Set large hospitals with sufficient computing power and higher credibility as main nodes, and set private hospitals and health clinic nodes with insufficient computing power and which may often go offline and online as edge nodes. Edge nodes Only the block header is stored, while the main node stores the complete data;

所述数据共识处理,具体步骤包括:The specific steps of the data consensus processing include:

步骤1.0:所有主要节点将接收到的病历写上时间戳,并转变为准备广播的状态;Step 1.0: All major nodes write timestamps on the received medical records and transition to a state ready for broadcast;

步骤1.1:若本节点为主要节点,x=节点在t到t+m时间段内根据接收到的病历信息所计算的默克尔树;Step 1.1: If this node is the main node, x = Merkel tree calculated by the node based on the received medical record information in the time period from t to t+m;

步骤1.2:若本节点为边缘节点,x置空;Step 1.2: If this node is an edge node, leave x blank;

步骤:1.3:order节点向所有主要节点发送消息,通知其打包t到t+m时间段内的病历;Step: 1.3: The order node sends a message to all major nodes, notifying them to package the medical records within the time period from t to t+m;

步骤1.4:阶段个数小于f+1,继续步骤1.6;Step 1.4: The number of stages is less than f+1, continue to step 1.6;

步骤1.5:算法结束;Step 1.5: The algorithm ends;

步骤1.6:本节点广播自己的输入值value(x),并转变为准备接收提议的状态;Step 1.6: This node broadcasts its own input value value(x) and changes to a state ready to receive proposals;

步骤1.7:若本节点接收到其他节点广播的value(y)次数至少n-f次,则本节点广播propose(y);Step 1.7: If this node receives value(y) broadcast by other nodes at least n-f times, then this node broadcasts propose(y);

步骤1.8:若本节点接收到propose(z)至少f次,则本节点修改x为z;Step 1.8: If this node receives proposal(z) at least f times, then this node modifies x to z;

步骤1.9:RSA随机数生成器生成第i阶段的主节点vi,且每阶段主节点不重复;Step 1.9: The RSA random number generator generates the master node vi of the i-th stage, and the master node does not repeat in each stage;

步骤1.10:主节点vi广播其值value(w);Step 1.10: The master node vi broadcasts its value value(w);

步骤1.11:若本节点接收到propose(x)的次数严格少于n-f,则本节点修改x为w;Step 1.11: If the number of times this node receives propose(x) is strictly less than n-f, then this node modifies x to w;

步骤1.12:阶段个数加1,返回步骤1.4。。Step 1.12: Add 1 to the number of stages and return to step 1.4. .

1、优选地,所述数据同步处理,具体步骤包括:1. Preferably, the data synchronization processing includes:

步骤2.0:若节点u是与网络断开连接时调用本算法,停止广播病历区块,新增病历保留在本地,系统在网络分区中继续运行,等待网络恢复。Step 2.0: If node u calls this algorithm when it is disconnected from the network, it will stop broadcasting the medical record block, the new medical record will be kept locally, and the system will continue to run in the network partition, waiting for the network to recover.

步骤2.1:若节点u在传播算法中调用本算法,或者某一时刻与网络断开连接,进入步骤2;Step 2.1: If node u calls this algorithm in the propagation algorithm or is disconnected from the network at a certain moment, enter step 2;

步骤2.2:通过仲裁系统查询区块链最新状态;Step 2.2: Query the latest status of the blockchain through the arbitration system;

步骤2.3:向由仲裁算法判断出来的最新正确节点同步,应用读取服务器获得数据,同步完成后重新开始执行算法。Step 2.3: Synchronize to the latest correct node determined by the arbitration algorithm, apply the read server to obtain the data, and restart the execution of the algorithm after the synchronization is completed.

步骤2.4:若同步失败,则进入步骤2.2。Step 2.4: If synchronization fails, go to step 2.2.

2、优选地,所述数据传播处理,具体步骤包括:2. Preferably, the specific steps of the data dissemination process include:

步骤3.0:在未启动共识时,边缘节点v上传病历至自己所属的主节点,Step 3.0: When consensus is not started, edge node v uploads medical records to its own master node.

步骤3.1:主节点u将v的病历以及其他主节点广播的病历保存在本地病历池中;Step 3.1: Master node u saves v’s medical records and the medical records broadcast by other master nodes in the local medical record pool;

步骤3.2:每当数据共识处理进行到步骤1.6时广播自己的输入值value(xi),value(xi)即数据共识处理步骤1.6中的value(x),此处用xi指代第i次进行到数据共识处理步骤1.6时的x;Step 3.2: Whenever the data consensus processing proceeds to step 1.6, broadcast its own input value value(xi), value(xi) is the value(x) in step 1.6 of the data consensus processing, and xi is used here to refer to the ith time. x when reaching data consensus processing step 1.6;

步骤3.3:第i次共识中选取t2为t到t+m时间内的病历用来计算默克尔树;Step 3.3: In the i-th consensus, t2 is selected as the medical record from t to t+m to calculate the Merkel tree;

步骤3.4:在i次共识完成后,将缓冲区中由自己范围内医院上传的病历打包,向输入值与系统共识值相同的节点请求是否已经被区块链确认的验证;Step 3.4: After i consensus is completed, package the medical records uploaded by hospitals within the buffer in the buffer, and request verification from the node whose input value is the same as the system consensus value to verify whether it has been confirmed by the blockchain;

步骤3.5:将缓冲区中由自己范围内医院上传的病历打包,向输入值与系统共识值相同的节点请求是否已经被区块链确认的验证;Step 3.5: Package the medical records uploaded by the hospitals within your own scope in the buffer, and request verification from the node whose input value is the same as the system consensus value whether it has been confirmed by the blockchain;

步骤3.6:被请求的节点通过默克尔树路径验证病历,并返回验证结果给请求节点,返回的结果为value(y),其中包含没有得到确认的病历;Step 3.6: The requested node verifies the medical record through the Merkel tree path and returns the verification result to the requesting node. The returned result is value(y), which contains unconfirmed medical records;

步骤3.7:在t到t+m阶段,若病历被设置保留标记,则放入value(y);若病历没有设置保留标志,则将病历删除;当value(y)不是空集时,结束算法。Step 3.7: In stages from t to t+m, if the medical record has a retention flag set, put value(y); if the medical record does not have a retention flag set, delete the medical record; when value(y) is not an empty set, end the algorithm. .

优选地,该电子病历存储方法,还包括可确认数据的完整性及准确的校验算法,所校验算法包括实时校验算法和周期校验算法。Preferably, the electronic medical record storage method also includes a verification algorithm that can confirm the integrity and accuracy of the data. The verification algorithm includes a real-time verification algorithm and a periodic verification algorithm.

3、优选地,所述实时校验算法,具体步骤包括:3. Preferably, the specific steps of the real-time verification algorithm include:

步骤5.1:数据验证模块接收到需要验证的病历哈希值Hash(M);Step 5.1: The data verification module receives the hash value Hash(M) of the medical record that needs to be verified;

步骤5.2:计算出需要证明Hash(M)所需要的节点proof(leaves);Step 5.2: Calculate the node proof(leaves) required to prove Hash(M);

步骤5.3:将Hash(M)和证明所需要的节点proof(leaves)一起输入proof算法中,proof算法在Merkle树中进行查找,返回验证的结果;Step 5.3: Enter the Hash (M) and the node proof (leaves) required for proof into the proof algorithm. The proof algorithm searches in the Merkle tree and returns the verification result;

步骤5.4:将验证的结果发送给请求验证的节点。Step 5.4: Send the verification results to the node requesting verification.

4、优选地,所述周期校验算法,指每隔一段时间进行本地区块链验证,每个服务器从自身维护的第一个区块开始验证,一直到验证到最新区块结束;具体步骤包括:4. Preferably, the periodic verification algorithm refers to local blockchain verification at regular intervals. Each server starts verification from the first block maintained by itself and continues to the latest block; specific steps include:

步骤6.1:p作为记录当前区块的标识符,并初始化为0;Step 6.1: p is used as the identifier to record the current block and is initialized to 0;

步骤6.2:从数据库中读出第p个区块的区块头,判断本地是否存储这个区块的具体数据;Step 6.2: Read the block header of the p-th block from the database and determine whether the specific data of this block is stored locally;

步骤6.3:如果存储了这个区块的具体数据则读取所有病历进行校验,如果没有存储具体数据则只校验区块头;Step 6.3: If the specific data of this block is stored, read all medical records for verification. If no specific data is stored, only the block header is verified;

步骤6.4:若校验成功则继续校验下一个区块,若校验失败则向其他备份节点请求区块P的数据,恢复区块P,校验成功后继续校验下一个区块。Step 6.4: If the verification is successful, continue to verify the next block. If the verification fails, request the data of block P from other backup nodes, restore block P, and continue to verify the next block after the verification is successful.

优选地该电子病历存储方法,还包括密钥恢复管理方法,具体方法步骤为:Preferably, the electronic medical record storage method also includes a key recovery management method. The specific method steps are:

步骤7.1:密钥生成后,采用Shamir门限秘密共享将密钥分片成k份分享;Step 7.1: After the key is generated, use Shamir threshold secret sharing to fragment the key into k shares;

步骤7.2:找回密码时,由n个分片持有者提供密钥即可恢复出密钥,其中,n≤k;Step 7.2: When retrieving the password, n shard holders can provide the key to recover the key, where n≤k;

步骤7.3:在授权后,密钥在一个就诊会话中保持活性,会话结束后密钥被销毁。基于区块链面向节点动态的分层电子病历存储装置,其特征在于:具体包括:Step 7.3: After authorization, the key remains active for a medical session and is destroyed at the end of the session. A hierarchical electronic medical record storage device based on blockchain for node dynamics, which is characterized by: specifically including:

第一单元,用于根据病人发送的调取请求,通过数据共识处理、数据同步处理、数据传播处理,读取相关数据;The first unit is used to read relevant data through data consensus processing, data synchronization processing, and data dissemination processing according to the retrieval request sent by the patient;

第二单元,用于根据病人发送的授权和密钥,将步骤一中读取的相关数据发送至对应科室医生;The second unit is used to send the relevant data read in step 1 to the doctor in the corresponding department based on the authorization and key sent by the patient;

第三单元,用于根据步骤二中的病人授权,允许医生对对应病历进行数据写入管理;The third unit is used to allow doctors to write data to the corresponding medical records based on the patient authorization in step two;

第四单元,用于将步骤三中医生对病历的管理操作反馈至数据池。The fourth unit is used to feed back the doctor's medical record management operations in step three to the data pool.

本发明提供的一种基于区块链面向节点动态的分层电子病历存储方法及装置,其可根据病人发送的调取请求,通过数据共识处理、数据同步处理、数据传播处理,读取相关数据;根据病人发送的授权和密钥,将前述读取的相关数据发送至对应科室医生;根据前述的病人授权,允许医生对对应病历进行数据写入管理;将前述医生对病历的管理操作反馈至数据池。最终可解决因为网络原因以及节点可能离线等原因,可能出现不存在大多数节点值相同的情况;采用PBFT算法无法达到共识,相对静态的PBFT算法难以应用在此场景的问题;另外,区块链虽然可以保证数据不被篡改,但是无法保证在取出数据的时候数据是否为正确的数据;在本地区块链的数据受到改动时,无法实时感知数据的修改,继而在读取时读取到被篡改的数据,无法依靠区块链的防篡改性实时发现改动等上述问题。The invention provides a node-dynamic hierarchical electronic medical record storage method and device based on blockchain, which can read relevant data through data consensus processing, data synchronization processing, and data dissemination processing according to the retrieval request sent by the patient. ; According to the authorization and key sent by the patient, the aforementioned read relevant data is sent to the corresponding department doctor; according to the aforementioned patient authorization, the doctor is allowed to write and manage the data of the corresponding medical record; the aforementioned doctor's management operation of the medical record is fed back to Data pool. It can ultimately solve the problem that due to network reasons and nodes that may be offline, there may be situations where most nodes have the same value; the PBFT algorithm cannot reach consensus, and the relatively static PBFT algorithm is difficult to apply in this scenario; in addition, blockchain Although it can be guaranteed that the data has not been tampered with, there is no guarantee that the data is correct when the data is taken out; when the data in the local blockchain is modified, the modification of the data cannot be sensed in real time, and then the modified data cannot be sensed when reading. For tampered data, it is impossible to rely on the tamper resistance of the blockchain to detect changes in real time and other problems mentioned above.

本发明采取分层的架构,将医院分为主要节点和边缘节点,主要节点存储具体数据,边缘节点存储区块头;通过这种方式降低参与系统的门槛,提高系统稳定性和数据验证的可信度。The present invention adopts a layered architecture and divides the hospital into main nodes and edge nodes. The main nodes store specific data and the edge nodes store block headers. In this way, the threshold for participating in the system is lowered and the system stability and the credibility of data verification are improved. Spend.

本发明设计了新的共识算法、同步算法和传播算法,在保证一致性的同时降低通讯成本,同时实现了PBFT等常用算法无法实现的“有效性”,即假设所有结点的初始值全都不相同,也可以达成共识值。This invention designs a new consensus algorithm, synchronization algorithm and propagation algorithm to reduce communication costs while ensuring consistency. At the same time, it achieves "effectiveness" that cannot be achieved by common algorithms such as PBFT, that is, it is assumed that the initial values of all nodes are not the same. Similarly, a consensus value can also be reached.

本发明针对区块链可以保证整体数据无法篡改但是无法保证读取到的数据是否是正确的问题,设计了两种验证机制,一种是实时验证,一种是周期验证,用来确认前者验证所读取的数据的完整性,后者检测自身数据库的完整性。This invention aims at the problem that the blockchain can ensure that the overall data cannot be tampered with but cannot guarantee whether the read data is correct. Two verification mechanisms are designed, one is real-time verification and the other is periodic verification, to confirm the former verification. The integrity of the data being read, which checks the integrity of its own database.

本发明设计了基于门限秘密共享的密钥方案,病人可以将密钥分成秘密份额,分发给自己的亲朋好友或者第三方机构;从而在一些意外紧急情况时,可以给出新的密钥保管或者恢复方案。The present invention designs a key scheme based on threshold secret sharing. Patients can divide the key into secret shares and distribute them to their relatives, friends or third-party organizations; thus in some unexpected emergencies, new keys can be kept or Recovery plan.

附图说明Description of drawings

图1为本发明基于区块链面向节点动态的分层电子病历存储方法流程示意图。Figure 1 is a schematic flow chart of the present invention's hierarchical electronic medical record storage method based on blockchain and oriented to node dynamics.

图2为本发明基于区块链面向节点动态的分层电子病历存储方法系统架构示意图。Figure 2 is a schematic diagram of the system architecture of the present invention's hierarchical electronic medical record storage method based on blockchain and oriented to node dynamics.

图3为本发明基于区块链面向节点动态的分层电子病历存储方法中共识算法流程图。Figure 3 is a flow chart of the consensus algorithm in the present invention's blockchain-based hierarchical electronic medical record storage method oriented to node dynamics.

具体实施方式Detailed ways

本发明实施例提供了一种基于区块链面向节点动态的分层电子病历存储方法及装置,用于解决了现有技术中PBFT算法存在不精准,区块链的信息精确度无法保证等技术问题,本发明提供的技术方案总体思路如下:Embodiments of the present invention provide a node-dynamic hierarchical electronic medical record storage method and device based on blockchain, which is used to solve the problem of inaccuracies in the PBFT algorithm in the existing technology and the inability to guarantee the information accuracy of the blockchain. Problem, the general idea of the technical solution provided by the present invention is as follows:

为了更好的理解上述技术方案,下面通过附图以及具体实施例对本说明书实施例的技术方案做详细的说明,应当理解本说明书实施例以及实施例中的具体特征是对本说明书实施例技术方案的详细的说明,而不是对本说明书技术方案的限定,在不冲突的情况下,本说明书实施例以及实施例中的技术特征可以相互组合。In order to better understand the above technical solutions, the technical solutions of the embodiments of this specification will be described in detail below through the accompanying drawings and specific examples. It should be understood that the embodiments of this specification and the specific features in the examples are the technical solutions of the embodiments of this specification. The detailed description is not intended to limit the technical solutions of this specification. The embodiments of this specification and the technical features in the embodiments can be combined with each other if there is no conflict.

实施例一:Example 1:

图1为本发明实施例中一种基于区块链面向节点动态的分层电子病历存储方法的流程示意图。如图1所示,该方法包括:Figure 1 is a schematic flow chart of a blockchain-based hierarchical electronic medical record storage method oriented to node dynamics in an embodiment of the present invention. As shown in Figure 1, the method includes:

步骤一:根据病人发送的调取请求,通过数据共识处理、数据同步处理、数据传播处理,读取相关数据;Step 1: According to the retrieval request sent by the patient, read relevant data through data consensus processing, data synchronization processing, and data dissemination processing;

步骤二:根据病人发送的授权和密钥,将步骤一中读取的相关数据发送至对应科室医生;Step 2: Based on the authorization and key sent by the patient, send the relevant data read in step 1 to the doctor in the corresponding department;

步骤三:根据步骤二中的病人授权,允许医生对对应病历进行数据写入管理;Step 3: Based on the patient authorization in Step 2, allow doctors to write and manage data on the corresponding medical records;

步骤四:将步骤三中医生对病历的管理操作反馈至数据池。Step 4: Feed back the doctor’s medical record management operations in Step 3 to the data pool.

区块链分层方案:将拥有足够算力和更高可信度的大型医院设置为主要节点,将算力不足以及可能经常离线和上线的私人医院、卫生所节点设置为边缘节点。边缘节点只存储区块头,而主要节点存储完整数据。Blockchain layering scheme: Set large hospitals with sufficient computing power and higher credibility as main nodes, and set private hospitals and health clinic nodes with insufficient computing power and which may often go offline and online as edge nodes. Edge nodes only store block headers, while primary nodes store the complete data.

图3为所述数据共识处理的流程图,具体步骤包括:Figure 3 is a flow chart of the data consensus processing. The specific steps include:

步骤0:所有主要节点将接收到的病历写上时间戳,并转变为准备广播的状态;Step 0: All major nodes write timestamps on the received medical records and transition to a state ready for broadcast;

步骤1:若本节点为主要节点,x=节点在t到t+m时间段内根据接收到的病历信息所计算的默克尔树;若本节点为边缘节点,x置空;Step 1: If this node is the main node, x = Merkel tree calculated by the node based on the received medical record information in the time period from t to t+m; if this node is an edge node, x is left blank;

步骤2:order节点向所有主要节点发送消息,通知其打包t到t+m时间段内的病历;Step 2: The order node sends a message to all major nodes, notifying them to package the medical records from t to t+m;

步骤3:阶段个数小于f+1,继续步骤4;否则,算法结束;Step 3: The number of stages is less than f+1, continue to step 4; otherwise, the algorithm ends;

步骤4:本节点广播自己的输入值value(x),并转变为准备接收提议的状态;Step 4: This node broadcasts its own input value value(x) and changes to a state ready to receive proposals;

步骤5:若本节点接收到其他节点广播的value(y)次数至少n-f次,则本节点广播propose(y);Step 5: If this node receives value(y) broadcast by other nodes at least n-f times, then this node broadcasts propose(y);

步骤6:若本节点接收到propose(z)至少f次,则本节点修改x为z;Step 6: If this node receives proposal(z) at least f times, then this node modifies x to z;

步骤7:RSA随机数生成器生成第i阶段的主节点vi,且每阶段主节点不重复;Step 7: The RSA random number generator generates the master node vi of the i-th stage, and the master node does not repeat in each stage;

步骤8:主节点vi广播其值value(w);Step 8: The master node vi broadcasts its value value(w);

步骤9:若本节点接收到propose(x)的次数严格少于n-f,则本节点修改x为w;Step 9: If the number of times this node receives propose(x) is strictly less than n-f, then this node modifies x to w;

步骤10:阶段个数加1,返回步骤3。Step 10: Add 1 to the number of stages and return to step 3.

所述数据同步处理,具体步骤包括:The specific steps of data synchronization include:

步骤0:若节点u在传播算法中调用本算法,或者某一时刻与网络断开连接,进入步骤1;Step 0: If node u calls this algorithm in the propagation algorithm or is disconnected from the network at a certain moment, enter step 1;

步骤1:如果是与网络断开连接,停止广播病历区块,新增病历保留在本地,系统在网络分区中继续运行,等待网络恢复,否则直接进入步骤2;Step 1: If it is disconnected from the network, stop broadcasting the medical record block, keep the newly added medical records locally, and the system continues to run in the network partition, waiting for the network to recover, otherwise go to step 2 directly;

步骤2:通过仲裁系统查询区块链最新状态;Step 2: Query the latest status of the blockchain through the arbitration system;

步骤3:向由仲裁算法判断出来的最新正确节点同步,应用读取服务器获得数据,若同步失败,则进入步骤2;Step 3: Synchronize to the latest correct node determined by the arbitration algorithm, and apply the read server to obtain the data. If the synchronization fails, enter step 2;

步骤4:同步完成后重新开始执行算法。Step 4: Restart the algorithm after synchronization is completed.

所述数据传播处理,具体步骤包括:The specific steps of the data dissemination processing include:

步骤0:在未启动共识时,边缘节点v上传病历至自己所属的主节点,主节点u将v的病历以及其他主节点广播的病历保存在本地病历池中;Step 0: When consensus is not started, edge node v uploads medical records to its master node, and master node u saves v's medical records and the medical records broadcast by other master nodes in the local medical record pool;

步骤1:进行到算法步骤2时广播value(xi);Step 1: Broadcast value(xi) when proceeding to step 2 of the algorithm;

步骤2:i次共识中选取t2为t到t+m时间内的病历用来计算默克尔树,在i次共识完成后;Step 2: In the i-time consensus, t2 is selected as the medical record from t to t+m to calculate the Merkel tree. After the i-time consensus is completed;

步骤3:将缓冲区中由自己范围内医院上传的病历打包,向输入值与系统共识值相同的节点请求是否已经被区块链确认的验证;Step 3: Package the medical records uploaded by hospitals within your own scope in the buffer, and request verification from the node whose input value is the same as the system consensus value whether it has been confirmed by the blockchain;

步骤4:被请求的节点通过默克尔树路径验证病历,并返回验证结果给请求节点,返回的结果为value(y),其中包含没有得到确认的病历;Step 4: The requested node verifies the medical record through the Merkel tree path and returns the verification result to the requesting node. The returned result is value(y), which contains unconfirmed medical records;

该电子病历存储方法,还包括可确认数据的完整性及准确的校验算法,所校验算法包括实时校验算法和周期校验算法。The electronic medical record storage method also includes a verification algorithm that can confirm the integrity and accuracy of the data. The verification algorithm includes a real-time verification algorithm and a periodic verification algorithm.

其中,实时校验算法中,数据验证模块实现对某个病历的验证,返回验证的结果。数据验证模块的原理是利用Merkle树的特点,根据Merkle树快速查询某个节点是否在树中,由此判断病历是否是正确的病历。Merkle树可以提供快速的数据验证方法,速度远高于对所有数据进行遍历和查找验证。数据验证的具体的操作过程如下:Among them, in the real-time verification algorithm, the data verification module verifies a certain medical record and returns the verification results. The principle of the data verification module is to use the characteristics of the Merkle tree to quickly query whether a node is in the tree based on the Merkle tree, thereby determining whether the medical record is the correct medical record. Merkle trees can provide a fast data verification method, which is much faster than traversing and searching for all data. The specific operation process of data verification is as follows:

步骤1:数据验证模块接收到需要验证的病历哈希值Hash(M);Step 1: The data verification module receives the hash value Hash(M) of the medical record that needs to be verified;

步骤2:计算出需要证明Hash(M)所需要的节点proof(leaves);Step 2: Calculate the node proof(leaves) required to prove Hash(M);

步骤3:将Hash(M)和证明所需要的节点proof(leaves)一起输入proof算法中,proof算法在Merkle树中进行查找,返回验证的结果;Step 3: Enter the Hash (M) and the node proof (leaves) required for proof into the proof algorithm. The proof algorithm searches in the Merkle tree and returns the verification result;

步骤4:将验证的结果发送给请求验证的节点。Step 4: Send the verification results to the node requesting verification.

周期校验方法,系统每隔一段时间进行本地区块链验证,确保本地服务器维护数据的完整性。每个服务器从自身维护的第一个区块开始验证,一直到验证到最新区块结束。周期性验证的具体过程如下:Periodic verification method, the system performs local blockchain verification at regular intervals to ensure that the local server maintains data integrity. Each server starts verification from the first block maintained by itself and continues until the latest block is verified. The specific process of periodic verification is as follows:

步骤1:p作为记录当前区块的标识符,并初始化为0;Step 1: p is used as the identifier to record the current block and is initialized to 0;

步骤2:从数据库中读出第p个区块的区块头,判断本地是否存储这个区块的具体数据;Step 2: Read the block header of the p-th block from the database and determine whether the specific data of this block is stored locally;

步骤3:如果存储了这个区块的具体数据则读取所有病历进行校验。如果没有存储具体数据则只校验区块头;Step 3: If the specific data of this block is stored, read all medical records for verification. If no specific data is stored, only the block header is verified;

步骤4:若校验成功则继续校验下一个区块,若校验失败则向其他备份节点请求区块P的数据,恢复区块P,校验成功后继续校验下一个区块。Step 4: If the verification is successful, continue to verify the next block. If the verification fails, request the data of block P from other backup nodes, restore block P, and continue to verify the next block after the verification is successful.

该电子病历存储方法,还包括密钥恢复管理方法,病人在生成密钥后采用Shamir门限秘密共享将密钥分片成m份并分享给自己信任的亲朋好友或者参与系统的可信第三方机构,在找回密码时由n(n≤m)个分片持有者提供密钥即可恢复出密钥。在进行就诊并对医生授权后,密钥将被医疗机构获取,在一个就诊会话中保持活性,会话结束后密钥被销毁。考虑到密钥在医疗机构的服务器中存在泄露的可能,对此可以采取密钥更新的办法,每隔一定时间系统提醒用户更新密钥。用户也可以选择自主更新密钥,这样可以避免未来的医疗记录泄露的问题。密钥在经过用户口令加密后上传至密钥池,由于服务器中只存储有口令的MD5值,即使攻击者从服务器的密钥池中获取密钥也无法解密密钥,避免信息的泄露。The electronic medical record storage method also includes a key recovery management method. After the patient generates the key, he uses Shamir threshold secret sharing to fragment the key into m parts and share it with his trusted relatives and friends or a trusted third party institution participating in the system. , when retrieving the password, n (n ≤ m) shard holders can provide the key to recover the key. After a visit is made and the doctor is authorized, the key will be obtained by the medical institution, remain active during a visit session, and be destroyed after the session ends. Considering that the key may be leaked in the server of the medical institution, a key update method can be adopted, and the system reminds the user to update the key at regular intervals. Users can also choose to update their keys on their own, which can avoid future leaks of medical records. The key is uploaded to the key pool after being encrypted by the user's password. Since only the MD5 value of the password is stored in the server, even if the attacker obtains the key from the server's key pool, he cannot decrypt the key to avoid information leakage.

本发明提供的一种基于区块链面向节点动态的分层电子病历存储方法及装置,其可根据病人发送的调取请求,通过数据共识处理、数据同步处理、数据传播处理,读取相关数据;根据病人发送的授权和密钥,将前述读取的相关数据发送至对应科室医生;根据前述的病人授权,允许医生对对应病历进行数据写入管理;将前述医生对病历的管理操作反馈至数据池。最终在即使存在网络原因以及节点可能离线等因素的情况下,依然可以保证数据读取的精准性;通过两种验证机制,保证了数据读取的实时正确性,以及节点本地数据库的完整性,可保证区块链中的数据不被篡改,且即使被改动也会有迹可循,留下篡改证据;另外,对于密钥的设置,病人可以将密钥分成秘密份额,分发给自己的亲朋好友或者第三方机构,以备意外情况发生时的备案启动。The invention provides a node-dynamic hierarchical electronic medical record storage method and device based on blockchain, which can read relevant data through data consensus processing, data synchronization processing, and data dissemination processing according to the retrieval request sent by the patient. ; According to the authorization and key sent by the patient, the aforementioned read relevant data is sent to the corresponding department doctor; according to the aforementioned patient authorization, the doctor is allowed to write and manage the data of the corresponding medical record; the aforementioned doctor's management operation of the medical record is fed back to Data pool. In the end, even if there are network reasons and the node may be offline, the accuracy of data reading can still be guaranteed; through two verification mechanisms, the real-time correctness of data reading and the integrity of the node's local database are guaranteed. It can ensure that the data in the blockchain will not be tampered with, and even if it is changed, it will be traceable and leave evidence of tampering; in addition, for the setting of the key, the patient can divide the key into secret shares and distribute them to his relatives and friends. Friends or third-party organizations to prepare for the activation of registration when unexpected circumstances occur.

对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节,而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实现本发明。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化囊括在本发明内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。It is obvious to those skilled in the art that the present invention is not limited to the details of the above-described exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention. Therefore, the embodiments should be regarded as illustrative and non-restrictive from any point of view, and the scope of the present invention is defined by the appended claims rather than the above description, and it is therefore intended that all claims falling within the claims All changes within the meaning and scope of equivalent elements are included in the present invention. Any reference signs in the claims shall not be construed as limiting the claim in question.

此外,应当理解,虽然本说明书按照实施方式加以描述,但并非每个实施方式仅包含一个独立的技术方案,说明书的这种叙述方式仅仅是为清楚起见,本领域技术人员应当将说明书作为一个整体,各实施例中的技术方案也可以经适当组合,形成本领域技术人员可以理解的其他实施方式。In addition, it should be understood that although this specification is described in terms of implementations, not each implementation only contains an independent technical solution. This description of the specification is only for the sake of clarity, and those skilled in the art should take the specification as a whole. , the technical solutions in each embodiment can also be appropriately combined to form other implementations that can be understood by those skilled in the art.

Claims (9)

1.基于区块链面向节点动态的分层电子病历存储方法,其特征在于:所述方法具体步骤包括:1. A hierarchical electronic medical record storage method oriented to node dynamics based on blockchain, which is characterized in that: the specific steps of the method include: 步骤一:根据病人发送的调取请求,通过数据共识处理、数据同步处理、数据传播处理,读取相关数据;Step 1: According to the retrieval request sent by the patient, read relevant data through data consensus processing, data synchronization processing, and data dissemination processing; 步骤二:根据病人发送的授权和密钥,将步骤一中读取的相关数据发送至对应科室医生;Step 2: Based on the authorization and key sent by the patient, send the relevant data read in step 1 to the doctor in the corresponding department; 步骤三:根据步骤二中的病人授权,允许医生对对应病历进行数据写入管理;Step 3: Based on the patient authorization in Step 2, allow doctors to write and manage data on the corresponding medical records; 步骤四:将步骤三中医生对病历的管理操作反馈至数据池;Step 4: Feed back the doctor’s medical record management operations in Step 3 to the data pool; 区块链分层方案:将拥有足够算力和更高可信度的大型医院设置为主要节点,将算力不足以及可能经常离线和上线的私人医院、卫生所节点设置为边缘节点,边缘节点只存储区块头,而主要节点存储完整数据;Blockchain layering scheme: Set large hospitals with sufficient computing power and higher credibility as main nodes, and set private hospitals and health clinic nodes with insufficient computing power and which may often go offline and online as edge nodes. Edge nodes Only the block header is stored, while the main node stores the complete data; 所述数据共识处理,具体步骤包括:The specific steps of the data consensus processing include: 步骤1.0:所有主要节点将接收到的病历写上时间戳,并转变为准备广播的状态;Step 1.0: All major nodes write timestamps on the received medical records and transition to a state ready for broadcast; 步骤1.1:若本节点为主要节点,x=节点在t到t+m时间段内根据接收到的病历信息所计算的默克尔树;Step 1.1: If this node is the main node, x = Merkel tree calculated by the node based on the medical record information received in the time period from t to t+m; 步骤1.2:若本节点为边缘节点,x置空;Step 1.2: If this node is an edge node, leave x blank; 步骤:1.3:order节点向所有主要节点发送消息,通知其打包t到t+m时间段内的病历;Step: 1.3: The order node sends a message to all major nodes, notifying them to package the medical records within the time period from t to t+m; 步骤1.4:阶段个数小于f+1,继续步骤1.6;Step 1.4: The number of stages is less than f+1, continue to step 1.6; 步骤1.5:算法结束;Step 1.5: The algorithm ends; 步骤1.6:本节点广播自己的输入值value(x),并转变为准备接收提议的状态;Step 1.6: This node broadcasts its own input value value(x) and changes to a state ready to receive proposals; 步骤1.7:若本节点接收到其他节点广播的value(y)次数至少n-f次,则本节点广播propose(y);Step 1.7: If this node receives value(y) broadcast by other nodes at least n-f times, then this node broadcasts propose(y); 步骤1.8:若本节点接收到propose(z)至少f次,则本节点修改x为z;Step 1.8: If this node receives proposal(z) at least f times, then this node modifies x to z; 步骤1.9:RSA随机数生成器生成第i阶段的主节点vi,且每阶段主节点不重复;Step 1.9: The RSA random number generator generates the master node vi of the i-th stage, and the master node does not repeat in each stage; 步骤1.10:主节点vi广播其值value(w);Step 1.10: The master node vi broadcasts its value value(w); 步骤1.11:若本节点接收到propose(x)的次数严格少于n-f,则本节点修改x为w;Step 1.11: If the number of times this node receives propose(x) is strictly less than n-f, then this node modifies x to w; 步骤1.12:阶段个数加1,返回步骤1.4。Step 1.12: Add 1 to the number of stages and return to step 1.4. 2.根据权利要求1所述的基于区块链面向节点动态的分层电子病历存储方法,其特征在于:所述数据同步处理,具体步骤包括:2. The hierarchical electronic medical record storage method for node dynamics based on blockchain according to claim 1, characterized in that: the data synchronization processing, the specific steps include: 步骤2.0:若节点u是与网络断开连接时调用本算法,停止广播病历区块,新增病历保留在本地,系统在网络分区中继续运行,等待网络恢复;Step 2.0: If node u calls this algorithm when it is disconnected from the network, it stops broadcasting the medical record block, the newly added medical records are kept locally, and the system continues to run in the network partition, waiting for the network to recover; 步骤2.1:若节点u在传播算法中调用本算法,或者某一时刻与网络断开连接,进入步骤2;Step 2.1: If node u calls this algorithm in the propagation algorithm or is disconnected from the network at a certain moment, enter step 2; 步骤2.2:通过仲裁系统查询区块链最新状态;Step 2.2: Query the latest status of the blockchain through the arbitration system; 步骤2.3:向由仲裁算法判断出来的最新正确节点同步,应用读取服务器获得数据,同步完成后重新开始执行算法;Step 2.3: Synchronize to the latest correct node determined by the arbitration algorithm, apply the read server to obtain the data, and restart the execution of the algorithm after the synchronization is completed; 步骤2.4:若同步失败,则进入步骤2.2。Step 2.4: If synchronization fails, go to step 2.2. 3.根据权利要求1所述的基于区块链面向节点动态的分层电子病历存储方法,其特征在于:所述数据传播处理,具体步骤包括:3. The hierarchical electronic medical record storage method for node dynamics based on blockchain according to claim 1, characterized in that: the data dissemination processing, the specific steps include: 步骤3.0:在未启动共识时,边缘节点v上传病历至自己所属的主节点,Step 3.0: When consensus is not started, edge node v uploads medical records to its own master node. 步骤3.1:主节点u将v的病历以及其他主节点广播的病历保存在本地病历池中;Step 3.1: Master node u saves v’s medical records and the medical records broadcast by other master nodes in the local medical record pool; 步骤3.2:每当数据共识处理进行到步骤1.6时广播自己的输入值value(xi), value(xi)即数据共识处理步骤1.6中的value(x),此处用xi指代第i次进行到数据共识处理步骤1.6时的x;Step 3.2: Whenever the data consensus processing proceeds to step 1.6, broadcast its own input value value(xi), value(xi) is the value(x) in the data consensus processing step 1.6, here xi refers to the i-th time x when reaching data consensus processing step 1.6; 步骤3.3:第i次共识中选取t2为t到t+m时间内的病历用来计算默克尔树;Step 3.3: In the i-th consensus, t2 is selected as the medical record from t to t+m to calculate the Merkel tree; 步骤3.4:在i次共识完成后,将缓冲区中由自己范围内医院上传的病历打包,向输入值与系统共识值相同的节点请求是否已经被区块链确认的验证;Step 3.4: After i consensus is completed, package the medical records uploaded by hospitals within the buffer in the buffer, and request verification from the node whose input value is the same as the system consensus value to verify whether it has been confirmed by the blockchain; 步骤3.5:将缓冲区中由自己范围内医院上传的病历打包,向输入值与系统共识值相同的节点请求是否已经被区块链确认的验证;Step 3.5: Package the medical records uploaded by the hospitals within your own scope in the buffer, and request verification from the node whose input value is the same as the system consensus value whether it has been confirmed by the blockchain; 步骤3.6:被请求的节点通过默克尔树路径验证病历,并返回验证结果给请求节点,返回的结果为value(y) ,其中包含没有得到确认的病历;Step 3.6: The requested node verifies the medical record through the Merkle tree path and returns the verification result to the requesting node. The returned result is value(y), which contains unconfirmed medical records; 步骤3.7:在t到t+m阶段,若病历被设置保留标记,则放入value(y);若病历没有设置保留标志,则将病历删除;当value(y)不是空集时,结束算法。Step 3.7: In stages from t to t+m, if the medical record has a retention flag set, put value(y); if the medical record does not have a retention flag set, delete the medical record; when value(y) is not an empty set, end the algorithm. . 4.根据权利要求1所述的基于区块链面向节点动态的分层电子病历存储方法,其特征在于:该电子病历存储方法,还包括可确认数据的完整性及准确的校验算法,所校验算法包括实时校验算法和周期校验算法。4. The hierarchical electronic medical record storage method based on blockchain and oriented to node dynamics according to claim 1, characterized in that: the electronic medical record storage method also includes a verification algorithm that can confirm the integrity and accuracy of the data, so The verification algorithm includes real-time verification algorithm and periodic verification algorithm. 5.根据权利要求4所述的基于区块链面向节点动态的分层电子病历存储方法,其特征在于:所述实时校验算法,具体步骤包括:5. The hierarchical electronic medical record storage method for node dynamics based on blockchain according to claim 4, characterized in that: the real-time verification algorithm, the specific steps include: 步骤5.1:数据验证模块接收到需要验证的病历哈希值Hash(M);Step 5.1: The data verification module receives the hash value Hash(M) of the medical record that needs to be verified; 步骤5.2:计算出需要证明Hash(M)所需要的节点proof(leaves);Step 5.2: Calculate the node proof(leaves) required to prove Hash(M); 步骤5.3:将Hash(M)和证明所需要的节点proof(leaves)一起输入proof算法中,proof算法在Merkle树中进行查找,返回验证的结果;Step 5.3: Enter the Hash (M) and the node proof (leaves) required for proof into the proof algorithm. The proof algorithm searches in the Merkle tree and returns the verification result; 步骤5.4:将验证的结果发送给请求验证的节点。Step 5.4: Send the verification results to the node requesting verification. 6.根据权利要求4所述的基于区块链面向节点动态的分层电子病历存储方法,其特征在于:所述周期校验算法,指每隔一段时间进行本地区块链验证,每个服务器从自身维护的第一个区块开始验证,一直到验证到最新区块结束;具体步骤包括:6. The hierarchical electronic medical record storage method based on blockchain for node dynamics according to claim 4, characterized in that: the periodic verification algorithm refers to local blockchain verification at intervals, and each server Verification starts from the first block maintained by itself and continues until the latest block is verified; the specific steps include: 步骤6.1:p作为记录当前区块的标识符,并初始化为0;Step 6.1: p is used as the identifier to record the current block and is initialized to 0; 步骤6.2:从数据库中读出第p个区块的区块头,判断本地是否存储这个区块的具体数据;Step 6.2: Read the block header of the p-th block from the database and determine whether the specific data of this block is stored locally; 步骤6.3:如果存储了这个区块的具体数据则读取所有病历进行校验,如果没有存储具体数据则只校验区块头;Step 6.3: If the specific data of this block is stored, read all medical records for verification. If no specific data is stored, only the block header is verified; 步骤6.4:若校验成功则继续校验下一个区块,若校验失败则向其他备份节点请求区块P的数据,恢复区块P,校验成功后继续校验下一个区块。Step 6.4: If the verification is successful, continue to verify the next block. If the verification fails, request the data of block P from other backup nodes, restore block P, and continue to verify the next block after the verification is successful. 7.根据权利要求1所述的基于区块链面向节点动态的分层电子病历存储方法,其特征在于:该电子病历存储方法,还包括密钥恢复管理方法,具体方法步骤为:7. The hierarchical electronic medical record storage method based on blockchain and oriented to node dynamics according to claim 1, characterized in that: the electronic medical record storage method also includes a key recovery management method, and the specific method steps are: 步骤7.1:密钥生成后,采用Shamir门限秘密共享将密钥分片成k份分享,Step 7.1: After the key is generated, use Shamir threshold secret sharing to fragment the key into k shares. 步骤7.2:找回密码时,由n个分片持有者提供密钥即可恢复出密钥,其中,n≤k;Step 7.2: When retrieving the password, n shard holders can provide the key to recover the key, where n≤k; 步骤7.3:在授权后,密钥在一个就诊会话中保持活性,会话结束后密钥被销毁。Step 7.3: After authorization, the key remains active for a medical session and is destroyed at the end of the session. 8.基于区块链面向节点动态的分层电子病历存储装置,实现权利要求1-7任一项所述方法的步骤,其特征在于,具体步骤如下:8. Based on the hierarchical electronic medical record storage device oriented to node dynamics based on blockchain, the steps of implementing the method described in any one of claims 1 to 7 are characterized in that the specific steps are as follows: 第一单元,用于根据病人发送的调取请求,通过数据共识处理、数据同步处理、数据传播处理,读取相关数据;The first unit is used to read relevant data through data consensus processing, data synchronization processing, and data dissemination processing according to the retrieval request sent by the patient; 第二单元,用于根据病人发送的授权和密钥,将步骤一中读取的相关数据发送至对应科室医生;The second unit is used to send the relevant data read in step 1 to the doctor in the corresponding department based on the authorization and key sent by the patient; 第三单元,用于根据步骤二中的病人授权,允许医生对对应病历进行数据写入管理;The third unit is used to allow doctors to write data to the corresponding medical records based on the patient authorization in step two; 第四单元,用于将步骤三中医生对病历的管理操作反馈至数据池。The fourth unit is used to feed back the doctor's medical record management operations in step three to the data pool. 9.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现权利要求1-7任一项所述方法的步骤。9. A computer-readable storage medium with a computer program stored thereon, characterized in that when the program is executed by a processor, the steps of the method described in any one of claims 1-7 are implemented.
CN202010344869.3A 2020-04-27 2020-04-27 Hierarchical electronic medical record storage method and device based on block chain oriented node dynamics Active CN111599425B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010344869.3A CN111599425B (en) 2020-04-27 2020-04-27 Hierarchical electronic medical record storage method and device based on block chain oriented node dynamics

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010344869.3A CN111599425B (en) 2020-04-27 2020-04-27 Hierarchical electronic medical record storage method and device based on block chain oriented node dynamics

Publications (2)

Publication Number Publication Date
CN111599425A CN111599425A (en) 2020-08-28
CN111599425B true CN111599425B (en) 2023-12-05

Family

ID=72192077

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010344869.3A Active CN111599425B (en) 2020-04-27 2020-04-27 Hierarchical electronic medical record storage method and device based on block chain oriented node dynamics

Country Status (1)

Country Link
CN (1) CN111599425B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112037873B (en) * 2020-08-31 2022-09-13 合肥工业大学 A single-point optimization method based on cluster master selection and consensus mechanism
CN113965572B (en) * 2021-11-02 2024-05-14 上海佰贝网络工程技术有限公司 A block distribution method, system, computer device and computer readable storage medium of blockchain

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3534287A1 (en) * 2018-02-28 2019-09-04 Siemens Healthcare GmbH Inserting a further data block into a first ledger
CN110289060A (en) * 2019-06-20 2019-09-27 福州数据技术研究院有限公司 A kind of personal medical data storage method under the chain based on random Merkle tree
CN110299195A (en) * 2019-06-11 2019-10-01 中国矿业大学 The electronic health record shared system and application method with secret protection based on alliance's chain
CN110634544A (en) * 2019-09-19 2019-12-31 腾讯科技(深圳)有限公司 Blockchain-based medical record data processing method, device, storage medium and equipment
CN110851867A (en) * 2019-11-12 2020-02-28 北京芯际科技有限公司 Medical data sharing method based on block chain
CN110910977A (en) * 2019-11-12 2020-03-24 南京工业大学 A secure storage method of medical data incorporating blockchain technology

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11227675B2 (en) * 2016-08-23 2022-01-18 BBM Health LLC Blockchain-based mechanisms for secure health information resource exchange
US11488713B2 (en) * 2017-08-15 2022-11-01 Computer Technology Associates, Inc. Disease specific ontology-guided rule engine and machine learning for enhanced critical care decision support
US20190147137A1 (en) * 2017-11-14 2019-05-16 Robert Gergely System, Method, and Apparatus for Universally Accessible Personal Medical Records

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3534287A1 (en) * 2018-02-28 2019-09-04 Siemens Healthcare GmbH Inserting a further data block into a first ledger
CN110299195A (en) * 2019-06-11 2019-10-01 中国矿业大学 The electronic health record shared system and application method with secret protection based on alliance's chain
CN110289060A (en) * 2019-06-20 2019-09-27 福州数据技术研究院有限公司 A kind of personal medical data storage method under the chain based on random Merkle tree
CN110634544A (en) * 2019-09-19 2019-12-31 腾讯科技(深圳)有限公司 Blockchain-based medical record data processing method, device, storage medium and equipment
CN110851867A (en) * 2019-11-12 2020-02-28 北京芯际科技有限公司 Medical data sharing method based on block chain
CN110910977A (en) * 2019-11-12 2020-03-24 南京工业大学 A secure storage method of medical data incorporating blockchain technology

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
"A Design of Blockchain-Based Architecture for the Security of Electronic Health Record (EHR) Systems";G.Yang等;《2018 IEEE International Conference on Cloud Computing Technology and Science (CloudCom)》;IEEE;20181227;第2018年卷;第261–265页 *
"Multi-tier Blockchain Framework for IoT-EHRs Systems";Shaimaa Badr等;《Procedia Computer Science》;20181231;第141卷;第159-166页 *
"基于区块链的电子健康病历系统性能与安全性研究";杨俊;《中国优秀硕士学位论文全文数据库医药卫生科技辑》;20200215;第2020年卷(第02期);第E053-189页 *
基于区块链网络的医疗记录安全储存访问方案;徐健等;《计算机应用》;20190131;第39卷(第05期);第260-266页 *
第73-75页."密钥管理技术".《计算机网络安全导论》.东南大学出版社,2007,(第2版),第73-75页. *

Also Published As

Publication number Publication date
CN111599425A (en) 2020-08-28

Similar Documents

Publication Publication Date Title
TWI714179B (en) Use public side chains to verify the integrity of data stored in the alliance blockchain
CN112910840B (en) A method and system for medical data storage and sharing based on consortium blockchain
TWI720727B (en) Computer-implemented method for managing sensitive data elements that are stored in a blockchain network, apparatus and system for managing sensitive data elements stored in a blockchain network
CN110797099B (en) A method and system for sharing medical data based on blockchain
TWI729880B (en) Shared blockchain data storage based on error correction coding in trusted execution environments
US11171774B2 (en) System for synchronizing a cryptographic key state through a blockchain
WO2018214858A1 (en) Block chain-based data processing method and device
TWI720918B (en) Consenus of shared blockchain data storage based on error correction code
EP3917113A1 (en) Establishment of consortium blockchain network
Pang et al. Electronic health records sharing model based on blockchain with checkable state PBFT consensus algorithm
CN110910977A (en) A secure storage method of medical data incorporating blockchain technology
Yanovich et al. Exonum: Byzantine fault tolerant protocol for blockchains
TW202121226A (en) Asynchronous processing of blockchain blocks
CN110599357A (en) Insurance business data processing method and device based on block chain and storage medium
CN111599425B (en) Hierarchical electronic medical record storage method and device based on block chain oriented node dynamics
CN110771093A (en) Method and system for proving existence of digital document and label chain block chain system
Donawa et al. Scaling blockchains to support electronic health records for hospital systems
TW202119210A (en) Data security of shared blockchain data storage based on error correction code
CN110635913A (en) Electronic prescription verification method and device
CN113764060B (en) A medical data management system and patient-authorized medical record sharing method based on dual blockchains
US11063748B2 (en) Synchronizing content
CN111916217A (en) Blockchain-based medical data management method, system, storage medium and terminal
US20190286614A1 (en) Synchronizing content
CN110750541A (en) Data storage indexing system and method based on block chain
Walid et al. Leveraging semantic context to establish access controls for secure cloud-based electronic health records

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant