A drug multi-batch mixed sampling control method, system and storage medium

Through the multi-batch mixed sampling control method of drugs, a random random placement algorithm is used to generate and other probabilistic sampling sample information databases, the problem of time-consuming and labor-consuming manual sampling in drug raw material quality inspection is solved, automatic sampling and efficient quality inspection are realized, and the accuracy and consistency of drug quality are ensured.

CN113887949BActive Publication Date: 2025-08-15MINGDU ZHIYUN (ZHEJIANG) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111162680.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2025-08-15
Estimated Expiration
2041-09-30

AI Technical Summary

Technical Problem

There are a lot of manual sampling operations during the quality inspection of raw materials of traditional Chinese medicines in the prior art, which is time-consuming and labor-intensive, and the compliance is difficult to meet. The manual screening and sampling efficiency is inefficient, which makes it easy to cause inaccurate sampling caused by human intervention.

Method used

The multi-batch mixed sampling control method of drug products is used to analyze the sampling instructions for drug raw materials, and the sampling working parameters are generated. The barcode information of goods is mixed or entered separately according to the batch production information. The random random placement algorithm is used to perform sampling, forming a random sampling sample information database with equal probability.

Benefits of technology

It realizes automatic sampling of raw materials for pharmaceuticals, reduces manual intervention, improves quality inspection speed and efficiency, can promptly detect batch quality differences, accurately locate problem batches, and improves the quality management level of pharmaceutical companies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113887949B_ABST
    Figure CN113887949B_ABST
Patent Text Reader

Abstract

The present invention discloses a control method, system and storage medium for multi-batch mixed sampling of pharmaceuticals, including parsing a pharmaceutical raw material random inspection instruction, querying the quantity of raw materials in the corresponding batch according to the batch information of the raw materials to be inspected if it is a second sampling parameter, determining whether to mix the barcode information of the goods in each batch according to the production information of each batch and entering the information into a first barcode table, and generating a request for inspection of the raw materials to be inspected; then receiving the request for inspection, using a random scrambling algorithm to randomly select the barcode information of each product in the first barcode table, swapping the positions of the barcodes to form a second barcode table, and then sampling the goods in the second barcode table with equal probability, and entering the extracted barcode information into a random inspection sample information database. This method can detect quality differences between batches of goods, reduce manual intervention in sampling goods, realize batch-based automatic sampling of drugs, and improve the speed and efficiency of raw material quality inspection in pharmaceutical companies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent manufacturing, and in particular to a method, system and storage medium for automatic sampling control of pharmaceutical raw materials. Background Art

[0002] At present, most pharmaceutical companies still rely on staff to perform a large amount of manual sampling operations on batch materials when carrying out quality management work and conducting drug quality inspections. This manual screening and sampling process is time-consuming and labor-intensive, and compliance requirements are difficult to meet. Summary of the Invention

[0003] In view of the shortcomings of the prior art, the present invention provides a method for controlling multi-batch mixed sampling of medicines, comprising the following steps:

[0004] S1, parsing the drug raw material random inspection instruction, generating sampling working parameters according to the raw material properties and the production information of each batch of the raw material to be inspected, wherein the sampling working parameters include a first sampling parameter and a second sampling parameter;

[0005] S2: If the second sampling parameter is used, the quantity of raw materials in the corresponding batch is queried based on the batch information of the raw materials to be inspected, all product barcodes in each batch of raw materials are obtained from the raw material information database, and based on the production information of each batch, the barcode information of the products in each batch is determined to be mixed and entered into the first product barcode table, thereby generating a request for inspection of the raw materials to be inspected;

[0006] S3, receiving the inspection application form, using a random scrambling algorithm to randomly select the barcode information of each product in the first barcode table, swapping the positions of the barcode information to form a second barcode table, and then performing random degree verification on the second barcode table to ensure that it meets the preset probability, sampling the products in the second barcode table with equal probability, and entering the sampled barcode information into the random inspection sample information database.

[0007] Preferably, step S2 includes: obtaining the production time interval of each batch of raw materials to be inspected from the production information of each batch; if the production time interval between multiple batches is less than the preset time, the barcode information of the goods of these batches are mixed and entered into the first barcode table of goods; otherwise, the barcode information of each batch of goods is entered into its corresponding barcode table separately.

[0008] Preferably, the step S2 further specifically includes:

[0009] Obtaining the batch time span of each batch of raw materials to be inspected, where the batch time span is the time interval between the earliest produced goods and the latest produced goods in the batch of raw materials to be inspected;

[0010] Calculate the production time interval between each batch of raw materials to be inspected, where the production time interval is the time interval between the latest produced goods in the earlier batch of raw materials to be inspected and the earliest produced goods in the later batch of raw materials to be inspected;

