A medicine commodity warehousing method and system based on name and specification matching
Patent Information
- Application Number
- CN202611276419.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-21
- Publication Date
- 2026-10-09
AI Technical Summary
上游出库单与本地药店对同一药品的品名描述常含有无关的符号或别名,导致字符串无法对齐
1、创新性地引入了规格单元拆分。无论上游输入的是“0.25g*24s”还是“0.25克×2板(12粒/板)”,本方法构建了绝对唯一的数据锚点,这使得计算机能够准确判断物理实质相同的商品,将自动匹配准确率有效提升。
Smart Images

Figure CN122887377A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of pharmaceutical supply chain information processing and pharmaceutical ERP automatic warehousing technology, and more specifically, it relates to a method and system for warehousing pharmaceutical products based on name and specification matching. Background Technology
[0002] In the pharmaceutical retail industry, when pharmacies purchase medicines from upstream suppliers, they need to match the outbound delivery orders from upstream suppliers with the product records in their local ERP system to generate purchase receipts. Due to the unique nature of the pharmaceutical industry, the descriptive information for the same medicine often differs significantly at different nodes in the supply chain.
[0003] In existing technologies, systems often use a single field, such as the approval number, barcode, or simple string matching, for code entry into the database. However, this approach has the following drawbacks: The upstream delivery slip and the local pharmacy's description of the same drug often contain irrelevant symbols or aliases, causing string misalignment. Because pharmaceutical products have complex packaging layers, such as dosage, dosage unit, inner packaging, and middle packaging, when the upstream description is "0.25g x 2 blisters (12 tablets / blister)," and the local record is "0.25g * 24 tablets," the existing computer system recognizes them as completely different strings, leading to matching failure.
[0004] Secondly, the current warehousing system, when scanning the China Drug Electronic Supervision Code, i.e. the traceability code, usually only records the traceability information of a single box of medicine. It fails to utilize the upstream outbound network data carried by the traceability code, which means that store staff still need to scan the code one by one or manually fill in the quantity, batch number, expiration date and other information on the warehousing slip.
[0005] Therefore, how to teach computer systems to understand the complex semantics of pharmaceutical product specifications, achieve accurate automatic matching, and make full use of traceability codes to achieve one-click full order warehousing is a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0006] In view of the problems mentioned in the background art above, the present invention provides a method and system for warehousing pharmaceutical products based on name and specification matching.
[0007] On one hand, the technical solution adopted by the present invention is as follows: a method for warehousing pharmaceutical products based on name and specification matching, comprising the following steps: S1: obtaining upstream outbound order data, and extracting the name field and specification field to be matched for the products to be warehoused from the upstream outbound order data; S2: performing character cleaning and formatting processing on the name field to be matched to obtain a standardized generic name; S3: splitting the specification field to be matched into specification units to obtain multiple smallest units containing only quantity values and unit strings; S4: classifying the smallest units according to preset pharmaceutical packaging levels, and extracting dosage units and total dosage units respectively; wherein, the quantity value of the total dosage unit is the dosage unit. S5: Query the standardized generic name in the local product file database. When there is a target generic name in the local product file that is completely consistent with the standardized generic name, extract the local dosage unit and local total dosage unit corresponding to the local product file. S6: Compare the dosage unit and total dosage unit of the product to be put into storage with the local dosage unit and local total dosage unit. If the data of the two sets of units are consistent, the product is determined to be matched successfully. S7: Automatically generate a purchase order and update the local inventory system based on the successfully matched local product file information.
[0008] Furthermore, the character cleaning and formatting process performed on the product name field to be matched in S2 to obtain a standardized generic name specifically includes: S21, identifying and removing characters from a preset set of special characters from the string of the product name field to be matched; S22, converting all full-width characters in the string after removing special characters to half-width characters; S23, identifying paired bracket characters in the half-width string and deleting the paired bracket characters and all characters contained within them; S24, storing the string remaining after the above processing as the standardized generic name.
[0009] Further, S3 describes splitting the specification field to be matched into specification units to obtain multiple minimum units containing only quantity values and unit strings. Specifically, this includes: S31, removing preset invalid characters from the specification field to be matched, converting multiplication and division symbols, slashes, and parenthesis boundary symbols in the specification field to be matched into a unified delimiter, and performing full-width to half-width character conversion; S32, using the unified delimiter as the delimiter, dividing the converted specification string into multiple substrings, identifying the numerical part and non-numerical unit part in each substring, and constructing a minimum unit containing quantity values and unit strings; S33, if a substring contains only unit strings and not numerical values, then the quantity value of the minimum unit is automatically assigned to 1; S34, for multiple minimum units with the same unit string, deduplication is performed, retaining only the minimum unit with the largest quantity value.
[0010] Further, in step S4, classifying the smallest units according to a preset pharmaceutical packaging hierarchy and extracting dosage units and total dosage units respectively includes: S41, reading a preset unit base mapping table and comparing the unit string of each smallest unit with the unit base mapping table; S42, assigning a corresponding classification label to each matching smallest unit according to the priority order of dosage unit, dosage unit, inner packaging unit, and middle packaging unit; S43, if the unit string of the same smallest unit can match multiple classification labels, assigning it to the highest priority classification label according to the priority order, and each smallest unit can only belong to one classification label; S44, extracting the smallest units belonging to dosage units based on the smallest units with classification labels; multiplying the quantity values of the smallest units with classification labels of dosage unit, inner packaging unit, and middle packaging unit, treating the quantity values of missing packaging hierarchy as 1, and combining the product result with the unit string of the dosage unit to generate the total dosage unit.
[0011] Furthermore, if the extracted dose units contain multiple units, it is determined to be a multi-dose specification product. The arrangement order of the multiple dose units is standardized: according to the preparation type to which the unit string belongs, the multiple dose units are sorted, spliced, stored and compared in the order of biological agent, radioactivity intensity, volume, area, weight and percentage.
[0012] Furthermore, before comparing the dosage unit and total number of preparations of the goods to be put into storage with the local dosage unit and total number of preparations in S6, the method further includes: performing unit measurement conversion on the extracted units. If the unit strings of the two units to be compared belong to different expressions of the same measurement dimension, they are uniformly converted into the base unit according to the preset conversion ratio, and the corresponding quantity value is converted simultaneously.
[0013] Furthermore, after obtaining the upstream outbound order data in S1, and before performing character cleaning and formatting in S2, an initial binding check step is also included: extracting the unique identifier of the upstream product of the product to be received, and querying the local relational database to see if there is a local product code bound to the unique identifier of the upstream product; if there is, skipping the subsequent product name and specification matching steps, and directly calling the local product file corresponding to the local product code to generate a purchase receipt; if there is no such product, and the product to be received has successfully matched through the steps, automatically creating a binding mapping record between the unique identifier of the upstream product and the successfully matched local product code in the local relational database.
[0014] Furthermore, the acquisition of upstream outbound order data described in S1 specifically includes: receiving a single drug traceability code input through a scanning device, wherein the drug traceability code corresponds to a specific item in a full outbound order issued by an upstream supplier; using the drug traceability code as a query parameter, calling the document query interface of the drug traceability platform to retrieve the full outbound order data associated with the drug traceability code, wherein the full outbound order data contains multiple detailed records of all outbound items in the batch; parsing the full outbound order data, and batch extracting the matching product name field, matching specification field, batch number field, expiration date field, and drug traceability code of each item from each detailed record.
[0015] Furthermore, as described in S7, automatically generating a purchase receipt and updating the local inventory system based on the successfully matched local product file information specifically includes: combining the batch-matched local product file information with the extracted batch number field and expiration date field to generate a complete purchase receipt; associating the drug traceability code of each product in the complete outbound data with the generated complete purchase receipt number and writing it into the local traceability code inventory ledger database.
[0016] On the other hand, this invention provides a pharmaceutical product warehousing system based on name and specification matching, comprising: a data acquisition module for acquiring upstream outbound order data or calling an external interface to retrieve complete outbound order data by scanning the drug traceability code; a product name preprocessing module for performing character cleaning and formatting processing on the product name field to be matched, including special character removal, half-width conversion, and deletion of bracket content, to obtain a standardized generic name; a specification intelligent splitting module for splitting the specification field to be matched using delimiters to obtain multiple minimum units containing only quantity values and unit strings, and assigning classification labels according to the rules of dosage unit, preparation unit, inner packaging unit, and middle packaging unit to calculate and extract the dosage unit and total preparation unit; a dual-condition matching module for verifying whether the dosage unit and total preparation unit of the product to be warehoused correspond to the local product, provided that the generic name of the local product file is consistent with the standardized generic name; and a document generation and inventory module for automatically generating a purchase receipt and updating the local inventory system based on the successfully matched local product file.
[0017] The beneficial effects of this invention are: 1. Innovatively, a specification unit splitting method is introduced. Regardless of whether the upstream input is "0.25g*24s" or "0.25g×2 boards (12 tablets / board)," this method constructs an absolutely unique data anchor point, which enables the computer to accurately identify products with the same physical substance, effectively improving the accuracy of automatic matching.
[0018] 2. By integrating with the drug traceability system, it breaks through the limitations of traditional single-code scanning for inbound goods. Simply scan the traceability code on the packaging box or any box of medicine with a barcode scanner, and the system can reverse-map the entire outbound order via a network API. Combined with the underlying intelligent matching algorithm, it achieves one-code entry and complete order entry into the warehouse, reducing manual intervention costs and button press frequency.
[0019] 3. By establishing a binding relationship database after initial operation or manual correction, the system has the ability to remember. Once a unique identifier mapping is successfully formed by matching codes, subsequent data of the same type from the same supplier will be directly hit in the hash table with O(1) complexity and allowed to pass, avoiding the waste of CPU computing power caused by repeatedly calling the splitting algorithm. Attached Figure Description
[0020] The present invention can be further illustrated by the non-limiting embodiments given in the accompanying drawings; Figure 1 This is a schematic diagram of the method flow of the present invention; Figure 2 This is a system framework diagram of the present invention; Detailed Implementation This invention provides a method for warehousing pharmaceutical products based on name and specification matching. This method can be executed by a server, terminal device, cloud service node, or a combination thereof deployed in a pharmaceutical ERP system. The server, terminal device, or cloud service node includes at least a processor, memory, database access interface, network communication interface, and input interface for receiving input data from a scanning device, and includes the following steps: S1: Obtain upstream outbound order data, and extract the matching product name field and matching specification field of the goods to be received from the upstream outbound order data; Specifically, it includes: In the interface import method, upstream outbound order data can be JSON, XML, or other structured messages. After receiving the message through the network communication interface, the system deserializes the message to obtain the document header and product detail set. The document header may include the outbound order number, supplier name, outbound time, and total quantity; the product detail set may include multiple product detail objects, each corresponding to a product to be received.
[0021] In the file import method, the system reads fields from Excel, CSV or other spreadsheet files, converts each row into a product detail object, and maps fields such as product name, specifications, quantity, batch number, and expiration date to unified internal fields.
[0022] In the traceability code method, users scan any drug traceability code using a barcode scanner. This traceability code corresponds to any product in a single outbound shipment from an upstream supplier. The system uses this traceability code as a query parameter, calling the outbound document query interface of the drug traceability platform to retrieve the outbound shipment data associated with that traceability code. After receiving the returned outbound shipment data, the system parses the following fields from each product detail record: the product name, specifications, quantity, batch number, expiration date, and the corresponding drug traceability code for each product.
[0023] For example, after scanning a drug traceability code, the system calls the drug traceability platform interface to return the entire order's outbound data. This data includes the document number, supplier information, outbound time, and multiple product details. Each product detail includes the product name, specifications, manufacturer, approval number, batch number, production date, expiration date, outbound quantity, outbound unit, and traceability code. The system performs a subsequent matching process for each product detail in the entire order's outbound data, thereby achieving batch inbound processing of the entire order. S2: Perform character cleaning and formatting on the product name field to be matched to obtain a standardized generic name; Specifically, it includes: The system first identifies and removes preset special characters from the product name field to be matched. The preset special characters may include spaces, newlines, tabs, null characters, connectors, repeating delimiters, invisible characters, and other characters that do not affect the substantive meaning of the generic name of the drug.
[0024] Then, the system converts full-width characters in the string after removing preset special characters to half-width characters. For example, full-width numbers, full-width English letters, full-width parentheses, and full-width punctuation marks are uniformly converted to half-width forms to avoid inconsistencies in the string due to the difference between full-width and half-width characters.
[0025] Subsequently, the system identifies paired parenthesis characters in the string and deletes the paired parenthesis characters and the characters inside them. The paired parenthesis characters can include Chinese parentheses, English parentheses, Chinese square brackets, English square brackets, Chinese book titles, and English curly braces. For nested parentheses or multiple sets of parentheses, the system can use a stack structure to identify the pairing relationship between left and right parentheses. When a left parenthesis is scanned, its position is pushed onto the stack; when a right parenthesis is scanned, the top left parenthesis position is popped from the stack, and the characters between that left and right parenthesis are marked as deleted characters. After scanning, the system outputs the sequence of characters that were not marked for deletion.
[0026] Finally, the system stores the processed string as a standardized generic name and uses it for subsequent local product file queries; In addition, after obtaining the upstream outbound order data in step S1, and before performing character cleaning and formatting in this step, an initial binding check step is also included: Extract the unique identifier of the upstream product of the product to be put into storage, and query the local relational database to see if there is a local product code bound to the unique identifier of the upstream product. If there is, skip the subsequent product name and specification matching steps and directly call the local product file corresponding to the local product code to generate a purchase order. If there is no, and the product to be put into storage has been successfully matched through the steps, automatically create a binding mapping record between the unique identifier of the upstream product and the successfully matched local product code in the local relational database. S3: The specification field to be matched is split into specification units to obtain multiple minimum units containing only quantity values and unit strings; Specifically, it includes: Remove preset invalid characters from the specification field to be matched and convert them from full-width to half-width characters; use preset multiplication and division symbols and punctuation marks as delimiters to split the converted specification string into multiple substrings; call a preset regular expression engine to identify the numerical part and non-numerical unit part in each substring, and construct key-value pairs containing quantity values and unit strings as the smallest unit; if the substring contains only unit strings and no numerical values, the quantity value of the smallest unit is automatically assigned to 1 in memory; construct a hash table in the memory buffer, and perform deduplication on multiple smallest units with the same unit string, retaining only the smallest unit with the largest quantity value; S4: The smallest unit is then classified according to the preset pharmaceutical packaging hierarchy, and the dosage unit and the total number of preparations unit are extracted respectively; Specifically, it includes: The system reads a preset unit base mapping table and compares the unit string of each minimum unit with the unit base mapping table. It assigns a corresponding category label to each matching minimum unit according to the priority order of dosage unit, formulation unit, inner packaging unit, and intermediate packaging unit. If the unit string of the same minimum unit can match multiple category labels, it assigns it to the highest priority category label according to the priority order, and each minimum unit can only belong to one category label. Based on the minimum units with category labels, it extracts the minimum units belonging to dosage units. It then performs a dimensionality reduction multiplication operation on the number of minimum units with category labels of formulation unit, inner packaging unit, and intermediate packaging unit, and combines the product result with the unit string of the formulation unit to generate the total number of formulation units. S5: Query the standardized generic name in the local product file database. When there is a target generic name in the local product file that is completely consistent with the standardized generic name, extract the local dosage unit and local formulation total unit corresponding to the local product file. S6: Compare the dosage unit and total number of preparations of the goods to be put into storage with the local dosage unit and local total number of preparations. If the data of the two sets of units are consistent, the goods are determined to be successfully matched. The process includes, before comparing the dosage units and total number of formulation units of the goods to be received with the local dosage units and total number of local formulation units, the following steps: The extracted units are converted to units. If the unit strings of two units to be compared belong to different expressions of the same measurement dimension, they are converted to the base unit according to the preset conversion ratio, and the corresponding quantity value is converted simultaneously. If the extracted dose units contain multiple units, they are determined to be multi-dose specification products. According to the preparation type to which the unit string belongs, the multiple dose units are sorted, spliced and stored and compared in the order of biological agent, radioactivity intensity, volume, area, weight and percentage. S7: Based on the successfully matched local product file information, automatically generate a purchase receipt and update the local inventory system.
[0027] Example 1: This embodiment details how the system processes complex product details received from upstream through underlying software and hardware logic. Assume the computer system receives the following details: Product name "Amoxicillin Capsules (Special Edition)"; Specification "0.25g × 2 blister packs (12 capsules / blister)".
[0028] The system loads the details into memory and extracts the unique identifier of its upstream product. A query is then performed in the local database, such as a product association table in SQL Server. If no match is found, the process proceeds to the core processing flow.
[0029] The computer system's product name preprocessing module reads the string "Amoxicillin Capsules (Special Edition)" from memory. First, it iterates through the strings, removing control characters from the ASCII code, such as hidden newline characters (\n) and tab characters (\t). Next, it calls a full-width / half-width character conversion function for standardization. The key is the bracket deletion mechanism: the system initializes a character stack structure in memory. Characters are read sequentially; when a left bracket character () is encountered, its current index position is recorded and pushed onto the stack; when a corresponding right bracket is encountered, it is popped from the stack, and all memory data within the left and right bracket index range, i.e., "Special Edition," is erased. After processing, the system persistently outputs the string remaining in memory, resulting in the standardized, generic name: Amoxicillin Capsules.
[0030] The system reads the specification field to be matched: "0.25g × 2 blister packs (12 tablets / blister pack)".
[0031] (1) Filtering and conversion: The system executes the replacement rules and replaces all special symbols other than the parentheses with preset delimiters, such as *, and the string is changed to 0.25g*2plates*12 tablets / plate.
[0032] (2) Regular expression segmentation and extraction: The string is segmented using * and / as delimiters, and the regular expression engine is called. For example, \d+(\.\d+)? is used to match numbers, and [a-zA-Z\u4e00-\u9fa5]+ is used to match units, separating numbers and text, and instantiating them into a collection of objects in memory: (0.25, g), (2, plate), (12, grain), (1, plate). For the substring that only extracts the unit "plate", the system assigns the numerical constant 1 by default.
[0033] (3) Hash Deduplication: To eliminate redundant descriptions at the packaging level, the system stores "unit" as the key and "quantity value" as the value in a hash table. For inputs that are both "plates", the system compares the values, retains (2, plate) and overwrites (1, plate). At this time, the set is simplified to: (0.25, gram), (12, grain), (2, plate).
[0034] (4) Table lookup and dimensionality reduction calculation: The system reads the local "unit basic mapping table". Map "gram" to the [dosage unit] label; "particle" to the [formulation unit] label; "plate" to the [inner packaging unit] label. The system triggers the dimensionality reduction calculation logic: directly extract the dosage unit data as 0.25, grams; before calculating the total number of formulation unit data, the system will predict the existence of each packaging level. For products that only contain formulation units but lack inner packaging units and middle packaging units (e.g., specifications of 0.25g*24 tablets), the system will default the quantity value of the missing level to 1. In this embodiment, the total number of formulation unit data is calculated as: the quantity value of formulation units (12) × the quantity value of inner packaging units (2) × the default value of missing middle packaging units (1) = 24, and the unit is "particle" of the formulation unit. Generate the total number of formulation units: 24, tablets.
[0035] (5) Measurement mapping standardization: The system calls the measurement dictionary to uniformly map the "gram" in the dosage unit to its base unit "g", and the numerical value is maintained proportionally, thus obtaining the system's underlying comparison anchor point: dosage unit 0.25,g. If the total dosage unit does not require cross-dimensional conversion, it is maintained as 24,particles.
[0036] The system then queries the local product database and locates a local file with the same generic name, "Amoxicillin Capsules." It reads the local dosage unit (assuming 0.25 g) and the total dosage unit (assuming 24 capsules) that were fixed during the file's creation.
[0037] The comparison engine performs the following logical checks: Standardized generic name matches (True) AND dosage unit matches (True) AND total number of preparations matches (True). If all conditions are met, the upstream product and the local file are considered a successful match. Subsequently, the system writes this correspondence into the product association table, instantiates an inbound document object, fills in the batch number and expiration date, and updates the local inventory table through a transaction commit.
[0038] Example 2: This embodiment describes how the present invention can be integrated with a drug traceability network to change the traditional physical interaction mode of scanning barcodes item by item for warehousing. Scenario description: A pharmacy receives a mixed-package large box from a supplier, containing 50 different specifications of drugs. In the traditional mode, it would require scanning the barcodes 50 times and manually confirming the scan.
[0039] Users randomly scan the 20-digit drug traceability code of any box of medicine in the cargo box using a barcode scanner, for example: 81234567890123456789. The computer front-end interface captures this string, encapsulates it in the payload of an HTTP / HTTPS request, and initiates an asynchronous GET / POST request to an external drug traceability platform, such as the "Code-Based Safe" platform API, for example, calling the "Retail Pharmacy Query Upstream Enterprise Outbound Document Information API Interface".
[0040] After verifying permissions, the platform server returns a JSON-formatted response message. This message not only contains individual information about the scanned box of medicine, but also a complete array of details for all 50 products under the corresponding upstream outbound order. Each record includes the product name, specifications, manufacturer, batch number, expiration date, quantity, and its respective traceability code. The system receives the response message and performs JSON deserialization, allocating a list structure in memory to cache these 50 detailed data entries.
[0041] The system initiates a loop or multi-threaded concurrent processing, sending each of the 50 detailed data entries into Example 1 for product name preprocessing and intelligent specification splitting. The system automatically and silently performs intensive calculations and comparisons in the background, assuming 48 drugs are successfully matched and 2 are first-time purchases without local records.
[0042] For the two products that failed to match, the system suspends the thread and highlights a prompt in the UI, suggesting the operator to "create a new first-time product" or "manually specify mapping." After manual processing and confirmation, the system resumes the suspended process, packaging the matching results, batch number, expiration date, quantity, and other fields of the 50 products into a single complete purchase receipt with 50 detailed entries in the database. Simultaneously, the system performs two-way traceability recording: associating the drug traceability codes of these 50 products with the locally generated receipt number, and performing batch INSERT operations to write them to the "Traceability Code Receipt Ledger." Thus, with just one scan, the complex whole-box verification, document matching, and GSP-compliant receipt are completed, greatly improving work efficiency.
[0043] Example 3: For some compound preparations or multi-component drugs, such as topical ointments containing both weight-based and percentage-based dosages, the registration order between upstream and local databases is often reversed. For example, the dosage unit set resolved from the upstream specification might be: [5,%; 3,g]. The local database might store it as: [3,g; 5,%].
[0044] This invention adds a sorting and cleaning process before the comparison module: the system presets a dimension-based sorting enumeration: 1=biological agent, 2=radioactivity intensity, 3=volume, 4=area, 5=weight, 6=percentage. When the system detects the existence of multiple dose units, it reads the enumeration value of each unit. g belongs to weight (5), % belongs to percentage (6). The system calls a sorting algorithm, such as quicksort, to sort in ascending order of enumeration values, forcibly rearranging the upstream set to: [3,g;5,%], and then comparing the concatenated string with the local string hash value for accurate comparison. This avoids algorithm misjudgment caused by simply reversing the writing order.
[0045] Example 4: To further improve the business applicability of the matching, the system has constructed a four-level hierarchical matching logic. After completing basic data cleaning and unit normalization, the computer system does not directly determine the matching result, but performs matching according to a preset hierarchical strategy. The system first traverses the local product file database and cross-validates the standardized product name and specifications with the manufacturer and approval number in the upstream delivery order.
[0046] The four-level hierarchical matching logic is as follows: Condition 1: Product Name + Manufacturer + Specifications + Approval Number; Condition 2: Product name + specifications + manufacturer; Condition 3: Product name + specifications + approval number; Condition 4: Specifications + Approval Number.
[0047] This hierarchical logic can effectively handle situations where the completeness of outbound order information varies among different suppliers.
[0048] If the four-level hierarchical matching logic traversal fails to find a match, the system enters exception handling: 1. Manual matching: Users enter keywords in the interactive interface, and the system performs dynamic fuzzy matching based on the local product table.
[0049] 2. Initial Establishment: If a user chooses to establish a new business, the system first performs a hash-based deduplication check on unique characteristics such as the approval number and manufacturer. If the deduplication check passes, the system executes a backtracking mechanism, automatically recording the mapping relationship between the upstream product ID and the newly established local ERP product ID, and automatically invoking the aforementioned four-level hierarchical matching logic to check if the newly added relationship meets the four-level matching conditions. If the backtracking match is successful, the matching logic is stored in the relational database, thereby achieving self-learning and dynamic optimization of the matching rules.
[0050] This invention also provides a pharmaceutical product warehousing system based on name and specification matching, comprising the following functional modules to perform the above methods: The data acquisition module is used to acquire upstream outbound order data, or receive drug traceability codes transmitted by hardware scanning devices through external I / O interfaces, and construct network requests to call the external traceability platform API to pull the JSON / XML data message of the entire outbound order.
[0051] The product name preprocessing module is used to allocate a buffer in memory, perform special character removal and half-width conversion based on regular expressions on the product name field to be matched, and complete the erasure operation of paired parentheses and their internal associated characters through logic that simulates a stack structure, and output a standardized general name.
[0052] The specification intelligent splitting module is equipped with a regular expression parser and a data dictionary. It is used to split long specification strings into substrings and extract values and units to construct the smallest unit objects; it performs the same-unit comparison and deduplication logic; and based on the configured unit base mapping tree, it classifies objects to the corresponding pharmaceutical packaging level nodes: dosage, formulation, inner packaging, and middle packaging. Then, it uses multiplication logic to reduce dimensionality and order, and calculates the dosage unit and the total number of formulation units as the core anchor points.
[0053] The dual-condition matching module, serving as the core decision engine, performs comparison calculations between upstream data and local SQL database data. It includes a unit metric conversion submodule, a multi-dose dimensionality reduction sorting submodule, and a high-speed query submodule for initial binding relationships based on an associative hash table. Its judgment threshold is set as follows: all three conditions—standardized generic name AND dose unit AND total number of formulation units—must be equal.
[0054] The document generation and inventory module is used to listen for the success signal of the two-condition matching module, instantiate the inbound document entity, inject the batch number, expiration date, quantity and successfully mapped local product ID into the entity and perform ORM save operation, generate the purchase inbound order and update the underlying inventory table and traceability ledger table in the form of transactions.
[0055] The present invention has been described in detail above. The specific embodiments are provided only to help understand the method and core ideas of the present invention. It should be noted that those skilled in the art can make various improvements and modifications to the present invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims
1. A method for warehousing pharmaceutical products based on name and specification matching, characterized in that: The method includes the following steps: S1: Obtain upstream outbound order data, and extract the matching product name field and matching specification field of the goods to be received from the upstream outbound order data; S2: Perform character cleaning and formatting on the product name field to be matched to obtain a standardized generic name; S3: The specification field to be matched is split into specification units to obtain multiple minimum units containing only quantity values and unit strings; S4: The smallest unit is classified according to the preset pharmaceutical packaging level, and the dosage unit and the total number of preparations unit are extracted respectively; wherein, the quantity value of the total number of preparations unit is the product of the quantity values of preparation units, inner packaging units and middle packaging units, and the quantity value of missing packaging levels is treated as 1; S5: Query the standardized generic name in the local product file database. When there is a target generic name in the local product file that is completely consistent with the standardized generic name, extract the local dosage unit and local formulation total unit corresponding to the local product file. S6: Compare the dosage unit and total number of preparations of the goods to be put into storage with the local dosage unit and local total number of preparations. If the data of the two sets of units are consistent, the goods are determined to be successfully matched. S7: Based on the successfully matched local product file information, automatically generate a purchase receipt and update the local inventory system.
2. The method for warehousing pharmaceutical products based on name and specification matching according to claim 1, characterized in that: S2 describes performing character cleaning and formatting on the product name field to be matched to obtain a standardized generic name, specifically including: S21. Identify and remove characters from the preset special character set from the string of the product name field to be matched; S22. Convert all full-width characters in the string after removing special characters to half-width characters; S23. Identify paired parenthesis characters in a half-width string and delete the paired parenthesis characters and all characters contained within them; S24. Store the string remaining after the above processing as the standardized generic name.
3. The method for warehousing pharmaceutical products based on name and specification matching according to claim 1, characterized in that: In S3, the specification field to be matched is split into specification units to obtain multiple minimum units containing only quantity values and unit strings, specifically including: S31. Remove the preset invalid characters in the specification field to be matched, and convert the multiplication and division symbols, slashes, and parenthesis boundary symbols in the specification field to be matched into a unified delimiter, and perform full-width to half-width character conversion; S32. Using the unified delimiter as the delimiter, the converted specification string is divided into multiple substrings, and the numerical part and non-numerical unit part in each substring are identified to construct the smallest unit containing quantity value and unit string. S33. If the substring contains only unit strings and no numerical values, then the quantity value of the smallest unit will be automatically assigned to 1. S34. For multiple smallest units with the same unit string, perform deduplication and retain only the smallest unit with the largest quantity value.
4. A method for warehousing pharmaceutical products based on name and specification matching according to claim 1 or 3, characterized in that: S4 describes classifying the smallest unit according to a preset pharmaceutical packaging hierarchy, and extracting dosage units and total dosage units, specifically including: S41. Read the preset unit base mapping table and compare the unit string of each smallest unit with the unit base mapping table; S42. Assign a corresponding classification label to each matching smallest unit according to the priority order of dosage unit, formulation unit, inner packaging unit, and middle packaging unit; S43. If the unit string of the same smallest unit can match multiple category tags, then assign them to the category tag with the highest priority according to the priority order, and each smallest unit can only belong to one category tag. S44. Based on the smallest unit with the classification label, extract the smallest unit belonging to the dosage unit; multiply the quantity values of the smallest units with the classification labels of formulation unit, inner packaging unit and middle packaging unit, treat the quantity value of missing packaging level as 1, and combine the product result with the unit string of the formulation unit to generate the total number of formulation units.
5. The method for warehousing pharmaceutical products based on name and specification matching according to claim 4, characterized in that: If the extracted dose units contain multiple units, it is determined to be a multi-dose specification product. The arrangement order of the multiple dose units is standardized: according to the preparation type to which the unit string belongs, the multiple dose units are sorted, spliced, stored and compared in the order of biological agent, radioactivity intensity, volume, area, weight and percentage.
6. The method for warehousing pharmaceutical products based on name and specification matching according to claim 1, characterized in that: Before comparing the dosage units and total dosage units of the goods to be received with the local dosage units and total dosage units of the local products in S6, the following steps are also included: The extracted units are converted to units. If the unit strings of the two units to be compared belong to different expressions of the same measurement dimension, they are converted to the base unit according to the preset conversion ratio, and the corresponding quantity values are converted simultaneously.
7. The method for warehousing pharmaceutical products based on name and specification matching according to claim 1, characterized in that: After S1 obtains the upstream outbound order data, and before S2 performs character cleaning and formatting, an initial binding check step is also included: Extract the unique identifier of the upstream product of the product to be put into the warehouse, and query the local relational database to see if there is a local product code that is bound to the unique identifier of the upstream product; If it exists, skip the subsequent steps of matching product name and specifications, and directly call the local product file corresponding to the local product code to generate a purchase receipt; If it does not exist, and the goods to be put into the warehouse are successfully matched through the steps, a binding mapping record of the unique identifier of the upstream goods and the successfully matched local goods code will be automatically created in the local association database.
8. The method for warehousing pharmaceutical products based on name and specification matching according to claim 1, characterized in that: The acquisition of upstream outbound order data described in S1 specifically includes: Receive a single drug traceability code input via a scanning device, wherein the drug traceability code corresponds to a specific item in a full outbound order issued by an upstream supplier; Using the drug traceability code as a query parameter, the document query interface of the drug traceability platform is called to retrieve the entire order outbound data associated with the drug traceability code. The entire order outbound data contains multiple detailed records of all outbound goods in this batch. The entire order outbound data is parsed, and the product name field, specification field, batch number field, expiration date field, and drug traceability code of each item are extracted in batches from each detailed record.
9. A method for warehousing pharmaceutical products based on name and specification matching according to claim 8, characterized in that: S7 describes automatically generating a purchase receipt and updating the local inventory system based on the successfully matched local product file information, specifically including: The successfully matched local product files are combined with the extracted batch number and expiration date fields to generate a complete purchase receipt. The drug traceability codes of each commodity in the overall outbound data are associated with the generated overall purchase inbound order number and written into the local traceability code inbound ledger database.
10. A pharmaceutical product warehousing system based on name and specification matching, characterized in that: include: The data acquisition module is used to acquire upstream outbound order data or to call an external interface to pull out the entire outbound order data by scanning the drug traceability code; The product name preprocessing module is used to perform character cleaning and formatting processing on the product name field to be matched, including special character removal, half-width conversion, and deletion of bracket content, to obtain a standardized general name; The specification intelligent splitting module is used to split the specification field to be matched using delimiters to obtain multiple minimum units containing only quantity values and unit strings, and to assign classification labels according to the rules of dosage unit, formulation unit, inner packaging unit, and middle packaging unit, so as to calculate and extract dosage unit and total formulation unit. The dual-condition matching module is used to verify whether the dosage unit and total dosage unit of the product to be put into the warehouse are consistent with the local product, provided that the common name of the local product file is consistent with the standardized common name. The document generation and inventory module is used to automatically generate purchase receipts and update the local inventory system based on successfully matched local product files.