+

CN110197708A - A kind of migration of block chain and storage method towards electron medical treatment case history - Google Patents

A kind of migration of block chain and storage method towards electron medical treatment case history Download PDF

Info

Publication number
CN110197708A
CN110197708A CN201910486535.7A CN201910486535A CN110197708A CN 110197708 A CN110197708 A CN 110197708A CN 201910486535 A CN201910486535 A CN 201910486535A CN 110197708 A CN110197708 A CN 110197708A
Authority
CN
China
Prior art keywords
data
blockchain
information
medical record
transaction
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.)
Granted
Application number
CN201910486535.7A
Other languages
Chinese (zh)
Other versions
CN110197708B (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.)
Lvliang Botong Network Electronic Technology Co.,Ltd.
Original Assignee
Chongqing University of Post and Telecommunications
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 Chongqing University of Post and Telecommunications filed Critical Chongqing University of Post and Telecommunications
Priority to CN201910486535.7A priority Critical patent/CN110197708B/en
Publication of CN110197708A publication Critical patent/CN110197708A/en
Application granted granted Critical
Publication of CN110197708B publication Critical patent/CN110197708B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/81Indexing, e.g. XML tags; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Epidemiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Primary Health Care (AREA)
  • Public Health (AREA)
  • Computing Systems (AREA)
  • Medical Treatment And Welfare Office Work (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention relates to a kind of migration of block chain and storage method towards electron medical treatment case history, belong to block chain technical field, this method provides a kind of solution of old Data Migration to new block chain network, it can be achieved that from traditional database to the migration and mapping of block chain data in traditional medical electronic health record database (relevant database) and the medical electronics case history block catenary system (non-relational database) that newly constructs.It is the distributed data base system centered on sufferer by the centralized data base system transform centered on hospital-department by carrying out the construction of multiway tree data model to traditional medical database.One aspect of the present invention ensure that integrality and robustness of the data in new and old database migration.On the other hand, it ensure that by the construction to model tree and efficient duration data migration may be implemented.

Description

一种面向电子医疗病历的区块链迁移与存储方法A blockchain migration and storage method for electronic medical records

技术领域technical field

本发明属于区块链技术领域,涉及一种面向电子医疗病历的区块链迁移与存储方法。The invention belongs to the technical field of blockchain, and relates to a blockchain migration and storage method for electronic medical records.

背景技术Background technique

区块链最早可追溯于1991年,由Haber和Bayeret提出了在分布式系统里采用加密的哈希函数和默克尔树,用时间戳高效、安全的记录数据,并将加密的数据区块连接成链。直至2008年,中本聪发表了一篇《比特币:一种点对点的电子现金系统》,宣布了第一代区块链技术的诞生与大规模应用。此后的区块链技术则是将分布式数据存储、点对点传输、共识机制和加密算法等技术从比特币中提炼出来,配合自动化脚本代码所组成的智能合约来进行编程和业务处理的一种分布式存储账本体系。The blockchain can be traced back to 1991. Haber and Bayeret proposed to use encrypted hash functions and Merkle trees in distributed systems to efficiently and securely record data with timestamps, and to block encrypted data. connected in a chain. Until 2008, Satoshi Nakamoto published an article "Bitcoin: A Peer-to-Peer Electronic Cash System", announcing the birth and large-scale application of the first generation of blockchain technology. The subsequent blockchain technology is a distribution of technologies such as distributed data storage, point-to-point transmission, consensus mechanism and encryption algorithm extracted from Bitcoin, and a smart contract composed of automated script codes for programming and business processing. storage ledger system.

随着区块链技术在最近这几年的不断进行落地应用与实施,区块链与传统医疗行业结合成为一种主流趋势。由于传统医疗机构早已采用的医院信息系统HIS(HospitalInformation System)这种集中式关系型数据库系统存储病患信息,导致在构建医疗区块链这种非关系型存储系统时,存储在关系型数据库中的有价值数据并不能无缝迁移至非关系型的区块链存储系统中。With the continuous application and implementation of blockchain technology in recent years, the combination of blockchain and traditional medical industry has become a mainstream trend. Because the hospital information system HIS (Hospital Information System), a centralized relational database system that traditional medical institutions has already adopted, stores patient information, when building a non-relational storage system such as medical blockchain, it is stored in a relational database. of valuable data cannot be seamlessly migrated to non-relational blockchain storage systems.

现有关于医疗区块链技术中,大多技术或专利都是从构建医疗区块链的整体流程着手,包括设计分布医疗信息的存储节点、医疗区块链的整体功能和电子病历信息的隐私访问控制策略等方面进行技术阐述与申请。而区块链的数据迁移技术多是将旧有区块链的数据迁移到新版本的区块链中,或是提出一种通用的关系型数据库迁移到非关系型数据库系统的技术。由此导致在区块链医疗方面,采用目前已有方法将医院传统数据库的旧有电子病历信息迁移到区块链数据库中是困难的。因此,本发明提供一种面向电子医疗病历的区块链迁移与存储方法。Among the existing medical blockchain technologies, most of the technologies or patents start from the overall process of building a medical blockchain, including the design of storage nodes for distributing medical information, the overall functions of the medical blockchain, and the privacy access to electronic medical record information. Control strategy and other aspects of technical description and application. The data migration technology of the blockchain is mostly to migrate the data of the old blockchain to the new version of the blockchain, or to propose a technology for migrating a general relational database to a non-relational database system. As a result, in terms of blockchain medical care, it is difficult to migrate the old electronic medical record information of the traditional hospital database to the blockchain database by using the existing methods. Therefore, the present invention provides a blockchain migration and storage method for electronic medical records.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明的目的在于提供一种面向电子医疗病历的区块链迁移与存储方法,能够将医院数据库中已有的电子病历信息自动构建成多叉树模型,并通过构建好的多叉树模型对关系型数据转化为半结构化数据并存储,匹配现有的区块链上的用户信息,自动发布智能合约,并转换迁移至现有的区块链存储系统中。In view of this, the purpose of the present invention is to provide a blockchain migration and storage method for electronic medical records, which can automatically construct the existing electronic medical record information in the hospital database into a multi-fork tree model, and through the constructed multi-tree model. The fork tree model converts relational data into semi-structured data and stores it, matches the user information on the existing blockchain, automatically publishes smart contracts, and converts and migrates to the existing blockchain storage system.

为达到上述目的,本发明提供如下技术方案:To achieve the above object, the present invention provides the following technical solutions:

一种面向电子医疗病历的区块链迁移与存储方法,在传统医疗数据系统中提取电子病历关系表来构建多叉树信息模型,通过构建生成的多叉树信息模型对传统电子病历的关系表型数据进行数据转换,将生成的非关系型病历数据与迁移区块链上的已有用户信息进行信息匹配。当匹配到相关用户信息时,根据多叉树信息模型和非关系型病历数据发送的信息参数建立智能合约,对转换成功的非关系型病历数据按照新区块链的元交易数据结构和新交易数据结构进行区块链的交易广播,完成从传统医疗数据系统到区块链数据系统的迁移过程。A blockchain migration and storage method for electronic medical records, extracting the relationship table of electronic medical records in the traditional medical data system to build a multi-tree information model, and constructing the generated multi-tree information model to the relationship table of traditional electronic medical records Data conversion is performed on the non-relational medical record data generated, and the information is matched with the existing user information on the migration blockchain. When the relevant user information is matched, a smart contract is established according to the multi-tree information model and the information parameters sent by the non-relational medical record data, and the non-relational medical record data that has been successfully converted is based on the meta-transaction data structure and new transaction data of the new blockchain. The structure carries out the transaction broadcast of the blockchain, and completes the migration process from the traditional medical data system to the blockchain data system.

其中,按照所述新区块链的元交易数据内容,将元交易相对应的非关系型病历数据信息依次整合为具有链式顺序的新交易数据结构,固化在整个区块中,成为区块链数据。Among them, according to the meta transaction data content of the new blockchain, the non-relational medical record data information corresponding to the meta transaction is sequentially integrated into a new transaction data structure with a chain sequence, which is solidified in the entire block and becomes a blockchain data.

进一步,所述构建多叉树信息模型,包括以下步骤:Further, the construction of the multi-tree information model includes the following steps:

S11:对于存在多张关系表相互嵌套的电子病历数据,使用多叉树模型逐级映射结构化数据关系表,多叉树的根节点或子节点对应关系表中的主键与外键,而多叉树叶节点对应关系表中的字段(属性)。S11: For the electronic medical record data with multiple relationship tables nested in each other, use the multi-fork tree model to map the structured data relationship table level by level. The root node or child node of the multi-fork tree corresponds to the primary key and foreign key in the relationship table, and The fields (attributes) in the relationship table are corresponding to the multi-leaf nodes.

S12:获取电子病历关系表中的Patient(患者信息)表,并将Patient表的主键作为整个多叉树模型的根节点。S12: Obtain the Patient (patient information) table in the electronic medical record relationship table, and use the primary key of the Patient table as the root node of the entire polytree model.

S13:将关系表中的字段映射为多叉树的子节点。S13: Map the fields in the relational table to the child nodes of the multi-fork tree.

S14:判断子节点是否为外键属性,若当前节点为外键属性,则开启新线程,跳转到外键所属主表执行程序,重复步骤S12-S14,直到表中没有未加入多叉树节点的外键属性。S14: Determine whether the child node is a foreign key attribute, if the current node is a foreign key attribute, start a new thread, jump to the execution program of the main table to which the foreign key belongs, and repeat steps S12-S14 until there is no unjoined multi-fork tree in the table. The foreign key property of the node.

S15:遍历所有关系节点,若所在关系表中的所有字段都添加至相映射的多叉树中,结束程序。否则,读取没有加入到多叉树节点的字段值,重复步骤S13。S15: Traverse all relational nodes, and if all fields in the relational table are added to the mapped polytree, the procedure ends. Otherwise, read the field value not added to the multi-tree node, and repeat step S13.

进一步,所述通过构建生成的多叉树信息模型对传统电子病历的关系表型数据进行数据转换,将生成的非关系型病历数据与迁移区块链上的已有用户信息进行信息匹配,具体包括以下步骤:Further, the data conversion is performed on the relational phenotype data of the traditional electronic medical record by constructing the generated polytree information model, and the generated non-relational medical record data is matched with the existing user information on the migration blockchain. Include the following steps:

S21:获取多叉树模型根节点所映射的Patient关系表字段数据。S21: Obtain the field data of the Patient relation table mapped by the root node of the multi-tree model.

S22:按照多叉树模型的结构模型生成多叉树数据实例,从所述的Patient关系表开始依次读取所述表中的每一条元组数据,直至所述关系表中要被迁移的最后一条元组。S22: Generate a polytree data instance according to the structural model of the polytree model, and sequentially read each tuple data in the table from the Patient relation table until the last item to be migrated in the relation table A tuple.

S23:对于所读取到的每一条元组数据,从每一条元组的第一个字段所对应的数据内容开始,逐步迁移至多叉树模型所实例化的叶节点与子节点中,直至所读取此条元组数据的最后一个字段所对应的数据内容被迁移完成。S23: For each piece of tuple data read, start from the data content corresponding to the first field of each tuple, and gradually migrate to the leaf nodes and child nodes instantiated by the multi-tree model, until all The data content corresponding to the last field of the read tuple data is migrated.

S24:对于所读取到的关系表中每一条元组数据相对应的每一个外键字段(属性),按照先前所生成的多叉树模型节点关系,跳转到外键字段对应主键字段所属的数据关系表中,依次读取多叉树模型所映射到外键字段对应的关系表中的元组数据,直到迁移至最底端的叶节点。S24: For each foreign key field (attribute) corresponding to each tuple data in the read relation table, jump to the foreign key field corresponding to the primary key field according to the previously generated multi-tree model node relationship. In the data relationship table of , read the tuple data in the relationship table corresponding to the foreign key field mapped by the multi-tree model in turn, until it migrates to the bottom leaf node.

S25:对于与Patient关系表无直接或间接联系的独立数据关系表,依据多叉树建模方法,获取其关系表中的主键做作为整个多叉树模型的根节点,依次迁移数据。S25: For an independent data relationship table that has no direct or indirect connection with the Patient relationship table, according to the polytree modeling method, the primary key in the relationship table is obtained as the root node of the entire polytree model, and the data is migrated in turn.

S26:将生成的非关系型用户病历数据与区块链中已存在的相关用户信息进行匹配。S26: Match the generated non-relational user medical record data with the relevant user information already existing in the blockchain.

更进一步的,所述相关用户信息包括所述Patient关系表中的患者姓名,身份证号,性别,出生日期等患者个人信息;所述传统电子病历数据系统中的患者唯一标识数据,即Patient关系表中的主键信息;以及所述Patient关系表中监护人或其他家庭成员所组成的关系网信息。Further, the relevant user information includes the patient's personal information such as the patient's name, ID number, gender, and date of birth in the Patient relationship table; the patient's unique identification data in the traditional electronic medical record data system is the Patient relationship. The primary key information in the table; and the relationship network information composed of guardians or other family members in the Patient relationship table.

进一步,对转换成功的非关系型病历数据迁移至区块链的步骤包括:Further, the steps for migrating the successfully converted non-relational medical record data to the blockchain include:

S31:获取非关系型数据根节点与区块链上已有用户信息进行匹配。S31: Obtain the non-relational data root node and match the existing user information on the blockchain.

S32:若用户信息匹配成功,将匹配成功的返回值作为参数传递给智能合约,节点间背书并开始发布交易内容。S32: If the user information is successfully matched, the returned value of the successful match is passed as a parameter to the smart contract, and the nodes endorse and start to publish the transaction content.

S33:若用户信息匹配失败,将匹配失败的返回值和设定的有效期限值作为参数传递给智能合约,节点背书但并不发布,检测合约期限内是否有用户信息匹配。S33: If the user information matching fails, pass the return value of the matching failure and the set validity period as parameters to the smart contract, and the node endorses it but does not publish it, and detects whether there is a matching user information within the contract period.

S34:若在合约期限内匹配到相关用户信息,则执行步骤S32。S34: If the relevant user information is matched within the contract period, step S32 is executed.

S35:若在合约期限内未匹配到相关用户信息,则进行交易回退操作,存储回非关系型数据库中,等待执行步骤S31。S35: If the relevant user information is not matched within the contract period, perform a transaction rollback operation, store it back in the non-relational database, and wait for the execution of step S31.

S36:发布交易的病历数据按照新区块链的按照新区块链的元交易数据结构和新交易数据结构进行数据存储。S36: The medical record data of the published transaction is stored according to the new blockchain according to the meta transaction data structure and the new transaction data structure of the new blockchain.

更进一步的,区块链存储数据格式包括以下信息:Further, the blockchain storage data format includes the following information:

区块链整体数据结构分为区块头与区块体两部分。区块头包含区块散列与前一个区块散列。区块体包含两种不同的交易信息,即元交易数据和新交易数据。The overall data structure of the blockchain is divided into two parts: the block header and the block body. The block header contains the block hash and the previous block hash. The block body contains two different kinds of transaction information, namely meta transaction data and new transaction data.

其中,元交易数据用来描述数据属性的信息,包括区块链版本信息,多叉树模型负载与负载长度以及导入日志信息。其中,版本信息标识着当时导入区块链中的版本。负载长度标识生成的多叉树模型的数据量的大小。模型负载标识生成的半结构化数据的多叉树模型。而导入日志则记录导入数据的关系型数据库侧的存储位置以及数据负载等信息。新交易数据用来存储转换完成的病历数据,包括区块链交易数据所对应电子病历关系表的元数据,逻辑时间,交易负载和导入日志。其中,元数据代表了关系型数据库侧的元数据信息,包括存储位置,历史数据、文件记录等功能。而逻辑时间代表了该数据在关系型数据库侧生成数据的时间,而非区块链的导入时间,逻辑时间将病人的病历结果以正常就诊时间在区块链中表示出来。导入日志则记录导入数据的关系型数据库侧的存储位置以及数据负载等信息。Among them, meta transaction data is used to describe the information of data attributes, including blockchain version information, multi-tree model load and load length, and import log information. Among them, the version information identifies the version imported into the blockchain at that time. The payload length identifies the size of the data volume of the generated multi-tree model. The model payload identifies the multi-tree model of the generated semi-structured data. The import log records information such as the storage location and data load on the relational database side of the imported data. The new transaction data is used to store the converted medical record data, including the metadata of the electronic medical record relationship table corresponding to the blockchain transaction data, logic time, transaction load and import log. Among them, the metadata represents the metadata information on the relational database side, including functions such as storage location, historical data, and file records. The logical time represents the time when the data is generated on the relational database side, rather than the import time of the blockchain. The logical time represents the patient's medical record results in the blockchain with the normal visit time. The import log records information such as the storage location and data load on the relational database side of the imported data.

更进一步的,所述节点发包括括区块链索引模块,链表模块和状态存储模块;Further, the node server includes a block chain index module, a linked list module and a state storage module;

智能合约发布完成后,区块链框架模块调用链表模块接收达成共识的交易内容,通过调用索引模块对交易内容建立索引,并加入逻辑时间状态,调用状态存储模块将交易内容进行存储。当状态存储模块完成存储,产生交易回执,通知数据转换模块进行数据标记。数据转换模块将存储完成状态反馈回电子病历关系表中,完成整个区块链的迁移过程。After the smart contract is released, the blockchain framework module calls the linked list module to receive the consensus transaction content, calls the indexing module to index the transaction content, adds a logical time state, and calls the state storage module to store the transaction content. When the state storage module completes the storage, a transaction receipt is generated, and the data conversion module is notified to mark the data. The data conversion module feeds back the storage completion status back to the electronic medical record relationship table to complete the migration process of the entire blockchain.

本发明的有益效果在于:本发明一方面保证了数据在新旧数据库迁移中的完整性和鲁棒性。另一方面,通过对模型树的建构保证了可以实现高效率的持续数据迁移。The beneficial effects of the present invention are: on the one hand, the present invention ensures the integrity and robustness of data in the migration of new and old databases. On the other hand, efficient continuous data migration can be achieved through the construction of the model tree.

本发明的其他优点、目标和特征在某种程度上将在随后的说明书中进行阐述,并且在某种程度上,基于对下文的考察研究对本领域技术人员而言将是显而易见的,或者可以从本发明的实践中得到教导。本发明的目标和其他优点可以通过下面的说明书来实现和获得。Other advantages, objects, and features of the present invention will be set forth in the description that follows, and will be apparent to those skilled in the art based on a study of the following, to the extent that is taught in the practice of the present invention. The objectives and other advantages of the present invention may be realized and attained by the following description.

附图说明Description of drawings

为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作优选的详细描述,其中:In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be preferably described in detail below with reference to the accompanying drawings, wherein:

图1是本发明所述面向电子医疗病历区块链迁移与存储的方法的整体程序流程图;Fig. 1 is the overall program flow chart of the method for electronic medical record block chain migration and storage according to the present invention;

图2是本发明所述面向电子医疗病历区块链迁移与存储的方法中多叉树建模流程图;2 is a flowchart of polytree modeling in the method for electronic medical record blockchain migration and storage according to the present invention;

图3是本发明所述面向电子医疗病历区块链迁移与存储的方法中区块链存储的数据结构图;3 is a data structure diagram of blockchain storage in the method for electronic medical record blockchain migration and storage according to the present invention;

图4是本发明所述面向电子医疗病历区块链迁移与存储的方法中区块链存储数据结构图中元交易结构图;Fig. 4 is the block chain storage data structure diagram in the method for the electronic medical record block chain migration and storage according to the present invention;

图5是本发明所述面向电子医疗病历区块链迁移与存储的方法中区块链存储数据结构图中新交易结构图;5 is a new transaction structure diagram in the block chain storage data structure diagram in the method for electronic medical record block chain migration and storage according to the present invention;

图6是本发明所述面向电子医疗病历区块链迁移与存储的方法的整体结构图。FIG. 6 is an overall structural diagram of the method for the blockchain migration and storage of electronic medical records according to the present invention.

具体实施方式Detailed ways

以下通过特定的具体实例说明本发明的实施方式,本领域技术人员可由本说明书所揭露的内容轻易地了解本发明的其他优点与功效。本发明还可以通过另外不同的具体实施方式加以实施或应用,本说明书中的各项细节也可以基于不同观点与应用,在没有背离本发明的精神下进行各种修饰或改变。需要说明的是,以下实施例中所提供的图示仅以示意方式说明本发明的基本构想,在不冲突的情况下,以下实施例及实施例中的特征可以相互组合。The embodiments of the present invention are described below through specific specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the drawings provided in the following embodiments are only used to illustrate the basic idea of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.

其中,附图仅用于示例性说明,表示的仅是示意图,而非实物图,不能理解为对本发明的限制;为了更好地说明本发明的实施例,附图某些部件会有省略、放大或缩小,并不代表实际产品的尺寸;对本领域技术人员来说,附图中某些公知结构及其说明可能省略是可以理解的。Among them, the accompanying drawings are only used for exemplary description, and represent only schematic diagrams, not physical drawings, and should not be construed as limitations of the present invention; in order to better illustrate the embodiments of the present invention, some parts of the accompanying drawings will be omitted, The enlargement or reduction does not represent the size of the actual product; it is understandable to those skilled in the art that some well-known structures and their descriptions in the accompanying drawings may be omitted.

本发明实施例的附图中相同或相似的标号对应相同或相似的部件;在本发明的描述中,需要理解的是,若有术语“上”、“下”、“左”、“右”、“前”、“后”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此附图中描述位置关系的用语仅用于示例性说明,不能理解为对本发明的限制,对于本领域的普通技术人员而言,可以根据具体情况理解上述术语的具体含义。The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar components; in the description of the present invention, it should be understood that if there are terms “upper”, “lower”, “left” and “right” , "front", "rear" and other indicated orientations or positional relationships are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the indicated device or element must be It has a specific orientation, is constructed and operated in a specific orientation, so the terms describing the positional relationship in the accompanying drawings are only used for exemplary illustration, and should not be construed as a limitation of the present invention. situation to understand the specific meaning of the above terms.

区块链系统是一种防篡改的、共享的数字化分布式记账系统,按照区块链的规模和运行模式可分为公有链,私有链以及联盟链。每个区块链系统中包含若干个节点,若干个节点之间可发生不同的交易,并因此产生交易数据。区块链系统通过背书机制与共识算法对各个交易数据进行一致性确定,从而对交易数据进行处理,形成账本数据,也称区块数据。当区块链技术与医疗电子病历系统相结合时,由于区块链技术所采用的是非关系型数据库NoSQL,而传统医疗电子病历系统往往采用的是关系型数据库。关系型数据库是指采用了关系模型来组织数据的数据库。而关系模型指的是二维表格模型,一个关系型数据库就是由二维表及其之间的联系所组成的一个数据组织。关系型数据库遵循规范化设计,保证设计的最小化数据冗余,关系结构紧密。而非关系型数据库是指不遵循范式结构设计的,分布式的,且一般不保证ACID原则的数据存储系统。NoSQL是以键值对存储,且结构不固定的存储方式。原有医疗电子病历系统并不能直接接入医疗区块系统中以获取病历信息,需要借助数据迁移中间件来完成病历信息从医疗系统到区块链的迁移过程。本发明各实施例的技术方案即涉及关系型数据库和非关系型数据库及区块链存储技术。The blockchain system is a tamper-proof, shared digital distributed accounting system. According to the scale and operation mode of the blockchain, it can be divided into public chain, private chain and alliance chain. Each blockchain system contains several nodes, and different transactions can occur between several nodes, thus generating transaction data. The blockchain system determines the consistency of each transaction data through the endorsement mechanism and consensus algorithm, so as to process the transaction data to form ledger data, also known as block data. When the blockchain technology is combined with the medical electronic medical record system, since the blockchain technology uses a non-relational database NoSQL, the traditional medical electronic medical record system often uses a relational database. A relational database is a database that uses a relational model to organize data. The relational model refers to the two-dimensional table model, and a relational database is a data organization composed of two-dimensional tables and the connections between them. Relational databases follow a standardized design to ensure that the design minimizes data redundancy and has a tight relationship structure. A non-relational database refers to a data storage system that does not follow the paradigm structure design, is distributed, and generally does not guarantee the ACID principle. NoSQL is a storage method in which key-value pairs are stored and the structure is not fixed. The original medical electronic medical record system cannot be directly connected to the medical block system to obtain medical record information. Data migration middleware is needed to complete the migration process of medical record information from the medical system to the blockchain. The technical solutions of the embodiments of the present invention relate to relational databases, non-relational databases and blockchain storage technologies.

图1是本发明实施例提供一种面向电子医疗病历的区块链迁移与存储方法的流程图,能够将医院数据库中已有的电子病历信息自动构建成多叉树模型,并通过构建好的多叉树模型对关系型数据转化为半结构化数据并存储,匹配现有的区块链上的用户信息,自动发布智能合约,并转换迁移至现有的区块链存储系统中。Fig. 1 is a flow chart of a blockchain migration and storage method for electronic medical records provided by an embodiment of the present invention, which can automatically construct the existing electronic medical record information in the hospital database into a multi-fork tree model, and through the constructed The multi-fork tree model converts relational data into semi-structured data and stores it, matches the user information on the existing blockchain, automatically publishes smart contracts, and converts and migrates to the existing blockchain storage system.

为实现上述目的,本发明提供一种数据迁移方法,其内容包括在传统医疗数据系统中提取电子病历关系表来构建多叉树信息模型,通过构建生成的多叉树信息模型对传统电子病历的关系表型数据进行数据转换,将生成的半结构化数据与迁移区块链上的已有用户信息进行信息匹配。In order to achieve the above object, the present invention provides a data migration method. The relational phenotype data is converted, and the generated semi-structured data is matched with the existing user information on the migration blockchain.

当匹配到相关用户信息时,根据多叉树信息模型和非关系型病历数据发送的信息参数建立智能合约,对转换成功的非关系型病历数据按照新区块链的元交易数据结构和新交易数据结构进行区块链的交易广播,完成从传统医疗数据系统到区块链数据系统的迁移过程。When the relevant user information is matched, a smart contract is established according to the multi-tree information model and the information parameters sent by the non-relational medical record data, and the non-relational medical record data that has been successfully converted is based on the meta-transaction data structure and new transaction data of the new blockchain. The structure carries out the transaction broadcast of the blockchain, and completes the migration process from the traditional medical data system to the blockchain data system.

其中,按照所述新区块链的元交易数据内容,将元交易相对应的非关系型病历数据信息依次整合为具有链式顺序的新交易数据结构,固化在整个区块中,成为区块链数据。Among them, according to the meta transaction data content of the new blockchain, the non-relational medical record data information corresponding to the meta transaction is sequentially integrated into a new transaction data structure with a chain sequence, which is solidified in the entire block and becomes a blockchain data.

本发明实施例所述的关系型数据库系统是指应用于医院电子病历系统的符合关系模型的数据库软件实体,包括但不限于常用的关系型数据库,例如:Oracle、DB2、Microsoft SQL Server和MySQL等数据库系统。The relational database system described in the embodiment of the present invention refers to a database software entity conforming to a relational model applied to a hospital electronic medical record system, including but not limited to commonly used relational databases, such as Oracle, DB2, Microsoft SQL Server and MySQL, etc. database system.

本发明实施例所述的非关系型数据库系统是指适用于联盟链的非关系型数据库软件实体,包括但不限于常用的非关系型数据库,例如:MongoDB、redis、HBase和CouchDB等数据库系统。The non-relational database system described in the embodiment of the present invention refers to a non-relational database software entity suitable for alliance chains, including but not limited to commonly used non-relational databases, such as database systems such as MongoDB, redis, HBase, and CouchDB.

可选地,图2是本发明实施例提供的一种多叉树模型建立流程图。其操作步骤如下:Optionally, FIG. 2 is a flowchart of establishing a multi-tree model provided by an embodiment of the present invention. The operation steps are as follows:

获取电子病历关系表中的Patient(患者信息)表(S201),并将Patient表的主键作为整个多叉树模型的根节点。(S202)Obtain the Patient (patient information) table in the electronic medical record relationship table (S201), and use the primary key of the Patient table as the root node of the entire polytree model. (S202)

将关系表中的字段映射为多叉树的子节点,获取关系表中的节点。(S203)Map the fields in the relational table to the child nodes of the multi-fork tree, and get the nodes in the relational table. (S203)

判断子节点是否为外键属性(S204),若当前节点为外键属性,则开启新线程,跳转到外键所属主表执行程序(S207),重复S202-S204,直到表中没有未加入多叉树节点的外键属性。Determine whether the child node is a foreign key attribute (S204), if the current node is a foreign key attribute, start a new thread, jump to the main table execution program to which the foreign key belongs (S207), and repeat S202-S204 until there is no unjoined table in the table. The foreign key property of a polytree node.

判断下一个节点(S205),遍历所有关系节点(S206),若所在关系表中的所有字段都添加至相映射的多叉树中,结束程序。否则,读取没有加入到多叉树节点的字段值,重复S203。Determine the next node (S205), traverse all relational nodes (S206), and end the program if all fields in the relational table are added to the mapped polytree. Otherwise, read the field value not added to the multi-tree node, and repeat S203.

可选地,对于所述的数据迁移方法,其中,数据转换与用户匹配步骤包括:Optionally, for the data migration method, wherein the step of data conversion and user matching includes:

获取多叉树模型根节点所映射的Patient关系表字段数据。Obtain the field data of the Patient relation table mapped by the root node of the multi-tree model.

按照多叉树模型的结构模型生成多叉树数据实例,从所述的Patient关系表开始依次读取所述表中的每一条元组数据,直至所述关系表中要被迁移的最后一条元组。其中,读取多叉树数据的树遍历算法包括但并不限于常见算法,例如:前序遍历算法,中序遍历算法和后续遍历算法等。Generate a polytree data instance according to the structural model of the polytree model, and sequentially read each tuple data in the table from the Patient relation table until the last element to be migrated in the relation table Group. The tree traversal algorithms for reading multi-tree data include but are not limited to common algorithms, such as: pre-order traversal algorithms, in-order traversal algorithms, and subsequent traversal algorithms.

对于所读取到的每一条元组数据,从每一条元组的第一个字段所对应的数据内容开始,逐步迁移至多叉树模型所实例化的叶节点与子节点中,直至所读取此条元组数据的最后一个字段所对应的数据内容被迁移完成。For each tuple data read, start from the data content corresponding to the first field of each tuple, and gradually migrate to the leaf nodes and child nodes instantiated by the multi-tree model until the read The data content corresponding to the last field of this tuple data has been migrated.

对于所读取到的关系表中每一条元组数据相对应的每一个外键字段(属性),按照先前所生成的多叉树模型节点关系,跳转到外键字段对应主键字段所属的数据关系表中,依次读取多叉树模型所映射到外键字段对应的关系表中的元组数据,直到迁移至最底端的叶节点。For each foreign key field (attribute) corresponding to each tuple data in the read relation table, jump to the data to which the foreign key field corresponds to the primary key field according to the node relationship of the previously generated multi-tree model In the relational table, the tuple data in the relational table corresponding to the foreign key field mapped by the multi-tree model is sequentially read, until it is migrated to the bottommost leaf node.

对于与Patient关系表无直接或间接联系的独立数据关系表,依据权利要求2的多叉树建模方法,获取其关系表中的主键做作为整个多叉树模型的根节点,依次迁移数据。For an independent data relationship table that has no direct or indirect connection with the Patient relationship table, according to the multi-fork tree modeling method of claim 2, the primary key in the relationship table is obtained as the root node of the entire multi-fork tree model, and data is migrated in turn.

将生成的非关系型用户病历数据与区块链中已存在的相关用户信息进行匹配。Match the generated non-relational user medical record data with the relevant user information already existing in the blockchain.

可选地,对于所匹配的相关用户信息至少包含以下信息:Optionally, the matched relevant user information includes at least the following information:

所述Patient关系表中的患者姓名,身份证号,性别,出生日期等患者个人信息。所述传统电子病历数据系统中的患者唯一标识数据,即Patient关系表中的主键信息。以及所述Patient关系表中监护人或其他家庭成员所组成的关系网信息。其中以姓名,性别和身份证号为主的患者个人信息作为严格匹配条件,存在任意一条与个人信息不相符的条件就不能进行匹配。而以Patient关系表中监护人或其他家庭成员所组成的关系网信息则可以通过设定阈值匹配度来作为弱条件匹配,例如阈值匹配度在80%以上的用户信息可以进行匹配。通过对符合个人信息的强条件匹配与关系网信息的弱条件匹配,对区块链上的用户进行匹配推送,经由患者用户通过web端或app端同意匹配后,进行数据的正式迁移。The patient's name, ID number, gender, date of birth and other personal information of the patient in the Patient relationship table. The patient unique identification data in the traditional electronic medical record data system is the primary key information in the Patient relation table. And the relationship network information composed of guardians or other family members in the Patient relationship table. Among them, the patient's personal information mainly based on name, gender and ID number is used as a strict matching condition, and any condition that does not match the personal information cannot be matched. The relationship network information composed of guardians or other family members in the Patient relationship table can be used as weak condition matching by setting a threshold matching degree. For example, user information with a threshold matching degree above 80% can be matched. By matching the strong condition matching with personal information and the weak condition matching of the relationship network information, the users on the blockchain are matched and pushed, and after the patient users agree to the matching through the web terminal or the app terminal, the data is officially migrated.

可选地,如图1所示,对于转换完成的非关系型病历数据迁移至区块链的步骤包括:Optionally, as shown in FIG. 1 , the steps of migrating the converted non-relational medical record data to the blockchain include:

获取非关系型数据根节点与区块链上已有用户信息进行匹配(S103)。The acquired non-relational data root node is matched with the existing user information on the blockchain (S103).

若用户信息匹配成功,将匹配成功的返回值作为参数传递给智能合约,智能合约开始生成与执行(S104),节点间背书并开始发布交易内容(S109)。If the user information is successfully matched, the returned value of the successful match is passed as a parameter to the smart contract, the smart contract starts to be generated and executed (S104), and the nodes endorse and start to publish the transaction content (S109).

若用户信息匹配失败,将匹配失败的返回值和设定的有效期限值作为参数传递给智能合约(S105),节点背书但并不发布(S106),检测合约期限内是否有用户信息匹配(S108)。If the user information matching fails, the return value of the matching failure and the set validity period are passed as parameters to the smart contract (S105), the node endorses but does not publish it (S106), and detects whether there is any user information matching within the contract period (S108) ).