[0011] The batch time spans and production time intervals of each batch of raw materials to be inspected are traversed to obtain one or more related batches of raw materials to be inspected groups, wherein the related batches of raw materials to be inspected are batches of raw materials to be inspected for which the ratio of the production time interval of two batches of raw materials to be inspected to the sum of the time spans of the two batches is lower than a preset value, and the barcode information of each batch of goods in the related batches of raw materials to be inspected groups is mixed and entered into the same first barcode table of goods.

[0012] Preferably, the step S3 specifically further includes:

[0013] S31, using a random scrambling algorithm to randomly select each barcode of the product information in the first barcode table, swapping the positions of the selected products to form a second barcode table;

[0014] S32, after the randomness verification of the second product barcode table meets the preset probability, it is determined whether the number of products in the second product barcode table is less than or equal to the predetermined number of random inspection samples. If so, all product barcodes are entered into the random inspection sample information database;

[0015] S33, if the quantity of goods is greater than the predetermined number of random inspection samples, the preset sampling strategy corresponding to the attribute of the drug raw material is called to sample each barcode of the goods in the goods barcode table with equal probability, and the sampled barcode information is entered into the random inspection sample information database.

[0016] Preferably, the step S33 specifically includes:

[0017] S331, if the number of goods in the second product barcode table is greater than the predetermined number of samples for random inspection, then sequentially enter the first k product barcode information in the product barcode table into the first sample library, where k is not greater than the predetermined number of samples for random inspection m, and enter the subscript of each product barcode information entered into the first sample library into the second sample library;

[0018] S332, determine whether to enter the current product barcode information into the first sample library with a probability of k⁄(k+1) for the remaining product barcode information in the product barcode table. When a new product barcode information is entered into the first sample library, enter the subscript of the product barcode information into the second sample library, and randomly select a product barcode information from the first sample library and move it out of the first sample library, until all the product barcode information in the product barcode table is traversed and the first sample library is used as the sampling sample information library.

[0019] The present invention also discloses a multi-batch mixed sampling control system for medicines, comprising: an instruction receiving module for parsing a random inspection instruction for medicine raw materials, generating sampling working parameters according to raw material properties and production information of each batch of raw materials to be inspected, the sampling working parameters including a first sampling parameter and a second sampling parameter; a barcode table generating module for querying the quantity of raw materials in a corresponding batch according to the batch information of the raw materials to be inspected when the sampling working parameter is the second sampling parameter, obtaining all product barcodes in each batch of raw materials from a raw material information database, judging whether to mix the product barcode information of each batch according to the production information of each batch and entering the information into a first product barcode table, and generating an inspection application form for the raw materials to be inspected; a sampling module for randomly selecting each product barcode information from the product barcode information in the first product barcode table by using a random scrambling algorithm, exchanging the positions of the product barcode information, forming a second product barcode table, performing random degree verification on the second product barcode table to ensure that the randomness meets a preset probability, sampling the products in the second product barcode table with equal probability, and entering the sampled product barcode information into a random inspection sample information database.

[0020] Preferably, the first barcode table generating module is specifically configured to obtain the production time intervals of the previous and subsequent batches of raw materials to be inspected from the production information of each batch; if the production time interval between multiple batches is less than a preset time, the barcode information of the goods of these batches are mixed and entered into the first barcode table of goods; otherwise, the barcode information of each batch of goods is entered into the corresponding independent barcode table separately.

[0021] Preferably, the first barcode table generating module specifically includes: a time span obtaining module, used to obtain the batch time span of each batch of raw materials to be inspected, the batch time span being the time interval between the earliest produced goods and the latest produced goods in the batch of raw materials to be inspected; a time interval obtaining module, used to calculate the production time interval between each batch of raw materials to be inspected, the production time interval being the time interval between the latest produced goods in the earlier batch of raw materials to be inspected and the earliest produced goods in the later batch of raw materials to be inspected; a related batch obtaining module, used to traverse the batch time span and production time interval of each batch of raw materials to be inspected, and obtain one or more related batches of raw materials to be inspected groups, wherein the related batches of raw materials to be inspected are batches of raw materials to be inspected for which the ratio of the production time interval of two batches of raw materials to be inspected to the sum of the time spans of the two batches is lower than a preset value, and the barcode information of each batch of goods in the related batch of raw materials to be inspected groups is mixed and entered into the same first goods barcode table.

[0022] The present invention also discloses a multi-batch mixed sampling device for medicines, comprising 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 steps of any of the above methods are implemented.

[0023] The present invention also discloses a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above methods are implemented.

[0024] The multi-batch mixed sampling control method for pharmaceuticals disclosed in the present invention can delineate related batch groups based on the relationship between the production time intervals of each batch of raw materials to be inspected and the time span between batches. Related batches can be directly mixed and sampled as a whole, while unrelated batches can be sampled separately. This allows for timely detection of high unqualified rates in specific batches of raw materials to be sampled and inspected, ensuring accurate knowledge of the overall quality status of the goods to be inspected while more effectively locating specific problem batches. This method can detect quality differences between batches of goods, reduce manual intervention in sampled goods, realize batch-based automatic sampling of drugs, and improve the speed and efficiency of raw material quality inspections for pharmaceutical companies.

