Drug traceability system and storage and access optimization method based on blockchain

By combining blockchain and centralized database technical means in the drug traceability system, problems such as data interoperability and easy tampering in the drug traceability system are solved, and efficient drug traceability and data security are achieved.

CN114862423BActive Publication Date: 2025-02-18NORTHEASTERN UNIV CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210585019.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-27
Publication Date
2025-02-18
Estimated Expiration
2042-05-27

AI Technical Summary

Technical Problem

The existing drug traceability system has problems such as data not interoperable, easy to be tampered with, low traceability efficiency and user privacy leakage, and blockchain technology has shortcomings in query efficiency and data security.

Method used

Using a blockchain-based drug traceability system, combined with centralized database and blockchain technology, drug data is divided into two categories and stored separately through a classification storage module, and the query process is optimized through the query module, and the query efficiency is improved using the global index tree.

Benefits of technology

It realizes efficient storage and query of drug traceability systems, ensures the security and immutability of drug transaction data, and improves user experience and traceability efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114862423B_ABST
    Figure CN114862423B_ABST
Patent Text Reader

Abstract

The present invention provides a drug traceability system and access optimization method based on blockchain, which relates to the technical field of drug traceability. The user's storage instructions and the drug data to be stored are input into the system through an input module; the input module transmits the received drug data to the classification storage module; the classification storage module stores different types of data in a database or blockchain; the input module transmits the user's query instructions and the information to be queried to the query module; the query module inputs the query results into a transaction graph construction module or an output module according to the query instruction type; the transaction graph construction module constructs the transaction graph required for drug traceability, and transmits the transaction graph to the output module in the form of data information and image information; the output module feeds back all the received information to the user; the system and method combine the centralized database with the blockchain technology, which not only ensures the high efficiency of storage and query, but also ensures that the key information of drug transactions cannot be easily tampered with.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of drug traceability, and in particular to a drug traceability system and access optimization method based on blockchain. Background Art

[0002] Drug traceability is particularly important for reducing medical disputes caused by opaque information and untraceable sources. However, the existing drug traceability system is not interoperable, which makes data easy to be maliciously tampered with. The complex drug supply chain reduces the efficiency of traceability, and the lack of an effective supervision mechanism makes user privacy easy to leak.

[0003] In recent years, the increasingly mature blockchain technology has provided a new solution for drug traceability. Blockchain has the characteristics of openness, transparency, decentralization, and resistance to tampering. It provides a better platform for data storage and query. As a storage structure for drug transaction information, it has obvious advantages and provides effective help for improving the drug traceability system. However, as an emerging data structure, blockchain also has obvious disadvantages, that is, its efficiency is lower than that of traditional centralized databases. Therefore, the organic combination of blockchain and traditional database technology will become the best solution to solve storage efficiency and security problems. At the same time, in some application scenarios, it is usually necessary to do a compound query on a certain element at the same time. The traditional approach is to split the compound query into two parts, one for each question and one for each query, which seriously affects the query efficiency and user experience. Therefore, the optimization of traditional queries will also play an important role in the development of the traceability system.

[0004] The existing blockchain storage and query system can only find all the information of the drug and then query it. It cannot accurately locate the drug information, has low query efficiency, and cannot meet the user's query needs. The traditional blockchain query process is complicated, resulting in slow query speed and low efficiency. If only key information is stored in the blockchain and other information is stored in the database, combining the blockchain with a database with high query efficiency can not only store enough information, but also greatly improve the efficiency of information query.

[0005] However, the existing blockchain technology requires signature authentication steps when performing a series of operations, which leads to low efficiency when performing large-scale data queries. At the same time, traditional databases are centralized and cannot guarantee the security of stored data, which is easy to be tampered with. Summary of the invention

[0006] The technical problem to be solved by the present invention is to provide a blockchain-based drug traceability system and access optimization method to achieve traceability and access to drugs in view of the deficiencies of the above-mentioned prior art.