若在合约期限内匹配到相关用户信息,则执行交易背书,并广播各个节点进行消息的发布(S109)。If the relevant user information is matched within the contract period, the transaction endorsement is executed, and each node is broadcast to publish the message (S109).

若在合约期限内未匹配到相关用户信息,则进行交易回退操作(S107),存储回非关系型数据库缓冲区,等待执行S103。If the relevant user information is not matched within the contract period, the transaction rollback operation is performed (S107), the data is stored in the non-relational database buffer, and the execution of S103 is awaited.

发布交易的病历数据按照新区块链的按照新区块链的元交易数据结构和新交易数据结构进行数据存储。The medical record data of the published transaction is stored according to the new blockchain according to the meta transaction data structure and the new transaction data structure of the new blockchain.

可选地,如图3所示为区块链数据结构图。对于所述的区块链存储数据格式包括以下信息:Optionally, as shown in FIG. 3 is a block chain data structure diagram. The data format for the described blockchain storage includes the following information:

区块链整体数据结构分为区块头与区块体两部分。区块头包含区块散列(S301)与前一个区块散列(S302)。区块体包含两种不同的交易信息,即元交易数据(S303)和新交易数据(S304)。The overall data structure of the blockchain is divided into two parts: the block header and the block body. The block header contains the block hash (S301) and the previous block hash (S302). The block body contains two different transaction information, namely meta transaction data (S303) and new transaction data (S304).