[0025] Additional aspects and advantages of the present invention will be set forth in part in the description which follows and, in part, will be obvious from the description which follows, or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0027] Figure 1 This is a flow chart of the method for controlling multi-batch mixed sampling of drugs disclosed in this embodiment.

[0028] Figure 2 This is a schematic diagram of the specific flow of step S2 disclosed in this embodiment.

[0029] Figure 3 This is a schematic diagram of the specific flow of step S3 disclosed in this embodiment.

[0030] Figure 4 This is a schematic diagram of the specific flow of step S33 disclosed in this embodiment. DETAILED DESCRIPTION

[0031] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the described embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0032] In the description of the present invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature specified as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, "plurality" means two or more, unless otherwise specifically defined.

[0033] In the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," "connect," "fixed," etc. should be understood broadly. For example, they may refer to fixed, detachable, or integral connections; mechanical or electrical connections; direct or indirect connections through an intermediary; or internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on specific circumstances.

[0034] In the present invention, unless otherwise expressly specified or limited, a first feature being "above" or "below" a second feature may include the first and second features being in direct contact, or may include the first and second features being in contact not directly but through another feature between them. Furthermore, a first feature being "above," "above," and "above" a second feature may include the first feature being directly above or obliquely above the second feature, or may simply mean that the first feature is higher in level than the second feature. A first feature being "below," "below," and "below" a second feature may include the first feature being directly below or obliquely below the second feature, or may simply mean that the first feature is lower in level than the second feature.

[0035] In the quality management work of pharmaceutical companies, there are still a lot of manual sampling operations for batch materials during the quality inspection process, which is time-consuming and labor-intensive. This type of manual screening sampling method has low sampling efficiency and the possibility of human intervention in sampling, and compliance requirements are difficult to meet. In order to solve the above shortcomings, the present invention provides a multi-batch mixed sampling control method for drugs, as shown in the attached figure. Figure 1 As shown, the method includes the following steps:

[0036] Step S1: Parse the drug raw material sampling inspection instruction and generate sampling parameters based on the raw material properties and the production information of each batch of the raw material to be inspected. The sampling parameters include a first sampling parameter and a second sampling parameter. In this embodiment, the first sampling parameter is for non-automatic sampling, and the second sampling parameter is for automatic sampling.

[0037] Whether each product is automatically sampled can form the following data structure:

[0038] {

[0039] "autoSample": 1, / / Whether to automatically select samples 1 automatic sampling 0 non-automatic sampling

[0040] }

[0041] The automatically sampled goods can form the following data structure,

[0042] {

[0043] "barcodeId": 00001,

[0044] "barcodeId": 00006,

[0045] "barcodeId": 00034,

[0046] "barcodeId": 00012,

[0047] "barcodeId": 00022, ....

[0048] }

[0049] The autoSample field indicates whether the sampling method for the pharmaceutical raw material is automatic sampling, serving as the basis for receiving the inspection request form. The barcodeId field contains the barcode information of the randomly sampled item and serves as the basis for generating the sampling plan.

[0050] S2, if it is the second sampling parameter, then the quantity of raw materials in the corresponding batch is queried based on the batch information of the raw materials to be inspected, all the barcodes of the goods in each batch of raw materials are obtained from the raw material information database, and the barcodes of the goods in each batch are determined based on the production information of each batch, and the barcodes of the goods in each batch are mixed and entered into the first barcode table of goods, thereby generating an application form for the inspection of the raw materials to be inspected. Among them, if it is the first sampling parameter, the preset sample configuration value is retrieved, and the corresponding barcode information of the goods in each batch of raw materials to be sampled and inspected is obtained based on the preset sample configuration value and entered into the inspection sample information database. If it is the second sampling parameter, the quantity of raw materials in the corresponding batch is first queried based on the batch information of the raw materials to be inspected, all the barcodes of the goods in each batch of raw materials are obtained from the raw material information database, and the barcodes of the goods in each batch are determined based on the production information of each batch, and the barcodes of the goods in each batch are mixed and entered into the first barcode table of goods, thereby generating an application form for the inspection of the raw materials to be inspected.

[0051] In this embodiment, the autoSample field is used to mark whether the sampling method of the pharmaceutical raw material is automatic sampling, which serves as the basic data when receiving the inspection application form. The barcodeId field is the barcode information of the randomly sampled goods, and also serves as the basic data for generating the sampling plan. After obtaining these two basic data, when receiving the inspection application form, the basic data is used for calculation and the received result, i.e., the sampling plan table data, is persisted. Any relational or non-relational database, such as MySQL, SqlServer, Oracle, MongoDB, Elasticsearch, etc., can be selected to persist the sampling plan data. The first sampling parameter is non-automatic sampling, that is, the corresponding barcode information of the goods in the batch of raw materials is obtained according to the set sample configuration value and entered into the inspection sample information library. The sample configuration value can be a specific sampling rule, such as sampling according to the barcode information interval or sampling according to the preset barcode judgment method.