[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0008] On the one hand, the present invention provides a drug traceability system based on blockchain, including an input module, a classification storage module, a query module, a transaction graph construction module and an output module; the input module inputs the user's storage instructions and the drug data to be stored into the system; the input module transmits the received drug data to the classification storage module; the classification storage module is used to store different types of data in corresponding data structures; the input module transmits the user's query instructions and information to be queried to the query module; the query module is used to receive the query instruction, and input the query result into the transaction graph construction module or the output module according to the query instruction type; the transaction graph construction module is used to construct the transaction graph required for drug traceability, and transmit the transaction graph to the output module in the form of data information and image information; the output module is used to feed back all received information to the user;

[0009] The drug data is divided into two categories, among which the first category is the basic information data of the drug; the second category is the transaction information data of the drug, including the drug number and the organization number of the two parties to the transaction; the drug number is a unique number obtained after a drug is produced, which is used as a feature code to identify the drug; the first category of data is general data and will be stored in a centralized database; the second category of information is sensitive data and will be stored in the blockchain.

[0010] The query instructions are divided into two categories. The first category is drug information query, and the user will also enter the name of the drug to be queried; the second category is traceability query; when the query instruction is the first category, the query module will directly search for the drug to be queried in the centralized database. If the search is successful, the query success instruction and the obtained drug information will be passed to the output module. If the search fails, only the query failure instruction will be fed back to the output module;

[0011] When the query instruction is of the second type, the query module will check whether the drug number is legal after receiving the query instruction. If it is illegal, the query will not be performed and the query failure instruction will be passed to the output module. If it is legal, the drug number of the drug to be traced will be used as the sorting weight to split all the transaction numbers of the drug in the splittable binary sorting tree Treap, and the corresponding transaction information will be queried in the blockchain and then passed to the transaction graph construction module; the transaction graph construction module constructs a directed acyclic graph of the drug flow through the obtained transaction information and passes it to the output module.

[0012] On the other hand, the present invention also provides a drug traceability storage and access optimization method based on blockchain, which includes two parts: drug information storage and drug information query, wherein:

[0013] The specific method of storing the medicine is as follows:

[0014] Step 1: The user inputs the storage instruction and the drug data to be stored into the drug traceability system through the input module;

[0015] Step 2: The input module transfers the received data to the classification storage module, and the classification storage module stores the drug data in different ways according to the type of drug data;

[0016] If the drug data is the first category of data:

[0017] The classification storage module will directly call the database interface and store the received data into the centralized database;

[0018] If the drug data is the second type of data, the classification storage module will package the organization numbers of both parties in the drug transaction and the generated transaction number and store them in the decentralized blockchain. The specific method is as follows:

[0019] Step 2.1: Generate a transaction IDx unique to the drug transaction; set Mx as the drug number, Orga and Orgb as the organization numbers of the two parties to the transaction, where Orga is the organization number of the transaction supplier, Orgb is the organization number of the transaction recipient, and Rx is the additional weight obtained by random;

[0020] Step 2.2: Create a new index information node Tx, whose storage structure is<Mx,IDx,Rx> ;

[0021] Step 2.3: The classification storage module first packages the transaction drug number and the generated transaction number to create a new information node and puts it into the sorting binary tree Treap with the drug number as the sorting weight to establish a global index tree;

[0022] Step 2.4: Split the index tree into two trees Tr1 and Tr2 according to the drug number Mx, where the sorting weights of the nodes in Tr1 are all less than or equal to the drug number Mx, and the sorting weights of the nodes in Tr2 are all greater than the drug number Mx;

[0023] Step 2.5: Merge Tr1 and Tx into Tr3;

[0024] Step 2.6: Merge Tr3 and Tr2 into a new index tree, and the insertion is completed;

[0025] Step 2.7: Package and store sensitive data such as the organization numbers of both parties in this drug transaction and the generated transaction number into the decentralized blockchain;

[0026] Step 2.8: The classification storage module modifies the ownership of the drug in the centralized database and stores other relevant information of the drug.

[0027] The specific method for querying drug information is as follows:

[0028] Step S1: The user inputs the query instruction into the drug traceability system through the input module;

[0029] Step S2: The input module transmits the query instruction and the drug information to be queried to the query module, and the query module performs drug information query or drug traceability query according to the query instruction type;

[0030] If the query instruction is the first type of query:

[0031] The query module will directly search the database with the name of the drug to be queried as the key value. If the search is successful, the query success instruction and the obtained drug information will be passed to the output module. If the search fails, only the query failure instruction will be fed back to the output module;

[0032] If the query instruction is the second type of query:

[0033] The query module obtains the transaction party organization number from the blockchain and transmits it to the transaction graph construction module; the transaction graph construction module constructs a directed acyclic graph of drug flow through the obtained transaction party organization number and transmits it to the output module; the output module outputs the drug transaction traceability result, the specific method is as follows:

[0034] Step S2.1: The query module first checks whether the input drug number is legal. If it is illegal, the query will not be performed and the query failure instruction will be transmitted to the output module;

[0035] Step S2.2: If the drug number is legal, split the index tree into Tr1′ and Tr2′ according to the drug number Mx, where the sorting weights of the nodes in Tr1′ are all less than or equal to Mx, and the sorting weights of the nodes in Tr2′ are all greater than Mx;

[0036] Step S2.3: Split Tr1′ into Tr3′ and Tr4′ according to Mx-1, where the sorting weights of the nodes in Tr3′ are all less than Mx, and the sorting weights of the nodes in Tr4′ are all equal to Mx;

[0037] Step S2.4: traverse Tr4′ and use the transaction number in Tr4′ as the key to query the corresponding transaction in the blockchain;

[0038] Step S2.5: merge Tr3′, Tr4′, and Tr2′ in order to restore the index tree;

[0039] Step S2.6: Transmitting the transaction party organization numbers obtained from the blockchain to the transaction graph construction module;

[0040] Step S2.7: The transaction graph construction module constructs a directed acyclic graph of drug flow through the obtained transaction party organization numbers and transmits it to the output module. The specific steps are as follows;

[0041] Step a: Extract all the transaction party organization numbers to obtain the point set V = {Orga1, Orgb1, Orga2, Orgb2, ..., Organ, Orgbn}, and use the transaction party organization numbers as directed edges.<Orga,Orgb> The edge set E = {<Orga1,Orgb1> ,<Orga2,Orgb2> ,...<Organ,Orgbn>}, where n is the total number of organization numbers of both transaction parties obtained by query;

[0042] Step b: Reconstruct the forward directed graph G(V,E) of the drug transaction, and add edges in the reverse direction to construct the reverse directed graph G'(V,E');

[0043] Step S2.8: Transmit the two directed graphs and transaction information data to the output module;

[0044] Step S3: The output module outputs the drug transaction traceability results.

[0045] The beneficial effect of adopting the above technical solution is that the blockchain-based drug traceability system and access optimization method provided by the present invention combines the centralized database with the blockchain technology, which not only ensures the high efficiency of storage and query, but also ensures that the key information of drug transactions cannot be easily tampered with. Using the global index classification storage method, the various parts of the transaction information are stored in the centralized database and the blockchain respectively, while ensuring the efficiency of storage and query of the traceability system and data security. When querying, the global index Treap is used to extract the target point set at one time, which significantly reduces the time spent by the traceability system in extracting transaction information and improves the efficiency of drug traceability. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 A structural block diagram of a drug traceability system based on blockchain provided by an embodiment of the present invention;

[0047] Figure 2 A storage flow chart of a drug traceability system provided by an embodiment of the present invention;

[0048] Figure 3 A schematic diagram of an optimized sorted binary tree Treap merge operation provided by an embodiment of the present invention;

[0049] Figure 4 A schematic diagram of an optimized sorted binary tree Treap splitting operation provided by an embodiment of the present invention;

[0050] Figure 5 A query flow chart of a drug traceability system provided by an embodiment of the present invention;

[0051] Figure 6A schematic diagram of searching for a target point set by splitting an index tree provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0052] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.