可选地,如图4所示为元交易数据结构图。元交易数据用来描述数据属性的信息,包括区块链版本信息(S401),多叉树模型负载(S403)与负载长度(S402)以及导入日志信息(S404)。其中,版本信息标识着当时导入区块链中的版本。负载长度标识生成的多叉树模型的数据量的大小。模型负载标识生成的半结构化数据的多叉树模型。而导入日志则记录导入数据的关系型数据库侧的存储位置以及数据负载等信息。Optionally, as shown in FIG. 4 , a meta-transaction data structure diagram is shown. Meta transaction data is used to describe the information of data attributes, including blockchain version information (S401), multi-tree model load (S403) and load length (S402), and import log information (S404). Among them, the version information identifies the version imported into the blockchain at that time. The payload length identifies the size of the data volume of the generated multi-tree model. The model payload identifies the multi-tree model of the generated semi-structured data. The import log records information such as the storage location and data load on the relational database side of the imported data.

可选地,如图5所示为新交易数据结构图。新交易数据用来存储转换完成的病历数据,包括区块链交易数据所对应电子病历关系表的元数据(S501),逻辑时间(S502),交易负载(S503)和导入日志(S504)。其中,元数据代表了关系型数据库侧的元数据信息,包括存储位置,历史数据、文件记录等功能。而逻辑时间代表了该数据在关系型数据库侧生成数据的时间,而非区块链的导入时间,逻辑时间将病人的病历结果以正常就诊时间在区块链中表示出来。导入日志则记录导入数据的关系型数据库侧的存储位置以及数据负载等信息。Optionally, as shown in FIG. 5, a new transaction data structure diagram is shown. The new transaction data is used to store the converted medical record data, including the metadata of the electronic medical record relationship table corresponding to the blockchain transaction data (S501), the logical time (S502), the transaction load (S503) and the import log (S504). Among them, the metadata represents the metadata information on the relational database side, including functions such as storage location, historical data, and file records. The logical time represents the time when the data is generated on the relational database side, rather than the import time of the blockchain. The logical time represents the patient's medical record results in the blockchain with the normal visit time. The import log records information such as the storage location and data load on the relational database side of the imported data.