[0052] In this embodiment, step S2 may include obtaining the production time intervals of the previous and subsequent batches of raw materials to be inspected from the production information of each batch. If the production time interval between multiple batches is less than a preset time, the barcode information of the goods of these batches is mixed and entered into the first barcode table of goods; otherwise, the barcode information of each batch of goods is entered into its corresponding barcode table separately.

[0053] This embodiment generates different sampling parameters based on the properties of the raw material, the batch information of the raw material to be inspected, or the sampling method. It then queries the batch information for the raw material to generate a request for inspection. Based on the request and the operating parameters, it automatically selects different sampling methods for the corresponding batch of goods. This allows for flexible configuration of product quality inspection strategies and generates a sampling schedule upon receiving the request, improving the efficiency of the inspection process. This method allows for random sampling and analysis of goods corresponding to the quality management request, identifying quality differences between batches. It is suitable for large product volumes, avoiding human intervention, minimizing manual intervention in sampled goods, and avoiding incomplete quality inspection coverage due to unhashed sampling. Ultimately, automated batch-based drug sampling is achieved, addressing the inefficiency and error-proneness of manual sampling. This helps pharmaceutical companies better control drug quality, improves the speed and efficiency of raw material quality inspection, and accelerates drug production.

[0054] As attached Figure 2 As shown, the step S2 may further specifically include:

[0055] Step S21 : obtaining the batch time span of each batch of raw materials to be inspected, wherein the batch time span is the time interval between the earliest produced goods and the latest produced goods in the batch of raw materials to be inspected.

[0056] Step S22 , calculating the production time interval between each batch of raw materials to be inspected, wherein the production time interval is the time interval between the latest produced goods in the earlier batch of raw materials to be inspected and the earliest produced goods in the later batch of raw materials to be inspected.

[0057] Step S23 traverses the batch time spans and production time intervals of each batch of raw materials to be inspected, obtaining one or more groups of related batches of raw materials to be inspected, wherein the related batches of raw materials to be inspected are batches of raw materials to be inspected for which the ratio of the production time interval of two batches of raw materials to the sum of the time spans of these two batches is less than a preset value. The barcode information of each batch of goods in the related batches of raw materials to be inspected is mixed and entered into a single first barcode table. The preset value can be pre-set before inspection based on the actual conditions of the goods to be inspected. For example, if the preset value is set to 1, then if the time interval between the latest produced goods in the earlier batch of raw materials to be inspected and the earliest produced goods in the later batch of raw materials to be inspected is less than or equal to the sum of the time spans of these two batches, the two batches of raw materials to be inspected are marked as related batches. Because the related batches of raw materials to be inspected have similar production times, the processing environment conditions, equipment conditions, and raw material parameters of these two batches are very similar during production, and they can be approximated as raw materials produced with the same production parameters for mixed sampling. However, when two batches of raw materials to be inspected are not considered to be related batches, that is, the ratio of the production time interval of the two batches of raw materials to be inspected to the sum of the time spans of the two batches exceeds the preset value, since the production interval of the goods in the two batches is too long, it may cause the equipment status to be different during the production and processing of each batch of goods due to different working hours, which may lead to different processing deviations due to work loss when producing raw materials, or slight differences in some environmental parameters in the processing environment due to different seasons, or slight differences in some internal parameters due to the long interval time, which partially affects the final parameters to be inspected of the two batches. Therefore, it is more appropriate to conduct separate spot checks on the two batches of raw materials to be inspected, so as to promptly discover the problem of high unqualified rate between a batch of raw materials, thereby more effectively locating the problem batch of goods while ensuring the accurate knowledge of the overall quality status of the goods.

[0058] Step S3, receiving the inspection application form, using a random scrambling algorithm to randomly select the barcode information of each product in the first barcode table of goods, swapping the positions to form a second barcode table of goods, and then performing random degree verification on the second barcode table to ensure that it meets the preset probability, sampling the goods in the second barcode table with equal probability, and entering the sampled barcode information into the sampling sample information library. The inspection application form for the raw materials to be inspected includes but is not limited to one or more of the sampling work parameters, the batch of raw materials to be inspected, the identity information of the submitter, and the predetermined number of samples for random inspection. The predetermined number of samples for random inspection is the number of samples required for this sampling work. The sampling sample information library stores the sampling sample groups corresponding to each second barcode table and the sampling sample groups corresponding to the remaining batches of goods that have not been mixed because there are no related batches.

[0059] In this embodiment, step S3 further includes:

[0060] Step S301: determine whether the number of goods in the relevant batch of raw materials to be inspected is less than or equal to the predetermined number of random inspection samples. If so, enter all the barcodes of the goods into the random inspection sample information database. This step may also include the following:

