Method for identifying receipts to be put in storage based on OCR
Through the OCR -based identification method and three element matching calculations, the problem of formatting and alignment of the data formatting of the same goal peers, realizing the automated database into the library, improving efficiency and accuracy.
Patent Information
- Application Number
- CN202411127966.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2025-01-21
AI Technical Summary
The prior art is difficult to efficiently format and align data in orders with goods, especially for complex table layout formats, and manual entry is inefficient.
The OCR -based identification method is adopted to collect information on the followers of the followers, and through the matching of product names, specifications and manufacturers, combined with matching compatibility calculations, automatic alignment and formatting data.
It realizes the automated data warehousing process, improves the efficiency and accuracy of data entry, can handle complex table layout formats, and is suitable for a variety of document templates.
Smart Images

Figure CN119339402A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of medical automation, and in particular to a method for warehousing documents based on OCR recognition. Background Art
[0002] There are too many specific requirements for data formatting, such as the formatting requirements for accompanying documents. The formatted data will be aligned to each field of the database one by one. In the past, data was often entered manually. For example, after receiving the goods, the pharmacy needed to manually enter the product information of each purchase, including the name / specification / manufacturer of the drug (product), etc. This was very inefficient.
[0003] With the development of OCR (Optical Character Recognition) technology, the text content in the image file can be recognized, but the formatting and alignment of the content cannot be completed. For simpler requirements, such as ID card recognition, templates can be used to align the corresponding fields, but for table typesetting, this method cannot meet the data formatting requirements. In contrast, the method provided by this patent can be used directly.
[0004] Therefore, this patent invents a method for warehousing documents based on OCR recognition. Summary of the invention
[0005] In order to solve the technical problem, the present invention proposes the following solution: A method for warehousing documents based on OCR recognition includes the following steps: Step 1: Collect the information on the accompanying document through OCR; Step 2, matching the information obtained in step 1 with the pre-stored commodity library information according to the three elements of commodity name, specification and manufacturer; Step 3, matching the same number of characters in each of the three elements and synthesizing the matching degree of the three elements.
[0006] Preferably, after step 1, step 1.1 is also included. When the identified product information is displayed in a mixed form, it needs to be cut according to the corresponding fields and then saved.
[0007] Preferably, the mixed form includes at least two of the drug name, specification and manufacturer.
[0008] Preferably, step 3 also includes: step 3.1 determining which of the three elements the obtained information belongs to; step 3.2 after determining the element, comparing the information with the corresponding information in the pre-stored product library information; step 3.3 when multiple pieces of the obtained information match the corresponding information and have the same degree of match, selecting the first one that matches.
[0009] Preferably, the matching degree is obtained by determining the proportion of the same number of words in the obtained information and the information in the database in the same corresponding element according to the number of words, and then averaging the matching degrees obtained in the first element, the second element and the third element respectively.
[0010] Preferably, the method further includes step 4, in which the commodities that match the drugstore commodity library are displayed, and the commodities that do not match the drugstore commodity library are displayed according to the OCR identification information.
[0011] Preferably, the method further includes step 5, wherein the product batch, validity period, quantity and tax-inclusive price are displayed according to OCR recognition.
[0012] Supports taking a single photo (or multiple photos) while traveling, OCR recognition of multiple photos at the same time, optimized operation, and improved accuracy; supports configuration of document templates of different styles, abstract data models, no need for subsequent code development, and can recognize different documents by configuring template parsing strategies; after OCR recognition, supports user comparison and inspection, and manual intervention for error correction; supports access to multiple OCR recognition vendors, bottom-level code encapsulation, business isolation, and can be switched at any time to achieve the optimal usage scenario; BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1-Figure 15 It is a simplified diagram of the interactive process of the document storage method of the present invention on the mobile phone; Fig.16 This is a preferred embodiment of the document warehousing method of the present invention. DETAILED DESCRIPTION
[0014] A method for warehousing documents based on OCR recognition includes the following steps: Step 1: Collect the information on the accompanying document through OCR; Step 2, matching the information obtained in step 1 with the pre-stored commodity library information according to the three elements of commodity name, specification and manufacturer; Step 3, matching the same number of characters in each of the three elements and synthesizing the matching degree of the three elements.
[0015] Preferably, after step 1, step 1.1 is also included. When the identified product information is displayed in a mixed form, it needs to be cut according to the corresponding fields and then saved.
[0016] Preferably, the mixed form includes at least two of the drug name, specification and manufacturer.
[0017] Preferably, step 3 also includes: step 3.1 determining which of the three elements the obtained information belongs to; step 3.2 after determining the element, comparing the information with the corresponding information in the pre-stored product library information; step 3.3 when multiple pieces of the obtained information match the corresponding information and have the same degree of match, selecting the first one that matches.
[0018] Preferably, the matching degree is obtained by determining the proportion of the same number of words in the obtained information and the information in the database in the same corresponding element according to the number of words, and then averaging the matching degrees obtained in the first element, the second element and the third element respectively.
[0019] Preferably, the method further includes step 4, in which the commodities that match the drugstore commodity library are displayed, and the commodities that do not match the drugstore commodity library are displayed according to the OCR identification information.
[0020] Preferably, the method further includes step 5, wherein the product batch, validity period, quantity and tax-inclusive price are displayed according to OCR recognition.
[0021] like Figure 1-16 As shown, this patent proposes a method for formatting and aligning the original text after OCR recognition based on the method of OCR recognition of document storage.
[0022] 1. Operation Guide Exhibition content: ①. Shooting standards: 1. Standard accompanying documents, including supplier / commodity / quantity / batch / price; 2. No excessive watermarks, smears, or seal obstructions; 3. Bright light, clear photos without shaking; 4. For multiple accompanying documents of the same order, please take photos in sequence; ②. Incorrect operation: 1. Multiple orders cannot be placed at the same time; 2. There are other documents or other objects interfering; 3. Please do not take photos of medicine packaging boxes; ③、Introduction to the photography process; Interaction logic: ①. Operation instructions will be provided only when you use the photo storage function for the first time; 2. Take photos Interaction logic: ①. Before clicking on the photo storage page to enter the photo page, you need to determine whether the user has authorized it. If not, it will prompt the user to authorize it; ②. After the user authorizes, click the photo button to take a photo. It supports taking multiple photos at a time. ③. The photos taken are displayed in the lower left corner, and the number of photos currently taken is marked; Photo restrictions: ①. The current version only supports taking up to 10 photos at a time; ②. The size of each photo must be less than 4M; 3. Mobile photo album Interaction logic: ①. Click on the mobile phone album to determine whether the user has authorized the local album. If not, perform the user authorization operation; ②. After the user authorizes, directly enter the local photo album to select the corresponding photo, and multiple selections are allowed; ③. The selected photos are displayed in the lower left corner, and the number of current photos is marked; 4. OCR recognition & processing Interaction logic: ①. Use the OCR interface to identify and process existing photos; ②. When the identified product information is displayed in a mixed form, it needs to be cut according to the corresponding fields and saved. The cutting identification mark is " / ".
[0023] Note: Example of mixed form: Drug (product) name / specification / manufacturer 5. Matching products Interaction logic: ①. Match the processed product information through the interface; Matching Source: ①. Drugstore product library ②、OCR identifies products based on the same logic as the pop-up window for selecting products on the PC side, and matches them; Matching method: ①. Use the common name + manufacturer + specification / model to match the three elements and select the product with the highest matching degree; ②. If there is more than one product with the highest matching degree, just select the first one; Matching rules: Each element is matched with the same number of words, and then the matching degrees of the three elements are combined and averaged to obtain the comprehensive matching degree; 6. Results display Interaction logic: ①. Display the supplier information in the newly added warehouse; ②、Reflect the product information to the newly added inventory—— The products that have been matched with the drugstore product library are displayed according to the matching information; Products that have anomalies in the drugstore product database are displayed according to OCR recognition information; ③. Product batch, validity period, quantity, and price including tax are displayed according to OCR recognition; ④. Amount = quantity * price including tax; Field Notes: ①. The tax-inclusive price in some tables is expressed as a unit price, that is, unit price = tax-inclusive price. The present invention uses a keyword set to format and align text, which is more general than using an OCR template for alignment. It has a stronger generalization ability when dealing with alignment such as case and physical examination reports, because the template-based method is feasible for small fixed tasks such as identity cards and invoices, but it is difficult to find a fixed template for physical examination reports with variable layouts. The use of three-element matching can cope with this situation.
[0024] like Fig.16 As shown, OCR parsing strategy: 1. If the type is plain, match it to the field according to the regular expression 2. If the recognized content is a table, it will be mapped to the field according to the column subtitles. 3. According to the policy method and parameters in the parsing policy configuration, call the corresponding policy method through Java reflection to extract the field content byWord: directly assign values to the field, without lineNumber byTableCol: directly assign values to fields, with lineNumber byTableColAndSplit: The array obtained by separating the string according to the specified characters, taking the corresponding subscript, assigning a value to the field, with lineNumber byTableColGetNumber: extract numbers from a string and assign values to fields, with lineNumber byMatcherGroup: matches some characters in a string according to a regular expression. Multiple matching results are obtained according to the specified index and a value is assigned to the field, including lineNumber.
[0025] 4. Convert the parsing results: the same lineNumber is a product, each lineNumber is assembled into a json object, the key is the attribute name, the value is the attribute value, and finally convert the json object into DTO. Fig.16 The text content displayed in will not be repeated.
[0026] Therefore, the above-mentioned embodiments are given as examples with the help of the accompanying drawings, but those skilled in the art should understand that within the protection scope defined by the claims of the present invention, different technical solutions can be formed by adding, deleting and combining technical features.
Claims
1. A method for warehousing documents based on OCR recognition, characterized in that: The steps include: Step 1: Collect the information on the accompanying document through OCR; Step 2, matching the information obtained in step 1 with the pre-stored commodity library information according to the three elements of commodity name, specification and manufacturer; Step 3, matching the same number of characters in each of the three elements and synthesizing the matching degree of the three elements.
2. The method for warehousing documents based on OCR recognition according to claim 1 is characterized in that: After step 1, step 1.1 is also included. When the identified product information is displayed in a mixed form, it needs to be cut according to the corresponding fields and then saved.
3. The method for warehousing documents based on OCR recognition according to claim 2 is characterized in that: The mixed form includes at least two of the drug name, specification and manufacturer.
4. The method for warehousing documents based on OCR recognition according to claim 3 is characterized in that: The step 3 also includes: step 3.1 determining which of the three elements the obtained information belongs to; step 3.2 after determining the element, comparing the information with the corresponding information in the pre-stored product library information; step 3.3 when multiple pieces of the obtained information match the corresponding information and have the same degree of match, the first matching one is selected.
5. The method for warehousing documents based on OCR recognition according to claim 4 is characterized in that: The matching degree is obtained by determining the proportion of the same number of words in the corresponding same element between the obtained information and the information in the database according to the number of words, and then averaging the matching degrees obtained in the first element, the second element and the third element respectively.
6. The method for warehousing documents based on OCR recognition according to claim 5 is characterized in that: The method also includes step 4, in which the products that match the drugstore product library are displayed, and the products that have an abnormal match with the drugstore product library are displayed according to the OCR recognition information.
7. The method for warehousing documents based on OCR recognition according to claim 5 is characterized in that: It also includes step 5, in which the product batch, expiration date, quantity and tax-inclusive price are displayed according to OCR recognition.