Dynamic construction method, device, terminal equipment and storage medium of traceability certificate chain
By building a drug traceability certificate tree and combining drug source data with sales data, the problem of untrue and untraceable data in traditional drug circulation management is solved, the authenticity and safety of drug circulation data is realized, and the reliability and legality of drugs is ensured. and use reasonably.
Patent Information
- Application Number
- CN202411147803.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-08-21
AI Technical Summary
Traditional drug circulation management methods have problems such as untrue, untraceable data, which leads to troubles in drug circulation management. An advanced and efficient technical means are urgently needed to ensure the safety and traceability of drugs.
By building a drug traceability certificate tree, combining the source data of the drug with sales data, dynamically constructing a traceability certificate chain, including obtaining drug source data and sales data, generating supplier certificates, drug certificates, contract certificates, buyer certificates, etc., to verify Legality and generate a voucher sequence to form a drug source certificate and a drug circulation certificate, and finally generate a drug traceability certificate tree.
Ensure the authenticity and effectiveness of drug circulation data, safety and traceability, helping midstream pharmaceutical distribution companies strictly manage drug suppliers and downstream terminals, and ensuring the rational use and traceability of drugs.
Smart Images

Figure CN118674467B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of drug supervision technology, and in particular to a method, device, terminal equipment and storage medium for dynamically constructing a traceability certificate chain. Background Art
[0002] In the medical industry, drugs are not only an important means of treating diseases, but also directly related to the health and well-being of the people, and bear the great responsibility of public health and national security. As a special commodity, the sales process of drugs is strictly regulated by national laws, including the "Drug Administration Law", "Drug Registration Management Measures" and other laws and regulations. The introduction of these laws and regulations aims to regulate the order of the drug market and ensure the legal circulation and traceability of drugs. To this end, relevant regulatory agencies have put forward clear requirements for medical institutions, that is, they must strictly record the sales data of drugs so that they can check the source, destination and circulation of drugs at any time. This not only helps to ensure the quality and safety of drugs, but also allows for rapid traceability and investigation when problems arise.
[0003] There are three links in the pharmaceutical distribution chain, namely upstream pharmaceutical production enterprises, midstream pharmaceutical distribution enterprises, and downstream pharmaceutical terminals. Among them, midstream pharmaceutical distribution enterprises play the role of a bridge connecting upstream and downstream in the pharmaceutical distribution chain. Such enterprises purchase products from pharmaceutical companies or other pharmaceutical distribution companies and sell them to pharmaceutical terminals or other pharmaceutical distribution companies. Therefore, midstream pharmaceutical distribution companies not only need to strictly manage the suppliers of various drugs to ensure that the sources of drugs are reliable and legal. They also need to manage the information of downstream pharmaceutical terminals to ensure the rational use and traceability of drugs.
[0004] However, traditional drug circulation management methods often have problems such as untrue data, untraceability, and insecurity, which has brought great troubles to the management of drug circulation. Therefore, a more advanced and efficient technical means is urgently needed to strengthen drug circulation management to ensure the safety and traceability of drugs. Summary of the invention
[0005] The embodiment of the present invention provides a method, apparatus, terminal device and storage medium for dynamically constructing a traceability certificate chain. By constructing a drug traceability certificate tree, the source data of the drug is combined with the sales data, thereby ensuring the authenticity and validity of the drug circulation data, and having the characteristics of security and traceability.
[0006] An embodiment of the present invention provides a method for dynamically constructing a traceability credential chain, comprising:
[0007] Obtaining drug source data and sales data; wherein the drug source data includes: supplier data, drug storage data, and contract data; the sales data includes: drug sales data and buyer data;
[0008] Generate supplier vouchers and supplier voucher subtrees based on supplier data, generate contract vouchers and contract voucher subtrees based on contract data, and generate drug vouchers and drug voucher subtrees based on drug warehousing data;
[0009] Generate a drug source certificate according to the supplier certificate, the drug certificate, and the contract certificate, and use the drug source certificate as a root node, and use the supplier certificate subtree, the drug certificate subtree, and the contract certificate subtree as the same-layer subtrees under the drug source certificate to generate a drug source certificate subtree;
[0010] Generate a drug sales voucher and a drug sales subtree according to the drug sales data, and generate a buyer voucher and a buyer voucher subtree according to the buyer data;
[0011] Generate a drug circulation certificate according to the buyer's certificate and the drug sales certificate, and use the drug circulation certificate as a root node, and use the drug sales subtree and the buyer's certificate subtree as the same-level subtrees under the drug circulation certificate to generate a drug circulation certificate subtree;
[0012] A drug traceability certificate is generated according to the drug source certificate and the drug circulation certificate. The drug traceability certificate is used as the root node, and the drug source certificate subtree and the drug circulation certificate subtree are used as the same-level subtrees under the drug traceability certificate to generate a drug traceability certificate tree.
[0013] Further, a supplier certificate and a supplier certificate subtree are generated according to the supplier data, and a contract certificate and a contract certificate subtree are generated according to the contract data, including:
[0014] Performing a legitimacy verification on the supplier data, and when it is determined that the supplier data passes the legitimacy verification, generating a supplier credential and a supplier verification code according to a preset verification code generation algorithm and the supplier data;
[0015] Generate a supplier credential sequence according to the supplier credential and the supplier verification code;
[0016] Taking the supplier credential sequence as the root node and the supplier data as the leaf node, a supplier credential subtree is generated;
[0017] Generate a contract certificate and a contract verification code according to the contract data and the verification code generation algorithm;
[0018] Generate a contract certificate sequence according to the contract certificate and the contract verification code;
[0019] The contract certificate sequence is used as the root node and the contract data is used as the leaf node to generate a contract certificate subtree.
[0020] Furthermore, drug vouchers and drug voucher subtrees are generated based on drug storage data, including:
[0021] Determining whether the supplier has completed drug delivery based on the drug storage data and the contract data;
[0022] If so, generate a drug voucher according to the drug storage data, and use the drug voucher as the root node and the drug storage data as the leaf node to generate a drug voucher subtree;
[0023] If not, a drug sub-voucher is generated according to the drug storage data, and the drug sub-voucher is used as the root node and the drug storage data is used as the leaf node to generate a drug sub-voucher subtree;
[0024] When new drug inventory data is obtained, a new drug sub-voucher and a new drug sub-voucher subtree are generated. When it is determined that the supplier has completed the drug delivery, a drug voucher is generated based on several drug sub-vouchers, and the drug voucher is used as the root node, and several of the drug sub-voucher subtrees are used as subtrees of the same level to generate a drug voucher subtree.
[0025] Further, generating a drug sales voucher and a drug sales subtree according to the drug sales data, and generating a buyer voucher and a buyer voucher subtree according to the buyer data, including:
[0026] Obtain some historical drug sales data and some historical drug inventory data;
[0027] Verify whether the drug sales data is valid based on the historical drug sales data, the historical drug storage data, the drug sales data, and the drug storage data;
[0028] When it is determined that the drug sales data is valid, generating a drug sales voucher and a drug sales verification code according to the drug sales data and the verification code generation algorithm;
[0029] Generate a drug sales voucher sequence according to the drug sales voucher and the drug sales verification code;
[0030] Taking the drug sales voucher sequence as the root node and the drug sales data as the leaf node, a drug sales voucher subtree is generated;
[0031] Performing a legitimacy verification on the buyer data, and when it is determined that the buyer data passes the legitimacy verification, generating a buyer credential and a buyer verification code according to the buyer data and the verification code generation algorithm;
[0032] Generate a buyer credential sequence according to the buyer credential and the buyer verification code;
[0033] The buyer credential sequence is used as a root node and the buyer data is used as a leaf node to generate a buyer credential subtree.
[0034] Further, a drug circulation certificate is generated according to the buyer's certificate and the drug sales certificate, and the drug circulation certificate is used as a root node, and the drug sales subtree and the buyer's certificate subtree are used as the same-level subtrees under the drug circulation certificate to generate a drug circulation certificate subtree, including:
[0035] Determining whether the drug has been sold out based on the historical drug sales data, the historical drug storage data, the drug sales data, and the drug storage data;
[0036] If yes, then generate a drug circulation certificate according to the buyer certificate sequence and the drug sales certificate sequence, and use the drug circulation certificate as the root node, the drug sales subtree and the buyer certificate subtree as the same-level subtrees under the drug circulation certificate to generate a drug circulation certificate subtree;
[0037] If not, if so, then generate a drug circulation sub-voucher according to the buyer voucher sequence and the drug sales voucher sequence, take the drug circulation sub-voucher as the root node, take the drug sales subtree and the buyer voucher subtree as the same-level subtrees under the drug circulation sub-voucher, and generate a drug circulation sub-voucher subtree;
[0038] When a new buyer's credential sequence and a new drug sales credential sequence are obtained, a new drug circulation sub-credential and a new drug circulation sub-credential subtree are generated. When it is determined that the drug has been sold out, a drug circulation credential is generated based on several drug circulation sub-credentials, and the drug circulation credential is used as the root node, and several of the drug circulation sub-credential subtrees are used as subtrees of the same level to generate a drug circulation subtree.
[0039] Further, the drug sales data and the historical drug sales data include: the drug sales quantity of each type of drug; the drug storage data and the historical drug sales data include: the drug storage quantity of each type of drug;
[0040] The verifying whether the drug sales data is valid based on the historical drug sales data, the historical drug storage data, the drug sales data, and the drug storage data includes:
[0041] Determine all drugs existing in the drug sales data as target drugs;
[0042] According to the target drugs, counting the drug storage data and the drug storage quantity of each target drug in the historical drug sales data, and generating the total drug storage quantity of each target drug;
[0043] According to the target drugs, counting the drug sales data and the historical drug sales data, the drug sales quantity of each target drug, and generating the total drug sales of each target drug;
[0044] When it is determined that the total drug sales of all target drugs is not greater than the total drug inventory, the drug sales data is determined to be valid;
[0045] When it is determined that the total drug sales of a target drug is greater than the total drug inventory, the drug sales data is determined to be invalid.
[0046] Furthermore, the verification code generation algorithm includes:
[0047] Obtaining a target credential; wherein the target credential is the supplier credential, the contract credential, the drug sales credential, or the buyer credential;
[0048] The target credential is encrypted using a hash algorithm to generate a digital summary of the target credential;
[0049] The target credential, the digital summary, and the credential type of the target credential are combined to generate a credential verification code corresponding to the target credential, wherein the credential verification code is the supplier verification code, the contract verification code, the drug sales verification code, or the buyer verification code.
[0050] Another embodiment of the present invention provides a device for dynamically constructing a traceability credential chain, comprising:
[0051] The data acquisition module is used to acquire drug source data and sales data; wherein the drug source data includes: supplier data, drug storage data, and contract data; the sales data includes: drug sales data and buyer data;
[0052] The first subtree generation module is used to generate a supplier voucher and a supplier voucher subtree according to supplier data, generate a drug voucher and a drug voucher subtree according to drug storage data, and generate a contract voucher and a contract voucher subtree according to contract data;
[0053] A second subtree generation module is used to generate a drug source certificate according to the supplier certificate, the drug certificate, and the contract certificate, and use the drug source certificate as a root node, the supplier certificate subtree, the drug certificate subtree, and the contract certificate subtree as the same-layer subtrees under the drug source certificate to generate a drug source certificate subtree;
[0054] A third subtree generation module is used to generate a drug sales voucher and a drug sales subtree according to the drug sales data, and to generate a buyer voucher and a buyer voucher subtree according to the buyer data;
[0055] A fourth subtree generation module is used to generate a drug circulation certificate according to the buyer certificate and the drug sales certificate, and use the drug circulation certificate as a root node, the drug sales subtree and the buyer certificate subtree as the same-layer subtrees under the drug circulation certificate to generate a drug circulation certificate subtree;
[0056] The voucher tree generation module is used to generate a drug traceability voucher based on the drug source voucher and the drug circulation voucher. The drug traceability voucher is used as the root node, and the drug source voucher subtree and the drug circulation voucher subtree are used as the same-level subtrees under the drug traceability voucher to generate a drug traceability voucher tree.
[0057] Another embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements a method for dynamically constructing a traceability credential chain as described in any one of the embodiments.
[0058] Another embodiment of the present invention provides a storage medium, characterized in that the storage medium includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute a method for dynamically constructing a traceability credential chain as described in any of the above embodiments.
[0059] The following beneficial effects are achieved by implementing the present invention:
[0060] The present invention discloses a method, device, terminal device and storage medium for dynamically constructing a traceability voucher chain, by constructing a drug source voucher subtree according to drug source data, constructing a drug circulation voucher subtree according to sales data, and then dynamically constructing a drug traceability voucher tree according to the drug source voucher subtree and the drug circulation voucher subtree. Therefore, the present invention combines the source data of the drug with the sales data by dynamically constructing a drug traceability voucher tree, thereby ensuring the authenticity and validity of the drug circulation data, and having the characteristics of security and traceability, so that midstream pharmaceutical distribution companies can not only strictly manage the suppliers of various drugs to ensure the reliability and legality of the source of drugs, but also safely and effectively manage the information of downstream pharmaceutical terminals to ensure the rational use and traceability of drugs. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 It is a flowchart of a method for dynamically constructing a traceability credential chain provided by an embodiment of the present invention.
[0062] Figure 2 It is a structural diagram of a dynamic construction device for a traceability certificate chain provided by an embodiment of the present invention.
[0063] Figure 3 It is a schematic diagram of the structure of a drug traceability certificate tree provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0065] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.
[0066] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.
[0067] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0068] In the description of the embodiments of the present application, the term "and / or" is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0069] In the description of the embodiments of the present application, the term "multiple" refers to more than two (including two). Similarly, "multiple groups" refers to more than two groups (including two groups), and "multiple pieces" refers to more than two pieces (including two pieces).
[0070] In the description of the embodiments of the present application, unless otherwise clearly specified and limited, technical terms such as "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal connection of two elements or the interaction relationship between two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the embodiments of the present application can be understood according to the specific circumstances.
[0071] See also Figure 1 , is a flowchart of a method for dynamically constructing a traceability credential chain provided by an embodiment of the present invention, including:
[0072] S1. Obtain drug source data and sales data; wherein the drug source data includes: supplier data, drug storage data, and contract data; the sales data includes: drug sales data and buyer data;
[0073] In a preferred embodiment of the present invention, based on drug information such as drug names and drug batch numbers recorded in the contract, drug warehousing data is obtained from a preset drug warehousing database and sales data is obtained from a preset sales database.
[0074] S2. Generate supplier vouchers and supplier voucher subtrees based on supplier data, generate contract vouchers and contract voucher subtrees based on contract data, and generate drug vouchers and drug voucher subtrees based on drug storage data;
[0075] Preferably, generating a supplier certificate and a supplier certificate subtree according to the supplier data, and generating a contract certificate and a contract certificate subtree according to the contract data, includes:
[0076] S201, performing legitimacy verification on the supplier data, and when it is determined that the supplier data passes the legitimacy verification, generating a supplier credential and a supplier verification code according to a preset verification code generation algorithm and the supplier data;
[0077] S202, generating a supplier credential sequence according to the supplier credential and the supplier verification code;
[0078] S203, taking the supplier credential sequence as a root node and the supplier data as a leaf node, generating a supplier credential subtree;
[0079] In a preferred embodiment of the present invention, by accessing the information such as drugs, drug approval numbers, and production units disclosed on the official website of the State Drug Administration, it is determined whether the supplier data is legal. If it is not legal, an early warning message is generated to inform the relevant staff to verify the supplier data. If it is legal, a supplier credential and a supplier verification code are generated according to the supplier data and the verification code generation algorithm described in steps S4061-S4063.
[0080] Further, according to the supplier credential and the supplier verification code, a supplier credential sequence is generated, and the supplier credential sequence is used as a root node and the supplier data is used as a leaf node to generate the following Figure 3 The supplier credentials subtree shown;
[0081] S204, generating a contract certificate and a contract verification code according to the contract data and the verification code generation algorithm;
[0082] S205, generating a contract certificate sequence according to the contract certificate and the contract verification code;
[0083] S206. Use the contract certificate sequence as a root node and the contract data as a leaf node to generate a contract certificate subtree.
[0084] In a preferred embodiment of the present invention, after determining that the supplier data is legal, a contract voucher and a contract verification code are generated according to the contract data and the verification code generation algorithm described in steps S4061-S4063; and then a contract voucher sequence is generated according to the contract voucher and the contract verification code, and the contract voucher sequence is used as the root node and the contract data is used as the leaf node to generate the following: Figure 3 The contract certificate subtree shown.
[0085] Preferably, generating a drug voucher and a drug voucher subtree according to the drug storage data includes:
[0086] S207, determining whether the supplier has completed drug delivery based on the drug storage data and the contract data;
[0087] S208, if yes, generate a drug voucher according to the drug storage data, and use the drug voucher as a root node and the drug storage data as a leaf node to generate a drug voucher subtree;
[0088] S209, if not, generate a drug sub-voucher according to the drug storage data, take the drug sub-voucher as the root node, take the drug storage data as the leaf node, and generate a drug sub-voucher subtree;
[0089] S210. When acquiring new drug warehousing data, generate a new drug sub-voucher and a new drug sub-voucher subtree. When determining that the supplier has completed drug delivery, generate a drug voucher based on several drug sub-vouchers, take the drug voucher as the root node, and take several of the drug sub-voucher subtrees as subtrees of the same level to generate a drug voucher subtree.
[0090] In a preferred embodiment of the present invention, the situation that the supplier may deliver the drugs in batches is taken into consideration. If the drug delivery is not completed, a drug sub-voucher sub-tree is generated according to the current warehouse data, and the currently unfinished drug traceability voucher tree is temporarily suspended. When the drug delivery is completed, the following drug traceability voucher tree is generated according to several drug sub-voucher sub-trees: Figure 3 The drug credentials subtree is shown.
[0091] S3, generating a drug source certificate according to the supplier certificate, the drug certificate, and the contract certificate, and taking the drug source certificate as the root node, taking the supplier certificate subtree, the drug certificate subtree, and the contract certificate subtree as the same-layer subtrees under the drug source certificate, and generating a drug source certificate subtree;
[0092] In a preferred embodiment of the present invention, a drug source certificate subtree is generated based on the supplier certificate subtree, the drug certificate subtree and the contract certificate subtree. It can be understood that the drug source certificate subtree records in detail the contract data, supplier data, and the warehousing time of several drugs. When the source of the drug is subsequently traced based on the drug traceability certificate tree, the supplier of the drug, the warehousing time, and the relevant contract terms can be traced in detail, ensuring the legality and reliability of the source of the drug and improving the management efficiency of the source of the drug by the midstream pharmaceutical distribution companies.
[0093] S4, generating a drug sales voucher and a drug sales subtree according to the drug sales data, and generating a buyer voucher and a buyer voucher subtree according to the buyer data;
[0094] Preferably, generating a drug sales voucher and a drug sales subtree according to the drug sales data, and generating a buyer voucher and a buyer voucher subtree according to the buyer data, includes:
[0095] S401, obtaining some historical drug sales data and some historical drug storage data;
[0096] S402, verifying whether the drug sales data is valid according to the historical drug sales data, the historical drug storage data, the drug sales data, and the drug storage data;
[0097] Preferably, the drug sales data and the historical drug sales data include: the drug sales quantity of each type of drug; the drug storage data and the historical drug sales data include: the drug storage quantity of each type of drug;
[0098] The verifying whether the drug sales data is valid based on the historical drug sales data, the historical drug storage data, the drug sales data, and the drug storage data includes:
[0099] S4021. Determine all drugs in the drug sales data as target drugs;
[0100] S4022. According to the target drugs, the drug storage data and the historical drug sales data are counted to generate the total drug storage of each target drug;
[0101] S4023. According to the target drugs, the drug sales data and the historical drug sales data are counted to generate the total drug sales of each target drug.
[0102] S4024. When it is determined that the total drug sales of all target drugs is not greater than the total drug inventory, the drug sales data is determined to be valid;
[0103] S4025. When it is determined that the total drug sales of a target drug is greater than the total drug inventory, the drug sales data is determined to be invalid.
[0104] In a preferred embodiment of the present invention, in step S1, the sales data is obtained from a preset sales database based on the drug names and drug batch numbers and other drug information recorded in the contract. In order to prevent errors in sales data recording, before building the drug sales subtree, it is also necessary to verify the validity of the sales data, that is, to compare the storage quantity of the sold drugs with the sales quantity, so as to ensure the data validity and accuracy of the drug traceability voucher tree.
[0105] S403, when it is determined that the drug sales data is valid, generating a drug sales voucher and a drug sales verification code according to the drug sales data and the verification code generation algorithm;
[0106] S404, generating a drug sales voucher sequence according to the drug sales voucher and the drug sales verification code;
[0107] S405, taking the drug sales voucher sequence as the root node and the drug sales data as the leaf node, generating a drug sales voucher subtree;
[0108] S406, performing legitimacy verification on the buyer data, and when it is determined that the buyer data passes the legitimacy verification, generating a buyer credential and a buyer verification code according to the buyer data and the verification code generation algorithm;
[0109] Preferably, the verification code generation algorithm includes:
[0110] S4061. Obtain a target credential; wherein the target credential is the supplier credential, the contract credential, the drug sales credential, or the buyer credential;
[0111] S4062, encrypting the target credential using a hash algorithm to generate a digital summary of the target credential;
[0112] S4063. Combine the target credential, the digital summary, and the credential type of the target credential to generate a credential verification code corresponding to the target credential, wherein the credential verification code is the supplier verification code, the contract verification code, the drug sales verification code, or the buyer verification code.
[0113] S407, generating a buyer credential sequence according to the buyer credential and the buyer verification code;
[0114] S408: Use the buyer credential sequence as a root node and the buyer data as a leaf node to generate a buyer credential subtree.
[0115] In a preferred embodiment of the present invention, the downstream pharmaceutical terminal that purchases drugs from the midstream pharmaceutical distribution enterprise needs to have relevant pharmaceutical business qualifications. Therefore, in this embodiment, the buyer's data legitimacy is verified by visiting the official website of the State Drug Administration to query the buyer's drug business license. When the buyer's data fails the legitimacy verification, an early warning message is generated to inform the relevant staff to verify the buyer's data. If it is legal, the buyer's credential and the buyer's verification code are generated based on the buyer's data and the verification code generation algorithm.
[0116] Further, a buyer credential sequence is generated according to the buyer credential and the buyer verification code, and then the buyer credential sequence is used as the root node and the buyer data is used as the leaf node to generate the following Figure 3 The buyer credentials subtree is shown.
[0117] S5. Generate a drug circulation certificate according to the buyer's certificate and the drug sales certificate, and use the drug circulation certificate as a root node, and use the drug sales subtree and the buyer's certificate subtree as the same-layer subtrees under the drug circulation certificate to generate a drug circulation certificate subtree;
[0118] In a preferred embodiment of the present invention, a drug circulation certificate subtree is generated based on the drug sales subtree and the buyer certificate subtree. It can be understood that the drug circulation certificate subtree records in detail the detailed information of the drug purchaser and the sales information of the drug. When the drug circulation is subsequently traced based on the drug traceability certificate tree, the buyer of the drug, the purchase time, the purchase quantity and other information can be traced in detail, thereby ensuring the traceability of the drug.
[0119] Preferably, a drug circulation certificate is generated according to the buyer's certificate and the drug sales certificate, and the drug circulation certificate is used as a root node, and the drug sales subtree and the buyer's certificate subtree are used as the same-layer subtrees under the drug circulation certificate to generate a drug circulation certificate subtree, including:
[0120] S501, judging whether the drug has been sold out according to the historical drug sales data, the historical drug storage data, the drug sales data, and the drug storage data;
[0121] S502: If yes, generate a drug circulation certificate according to the buyer certificate sequence and the drug sales certificate sequence, and use the drug circulation certificate as a root node, and use the drug sales subtree and the buyer certificate subtree as the same-level subtrees under the drug circulation certificate to generate a drug circulation certificate subtree;
[0122] S503, if not, then generate a drug circulation sub-voucher according to the buyer voucher sequence and the drug sales voucher sequence, take the drug circulation sub-voucher as the root node, take the drug sales subtree and the buyer voucher subtree as the same-level subtrees under the drug circulation sub-voucher, and generate a drug circulation sub-voucher subtree;
[0123] S504. When obtaining a new buyer's credential sequence and a new drug sales credential sequence, a new drug circulation sub-credential and a new drug circulation sub-credential subtree are generated. When it is determined that the drug is sold out, a drug circulation credential is generated based on several drug circulation sub-credentials, and the drug circulation credential is used as the root node, and several of the drug circulation sub-credential subtrees are used as subtrees of the same level to generate a drug circulation subtree.
[0124] In a preferred embodiment of the present invention, considering that the drugs purchased through a contract will generate a lot of sales data, therefore, when the drugs are not sold out, a drug circulation sub-voucher subtree is generated based on the current buyer voucher subtree and the drug sales voucher subtree, and the drug traceability voucher tree that is not yet completed is temporarily suspended. After obtaining new sales data and generating new buyer vouchers and new drug sales vouchers, a new drug circulation sub-voucher subtree is dynamically generated. Finally, when it is determined that all the drugs recorded in the contract have been sold out, a drug circulation voucher is generated based on several drug circulation sub-vouchers, and the drug circulation voucher is used as the root node, and several drug circulation sub-voucher subtrees are used as peer subtrees to generate a drug circulation subtree. It can be understood that the construction of the drug traceability voucher tree can only be truly completed after the supplier completes all drug deliveries and all drugs are sold out, that is, a complete drug traceability voucher chain is constructed based on the contract data.
[0125] S6. Generate a drug traceability certificate according to the drug source certificate and the drug circulation certificate, take the drug traceability certificate as the root node, and take the drug source certificate subtree and the drug circulation certificate subtree as the same-level subtrees under the drug traceability certificate to generate a drug traceability certificate tree.
[0126] In a preferred embodiment of the present invention, construct Figure 3 The drug traceability certificate tree shown. This embodiment takes into account the situation where suppliers deliver drugs in batches and that one contract corresponds to several sales data. It uses a dynamic method to generate a drug certificate subtree and a drug circulation subtree, and then dynamically constructs a drug traceability certificate tree. It can be understood that the drug traceability certificate tree combines the source data of the drug with the sales data to construct a complete drug traceability certificate chain, and uses a verification code generation algorithm to simultaneously ensure the authenticity, validity, security and traceability of the drug circulation data, effectively improving the drug circulation management efficiency of midstream pharmaceutical circulation companies.
[0127] This embodiment provides a method for dynamically constructing a traceability voucher chain, by constructing a drug source voucher subtree based on drug source data, constructing a drug circulation voucher subtree based on sales data, and then constructing a drug traceability voucher tree based on the drug source voucher subtree and the drug circulation voucher subtree. Therefore, the present invention combines the source data of the drug with the sales data by constructing a drug traceability voucher tree, thereby ensuring the authenticity and validity of the drug circulation data, and having the characteristics of security and traceability, so that midstream pharmaceutical distribution companies can not only strictly manage the suppliers of various types of drugs to ensure the reliability and legality of the source of drugs, but also safely and effectively manage the information of downstream pharmaceutical terminals to ensure the rational use and traceability of drugs.
[0128] See also Figure 2, is a schematic diagram of a structure of a dynamic construction device for a traceability credential chain provided by an embodiment of the present invention, comprising:
[0129] The data acquisition module is used to acquire drug source data and sales data; wherein the drug source data includes: supplier data, drug storage data, and contract data; the sales data includes: drug sales data and buyer data;
[0130] The first subtree generation module is used to generate a supplier voucher and a supplier voucher subtree according to supplier data, generate a drug voucher and a drug voucher subtree according to drug storage data, and generate a contract voucher and a contract voucher subtree according to contract data;
[0131] A second subtree generation module is used to generate a drug source certificate according to the supplier certificate, the drug certificate, and the contract certificate, and use the drug source certificate as a root node, the supplier certificate subtree, the drug certificate subtree, and the contract certificate subtree as the same-layer subtrees under the drug source certificate to generate a drug source certificate subtree;
[0132] A third subtree generation module is used to generate a drug sales voucher and a drug sales subtree according to the drug sales data, and to generate a buyer voucher and a buyer voucher subtree according to the buyer data;
[0133] A fourth subtree generation module is used to generate a drug circulation certificate according to the buyer certificate and the drug sales certificate, and use the drug circulation certificate as a root node, the drug sales subtree and the buyer certificate subtree as the same-layer subtrees under the drug circulation certificate to generate a drug circulation certificate subtree;
[0134] The voucher tree generation module is used to generate a drug traceability voucher based on the drug source voucher and the drug circulation voucher. The drug traceability voucher is used as the root node, and the drug source voucher subtree and the drug circulation voucher subtree are used as the same-level subtrees under the drug traceability voucher to generate a drug traceability voucher tree.
[0135] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0136] Those skilled in the art can clearly understand that for the sake of convenience and brevity, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0137] Another preferred embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements a method for dynamically constructing a traceability credential chain as described in any one of the above embodiments.
[0138] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0139] The processor may be a central processing unit (CPU), 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. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device.
[0140] The memory can be used to store the computer program, and the processor realizes various functions of the terminal device by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0141] Another preferred embodiment of the present invention provides a storage medium, the storage medium is a computer-readable storage medium, the computer program is stored in the computer-readable storage medium, and the computer program, when executed by the processor, can implement the steps of the above-mentioned various method embodiments. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc.
[0142] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A dynamic construction method for traceability credential chain, It is characterized in that include: Obtaining drug source data and sales data; wherein the drug source data includes: supplier data, drug storage data, and contract data; the sales data includes: drug sales data and buyer data; Generate supplier vouchers and supplier voucher subtrees based on supplier data, generate contract vouchers and contract voucher subtrees based on contract data, and generate drug vouchers and drug voucher subtrees based on drug warehousing data; Generate a drug source certificate according to the supplier certificate, the drug certificate, and the contract certificate, and use the drug source certificate as a root node, and use the supplier certificate subtree, the drug certificate subtree, and the contract certificate subtree as the same-layer subtrees under the drug source certificate to generate a drug source certificate subtree; Obtain some historical drug sales data and some historical drug inventory data; Verify whether the drug sales data is valid based on the historical drug sales data, the historical drug storage data, the drug sales data, and the drug storage data; When it is determined that the drug sales data is valid, generating a drug sales voucher and a drug sales verification code according to the drug sales data and a preset verification code generation algorithm; Generate a drug sales voucher sequence according to the drug sales voucher and the drug sales verification code; The drug sales voucher sequence is used as the root node and the drug sales data is used as the leaf node to generate a drug sales voucher subtree; Performing a legitimacy verification on the buyer data, and when it is determined that the buyer data passes the legitimacy verification, generating a buyer credential and a buyer verification code according to the buyer data and the verification code generation algorithm; Generate a buyer credential sequence according to the buyer credential and the buyer verification code; Using the buyer credential sequence as a root node and the buyer data as a leaf node, a buyer credential subtree is generated; Determining whether the drug has been sold out based on the historical drug sales data, the historical drug storage data, the drug sales data, and the drug storage data; If yes, then generate a drug circulation certificate according to the buyer certificate sequence and the drug sales certificate sequence, and use the drug circulation certificate as the root node, the drug sales subtree and the buyer certificate subtree as the same-level subtrees under the drug circulation certificate to generate a drug circulation certificate subtree; If not, a drug circulation sub-voucher is generated according to the buyer voucher sequence and the drug sales voucher sequence, the drug circulation sub-voucher is used as the root node, the drug sales subtree and the buyer voucher subtree are used as the same-level subtrees under the drug circulation sub-voucher, and a drug circulation sub-voucher subtree is generated; When a new buyer voucher sequence and a new drug sales voucher sequence are obtained, a new drug circulation sub-voucher and a new drug circulation sub-voucher sub-tree are generated, and when it is determined that the drug is sold out, a drug circulation voucher is generated according to a plurality of drug circulation sub-vouchers, and the drug circulation voucher is used as a root node, and the plurality of drug circulation sub-voucher sub-trees are used as peer sub-trees to generate a drug circulation sub-tree; A drug traceability certificate is generated according to the drug source certificate and the drug circulation certificate. The drug traceability certificate is used as the root node, and the drug source certificate subtree and the drug circulation certificate subtree are used as the same-level subtrees under the drug traceability certificate to generate a drug traceability certificate tree.
2. A method for dynamically constructing a traceability voucher chain as claimed in claim 1, It is characterized in that Generate supplier vouchers and supplier voucher subtrees based on supplier data, and generate contract vouchers and contract voucher subtrees based on contract data, including: Performing a legitimacy verification on the supplier data, and when it is determined that the supplier data passes the legitimacy verification, generating a supplier credential and a supplier verification code according to a preset verification code generation algorithm and the supplier data; Generate a supplier credential sequence according to the supplier credential and the supplier verification code; Taking the supplier credential sequence as the root node and the supplier data as the leaf node, a supplier credential subtree is generated; Generate a contract certificate and a contract verification code according to the contract data and the verification code generation algorithm; Generate a contract certificate sequence according to the contract certificate and the contract verification code; The contract certificate sequence is used as the root node and the contract data is used as the leaf node to generate a contract certificate subtree.
3. A method for dynamically constructing a traceability voucher chain as claimed in claim 2, It is characterized in that Generate drug vouchers and drug voucher subtrees based on drug inventory data, including: Determining whether the supplier has completed drug delivery based on the drug storage data and the contract data; If so, generate a drug voucher according to the drug storage data, and use the drug voucher as the root node and the drug storage data as the leaf node to generate a drug voucher subtree; If not, a drug sub-voucher is generated according to the drug storage data, and the drug sub-voucher is used as the root node and the drug storage data is used as the leaf node to generate a drug sub-voucher subtree; When new drug inventory data is obtained, a new drug sub-voucher and a new drug sub-voucher subtree are generated. When it is determined that the supplier has completed the drug delivery, a drug voucher is generated based on several drug sub-vouchers, and the drug voucher is used as the root node, and several of the drug sub-voucher subtrees are used as subtrees of the same level to generate a drug voucher subtree.
4. A method for dynamically constructing a traceability voucher chain as claimed in claim 3, It is characterized in that The drug sales data and the historical drug sales data include: the drug sales quantity of each type of drug; the drug storage data and the historical drug sales data include: the drug storage quantity of each type of drug; The verifying whether the drug sales data is valid based on the historical drug sales data, the historical drug storage data, the drug sales data, and the drug storage data includes: Determine all drugs existing in the drug sales data as target drugs; According to the target drugs, counting the drug storage data and the drug storage quantity of each target drug in the historical drug sales data, and generating the total drug storage quantity of each target drug; According to the target drugs, counting the drug sales data and the historical drug sales data, the drug sales quantity of each target drug, and generating the total drug sales of each target drug; When it is determined that the total drug sales of all target drugs is not greater than the total drug inventory, the drug sales data is determined to be valid; When it is determined that the total drug sales of a target drug is greater than the total drug inventory, the drug sales data is determined to be invalid.
5. A method for dynamically constructing a traceability voucher chain as claimed in claim 4, It is characterized in that The verification code generation algorithm includes: Obtaining a target credential; wherein the target credential is the supplier credential, the contract credential, the drug sales credential, or the buyer credential; The target credential is encrypted using a hash algorithm to generate a digital summary of the target credential; The target credential, the digital summary, and the credential type of the target credential are combined to generate a credential verification code corresponding to the target credential, wherein the credential verification code is the supplier verification code, the contract verification code, the drug sales verification code, or the buyer verification code.
6. A dynamic construction device for tracing voucher chain, It is characterized in that include: The data acquisition module is used to acquire drug source data and sales data; wherein the drug source data includes: supplier data, drug storage data, and contract data; the sales data includes: drug sales data and buyer data; The first subtree generation module is used to generate a supplier voucher and a supplier voucher subtree according to supplier data, generate a drug voucher and a drug voucher subtree according to drug storage data, and generate a contract voucher and a contract voucher subtree according to contract data; A second subtree generation module is used to generate a drug source certificate according to the supplier certificate, the drug certificate, and the contract certificate, and use the drug source certificate as a root node, the supplier certificate subtree, the drug certificate subtree, and the contract certificate subtree as the same-layer subtrees under the drug source certificate to generate a drug source certificate subtree; The third subtree generation module is used to obtain a number of historical drug sales data and a number of historical drug storage data; verify whether the drug sales data is valid according to the historical drug sales data, the historical drug storage data, the drug sales data, and the drug storage data; when it is determined that the drug sales data is valid, generate a drug sales voucher and a drug sales verification code according to the drug sales data and a preset verification code generation algorithm; generate a drug sales voucher sequence according to the drug sales voucher and the drug sales verification code; use the drug sales voucher sequence as the root node and the drug sales data as the leaf node to generate a drug sales voucher subtree; perform legitimacy verification on the buyer data, and when it is determined that the buyer data passes the legitimacy verification, generate a buyer voucher and a buyer verification code according to the buyer data and the verification code generation algorithm; generate a buyer voucher sequence according to the buyer voucher and the buyer verification code; use the buyer voucher sequence as the root node and the buyer data as the leaf node to generate a buyer voucher subtree; The fourth subtree generation module is used to determine whether the drug is sold out according to the historical drug sales data, the historical drug storage data, the drug sales data, and the drug storage data; if so, generate a drug circulation certificate according to the buyer's certificate sequence and the drug sales certificate sequence, and use the drug circulation certificate as the root node, the drug sales subtree and the buyer's certificate subtree as the same-level subtrees under the drug circulation certificate to generate a drug circulation certificate subtree; if not, generate a drug circulation sub-certificate according to the buyer's certificate sequence and the drug sales certificate sequence, use the drug circulation sub-certificate as the root node, use the drug sales subtree and the buyer's certificate subtree as the same-level subtrees under the drug circulation sub-certificate to generate a drug circulation sub-certificate subtree; when a new buyer's certificate sequence and a new drug sales certificate sequence are obtained, generate a new drug circulation sub-certificate and a new drug circulation sub-certificate subtree, and when it is determined that the drug is sold out, generate a drug circulation certificate according to a plurality of drug circulation sub-certificates, use the drug circulation certificate as the root node, and use a plurality of the drug circulation sub-certificate subtrees as the same-level subtrees to generate a drug circulation subtree; The voucher tree generation module is used to generate a drug traceability voucher based on the drug source voucher and the drug circulation voucher. The drug traceability voucher is used as the root node, and the drug source voucher subtree and the drug circulation voucher subtree are used as the same-level subtrees under the drug traceability voucher to generate a drug traceability voucher tree.
7. A terminal device, It is characterized in that The method comprises a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, a method for dynamically constructing a traceability credential chain as described in any one of claims 1 to 5 is implemented.
8. A storage medium, It is characterized in that The storage medium includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute a method for dynamically constructing a traceability credential chain as described in any one of claims 1 to 5.
