A method and system for quality control and traceability of Chinese medicinal materials products
Through dynamic comparison of the weight data of traditional Chinese medicinal materials and the time difference between labels, the problem of lack of judgment standards in quality control and traceability of traditional Chinese medicinal materials is solved, and the accuracy of the accuracy of the medicinal materials is realized, and the system's automatic identification and early warning capabilities are improved.
Patent Information
- Application Number
- CN202510900232.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-01
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2045-07-01
AI Technical Summary
The existing Chinese medicinal materials quality control and traceability lacks a key judgment standard and index system, which leads to the inability to form a clear judgment basis in the preliminary screening stage. Information registration is often mainly based on static records, lacks real-time linkage with the actual label generation time, and cannot identify abnormal marks in time. The system lacks automatic identification capabilities, and cannot be timely isolated after the data abnormal state is generated, which affects the data trust structure.
By obtaining the weight data of Chinese medicinal materials and comparing the minimum standard quality, a preliminary screening result set of medicinal materials is generated, the label number is bound and the absolute time difference between the label generation time and the data entry time is calculated, the time synchronization abnormality is identified, the traceability permission update log is generated, and the medicinal materials records with qualified quality and synchronized label information is screened to form a list of traceable data for Chinese medicinal materials.
It has realized the accurate screening of traditional Chinese medicinal materials, enhanced source control, guaranteed the specificity of traceability information, improved early warning capabilities, prevented risky medicinal materials from entering the traceability chain, improved the reliability of traceability data, and built dynamic quality control and traceability paths throughout the process.
Smart Images