[0053] In this embodiment, the drug traceability system based on blockchain, such as Figure 1 As shown, it includes an input module, a classification storage module, a query module, a transaction graph construction module and an output module; the input module inputs the user's storage instructions and the drug data to be stored into the system; the input module transmits the received drug data to the classification storage module; the classification storage module is used to store different types of data in corresponding data structures; the input module transmits the user's query instructions and the information to be queried to the query module; the query module is used to receive the query instruction, and input the query result into the transaction graph construction module or the output module according to the query instruction type; the transaction graph construction module is used to construct the transaction graph required for drug traceability, and transmit the transaction graph to the output module in the form of data information and image information; the output module is used to feed back all received information to the user;

[0054] The drug data is divided into two categories, among which the first category is the basic information data of the drug, including the ingredients, production date, batch number, manufacturer, etc. of the drug; the second category is the transaction information data of the drug, including the drug number and the organization number of the two parties to the transaction; the drug number is a unique number obtained after a drug is produced, which is used as a feature code to identify the drug; the first category of data is general data and will be stored in a centralized database; the second category of information is sensitive data and will be stored in the blockchain.

[0055] The query instructions are divided into two categories. The first category is drug information query, and the user will also enter the name of the drug to be queried; the second category is traceability query; when the query instruction is the first category, the query module will directly search for the drug to be queried in the centralized database. If the search is successful, the query success instruction and the obtained drug information will be passed to the output module. If the search fails, only the query failure instruction will be fed back to the output module;

[0056] When the query instruction is of the second type, the query module will check whether the drug number is legal after receiving the query instruction. If it is illegal, the query will not be performed and the query failure instruction will be passed to the output module. If it is legal, the drug number of the drug to be traced will be used as the sorting weight to split all the transaction numbers of the drug in the splittable binary sorting tree Treap, and the corresponding transaction information will be queried in the blockchain and then passed to the transaction graph construction module; the transaction graph construction module constructs a directed acyclic graph of the drug flow through the obtained transaction information and passes it to the output module.

[0057] The drug traceability storage and access optimization method based on blockchain includes two parts: drug information storage and drug information query.

[0058] The drug storage process is as follows Figure 2 As shown, the specific method is:

[0059] Step 1: The user inputs the storage instruction and the drug data to be stored into the drug traceability system through the input module;

[0060] Step 2: The input module transfers the received data to the classification storage module, and the classification storage module stores the drug data in different ways according to the type of drug data;

[0061] If the drug data is the first category of data:

[0062] The classification storage module will directly call the database interface and store the received data into the centralized database;

[0063] If the drug data is the second type of data, the classification storage module will package the organization numbers of both parties in the drug transaction and the generated transaction number and store them in the decentralized blockchain. The specific method is as follows:

[0064] Step 2.1: Generate a transaction IDx unique to the drug transaction; set Mx as the drug number, Orga and Orgb as the organization numbers of the two parties to the transaction, where Orga is the organization number of the transaction supplier, Orgb is the organization number of the transaction recipient, and Rx is the additional weight obtained by random;

[0065] Step 2.2: Create a new index information node Tx, whose storage structure is<Mx,IDx,Rx> ;

[0066] Step 2.3: The classification storage module first packages the transaction drug number and the generated transaction number to create a new information node and puts it into the sorting binary tree Treap with the drug number as the sorting weight to establish a global index tree;

[0067] The Treap used in this step is a sorted binary tree data structure that is optimized for the traditional Treap. It cancels the rotation method used by the traditional Treap to maintain the binary tree shape, and instead uses split (Split) and merge (Merge) operations to maintain the balanced shape of the binary tree to ensure the complexity of query insertion. Its splittable nature will be used to optimize the time complexity of subsequent query operations.

[0068] The technical principles are as follows:

[0069] Merge operation, such as Figure 3 As shown:

[0070] The merge operation merges two Treaps into one tree and obtains the root node of the new tree; the specific steps are as follows:

[0071] Step A: Before merging two subtrees Tr1 and Tr2, it must be ensured that the maximum weight in Tr1 is less than the maximum weight in Tr2. If one of the two trees is empty, the other tree is directly returned. If both are empty, an empty node is returned.

[0072] Step B: Compare the additional weights of the root nodes of the two subtrees, and use the point with the larger additional weight Rx as the root node of the new tree;

[0073] Step B.1: If the root of Tr1 is used as the new root, merge the right subtree of Tr1 with Tr2 and use the resulting root as the right child of Tr1;

[0074] Step B.2: If the root of Tr2 is used as the new root, merge the left subtree of Tr2 with Tr1 and use the resulting root as the left child of Tr2;

[0075] Recursively repeat steps A-B until the merge is complete;

[0076] Split operations, such as Figure 4 As shown:

[0077] Take Treap as the split point according to a certain sorting weight X, and divide it into two trees Tr1 and Tr2, where the weights of all nodes in Tr1 will be less than or equal to X, and the weights of all nodes in Tr2 will be greater than X; the split operation will obtain the root nodes of the two new trees; the specific steps are as follows:

[0078] Step A: Check whether the tree to be split is an empty tree. If it is an empty tree, the two trees after the split will have two empty nodes.

[0079] Step B: If the tree to be split is not an empty tree, compare whether the weight of the root node is less than or equal to X;

[0080] Step B.1: If the weight of the root node is less than or equal to X, then the root node and its left subtree are taken as Tr1, and its right subtree is split to obtain Tr1' and Tr2, and Tr1' is connected to Tr1 as its right subtree;

[0081] Step B.2: If the weight of the root node is greater than X, then the root node and its right subtree are taken as Tr2, and the right subtree is split to obtain Tr1 and Tr2', and Tr2' is connected to Tr2 as its left subtree;

[0082] Repeat the above steps recursively until the splitting is completed;

[0083] Step 2.4: Split the index tree into two trees Tr1 and Tr2 according to the drug number Mx, where the sorting weights of the nodes in Tr1 are all less than or equal to the drug number Mx, and the sorting weights of the nodes in Tr2 are all greater than the drug number Mx;

[0084] Step 2.5: Merge Tr1 and Tx into Tr3;

[0085] Step 2.6: Merge Tr3 and Tr2 into a new index tree, and the insertion is completed;

[0086] Step 2.7: Package and store sensitive data such as the organization numbers of both parties in this drug transaction and the generated transaction number into the decentralized blockchain;

[0087] Step 2.8: The classification storage module modifies the ownership of the drug in the centralized database and stores other relevant information of the drug.

[0088] The drug information query process is as follows Figure 5 As shown, the specific method is:

[0089] Step S1: The user inputs the query instruction into the drug traceability system through the input module;

[0090] Step S2: The input module transmits the query instruction and the drug information to be queried to the query module, and the query module performs drug information query or drug traceability query according to the query instruction type;

[0091] If the query instruction is the first type of query:

[0092] The query module will directly search the database with the name of the drug to be queried as the key value. If the search is successful, the query success instruction and the obtained drug information will be passed to the output module. If the search fails, only the query failure instruction will be fed back to the output module;

[0093] If the query instruction is the second type of query:

[0094] The query module obtains the transaction party organization number from the blockchain and transmits it to the transaction graph construction module; the transaction graph construction module constructs a directed acyclic graph of drug flow based on the obtained transaction party organization number and transmits it to the output module; the output module outputs the drug transaction traceability result. The specific method is as follows:

[0095] Step S2.1: The query module first checks whether the input drug number is legal. If it is illegal, the query will not be performed and the query failure instruction will be transmitted to the output module;

[0096] Step S2.2: If the drug number is legal, Figure 6As shown, the index tree is split into Tr1′ and Tr2′ according to the drug number Mx, wherein the sorting weights of the nodes in Tr1′ are all less than or equal to Mx, and the sorting weights of the nodes in Tr2′ are all greater than Mx;