[0061] Step S3011: Obtain the quantity of goods in these batches of raw materials according to the barcode table of all goods in the relevant batches of raw materials to be inspected. If the quantity of goods is less than a first preset value, enter all the barcodes of the goods into the random inspection sample information database.

[0062] Step S3012: If the quantity of goods is greater than a first preset value, the first preset value is lower than the predetermined number of samples for random inspection, and the predetermined number of samples for random inspection is less than a second preset value, the square root of the quantity of goods is rounded up as the adjusted sample base.

[0063] Step S3013: If the quantity of goods is greater than the first preset value and the number of samples to be randomly inspected is greater than the second preset value, half of the square root of the number of goods is used as the adjusted sample base.

[0064] Specifically, according to the batch number of the inspection application form, the barcode information list of all goods corresponding to the batch is retrieved. <long>barcodeIds. If the number n of barcodeIds corresponding to the barcode information of the goods in the relevant batch of raw materials to be inspected is less than 300 (i.e., in this embodiment, the minimum sampling quantity, also known as the first preset value, is set to 300), then barcodeIds is directly returned as a sampling record. Otherwise, the square root of n is first taken and rounded to the nearest integer to obtain the sampling reference quantity i. If m is less than or equal to 600, the sampling number m = i + 1; otherwise, m = i / 2 + 1. A random value is obtained using barcodeIds as the data source and m as the sampling quantity. During the random value extraction, if n of barcodeIds is less than the sampling quantity m, then barcodeIds is returned as a random sampling record.

[0065] In step S302, if the number of goods in the relevant batch of raw materials to be inspected is greater than the predetermined number of random inspection samples, the preset sampling strategy corresponding to the properties of the pharmaceutical raw materials is called to sample each product barcode in the product barcode table with equal probability, and the sampled product barcode information is entered into the random inspection sample information database.

[0066] In another specific embodiment, as shown in the attached Figure 3 As shown, step S3 may further include:

[0067] In step S31 , a random scrambling algorithm is used to randomly select each barcode of the product in the first barcode table, and the positions of the selected products are swapped to form a second barcode table.

[0068] Specifically, when conducting mixed sampling inspection on multiple batches, the data sets of multiple batches are first mixed and shuffled. In order to ensure that the data sets of multiple batches are arranged randomly and chaotically, a random shuffling algorithm is adopted in this embodiment to randomly select elements for exchange. First, a method randInt(int min, int max) is defined to obtain a random integer in the closed interval [min, max]. Random.nextInt(min, max) is called to obtain a random value between [min, max]. Then, a random shuffle algorithm shuffle(List<int>) is defined. <long>list), define the variable length = list.size() in the algorithm, randomly select an element by calling randInt(i, length - 1) in a loop, and then exchange the i-th and rand-th data in list list. list.get(i) = list.get(rand).

[0069] In step S32, after verifying the randomness of the second product barcode list and confirming that it meets the preset probability, a determination is made as to whether the number of products in the second product barcode list is less than or equal to the predetermined number of samples for random inspection. If so, all product barcodes are entered into the random inspection sample database. A Monte Carlo method can be used to verify that the result set after the data exchange in the above step is sufficiently random. The frequency of all permutations and combinations of list list is listed and displayed as a histogram. Assuming list = {1, 2, 3, 4}, after each shuffle, the frequency corresponding to the resulting shuffle result is increased by one. Repeat this 1 million times. If the total number of occurrences of each result is similar, the probability of each result occurring should be equal.

[0070] In step S33, if the quantity of goods is greater than the predetermined number of random inspection samples, the preset sampling strategy corresponding to the attribute of the drug raw material is called to sample each barcode of the goods in the goods barcode table with equal probability, and the sampled barcode information is entered into the random inspection sample information database.

[0071] As attached Figure 4 As shown, in this embodiment, step S33 may further specifically include:

[0072] In step S331, if the number of goods in the second product barcode table is greater than the predetermined number of samples for random inspection, the first k product barcode information in the product barcode table is sequentially entered into the first sample library, where k is not greater than the predetermined number of samples for random inspection m, and the subscript of each product barcode information entered into the first sample library is entered into the second sample library.

[0073] In step S332, the remaining product barcode information in the product barcode table is sequentially judged with a probability of k⁄(k+1) whether to enter the current product barcode information into the first sample library. When a new product barcode information is entered into the first sample library, the subscript of the product barcode information is entered into the second sample library, and a product barcode information is randomly selected from the first sample library and removed from the first sample library. After all the product barcode information in the product barcode table is traversed, the first sample library is used as the sampling sample information library.

