Report generation method and device, electronic equipment and computer readable storage medium
By preprocessing images, recognizing fields, and mapping and matching, generating SQL statements and validating them, the problem of existing report generation relying on manual mapping is solved, and efficient and accurate intelligent report generation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- PING AN INT FINANCIAL LEASING CO LTD
- Filing Date
- 2026-05-09
- Publication Date
- 2026-07-31
AI Technical Summary
The existing intelligent report generation process relies on manual field-by-field mapping, which is time-consuming and prone to errors, and cannot achieve efficient and accurate data display.
By acquiring the image to be recognized, preprocessing, field recognition, mapping and matching with a preset knowledge base, generating SQL statements and performing syntax verification, and finally deploying to the database to generate intelligent reports, manual intervention is reduced.
It enables intelligent report generation, improving generation efficiency, reducing the time spent on manual review and mapping, and enhancing report accuracy.
Smart Images

Figure CN122489632A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this application relate to, but are not limited to, the field of data processing technology, and are applied to financial technology and smart healthcare scenarios. In particular, they relate to a report generation method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] With the continuous development of society and economy and the advancement of science and technology, people's living standards have been greatly improved. Various intelligent systems are increasingly being applied in the fields of smart healthcare and fintech. For example, in smart healthcare, intelligent medical systems are increasingly used to manage and process various medical matters; in fintech, financial business systems are used to manage and process various financial transactions. When using intelligent systems to manage various business transactions, and a more intuitive data display of a particular interface of the intelligent system is needed, intelligent reports can be used. However, currently, the generation of intelligent reports relies on manual field-by-field mapping, which is time-consuming and prone to errors. Summary of the Invention
[0003] The following is an overview of the subject matter described in detail herein. This overview is not intended to limit the scope of the claims.
[0004] To address the problems mentioned in the background section, this application provides a report generation method, apparatus, electronic device, and computer-readable storage medium, which can improve report generation efficiency, eliminate the need for manual verification, and enhance the accuracy of the generated reports.
[0005] In a first aspect, embodiments of this application provide a report generation method, the report generation method comprising: Acquire the image to be recognized; The image to be identified is preprocessed to obtain a preprocessed image; The preprocessed image is subjected to field recognition processing to obtain the recognized fields; The identified fields are mapped and matched with a preset knowledge base to obtain the matching fields; Based on a preset structured query language (SQL) template and the matching fields, an SQL statement is generated; and the SQL statement undergoes syntax validation. The SQL statement that passes syntax validation is deployed to a specified location in a preset database to generate intelligent reports.
[0006] Secondly, embodiments of this application also provide a report generation apparatus, the report generation apparatus comprising: The acquisition unit is used to acquire the image to be recognized; The preprocessing unit is used to preprocess the image to be identified to obtain a preprocessed image; The recognition unit is used to perform field recognition processing on the preprocessed image to obtain the recognition fields; The matching unit is used to perform mapping and matching processing between the identified field and a preset knowledge base to obtain the matching field; The execution unit is used to generate an SQL statement based on a preset structured query language (SQL) template and the matching field; and to perform syntax validation on the SQL statement. The building unit is used to deploy the SQL statement that has passed syntax validation to a preset database location to generate intelligent reports.
[0007] Thirdly, embodiments of this application also provide an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the report generation method described in the first aspect above.
[0008] Fourthly, embodiments of this application also provide a computer-readable storage medium storing computer-executable instructions for performing the report generation method described in the first aspect above.
[0009] The report generation method according to the embodiments provided in this application has at least the following beneficial effects: In the report generation process, firstly, an image to be recognized is acquired; then, the image to be recognized is preprocessed to obtain a preprocessed image; next, field recognition processing is performed on the preprocessed image to obtain recognized fields; then, the recognized fields are mapped and matched with a preset knowledge base to obtain matching fields; then, based on a preset structured query language (SQL) template and the matching fields, corresponding SQL statements are generated; and the corresponding SQL statements undergo syntax validation processing; finally, the SQL statements that pass syntax validation are deployed to a specified location in a preset database, thereby generating the corresponding intelligent report. Through the above technical solution, reports can be generated intelligently, eliminating the need for manual field-by-field review and mapping as in the past, thus significantly improving report generation efficiency. Attached Figure Description
[0010] The accompanying drawings are used to provide a further understanding of the technical solutions of this application and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of this application and do not constitute a limitation on the technical solutions of this application.
[0011] Figure 1 This is a schematic diagram of an application environment for a report generation method according to an embodiment of this application; Figure 2This is a flowchart illustrating a report generation method provided in one embodiment of this application; Figure 3 yes Figure 2 A schematic diagram of a specific implementation method of step S200; Figure 4 yes Figure 2 A schematic diagram of a specific implementation of step S300; Figure 5 yes Figure 2 A schematic diagram of a specific implementation of step S400; Figure 6 yes Figure 2 A schematic diagram of another specific implementation of step S400; Figure 7 yes Figure 2 A schematic diagram of a specific implementation of step S500; Figure 8 yes Figure 2 A flowchart illustrating another specific implementation of step S500; Figure 9 This is a schematic diagram of a report generation apparatus provided in one embodiment of this application; Figure 10 This is a schematic diagram of an electronic device provided in one embodiment of this application. Detailed Implementation
[0012] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0013] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be noted that, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0014] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0015] AI is a new technical science that studies and develops theories, methods, technologies, and application systems for simulating, extending, and expanding human intelligence. Artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce new intelligent machines that can react in a way similar to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems. Artificial intelligence can simulate the information processes of human consciousness and thought. Furthermore, artificial intelligence utilizes digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceiving the environment, acquiring knowledge, and using that knowledge to achieve optimal results—the theories, methods, technologies, and application systems available for use.
[0016] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0017] Artificial intelligence, or AI, is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0018] The servers involved in artificial intelligence technology can be standalone servers or cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0019] This application provides a report generation method, apparatus, electronic device, and computer-readable storage medium. In the report generation process, firstly, an image to be recognized is acquired; then, the image to be recognized is preprocessed to obtain a preprocessed image; next, field recognition processing is performed on the preprocessed image to obtain recognition fields; then, the recognition fields are mapped and matched with a preset knowledge base to obtain matching fields; next, based on a preset Structured Query Language (SQL) template and the matching fields, corresponding SQL statements are generated; and the corresponding SQL statements undergo syntax validation; finally, the syntax-validated SQL statements are deployed to a specified location in a preset database, thereby generating the corresponding intelligent report. Through the above technical solution, reports can be generated intelligently, eliminating the need for manual field-by-field review and mapping as in the past, significantly improving report generation efficiency.
[0020] The report generation method provided in this application relates to the field of data processing technology. This report generation method can be applied to a terminal or a server, and can also be software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0021] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0022] It should be noted that in all specific embodiments of this application, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards. In addition, when embodiments of this application require access to sensitive personal information of users, separate permission or consent from the user is obtained through pop-ups or redirection to confirmation pages. Only after obtaining the user's separate permission or consent is the necessary user-related data required for the proper functioning of these embodiments acquired.
[0023] The report generation method provided in this application embodiment can be applied to, for example, Figure 1 In this application environment, the client communicates with the server via a network. The server can obtain the image to be recognized from the client; then, it preprocesses the image to obtain a preprocessed image; next, it performs field recognition processing on the preprocessed image to obtain recognition fields; then, it maps and matches the recognition fields with a preset knowledge base to obtain matching fields; then, based on a preset structured query language (SQL) template and matching fields, it generates corresponding SQL statements; and performs syntax validation on the corresponding SQL statements; finally, it deploys the syntax-validated SQL statements to a preset database location to generate corresponding intelligent reports. This technical solution enables intelligent report generation, eliminating the need for manual field-by-field review and mapping as in the past, significantly improving report generation efficiency. The client can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented using a standalone server or a server cluster consisting of multiple servers. The following detailed description of specific embodiments of this application is provided below.
[0024] like Figure 2 As shown, Figure 2 This is a flowchart illustrating a report generation method provided in one embodiment of this application. The report generation method includes the following steps: Step S100: Obtain the image to be recognized.
[0025] The report generation method provided in this application first acquires an image to be recognized during the report generation process. This image can be a screenshot of a system interface in a medical system or a screenshot of a system interface in a financial business system. For example, when medical staff use an inpatient / outpatient management system to view relevant inpatient bed occupancy information, they can take a screenshot of the system's page to obtain the corresponding image to be recognized, preparing for subsequent intelligent report generation. Similarly, when bank employees use a loan management system to view and manage relevant loan information, they can also take a screenshot of the system's page to obtain the corresponding image to be recognized, also preparing for subsequent intelligent report generation.
[0026] It's worth noting that during the process of acquiring the image to be recognized, the corresponding system interface image can be captured using screenshot software on a computer or the system's built-in screenshot function module. Alternatively, it can be photographed using a mobile device such as a smartphone, camera, or tablet. For example, in the field of smart healthcare, when medical staff need to view the drug classification and quantity statistics in a pharmacy management system, they can use screenshot software on the system terminal to capture a screenshot of the pharmacy management system interface, thus obtaining the corresponding image to be recognized. They can also photograph the interface of the pharmacy management system using a mobile phone. Similarly, in the field of fintech, when financial professionals need to view the leased assets in a leasing financing system, they can use screenshot software on the system terminal to capture a screenshot of the leasing financing system interface, thus obtaining the corresponding image to be recognized. They can also photograph the interface of the leasing financing system using a mobile phone.
[0027] It is worth noting that during the acquisition of the image to be identified, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is always obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards. In addition, when this application embodiment needs to obtain sensitive personal information of the user, separate permission or consent from the user is obtained through pop-ups or redirection to a confirmation page. Only after explicitly obtaining the user's separate permission or consent is the necessary user-related data for the normal operation of this application embodiment acquired.
[0028] Step S200: Preprocess the image to be recognized to obtain a preprocessed image.
[0029] The report generation method provided in this application first preprocesses the received image to be recognized during the report generation process to obtain a corresponding preprocessed image; wherein, preprocessing the image to be recognized can well prepare for subsequent field recognition.
[0030] It is worth noting that in the preprocessing of the image to be recognized, the image is first converted to grayscale to obtain a grayscale image; then the grayscale image is denoised to obtain a denoised image; then the denoised image is binarized to obtain a binarized image; then the binarized image is corrected to obtain a corrected image; finally, the corrected image is cropped to obtain the corresponding preprocessed image, which makes the subsequent intelligent report generation more accurate.
[0031] It is worth noting that the image to be recognized is preprocessed before the field recognition process, so that the subsequent field recognition can be more accurate, which in turn makes the subsequent intelligent report generation more accurate.
[0032] like Figure 3 As shown, preprocessing the image to be recognized to obtain a preprocessed image can include the following steps: Step S210: Perform grayscale processing on the image to be recognized to obtain a grayscale image; Step S220: Denoise the grayscale image to obtain a denoised image; Step S230: Binarize the denoised image to obtain a binarized image; Step S240: Correct the binarized image to obtain a corrected image; Step S250: Perform region cropping on the corrected image to obtain a preprocessed image.
[0033] For steps S210 to S250, during the preprocessing of the image to be recognized, the image to be recognized is first converted to grayscale to obtain a grayscale image; then the grayscale image is denoised to obtain a denoised image; then the denoised image is binarized to obtain a binarized image; then the binarized image is corrected to obtain a corrected image; finally, the corrected image is cropped to obtain the corresponding preprocessed image, making the subsequent intelligent report generation more accurate.
[0034] It's worth noting that the image to be recognized is first converted to grayscale, effectively reducing color interference by converting a color image to grayscale. Next, noise reduction is applied to the grayscale image using Gaussian or median filtering to remove noise such as screen scratches or compression distortion. Then, the denoised image is binarized by setting a threshold to convert it to black and white, effectively enhancing the outline of text or markings. Next, the binarized image undergoes correction processing, using Hough transform to correct image tilt, improving the accuracy of field recognition. Finally, the corrected image is cropped, automatically identifying and removing irrelevant areas such as browser borders and desktop icons, retaining only the core area containing the marked field, further improving the accuracy of field recognition.
[0035] For example, a screenshot of the interface of a loan management system in the financial industry is taken to obtain the corresponding image to be recognized. This image is then converted to grayscale to obtain a grayscale image of the loan management system interface. Next, noise reduction processing is performed on the grayscale image to obtain a denoised image. Then, binarization processing is performed on the denoised image to obtain a binarized image. Next, correction processing is performed on the binarized image to obtain a corrected image. Finally, region cropping is performed on the corrected image to obtain a preprocessed image of the loan management system interface. Alternatively, a screenshot of the interface of a medical examination record management system in the medical industry is taken to obtain the corresponding image to be recognized. This image is then converted to grayscale to obtain a grayscale image of the medical examination record management system interface. Next, noise reduction processing is performed on the grayscale image to obtain a denoised image. Then, binarization processing is performed on the denoised image to obtain a binarized image. Next, correction processing is performed on the binarized image to obtain a corrected image. Finally, region cropping is performed on the corrected image to obtain a preprocessed image of the medical examination record management system interface.
[0036] Step S300: Perform field recognition processing on the preprocessed image to obtain the recognized fields.
[0037] The report generation method provided in this application, after preprocessing the image to be recognized to obtain a preprocessed image, can perform field recognition processing on the preprocessed image to obtain the corresponding recognition fields, thus preparing for subsequent field matching. Specifically, in the process of obtaining recognition fields by performing field recognition processing on the preprocessed image, firstly, optical character recognition processing is performed on the preprocessed image to obtain the character recognition content and its corresponding coordinate position; then, contour detection processing is performed on the preprocessed image to obtain a positioning marker region; next, the coordinate information of the positioning marker region is matched with the coordinate position of the character recognition content to obtain a matching confidence score; then, if the matching confidence score is greater than a preset confidence score threshold, the character recognition content corresponding to the coordinate position can be used as the corresponding recognition field.
[0038] It is worth noting that in the financial business field, after obtaining the preprocessed image related to the leasing and financing system interface, optical character recognition (OCR) processing can be performed on the preprocessed image to obtain the corresponding character recognition content and coordinate position. Then, contour detection processing is performed on the preprocessed image to obtain the positioning marker area. Next, the coordinate information of the positioning marker area is matched with the coordinate position of the character recognition content to obtain the matching confidence. Then, if the matching confidence is greater than the preset confidence threshold, the character recognition content corresponding to the coordinate position can be used as the corresponding recognition field to prepare for subsequent field matching. Alternatively, in the field of smart healthcare, after obtaining a preprocessed image related to the registration and consultation system interface, optical character recognition (OCR) can be performed on the preprocessed image to obtain the corresponding character recognition content and coordinate position. Then, contour detection processing is performed on the preprocessed image to obtain the positioning marker region. Next, the coordinate information of the positioning marker region is matched with the coordinate position of the character recognition content to obtain the matching confidence. Then, if the matching confidence is greater than a preset confidence threshold, the character recognition content corresponding to the coordinate position can be used as the corresponding recognition field to prepare for subsequent field matching.
[0039] like Figure 4 As shown, performing field recognition processing on the preprocessed image to obtain the recognized fields can include the following steps: Step S310: Perform optical character recognition processing on the preprocessed image to obtain the character recognition content and the corresponding coordinate position; Step S320: Perform contour detection processing on the preprocessed image to obtain the positioning marker region; Step S330: Match the coordinate information of the positioning marker area with the coordinate position of the character recognition content to obtain the matching confidence score; Step S340: If the matching confidence is greater than the preset confidence threshold, the character recognition content corresponding to the coordinate position is used as the recognition field.
[0040] For steps S310 to S340, in the process of obtaining recognition fields by performing field recognition processing on the preprocessed image, firstly, optical character recognition processing is performed on the preprocessed image to obtain the character recognition content and the corresponding coordinate position; then, contour detection processing is performed on the preprocessed image to obtain the positioning marker area; then, the coordinate information of the positioning marker area is matched with the coordinate position of the character recognition content to obtain the matching confidence; then, if the matching confidence is greater than the preset confidence threshold, the character recognition content corresponding to the coordinate position can be used as the corresponding recognition field to prepare for subsequent field matching.
[0041] It is worth noting that optical character recognition (OCR) is performed on the preprocessed image to recognize all the text in the preprocessed image, thereby obtaining the character recognition content and the corresponding coordinate position. Then, the text in the positioning mark area is extracted, and the coordinates of the positioning mark area are matched with the coordinate positions obtained by optical character recognition to extract the field names in the positioning mark area. For example, for a financial business system, the field names can be "sales amount", "order number" and "date", etc.; for a medical management system, the field names can be "price", "drug number" and "production date", etc.
[0042] It is worth noting that matching the coordinates of the location marker area with the coordinates of the character recognition content yields a matching confidence score. If the matching confidence score is greater than a preset confidence threshold, the character recognition content corresponding to the coordinate position can be used as the recognition field. By setting the matching confidence score, the field recognition matching becomes more reasonable and accurate, improving the accuracy of field recognition. For example, with a confidence threshold set to 0.8, the character recognition content corresponding to the coordinate position will only be used as the recognition field if the calculated matching confidence score is greater than 0.8; otherwise, it will not be used. Adjusting the confidence threshold allows for flexible adjustment of the field recognition accuracy, which can be set according to actual needs.
[0043] Step S400: Map and match the identified fields with the preset knowledge base to obtain the matched fields.
[0044] The report generation method provided in this application, after performing field recognition processing on the preprocessed image to obtain the recognized fields, can then perform mapping and matching processing between the recognized fields and a pre-set knowledge base to obtain the corresponding matching fields, thus preparing for subsequent intelligent report generation.
[0045] It's worth noting that the knowledge base uses structured storage, which can include field aliases, standard database field names, the name of the database table to which it belongs, the name of the database to which it belongs, field data types, field descriptions, and matching weights. Specifically, in the financial industry, field aliases can include sales amount, sales revenue, and income; standard database field names can include sales amount; database table names can include order details; and field descriptions can include the actual payment amount for the order.
[0046] It is worth noting that mapping and matching the identified fields with the fields in the preset knowledge base eliminates the need for manual verification of the mapping process as in the past, thus achieving intelligent mapping and matching and significantly improving the efficiency of intelligent report generation.
[0047] like Figure 5 As shown, mapping and matching the identified fields with a preset knowledge base to obtain the matched fields can include the following steps: Step S410: If there is only one field to identify, perform precise matching between the identified field and the knowledge base fields in the knowledge base. Step S420: If a precise match is successful, the corresponding recognition field is used as the matching field; Step S430: If the exact match fails, calculate the similarity between the identified field and the knowledge base field in the knowledge base using a preset semantic similarity algorithm; Step S440: If the similarity is greater than the preset similarity threshold, the corresponding identification field is used as the matching field.
[0048] For steps S410 to S440, in the process of mapping and matching the identified field with the preset knowledge base to obtain the matching field, when there is only one identified field, the identified field can be precisely matched with the knowledge base field in the knowledge base; if the precise match is successful, the corresponding identified field will be used as the matching field; if the precise match is unsuccessful, a preset semantic similarity algorithm can be used to calculate the similarity between the identified field and the knowledge base field in the knowledge base; if the similarity is greater than a preset similarity threshold, the corresponding identified field will be used as the matching field. Through the above technical solution, the mapping and matching of fields can be made more accurate.
[0049] It is worth noting that when there is only one identification field, the identification field is first matched precisely with the knowledge base fields in the knowledge base. If a precise match is found, the corresponding identification field can be used as the matching field. If a precise match is not found, a similarity match is performed on the identification field. A semantic similarity algorithm is used to calculate the similarity between the identification field and the knowledge base fields in the knowledge base. If the similarity is greater than a pre-set similarity threshold, the corresponding identification field can be used as the matching field. The similarity threshold can be set according to actual needs.
[0050] It is worth noting that the identification field is matched precisely with the knowledge base field in the knowledge base. That is, the requirement of precise matching is only met if the identification field and the knowledge base field are completely identical. If the requirement of precise matching is not met, the identification field will be matched with the knowledge base field in the knowledge base for similarity.
[0051] For example, in the financial business field, the identified field is "sales amount," and the knowledge base also contains "sales amount." Therefore, in the exact matching process, since the knowledge base also contains "sales amount," "sales amount" can be directly used as the matching field. Alternatively, the knowledge base may contain "sales amount" but not "sales amount." Therefore, in the subsequent field matching process, exact matching is performed first because "sales amount" and "sales amount" do not meet the requirements for exact matching. Then, a semantic similarity algorithm can be used to calculate the similarity between "sales amount" and "sales amount," and then "sales amount" can be determined as a matching field based on the similarity. In the smart healthcare field, the identified field is "fee settlement," and the knowledge base also contains "fee settlement." Therefore, in the exact matching process, since the knowledge base also contains "fee settlement," "fee settlement" can be directly used as the matching field. Alternatively, the knowledge base fields may include "cost details calculation" but not "cost settlement". Therefore, in the subsequent field matching process, exact matching is performed first, because "cost details calculation" and "cost settlement" do not meet the requirements of exact matching. Then, a semantic similarity algorithm can be used to calculate the similarity between "cost details calculation" and "cost settlement". Then, "cost settlement" can be determined as a matching field based on the similarity.
[0052] like Figure 6 As shown, mapping and matching the identified fields with a preset knowledge base to obtain the matched fields can include the following steps: Step S450: When there are multiple identification fields, perform multi-field association matching processing between the multiple identification fields and the knowledge base fields in the knowledge base to obtain the matching verification result; Step S460: If the matching verification result is greater than the preset matching confidence threshold, the corresponding multiple recognition fields are used as matching fields.
[0053] For steps S450 to S460, in the process of mapping and matching the identified fields with the preset knowledge base to obtain matching fields, if there are multiple identified fields, multi-field association matching is performed between these multiple identified fields and knowledge base fields to obtain a matching verification result. Furthermore, if the matching verification result is greater than a preset matching confidence threshold, the corresponding multiple identified fields can be used as the corresponding matching fields. Through the above technical solution, the accuracy of field identification is significantly improved by combining the association matching process of multiple identified fields with the relationships between fields.
[0054] For example, in the financial business field, multiple identification fields include "2024" and "sales amount". "2024" belongs to the order time field, and the order time field and "sales amount" belong to the order details field. Therefore, in the subsequent field association matching process, the relationship between the fields can be combined to improve the matching accuracy.
[0055] It is worth noting that if the matching verification result is greater than the preset matching confidence threshold, multiple corresponding identification fields can be used as matching fields; if the matching verification result is not greater than the preset matching confidence threshold, manual confirmation can be triggered to avoid incorrect mapping and make the entire field mapping matching process more reliable.
[0056] Step S500: Generate an SQL statement based on a preset structured query language (SQL) template and matching fields; and perform syntax validation on the SQL statement.
[0057] The report generation method provided in this application embodiment can construct an SQL statement based on a pre-set SQL template and matching fields during the report generation process; then, the generated SQL statement is subjected to syntax validation processing to prepare data for subsequent intelligent report generation.
[0058] It's worth noting that SQL templates can be single-table aggregation report templates, multi-table join report templates, and aggregation report templates. In the process of generating SQL statements based on SQL templates and matching fields, the matching fields are first filled into a pre-defined SQL template to obtain an initial SQL template. Then, according to pre-defined auto-completion conditions, the initial SQL template is supplemented to obtain the corresponding SQL statement. Subsequently, the generated SQL statement can be directly subjected to syntax validation to prepare for subsequent intelligent report generation.
[0059] like Figure 7 As shown, generating SQL statements based on preset Structured Query Language (SQL) templates and matching fields can include the following steps: Step S510: Fill the matching fields into the preset SQL template to obtain the initial SQL template; Step S520: Based on the preset automatic completion conditions, the initial SQL template is supplemented to obtain the SQL statement.
[0060] For steps S510 to S520, in the process of generating SQL statements based on the pre-set structured query language SQL template and matching fields, the matching fields are first filled into the pre-set SQL template to obtain the initial SQL template; then, the initial SQL template is supplemented according to the pre-set automatic supplementation conditions to obtain the corresponding SQL statement. Subsequently, the generated SQL statement can be directly subjected to syntax verification to prepare for the subsequent intelligent report generation.
[0061] For example, in the financial business field, information such as database names, table names, standard fields, and canonical fields matched from the knowledge base are populated into the SQL template; then, conditions are supplemented based on automatically supplemented general conditions (such as time range: order date >= '2024-01-01') or based on implicit information in the image to be recognized (such as the label "2024"). Alternatively, in the smart healthcare field, information such as database names, table names, standard fields, and canonical fields matched from the knowledge base are populated into the SQL template; then, conditions are supplemented based on automatically supplemented general conditions (such as time range: registration date >= '2026-01-01').
[0062] Step S600: Deploy the SQL statement that has passed the syntax check to the specified location in the preset database to generate intelligent reports.
[0063] The report generation method provided in this application generates SQL statements based on preset SQL templates and matching fields during the report generation process. After performing syntax validation on the SQL statements, the syntax-validated SQL statements are deployed to a pre-defined database location, and then the corresponding intelligent reports are generated. This technical solution makes the generation of intelligent reports more accurate and reliable.
[0064] It is worth noting that only SQL statements that pass syntax validation will be deployed to the pre-defined database location. SQL statements that fail syntax validation will not be deployed to the pre-defined database location, thus making the generation of intelligent reports more accurate.
[0065] The above technical solution enables intelligent report generation, eliminating the need for manual field-by-field review and mapping as in the past, thus significantly improving report generation efficiency.
[0066] like Figure 8 As shown, performing syntax validation on SQL statements can include the following steps: Step S530: Perform syntax correctness verification on the SQL statement; Step S540: Perform field validity validation on the SQL statement; Step S550: Perform permission range verification on the SQL statement.
[0067] For steps S530 to S550, during the process of performing syntax verification on the SQL statement, the SQL statement is subjected to syntax correctness verification, field validity verification, and permission scope verification respectively. Through the above three aspects of verification, the syntax verification of the SQL statement can be more comprehensive, accurate, and reasonable.
[0068] It is worth noting that the SQL parsing engine can be called to verify the syntax correctness of the generated SQL statement; the field validity of the SQL statement can be verified to check the legality of the relationship between fields and tables; and the permission scope of the SQL statement can be verified to check whether the generated SQL exceeds the scope of the database / table that the user can access.
[0069] In addition, such as Figure 9 As shown, one embodiment of this application also provides a report generation device 10, which includes: Acquisition unit 100 is used to acquire the image to be recognized; The preprocessing unit 200 is used to preprocess the image to be recognized to obtain a preprocessed image; The recognition unit 300 is used to perform field recognition processing on the preprocessed image to obtain the recognition fields; The matching unit 400 is used to map and match the identified fields with a preset knowledge base to obtain the matching fields; The execution unit 500 is used to generate SQL statements based on preset structured query language (SQL) templates and matching fields, and to perform syntax validation on the SQL statements. Building unit 600 is used to deploy SQL statements that have passed syntax validation to a specified location in a preset database to generate intelligent reports.
[0070] The specific implementation of the report generation device 10 is basically the same as the specific implementation of the report generation method described above, and will not be repeated here.
[0071] In addition, such as Figure 10 As shown, one embodiment of this application also provides an electronic device 700, which includes: a memory 720, a processor 710, and a computer program stored on the memory 720 and executable on the processor 710.
[0072] The processor 710 and memory 720 can be connected via a bus or other means.
[0073] The non-transient software program and instructions required to implement the report generation method of the above embodiments are stored in the memory 720. When executed by the processor 710, the report generation method of each of the above embodiments is executed.
[0074] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0075] Furthermore, one embodiment of this application also provides a computer-readable storage medium storing computer-executable instructions that are executed by a processor 710 or a controller, for example, by a processor 710 in the above-described device embodiment, causing the processor 710 to perform the report generation method in the above-described embodiment.
[0076] The above embodiments can be used in combination, and modules with the same name in different embodiments may be the same or different.
[0077] The foregoing has described specific embodiments of this application; other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims may be performed in a different order than those shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily have to follow the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0078] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, and computer-readable storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0079] The apparatus, device, computer-readable storage medium and method provided in the embodiments of this application are corresponding. Therefore, the apparatus, device and non-volatile computer storage medium also have similar beneficial technical effects as the corresponding method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the corresponding apparatus, device and computer storage medium will not be described again here.
[0080] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program a digital system themselves to "integrate" it onto a PLD, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software, which is similar to the software compiler used when writing program development code. The original code before compilation must also be written in a specific programming language, which is called a Hardware Description Language (HDL). There is not just one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also understand that by simply performing some logic programming on the method flow using the aforementioned hardware description languages and programming it into an integrated circuit, the hardware circuit that implements the logic method flow can be easily obtained.
[0081] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, ASICs, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0082] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0083] For ease of description, the above apparatus is described by dividing it into various functional units. Of course, in implementing the embodiments of this application, the functions of each unit can be implemented in one or more software and / or hardware.
[0084] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0085] This specification is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0086] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0087] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0088] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0089] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (FlashRAM). Memory is an example of computer-readable media.
[0090] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0091] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0092] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, A and B simultaneously, or B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.
[0093] The embodiments of this application can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. The embodiments of this application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can reside in local and remote computer storage media, including storage devices.
[0094] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0095] It should be noted that any AI models, software tools, or components not belonging to this company appearing in the embodiments of this application are merely illustrative examples and do not represent actual use. All user personal information involved in the embodiments of this application has been authorized (with the knowledge and consent) by the relevant parties or has been fully authorized by all parties, and the executing entity may obtain it through various legal and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with relevant laws and regulations and do not violate public order and good morals.
[0096] The above description is merely an embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of this application should be included within the scope of the claims of this application.
Claims
1. A report generation method characterized by, The report generation method includes: Acquire the image to be recognized; The image to be identified is preprocessed to obtain a preprocessed image; The preprocessed image is subjected to field recognition processing to obtain the recognized fields; The identified fields are mapped and matched with a preset knowledge base to obtain the matching fields; Based on a preset structured query language (SQL) template and the matching fields, an SQL statement is generated; and the SQL statement undergoes syntax validation. The SQL statement that passes syntax validation is deployed to a specified location in a preset database to generate intelligent reports.
2. The report generating method of claim 1, wherein, The preprocessing of the image to be identified to obtain a preprocessed image includes: The image to be identified is converted to grayscale to obtain a grayscale image; The grayscale image is subjected to noise reduction processing to obtain a noise-reduced image; The denoised image is binarized to obtain a binarized image; The binarized image is corrected to obtain a corrected image; The corrected image is cropped to obtain the preprocessed image.
3. The report generation method of claim 1, wherein, The process of performing field recognition processing on the preprocessed image to obtain the recognized fields includes: The preprocessed image is subjected to optical character recognition processing to obtain the character recognition content and the corresponding coordinate position; The preprocessed image is subjected to contour detection processing to obtain the positioning marker region; The coordinate information of the positioning mark area is matched with the coordinate position of the character recognition content to obtain the matching confidence score; If the matching confidence level is greater than a preset confidence level threshold, the character recognition content corresponding to the coordinate position is used as the recognition field.
4. The report generation method according to claim 1, characterized in that, The step of mapping and matching the identified fields with a preset knowledge base to obtain matching fields includes: When there is only one identification field, the identification field is precisely matched with the knowledge base field in the knowledge base; If a precise match is successful, the corresponding identification field will be used as the matching field; If an exact match fails, a preset semantic similarity algorithm is used to calculate the similarity between the identified field and the knowledge base fields in the knowledge base. If the similarity is greater than a preset similarity threshold, the corresponding identification field is used as the matching field.
5. The report generation method of claim 1, wherein, The step of mapping and matching the identified fields with a preset knowledge base to obtain matching fields includes: When there are multiple identification fields, the multiple identification fields are matched with the knowledge base fields in the knowledge base to obtain the matching verification result; If the matching verification result is greater than the preset matching confidence threshold, the corresponding multiple identification fields are used as the matching fields.
6. The report generating method of claim 1, wherein, The process of generating SQL statements based on a preset structured query language (SQL) template and the matching fields includes: The matching fields are filled into a preset SQL template to obtain an initial SQL template; The initial SQL template is supplemented according to preset automatic supplementation conditions to obtain the SQL statement.
7. The report generating method of claim 1, wherein, The syntax validation process for the SQL statement includes: Perform syntax correctness verification on the SQL statement; Perform field validity validation on the SQL statement; Perform permission range validation on the SQL statement.
8. A report generating apparatus characterized by comprising: The report generation device includes: The acquisition unit is used to acquire the image to be recognized; The preprocessing unit is used to preprocess the image to be identified to obtain a preprocessed image; The recognition unit is used to perform field recognition processing on the preprocessed image to obtain the recognition fields; The matching unit is used to perform mapping and matching processing between the identified field and a preset knowledge base to obtain the matching field; The execution unit is used to generate an SQL statement based on a preset structured query language (SQL) template and the matching field; and to perform syntax validation on the SQL statement. The building unit is used to deploy the SQL statement that has passed syntax validation to a preset database location to generate intelligent reports.
9. An electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, it implements the report generation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing computer-executable instructions, the computer-executable instructions comprising: The computer-executable instructions are used to execute the report generation method according to any one of claims 1 to 7.