可选地,如图6所示为数据迁移系统的整体结构图。对于迁移与存储方法所应用的区块链架构,包括但不限于常用的联盟链区块链平台。例如:Hyperledger Fabric、Ripple以及OpenChain等联盟链平台。其存储节点模块应当包括区块链索引模块,链表模块和状态存储模块三种。Optionally, as shown in FIG. 6 is an overall structural diagram of the data migration system. The blockchain architecture applied to the migration and storage methods includes, but is not limited to, the commonly used consortium blockchain blockchain platforms. For example: Hyperledger Fabric, Ripple and OpenChain and other consortium chain platforms. Its storage node module should include three types: blockchain index module, linked list module and state storage module.

智能合约发布完成后,区块链框架模块调用链表模块接收达成共识的交易内容,通过调用索引模块对交易内容建立索引,并加入逻辑时间状态,调用状态存储模块将交易内容进行存储。After the smart contract is released, the blockchain framework module calls the linked list module to receive the consensus transaction content, calls the indexing module to index the transaction content, adds a logical time state, and calls the state storage module to store the transaction content.

当状态存储模块完成存储,产生交易回执,通知数据转换模块进行数据标记。数据转换模块将存储完成状态反馈回电子病历关系表中,完成整个区块链的迁移过程。When the state storage module completes the storage, a transaction receipt is generated, and the data conversion module is notified to mark the data. The data conversion module feeds back the storage completion status back to the electronic medical record relationship table to complete the migration process of the entire blockchain.