[0074] Specifically, similar to the above step S33, k samples are randomly selected from the second barcode table after mixing the barcode information of each batch of goods, and the probability of each sample being selected is required to be equal. We adopt a custom sampling algorithm, first put k numbers into the first sample library, and then each number (>k) is randomly selected. The probability of swapping into the first sample library is , and a number in the first sample library is randomly selected for swapping out. For n (n>=k), if each time The probability of whether to put it into the first sample library until n, then the probability of each element being selected is equal, which is Suppose an element α, and α ≦ n, then the probability of it being selected in the end is: the probability of it being selected * [the element after it is not selected + the element after it is selected * without replacing α], that is: ×{( + × ) × ( + × ) × ┄ × + × }= ×{( ) × ( ) × ┄ × }= × = Define n as the total size of the list to be extracted, and m as the number of samples to be extracted. In order to ensure that the probability of each sample being extracted is , the first sample is For the second sample, if the first sample is selected, the probability of it being selected is , if the first sample is not drawn, the probability of it being drawn is The probability of the second sample being selected is * + * (1 - )= For the i-th sample, the probability of being selected is , where k is the number of samples previously drawn, and k <= m. That is, when drawing the i-th sample, if k samples have already been drawn, then mk samples need to be drawn from the remaining n-i+1 samples. After traversing all the product barcode information in the second product barcode table, the first sample database is entered into the random inspection sample information database.

[0075] In a specific embodiment, a function random(List <long>barcodeIds, int m), this method is used to randomly select m barcode information from the barcodeIds batch barcode information. The function defines the number of barcodes that have been selected, that is, the second sample library checkedNum = m, the total number of barcodes in the batch len = barcodeIds.size(), and the list of randomly selected barcode information List <long>list, key-value pair Map<int, Long> CheckedMap is used to mark whether the randomly selected index has existed before, and the int[] array of size m is used to store the first m elements of the total barcode barcodeIds sampled. In the loop for(int i = 0; i < m; i++), the first m elements are directly placed into the array result[i] = barcodeIds.get(i). In the loop for(int i = m; i < len; i++), m + 1 elements are sampled with probability. The random index int index = random.nextInt(i + 1) is first calculated (here using the Java API function Random). If index is less than the number m to be sampled, and if checkedMap does not contain the current index, barcodeIds.get(i) is assigned to result[r], that is, if (r < m) result[r] = barcodeIds.get(i). This is the embodiment of the probability of being sampled k / n mentioned above. The current randomly selected index is then recorded in checkedMap. After both loops complete, the result array is returned as the sampling result set. Finally, the sampling result set, i.e., the barcode information of the sampled items, is entered into the random inspection sample database. Furthermore, the random sampling algorithm fully considers the size of the sampled specimens relative to the total number of samples, records the random sampling index, and avoids repeated sampling of the same item. This makes the method more versatile and improves the efficiency and coverage of quality inspection sampling.

[0076] After the subsequent random inspection of the goods in the random inspection sample information database, if the goods pass rates of the random inspection sample groups corresponding to each second product barcode table and the random inspection sample groups corresponding to the remaining single batches of goods that have not been mixed due to the absence of related batches are both higher than the preset value, the barcode information of the goods in all batches can be mixed and entered into the third product barcode table. The barcode information of the goods in the third product barcode table is randomly selected using a random scrambling algorithm to randomly swap the positions of the barcode information of each product to form a fourth product barcode table. The goods in the fourth product barcode table are sampled with equal probability, and the extracted barcode information of the goods is entered into the random inspection sample information database and then random inspection is performed to obtain the overall pass rate.

[0077] If at least one of the qualified rates of each product in the sampling sample groups corresponding to each second product barcode table and the sampling sample groups corresponding to the remaining individual batches of goods that have not been mixed because there are no related batches is lower than the preset value, a warning message will be directly issued to the corresponding sampling sample groups or individual batches of goods, and no mixed sampling will be carried out on the entire product.

[0078] In this embodiment, relevant batch groups are defined based on the relationship between the production time intervals of each batch of raw materials to be inspected and the time span between batches. Relevant batches can be directly mixed and sampled as a whole, while unrelated batches can be sampled separately. This allows timely discovery of the high unqualified rate that may exist in a specific batch of raw materials, ensuring accurate knowledge of the overall quality status of the goods while more effectively locating the problem batch of goods.

[0079] The present invention also discloses a multi-batch mixed sampling control system for medicines, comprising an instruction receiving module for parsing a random inspection instruction for medicine raw materials, generating sampling working parameters according to raw material properties and production information of each batch of raw materials to be inspected, the sampling working parameters including a first sampling parameter and a second sampling parameter; a barcode table generating module for querying the quantity of raw materials in a corresponding batch according to the batch information of the raw materials to be inspected when the sampling working parameter is the second sampling parameter, obtaining all product barcodes in each batch of raw materials from a raw material information database, judging whether to mix the product barcode information of each batch according to the production information of each batch and entering the information into a first product barcode table, and generating an inspection application form for the raw materials to be inspected; a sampling module for randomly selecting each product barcode information from the product barcode information in the first product barcode table by using a random scrambling algorithm, exchanging the positions of the product barcode information, forming a second product barcode table, performing random degree verification on the second product barcode table to ensure that the randomness meets a preset probability, sampling the products in the second product barcode table with equal probability, and entering the sampled product barcode information into a random inspection sample information database.

