Report generation method and device based on suffix stack technology
Through the report generation method based on suffix stack technology, the indicator placeholders and calculation formulas in the report template are identified and configured, and the complex and lengthy modification of the report template in the existing technology is solved, and the flexibly configure indicators and simplify modification operations are realized, which improves the user experience.
Patent Information
- Application Number
- CN201910992241.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-18
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2039-10-18
AI Technical Summary
In the prior art, the modification of the report template is complex and lengthy, which makes it difficult for users to use and it is difficult to meet user needs.
The report generation method based on suffix stack technology is adopted. By identifying the indicator placeholders in the source report template, the second indicator is configured according to the indicator placeholders, the third indicator of the target report template and the corresponding first calculation formula are obtained, and the source report template is edited based on these indicators and calculation formulas to generate a target report.
It realizes flexible configuration of indicators, simplifies the modification of report templates, improves user experience, and solves the complex and lengthy modification problems in traditional report generation technology.
Smart Images

Figure CN110852053B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a report generation method and device based on suffix stack technology. Background Art
[0002] Nowadays, reports are widely used. For example, according to the superior's deployment or work plan, after completing each task, you generally need to write a report to your superior, reflecting the basic situation of the work, the lessons learned from the work, the existing problems, and the future work plan, etc., in order to obtain guidance from the superior leadership department. However, in today's highly information-based office environment, there is no relatively complete report automatic generation system that can help users automatically collect data and generate corresponding reports.
[0003] In traditional report generation technology, users need to face fixed report styles or modify complex, lengthy, and poorly readable report templates. It is not flexible for users to use and can easily cause a poor user experience. At the same time, since some indicator calibers (such as the caliber of year-end reporting indicators) may change, there is often a need to adjust the calculation caliber. Traditional report generation technology cannot meet user needs, resulting in traditional data batch calculations that are difficult to maintain, long personalized development cycles, and user experience is also affected.
[0004] With respect to the above-mentioned problems existing in the prior art, no effective solution has been found so far. Summary of the invention
[0005] The embodiment of the present invention provides a report generation method and device based on suffix stack technology, so as to at least solve the technical problems in the prior art that the modification of existing report templates is complicated and lengthy, causing inconvenience to users and difficulty in meeting user needs.
[0006] According to one embodiment of the present invention, a report generation method based on suffix stack technology is provided, including: identifying an indicator placeholder for a first indicator in a source report template, wherein the first indicator is a basic indicator in the source report template; configuring a second indicator according to the indicator placeholder to obtain a third indicator of a target report template and a first calculation formula corresponding to the third indicator, wherein the second indicator is a basic indicator in the target report template; editing the source report template according to the third indicator and the first calculation formula to generate the target report.
[0007] Optionally, the second indicator is configured according to the indicator placeholder to obtain a third indicator of the target report template and a first calculation formula corresponding to the third indicator, including: combining the first indicator element and the second indicator element to obtain a composite indicator; and / or determining the third indicator element as a single indicator, wherein the third indicator includes the composite indicator and the single indicator, and the second indicator is a set including the first indicator element, the second indicator element, and the third indicator element; configuring the first calculation formula of the third indicator according to the second indicator.
[0008] Optionally, after configuring the first calculation formula of the third indicator according to the second indicator, the method also includes: determining whether the first calculation formula of the third indicator has been configured; if the first calculation formula has been configured, determining whether the first calculation formula needs to be modified; if modification is required, modifying the first calculation formula; if the first calculation formula is not configured, configuring the first calculation formula.
[0009] Optionally, the source report template is edited according to the third indicator and the first calculation formula to generate the target report, including: updating the source report template according to the first calculation formula to generate a target report template; parsing the first calculation formula using a suffix stack, and calculating the indicator data of the third indicator in the target report template according to the first calculation formula; writing the calculated indicator data into the target report template through a dox4j document or docx4j document writing interface to generate the target report.
[0010] Optionally, updating the source report template according to the first calculation formula to generate a target report template includes at least one of the following: modifying the layout of the source report template according to the first calculation formula to obtain the target report template; modifying the content of the source report template according to the first calculation formula to obtain the target report template.
[0011] Optionally, the layout of the source report template is modified according to the first calculation formula to obtain the target report template, which includes at least one of the following: modifying the layout of the source report template by deleting or adding the third indicator; modifying the layout of the source report template by adjusting the position of the third indicator.
[0012] Optionally, a suffix stack is used to parse the first calculation formula, including: defining an empty suffix stack and a current index position, converting the first calculation formula into a char character array; traversing the character array from an initial value to determine whether the current character length is less than the array length of the character array; when the current character length is less than the array length of the character array, if a non-operator is traversed, the count value is increased by 1, and if an operator is traversed and the count value is greater than 0, the count characters behind the current index position are pushed into the empty suffix stack; when the current character length is greater than or equal to the array length of the character array, when the last character traversed to the character array is not a preset character, the last character is added to the suffix stack, and the remaining elements in the operator stack are added to the suffix stack.
[0013] According to one embodiment of the present invention, a report generation device based on suffix stack technology is provided, including: an identification module, used to identify an indicator placeholder of a first indicator in a source report template, wherein the first indicator is a basic indicator in the source report template; a configuration module, used to configure a second indicator according to the indicator placeholder to obtain a third indicator of a target report template and a first calculation formula corresponding to the third indicator, wherein the second indicator is a basic indicator in the target report template; a generation module, used to edit the source report template according to the third indicator and the first calculation formula to generate the target report.
[0014] Optionally, the configuration module includes: a combination unit, used to combine the first indicator element and the second indicator element to obtain a composite indicator; and / or, a determination unit, used to determine the third indicator element as a single indicator, wherein the third indicator includes the composite indicator and the single indicator, and the second indicator is a set including the first indicator element, the second indicator element, and the third indicator element; a first configuration unit, used to configure the first calculation formula of the third indicator according to the second indicator.
[0015] Optionally, the configuration module also includes: a first judgment unit, used to judge whether the first calculation formula of the third indicator has been configured after the first configuration unit configures the first calculation formula of the third indicator according to the second indicator; a second judgment unit, used to judge whether the first calculation formula needs to be modified if the first calculation formula has been configured; if modification is required, modify the first calculation formula; and a second configuration unit, used to configure the first calculation formula if the first calculation formula is not configured.
[0016] Optionally, the generation module includes: a generation unit, used to update the source report template according to the first calculation formula to generate a target report template; a parsing unit, used to parse the first calculation formula using a suffix stack, and calculate the indicator data of the third indicator in the target report template according to the first calculation formula; a writing unit, used to write the calculated indicator data into the target report template through a dox4j document or docx4j document writing interface to generate the target report.
[0017] Optionally, the generation unit includes at least one of the following: a first modification subunit, used to modify the layout of the source report template according to the first calculation formula to obtain the target report template; a second modification subunit, used to modify the content of the source report template according to the first calculation formula to obtain the target report template.
[0018] Optionally, the first modification subunit includes at least one of the following: modifying the layout of the source report template by deleting or adding the third indicator; modifying the layout of the source report template by adjusting the position of the third indicator.
[0019] Optionally, the parsing unit includes: defining an empty suffix stack and a current index position, converting the first calculation formula into a char character array; traversing the character array from an initial value to determine whether the current character length is less than the array length of the character array; when the current character length is less than the array length of the character array, if a non-operator is traversed, the count value is increased by 1, and if an operator is traversed and the count value is greater than 0, the count characters behind the current index position are pushed into the empty suffix stack; when the current character length is greater than or equal to the array length of the character array, when the last character traversed in the character array is not a preset character, the last character is added to the suffix stack, and the remaining elements in the operator stack are added to the suffix stack.
[0020] According to yet another embodiment of the present invention, a storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned device embodiments when running.
[0021] According to another embodiment of the present invention, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0022] Through the present invention, the indicator placeholder of the first indicator in the source report template is identified, and the second indicator is configured according to the indicator placeholder to obtain the third indicator and the first calculation formula corresponding to the third indicator, thereby achieving the purpose of flexible configuration of indicators, and editing the source report template according to the third indicator and the first calculation formula to generate the target report, so that the operation of modifying the source report template is simple and convenient for users to use, thereby solving the technical problems in the prior art of modifying the existing report template that are complicated and lengthy, causing inconvenience to users and difficulty in meeting user needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0024] Figure 1 It is a hardware structure block diagram of a report generation method based on suffix stack technology according to an embodiment of the present invention applied to a computer terminal;
[0025] Figure 2 is a flow chart of a report generation method based on suffix stack technology according to an embodiment of the present invention;
[0026] Figure 3 This is a system workflow diagram for automatic report generation provided according to a specific embodiment of the present invention;
[0027] Figure 4 It is an algorithm flow chart of a suffix stack parsing calculation formula provided according to a specific embodiment of the present invention;
[0028] Figure 5 It is a structural block diagram of a report generating device based on suffix stack technology according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0031] Example 1
[0032] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a server, a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1FIG. 1 is a hardware structure diagram of a report generation method based on suffix stack technology applied to a computer terminal according to an embodiment of the present invention. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0033] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the report generation method based on the suffix stack technology in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0034] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0035] In this embodiment, a report generation method based on suffix stack technology is provided. Figure 2 is a flow chart of a report generation method based on suffix stack technology according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0036] Step S202, identifying an indicator placeholder of a first indicator in a source report template, wherein the first indicator is a basic indicator in the source report template;
[0037] Optionally, regular expressions are used to identify indicator placeholders in the report template. In this embodiment, after selecting a source report template, the indicator value position needs to be displayed, that is, the indicator code of the agreed rule is used to occupy the placeholder, and the indicator placeholders of each indicator value displayed in the source report template are parsed by regular expressions.
[0038] Step S204, configuring the second indicator according to the indicator placeholder to obtain a third indicator of the target report template and a first calculation formula corresponding to the third indicator, wherein the second indicator is a basic indicator in the target report template;
[0039] Optionally, according to the requirement information in the target report template, or according to the user's operating instructions, the second indicator is configured to obtain a third indicator (including the indicator name and the calculation formula corresponding to the indicator), and set it in the indicator placeholder position. The third indicator is obtained by modifying, combining, or editing several second indicators. For example, the second indicator includes indicator 1 and indicator 2, and the third indicator (indicator A) is the sum of indicator 1 and indicator 2. The calculation formula is: sum = indicator 1 + indicator 2. The calculation formula will be hidden in the indicator placeholder position of the third indicator.
[0040] In this embodiment, the user uses a template editing tool (for example, based on pageOffice to implement the template online editing function, or other online editing tools can be used) to modify the source report template to obtain the target report template. The user can also edit the source report template offline and upload the modified target report template through the system's "template upload" function.
[0041] Step S206, editing the source report template according to the third indicator and the first calculation formula to generate a target report.
[0042] Through the above steps, the indicator placeholder of the first indicator in the source report template is identified, and the second indicator is configured according to the indicator placeholder to obtain the third indicator and the first calculation formula corresponding to the third indicator, thereby achieving the purpose of flexible configuration of indicators, and editing the source report template according to the third indicator and the first calculation formula to generate a target report, so that the operation of modifying the source report template is simple and convenient for users to use, which solves the technical problem of inflexible modification of report templates in the prior art and can automatically and quickly modify complex and lengthy report templates.
[0043] In an optional embodiment, the second indicator is configured according to the indicator placeholder to obtain a third indicator of the target report template and a first calculation formula corresponding to the third indicator, including: combining the first indicator element and the second indicator element in the indicator placeholder to obtain a composite indicator; and / or determining the third indicator element as a single indicator, wherein the third indicator includes a composite indicator and a single indicator, and the second indicator is a set including the first indicator element, the second indicator element, and the third indicator element; configuring the first calculation formula of the third indicator in the indicator placeholder according to the second indicator.
[0044] In this embodiment, the meaning of the composite indicator can be the addition or subtraction of the first indicator element and the second indicator element, for example, month-on-month = current month indicator - last month indicator, and the month-on-month is used as the third indicator; the single indicator can be selecting one of the two indicator elements according to preset conditions, for example, the current month indicator and the last month indicator, and the current month indicator is selected from the two indicators and the current month indicator is used as the third indicator.
[0045] Optionally, after configuring the first calculation formula of the third indicator according to the second indicator, it also includes: determining whether the first calculation formula of the third indicator has been configured; if the first calculation formula has been configured, determining whether the first calculation formula needs to be modified; if modification is required, modifying the first calculation formula; if the first calculation formula is not configured, configuring the first calculation formula.
[0046] According to the above embodiment, the calculation formula of the composite indicator is also configured while configuring the composite indicator. The indicator configuration function automatically identifies the indicator code (i.e., the above indicator placeholder) of the indicator (i.e., the above indicator) in the source report template, and reminds the user to configure the composite indicator (i.e., the above third indicator) and the calculation formula of the composite indicator (i.e., the above first calculation formula): The indicator configuration function provides existing preset indicators (i.e., the above second indicator) for users to freely combine, that is, select the existing second indicator on the indicator configuration page for combination to obtain the composite indicator (i.e., the above third indicator). After the configuration is completed, the calculation formula of the composite indicator is saved in the background for secondary modification, wherein the calculation formula of the composite indicator needs to be calculated according to the calculation formula of the first indicator, that is, the new business indicator data.
[0047] In this embodiment, it is determined whether the calculation formula of the composite index needs to be modified. If so, a new calculation formula of the composite index is reconfigured. If not, the calculation formula of the first index before the combination is used.
[0048] Optionally, the source report template is edited according to the third indicator and the first calculation formula to generate a target report, including: updating the source report template according to the first calculation formula to generate a target report template; parsing the first calculation formula using a suffix stack, and calculating the indicator data of the third indicator in the target report template according to the first calculation formula; writing the calculated indicator data into the target report template through a dox4j document or docx4j document writing interface to generate a target report.
[0049] In this embodiment, after the user selects an existing second indicator to combine on the indicator configuration page to obtain the calculation formula for the third indicator, the report generation function can be used. The generated target report template supports re-running, that is, when the indicator formula configuration is incorrect or the basic data is re-counted, the user can click "Regenerate" on the relevant page of the system to regenerate the report; finally, use dox4j document or docx4j document writing technology to embed the calculated business indicator data or charts into the report, thereby generating a target report.
[0050] Figure 3 is a system workflow diagram for automatically generating reports according to a specific embodiment of the present invention. Figure 3 As shown,
[0051] 1) Generate or import basic indicators (i.e. the second indicator mentioned above);
[0052] By using the system's indicator import function to obtain indicator data from the outside or calculated in advance by the system background task (for example, month-on-month = current month's indicator - previous month's indicator, current month's indicator and previous month's indicator are both basic indicators, which can be calculated by the system or imported by the user), among which industry indicators calculated by the system are used (such as: total medical expenses, medical insurance expenses, reimbursement expenses, etc.).
[0053] 2), PageOffice online editing template;
[0054] Select a template sample (i.e. the source report template mentioned above) from the preset report template set, and the user uses the template online editing function based on pageOffice to modify the source report template; if the descriptive text in the generated report module does not need to be adjusted, it is the final report file (i.e. the target report template mentioned above).
[0055] 3), identification indicators;
[0056] The indicator placeholders of each indicator value displayed in the source report template are parsed through regular expressions.
[0057] 4) Determine whether to configure the calculation formula;
[0058] Determine whether the calculation formula of the configured third indicator is configured. If it is configured, continue to determine whether the calculation formula needs to be modified. If it needs to be modified, modify it according to the calculation formula of the second indicator, that is, reconfigure the calculation formula of the third indicator, and calculate the indicator data of the third indicator according to the final configured calculation formula; if it does not need to be modified, calculate the indicator data of the third indicator;
[0059] If it is not configured, then configure the calculation formula of the third indicator, and calculate the indicator data of the third indicator according to the configured calculation formula.
[0060] 5), docx4j report generation;
[0061] Finally, dox4j document writing technology is used to embed the calculated business indicator data and charts into the report. The chart (Echar) and indicator placeholders are the same. When the graphics are inserted into the report template, the system can generate corresponding bookmarks to the report template, and read the data for display when the report is generated.
[0062] In an optional embodiment, updating the source report template according to the first calculation formula to generate the target report template includes at least one of the following: modifying the layout of the source report template according to the first calculation formula to obtain the target report template; modifying the content of the source report template according to the first calculation formula to obtain the target report template. In this embodiment, after selecting a source report template, the target report template is generated according to user needs by modifying the layout and content of the source report template.
[0063] According to the above implementation, the layout of the source report template is modified according to the first calculation formula to obtain the target report template, which includes at least one of the following: modifying the layout of the source report template by deleting or adding a third indicator; modifying the layout of the source report template by adjusting the position of the third indicator.
[0064] Optionally, a suffix stack is used to parse the first calculation formula, including: defining an empty suffix stack and a current index position, converting the first calculation formula into a char character array; traversing the character array from an initial value to determine whether the current character length is less than the array length of the character array; when the current character length is less than the array length of the character array, if a non-operator is traversed, the count value is increased by 1, and if an operator is traversed and the count value is greater than 0, the count characters behind the current index position are pushed into the empty suffix stack; when the current character length is greater than or equal to the array length of the character array, if the last character traversed in the character array is not a preset character, the last character is added to the suffix stack, and the remaining elements in the operator stack are added to the suffix stack.
[0065] In one embodiment, Figure 4is an algorithm flow chart of a suffix stack parsing calculation formula provided according to a specific embodiment of the present invention, such as Figure 4 As shown in the figure, after determining the final calculation formula of the third indicator, the background uses the suffix stack technology to parse the calculation formula, automatically calculate the indicator, and put it into the calculation result table. Among them, the suffix stack used in the indicator calculation process is the key to the formula calculation, which mainly includes the following logical aspects:
[0066] (1) Define an empty postfix stack (postfixStack) and an empty operator stack (opStack), put the stack element "," in it, the current index position (currentIndex), the length of the characters from the last arithmetic operator to the current arithmetic operator (arr.length) or the value count between them, define the current operator (currentOp), and the top operator (peekOp);
[0067] (2) Convert the calculation formula of the composite index (i.e., the third index) into a char character array;
[0068] (3) Traverse the char array, assuming that the initial value i=0, and traverse the char array from the initial value: determine whether the current character length i is less than the array length arr.length of the char array. If the current character length i is less than the array length of the char array, when the non-operator count value is traversed, add 1, and the current index position currentIndex is not updated; if the operator is traversed and the count value count is greater than 0, push the count characters behind the current index position currentIndex into the empty postfix stack postfixStack, and then take out the top element of the operator stack peekOp to determine. If the right bracket ")" is traversed, remove the elements in the operator stack to the postfix stack until the left bracket is traversed, otherwise peekOp is pushed into the postfix stack postfixStack, and currentOp is pushed into opStack;
[0069] (4) When the current character length i is greater than or equal to the array length of the char character array, when the last character in the char character array is not a bracket or other operator, the last character is added to the postfix stack postfixStack, and the remaining elements in the operator stack are added to the postfix stack postfixStack.
[0070] Through the above embodiments, formula parsing is realized based on the suffix expression stack, so that the indicator caliber is flexibly configured by real users and no longer relies on professional technicians; the good readability of the report template during the configuration process and the report template with highly consistent final style improve the ease of use and user experience. The above two features will also greatly reduce the cost of later maintenance and personalization. It has a large application in the reporting platform, which can help enterprises improve service quality and customer satisfaction.
[0071] Example 2
[0072] In this embodiment, a report generation device based on suffix stack technology is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0073] Figure 5 It is a structural block diagram of a report generating device according to an embodiment of the present invention, which provides a report generating device based on suffix stack technology, including: an identification module 502, used to identify the indicator placeholder of the first indicator in the source report template, wherein the first indicator is the basic indicator in the source report template; a configuration module 504, connected to the above-mentioned identification module 502, used to configure the second indicator according to the indicator placeholder, and obtain the third indicator of the target report template and the first calculation formula corresponding to the third indicator, wherein the second indicator is the basic indicator in the target report template; a generation module 506, connected to the above-mentioned configuration module 504, used to edit the source report template according to the third indicator and the first calculation formula to generate a target report.
[0074] Optionally, the configuration module 504 includes: a combination unit, used to combine the first indicator element and the second indicator element to obtain a composite indicator; and / or, a determination unit, used to determine the third indicator element as a single indicator, wherein the third indicator includes a composite indicator and a single indicator, and the second indicator is a set including the first indicator element, the second indicator element, and the third indicator element; a first configuration unit, used to configure a first calculation formula for the third indicator based on the second indicator.
[0075] Optionally, the configuration module 504 also includes: a first judgment unit, used to determine whether the first calculation formula of the third indicator has been configured after the first configuration unit configures the first calculation formula of the third indicator according to the second indicator; a second judgment unit, used to determine whether the first calculation formula needs to be modified if it has been configured; if modification is required, modify the first calculation formula; and a second configuration unit, used to configure the first calculation formula if it has not been configured.
[0076] Optionally, the generation module 506 includes: a generation unit, used to update the source report template according to the first calculation formula to generate a target report template; a parsing unit, used to parse the first calculation formula using a suffix stack, and calculate the indicator data of the third indicator in the target report template according to the first calculation formula; a writing unit, used to write the calculated indicator data into the target report template through a dox4j document or docx4j document writing interface to generate a target report.
[0077] Optionally, the generation unit includes at least one of the following: a first modification subunit, used to modify the layout of the source report template according to the first calculation formula to obtain the target report template; a second modification subunit, used to modify the content of the source report template according to the first calculation formula to obtain the target report template.
[0078] Optionally, the first modification subunit includes at least one of the following: modifying the layout of the source report template by deleting or adding a third indicator; modifying the layout of the source report template by adjusting the position of the third indicator.
[0079] Optionally, the parsing unit includes: defining an empty suffix stack and a current index position, converting the first calculation formula into a char character array; traversing the character array from an initial value to determine whether the current character length is less than the array length of the character array; when the current character length is less than the array length of the character array, if a non-operator is traversed, the count value is increased by 1, and if an operator is traversed and the count value is greater than 0, the count characters behind the current index position are pushed into the empty suffix stack; when the current character length is greater than or equal to the array length of the character array, when the last character traversed in the character array is not a preset character, the last character is added to the suffix stack, and the remaining elements in the operator stack are added to the suffix stack.
[0080] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0081] Example 3
[0082] An embodiment of the present invention further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0083] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0084] S1, identifying an indicator placeholder of a first indicator in a source report template, wherein the first indicator is a basic indicator in the source report template;
[0085] S2, configuring the second indicator according to the indicator placeholder to obtain a third indicator of the target report template and a first calculation formula corresponding to the third indicator, wherein the second indicator is a basic indicator in the target report template;
[0086] S3: Edit the source report template according to the third indicator and the first calculation formula to generate the target report.
[0087] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0088] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0089] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0090] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0091] S1, identifying an indicator placeholder of a first indicator in a source report template, wherein the first indicator is a basic indicator in the source report template;
[0092] S2, configuring the second indicator according to the indicator placeholder to obtain a third indicator of the target report template and a first calculation formula corresponding to the third indicator, wherein the second indicator is a basic indicator in the target report template;
[0093] S3: Edit the source report template according to the third indicator and the first calculation formula to generate the target report.
[0094] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0095] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0096] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A report generation method based on suffix stack technology, characterized in that: include: Using a regular expression to identify an indicator placeholder of a first indicator in a source report template, wherein the first indicator is a basic indicator in the source report template, that is, the first indicator is each indicator value displayed in the source report template; The second indicator is configured according to the indicator placeholder to obtain a third indicator of the target report template and a first calculation formula corresponding to the third indicator, wherein the second indicator is a basic indicator in the target report template, that is, the second indicator is each indicator value displayed in the target report template; the third indicator is an indicator obtained by modifying, combining, or editing a plurality of the second indicators, and the first calculation formula corresponding to the third indicator is a calculation formula for the third indicator obtained by modifying, combining, or editing a plurality of the second indicators; Editing the source report template according to the third indicator and the first calculation formula to generate the target report specifically includes: updating the source report template according to the first calculation formula to generate the target report template; parsing the first calculation formula using a suffix stack, and calculating the indicator data of the third indicator in the target report template according to the first calculation formula; writing the calculated indicator data into the target report template through a dox4j document or a docx4j document writing interface to generate the target report; Among them, the use of a suffix stack to parse the first calculation formula includes: defining an empty suffix stack and a current index position, converting the first calculation formula into a char character array; traversing the character array from an initial value to determine whether the current character length is less than the array length of the character array; when the current character length is less than the array length of the character array, if a non-operator is traversed, the count value is increased by 1, and if an operator is traversed and the count value is greater than 0, the count characters behind the current index position are pushed into the empty suffix stack; when the current character length is greater than or equal to the array length of the character array, when the last character in the traversed character array is not a preset character, the last character is added to the suffix stack, and the remaining elements in the operator stack are added to the suffix stack.
2. The method according to claim 1, characterized in that The second indicator is configured according to the indicator placeholder to obtain a third indicator of the target report template and a first calculation formula corresponding to the third indicator, including: Combining the first indicator element and the second indicator element in the indicator placeholder to obtain a composite indicator; and / or determining the third indicator element as a single indicator, wherein the third indicator includes the composite indicator and the single indicator, and the second indicator is a set including the first indicator element, the second indicator element, and the third indicator element; A first calculation formula for the third indicator is configured in the indicator placeholder according to the second indicator.
3. The method according to claim 2, characterized in that After configuring the first calculation formula of the third indicator according to the second indicator, the method further includes: Determining whether a first calculation formula for the third indicator has been configured; If the first calculation formula has been configured, determine whether the first calculation formula needs to be modified; if modification is required, modify the first calculation formula; if the first calculation formula is not configured, configure the first calculation formula.
4. The method according to claim 1, characterized in that: Updating the source report template according to the first calculation formula to generate a target report template includes at least one of the following: Modifying the layout of the source report template according to the first calculation formula to obtain the target report template; The content of the source report template is modified according to the first calculation formula to obtain the target report template.
5. The method according to claim 4, characterized in that Modifying the layout of the source report template according to the first calculation formula to obtain the target report template includes at least one of the following: Modifying the layout of the source report template by deleting or adding the third indicator; The layout of the source report template is modified by adjusting the position of the third indicator.
6. A report generation device based on suffix stack technology, characterized in that: include: an identification module, configured to identify an indicator placeholder of a first indicator in a source report template using a regular expression, wherein the first indicator is a basic indicator in the source report template, that is, the first indicator is each indicator value displayed in the source report template; a configuration module, configured to configure the second indicator according to the indicator placeholder, to obtain a third indicator of the target report template and a first calculation formula corresponding to the third indicator, wherein the second indicator is a basic indicator in the target report template, that is, the second indicator is each indicator value displayed in the target report template; the third indicator is an indicator obtained by modifying, combining, or editing a plurality of the second indicators, and the first calculation formula corresponding to the third indicator is a calculation formula for the third indicator obtained by modifying, combining, or editing a plurality of the second indicators; A generation module is used to edit the source report template according to the third indicator and the first calculation formula to generate the target report, specifically comprising: updating the source report template according to the first calculation formula to generate a target report template; parsing the first calculation formula using a suffix stack, and calculating the indicator data of the third indicator in the target report template according to the first calculation formula; writing the calculated indicator data into the target report template through a dox4j document or a docx4j document writing interface to generate the target report; Among them, the use of a suffix stack to parse the first calculation formula includes: defining an empty suffix stack and a current index position, converting the first calculation formula into a char character array; traversing the character array from an initial value to determine whether the current character length is less than the array length of the character array; when the current character length is less than the array length of the character array, if a non-operator is traversed, the count value is increased by 1, and if an operator is traversed and the count value is greater than 0, the count characters behind the current index position are pushed into the empty suffix stack; when the current character length is greater than or equal to the array length of the character array, when the last character in the traversed character array is not a preset character, the last character is added to the suffix stack, and the remaining elements in the operator stack are added to the suffix stack.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Computing framework for compliance report generation
US20180374047A1
Method and apparatus for pattern discovery in 1-dimensional event streams
US6108666A