最后说明的是,以上实施例仅用以说明本发明的技术方案而非限制,尽管参照较佳实施例对本发明进行了详细说明,本领域的普通技术人员应当理解,可以对本发明的技术方案进行修改或者等同替换,而不脱离本技术方案的宗旨和范围,其均应涵盖在本发明的权利要求范围当中。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be Modifications or equivalent replacements, without departing from the spirit and scope of the technical solution, should all be included in the scope of the claims of the present invention.

Claims (7)

1.一种面向电子医疗病历的区块链迁移与存储方法,其特征在于:在传统医疗数据系统中提取电子病历关系表来构建多叉树信息模型,通过构建生成的多叉树信息模型对传统电子病历的关系表型数据进行数据转换,将生成的非关系型病历数据与迁移区块链上的已有用户信息进行信息匹配;当匹配到相关用户信息时,根据多叉树信息模型和非关系型病历数据发送的信息参数建立智能合约,对转换成功的非关系型病历数据按照新区块链的元交易数据结构和新交易数据结构进行区块链的交易广播,完成从传统医疗数据系统到区块链数据系统的迁移过程;1. a block chain migration and storage method oriented to electronic medical records, it is characterized in that: in the traditional medical data system, extract the electronic medical record relation table to construct a multi-tree information model, by constructing the generated multi-tree information model to The relational phenotype data of the traditional electronic medical record is converted into data, and the generated non-relational medical record data is matched with the existing user information on the migration blockchain; when the relevant user information is matched, according to the multi-tree information model and The information parameters sent by the non-relational medical record data establish a smart contract, and the non-relational medical record data that has been successfully converted is broadcasted on the blockchain according to the meta-transaction data structure and the new transaction data structure of the new blockchain, completing the transformation from the traditional medical data system. Migration process to blockchain data system; 其中,按照新区块链的元交易数据内容,将元交易相对应的非关系型病历数据信息依次整合为具有链式顺序的新交易数据结构,固化在整个区块中,成为区块链数据。Among them, according to the meta-transaction data content of the new blockchain, the non-relational medical record data information corresponding to the meta-transaction is sequentially integrated into a new transaction data structure with a chain sequence, which is solidified in the entire block and becomes blockchain data. 2.根据权利要求1所述的面向电子医疗病历的区块链迁移与存储方法,其特征在于:所述构建多叉树信息模型,包括以下步骤:2. The electronic medical record-oriented blockchain migration and storage method according to claim 1, characterized in that: the construction of a polytree information model comprises the following steps: S11:对于存在多张关系表相互嵌套的电子病历数据,使用多叉树模型逐级映射结构化数据关系表,多叉树的根节点或子节点对应关系表中的主键与外键,多叉树叶节点对应关系表中的字段,即属性;S11: For the electronic medical record data with multiple relationship tables nested in each other, use the multi-fork tree model to map the structured data relationship table level by level. The root node or child node of the multi-fork tree corresponds to the primary key and foreign key in the relationship table. Fork-leaf nodes correspond to fields in the relationship table, that is, attributes; S12:获取电子病历关系表中的患者信息表Patient,并将Patient表的主键作为整个多叉树模型的根节点;S12: Obtain the patient information table Patient in the electronic medical record relationship table, and use the primary key of the Patient table as the root node of the entire polytree model; S13:将关系表中的字段映射为多叉树的子节点;S13: Map the fields in the relational table to the child nodes of the polytree; S14:判断子节点是否为外键属性,若当前节点为外键属性,则开启新线程,跳转到外键所属主表执行程序,重复步骤S12-S14,直到表中没有未加入多叉树节点的外键属性;S14: Determine whether the child node is a foreign key attribute, if the current node is a foreign key attribute, start a new thread, jump to the execution program of the main table to which the foreign key belongs, and repeat steps S12-S14 until there is no unjoined multi-fork tree in the table. The foreign key attribute of the node; S15:遍历所有关系节点,若所在关系表中的所有字段都添加至相映射的多叉树中,结束程序;否则,读取没有加入到多叉树节点的字段值,重复步骤S13。S15: Traverse all relation nodes, if all fields in the relation table are added to the mapped polytree, end the program; otherwise, read the field values not added to the polytree node, and repeat step S13. 3.根据权利要求2所述的面向电子医疗病历的区块链迁移与存储方法,其特征在于:所述通过构建生成的多叉树信息模型对传统电子病历的关系表型数据进行数据转换,将生成的非关系型病历数据与迁移区块链上的已有用户信息进行信息匹配,具体包括以下步骤:3. The electronic medical record-oriented blockchain migration and storage method according to claim 2, characterized in that: the data conversion is performed on the relational phenotype data of traditional electronic medical records by the polytree information model generated by constructing, Matching the generated non-relational medical record data with the existing user information on the migration blockchain includes the following steps: S21:获取多叉树模型根节点所映射的Patient关系表字段数据;S21: Obtain the field data of the Patient relation table mapped by the root node of the multi-tree model; S22:按照多叉树模型的结构模型生成多叉树数据实例,从Patient关系表开始依次读取表中的每一条元组数据,直至所述Patient关系表中要被迁移的最后一条元组;S22: generate a polytree data instance according to the structural model of the polytree model, read each tuple data in the table successively from the Patient relation table, until the last tuple to be migrated in the Patient relation table; S23:对于所读取到的每一条元组数据,从每一条元组的第一个字段所对应的数据内容开始,逐步迁移至多叉树模型所实例化的叶节点与子节点中,直至所读取此条元组数据的最后一个字段所对应的数据内容被迁移完成;S23: For each piece of tuple data read, start from the data content corresponding to the first field of each tuple, and gradually migrate to the leaf nodes and child nodes instantiated by the multi-tree model, until all The data content corresponding to the last field of the read tuple data is migrated; S24:对于所读取到的关系表中每一条元组数据相对应的每一个外键字段,即属性,按照先前所生成的多叉树模型节点关系,跳转到外键字段对应主键字段所属的数据关系表中,依次读取多叉树模型所映射到外键字段对应的关系表中的元组数据,直到迁移至最底端的叶节点;S24: For each foreign key field corresponding to each tuple data in the read relation table, that is, an attribute, according to the previously generated multi-tree model node relationship, jump to the foreign key field corresponding to the primary key field to which it belongs. In the data relationship table of , read the tuple data in the relationship table corresponding to the foreign key field mapped by the multi-tree model in turn, until it migrates to the bottommost leaf node; S25:对于与Patient关系表无直接或间接联系的独立数据关系表,依据多叉树建模方法,获取其关系表中的主键做作为整个多叉树模型的根节点,依次迁移数据;S25: For an independent data relationship table that has no direct or indirect connection with the Patient relationship table, according to the polytree modeling method, obtain the primary key in the relationship table as the root node of the entire polytree model, and migrate the data in turn; S26:将生成的非关系型用户病历数据与区块链中已存在的相关用户信息进行匹配。S26: Match the generated non-relational user medical record data with the relevant user information already existing in the blockchain. 4.根据权利要求3所述的面向电子医疗病历的区块链迁移与存储方法,其特征在于:所述相关用户信息包括Patient关系表中的患者个人信息,即患者姓名,身份证号,性别,出生日期;还包括所述传统电子病历数据系统中的患者唯一标识数据,即Patient关系表中的主键信息;以及所述Patient关系表中监护人或其他家庭成员所组成的关系网信息。4. the block chain migration and storage method oriented to electronic medical records according to claim 3, is characterized in that: described relevant user information comprises the patient's personal information in the Patient relation table, namely patient's name, ID number, gender , date of birth; also includes the patient unique identification data in the traditional electronic medical record data system, that is, the primary key information in the Patient relationship table; and the relationship network information formed by guardians or other family members in the Patient relationship table. 5.根据权利要求1所述的面向电子医疗病历的区块链迁移与存储方法,其特征在于:对转换成功的非关系型病历数据迁移至区块链的步骤包括:5. The block chain migration and storage method for electronic medical records according to claim 1, wherein the step of migrating the successfully converted non-relational medical record data to the block chain comprises: S31:获取非关系型数据根节点与区块链上已有用户信息进行匹配;S31: Obtain the non-relational data root node and match the existing user information on the blockchain; S32:若用户信息匹配成功,将匹配成功的返回值作为参数传递给智能合约,节点间背书并开始发布交易内容;S32: If the user information is successfully matched, the returned value of the successful match is passed as a parameter to the smart contract, and the nodes endorse and start to publish the transaction content; S33:若用户信息匹配失败,将匹配失败的返回值和设定的有效期限值作为参数传递给智能合约,节点背书但并不发布,检测合约期限内是否有用户信息匹配;S33: If the user information matching fails, pass the return value of the matching failure and the set validity period as parameters to the smart contract, and the node endorses it but does not publish it, and detects whether there is a matching user information within the contract period; S34:若在合约期限内匹配到相关用户信息,则执行步骤S32;S34: If the relevant user information is matched within the contract period, step S32 is executed; S35:若在合约期限内未匹配到相关用户信息,则进行交易回退操作,存储回非关系型数据库中,等待执行步骤S31;S35: If the relevant user information is not matched within the contract period, perform a transaction rollback operation, store it back in the non-relational database, and wait for the execution of step S31; S36:发布交易的病历数据按照新区块链的按照新区块链的元交易数据结构和新交易数据结构进行数据存储。S36: The medical record data of the published transaction is stored according to the new blockchain according to the meta transaction data structure and the new transaction data structure of the new blockchain. 6.根据权利要求5所述的面向电子医疗病历的区块链迁移与存储方法,其特征在于:区块链存储数据格式包括以下信息:6. The block chain migration and storage method for electronic medical records according to claim 5, wherein the block chain storage data format includes the following information: 区块链整体数据结构包括区块头与区块体,所述区块头包含区块散列与前一个区块散列,区块体包含两种不同的交易信息,即元交易数据和新交易数据;The overall data structure of the blockchain includes a block header and a block body. The block header contains the block hash and the previous block hash. The block body contains two different transaction information, namely meta transaction data and new transaction data. ; 其中,元交易数据用来描述数据属性的信息,包括区块链版本信息,多叉树模型负载与负载长度以及导入日志信息;其中,版本信息标识着当时导入区块链中的版本;负载长度标识生成的多叉树模型的数据量的大小;模型负载标识生成的半结构化数据的多叉树模型;导入日志记录导入数据的关系型数据库侧的存储位置以及数据负载;新交易数据用来存储转换完成的病历数据,包括区块链交易数据所对应电子病历关系表的元数据,逻辑时间,交易负载和导入日志;其中,元数据代表关系型数据库侧的元数据信息,包括存储位置,历史数据、文件记录;逻辑时间代表对应数据在关系型数据库侧生成数据的时间,非区块链的导入时间,逻辑时间将病人的病历结果以正常就诊时间在区块链中表示出来;导入日志记录导入数据的关系型数据库侧的存储位置以及数据负载。Among them, the meta transaction data is used to describe the information of the data attributes, including the blockchain version information, the multi-tree model load and load length, and the import log information; wherein, the version information identifies the version imported into the blockchain at that time; the load length Identifies the size of the data volume of the generated multi-fork tree model; the model load identifies the multi-fork tree model of the generated semi-structured data; the import log records the storage location and data load on the relational database side of the imported data; the new transaction data is used for Store the converted medical record data, including the metadata, logical time, transaction load and import log of the electronic medical record relationship table corresponding to the blockchain transaction data; wherein, the metadata represents the metadata information on the relational database side, including the storage location, Historical data, file records; logical time represents the time when the corresponding data is generated on the relational database side, non-blockchain import time, logical time represents the patient's medical record results in the blockchain with the normal visit time; import log Record the storage location and data load on the relational database side of the imported data. 7.根据权利要求5所述的面向电子医疗病历的区块链迁移与存储方法,其特征在于:所述节点包括括区块链索引模块,链表模块和状态存储模块;7. The electronic medical record-oriented blockchain migration and storage method according to claim 5, wherein the node comprises a blockchain index module, a linked list module and a state storage module; 智能合约发布完成后,区块链框架模块调用链表模块接收达成共识的交易内容,通过调用索引模块对交易内容建立索引,并加入逻辑时间状态,调用状态存储模块将交易内容进行存储;当状态存储模块完成存储,产生交易回执,通知数据转换模块进行数据标记;数据转换模块将存储完成状态反馈回电子病历关系表中,完成整个区块链的迁移过程。After the smart contract is released, the blockchain framework module calls the linked list module to receive the consensus transaction content, calls the index module to index the transaction content, adds the logical time state, and calls the state storage module to store the transaction content; The module completes the storage, generates a transaction receipt, and notifies the data conversion module to mark the data; the data conversion module feeds back the storage completion status to the electronic medical record relationship table to complete the migration process of the entire blockchain.
CN201910486535.7A 2019-06-05 2019-06-05 A blockchain migration and storage method for electronic medical records Active CN110197708B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910486535.7A CN110197708B (en) 2019-06-05 2019-06-05 A blockchain migration and storage method for electronic medical records

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910486535.7A CN110197708B (en) 2019-06-05 2019-06-05 A blockchain migration and storage method for electronic medical records