Figure CN120410336B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of quality tracing, and in particular to a method and system for quality control and tracing of traditional Chinese medicine products. Background Art
[0002] The field of quality traceability encompasses the full-process technology for collecting, recording, and managing product information across all stages of production, processing, and distribution. It aims to track and confirm the source and flow of product quality through digital means. Its core content is to achieve traceability throughout the entire product lifecycle through information-based management, including raw material source registration, production and processing flow records, warehousing and transportation monitoring, and traceability information display at point-of-sale terminals. Technologies covered in this field typically include barcode identification, electronic labeling, data collection, information storage and processing, visual query interfaces, and encrypted information transmission. These technologies are widely used in food, pharmaceuticals, agricultural products, and other product chains subject to safety and regulatory requirements.
[0003] Among them, the quality control and traceability method of Chinese medicinal materials refers to a full-process information traceability method established for the quality assurance and traceability management of Chinese medicinal materials in the planting, harvesting, primary processing, storage and sales links. It covers the information collection and registration of key elements such as the variety information of Chinese medicinal materials, planting environment parameters, harvesting time, drying treatment methods, basis for determining the grade of medicinal materials, packaging batches and circulation records, and stores the information in a dedicated platform through QR code identification and database association. The information traceability display is completed through the user-end query interface, generally completed by image capture, weighing records, manual input, etc. The information registration is entered into the database system in a unified format, and one-to-one code management is achieved through unified coding rules.
[0004] The existing quality control and traceability process for traditional Chinese medicines lacks key criteria and indicator systems. This prevents a clear basis for determining herbal medicine quality during the initial screening phase, making it prone to substandard materials entering the labeling process. Information registration often relies primarily on static records, lacking real-time linkage to the actual label generation time, resulting in delayed labeling and inability to identify them in a timely manner. The time dimension, a fundamental criterion for determining information authenticity, is not effectively utilized in existing systems. Abnormality identification often relies on manual discovery, resulting in a lack of automatic identification capabilities. The generation of abnormal data states is often disconnected from system permission controls, making it impossible to automatically isolate suspicious data objects. This leads to information contamination that persists to user query terminals and undermines data trust. The screening logic primarily relies on single-quality judgments or status labeling, resulting in the inability to eliminate some seemingly qualified herbs with abnormal labeling information, leaving potential traceability loopholes. Failure to establish precise time response mechanisms or establish dual-factor screening rules throughout the traceability system will lead to significant limitations in source identification, non-proliferation control, and data purification. Summary of the Invention
[0005] The purpose of the present invention is to solve the shortcomings of the prior art and to propose a method for quality control and traceability of Chinese herbal medicine products.
[0006] In order to achieve the above-mentioned object, the present invention adopts the following technical solution: a method for quality control and traceability of Chinese medicinal materials, comprising the following steps:
[0007] S1: Obtain the weight data of Chinese medicinal materials, compare the measured weight with the minimum standard mass, determine the corresponding medicinal materials to be eliminated, and add the medicinal material number to generate a preliminary screening result set of medicinal materials;
[0008] S2: Based on the preliminary screening result set of the medicinal materials, read the medicinal material number and status identifier, match them with the label number, bind the medicinal materials and labels one by one, and generate a label binding index table;
[0009] S3: Calculate the absolute time difference between the tag generation time and the data storage time according to the tag binding index table, compare it with the preset time tolerance threshold, determine the medicinal materials with time synchronization abnormality, and generate a time abnormality record set;
[0010] S4: Read the medicinal material number with time synchronization anomaly in the time anomaly record set, match it with the medicinal material information list to be included in the traceability chain, mark the successfully matched number as a traceability locked state, and generate a traceability permission update log;
[0011] S5: Based on the traceability authority update log, count the medicinal material numbers that can be included in the traceability chain, read the corresponding quality status identifier and label time status and perform a cross-comparison, screen the medicinal material records with qualified quality and synchronized label information, and summarize and generate a list of Chinese medicinal material quality traceability data.
[0012] As a further solution of the present invention, the preliminary screening result set of medicinal materials includes status identification, medicinal material number, and quality assessment results; the label binding index table includes identification status, label number, generation time, and medicinal material number mapping relationship; the time anomaly record set includes medicinal material number, anomaly type, time difference, and anomaly identification; the traceability authority update log includes traceability lock status, matching number, and status change time; the Chinese medicinal material quality traceability data list includes quality status, label time status, traceability number, and screening pass identification.
[0013] As a further solution of the present invention, the steps for obtaining the medicinal material preliminary screening result set are specifically as follows:
[0014] S111: Based on the weight value of the Chinese medicinal material measured by the electronic scale, the weight value is compared with the minimum standard quality of the corresponding Chinese medicinal material category in the standard database, and the coding information of the medicinal material corresponding to the weight value and the minimum quality value is calculated to obtain the quality deviation record;
[0015] S112: Based on the quality deviation record and the minimum quality threshold information in the standard database, determine whether the deviation value is negative item by item. If it is negative, mark the current medicinal material status as to be rejected, record the medicinal material number, and obtain a set of unqualified medicinal material identifications;
[0016] S113: Based on the set of unqualified medicinal material identifications, the weight value, standard minimum quality value, quality deviation value and status identification of each medicinal material are integrated to calculate the status score of the Chinese medicinal material. , perform status scoring and number mapping, and establish a preliminary screening result set of medicinal materials.
[0017] As a further solution of the present invention, the steps of obtaining the label binding index table are specifically as follows:
[0018] S211: Based on the preliminary screening result set of the medicinal materials, extract the medicinal material numbers and corresponding status identifiers, read the medicinal material number fields one by one and uniformly convert them into a standard character format, establish a pairing structure of numbers and status identifiers, and obtain a number-status mapping set;
[0019] S212: Obtain the tag number according to the number status mapping set, match the medicinal material number with the tag number one by one, pair the medicinal material number with the tag number through a binding operation item by item, create a binding status record, and obtain the tag association pairing result;
[0020] S213: According to the tag association pairing result, the medicinal material number, status identifier, tag number and generation time content of each binding record are integrated, sorted in ascending order by the number field, and the sorted records are entered into the table structure in sequence to establish a tag binding index table.
[0021] As a further solution of the present invention, the steps of obtaining the time anomaly record set are specifically as follows:
[0022] S311: Read the tag number and generation time corresponding to each record according to the binding time field in the tag binding index table, extract the corresponding storage time field, confirm whether there is any time format anomaly through field comparison, and generate a tag storage time comparison set;
[0023] S312: Read the generation time and storage time in each pair of records based on the tag storage time comparison set, calculate the difference between the two timestamps and take the absolute value, compare it with the preset time tolerance threshold, determine the status of the medicinal material with time synchronization abnormality, and obtain a time error identification list;
[0024] S313: Based on the time error identification list, extract the records whose status field is time synchronization abnormality, sort them in ascending order according to the medicinal material number field, build a table structure for storage, and generate a time abnormality record set after sorting.
[0025] As a further solution of the present invention, the steps for obtaining the traceability permission update log are specifically as follows:
[0026] S411: Based on the time anomaly record set, extract the medicinal material number field in each anomaly record and convert it into a standard format number. Combined with the medicinal material information list table to be included in the traceability chain, match them one by one according to the number field to generate a traceability number matching list;
[0027] S412: writing the traceability status field item by item according to the medicinal material number in the traceability number matching list, synchronously registering the change time as the current system timestamp, calculating the traceability writing deviation value, and synchronously establishing the traceability status registration table;
[0028] S413: Based on the traceability status registration table, a log structure is constructed in the order of records, integrated into structured text information to form record entries, and system user information and operation IP fields are appended to the end of each entry to export a queryable log document and establish a traceability permission update log.
[0029] As a further solution of the present invention, the steps for obtaining the list of traceable data on the quality of Chinese medicinal materials are specifically as follows:
[0030] S511: Based on the traceability authority update log, read the label status and quality status information corresponding to the medicinal material number, perform format verification and abnormal record filtering on the two fields respectively, record the source log time field, and establish a traceability status medicinal material information set;
[0031] S512: Based on the traceability status medicinal material information set, a cross-comparison operation is performed on the quality status identification field and the label status identification field of each record, and qualified entries with successful status matching are recorded. The format of each time field is also checked for consistency, and a set of medicinal materials with consistent quality labels is constructed;
[0032] S513: Sort all valid medicinal material numbers in the medicinal material set with consistent quality labels in ascending order, output the field contents in a unified format, write them one by one into the traceability chain output directory in the order of records, and establish a Chinese medicinal material quality traceability data list.
[0033] A Chinese herbal medicine product quality control and traceability system, comprising:
[0034] The quality screening module obtains the actual weight data of the electronic scale, combines it with the minimum standard quality, compares and identifies the status and medicinal material number, and generates a preliminary screening result set for the medicinal materials;
[0035] The tag matching module collects the medicinal material numbers in the medicinal material preliminary screening result set, binds the tag numbers, records the status, tag numbers and time, and generates a tag binding index table;
[0036] The time verification module reads the corresponding medicinal material data storage time according to the tag generation time in the tag binding index table, calculates the absolute difference, compares it with the preset time tolerance threshold, filters out the items with time difference exceeding and assigns abnormal status, and generates a time abnormality record set;
[0037] The traceability identification module matches the medicinal material number in the database to be entered into the traceability chain number based on the time anomaly record set, marks the traceability lock status, and generates a traceability authority update log;
[0038] The quality archiving module updates the traceability number in the traceability authority log, compares the quality status and time status values, screens the compliance records, and generates a list of traceability data for the quality of Chinese medicinal materials.
[0039] Compared with the prior art, the advantages and positive effects of the present invention are:
[0040] In the present invention, accurate screening is achieved through the weight of processed Chinese medicinal materials, substandard medicinal materials are excluded, source control is enhanced, the process synchronization status identification and label number are bound, the traceability information is guaranteed to be specific, the time difference comparison mechanism identifies data anomalies, and active verification of information lag is achieved, thereby improving early warning capabilities. Abnormal status triggers traceability restriction marks, forming an information closed loop, preventing risky medicinal materials from mistakenly entering the traceability chain, cross-screening of quality status and time status, constructing a dual-factor filtering model, improving the reliability of traceability data, and establishing a dynamic quality control and traceability path for the entire process. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is a flow chart of the main steps of the present invention;
[0042] Figure 2 A flow chart for obtaining a preliminary screening result set for the medicinal materials of the present invention;
[0043] Figure 3 Obtaining a flow chart for the label binding index table of the present invention;
[0044] Figure 4 A flow chart for obtaining a time anomaly record set of the present invention;
[0045] Figure 5 Obtaining a flow chart for the update log of the retroactive authority of the present invention;
[0046] Figure 6 The present invention provides a flow chart for obtaining a list of traceable data for the quality of Chinese medicinal materials. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0048] In the description of the present invention, it should be understood that the terms "length," "width," "up," "down," "front," "back," "left," "right," "vertical," "horizontal," "top," "bottom," "inside," "outside," and the like, indicating positions or relationships, are based on the positions or relationships shown in the accompanying drawings and are intended only to facilitate the description of the present invention and simplify the description. They do not indicate or imply that the devices or elements referred to must have a specific orientation, be constructed, or operate in a specific orientation. Therefore, they should not be construed as limiting the present invention. Furthermore, in the description of the present invention, "plurality" means two or more, unless otherwise expressly and specifically defined.
[0049] See also Figure 1 A method for quality control and traceability of Chinese herbal medicine products, comprising the following steps:
[0050] S1: Obtain the weight data of Chinese medicinal materials measured by electronic scales. According to the minimum quality requirements of the Chinese Pharmacopoeia (Chinese Pharmacopoeia) corresponding to the category of Chinese medicinal materials, the measured weight is compared with the minimum standard quality. If the weight is less than the minimum standard quality, the corresponding medicinal material is marked as "to be eliminated" and the medicinal material number is added to generate a preliminary screening result set of medicinal materials.
[0051] S2: Based on the preliminary screening result set of medicinal materials, read the medicinal material number and status identification contained therein, and use the label number generated synchronously with the GS1 coding system (an internationally accepted commodity coding and traceability identification system) to bind the medicinal materials and labels one by one, record the identification status, label number, and generation time, and generate a label binding index table;
[0052] S3: Based on the tag generation time in the tag binding index table, obtain the entry time of the corresponding medicinal material record into the database, calculate the absolute time difference between the tag generation time and the data entry time, and compare it with the preset time tolerance threshold (the maximum interval between data collection and system entry set according to the enterprise production regulations, determined through equipment response testing). If the absolute time difference is greater than the threshold, the current medicinal material status is recorded as "time synchronization abnormality" and a time abnormality record set is generated;
[0053] S4: Based on the medicinal material numbers identified as "time synchronization anomaly" in the time anomaly record, the numbers are matched with the medicinal material information list to be included in the traceability chain in the database, the successfully matched numbers are marked as traceability locked, and the status information is entered into the traceability status registration table, and a traceability permission update log is generated;
[0054] S5: Based on the traceability authority update log, obtain the medicinal material number with the status of "can enter the traceability chain", read the corresponding quality status identifier and label time status and perform a cross-comparison, screen the medicinal material records with qualified quality and synchronized label information, and summarize and generate a list of traceable data on the quality of Chinese medicinal materials.
[0055] The preliminary screening result set of medicinal materials includes status identification, medicinal material number, and quality assessment results. The label binding index table includes identification status, label number, generation time, and medicinal material number mapping relationship. The time anomaly record set includes medicinal material number, anomaly type, time difference, and anomaly identification. The traceability permission update log includes traceability lock status, matching number, and status change time. The Chinese medicinal material quality traceability data list includes quality status, label time status, traceability number, and screening pass identification.
[0056] See also Figure 2 , S1 step is:
[0057] S111: Based on the weight value of the Chinese medicinal material measured by the electronic scale, the weight value is compared with the minimum standard quality of the corresponding Chinese medicinal material category in the standard database, and the coding information of the medicinal material corresponding to the weight value and the minimum quality value is calculated to obtain the quality deviation record;
[0058] Based on the weighing value of Chinese medicinal materials measured by electronic scales, they are compared with the minimum standard mass value of the corresponding Chinese medicinal material category in the "Chinese Pharmacopoeia" standard database. In the specific implementation process, the actual weight of each medicinal material is first recorded by electronic scales. For example, the angelica sinensis numbered A001 weighs 14.6 grams and the angelica sinensis numbered A002 weighs 16.4 grams. Then, the minimum standard mass value corresponding to angelica sinensis in the database is called and set to 16.0 grams. Then, the number information of all medicinal materials is extracted one by one and compared with the standard value according to the corresponding medicinal material category. For example, if the angelica sinensis numbered A003 weighs 14.2 grams, 16.0 grams will also be used as a reference. The mass deviation value of each medicinal material is obtained by subtracting the standard value from the actual weight. This deviation value is used to measure whether the medicinal material is lower than the standard requirement. The example in the table is shown below:
[0059] Table 1 Comparison of medicinal material weight and standard mass
[0060] Medicinal material number Name of medicinal material Actual weight (g) Minimum standard mass value (g) Mass deviation (g) A001 Angelica 14.6 16.0 -1.4 A002 Angelica 16.4 16.0 +0.4 A003 Angelica 14.2 16.0 -1.8
[0061] As shown in Table 1, the mass deviation value is calculated by the difference between the actual weight and the standard value. A negative deviation value indicates that it is lower than the pharmacopoeia standard value. The mass deviation record can be systematically obtained through the above method.
[0062] S112: Based on the quality deviation record and the minimum quality threshold information in the standard database, determine whether the deviation value is negative item by item. If it is negative, mark the current medicinal material status as to be rejected, record the medicinal material number, and obtain a set of unqualified medicinal material identifications;
[0063] Based on the quality deviation records obtained, the minimum quality threshold information in the Chinese Pharmacopoeia standard database is called to determine whether the deviation value is negative. The quality threshold judgment standard is set to a deviation value less than 0, which means it is unqualified. Based on this judgment principle, the medicinal materials corresponding to negative values are marked as "to be eliminated". For example, A001 and A003 are judged as unqualified medicinal materials because their deviations are -1.4 and -1.8 respectively, which are both less than 0. The numbers of these medicinal materials are recorded and their status information is summarized to form a status identification set. For example, the status identification of A001 is 1, A002 is 0, and A003 is 1. The medicinal material and status mapping set is constructed one by one as follows:
[0064] Table 2 Determination table of medicinal material quality deviation status
[0065] Medicinal material number Mass deviation (g) Status flag (0 / 1) Judgment results A001 -1.4 1 To be eliminated A002 +0.4 0 qualified A003 -1.8 1 To be eliminated
[0066] As shown in Table 2, the medicinal materials with a status identification value of 1 are samples that do not meet the minimum quality standard requirements, and the unqualified medicinal material identification set is then summarized.
[0067] S113: Based on the set of unqualified medicinal material identifications, the weighing value, standard minimum quality value, quality deviation value and status identification of each medicinal material are integrated, and the formula is used:
[0068] ;
[0069] Calculating the status score of Chinese medicinal materials , perform status scoring and number mapping, and establish a preliminary screening result set of medicinal materials, among which, Representative The weight of medicinal materials, Represents the lowest standard quality, Represents the packaging remainder of the corresponding medicinal materials, Represents the average weight of the same category of the corresponding medicinal materials in the current batch. Representative The rejection flag status of the medicinal material (1 if it is to be rejected, otherwise 0), Represents the total number of Chinese medicinal materials in this batch;
[0070] According to the set of unqualified medicinal material identification, the weighing value, standard minimum quality value, quality deviation value and status identification of each medicinal material are integrated to set the packaging allowance 0.3 grams, the average weight of the angelica herbs in the current batch The weight of the angelica root is 15.1 grams. The state score is calculated using the formula, with the angelica root numbered A001 as the input:
[0071] , , , ;
[0072] The weight values of the medicinal materials involved in the elimination are [14.2, 14.6, 15.0, 15.3, 14.7] grams, corresponding to ; ;
[0073] Part 1:
[0074] ;
[0075] Part II:
[0076] ;
[0077] The merged result is:
[0078] ;
[0079] This status score is used for classification judgment. If the threshold is set to 5.0, then a score greater than 5.0 is considered "to be eliminated" and a score less than or equal to 5.0 is considered "qualified". Therefore, A001 is classified as "to be eliminated". The complete classification results are shown in the following table:
[0080] Table 3 Medicinal material scoring values and screening judgment table
[0081] Medicinal material number Weighing value (g) Standard value (g) Packing remainder (g) Batch mean (g) Status indicator Status score Screening conclusion A001 14.6 16.0 0.3 15.1 1 6.2438 To be eliminated A002 16.4 16.0 0.3 15.1 0 0.2297 qualified A003 14.2 16.0 0.3 15.1 1 6.4711 To be eliminated
[0082] As shown in Table 3, the score value can be used to comprehensively identify the status of medicinal materials. The results show that the medicinal material status score value not only reflects the deviation of the individual from the standard, but also combines the batch elimination medicinal material weight correction factor to obtain the preliminary screening result set of medicinal materials.
[0083] The Chinese medicinal material status score is a numerical indicator used to quantitatively evaluate whether the quality of a single Chinese medicinal material meets the minimum standard requirements of the "Chinese Pharmacopoeia". Its specific significance lies in constructing a comprehensive score that reflects the degree of deviation and elimination trend of the medicinal material quality by integrating the actual weighing value of the medicinal material, the pharmacopoeial standard value, the packaging remainder and the overall quality level of the medicinal materials in the same batch. This score reflects both the direct difference between the individual and the standard, and integrates the overall proportion and quality weight of unqualified medicinal materials in the entire batch, so as to distinguish the medicinal material units that may have quality risks in batch processing. By setting a reasonable scoring threshold, the classification, screening and elimination operations of Chinese medicinal materials can be effectively realized, thereby assisting in the formation of a clearly structured and logically rigorous medicinal material screening result set, providing a quantitative basis and standardized support for subsequent medicinal material processing or circulation links.
[0084] The operational logic of this formula is based on a comprehensive evaluation of two dimensions: individual bias and group background correction. First, the numerator of the fraction It represents the difference between the actual weighing value of the medicinal material and the standard mass value, reflecting the quality deviation of the medicinal material at the individual level. The difference is processed in the form of absolute value to ensure that the degree of deviation can be reflected regardless of whether it is too high or too low. The square root structure is introduced in the denominator to construct a normalization factor based on the sum of squares of the two errors, where It reflects the weight influence of actual weighing and total packaging remainder. It represents the overall deviation trend between the average value of the current batch of similar medicinal materials and the standard quality value. The sum of the two is squared to construct a comprehensive measurement factor to alleviate the result distortion caused by the small denominator and reflect the balanced suppression of individual fluctuations. The second part is the summation term It is a weighted average processing method, which only weights the herbs in the eliminated state (because It represents the weighted impact of the quality of unqualified samples in the overall sample, which is expressed by the total number of samples. The division is used to achieve standardization. The introduction of this value is used to correct the sensitivity of the score to the elimination trend, improve the overall score's ability to identify batch fluctuations and local anomalies, and finally add the individual normalized deviation value and the elimination group correction item to complete the score value. This logic realizes the integration of local anomaly identification and global trend assessment, and has structural hierarchy and sensitivity control functions.
[0085] See also Figure 3 , step S2 is:
[0086] S211: Based on the preliminary screening result set of medicinal materials, extract the medicinal material numbers and corresponding status identifiers, read the medicinal material number fields one by one and uniformly convert them into a standard character format, establish a pairing structure of numbers and status identifiers, and obtain a number-status mapping set;
[0087] Based on the preliminary screening result set of medicinal materials, the medicinal material number and the corresponding status identifier are read in turn for each medicinal material information recorded therein. During the execution process, the reading operation is firstly accurate to the field level, the fields "number" and "status" are extracted, and the medicinal material entries in the entire data set are traversed in sequence, and the number field is standardized in a unified format. That is, if the original number is A001, A002, A003, etc., it is converted into a 12-bit standard encoding format such as "000000000001", "000000000002", "000000000003". During the standardization process, the number length needs to be judged and the left side needs to be padded with zeros to meet the unified output requirements. After the status identifier field is read, it needs to be digitized, and the "qualified" identifier is uniformly set to the value 0, and the "to be eliminated" identifier is uniformly set to the value 1. At the same time, a list of medicinal material numbers is constructed. A mapping pair structure with number as key and status identifier as value is created. Each mapping pair is stored separately in the intermediate data set. For example, for three records numbered A001 (qualified), A002 (to be eliminated), and A003 (qualified), three mapping pairs are generated after processing: "000000000001": 0, "000000000002": 1, and "000000000003": 0. During the above operation, if the read number field has a character length that is not in the preset range or the status identifier field is empty, the exception recognition mechanism should be triggered, the data will not be written into the mapping set temporarily, and the data source row number will be recorded for subsequent verification processing. The value judgment rule of this process does not rely on classification logic, but is implemented by accurately comparing the status field value to see whether it matches the two keywords "qualified" or "to be eliminated", thereby generating a number-status mapping set.
[0088] S212: Obtain the tag number according to the number status mapping set, match the medicinal material number with the tag number one by one, pair the medicinal material number with the tag number through a binding operation item by item, create a binding status record, and obtain the tag association pairing result;
[0089] According to the number status mapping set, read the synchronously generated GS1 tag number set. In actual operation, each GS1 tag number is a fixed 12-digit pure number, such as "690123456789". In the mapping operation, read the medicinal material number one by one in the order of the mapping set, and bind each medicinal material number to an unbound GS1 tag number one by one. During the binding process, it is necessary to ensure that the tag number is not reused and its generation timestamp record can be extracted. If a duplicate number occurs, an exception is recorded and the binding is skipped. After the tag number and the medicinal material number are paired, a pairing unit is formed. The unit contains four dimensions of information: medicinal material number, tag number, status identifier and binding time. The binding time should be collected from the current system time, accurate to seconds, for example "2024-05-09 15:43:27". In addition, it is necessary to verify whether the binding status is consistent with the value in the number status mapping. That is, if the medicinal material status is 1 (to be eliminated), the bound data should be marked as "abnormal binding" in the binding record, otherwise it should be "normal binding". After the above structure is established, a complete pairing record list is formed. The list record should use the medicinal material number as the primary key field and the tag number as the secondary field to ensure information relevance and uniqueness. For example, if the medicinal material number "000000000002" has a status of 1, its binding tag "690123456789" is marked as "abnormal binding" in the record. All records in the list are sorted by system time and updated into the database to obtain the tag association pairing result.
[0090] S213: Based on the tag association pairing result, the medicinal material number, status identifier, tag number, and generation time content of each binding record are integrated, sorted in ascending order by the number field, and the sorted records are sequentially entered into the table structure to establish a tag binding index table;
[0091] After obtaining the tag association pairing result, the bound medicinal material number, status identifier, tag number and binding time in the paired record are extracted in sequence and sorted in ascending order by number. The sorting process uses the numerical part of the number field as the comparison basis, excluding the interference of prefix characters to ensure accurate sorting. At the same time, each record is checked for field integrity. If any field is empty or the format does not match, the record is automatically marked as an "invalid record" and its subsequent table writing operation is skipped. The remaining valid records are written into the tag binding index table in sequence. The table structure is uniformly set to a four-column structure with column names of "medicinal material number", "status identifier", "tag number" and "binding time". Each row of records is filled in the table row according to the corresponding relationship, ensuring that all data fields in the table are output in a standard format. All time fields are unified in the standard timestamp format of year, month, day, hour, minute and second. The tag number field must maintain a 12-bit length, the status identifier field is a numeric type, and the medicinal material number field is a unified format number. Before writing each record, the data verification function should be called to perform secondary verification on the field length and format. After writing, it is re-indexed and sorted by the number field. The final output data structure is the tag binding index table, as shown in Table 4:
[0092] Table 4 Label binding index table
[0093] Medicinal material number Status indicator Tag number Binding Time 000000000001 0 690123456781 2024-05-09 15:40:01 000000000002 1 690123456782 2024-05-09 15:40:04 000000000003 0 690123456783 2024-05-09 15:40:06
[0094] As shown in Table 4, the tag binding index table displays the binding information between the medicinal material and the tag through standard structured data. The status identification field reflects whether the medicinal material is to be rejected, the tag number is the GS1 standard identification, and the binding time records the timestamp of the completion of the operation.
[0095] See also Figure 4 , S3 steps are:
[0096] S311: Read the tag number and generation time corresponding to each record based on the binding time field in the tag binding index table, extract the corresponding storage time field, compare the fields to determine whether there is any time format anomaly, and generate a tag storage time comparison set;
[0097] According to the binding time field in the tag binding index table, first read the medicinal material number and label generation time in each binding record in turn. The extraction method is to search the "medicine number" field in the table row by row, and extract the timestamp in the "generation time" field after matching the number. The timestamp format is uniformly converted to the second-level time unit within the system. For example, "2024-05-09 15:43:27" is converted into the numerical form of 1704939807 seconds. Then, the medicinal material number is used as the index condition to enter the database to query the corresponding storage record table of the medicinal material. The field matching method is called to compare the index field "medicine number". If the match is successful, the content of the field "storage time" is extracted and the same second-level conversion process is performed. If the content of the field is empty or does not meet the standard time format, the record is marked as "time field abnormality" and the subsequent processing of the data record is skipped. Next, a number and time comparison structure is constructed to compare the converted generation time with the storage time. Time binding forms a complete data unit under the medicinal material number. For example, the tag generation time of the number "000000000001" is 1704939807 seconds and the storage time is 1704939831 seconds. After binding, it is constructed as "000000000001": {Generation: 1704939807, Storage: 1704939831}. If batch data processing is performed, the same process is executed for each record to ensure that all records have two sets of time fields and the format is consistent. After the above processing, a tag storage time comparison set can be generated.
[0098] S312: Based on the tag entry time comparison set, read the generation time and entry time in each pair of records, calculate the difference between the two timestamps and take the absolute value, and compare it with the preset time tolerance threshold. If the time deviation comparison value is greater than the threshold, mark the current medicinal material status as "time synchronization abnormality", record the medicinal material number and time difference, and obtain a time error identification list;
[0099] According to the tag entry time reference set, the absolute difference calculation operation between the generation time and the entry time is performed for each medicinal material record. First, the timestamp difference is calculated and the difference result is output as an absolute value. For example, if the entry time is 1704939831 seconds and the tag generation time is 1704939807 seconds, the calculated difference is |1704939831 - 1704939807| =24 seconds. After obtaining the preliminary time difference, the time tolerance threshold set by the enterprise is called and the threshold is set to 180 seconds. The threshold is set by the production management system based on the equipment response test parameters. For example, for the automatic scanning code warehousing system, the maximum allowable data delay entry interval is 180 seconds. The next step is to compare the time difference with the tolerance threshold. If the calculated result is greater than 180 seconds, it is determined that there is a delay in the current medicinal material entry and the abnormality is recorded. If the time difference is less than or equal to 180 seconds, it is considered normal. Synchronously construct an identification field to mark the status 0 or 1, 1 represents abnormality, and 0 represents normality. For example, if the calculated result of the medicinal material number "000000000002" is 196 seconds, its status is marked as 1. The consistency of the time value data source needs to be verified throughout the process to prevent abnormal calculation results caused by incorrect input values. The example is as follows:
[0100] Table 5 Time comparison and difference calculation table
[0101] Medicinal material number Generation time (seconds) Storage time (seconds) Time difference (seconds) Status indicator 000000000001 1704939807 1704939831 24 0 000000000002 1704939800 1704939996 196 1 000000000003 1704939805 1704939850 45 0
[0102] As shown in Table 5, each medicinal material data in the record is accompanied by the calculated difference value and status identification. The status values of all medicinal materials can be used as input for subsequent classification and exception handling logic, thereby obtaining a time error identification list.
[0103] S313: Based on the time error identifier list, extract the records whose status field indicates time synchronization anomaly, sort them in ascending order according to the medicinal material number field, construct a table structure for storage, and generate a time anomaly record set after sorting;
[0104] Based on the time error identification list, the medicinal material records with the status identification field as 1 are extracted and sorted. First, all medicinal material numbers with abnormal status are filtered according to the status field, and their corresponding numbers, label numbers, calculated time difference values, and status fields are extracted. At the same time, the system records the current operating system time as the abnormality generation record time field, which is uniformly expressed in timestamp format. For example, the corresponding value of "2024-05-09 16:02:10" is 1704940930 seconds. The field combination order is medicinal material number, label number, time difference, status field, and record generation time. Subsequently, these five fields are combined into a row structure and written into the abnormal record set table. They are sorted in ascending order by medicinal material number. The field length standard is set as follows: medicinal material number is 12 characters, label number is a 12-digit code, time difference value is in seconds, status field is a value of 0 or 1, and record time is in standard timestamp format. After sorting, the time abnormality record set is obtained.
[0105] See also Figure 5 , step S4 is:
[0106] S411: Based on the time anomaly record set, extract the medicinal material number field in each anomaly record and convert it into a standard format number. Combined with the medicinal material information list table to be included in the traceability chain, match them one by one according to the number field to generate a traceability number matching list;
[0107] Based on the medicinal material numbers identified as "time synchronization anomaly" in the time anomaly record collection, first obtain all record entries with status 1, extract the field "medicinal material number", and uniformly standardize the number format. Numbers with less than 12 digits are padded to the left with zeros to make up the digits. For example, the number "A07" is processed as "000000000007" to ensure that the number structure is consistent with the database. Then, using the formatted number as the matching condition, call the "Medicinal Material Information List to be Included in the Traceability Chain" table in the medicinal material master database and perform number matching operations on each item. The matching adopts the full-field exact equivalence comparison method. The matching logic uses "medicinal material number = medicinal material number" as the judgment condition and requires that the "traceability status" field in the target item is 0, indicating that it is not currently traceable and bound. If both conditions are met, the record is included in the pending set, and the matching position, index order, and basic information fields are recorded for the subsequent locking operation process. During the entire process, it is necessary to avoid marking duplicate numbers multiple times. This can be limited by setting an auxiliary Boolean variable "matched". After processing, the total number of matches is counted. The example is as follows:
[0108] Table 6 Time anomaly medicinal material matching record
[0109] Medicinal material number Is it abnormal? Whether the match is successful Original state Index position 000000000007 yes yes 0 121 000000000015 yes no 1 — 000000000023 yes yes 0 173
[0110] As shown in Table 6, a record can be considered a successful match only if the medicinal material number exists in the database and the traceability status is not set. This structure allows valid numbers to be confirmed item by item and a traceability number matching list to be obtained.
[0111] S412: Match the medicinal material number in the traceability list with the traceability number, write the traceability status field item by item, synchronize the registration change time with the current system timestamp, extract the storage time, abnormal record generation time, and mark writing time of each record, using the formula:
[0112] ;
[0113] Calculating the Retroactive Write Deviation Value , and simultaneously establish a traceability status registration table, including: Write a timestamp for the traceability mark of this record, The storage timestamp. For the The timestamp of the abnormal record generation, is the mean of the generation time of all abnormal records, The integer value corresponding to the last three digits of the medicinal material number. is the batch number value, is the total number of abnormal records;
[0114] Based on the traceability number matching list of all medicinal material numbers, the traceability status field is written in sequence. The field value originally set to 0 needs to be updated to 1, indicating that the state is locked. During the processing, the current value of the field "Traceability Status" is read. If the value is not 0, the processing is skipped and recorded as "Skip Record". After the status is successfully updated, the system current time is called to generate a timestamp as the fill value of the field "Mark Time". For example, the system time "2024-05-1009:12:53" is converted to a second value of 1705002773. After writing the field, the fields "Warehouse Time" and "Exception Record Generation Time" are called. The three form the basic time structure. Then the time deviation is calculated, the field value is extracted for arithmetic operations, and the deviation value is calculated using the formula.
[0115] Among them, set the medicinal material numbered 000000000127 as an example, and the values of its various fields are as follows: Storage time , abnormal record generation time , mark the write time , the last three digits of the number are 127, set the batch reference value , current total exception entries , and their corresponding generation times are , , , the calculation steps are as follows:
[0116] The first calculation is:
[0117] ;
[0118] In the second calculation, calculate ;
[0119] Then calculate the difference between each term and the mean and sum them up:
[0120] ;
[0121] ;
[0122] ;
[0123] The sum is , the mean is ;
[0124] The third number difference is:
[0125] ;
[0126] The final result is:
[0127] ;
[0128] The calculation results show that the traceability write deviation value corresponding to number 000000000127 is 444.87. This value will be written into the status registration table as a deviation feature, forming an important parameter item for management record screening and used to establish the traceability status registration table.
[0129] The traceability write deviation value is a comprehensive numerical indicator used to measure the degree of various timing and structural deviations of a single medicinal material record during the traceability status change process. The larger the value, the longer the response delay between the medicinal material entering the warehouse and being traced and locked, the more the time of generating the abnormal record deviates from the overall distribution of other abnormal records, and the more its numbering structure in the entire batch deviates from the unified numbering sequence. This indicator is formed by integrating information from three dimensions: operation delay, discreteness of abnormal time distribution, and consistency of numbering structure. It provides a quantitative basis for the system to judge the abnormal level of traceability operations and the priority of management intervention without relying on subjective threshold judgment. It is a key intermediate control parameter in the traceability processing of abnormal medicinal material records.
[0130] The operational logic of this formula is to comprehensively evaluate the degree of change in the timeliness deviation, group synchronization deviation and numbering sequence stability of each medicinal material record in the marked state. It indicates the actual time interval between the entry of medicinal materials into the warehouse and the traceability status mark, which is used to measure the delay degree of traceability control response. The larger the value, the longer the operational response. The discreteness of the abnormal record generation time measures the time deviation of the record in the overall abnormal record group. By calculating the difference between the generation time of each abnormal record and the group mean and averaging it, it reflects the time aggregation characteristics of the abnormal batch. The higher the value, the more discrete the record is in time. The third item It is used to evaluate the numbering structure fluctuation between the medicinal material number and the batch reference number. The square root operation is used to introduce a nonlinear growth trend to avoid the extreme impact of a single number difference on the result. The three items are linearly superimposed by addition because they all represent the offset sources of different dimensions and can be directly added after dimensional processing, thus forming a unified deviation assessment value and realizing comprehensive expression across time domain, structure domain and population domain.
[0131] S413: Based on the markup information in the traceability status registration table, a log structure is constructed in the order of records. The log content fields include the medicinal material number, original traceability status, current traceability status, write time, and traceability write deviation value. These fields are integrated into structured text information to form record entries. System user information and operation IP fields are appended to the end of each entry, and the log is exported as a queryable log document to establish a traceability permission update log.
[0132] Read the mark writing information field in the traceability status registration table, extract the fields "medicine number", "original status", "current status", "writing time", and "traceability writing deviation value" in ascending order of recording time, generate a log structure text for each record, use a fixed field order for structured splicing, and append the fields "operation user ID" and "operation IP address" to the end of the log for traceability records. The operation user ID is fixed to the system automatic task identifier "SYS-AUTO-001", and the IP address field is uniformly set to "127.0.0.1" for system kernel records. After all records are generated, they are uniformly written to the log structure data table and sorted by the time field. The log document is output. The sample is as follows:
[0133] Table 7 Traceability Log Record Table
[0134] Medicinal material number Original state Current Status Write time Deviation value User ID IP address 000000000007 0 1 2024-05-1009:12:53 45 SYS-AUTO-001 127.0.0.1 000000000023 0 1 2024-05-1009:13:08 39 SYS-AUTO-001 127.0.0.1
[0135] As shown in Table 7, the log records every state change action in detail, including the comparison of the previous and next states, time stamps, source user information, etc., and finally establishes a traceability permission update log.
[0136] See also Figure 6 , step S5 is:
[0137] S511: Based on the traceability authority update log, read the label status and quality status information corresponding to the medicinal material number, perform format verification and abnormal record filtering on the two fields respectively, record the source log time field, and establish a traceability status medicinal material information set;
[0138] Based on the "traceability chain" medicinal material number obtained from the traceability permission update log, the traceability status field in the log data must first be judged and screened. Records with a status field of 1 are qualified target data. The corresponding medicinal material number is extracted and deduplicated to prevent repeated participation in subsequent matching. After the number is standardized, the Chinese medicinal material label information table and quality status record table are called according to the unified 12-bit character format as the main index field. The label status and quality status fields matching each medicinal material number are extracted respectively. During the reading process, abnormal identification conditions are set. If the label status field is empty, non-0 / 1 value, or the format is missing, the record is judged as a data abnormality and eliminated. The quality status field is similarly verified for data integrity. The set value must be 0 or 1. If it is not met, it is eliminated. The elimination rule is set as long as any field is abnormal, it will not participate in the subsequent cross-comparison. Qualified records use the medicinal material number as the key, and the label status value and quality status value form a three-field structure. The reading source time field is recorded as an auxiliary data item to form an information set for the next step of comparison processing. A typical field extraction sample is as follows:
[0139] Table 8 Traceable medicinal material status information table
[0140] Medicinal material number Tag Status Quality Status Source time 000000000201 0 0 2024-05-10 09:10:22 000000000202 1 0 2024-05-10 09:12:08 000000000203 0 1 2024-05-10 09:14:43
[0141] As shown in Table 8, the generated data must completely retain the source time field for audit tracking, thereby obtaining the traceability status medicinal material information set.
[0142] S512: Based on the traceability status medicinal material information set, a cross-comparison operation is performed on the quality status identification field and the label status identification field of each record, and qualified entries with successful status matching are recorded. The consistency check is also performed on the format of each time field to construct a set of medicinal materials with consistent quality labels;
[0143] Based on the traceability status medicinal material information set, a combined comparison operation of the label status field and the quality status field is performed on each record. The screening rule is set to record where both fields are 0 at the same time as the qualified target, that is, the label information is synchronized and the quality inspection is qualified. The record number that meets this condition is written into the target set, and the remaining records are not processed. The process needs to synchronously retain the comparison field information to ensure that the original field data in the target set is still traceable and readable. If the label status field value is 1 but the quality status is 0, or the label status is 0 but the quality status is 1, it is considered inconsistent and not included in the screening results. At the same time, the number of such conflicting comparison pairs is recorded as the screening conflict count. A typical example is as follows:
[0144] Table 9 Sample compliance screening results
[0145] Medicinal material number Tag Status Quality Status Screening markers 000000000201 0 0 Compliance 000000000202 1 0 conflict 000000000203 0 1 conflict
[0146] As shown in Table 9, records can only continue to flow into the list output logic after being marked as "compliant". After the process is completed, a set of medicinal materials with consistent quality labels is formed.
[0147] S513: sort all valid medicinal material numbers in the set of medicinal materials with consistent quality labels in ascending order, output the field contents in a unified format, write them one by one into the traceability chain output directory in the order of records, and establish a list of traceability data for Chinese medicinal materials quality;
[0148] According to the numbers of all compliant medicinal materials in the set of medicinal materials with consistent quality labels, the fields "quality status", "label status", "traceability status", and "writing time" are assembled with the medicinal material number field into a list structure. The output field order is set to medicinal material number, quality status, label status, traceability status, and recording time. Each record time field needs to be converted into a timestamp format and converted into a standard readable time format such as "YYYY-MM-DD HH:MM:SS". The status field is set to an enumeration value of 0 or 1. Before writing, the field type and bit width specifications need to be uniformly checked. The output structure is unified and sorted in ascending order by medicinal material number. The generated record entries are uniformly imported into the traceability chain storage table. At the same time, the list record log number, export time, and list version number are set as file metadata for subsequent management operation verification. Finally, a list of traceable data on Chinese medicinal material quality is established.
[0149] A Chinese herbal medicine product quality control and traceability system, comprising:
[0150] The quality screening module obtains the actual weight data of the electronic scale, combines it with the minimum standard quality, compares and identifies the status and medicinal material number, and generates a preliminary screening result set for the medicinal materials;
[0151] The tag matching module collects the medicinal material numbers in the preliminary screening results, binds the tag numbers, records the status, tag number and time, and generates a tag binding index table;
[0152] The time verification module reads the corresponding medicinal material data storage time based on the tag generation time in the tag binding index table, calculates the absolute difference, compares it with the preset time tolerance threshold, filters out items with excessive time differences, assigns an abnormal status, and generates a time abnormality record set;
[0153] The traceability identification module collects the medicinal material number based on the time anomaly record, matches the traceability chain number to be entered into the database, marks the traceability lock status, and generates a traceability permission update log;
[0154] The quality archiving module updates the traceability number in the log based on the traceability authority, compares the quality status and time status values, screens the compliance records, and generates a list of traceability data for the quality of Chinese medicinal materials.
[0155] The above are merely preferred embodiments of the present invention and do not limit the present invention in any other form. Any technician familiar with the profession may use the technical content disclosed above to change or modify it into an equivalent embodiment with equivalent changes and apply it to other fields. However, any simple modification, equivalent change and modification made to the above embodiment based on the technical essence of the present invention without departing from the content of the technical solution of the present invention shall still fall within the scope of protection of the technical solution of the present invention.
Claims
1. A method for quality control and traceability of Chinese herbal medicine products, characterized in that: The following steps are involved: S1: Obtain the weight data of Chinese medicinal materials, compare the measured weight with the minimum standard mass, determine the corresponding medicinal materials to be eliminated, and add the medicinal material number to generate a preliminary screening result set of medicinal materials; S2: Based on the preliminary screening result set of the medicinal materials, read the medicinal material number and status identifier, match them with the label number, bind the medicinal materials and labels one by one, and generate a label binding index table; S3: Calculate the absolute time difference between the tag generation time and the data storage time according to the tag binding index table, compare it with the preset time tolerance threshold, determine the medicinal materials with time synchronization abnormality, and generate a time abnormality record set; S4: Read the medicinal material number with time synchronization anomaly in the time anomaly record set, match it with the medicinal material information list to be included in the traceability chain, mark the successfully matched number as a traceability locked state, and generate a traceability permission update log; S5: Based on the traceability authority update log, count the medicinal material numbers that can be included in the traceability chain, read the corresponding quality status identifier and label time status and perform a cross-comparison, screen the medicinal material records with qualified quality and synchronized label information, and summarize and generate a list of Chinese medicinal material quality traceability data; The preliminary screening result set of medicinal materials includes status identification, medicinal material number, and quality assessment results; the label binding index table includes identification status, label number, generation time, and medicinal material number mapping relationship; the time anomaly record set includes medicinal material number, anomaly type, time difference, and anomaly identification; the traceability authority update log includes traceability lock status, matching number, and status change time; the Chinese medicinal material quality traceability data list includes quality status, label time status, traceability number, and screening pass identification.
2. The method for quality control and traceability of Chinese herbal medicine products according to claim 1, characterized in that: The steps for obtaining the preliminary screening result set of medicinal materials are as follows: S111: Based on the weight value of the Chinese medicinal material measured by the electronic scale, the weight value is compared with the minimum standard quality of the corresponding Chinese medicinal material category in the standard database, and the coding information of the medicinal material corresponding to the weight value and the minimum quality value is calculated to obtain the quality deviation record; S112: Based on the quality deviation record and the minimum quality threshold information in the standard database, determine whether the deviation value is negative item by item. If it is negative, mark the current medicinal material status as to be rejected, record the medicinal material number, and obtain a set of unqualified medicinal material identifications; S113: Based on the set of unqualified medicinal material identifications, the weight value, standard minimum quality value, quality deviation value and status identification of each medicinal material are integrated to calculate the status score of the Chinese medicinal material. , perform status scoring and number mapping, and establish a preliminary screening result set of medicinal materials.
3. The method for quality control and traceability of Chinese medicinal materials according to claim 1, characterized in that: The steps for obtaining the tag binding index table are specifically as follows: S211: Based on the preliminary screening result set of the medicinal materials, extract the medicinal material numbers and corresponding status identifiers, read the medicinal material number fields one by one and uniformly convert them into a standard character format, establish a pairing structure of numbers and status identifiers, and obtain a number-status mapping set; S212: Obtain the tag number according to the number status mapping set, match the medicinal material number with the tag number one by one, pair the medicinal material number with the tag number through a binding operation item by item, create a binding status record, and obtain the tag association pairing result; S213: According to the tag association pairing result, the medicinal material number, status identifier, tag number and generation time content of each binding record are integrated, sorted in ascending order by the number field, and the sorted records are entered into the table structure in sequence to establish a tag binding index table.
4. The method for quality control and traceability of Chinese herbal medicine products according to claim 1, characterized in that: The steps for obtaining the time anomaly record set are specifically as follows: S311: Read the tag number and generation time corresponding to each record according to the binding time field in the tag binding index table, extract the corresponding storage time field, confirm whether there is any time format anomaly through field comparison, and generate a tag storage time comparison set; S312: Read the generation time and storage time in each pair of records based on the tag storage time comparison set, calculate the difference between the two timestamps and take the absolute value, compare it with the preset time tolerance threshold, determine the status of the medicinal material with time synchronization abnormality, and obtain a time error identification list; S313: Based on the time error identification list, extract the records whose status field is time synchronization abnormality, sort them in ascending order according to the medicinal material number field, build a table structure for storage, and generate a time abnormality record set after sorting.
5. The method for quality control and traceability of Chinese herbal medicine products according to claim 1, characterized in that: The specific steps for obtaining the traceability permission update log are: S411: Based on the time anomaly record set, extract the medicinal material number field in each anomaly record and convert it into a standard format number. Combined with the medicinal material information list table to be included in the traceability chain, match them one by one according to the number field to generate a traceability number matching list; S412: writing the traceability status field item by item according to the medicinal material number in the traceability number matching list, synchronously registering the change time as the current system timestamp, calculating the traceability writing deviation value, and synchronously establishing the traceability status registration table; S413: Based on the traceability status registration table, a log structure is constructed in the order of records, integrated into structured text information to form record entries, and system user information and operation IP fields are appended to the end of each entry to export a queryable log document and establish a traceability permission update log.
6. The method for quality control and traceability of Chinese herbal medicine products according to claim 1, characterized in that: The specific steps for obtaining the Chinese herbal medicine quality traceability data list are as follows: S511: Based on the traceability authority update log, read the label status and quality status information corresponding to the medicinal material number, perform format verification and abnormal record filtering on the two fields respectively, record the source log time field, and establish a traceability status medicinal material information set; S512: Based on the traceability status medicinal material information set, a cross-comparison operation is performed on the quality status identification field and the label status identification field of each record, and qualified entries with successful status matching are recorded. The format of each time field is also checked for consistency, and a set of medicinal materials with consistent quality labels is constructed; S513: Sort all valid medicinal material numbers in the medicinal material set with consistent quality labels in ascending order, output the field contents in a unified format, write them one by one into the traceability chain output directory in the order of records, and establish a Chinese medicinal material quality traceability data list.
7. A Chinese herbal medicine product quality control and traceability system, characterized in that: The system is used to implement the method for quality control and traceability of traditional Chinese medicine products according to any one of claims 1 to 6, comprising: The quality screening module obtains the actual weight data of the electronic scale, combines it with the minimum standard quality, compares and identifies the status and medicinal material number, and generates a preliminary screening result set for the medicinal materials; The tag matching module collects the medicinal material numbers in the medicinal material preliminary screening result set, binds the tag numbers, records the status, tag numbers and time, and generates a tag binding index table; The time verification module reads the corresponding medicinal material data storage time according to the tag generation time in the tag binding index table, calculates the absolute difference, compares it with the preset time tolerance threshold, filters out the items with time difference exceeding and assigns abnormal status, and generates a time abnormality record set; The traceability identification module matches the medicinal material number in the database to be entered into the traceability chain number based on the time anomaly record set, marks the traceability lock status, and generates a traceability authority update log; The quality archiving module updates the traceability number in the traceability authority log, compares the quality status and time status values, screens the compliance records, and generates a list of traceability data for the quality of Chinese medicinal materials.
Citation Information
Patent Citations
Chinese herbal medicine traceability system and method
CN105096075A
Storage-based traditional Chinese medicine database management method, server and storage medium
CN116402435A