[0080] In this embodiment, the first barcode table generating module is specifically configured to obtain the production time intervals of the previous and subsequent batches of raw materials to be inspected from the production information of each batch. If the production time interval between multiple batches is less than a preset time, the barcode information of the goods of these batches is mixed and entered into the first barcode table of goods; otherwise, the barcode information of each batch of goods is entered into the corresponding independent barcode table separately.

[0081] In this embodiment, the first barcode table generating module further specifically includes a time span acquiring module for acquiring the batch time span of each batch of raw materials to be inspected, where the batch time span is the time interval between the earliest produced goods and the latest produced goods in the batch of raw materials to be inspected; a time interval acquiring module for calculating the production time interval between each batch of raw materials to be inspected, where the production time interval is the time interval between the latest produced goods in the earlier batch of raw materials to be inspected and the earliest produced goods in the later batch of raw materials to be inspected; and a related batch acquiring module for traversing the batch time spans and production time intervals of each batch of raw materials to be inspected, and acquiring one or more related batch groups of raw materials to be inspected, wherein the related batches of raw materials to be inspected are batches of raw materials to be inspected for which the ratio of the production time interval of two batches of raw materials to be inspected to the sum of the time spans of the two batches is lower than a preset value, and mixing the barcode information of each batch of goods in the related batch group of raw materials to be inspected and entering them into the same first barcode table for goods.

[0082] The specific functions of the above-mentioned drug multi-batch mixed sampling control system correspond one-to-one to the drug multi-batch mixed sampling control method disclosed in the previous embodiment, so they will not be described in detail here. For details, please refer to the various embodiments of the drug multi-batch mixed sampling control method disclosed previously. It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to in detail.

[0083] In other embodiments, a device for controlling multi-batch mixed sampling of drugs is provided, comprising 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 various steps of the method for controlling multi-batch mixed sampling of drugs described in the above embodiments are implemented.

[0084] The drug multi-batch mixed sampling control device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the schematic diagram is merely an example of a drug multi-batch mixed sampling control device and does not limit the device to the present invention. The device may include more or fewer components than shown, or a combination of certain components, or different components. For example, the drug multi-batch mixed sampling control device may also include input and output devices, network access devices, buses, and the like.