Publications (2)

Publication Number Publication Date
CN110197708A true CN110197708A (en) 2019-09-03
CN110197708B CN110197708B (en) 2023-01-24

Family

ID=67754006

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910486535.7A Active CN110197708B (en) 2019-06-05 2019-06-05 A blockchain migration and storage method for electronic medical records

Country Status (1)

Country Link
CN (1) CN110197708B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111311283A (en) * 2020-02-20 2020-06-19 宁波甜宝生物信息技术有限公司 Cosmetic source tracing production process method based on block chain and cloud computing
CN112632080A (en) * 2020-12-29 2021-04-09 杭州趣链科技有限公司 Data storage method, device and equipment based on block chain
CN113157723A (en) * 2021-04-06 2021-07-23 福州大学 SQL access method for Hyperridge Fabric
CN113656380A (en) * 2021-08-23 2021-11-16 工银科技有限公司 Data life cycle management method and device
CN116483808A (en) * 2023-06-16 2023-07-25 北京国电通网络技术有限公司 Data migration method, device, electronic equipment and computer readable medium
CN117950586A (en) * 2024-01-02 2024-04-30 中铁工程设计咨询集团有限公司 Distributed storage method of computer virus library based on blockchain and related devices
US12147399B2 (en) * 2018-11-06 2024-11-19 International Business Machines Corporation Migration of a legacy system

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106529194A (en) * 2016-12-02 2017-03-22 深圳市前海安测信息技术有限公司 Medical informatization electronic medical record data migration system and method
CN107040510A (en) * 2016-11-30 2017-08-11 华侨大学 A kind of medical big data processing method based on body area network and cloud computing
CN107820690A (en) * 2017-08-21 2018-03-20 达闼科技成都有限公司 Information selection method, device, electronic device, and computer-readable storage medium
WO2018126077A1 (en) * 2016-12-30 2018-07-05 Intel Corporation Service provision to iot devices
CN108648784A (en) * 2018-03-15 2018-10-12 西安电子科技大学 Medical data storage method, information data processing terminal based on block chain technology
CN109191003A (en) * 2018-09-25 2019-01-11 仲恺农业工程学院 Fruit and vegetable agricultural product quality safety traceability system based on block chain
WO2019018776A1 (en) * 2017-07-21 2019-01-24 Patientory, Inc. Blockchain network for secure exchange of healthcare information
CN109670334A (en) * 2018-12-19 2019-04-23 平安科技(深圳)有限公司 Electronic health record sharing method, device, computer equipment and storage medium
CN109830285A (en) * 2019-01-07 2019-05-31 东软医疗系统股份有限公司 A kind of medical image document handling method and device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107040510A (en) * 2016-11-30 2017-08-11 华侨大学 A kind of medical big data processing method based on body area network and cloud computing
CN106529194A (en) * 2016-12-02 2017-03-22 深圳市前海安测信息技术有限公司 Medical informatization electronic medical record data migration system and method
WO2018126077A1 (en) * 2016-12-30 2018-07-05 Intel Corporation Service provision to iot devices
WO2019018776A1 (en) * 2017-07-21 2019-01-24 Patientory, Inc. Blockchain network for secure exchange of healthcare information
CN107820690A (en) * 2017-08-21 2018-03-20 达闼科技成都有限公司 Information selection method, device, electronic device, and computer-readable storage medium
CN108648784A (en) * 2018-03-15 2018-10-12 西安电子科技大学 Medical data storage method, information data processing terminal based on block chain technology
CN109191003A (en) * 2018-09-25 2019-01-11 仲恺农业工程学院 Fruit and vegetable agricultural product quality safety traceability system based on block chain
CN109670334A (en) * 2018-12-19 2019-04-23 平安科技(深圳)有限公司 Electronic health record sharing method, device, computer equipment and storage medium
CN109830285A (en) * 2019-01-07 2019-05-31 东软医疗系统股份有限公司 A kind of medical image document handling method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
XIAOSHUAI ZHANG: "Block-Based Access Control for Blockchain-Based Electronic Medical Records (EMRs) Query in eHealth", 《IEEE》 *
苏雄业: "基于区块链的大数据共享模型与关键机制研究与实现", 《中国优秀硕士论文电子期刊网》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US12147399B2 (en) * 2018-11-06 2024-11-19 International Business Machines Corporation Migration of a legacy system
CN111311283A (en) * 2020-02-20 2020-06-19 宁波甜宝生物信息技术有限公司 Cosmetic source tracing production process method based on block chain and cloud computing
CN111311283B (en) * 2020-02-20 2021-02-05 宁波甜宝生物信息技术有限公司 Cosmetic source tracing production process method based on block chain and cloud computing
CN112632080A (en) * 2020-12-29 2021-04-09 杭州趣链科技有限公司 Data storage method, device and equipment based on block chain
CN113157723A (en) * 2021-04-06 2021-07-23 福州大学 SQL access method for Hyperridge Fabric
CN113157723B (en) * 2021-04-06 2022-06-03 福州大学 SQL access method for Hyperridge Fabric
CN113656380A (en) * 2021-08-23 2021-11-16 工银科技有限公司 Data life cycle management method and device
CN116483808A (en) * 2023-06-16 2023-07-25 北京国电通网络技术有限公司 Data migration method, device, electronic equipment and computer readable medium
CN116483808B (en) * 2023-06-16 2023-09-12 北京国电通网络技术有限公司 Data migration methods, devices, electronic devices and computer-readable media
CN117950586A (en) * 2024-01-02 2024-04-30 中铁工程设计咨询集团有限公司 Distributed storage method of computer virus library based on blockchain and related devices