[0097] Step S2.3: Split Tr1′ into Tr3′ and Tr4′ according to Mx-1, where the sorting weights of the nodes in Tr3′ are all less than Mx, and the sorting weights of the nodes in Tr4′ are all equal to Mx;

[0098] Step S2.4: traverse Tr4′, and use the transaction number in Tr4′ as the key to query the transaction party organization number corresponding to each transaction in the blockchain;

[0099] Step S2.5: merge Tr3′, Tr4′, and Tr2′ in order to restore the index tree;

[0100] Step S2.6: Transmitting the transaction party organization numbers obtained from the blockchain to the transaction graph construction module;

[0101] Step S2.7: The transaction graph construction module constructs a directed acyclic graph of drug flow through the obtained transaction party organization numbers and transmits it to the output module. The specific steps are as follows;

[0102] Step a: Extract all the transaction party organization numbers to obtain the point set V = {Orga1, Orgb1, Orga2, Orgb2, ..., Organ, Orgbn}, and use the transaction party organization numbers as directed edges.<Orga,Orgb> The edge set E = {<Orga1,Orgb1> ,<Orga2,Orgb2> ,...<Organ,Orgbn>}, where n is the total number of organization numbers of both transaction parties obtained by query;

[0103] Step b: Reconstruct the forward directed graph G(V,E) of the drug transaction, and add edges in the reverse direction to construct the reverse directed graph G'(V,E');

[0104] Step S2.8: Transmit the two directed graphs and transaction information data to the output module;

[0105] Step S3: The output module outputs the drug transaction traceability results.

[0106] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope defined by the claims of the present invention.

Claims

1. A drug traceability system based on blockchain, characterized by: It includes an input module, a classification storage module, a query module, a transaction graph construction module and an output module; the input module inputs the user's storage instructions and the drug data to be stored into the system; The input module transfers the received drug data to the classification storage module; the classification storage module is used to store different types of data into corresponding data structures; The input module transmits the user's query instruction and the information to be queried to the query module; The query module is used to receive query instructions and input the query results into the transaction graph construction module or the output module according to the query instruction type; the transaction graph construction module is used to construct the transaction graph required for drug traceability and transmit the transaction graph to the output module in the form of data information and image information; The output module is used to feed back all received information to the user; The classification storage module packages the organization numbers of both parties in the drug transaction and the generated transaction numbers and stores them in the decentralized blockchain. The specific method is: Step 2.1: Generate a transaction IDx unique to the drug transaction; set Mx as the drug number, Orga and Orgb as the organization numbers of the two parties to the transaction, where Orga is the organization number of the transaction supplier, Orgb is the organization number of the transaction recipient, and Rx is the additional weight obtained by random; Step 2.2: Create a new index information node Tx, whose storage structure is<Mx,IDx,Rx> ; Step 2.3: The classification storage module first packages the transaction drug number and the generated transaction number to create a new information node and puts it into the sorting binary tree Treap with the drug number as the sorting weight to establish a global index tree; Step 2.4: Split the index tree into two trees Tr1 and Tr2 according to the drug number Mx, where the sorting weights of the nodes in Tr1 are all less than or equal to the drug number Mx, and the sorting weights of the nodes in Tr2 are all greater than the drug number Mx; Step 2.5: Merge Tr1 and Tx into Tr3; Step 2.6: Merge Tr3 and Tr2 into a new index tree, and the insertion is completed; Step 2.7: Package and store sensitive data such as the organization numbers of both parties in this drug transaction and the generated transaction number into the decentralized blockchain; The specific method for the query module to query the blockchain to obtain the organization numbers of both parties to the transaction is: Step S2.1: The query module first checks whether the input drug number is legal. If it is illegal, the query will not be performed and the query failure instruction will be transmitted to the output module; Step S2.2: If the drug number is legal, split the index tree into , ,in, The sorting weights of the middle nodes are all less than or equal to Mx. The sorting weights of the middle nodes are all greater than Mx; Step S2.3: According to the Mx-1 split , ,in, The sorting weights of the middle nodes are all less than Mx. The sorting weights of the middle nodes are all equal to Mx; Step S2.4: Traversal , and The transaction number in is used as the key to query the organization numbers of both parties of each transaction in the blockchain; Step S2.5: , , Merge in order and restore the index tree; Step S2.6: Transmitting the transaction party organization numbers obtained from the blockchain to the transaction graph construction module; The transaction graph construction module constructs a directed acyclic graph of drug flow through the obtained transaction party organization numbers, and the specific method is as follows: Step a: Extract all the transaction party organization numbers to obtain the point set V = {Orga1, Orgb1, Orga2, Orgb2, ..., Organ, Orgbn}, and use the transaction party organization numbers as directed edges<Orga,Orgb> The edge set E={<Orga1,Orgb1> ,<Orga2,Orgb2> ,...< Organ, Orgbn >}, where n is the total number of organization numbers of both transaction parties obtained by query; Step b: Reconstruct the forward directed graph G(V,E) of the drug transaction, and add reverse edges to construct the reverse directed graph G'(V,E').