[0085] The processor may be a central processing unit (CPU), or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (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 serves as the control center of the device for controlling the multi-batch mixed sampling of drugs, and utilizes various interfaces and lines to connect various parts of the device for controlling the multi-batch mixed sampling of drugs.

[0086] The memory can be used to store the computer program and / or module. The processor implements the various functions of the device for controlling multi-batch mixed sampling of drugs by running or executing the computer program and / or module 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. 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 media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state storage device.

[0087] If the drug multi-batch mixed sampling control device is implemented as a software functional unit and sold or used as a standalone product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention can also implement all or part of the process steps in the above-mentioned method embodiments by using a computer program to instruct the relevant hardware. The computer program can be stored in a computer-readable storage medium. When executed by a processor, the computer program can implement the steps of each of the above-mentioned drug multi-batch mixed sampling control method embodiments. The computer program includes computer program code, which can be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium can include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practices in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practices, computer-readable media do not include electrical carrier signals and telecommunication signals.

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

[0089] In short, the above description is only a preferred embodiment of the present invention, and all equivalent changes and modifications made according to the scope of the patent application of the present invention should fall within the scope of the patent of the present invention.< / long> < / long> < / long> < / long>

Claims

1. A method for controlling the sampling of multiple batches of drugs, characterized in that: The steps include: S1, parsing the drug raw material random inspection instruction, generating sampling working parameters based on the raw material properties and the production information of each batch of the raw material to be inspected, wherein the sampling working parameters include a first sampling parameter indicating the use of non-automatic sampling and a second sampling parameter indicating the use of automatic sampling; S2, if the second sampling parameter is selected, query the quantity of raw materials in the corresponding batch according to the batch information of the raw materials to be inspected, obtain all product barcodes in each batch of raw materials from the raw materials information database, and obtain the production time interval of each batch of raw materials to be inspected from the production information of each batch. If the production time interval between multiple batches is less than the preset time, the product barcode information of these batches is mixed and entered into the first product barcode table. Otherwise, the product barcode information of each batch is entered into its corresponding product barcode table separately, and an inspection application form for the raw materials to be inspected is generated; S3, receiving the inspection application form, using a random scrambling algorithm to randomly select the barcode information of each product in the first barcode table, swapping the positions of the barcode information to form a second barcode table, and then performing random degree verification on the second barcode table to ensure that it meets the preset probability, sampling the products in the second barcode table with equal probability, and entering the sampled barcode information into the random inspection sample information database.

2. The drug multi-batch mixed sampling control method according to claim 1, characterized in that: The step S2 further specifically includes: Obtaining the batch time span of each batch of raw materials to be inspected, where the batch time span is the time interval between the earliest produced goods and the latest produced goods in the batch of raw materials to be inspected; Calculate the production time interval between each batch of raw materials to be inspected, where the production time interval is the time interval between the latest produced goods in the earlier batch of raw materials to be inspected and the earliest produced goods in the later batch of raw materials to be inspected; The batch time spans and production time intervals of each batch of raw materials to be inspected are traversed to obtain one or more related batches of raw materials to be inspected groups, wherein the related batches of raw materials to be inspected are batches of raw materials to be inspected for which the ratio of the production time interval of two batches of raw materials to be inspected to the sum of the time spans of the two batches is lower than a preset value, and the barcode information of each batch of goods in the related batches of raw materials to be inspected groups is mixed and entered into the same first barcode table of goods.

3. The drug multi-batch mixed sampling control method according to claim 2, characterized in that: The step S3 specifically includes: S31, using a random scrambling algorithm to randomly select each barcode of the product information in the first barcode table, swapping the positions of the selected barcodes, and forming a second barcode table; S32, after the randomness verification of the second product barcode table meets the preset probability, it is determined whether the number of products in the second product barcode table is less than or equal to the predetermined number of random inspection samples. If so, all product barcodes are entered into the random inspection sample information database; S33, if the quantity of goods is greater than the predetermined number of random inspection samples, the preset sampling strategy corresponding to the attribute of the drug raw material is called to sample each barcode of the goods in the goods barcode table with equal probability, and the sampled barcode information is entered into the random inspection sample information database.

4. The method for controlling multi-batch mixed sampling of drugs according to claim 3, characterized in that: The step S33 specifically includes: S331, if the number of goods in the second product barcode table is greater than the predetermined number of samples for random inspection, then sequentially enter the first k product barcode information in the product barcode table into the first sample library, where k is not greater than the predetermined number of samples for random inspection m, and enter the subscript of each product barcode information entered into the first sample library into the second sample library; S332, determine whether to enter the current product barcode information into the first sample library with a probability of k / (k+1) for the remaining product barcode information in the product barcode table. When a new product barcode information is entered into the first sample library, enter the subscript of the product barcode information into the second sample library, and randomly select a product barcode information from the first sample library and move it out of the first sample library, until all the product barcode information in the product barcode table is traversed and the first sample library is used as the sampling sample information library.

5. A drug multi-batch mixed sampling control system, characterized in that: include: An instruction receiving module is used to parse the instruction for random inspection of pharmaceutical raw materials and generate sampling working parameters based on the raw material properties and the production information of each batch of the raw materials to be inspected. The sampling working parameters include a first sampling parameter indicating the use of non-automatic sampling and a second sampling parameter indicating the use of automatic sampling; a barcode table generating module for querying the quantity of raw materials in a corresponding batch according to the batch information of the raw materials to be inspected when the sampling working parameter is the second sampling parameter, obtaining all the barcodes of the goods in each batch of raw materials from the raw material information database, determining whether to mix the barcode information of the goods in each batch according to the production information of each batch and entering the information into the first barcode table of goods, obtaining the production time interval of each batch of raw materials to be inspected from the production information of each batch, mixing the barcode information of the goods in the batches and entering the information into the first barcode table of goods if the production time interval between the batches is less than a preset time, otherwise entering the barcode information of each batch into the corresponding independent barcode table of goods, and generating an inspection application form for the raw materials to be inspected; The sampling module is used to randomly select the barcode information of each product in the first barcode table by using a random scrambling algorithm, exchange the positions of the barcode information, and form a second barcode table for goods. After the randomness of the second barcode table is verified to meet the preset probability, the goods in the second barcode table are sampled with equal probability, and the sampled barcode information of the goods is entered into the random inspection sample information database.

6. The drug multi-batch mixed sampling control system according to claim 5, characterized in that: The barcode table generation module specifically includes: A time span acquisition module is used to obtain the batch time span of each batch of raw materials to be inspected, wherein the batch time span is the time interval between the earliest produced goods and the latest produced goods in the batch of raw materials to be inspected; A time interval acquisition module is used to calculate the production time interval between each batch of raw materials to be inspected, where the production time interval is the time interval between the latest produced goods in the earlier batch of raw materials to be inspected and the earliest produced goods in the later batch of raw materials to be inspected; The relevant batch acquisition module is used to traverse the batch time spans and production time intervals of each batch of raw materials to be inspected, obtain one or more relevant batches of raw materials to be inspected, wherein the relevant batches of raw materials to be inspected are batches of raw materials to be inspected in which the ratio of the production time interval of two batches of raw materials to be inspected to the sum of the time spans of these two batches is lower than a preset value, and mix the barcode information of each batch of goods in the relevant batches of raw materials to be inspected and enter them into the same first barcode table.

7. A device for sampling multiple batches of mixed drugs, 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 steps of the method according to any one of claims 1 to 4 are implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Data access method and device for sample playback

    CN108536759A

  • Transfer casual inspection method suitable for distribution network key material inspection

    CN111080475A