Also Published As

Publication number Publication date
CN110197708B (en) 2023-01-24

Similar Documents

Publication Publication Date Title
CN110197708A (en) A kind of migration of block chain and storage method towards electron medical treatment case history
AU2020272058B2 (en) Systems, devices, and methods for DLT-based data management platforms and data products
CN112559627B (en) Method for sharing electronic medical record data in cooperation with each other on chain and under chain based on alliance chain
US20210157823A1 (en) Blockchain Node and Transaction Method
US20230412360A1 (en) Distributed platform for computation and trusted validation
CN106227800B (en) A storage method and management system for highly correlated big data
US11212076B2 (en) Distributed platform for computation and trusted validation
CN101409614B (en) Data synchronization method, system and equipment
US20220121648A1 (en) Distributed platform for computation and trusted validation
Angadi et al. International journal of advanced research in computer science and software engineering
US10924551B2 (en) IRC-Infoid data standardization for use in a plurality of mobile applications
WO2008101236A1 (en) Rest for entities
CN110135986A (en) A searchable encrypted file data method based on blockchain smart contracts
US11645344B2 (en) Entity mapping based on incongruent entity data
CN111488608A (en) Data verification method and device for service data block chain
WO2023011022A1 (en) Blockchain-based data processing method, and device and computer-readable storage medium
US20220254462A1 (en) System and Method of Property Collection Management and Architecture
CN112711633B (en) Multi-person collaborative creation method and system for BIM drawings based on blockchain
CN111488345A (en) Storage optimization method and device for service data block chain
CN111488611A (en) Relation data storage method and device of business data block chain
CN111488349A (en) Data query method and device based on service data block chain
CN111695136A (en) Method and system for realizing service data block chain
CN114529943A (en) Unified management method for biological identification data and server
CN111488607A (en) Data processing method and device for service data block chain
CN111695135A (en) Relation data query method and device based on business data block chain

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
TR01 Transfer of patent right

Effective date of registration: 20250820

Address after: 033000 Shanxi Province Luliang City Lishi District Binhe South Road Bin Dong Xuefu Yard 3rd Floor

Patentee after: Lvliang Botong Network Electronic Technology Co.,Ltd.

Country or region after: China

Address before: 400065 Chongqing Nan'an District huangjuezhen pass Chongwen Road No. 2

Patentee before: CHONGQING University OF POSTS AND TELECOMMUNICATIONS

Country or region before: China

TR01 Transfer of patent right
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载