2. The drug traceability system based on blockchain according to claim 1 is characterized by: The drug data is divided into two categories, among which the first category is the basic information data of the drug; the second category is the transaction information data of the drug, including the drug number and the organization number of the two parties to the transaction; the drug number is a unique number obtained after a drug is produced, which is used as a feature code to identify the drug; the first category of data is general data and will be stored in a centralized database; the second category of information is sensitive data and will be stored in the blockchain.

3. The drug traceability system based on blockchain according to claim 1 is characterized in that: The query instructions are divided into two categories. The first category is drug information query, and the user will also enter the name of the drug to be queried; the second category is traceability query; When the query instruction is of the first type, the query module will directly search for the drug to be queried in the centralized database. If the search is successful, the query success instruction and the obtained drug information will be passed to the output module. If the search fails, only the query failure instruction will be fed back to the output module. When the query instruction is of the second type, the query module will check whether the drug number is legal after receiving the query instruction. If it is illegal, the query will not be performed and the query failure instruction will be passed to the output module. If it is legal, the drug number of the drug to be traced will be used as the sorting weight to split all the transaction numbers of the drug in the splittable binary sorting tree Treap, and the corresponding transaction information will be queried in the blockchain and then passed to the transaction graph construction module; the transaction graph construction module constructs a directed acyclic graph of the drug flow through the obtained transaction information and passes it to the output module.

4. A blockchain-based drug traceability storage and access optimization method, implemented based on the system described in claim 1, characterized in that: It includes two parts: drug information storage and drug information query. The specific method of storing the medicine is as follows: Step 1: The user inputs the storage instruction and the drug data to be stored into the drug traceability system through the input module; Step 2: The input module transfers the received data to the classification storage module, and the classification storage module stores the drug data in different ways according to the type of drug data; If the drug data is the first category of data: The classification storage module will directly call the database interface and store the received data into the centralized database; If the drug data is the second type of data, the classification storage module packages the organization numbers of both parties in the drug transaction and the generated transaction number and stores them in the decentralized blockchain; The specific method for querying drug information is as follows: Step S1: The user inputs the query instruction into the drug traceability system through the input module; Step S2: The input module transmits the query instruction and the drug information to be queried to the query module, and the query module performs drug information query or drug traceability query according to the query instruction type; If the query instruction is the first type of query: The query module will directly search the database with the name of the drug to be queried as the key value. If the search is successful, the query success instruction and the obtained drug information will be passed to the output module. If the search fails, only the query failure instruction will be fed back to the output module; If the query instruction is the second type of query: the query module obtains the organization numbers of the two parties to the transaction in the blockchain and transmits them to the transaction graph construction module; the transaction graph construction module constructs a directed acyclic graph of the drug flow through the obtained organization numbers of the two parties to the transaction and transmits it to the output module; the output module outputs the drug transaction traceability results.

Citation Information

Patent Citations

  • Intelligent drug tracing system

    CN104574242A

  • Data source tracing method and system based on big data model analysis platform

    CN106055676A