Monitoring and management method and system for drug sales information
By constructing a drug sales blockchain network and electing leader server nodes to verify drug sales contracts, the problem of insufficient data security and transparency in drug sales supervision in Internet of Things technology is solved, and efficient, reliable and intelligent supervision of the drug sales process is achieved. .
Patent Information
- Application Number
- CN202410707746.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-03
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-03
AI Technical Summary
Existing IoT technology has problems with insufficient data security and transparency in drug sales supervision. It is susceptible to hacker attacks and data leaks. The number of devices is large and widely distributed, making security management and monitoring difficult.
By building a drug sales blockchain network, blockchain technology is used to import drug sellers and drug basic information into the blockchain, generate blockchain public keys, elect leadership server nodes to verify drug sales contracts, and pass multi-level blockchain The system encrypts and stores data, establishes a connection between the drug supervision system and the blockchain, and achieves high transparency and non-tamperability of data.
Effectively prevent data fraud and information asymmetry, ensure the compliance and legality of the drug sales process, enhance data security and integrity, improve regulatory efficiency and response speed, and provide a more efficient, reliable and intelligent drug sales supervision solution plan.
Smart Images

Figure CN118278961B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of online management of drug sales, and in particular relates to a monitoring and management method and system for drug sales information. Background Art
[0002] The significance of supervising drug sales information is to ensure public health and safety and prevent substandard drugs from entering the market. In the traditional supervision process, traditional manual regular or irregular sampling is usually used to inspect the circulation and use links, and its inspection and supervision efficiency is low. With the continuous development of technology, it has been possible to use Internet of Things technology to realize online drug sales supervision. Through sensors, RFID tags, smart devices and other technical means, the status and location of drugs in various sales links can be monitored in real time, thereby realizing drug sales traceability, ensuring that the source of drugs can be checked, effectively preventing counterfeit and inferior drugs from entering the market, and improving the efficiency and transparency of drug sales supervision.
[0003] However, in the current stage of using IoT technology to supervise drug sales, there is a risk of hacker attacks and data leakage in the data collection, transmission and storage processes. Since drug sales involve sensitive commercial and personal information, once the data is stolen or tampered with, it will not only cause economic losses, but also endanger the health and safety of consumers. In addition, the number of IoT devices is huge and widely distributed, making security management and monitoring difficult. In order to solve the above problems, a safer method for drug sales supervision is urgently needed. Summary of the invention
[0004] The present invention provides a monitoring and management method and system for drug sales information to solve the problem of data insecurity in the process of drug sales supervision.
[0005] In a first aspect, the present invention provides a method for monitoring and managing drug sales information, the method comprising the following steps:
[0006] Obtaining the basic information of all drug sellers in the target area and the basic information of all drugs sold by the drug sellers through the drug IoT management system, wherein the basic information includes drug coding information, drug prescription information, drug inventory information and drug price information;
[0007] According to the server addresses of the servers deployed by the drug sellers, all the drug sellers are divided into different network areas, and the servers in each of the network areas are used as server nodes to build a blockchain network to obtain multiple primary drug sales blockchains, and the basic information of the sellers is imported into the corresponding primary drug sales blockchain through the server nodes, and the basic information of the drugs is imported into all the primary drug sales blockchains through the server nodes;
[0008] Randomly generate a blockchain public key of the primary drug sales blockchain, and randomly select a server node in the primary drug sales blockchain as a broadcast server node, the broadcast server node is used to interact with all other server nodes using the blockchain public key to construct a blockchain key set of the primary drug sales blockchain;
[0009] Calculate the node reliability of each server node, and select the leading server node in the primary drug sales blockchain in combination with the node reliability of the blockchain key set;
[0010] Using the leading server node and based on the basic drug information, verifying the drug sales contract in the primary drug sales blockchain, broadcasting the successfully verified qualified drug sales contract to other server nodes in the primary drug sales blockchain through the leading server node, the drug sales contract is created based on the drug seller according to the seller basic information and the purchase application of the drug buyer;
[0011] Combining the qualified drug sales contract and the basic drug information and encrypting them with the blockchain key set, the drug sales data of the first-level drug sales blockchain is generated;
[0012] Configure a regional server for each of the network areas, build a secondary drug sales blockchain based on all the regional servers, and upload the drug sales data of the primary drug sales blockchain to the secondary drug sales blockchain through the leading server node;
[0013] Establish a connection between the secondary drug sales blockchain and the drug regulatory system of the target area, obtain the blockchain key set corresponding to the primary drug sales blockchain through the regional server, generate a primary blockchain key pair according to the blockchain key set through the regional server, and send the primary blockchain key pair to the drug regulatory system.
[0014] Optionally, the broadcast server node uses the blockchain public key to interact with all other server nodes to construct the blockchain key set of the primary drug sales blockchain, including the following steps:
[0015] The broadcast server node combines the blockchain public key and the locally preset node number and uses the asymmetric encryption algorithm to generate a broadcast node private key;
[0016] The broadcast server node broadcasts the blockchain public key to all other server nodes;
[0017] The broadcast server node receives the node signature fed back by the server node, and marks the server node that has fed back the node signature as an alternative server node, the node signature is generated by the node private key of the server node, the node private key is generated by the server node in combination with the blockchain public key and the locally preset node number and using the asymmetric encryption algorithm, the broadcast node private key, the blockchain public key and all the node private keys are combined into a blockchain key set.
[0018] Optionally, the node reliability of each server node is obtained by calculation, and the leading server node in the primary drug sales blockchain is selected in combination with the node reliability of the blockchain key set, including the following steps:
[0019] Calculating and obtaining the node reliability of each of the server nodes;
[0020] Combining the blockchain public key and the node reliability of all the candidate server nodes to generate a candidate node ballot set;
[0021] The broadcast server node generates a broadcast node signature using the broadcast node private key and adds the broadcast node signature to the candidate node ballot set, and broadcasts the candidate node ballot set to all other server nodes through the broadcast server node, and the server node is used to generate a node signature ballot in combination with the node private key and the node reliability;
[0022] Recover and verify the node signature ballots generated by all other server nodes through the broadcast server node;
[0023] Combine all the node signature votes to elect the leading server node in the primary drug sales blockchain.
[0024] Optionally, the server node generates a node signature ballot in combination with the node private key and the node reliability, comprising the following steps:
[0025] The server node verifies the blockchain public key and the broadcast node signature in the candidate node ballot set using the node private key;
[0026] After successful verification, the server node compares the node reliability of the candidate server nodes in the candidate node ballot set with its own node reliability in sequence;
[0027] The server node generates a node ballot according to the comparison result, wherein the server node in the node ballot only supports the candidate server node whose reliability is greater than that of the server node itself;
[0028] The server node generates a ballot ring signature of the node ballot using the node private key to obtain a node signature ballot.
[0029] Optionally, before using the leading server node and verifying the drug sales contract in the primary drug sales blockchain according to the drug basic information, the following steps are also included:
[0030] When the drug seller receives a purchase application from a drug buyer through the server node, identifying sensitive information in the purchase application, the sensitive information including purchase quantity information, purchaser prescription information and purchaser basic information;
[0031] The purchase quantity information and the basic information of the purchaser are fully encrypted using the node private key of the server node;
[0032] Using the node private key of the server node to encrypt the contents of the purchaser's prescription information except the disease number;
[0033] A drug sales contract is created in the primary drug sales blockchain through the server node in combination with the seller's basic information and the encrypted purchase application.
[0034] Optionally, the verifying the drug sales contract in the primary drug sales blockchain using the leading server node and based on the drug basic information comprises the following steps:
[0035] Using the leading server node to identify whether the drug code information contains the same drug code as the drug purchased in the drug sales contract;
[0036] If there is no drug code identical to the drug ordered in the drug sales contract, rejecting the corresponding drug sales contract through the leading server node;
[0037] If there is a drug code that is the same as the drug purchased in the drug sales contract, then using the leading server node to query in the drug prescription information whether there is a corresponding relationship between the drug code and the disease number in the drug sales contract;
[0038] If there is no corresponding relationship, the corresponding drug sales contract is rejected by the leading server node;
[0039] If there is a corresponding relationship, the leading server node is used to query the drug inventory information to see whether the drug inventory quantity corresponding to the drug code is lower than a preset inventory threshold;
[0040] If the inventory is lower than the inventory threshold, the corresponding drug sales contract is rejected through the leading server node;
[0041] If it is not lower than the inventory threshold, the leading server node is used to query the drug price information whether the purchase price corresponding to the drug code in the drug sales contract is within a preset drug price range;
[0042] If it is not within the drug price range, the corresponding drug sales contract is rejected through the leading server node;
[0043] If it is within the drug price range, the leader node signature is added to the drug sales contract through the leader server node according to the leader node private key.
[0044] Optionally, in establishing a connection between the secondary drug sales blockchain and the drug regulatory system of the target region, obtaining the blockchain key set corresponding to the primary drug sales blockchain through the regional server, generating a primary blockchain key pair according to the blockchain key set through the regional server, and sending the primary blockchain key pair to the drug regulatory system, the following steps are also included:
[0045] Sending a quantity statistics request to the drug supervision system through the regional server;
[0046] Obtaining the drug sales quantity fed back by the drug regulatory system in response to the quantity statistics request, wherein the drug sales quantity includes the sales quantity of all drugs corresponding to the drug coding information, and the drug sales quantity is calculated based on the decrypted drug sales data;
[0047] Sort the corresponding drug coding information in descending order according to the sales quantity of the drug;
[0048] Selecting the drug coding information in sequence according to the sorting results, and storing the drug sales data containing the selected drug coding information in the leading server node in the primary drug sales blockchain until the data storage capacity of the leading server node exceeds the storage upper limit;
[0049] The remaining drug sales data not stored in the leading server node is stored in the regional server.
[0050] Optionally, generating a primary blockchain key pair according to the blockchain key set by the regional server, and sending the primary blockchain key pair to the drug supervision system comprises the following steps:
[0051] Generate a primary block private key through the regional server and according to the hash value of the last block in the primary drug sales blockchain;
[0052] Using the primary block private key to encrypt all node private keys in the blockchain key set;
[0053] The first-level block private key and the blockchain public key in the blockchain key set are combined to generate a first-level blockchain key pair of the first-level drug sales blockchain, and the first-level blockchain key pair is sent to the drug supervision system through the regional server.
[0054] Optionally, after broadcasting the successfully verified qualified drug sales contract to other server nodes in the primary drug sales blockchain through the leading server node, the following steps are also included:
[0055] Obtaining drug traceability information corresponding to the drug coding information contained in the qualified drug sales contract through the drug IoT management system, wherein the drug traceability information includes drug production information, drug packaging information, and drug transportation information;
[0056] Uploading the drug traceability information to the primary drug sales blockchain through the server node corresponding to the qualified drug sales contract;
[0057] In response to a traceability application issued by a drug purchaser on the secondary drug sales blockchain, the blockchain public key is sent to the drug purchaser through the regional server.
[0058] In a second aspect, the present invention also provides a monitoring and management system for drug sales information, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the monitoring and management method for drug sales information as described in the first aspect is implemented.
[0059] The beneficial effects of the present invention are:
[0060] Compared with the prior art, the present invention has the advantage of significant effect in drug sales supervision using Internet of Things technology. First, by importing drug sellers and basic drug information into the primary drug sales blockchain, the high transparency and non-tamperability of information are achieved, which effectively prevents data falsification and information asymmetry. Secondly, the leading server node verifies and broadcasts qualified drug sales contracts, ensures the compliance and legality of the drug sales process, and avoids the circulation of illegal drugs. The secondary drug sales blockchain is constructed through the regional server, and the data of the primary blockchain is linked to the secondary blockchain, forming a multi-level supervision system, which further enhances the security and integrity of the data. Finally, the connection between the secondary blockchain and the drug supervision system is established, which realizes the real-time monitoring and management of drug sales data by the regulatory authorities, and improves the supervision efficiency and response speed. Through the above steps, not only the deficiencies of traditional Internet of Things technology in data security, transparency and traceability are solved, but also a more efficient, reliable and intelligent solution is provided for drug sales supervision. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 This is a flowchart of a method for monitoring and managing drug sales information in one of the implementation modes of the present application.
[0062] Figure 2 A schematic diagram of the framework of a method for monitoring and managing drug sales information in one of the implementation modes of the present application.
[0063] Figure 3 This is a schematic diagram of the framework of the drug sales blockchain in one of the implementation methods of the present application. DETAILED DESCRIPTION
[0064] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0065] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0066] Figure 1 FIG. 1 is a flow chart of a method for monitoring and managing drug sales information in one embodiment. It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps in the above method may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps. Figure 1 As shown, a monitoring and management method for drug sales information disclosed in the present invention specifically includes the following steps:
[0067] S101. Obtain the basic seller information of all drug sellers in the target area and the basic drug information of all drugs sold by the drug sellers through the drug IoT management system.
[0068] Among them, the basic information of drugs includes drug coding information, drug prescription information, drug inventory information and drug price information. The basic information of all drug sellers in the target area and the basic information of all drugs sold by drug sellers can be obtained through the drug IoT management system. Specifically, sensors, RFID tags and smart devices in IoT technology can be used to collect and transmit the basic information of drug sellers and detailed information of the drugs sold in real time, including drug coding, prescriptions, inventory and prices. Specific implementation methods may include installing IoT devices in the warehouses, transportation vehicles and sales terminals of drug sellers. These devices can monitor the storage conditions and circulation process of drugs in real time and upload the data to the central management system. Another implementation method is to automatically collect and upload relevant data through the ERP system of drug sellers to ensure the accuracy and real-time nature of the information. In addition, mobile applications or web platforms can be used to allow drug sellers to enter and update information by themselves.
[0069] S102. All drug sellers are divided into different network areas according to the server addresses of the servers deployed by the drug sellers, and the servers in each network area are used as server nodes to build a blockchain network to obtain multiple first-level drug sales blockchains. The basic information of the sellers is imported into the corresponding first-level drug sales blockchain through the server nodes, and the basic information of the drugs is imported into all first-level drug sales blockchains through the server nodes.
[0070] Among them, refer to Figure 2, using the decentralized, tamper-proof and traceable characteristics of blockchain to manage and monitor the drug sales process. Specifically, first, according to the geographical location or IP address of the drug seller's server, it is divided into different network areas to reduce network latency and improve data transmission efficiency. Then, several servers are selected as nodes in each network area to build the corresponding first-level drug sales blockchain network. Each server node is responsible for recording and storing the basic information of the drug seller and the basic information of the drug in the area, including drug coding, prescriptions, inventory and prices. Through blockchain technology, these data are distributed and stored on multiple nodes to ensure the security and integrity of the data. Another feasible implementation method is to adopt a hybrid blockchain architecture, that is, using private chains or alliance chains in the first-level blockchain to improve data processing speed and privacy protection, while using public chains at a higher level to achieve the openness and transparency of global data.
[0071] S103. Randomly generate a blockchain public key of the primary drug sales blockchain, and randomly select a server node in the primary drug sales blockchain as a broadcast server node. The broadcast server node is used to interact with all other server nodes using the blockchain public key to build a blockchain key set of the primary drug sales blockchain.
[0072] First, a blockchain public key is randomly generated in the primary drug sales blockchain, which will be used to encrypt and verify the data on the blockchain. Next, a broadcast server node is randomly selected from all server nodes in the primary blockchain, and the responsibility of this node is to broadcast the generated blockchain public key to all other server nodes in the network. The broadcast server node interacts with other nodes through a secure communication protocol (such as TLS or SSL) to ensure that the transmission process of the public key is safe and reliable. After receiving the public key, other server nodes will use the public key to generate their own key pair and store their private keys securely. In this way, all nodes can use the blockchain public key and their respective private keys to perform data encryption and decryption operations to ensure the security and integrity of data during transmission and storage.
[0073] Another feasible implementation method is to use multi-signature technology. In this way, not only one blockchain public key is generated, but multiple public keys are generated. After receiving multiple public keys, each node generates its own private key and encrypts and verifies data through a multi-signature mechanism. The specific steps include: First, randomly generate multiple blockchain public keys and broadcast these public keys to all server nodes. After receiving these public keys, each node generates multiple corresponding private keys and stores these private keys securely. Then, when encrypting and verifying data, the node needs to use multiple private keys to sign to ensure high security and reliability of the data.
[0074] S104. Calculate the node reliability of each server node, and select the leading server node in the first-level drug sales blockchain based on the reliability of the blockchain key set node.
[0075] Among them, by evaluating the reliability of each server node, a node that is most suitable for the leadership role is selected to ensure the efficient operation of the blockchain network and the security of data. Specifically, the reliability of each server node is calculated first, which can be evaluated through a variety of parameters, such as the node's online time, response speed, data processing capacity, historical failure rate, etc. Each parameter can be assigned a different weight, and a comprehensive node reliability score is calculated based on these weights. Next, these scores are combined with the node reliability in the blockchain key set to comprehensively consider the node's performance in key management and overall reliability.
[0076] One possible implementation is to use a weighted scoring system. The specific steps include: assigning a weight to each evaluation parameter, such as 40% for online time, 30% for response speed, 20% for data processing capacity, and 10% for historical failure rate. Then, score each node, multiply the score by the corresponding weight, and finally add up all the weighted scores to get a comprehensive reliability score for each node. Combining these scores with the node's performance in blockchain key management, a similar weighted scoring method can be used to weighted average the key management performance and the comprehensive reliability score to get the final node reliability score. Based on these scores, the node with the highest score is selected as the leader server node.
[0077] In another implementation, a voting mechanism can also be used to elect a leader node. Specifically, the reliability score of each node is calculated first, and then these scores are announced to all nodes. All nodes vote based on the scores and select the node they think is most reliable as the leader server node. This method can increase the transparency and participation of the system and ensure that the selected leader node has wide recognition. By calculating and combining the node reliability to elect the most suitable leader server node, the efficient operation of the blockchain network and the security of the data can be ensured. The leader server node plays a key role in the blockchain network, responsible for coordinating the work of other nodes and ensuring the correctness and consistency of the data.
[0078] S105. Use the leading server node to verify the drug sales contract in the primary drug sales blockchain based on the basic drug information, and broadcast the successfully verified qualified drug sales contract to other server nodes in the primary drug sales blockchain through the leading server node. The drug sales contract is created based on the drug seller according to the seller's basic information and the drug buyer's purchase application.
[0079] Among them, the legality and accuracy of the drug sales contract are ensured through the authoritative verification of the leader server node, thereby maintaining the security of the blockchain network and the reliability of the data. The drug seller creates a drug sales contract based on the basic information of the seller and the purchase application of the drug buyer. The contract contains detailed information of the drug, the seller's qualification certificate, the buyer's needs and other data. Then, the contract is submitted to the leader server node for verification. After receiving the drug sales contract, the leader server node will strictly verify it based on the basic information of the drug (drug coding information, drug prescription information, drug inventory information, drug price information, etc.) and the seller's qualification information. The verification process includes checking whether the drug information in the contract is consistent with the basic information of the drug stored in the blockchain to ensure the legality and authenticity of the drug; checking the seller's qualification information to ensure that the seller has legal sales authority; verifying the buyer's purchase application to ensure that it meets the relevant requirements. Through these verification steps, the leader server node can ensure the legality and accuracy of the drug sales contract.
[0080] After successful verification, the leading server node broadcasts the qualified drug sales contract to other server nodes in the primary drug sales blockchain through a secure communication protocol (such as TLS or SSL). After receiving the contract, all nodes will conduct a secondary verification to ensure that the contract has not been tampered with during transmission, and store the contract in the blockchain to form an unalterable record. Through the authoritative verification and broadcast mechanism of the leading server node, the legitimacy and accuracy of the drug sales contract are ensured, and the security of the blockchain network and the reliability of the data are maintained.
[0081] In another implementation, this step can also be implemented using smart contract technology. The specific implementation is: when the drug seller creates a drug sales contract, the contract information is written into the smart contract, and the smart contract contains automatic verification logic. After receiving the smart contract, the leading server node will trigger the verification logic in the contract to automatically check the basic information of the drug, the seller's qualification information, and the legitimacy of the buyer's purchase application. After the verification is passed, the smart contract will automatically broadcast the qualified drug sales contract to other server nodes, and other nodes will store and record it after receiving the contract.
[0082] S106. Generate drug sales data of the first-level drug sales blockchain by combining qualified drug sales contracts and basic drug information and encrypting them with the blockchain key set.
[0083] Among them, first, the drug sales contract is verified by the leading server node to confirm its legitimacy and accuracy. Next, the qualified drug sales contract is integrated with the basic drug information to form a complete drug sales data package, that is, the blockchain ledger of the first-level drug sales blockchain. After the integration is completed, the drug sales data is encrypted using the blockchain key set. The blockchain key set is jointly maintained by the leading server node and other server nodes to ensure the security and distribution of the key. The specific encryption process includes: first, part of the drug sales data is encrypted using the blockchain public key to ensure that only the node holding the corresponding private key can decrypt and access the data. Then, the encrypted data is broadcast to all server nodes in the first-level drug sales blockchain. After receiving the encrypted data, each node will use its private key to decrypt it, verify the integrity and authenticity of the data, and store it in the blockchain to form an unalterable record. By integrating the verified drug sales contract with the basic drug information and encrypting these data using the blockchain key set, safe and reliable drug sales data is generated to ensure the integrity and unalterability of the data during transmission and storage.
[0084] S107. Configure a regional server for each network area, build a secondary drug sales blockchain based on all regional servers, and upload the drug sales data of the primary drug sales blockchain to the secondary drug sales blockchain through the leading server node.
[0085] Among them, Figure 2As shown, one or more regional servers are configured in each network area, and these servers jointly maintain the primary drug sales blockchain network in the area. Each regional server is responsible for processing drug sales data in the region, including receiving, verifying, storing and broadcasting drug sales contracts. The regional servers use consensus mechanisms (such as PoW, PoS or PBFT) to ensure data consistency and integrity. Next, a secondary drug sales blockchain network is built based on all regional servers. The secondary blockchain is jointly maintained by the leader server nodes in each region, which are responsible for uploading the drug sales data in the region to the secondary blockchain. The leader server node packages the encrypted and verified drug sales data into blocks regularly or when the data is updated. Then, these blocks are broadcast to other leader server nodes in the secondary blockchain network through secure communication protocols (such as TLS or SSL). All leader server nodes verify and confirm the new data through a consensus mechanism to ensure the integrity and consistency of the data. The confirmed data blocks will be added to the secondary blockchain to form an unalterable record. By configuring dedicated regional servers in each network area, a regional-level primary drug sales blockchain network is formed, and a higher-level secondary drug sales blockchain is built on this basis. The leading server node is responsible for aggregating the drug sales data in its primary blockchain and uploading it to the secondary blockchain to achieve cross-regional data integration and sharing.
[0086] Another feasible implementation is to adopt a layered blockchain architecture. The specific steps include: configuring regional servers in each network area to form a primary blockchain network. Each regional server is responsible for processing drug sales data in the region and maintaining the blockchain in the region. Then, in the secondary blockchain layer, configure a central coordination node or multiple coordination nodes, which are responsible for receiving drug sales data from the leading server nodes in each region. The leading server node packages the data in the region into blocks, and after encryption and verification, sends it to the central coordination node. The central coordination node is responsible for integrating these blocks and uplinking them to the secondary blockchain to ensure the integrity and consistency of cross-regional data.
[0087] By configuring regional servers for each network area and building a secondary drug sales blockchain, cross-regional drug sales data integration and sharing are achieved. The leading server node is responsible for uploading the data in the primary blockchain to the secondary blockchain to ensure the security and integrity of the data. Regulators can monitor drug sales in each region in real time through the secondary blockchain, quickly discover and handle abnormal situations, and prevent counterfeit and substandard drugs from entering the market.
[0088] S108. Establish a connection between the secondary drug sales blockchain and the drug regulatory system of the target area, obtain the blockchain key set in the corresponding primary drug sales blockchain through the regional server, generate a primary blockchain key pair based on the blockchain key set through the regional server, and send the primary blockchain key pair to the drug regulatory system.
[0089] Among them, a secure communication channel is established between the secondary drug sales blockchain and the drug regulatory system of the target area, and an encryption protocol (such as TLS or SSL) is used to ensure the security and integrity of data transmission. Then, the blockchain key set in the corresponding primary drug sales blockchain is obtained through the regional server. The regional server is responsible for extracting the key set from the primary blockchain, which contains public and private key information for data encryption and decryption. The regional server uses the information in the blockchain key set to generate a public key and a private key pair through a predetermined encryption algorithm. The generated public and private key pairs are used to encrypt and decrypt the drug sales data in the primary blockchain to ensure the security and integrity of the data. After generating the key pair, the regional server sends the primary blockchain key pair to the drug regulatory system of the target area through a secure communication channel. After receiving the key pair, the drug regulatory system uses these key pairs to decrypt and verify the data, thereby obtaining the drug sales data in the primary blockchain. By establishing a secure connection between the secondary drug sales blockchain and the drug regulatory system of the target area, it is ensured that the regulatory system can effectively obtain and verify the drug sales data in the primary blockchain, thereby realizing real-time supervision and traceability of drug sales.
[0090] In one embodiment, the process in step S103 where the broadcast server node interacts with all other server nodes using the blockchain public key to construct the blockchain key set of the primary drug sales blockchain specifically includes the following steps:
[0091] The broadcast server node combines the blockchain public key and the locally preset node number and uses an asymmetric encryption algorithm to generate a broadcast node private key;
[0092] The broadcast server node broadcasts the blockchain public key to all other server nodes;
[0093] The broadcast server node receives the node signature fed back by the server node, and marks the server node that has fed back the node signature as an alternative server node. The node signature is generated by the node private key of the server node. The node private key is generated by the server node combining the blockchain public key and the locally preset node number and using an asymmetric encryption algorithm. The broadcast node private key, the blockchain public key and all node private keys are combined into a blockchain key set.
[0094] In this embodiment, the broadcast server node combines the blockchain public key and the locally preset node number (each node's unique identifier in the network) to generate a broadcast node private key using an asymmetric encryption algorithm. An asymmetric encryption algorithm is an encryption method in which a pair of keys are used for encryption and decryption operations. The broadcast node private key is a key that is exclusive to the broadcast server node and is used to sign and decrypt data. The broadcast server node then broadcasts the blockchain public key to all other server nodes. Broadcasting refers to sending information to all nodes in the network, not just a single node. Through broadcasting, all server nodes can receive the blockchain public key.
[0095] Then, the server node that receives the blockchain public key combines the blockchain public key and its own local preset node number, and uses an asymmetric encryption algorithm to generate its own node private key. The node private key is a key that is exclusive to each server node and is used to sign and decrypt data. The server node uses the generated node private key to sign its own identity information and generate a node signature. The node signature is a digital signature generated by the node private key, which is used to verify the identity of the node and the integrity of the data. The server node feeds back the node signature to the broadcast server node. After receiving these feedback node signatures, the broadcast server node marks the server node that feeds back the node signature as an alternative server node. Alternative server nodes refer to those server nodes that have passed identity authentication and can participate in the consensus and data transmission process of the blockchain network. Finally, the broadcast node private key, the blockchain public key and all node private keys are combined into a blockchain key set. The blockchain key set is a collection of all node private keys and blockchain public keys, which is used for data encryption, decryption and signing operations of the entire blockchain network to ensure the security and immutability of data during transmission.
[0096] The broadcast server node combines the blockchain public key and the locally preset node number to generate a broadcast node private key, and broadcasts the blockchain public key to all server nodes, ensuring the identity authentication of each node in the blockchain network and the security of data transmission. Each server node generates a node signature through the node private key and feeds it back to the broadcast server node, ensuring the validity and integrity of the nodes in the network. The final blockchain key set is used for data encryption, decryption and signature operations of the entire network, ensuring the security and non-tamperability of data during transmission. This solution not only improves the security and reliability of the blockchain network, but also improves the efficiency and transparency of data management, providing a solid technical guarantee for the application of blockchain technology.
[0097] In one implementation manner, step S104 specifically includes the following steps:
[0098] Calculate the node reliability of each server node;
[0099] Generate a candidate node ballot set by combining the blockchain public key and the node reliability of all candidate server nodes;
[0100] Generate a broadcast node signature using the broadcast node private key through the broadcast server node and add the broadcast node signature to the candidate node ballot set. Broadcast the candidate node ballot set to all other server nodes through the broadcast server node. The server node is used to generate a node signature ballot by combining the node private key and the node reliability.
[0101] Recover and verify the node signature ballots generated by all other server nodes through the broadcast server node;
[0102] Combine all node signature votes to elect the leading server node in the primary drug sales blockchain.
[0103] In this embodiment, node reliability is an indicator to measure the performance of server nodes in the network, and is usually calculated based on factors such as the node's historical behavior, response time, processing power, and data integrity. There are many ways to calculate node reliability, such as through a comprehensive scoring system, statistical analysis based on historical data, or prediction using a machine learning algorithm. The comprehensive scoring system can use a weighted average method to weight different factors according to their importance and calculate the comprehensive score of each node. For example, the weights of response time, processing power, data integrity, and historical behavior records can be set to 0.3, 0.3, 0.2, and 0.2 respectively, and then the scores of each factor are multiplied by the corresponding weights, and finally the sum is obtained to obtain the comprehensive score of the node. The specific weight setting can be adjusted according to actual needs.
[0104] The candidate node ballot set is generated by combining the blockchain public key and the node reliability of all candidate server nodes. The candidate node ballot set is a set of all candidate server nodes and their corresponding reliability, which is used in the subsequent election process. Specifically, the reliability of each candidate server node will be encrypted together with the blockchain public key to generate a unique ballot. The broadcast server node then uses the broadcast node private key to generate a broadcast node signature and adds the signature to the candidate node ballot set. The broadcast node signature is a digital signature generated by the broadcast node private key to ensure the authenticity and integrity of the ballot set. The broadcast server node broadcasts the candidate node ballot set with the signature to all server nodes so that each node can receive the information.
[0105] The server node generates a node signature ballot based on its own node private key and node reliability. The node signature ballot is a digital signature generated by the node private key and node reliability, which is used to verify the identity and reliability of the node. The server node feeds the generated node signature ballot back to the broadcast server node. The broadcast server node recycles and verifies the node signature ballots generated by all server nodes. Through verification, the broadcast server node can ensure the authenticity and integrity of each node signature ballot. Finally, all node signature ballots are combined to elect the leader server node in the primary drug sales blockchain. The leader server node is jointly elected by all nodes, has high reliability and processing power, and is responsible for coordinating and managing data transmission and consensus processes in the blockchain network.
[0106] This technical solution ensures the fairness and transparency of the election process by calculating the node reliability and generating a set of candidate node ballots. The broadcast node signature generated by the private key of the broadcast node and the node signature ballot generated by each server node ensure the authenticity and immutability of the ballot. The leader server node finally selected has high reliability and processing power, and can effectively coordinate and manage data transmission and consensus processes in the blockchain network. This solution not only improves the security and reliability of the blockchain network, but also improves the efficiency and transparency of network management, providing a solid technical guarantee for the application of the first-level drug sales blockchain.
[0107] In other implementations, historical behavior data of each server node may be collected, including response time, processing capacity, and data integrity, and then the collected historical data may be processed using statistical analysis methods to calculate the reliability of each node. Historical behavior data of a large number of server nodes may also be collected as training data for a machine learning model. A machine learning algorithm may be used to train the model to predict the reliability of each node.
[0108] In this embodiment, the process of the server node generating a node signature ballot by combining the node private key and the node reliability specifically includes the following steps:
[0109] The server node uses the node private key to verify the blockchain public key and broadcast node signature in the candidate node ballot set;
[0110] After successful verification, the server node compares the node reliability of the candidate server nodes in the candidate node ballot set with its own node reliability in turn;
[0111] The server node generates a node ballot based on the comparison results. In the node ballot, the server node only supports the candidate server nodes whose node reliability is greater than its own;
[0112] The server node uses the node private key to generate the ballot ring signature of the node ballot and obtains the node signature ballot.
[0113] In this embodiment, the server node uses the node private key to verify the blockchain public key and broadcast node signature in the candidate node ballot set. The candidate node ballot set contains all candidate server nodes and their corresponding reliability information, and is signed by the broadcast node to ensure its authenticity. The server node uses its own node private key for verification to ensure that the blockchain public key and broadcast node signature in the ballot set are valid and have not been tampered with. After successful verification, the server node compares the node reliability of the candidate server nodes in the candidate node ballot set with its own node reliability in turn. The purpose of this step is to evaluate whether the reliability of each candidate server node is higher than its own reliability. During the comparison process, the server node checks the reliability scores of the candidate nodes one by one and records the comparison results.
[0114] According to the comparison results, the server node generates a node ballot. In the node ballot, the server node only supports those candidate server nodes whose reliability is greater than its own. This ensures that the nodes included in the ballot are more reliable nodes, thereby improving the reliability and stability of the entire network. Finally, the server node uses the node private key to generate a ballot ring signature for the node ballot and obtains a node signature ballot. Ring signature is a special digital signature technology that ensures the anonymity and untraceability of the signature while ensuring the authenticity and integrity of the signature. By generating a ring signature, the server node can effectively protect its own identity while ensuring the authenticity of the ballot.
[0115] In one embodiment, before using the leading server node to verify the drug sales contract in the primary drug sales blockchain according to the drug basic information in step S105, the following steps are also included:
[0116] When the drug seller receives a purchase application from a drug buyer through a server node, the drug seller identifies sensitive information in the purchase application, including purchase quantity information, purchaser prescription information, and purchaser basic information;
[0117] The purchase quantity information and the basic information of the purchaser are fully encrypted using the node private key of the server node;
[0118] The node private key of the server node is used to encrypt the contents of the purchaser's prescription information except the disease number;
[0119] The drug sales contract is created in the primary drug sales blockchain through the server node, combining the seller's basic information and the encrypted purchase application.
[0120] In this embodiment, when the drug seller receives a purchase application from a drug buyer through a server node, the server node needs to identify sensitive information in the purchase application. Sensitive information includes purchase quantity information, purchaser prescription information, and purchaser basic information. The purchase quantity information involves the quantity of drugs purchased, the purchaser prescription information includes detailed information such as the drugs prescribed by the doctor and their dosage, and the purchaser basic information includes the purchaser's name, address, contact information and other personal information. The server node uses the node private key to fully encrypt the purchase quantity information and the purchaser's basic information. Full encryption ensures that these sensitive information remain confidential during transmission and storage, preventing unauthorized access and leakage. Using an asymmetric encryption algorithm, the node private key is used for encryption, and only the corresponding public key can be decrypted, thereby ensuring the security of the information.
[0121] The server node then uses the node private key to encrypt the contents of the purchaser's prescription information except the disease number. The disease number is retained as plain text for specific drug sales and disease management analysis in the blockchain, while other prescription contents (such as drug name, dosage, usage, etc.) are encrypted to protect the privacy of the purchaser. After completing the above encryption, the server node combines the basic information of the seller and the encrypted purchase application to create a drug sales contract in the primary drug sales blockchain. The basic information of the seller includes the seller's identity authentication information, drug inventory information, etc. The drug sales contract records the detailed information of the purchase application, including the encrypted purchase quantity information, the basic information of the buyer, and partially encrypted prescription information. Through blockchain technology, the drug sales contract is tamper-proof and traceable, ensuring the transparency and security of the transaction.
[0122] In one embodiment, in step S105, using the leading server node and verifying the drug sales contract in the primary drug sales blockchain according to the drug basic information specifically includes the following steps:
[0123] Using the leading server node to identify whether the drug code information contains the same drug code as the drug purchased in the drug sales contract;
[0124] If there is no drug code identical to the drug ordered in the drug sales contract, the corresponding drug sales contract is rejected through the leading server node;
[0125] If there is a drug code that is the same as the drug purchased in the drug sales contract, the leading server node is used to query in the drug prescription information whether there is a corresponding relationship between the drug code and the disease number in the drug sales contract;
[0126] If there is no corresponding relationship, the corresponding drug sales contract is rejected through the leading server node;
[0127] If there is a corresponding relationship, the leading server node is used to query the drug inventory information to see whether the drug inventory corresponding to the drug code is lower than the preset inventory threshold;
[0128] If the inventory is below the threshold, the corresponding drug sales contract will be rejected through the leading server node;
[0129] If it is not lower than the inventory threshold, the leading server node is used to query the drug price information to see whether the purchase price corresponding to the drug code in the drug sales contract is within the preset drug price range;
[0130] If it is not within the drug price range, the corresponding drug sales contract will be rejected through the leading server node;
[0131] If it is within the drug price range, the leader node signature is added to the drug sales contract through the leader server node according to the leader node private key.
[0132] In this embodiment, the leading server node identifies the drug code information and checks whether there is a drug code that is the same as the drug purchased in the drug sales contract. The drug code is an identifier that uniquely identifies the drug and is used to ensure that the purchased drug is legally present in the system. If the leading server node fails to find the same drug code as the drug purchased in the drug sales contract in the system, the drug sales contract will be rejected. This step ensures the legitimacy and authenticity of the purchased drug.
[0133] If there is a drug code that is the same as the drug purchased in the drug sales contract, the leading server node will further query the drug prescription information to see if there is a corresponding relationship between the drug code and the disease number in the drug sales contract. The disease number is used to identify a specific disease, and the corresponding relationship between the drug code and the disease number ensures that the purchased drug is suitable for the specified disease. If there is no such corresponding relationship, the leading server node will reject the drug sales contract, thereby avoiding unreasonable drug use.
[0134] If there is a correspondence between the drug code and the disease number, the leading server node will continue to query the drug inventory information to see if the drug inventory corresponding to the drug code is lower than the preset inventory threshold. The inventory threshold is the lowest inventory warning line set by the system to ensure sufficient inventory. If the drug inventory is lower than the preset inventory threshold, the leading server node will reject the drug sales contract to prevent insufficient inventory from affecting drug supply.
[0135] If the drug inventory is not lower than the inventory threshold, the leader server node will further query the drug price information to see if the purchase price corresponding to the drug code in the drug sales contract is within the preset drug price range. The drug price range is a reasonable price range preset by the system to prevent price anomalies. If the purchase price is not within the drug price range, the leader server node will reject the drug sales contract to ensure the rationality of the price. Finally, if the purchase price is within the drug price range, the leader server node will use the leader node private key to add the leader node signature to the drug sales contract. The leader node signature is used to confirm and authorize the drug sales contract to make it a valid transaction record. The legality, rationality and security of the drug sales contract are ensured through a multi-level verification process. Each step of the verification is strictly checked to prevent problems such as illegal drugs, incorrect drug use, insufficient inventory and price anomalies. Finally, the authenticity and validity of the transaction record are ensured through the leader node signature authorization.
[0136] In one embodiment, after step S108, the following steps are specifically included:
[0137] Send quantity statistics request to the drug regulatory system through the regional server;
[0138] Obtain the drug sales quantity fed back by the drug regulatory system in response to the quantity statistics request, where the drug sales quantity includes the sales quantity of all drugs corresponding to the drug coding information, and the drug sales quantity is calculated based on the decrypted drug sales data;
[0139] Sort the corresponding drug coding information in descending order according to the drug sales quantity;
[0140] Select drug coding information in sequence according to the sorting results, and store the drug sales data containing the selected drug coding information in the leading server node in the primary drug sales blockchain until the data storage capacity of the leading server node exceeds the storage upper limit;
[0141] The remaining drug sales data not stored in the leading server node is stored in the regional server.
[0142] In this embodiment, a quantity statistics request is sent to the drug regulatory system through the regional server. The request is intended to obtain the sales quantity of drugs for subsequent data processing and storage optimization. The sales quantity of drugs is calculated based on the decrypted drug sales data to ensure the accuracy and completeness of the data. After receiving the quantity statistics request, the drug regulatory system will respond to the quantity statistics request and transmit the decrypted drug sales data to the third-party cloud server after security verification, and use the third-party cloud server to perform statistical calculations on the drug sales data based on the preset quantity statistics rules. Then, the drug regulatory system will feedback the drug sales quantity to the regional server through the third-party cloud server. The drug sales quantity includes the sales quantity of all drugs corresponding to the drug coding information. These data are decrypted to ensure their authenticity and accuracy. After receiving the feedback data, the regional server will sort out the drug sales quantities according to the drug coding information.
[0143] The regional server sorts the corresponding drug coding information in the order of drug sales quantity from large to small. This step helps to identify drugs with large sales volume, which will be easier for consumers to trace in the future. According to the sorting results, the regional server selects drug coding information in turn, and stores the drug sales data containing the selected drug coding information to the leader server node in the primary drug sales blockchain. The data storage capacity of the leader server node is limited, so during the storage process, it is necessary to continuously monitor its storage capacity until the data storage capacity of the leader server node exceeds the preset storage limit. Once the data storage capacity of the leader server node reaches the upper limit, the regional server will store the remaining drug sales data not stored in the leader server node to the regional server. By sorting by sales quantity and hierarchical storage, the management of drug sales data is optimized. Drug data with large sales volume is stored in the leader server node first, which improves the efficiency of data query and management. At the same time, the regional server, as a backup storage node, ensures the complete storage of all data and avoids the risk of data loss.
[0144] In one embodiment, after step S108, the following steps are specifically included:
[0145] Send quantity statistics request to the drug regulatory system through the regional server;
[0146] Obtain the drug sales quantity fed back by the drug regulatory system in response to the quantity statistics request, where the drug sales quantity includes the sales quantity of all drugs corresponding to the drug coding information, and the drug sales quantity is calculated based on the decrypted drug sales data;
[0147] Obtain the historical query frequency of all drug coding information through the drug IoT management system;
[0148] Combine historical query frequency and drug sales volume to predict the probability of traceability query of drug coding information;
[0149] Create a data cache region in the region server;
[0150] Select drug coding information in descending order of traceability query probability, and store drug sales data containing the selected drug coding information in the leading server node in the primary drug sales blockchain in priority until the data storage capacity of the leading server node exceeds the storage limit;
[0151] The remaining drug sales data not stored in the leading server node is stored in the data cache area in order from large to small traceability query probability until the data storage capacity of the data cache area exceeds the storage upper limit;
[0152] The remaining drug sales data not stored in the leading server node is stored in the regional server.
[0153] In this embodiment, a quantity statistics request is sent to the drug regulatory system through the regional server to obtain drug sales quantity data. After receiving the request, the drug regulatory system decrypts the drug sales data and feeds back the sales quantity corresponding to all drug coding information. These sales quantities are calculated based on the decrypted drug sales data to ensure the accuracy and completeness of the data. Then the historical query frequency of all drug coding information is obtained through the drug IoT management system. The historical query frequency reflects the number of times each drug has been queried in the past period of time, which is an important basis for predicting the probability of drug traceability query. By combining the historical query frequency and the drug sales quantity, the future traceability query probability of each drug coding information can be predicted. The higher the traceability query probability, the greater the possibility that the drug will be queried in the future. By predicting the drug traceability query probability, the storage strategy of drug sales data is optimized. Data with high query probability is stored preferentially in the leading server node to ensure fast access to these data in future queries.
[0154] A data cache area is created in the regional server to temporarily store drug sales data. Drug coding information is selected in order from large to small according to the predicted traceability query probability, and drug sales data containing the selected drug coding information is preferentially stored in the leader server node in the primary drug sales blockchain. The leader server node is the core node in the blockchain network, responsible for processing and storing key data. Prioritizing the storage of drug sales data with high query probability in the leader server node can ensure that this data can be quickly accessed in future queries. The storage process continues until the data storage capacity of the leader server node exceeds the storage limit.
[0155] For the remaining drug sales data that cannot be stored in the leading server node, continue to store them in the data cache area in descending order of traceability query probability. The data cache area is used to temporarily store data with high query probability but cannot be stored in the leading server node to ensure that these data can respond quickly in future queries. The storage process continues until the data storage capacity of the data cache area exceeds the storage limit. Finally, the remaining drug sales data that is not stored in the leading server node is stored in the regional server. As a secondary storage node, the regional server is responsible for storing drug sales data with low query probability to ensure that all data has a backup and storage location.
[0156] In one embodiment, in step S108, the regional server generates a primary blockchain key pair according to the blockchain key set, and sends the primary blockchain key pair to the drug regulatory system. This process specifically includes the following steps:
[0157] Generate a primary block private key through the regional server based on the hash value of the last block in the primary drug sales blockchain;
[0158] Use the primary block private key to encrypt all node private keys in the blockchain key set;
[0159] The primary block private key and the blockchain public key in the blockchain key set are combined to generate a primary blockchain key pair for the primary drug sales blockchain, and the primary blockchain key pair is sent to the drug regulatory system through the regional server.
[0160] In this embodiment, the regional server generates a first-level block private key based on the hash value of the last block in the first-level drug sales blockchain. The hash value is a unique identifier obtained by hashing the data of the last block, and its irreversibility and uniqueness ensure the security and uniqueness of the generated first-level block private key. Using the hash value of the last block as a basis, a private key closely related to the blockchain state can be dynamically generated, thereby enhancing the security of the blockchain. The generated first-level block private key is used to encrypt all node private keys in the blockchain key set. The blockchain key set contains the private keys of each node in the blockchain, which are used for secure communication and data verification between nodes. By encrypting these node private keys with the first-level block private key, the security of the node private keys can be effectively protected to prevent them from being stolen or tampered with during transmission and storage.
[0161] Then, the first-level blockchain key pair of the first-level drug sales blockchain is generated by combining the first-level block private key and the blockchain public key in the blockchain key set. The blockchain public key is public and is used to encrypt data and verify digital signatures. The first-level blockchain key pair generated by combining the first-level block private key and the blockchain public key ensures the uniqueness and security of the key pair. The first-level blockchain key pair includes a private key and a public key. The private key is used for signing and decrypting, and the public key is used for encryption and verification of signatures. The generated first-level blockchain key pair is sent to the drug regulatory system through the regional server. After receiving the first-level blockchain key pair, the drug regulatory system can use it to manage and verify the data and transactions in the first-level drug sales blockchain to ensure the security and integrity of the blockchain.
[0162] In one embodiment, after the process of broadcasting the successfully verified qualified drug sales contract to other server nodes in the primary drug sales blockchain through the leading server node in step S105, the following steps are specifically included:
[0163] Obtain drug traceability information corresponding to the drug coding information contained in the qualified drug sales contract through the drug IoT management system. The drug traceability information includes drug production information, drug packaging information, and drug transportation information;
[0164] Upload drug traceability information to the primary drug sales blockchain through the server node corresponding to the qualified drug sales contract;
[0165] In response to a traceability request issued by a drug purchaser on the secondary drug sales blockchain, a blockchain public key is sent to the drug purchaser via a regional server.
[0166] In this embodiment, refer to Figure 3 , obtain the drug traceability information corresponding to the drug coding information contained in the qualified drug sales contract through the drug IoT management system. Drug traceability information includes drug production information, drug packaging information and drug transportation information. This information is collected in real time through IoT devices and sensors and stored in the drug IoT management system. Drug production information includes production date, production batch, manufacturer, etc.; drug packaging information includes packaging date, packaging batch, packaging manufacturer, etc.; drug transportation information includes transportation date, transportation batch, transportation company, etc. The drug traceability information is uploaded to the first-level drug sales blockchain through the server node corresponding to the qualified drug sales contract. The server node packs this traceability information into blocks and adds it to the first-level drug sales blockchain through a consensus mechanism. The immutability and distributed storage characteristics of blockchain technology ensure the authenticity and security of traceability information.
[0167] After purchasing the medicine, the drug buyer can use the mobile terminal to scan the RFID label, barcode or QR code label on the drug packaging, so as to obtain the drug code of the drug through the mobile terminal, and issue a traceability application in the secondary drug sales blockchain according to the drug code. After receiving the traceability application, the blockchain public key is sent to the mobile terminal of the drug buyer through the regional server. The drug buyer requests access to the traceability information of the drug through the traceability application. After receiving the request, the regional server verifies the identity of the buyer and sends the blockchain public key to the buyer. The blockchain public key is public and is used to encrypt data and verify digital signatures. Buyers can use the public key to query and verify the traceability information of the drug.
[0168] The present invention also discloses a monitoring and management system for drug sales information, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the monitoring and management method for drug sales information as described in any one of the above embodiments is implemented.
[0169] Among them, the processor can adopt a central processing unit (CPU). Of course, according to actual usage, other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. can also be adopted. The general-purpose processor can adopt a microprocessor or any conventional processor, etc., and this application does not impose any restrictions on this.
[0170] Among them, the memory can be an internal storage unit of a computer device, such as a hard disk or memory of a computer device, or an external storage device of a computer device, such as a plug-in hard disk, a smart memory card (SMC), a secure digital card (SD) or a flash memory card (FC) equipped on the computer device, and the memory can also be a combination of an internal storage unit and an external storage device of a computer device. The memory is used to store computer programs and other programs and data required by the computer device. The memory can also be used to temporarily store data that has been output or is to be output, and this application does not impose any restrictions on this.
[0171] A person skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of protection of the present application is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of different aspects of one or more embodiments of the present application as above, which are not provided in detail for the sake of simplicity.
[0172] One or more embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the present application. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present application should be included in the protection scope of the present application.
Claims
1. A method for monitoring and managing drug sales information, characterized in that: The steps include: Obtaining the basic information of all drug sellers in the target area and the basic information of all drugs sold by the drug sellers through the drug IoT management system, wherein the basic information includes drug coding information, drug prescription information, drug inventory information and drug price information; According to the server addresses of the servers deployed by the drug sellers, all the drug sellers are divided into different network areas, and the servers in each of the network areas are used as server nodes to build a blockchain network to obtain multiple primary drug sales blockchains, and the basic information of the sellers is imported into the corresponding primary drug sales blockchain through the server nodes, and the basic information of the drugs is imported into all the primary drug sales blockchains through the server nodes; Randomly generate a blockchain public key of the primary drug sales blockchain, and randomly select a server node in the primary drug sales blockchain as a broadcast server node, the broadcast server node is used to interact with all other server nodes using the blockchain public key to construct a blockchain key set of the primary drug sales blockchain; Calculate the node reliability of each of the server nodes, and select the leading server node in the primary drug sales blockchain in combination with the blockchain key set and the node reliability; Using the leading server node and based on the basic drug information, verifying the drug sales contract in the primary drug sales blockchain, broadcasting the successfully verified qualified drug sales contract to other server nodes in the primary drug sales blockchain through the leading server node, the drug sales contract is created based on the drug seller according to the seller basic information and the purchase application of the drug buyer; Combining the qualified drug sales contract and the basic drug information and encrypting them with the blockchain key set, the drug sales data of the first-level drug sales blockchain is generated; Configure a regional server for each of the network areas, build a secondary drug sales blockchain based on all the regional servers, and upload the drug sales data of the primary drug sales blockchain to the secondary drug sales blockchain through the leading server node; Establish a connection between the secondary drug sales blockchain and the drug regulatory system of the target area, obtain the blockchain key set corresponding to the primary drug sales blockchain through the regional server, generate a primary blockchain key pair according to the blockchain key set through the regional server, and send the primary blockchain key pair to the drug regulatory system.
2. The monitoring and management method for drug sales information according to claim 1, characterized in that: The broadcast server node uses the blockchain public key to interact with all other server nodes to construct the blockchain key set of the primary drug sales blockchain, including the following steps: The broadcast server node combines the blockchain public key and the locally preset node number and uses an asymmetric encryption algorithm to generate a broadcast node private key; The broadcast server node broadcasts the blockchain public key to all other server nodes; The broadcast server node receives the node signature fed back by the server node, and marks the server node that has fed back the node signature as an alternative server node, the node signature is generated by the node private key of the server node, the node private key is generated by the server node in combination with the blockchain public key and the locally preset node number and using the asymmetric encryption algorithm, the broadcast node private key, the blockchain public key and all the node private keys are combined into a blockchain key set.
3. The monitoring and management method of drug sales information according to claim 2 is characterized in that: The node reliability of each server node is obtained by calculation, and the leading server node in the primary drug sales blockchain is selected by combining the blockchain key set and the node reliability, including the following steps: Calculating and obtaining the node reliability of each of the server nodes; Generate a candidate node ballot set by combining the blockchain public key and the node reliability of all the candidate server nodes; The broadcast server node generates a broadcast node signature using the broadcast node private key and adds the broadcast node signature to the candidate node ballot set, and broadcasts the candidate node ballot set to all other server nodes through the broadcast server node, and the server node is used to generate a node signature ballot in combination with the node private key and the node reliability; Recover and verify the node signature ballots generated by all other server nodes through the broadcast server node; Combine all the node signature votes to elect the leading server node in the primary drug sales blockchain.
4. The monitoring and management method for drug sales information according to claim 3 is characterized in that: The server node generates a node signature ballot by combining the node private key and the node reliability, including the following steps: The server node verifies the blockchain public key and the broadcast node signature in the candidate node ballot set using the node private key; After successful verification, the server node compares the node reliability of the candidate server nodes in the candidate node ballot set with its own node reliability in sequence; The server node generates a node ballot according to the comparison result, wherein the server node in the node ballot only supports the candidate server node whose reliability is greater than that of the server node itself; The server node generates a ballot ring signature of the node ballot using the node private key to obtain a node signature ballot.
5. The monitoring and management method of drug sales information according to claim 1, characterized in that: Before using the leading server node to verify the drug sales contract in the primary drug sales blockchain according to the drug basic information, the following steps are also included: When the drug seller receives a purchase application from a drug buyer through the server node, identifying sensitive information in the purchase application, the sensitive information including purchase quantity information, purchaser prescription information and purchaser basic information; The purchase quantity information and the basic information of the purchaser are fully encrypted using the node private key of the server node; Using the node private key of the server node to encrypt the contents of the purchaser's prescription information except the disease number; A drug sales contract is created in the primary drug sales blockchain through the server node in combination with the seller's basic information and the encrypted purchase application.
6. The monitoring and management method for drug sales information according to claim 5, characterized in that: The method of using the leading server node and verifying the drug sales contract in the primary drug sales blockchain according to the drug basic information comprises the following steps: Using the leading server node to identify whether the drug code information contains the same drug code as the drug purchased in the drug sales contract; If there is no drug code identical to the drug ordered in the drug sales contract, rejecting the corresponding drug sales contract through the leading server node; If there is a drug code that is the same as the drug purchased in the drug sales contract, then using the leading server node to query in the drug prescription information whether there is a corresponding relationship between the drug code and the disease number in the drug sales contract; If there is no corresponding relationship, the corresponding drug sales contract is rejected by the leading server node; If there is a corresponding relationship, the leading server node is used to query the drug inventory information to see whether the drug inventory quantity corresponding to the drug code is lower than a preset inventory threshold; If the inventory is lower than the inventory threshold, the corresponding drug sales contract is rejected through the leading server node; If it is not lower than the inventory threshold, the leading server node is used to query the drug price information whether the purchase price corresponding to the drug code in the drug sales contract is within a preset drug price range; If it is not within the drug price range, the corresponding drug sales contract is rejected through the leading server node; If it is within the drug price range, the leader node signature is added to the drug sales contract through the leader server node according to the leader node private key.
7. The monitoring and management method of drug sales information according to claim 1, characterized in that: After establishing a connection between the secondary drug sales blockchain and the drug regulatory system of the target region, obtaining the blockchain key set corresponding to the primary drug sales blockchain through the regional server, generating a primary blockchain key pair according to the blockchain key set through the regional server, and sending the primary blockchain key pair to the drug regulatory system, the following steps are also included: Sending a quantity statistics request to the drug supervision system through the regional server; Obtaining the drug sales quantity fed back by the drug regulatory system in response to the quantity statistics request, wherein the drug sales quantity includes the sales quantity of all drugs corresponding to the drug coding information, and the drug sales quantity is calculated based on the decrypted drug sales data; Sort the corresponding drug coding information in descending order according to the sales quantity of the drug; Selecting the drug coding information in sequence according to the sorting results, and storing the drug sales data including the selected drug coding information in the leading server node in the primary drug sales blockchain until the data storage capacity of the leading server node exceeds the storage upper limit; The remaining drug sales data not stored in the leading server node is stored in the regional server.
8. The monitoring and management method of drug sales information according to claim 1, characterized in that: The generating of a primary blockchain key pair according to the blockchain key set by the regional server and sending the primary blockchain key pair to the drug supervision system comprises the following steps: Generate a primary block private key through the regional server and according to the hash value of the last block in the primary drug sales blockchain; Using the primary block private key to encrypt all node private keys in the blockchain key set; The first-level block private key and the blockchain public key in the blockchain key set are combined to generate a first-level blockchain key pair of the first-level drug sales blockchain, and the first-level blockchain key pair is sent to the drug supervision system through the regional server.
9. The method for monitoring and managing drug sales information according to claim 8, characterized in that: After the leader server node broadcasts the successfully verified qualified drug sales contract to other server nodes in the primary drug sales blockchain, the following steps are also included: Obtaining drug traceability information corresponding to the drug coding information contained in the qualified drug sales contract through the drug IoT management system, wherein the drug traceability information includes drug production information, drug packaging information, and drug transportation information; Uploading the drug traceability information to the primary drug sales blockchain through the server node corresponding to the qualified drug sales contract; In response to a traceability application issued by a drug purchaser on the secondary drug sales blockchain, the blockchain public key is sent to the drug purchaser via the regional server.
10. A monitoring and management system for drug sales information, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for monitoring and managing drug sales information as described in any one of claims 1 to 9 is implemented.
