Report display method and report display device based on docx format
By receiving personalized requirements on the front end and inserting rendering tags to process data on the back end, an adaptive target template is generated, which solves the high error rate problem caused by manual code modification in the existing technology and realizes automated report generation and efficient personalized customization.
Patent Information
- Application Number
- CN202511226282.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-29
- Publication Date
- 2025-09-30
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing technology, personalized report customization through python-docx requires manual code modification, resulting in a high error rate and difficulty in performing personalized customization on a general template.
By receiving the personalized needs and annotation data of medical institutions at the front end, inserting rendering tags and processing data at the back end, an adaptive target template is generated, and automated template modification is achieved, avoiding manual code development.
It realizes the automatic generation of reports according to customer needs, reduces the error rate, improves the efficiency and flexibility of report generation, and adapts to the personalized needs of different medical institutions.
Smart Images

Figure CN120724970A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a report display method, a report display device, a computer-readable storage medium, and a business system based on the docx format. Background Art
[0002] With the rapid development of artificial intelligence (AI) technology, a variety of AI applications have emerged in the healthcare ecosystem, such as automated medical text generation. Traditional automated medical text generation technology primarily relies on deep learning methods, using machine learning training on domain-specific text corpora. This technology places very strict demands on the quality of generated medical text. For example, the generated text must be logical and readable, professional, accurate, and objective. Furthermore, the text format must be customized according to different application scenarios, and the text must have varying levels of customization capabilities.
[0003] Medical test reports with varying requirements are precisely the challenge in the field of automatic medical text generation. Since different variant sites in the test report have different display logic in the report, it is difficult to batch process customized requirements of different customers. Python-docx is required to open, create, and update Word documents. The usual practice is to read variant site information from the gene site annotation file (*anno.xlsx), then fill in and render the data based on a customized docx template, and then save it as a local .docx file.
[0004] That is, in the existing technology, templates need to be developed separately for personalized customization needs such as table merging and font setting in tables, and further updates cannot be made on the general templates. Template development relies on manual labor and has a high error rate. Summary of the Invention
[0005] The main purpose of this application is to provide a report display method, report display device, computer-readable storage medium and business system based on the docx format, so as to at least solve the problem in the prior art that personalized report customization through python-docx requires manual code modification, resulting in a high error rate.
[0006] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a report display method based on the docx format is provided, including: controlling the front end to receive the personalized needs, annotation data and preset document template of the medical institution, the personalized needs are used to define the data processing method, display format and display method of the annotation data filling in the preset document template, and the annotation data includes the patient's test results and the explanatory information of the test results; controlling the front end to store the preset document template and annotation data to the back end according to the preset path; when the back end monitors the presence of a write operation under the preset path, controlling the back end to obtain the customer's personalized needs from the front end, inserting a rendering tag into the preset document template according to the personalized needs to obtain a target template, the rendering tag is used to define the data variable name, data processing method, display method and display format of the insertion position; controlling the back end to fill the corresponding annotation data into the corresponding insertion position according to the data variable name of the rendering tag in the target template and processing it according to the corresponding data processing method, display method and display format to obtain a test result report; controlling the back end to send the test result report to the front end to visualize the test result report.
[0007] Optionally, according to personalized needs, a rendering tag is inserted into the preset document template to obtain a target template. The method also includes: parsing the personalized needs to extract template layout information, data display logic, speech configuration, personalized annotations and additional information. The personalized annotations are used to explain the preset nouns in the detection results. The additional information includes literature citation information; inserting a style tag corresponding to the template layout information into the preset document template to obtain a first alternative template, and the value of the style tag is used to limit the style of the data at the insertion position; inserting a conditional judgment tag, a loop tag and a declarative tag corresponding to the data display logic into the first alternative template to obtain a second alternative template. In the example, the conditional judgment tag is used to determine whether the conclusion data is displayed based on the conditional data at the insertion position, the loop tag is used to traverse the data at the insertion position, and the declarative tag is used to limit the operation and assignment at the insertion position; the filter tag corresponding to the speech configuration is inserted into the second alternative template to obtain the third alternative template, and the filter tag is used to limit the filter engine called at the insertion position, and different filter engines correspond to different language styles; the data rendering tag corresponding to the personalized comment is inserted into the third alternative template and the data rendering tag corresponding to the additional information is inserted into the third alternative template to obtain the target template, and the data rendering tag is used to convert the variable at the insertion position into the actual value.
[0008] Optionally, the control backend fills the corresponding annotation data into the corresponding insertion position according to the data variable name of the rendering tag in the target template and processes it according to the corresponding data processing method, display method and display format to obtain a detection result report, including: the control backend fills the corresponding annotation data into the corresponding insertion position according to the conditional judgment tag, loop tag, declarative tag and data rendering tag in the target template; the control backend modifies the style of the annotation data at the insertion position according to the style tag in the target template; the control backend queries the preset engine in the preset engine library according to the filter tag to obtain the target filter engine; the control backend processes the annotation data at the corresponding insertion position through the target filter engine to obtain a detection result report.
[0009] Optionally, before the control backend queries the preset engine in the preset engine library according to the filter tag to obtain the target filter engine, the method includes: the control backend constructs a filter engine according to the conditional statements and functions of different filtering levels to obtain multiple alternative engines, and the filtering level is used to characterize the similarity between the data output by the filter engine and the speech configuration; the control backend adjusts the conditional statements and functions of the alternative engine according to the data display logic to obtain the preset engine, and stores the preset engine in the preset engine library.
[0010] Optionally, the control backend fills the corresponding annotation data into the corresponding insertion position according to the conditional judgment tag, loop tag, declarative tag and data rendering tag in the target template, including: the control backend performs data cleaning on the annotation data to obtain alternative filling data, converts the alternative filling data into json format, and obtains target filling data; the control backend traverses the target template to identify the conditional judgment tag, loop tag, declarative tag and data rendering tag in the target template; the control backend processes the target filling data based on the conditional judgment tag, loop tag, declarative tag and data rendering tag, and fills the processing result into the filling position corresponding to the rendering tag.
[0011] Optionally, before controlling the backend to obtain the customer's personalized needs from the frontend, the method also includes: creating a scheduled task based on the Django project in the backend Linux server, the scheduled task is used to periodically poll the annotation data under the preset path, and when new annotation data appears, triggering the data processing task, the data processing task is used to control the backend to capture personalized needs from the frontend.
[0012] Optionally, before the control backend sends the test result report to the front end for visual display of the test result report, the method also includes: controlling the backend to compress and encapsulate the test result report in a preset manner to obtain a report to be displayed; controlling the backend to store the report to be displayed according to a preset path, and storing the preset path to the front end.
[0013] According to another aspect of the present application, a report display device based on the docx format is provided, and the device includes: a first control unit, used to control the front end to receive the personalized needs, annotation data and preset document template of the medical institution, the personalized needs are used to define the data processing method, display format and display method of the annotation data filled into the preset document template, and the annotation data includes the patient's test results and explanatory information of the test results; a second control unit, used to control the front end to store the preset document template and annotation data to the back end according to a preset path; a third control unit, used to control the back end to obtain the customer's personalized needs from the front end when the back end monitors that there is a write operation under the preset path, and insert a rendering tag into the preset document template according to the personalized needs to obtain a target template, and the rendering tag is used to define the data variable name, data processing method, display method and display format of the insertion position; a fourth control unit, used to control the back end to fill the corresponding annotation data into the corresponding insertion position according to the data variable name of the rendering tag in the target template and process it according to the corresponding data processing method, display method and display format to obtain a test result report; a fifth control unit, used to control the back end to send the test result report to the front end for visual display of the test result report.
[0014] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the methods.
[0015] According to another aspect of the present application, a business system is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include methods for executing any one of the methods.
[0016] Applying the technical solution of the present application, in the above-mentioned report display method based on the docx format, first, the front end is controlled to receive the personalized needs, annotation data and preset document template of the medical institution. The personalized needs are used to define the data processing method, display format and display method of the annotation data filled into the preset document template. The annotation data includes the patient's test results and the explanatory information of the test results; then, the front end is controlled to store the preset document template and annotation data to the back end according to the preset path; thereafter, when the back end monitors the presence of a write operation under the preset path, the back end is controlled to obtain the customer's personalized needs from the front end, and insert a rendering tag into the preset document template according to the personalized needs to obtain the target template. The rendering tag is used to define the data variable name, data processing method, display method and display format of the insertion position; thereafter, the back end is controlled to fill the corresponding annotation data into the corresponding insertion position according to the data variable name of the rendering tag in the target template and process it according to the corresponding data processing method, display method and display format to obtain the test result report; finally, the back end is controlled to send the test result report to the front end for visual display of the test result report. This application proposes to convert the user's personalized needs into a label language, and then integrate the label language into a universal template to form a target template that is adaptive based on customer needs. The above setting system can automatically modify the template according to customer needs, without the need for manual code development for data processing in the document generation process based on customer needs. This solves the problem in the existing technology of using python-docx to achieve personalized report customization, which requires manual code modification and leads to a high error rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 The following is a hardware structure diagram of a mobile terminal according to a report display method based on the docx format provided in an embodiment of the present application;
[0018] Figure 2 A flowchart of a report display method based on the docx format provided in an embodiment of the present application is shown;
[0019] Figure 3 The figure shows a structural block diagram of a report display device based on the docx format provided according to an embodiment of the present application.
[0020] The above drawings include the following reference numerals:
[0021] 102. Processor; 104. Memory; 106. Transmission device; 108. Input / output device. DETAILED DESCRIPTION
[0022] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0023] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] As introduced in the background technology, in the prior art, templates need to be developed separately for personalized customization needs such as table merging and font settings in tables, and further updates cannot be made on the general templates. Template development relies on manual labor and has a high error rate. In order to solve the problem that personalized report customization is achieved through python-docx in the prior art, manual code modification is required, resulting in a high error rate, the embodiments of the present application provide a report display method, report display device, computer-readable storage medium and business system based on the docx format.
[0026] The technical solutions in the embodiments of the present invention will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present invention.
[0027] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure diagram of a mobile terminal for a report display method based on docx format according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It will 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 mobile terminal. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0028] Memory 104 can be used to store computer programs, such as application software programs and modules, such as the computer program corresponding to the docx format report presentation method in the embodiments of the present invention. Processor 102 executes the computer programs stored in memory 104 to execute various functional applications and data processing, thereby implementing the aforementioned method. Memory 104 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 104 may further include memory remotely located from processor 102, which can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. Transmission device 106 is used to receive or transmit data via a network. Specific examples of such networks may include a wireless network provided by the mobile terminal's telecommunications provider. In one example, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0029] In this embodiment, a report presentation method based on the docx format running on a mobile terminal, a computer terminal or a similar computing device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0030] Figure 2 This is a flow chart of a report display method based on docx format according to an embodiment of the present application. Figure 2 As shown, the method includes the following steps:
[0031] Step S201: The control front end receives personalized requirements, annotation data, and a preset document template from a medical institution. The personalized requirements are used to define the data processing method, display format, and display method for filling the annotation data into the preset document template. The annotation data includes the patient's test results and explanation information for the test results.
[0032] Specifically, the front-end page design allows medical institutions to input personalized requirements for report format, content display, and data processing logic. At the same time, the annotation data uploaded by medical institutions usually includes patient test results and interpretation information of the results, as well as common document templates.
[0033] Step S202: Control the front end to store the preset document template and annotation data to the back end according to the preset path;
[0034] Step S203: When the backend detects a write operation in the preset path, the backend is controlled to obtain the customer's personalized requirements from the frontend, and a rendering tag is inserted into the preset document template according to the personalized requirements to obtain a target template. The rendering tag is used to define the data variable name, data processing method, display method, and display format of the insertion location.
[0035] Specifically, the backend server listens for write operations on a specific path. Once new annotation data and template uploads are detected, the backend server pulls these data and personalized requirements from the frontend.
[0036] Step S204: Control the backend to fill the corresponding annotation data into the corresponding insertion position according to the data variable name of the rendering label in the target template and process it according to the corresponding data processing method, display method and display format to obtain a detection result report;
[0037] Specifically, the backend inserts rendering tags into the preset template based on requirements. These tags define the data variable name, processing method, display format, and display method. The backend then reads the annotation data, fills the data into the template according to the definition of the rendering tags, performs corresponding processing, and generates a detection result report.
[0038] Step S205: Control the backend to send the test result report to the frontend to visualize the test result report.
[0039] Specifically, the generated report is sent back to the front end, and the report is visualized through the web interface, and medical institutions and patients can view and download it online.
[0040] It is understandable that the front end provides the following information through the front end page:
[0041] Personalized requirements: including report style, content layout, display format of specific data (such as font size, color, table style), and display method (such as showing or hiding information based on conditions).
[0042] Annotation data upload: Upload an Excel file containing patient test results and interpretation information.
[0043] Document template upload: Upload a preset .docx template for building the report framework.
[0044] It is understandable that backend processing is mainly divided into two stages:
[0045] Monitoring and Acquisition: Use Linux file system monitoring tools, such as inotify, to monitor pre-set paths. Once a file write is detected, data processing is immediately executed. This process includes obtaining personalized requirements, annotation data, and document templates from the front-end. Use Python's docx-tpl or similar libraries to insert rendering tags into the template as required.
[0046] Data Processing and Report Generation: Use Pandas to read and clean annotation data, ensuring the data format meets the template requirements. Based on the rendering tags, variables from the annotation data are populated into the document template as needed, applying data processing methods. Format the populated data for presentation, adjusting table layout, fonts, and colors to meet personalized needs. Save the generated report and return it to the front-end via email or web interface.
[0047] Through this embodiment, first, the control front end receives the personalized needs, annotation data and preset document template of the medical institution. The personalized needs are used to define the data processing method, display format and display method of the annotation data filled into the preset document template. The annotation data includes the patient's test results and the explanatory information of the test results; then, the control front end stores the preset document template and annotation data to the back end according to the preset path; thereafter, when the back end monitors the presence of a write operation under the preset path, the control back end obtains the customer's personalized needs from the front end, inserts a rendering tag into the preset document template according to the personalized needs, and obtains the target template. The rendering tag is used to define the data variable name, data processing method, display method and display format of the insertion position; thereafter, the control back end fills the corresponding annotation data into the corresponding insertion position according to the data variable name of the rendering tag in the target template and processes it according to the corresponding data processing method, display method and display format to obtain a test result report; finally, the control back end sends the test result report to the front end to visualize the test result report. This application proposes to convert the user's personalized needs into a label language, and then integrate the label language into a universal template to form a target template that is adaptive based on customer needs. The above setting system can automatically modify the template according to customer needs, without the need for manual code development for data processing in the document generation process based on customer needs. This solves the problem in the existing technology of using python-docx to achieve personalized report customization, which requires manual code modification and leads to a high error rate.
[0048] In order to insert the tag language into the general template to form a personalized customized template, in an optional embodiment, the above step S203 includes:
[0049] Step S2031: Parse the personalized requirements to extract template layout information, data display logic, speech configuration, personalized annotations, and additional information. The personalized annotations are used to explain the preset nouns in the detection results. The additional information includes literature citation information.
[0050] Specifically, it parses the personalized demand information submitted by medical institutions through the Web front-end, including template layout information, data display logic, speech configuration, personalized annotations and additional information (such as literature citations).
[0051] In the specific implementation, after the backend Django service receives the requirements, it uses Python's built-in JSON or XML parsing library to parse the requirements and extract the above key elements.
[0052] Step S2032: inserting a style tag corresponding to the template layout information into the preset document template to obtain a first candidate template. The value of the style tag is used to define the style of the data at the insertion position.
[0053] Specifically, the parsed template layout information is obtained. In the pre-set docx document template, style tags are added based on the layout information using the docx-tpl module or other compatible Python libraries. These tags define the specific styles of elements such as text, tables, and images, such as font size, color, and alignment, to ensure visual consistency of the report.
[0054] Step S2033: Insert the conditional judgment tag, loop tag, and declarative tag corresponding to the data display logic into the first candidate template to obtain a second candidate template. The conditional judgment tag is used to determine whether the conclusion data should be displayed based on the conditional data at the insertion position, the loop tag is used to traverse the data at the insertion position, and the declarative tag is used to limit the calculation and assignment of the insertion position.
[0055] Specifically, after parsing the data, the display logic is obtained and conditional tags (such as {% if ... %}), loop tags (such as {% for ... %}), and declarative tags (such as {% set ... %}) are used to dynamically display data in reports. For example, if a test result is outside the normal range, the conditional tag automatically highlights the result. For multiple test indicators, loop tags can ensure that each indicator is displayed correctly.
[0056] Step S2034: insert the filter tag corresponding to the speech configuration into the second candidate template to obtain a third candidate template. The filter tag is used to limit the filter engine called at the insertion position. Different filter engines correspond to different language styles.
[0057] Specifically, the parsed script configuration information is obtained and filter tags are added to the document template. These tags point to specific filter engines, and the report's language style is adjusted as needed, such as by simplifying professional terms and adding patient care statements. This step ensures that the report is not only accurate but also more user-friendly and suitable for different audiences.
[0058] Step S2035 : inserting a data rendering tag corresponding to the personalized annotation into the third candidate template and inserting a data rendering tag corresponding to the additional information into the third candidate template to obtain a target template. The data rendering tag is used to convert the variable at the insertion position into an actual value.
[0059] Specifically, personalized annotations and additional information are obtained after parsing. Explanations of specific test terms are added to the template through data rendering tags (such as {{variable_name}}) to increase report readability. Similarly, additional content such as literature citations can be embedded in a similar manner to enhance the report's professionalism and reference value.
[0060] Through the above-described embodiments, automated processing significantly reduces the time required for manual tabulation and report filling, improving report generation efficiency. The application of dynamic data filling and conditional logic ensures the accuracy of report content and avoids errors that may be caused by manual operation. The dynamic configuration capability of pre-set document templates enables the system to quickly adapt to the diverse needs of different medical institutions, reducing maintenance costs and improving system flexibility and scalability.
[0061] In order to obtain the above-mentioned test result report, in an optional embodiment, the above-mentioned step S204 includes:
[0062] Step S2041, controlling the backend to fill the corresponding annotation data into the corresponding insertion position according to the condition judgment tag, loop tag, declarative tag and data rendering tag in the target template;
[0063] Specifically, the target template (including rendering tags, conditional tags, loop tags, and declarative tags) and the processed annotation data are obtained. The {{data_variable}} tag in the template is read and populated with patient test data from anno.xlsx. Conditional tags {%if condition%} and loop tags {%for item in data%} are used to determine whether to display or how to iterate over the data based on specific attributes of the annotation data. The declarative tag {%setvariable%} is used to define local variables and preprocess data to accommodate complex data display logic.
[0064] Step S2042, controlling the backend to modify the style of the annotation data at the insertion position according to the style tag in the target template;
[0065] Specifically, the style tags and the filled annotation data in the target template are obtained. The style tags are applied to modify the data style at the insertion location to ensure that the visual effects of the report meet the requirements of the medical institution while enhancing the readability and professionalism of the report.
[0066] Step S2043: The control backend searches for a preset engine in the preset engine library according to the filter tag to obtain a target filter engine;
[0067] Specifically, the system retrieves annotation data for the filter tag and insertion location. Based on the filter call in {{variable | filter}}, the system queries the preset engine library to find the corresponding wording configuration, language style, or data formatting engine, such as the "Professional Terminology Simplification Filter" or the "Patient Care Statement Addition Engine."
[0068] Step S2044: The control backend processes the annotation data of the corresponding insertion position through the target filter engine to obtain a detection result report.
[0069] Specifically, the target filter engine is used to process the annotation data at the insertion position, for example, converting professional terms into easy-to-understand explanations, or adjusting the language style according to the preferences of medical institutions to generate test result reports that meet the needs.
[0070] Through the above-described embodiments, medical institutions can freely customize the report layout, data display logic, and language style as needed, significantly improving the level of report personalization. The system accurately applies the medical institution's display rules while processing data through a filter engine to ensure the professionalism and accuracy of reports. Automated processing significantly reduces report generation time and improves work efficiency, which is particularly significant for the rapid generation of large numbers of reports.
[0071] In order to build a personalized engine, in an optional embodiment, before the control backend searches for preset engines in the preset engine library according to the filter tag to obtain the target filter engine, the above method includes:
[0072] Step S301: The control backend constructs a filter engine based on conditional statements and functions of different filter levels to obtain multiple candidate engines. The filter level is used to represent the similarity between the data output by the filter engine and the speech configuration;
[0073] Specifically, by leveraging Python's function definition capabilities and logical conditional statements, combined with specific conditions provided by medical institutions (such as data accuracy, frequency of terminology, and sentiment), multiple alternative filter engines are constructed. These engines use internal algorithms (such as natural language processing technology and machine learning models) to evaluate the similarity between their output data and the medical institution's language configuration, using this as a quantitative standard for filtering levels. Based on the medical institution's preset data presentation logic and language style, the conditional statements and functions in the alternative filter engines are parameterized to optimize their processing performance for specific data types. For example, for reports containing a large amount of professional terminology, filters can be adjusted to add term explanations or replacements to improve report readability. For situations where data comparisons need to be emphasized, conditional statements can be adjusted to optimize data highlighting.
[0074] Step S302 : The control backend adjusts the conditional statements and functions of the candidate engines according to the data display logic to obtain a preset engine, and stores the preset engine in a preset engine library.
[0075] Specifically, the preset engine storage process: the filter engine optimized through the above steps is marked as a preset engine and stored in the preset engine library so that it can be called when generating reports later.
[0076] Through the above embodiment, by dynamically building and adjusting the filter engine, the generated report can better incorporate the care statements expected by medical institutions, making the report more humane. The effective simplification of professional terms increases the readability of the report, reduces the understanding barriers for non-professionals, and improves the patient experience.
[0077] To complete the insertion of annotation data, in an optional implementation, step S2041 includes:
[0078] Step S20411: Control the backend to clean the annotation data to obtain candidate filling data, convert the candidate filling data into JSON format, and obtain target filling data;
[0079] Specifically, the input is raw annotation data provided by medical institutions, which may contain disorganized text, numbers, and symbols. Processing: The data is read and cleaned using the Python pandas library, removing irrelevant information and formatting errors to ensure data integrity and consistency. The cleaned data is converted to JSON format for subsequent parsing and rendering. JSON (JavaScript Object Notation) is a lightweight data exchange format that is easy for humans to read and write, as well as for machines to parse and generate.
[0080] Step S20412: Control the backend to traverse the target template to identify conditional judgment tags, loop tags, declarative tags, and data rendering tags in the target template;
[0081] Specifically, the backend service traverses the target template and uses a Python template engine (such as Jinja2) to identify all conditional judgment tags (such as {% if %}), loop tags (such as {% for %}), declarative tags (such as {% set %}), and data rendering tags (such as {{variable name}}).
[0082] Step S20413, the control backend processes the target filling data based on the condition judgment tag, loop tag, declarative tag and data rendering tag, and fills the processing result into the filling position corresponding to the rendering tag.
[0083] Specifically, for conditional tags: decide whether to render or skip a specific part based on the corresponding field value in the JSON data. For example, if a test result is lower than the normal threshold, the abnormal result part in the template will be rendered. For loop tags: traverse the list or dictionary in the JSON data and repeatedly render the specified fragment in the template. For example, for multiple test results, a result row will be generated for each item. For declarative tags: define local variables or execute specific functions to prepare the data required for rendering. For example, pre-calculate the mean or median of the results for subsequent comparative descriptions. For data rendering tags: directly fill the placeholders in the template with the field values in the JSON data to generate the final report content.
[0084] Through the above-described implementation, data cleaning and structuring ensure the accuracy and completeness of input data, avoiding reporting errors caused by data errors. Based on conditional judgment and loop processing, the system can intelligently identify and fill in data, especially highlighting abnormal results, enhancing the warning effect of reports. Medical institutions can generate personalized reports that fully meet their needs by defining different tags and conditions, improving the professionalism of reports and user satisfaction.
[0085] In order to monitor the write operation under the preset path, in an optional implementation, before controlling the backend to obtain the customer's personalized needs from the frontend, the above method further includes:
[0086] Step S401, create a scheduled task based on the Django project in the back-end Linux server. The scheduled task is used to periodically poll the annotation data under the preset path. When new annotation data appears, the data processing task is triggered. The data processing task is used to control the back-end to capture personalized needs from the front-end.
[0087] Specifically, the input defines instructions for creating a scheduled task on the Linux server, as well as a script or view in the Django project for data processing. Processing: Using tools such as cron or anacron, a scheduled task is created on the Linux server. This task specifies a frequency for checking annotation data files in a preset path, for example, every five minutes. The scheduled task script calls a data processing function in the Django project, which monitors file changes and triggers subsequent processing. When the scheduled task runs, the Django script checks for new or updated annotation data files in the preset path. If a file change is detected, the data processing task is immediately triggered, invoking a view or script in the Django project for data capture and preprocessing. The data processing task begins executing, interacting with the front-end web application to capture the latest personalized requirements of the medical institution, including report templates, presentation logic, and language style. The data processing task further cleans and formats the collected annotation data to prepare the input for report generation. Using the processed annotation data and the acquired personalized requirements, the final medical test report is generated through the previously established report generation process (such as template rendering and data population).
[0088] Through the above embodiment, the system can respond to the update of medical institution data in a timely manner through the polling mechanism of scheduled tasks, ensuring the real-time and accurate generation of reports. Once the annotation data file changes are detected, the system automatically triggers subsequent processing, reducing the need for manual intervention and improving efficiency.
[0089] In order to save space occupied by the report, in an optional embodiment, before controlling the backend to send the test result report to the frontend for visual display of the test result report, the above method further includes:
[0090] Step S501: Control the backend to compress and encapsulate the test result report in a preset manner to obtain a report to be displayed;
[0091] Specifically, the generated test result report (.docx file) is processed using Python's zipfile module to compress the report file into a .z01 or .zip archive, reducing the file size and facilitating network transmission. During the compression process, additional information files (such as the report generation timestamp and report type) can be optionally added to enhance the report's encapsulation.
[0092] Step S502: Control the backend to store the report to be presented according to a preset path, and store the preset path to the frontend.
[0093] Specifically, the compressed report is stored in a pre-set directory on the Linux server, such as the / report_storage / directory. A database (such as MySQL) is used to store the pre-set directory and report metadata (such as the report ID, generation time, and client code) for easy front-end query and location. The pre-set directory and metadata are sent to the front-end through the Django framework's API. Upon receiving the directory and metadata, the front-end web application can immediately load and display the corresponding compressed report file.
[0094] The above-described embodiment significantly reduces network transmission time by compressing report files. Compression and encapsulation not only reduce file size but also enhance the security of report data, preventing tampering or misinterpretation during transmission. Pre-set storage and automatic loading mechanisms enable front-end users to seamlessly and quickly access the latest test result reports without manual searching, improving the user experience.
[0095] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0096] The embodiment of the present application also provides a report display device based on the docx format. It should be noted that the report display device based on the docx format of the embodiment of the present application can be used to execute the report display method based on the docx format provided in the embodiment of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation methods, and the details that have been explained will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and conceived.
[0097] The following is an introduction to the report display device based on the docx format provided in an embodiment of the present application.
[0098] Figure 3 This is a structural block diagram of a report display device based on docx format according to an embodiment of the present application. Figure 3 As shown, the device includes:
[0099] A first control unit 10 is used to control the front end to receive personalized requirements, annotation data, and preset document templates from medical institutions. The personalized requirements are used to define the data processing method, display format, and display method for filling the annotation data into the preset document template. The annotation data includes the patient's test results and explanation information for the test results;
[0100] Specifically, the front-end page design allows medical institutions to input personalized requirements for report format, content display, and data processing logic. At the same time, the annotation data uploaded by medical institutions usually includes patient test results and interpretation information of the results, as well as common document templates.
[0101] The second control unit 20 is used to control the front end to store the preset document template and annotation data to the back end according to a preset path;
[0102] The third control unit 30 is configured to, when the backend monitors a write operation in a preset path, control the backend to obtain the customer's personalized requirements from the frontend, insert a rendering tag into the preset document template according to the personalized requirements, and obtain a target template. The rendering tag is used to define the data variable name, data processing method, display method, and display format at the insertion location;
[0103] Specifically, the backend server listens for write operations on a specific path. Once new annotation data and template uploads are detected, the backend server pulls these data and personalized requirements from the frontend.
[0104] A fourth control unit 40 is used to control the backend to fill the corresponding annotation data into the corresponding insertion position according to the data variable name of the rendering label in the target template and process it according to the corresponding data processing method, display method and display format to obtain a detection result report;
[0105] Specifically, the backend inserts rendering tags into the preset template based on requirements. These tags define the data variable name, processing method, display format, and display method. The backend then reads the annotation data, fills the data into the template according to the definition of the rendering tags, performs corresponding processing, and generates a detection result report.
[0106] The fifth control unit 50 is used to control the backend to send the test result report to the frontend so as to visually display the test result report.
[0107] Specifically, the generated report is sent back to the front end, and the report is visualized through the web interface, and medical institutions and patients can view and download it online.
[0108] It is understandable that the front end provides the following information through the front end page:
[0109] Personalized requirements: including report style, content layout, display format of specific data (such as font size, color, table style), and display method (such as showing or hiding information based on conditions).
[0110] Annotation data upload: Upload an Excel file containing patient test results and interpretation information.
[0111] Document template upload: Upload a preset .docx template for building the report framework.
[0112] It is understandable that backend processing is mainly divided into two stages:
[0113] Monitoring and Acquisition: Use Linux file system monitoring tools, such as inotify, to monitor pre-set paths. Once a file write is detected, data processing is immediately executed. This process includes obtaining personalized requirements, annotation data, and document templates from the front-end. Use Python's docx-tpl or similar libraries to insert rendering tags into the template as required.
[0114] Data Processing and Report Generation: Use Pandas to read and clean annotation data, ensuring the data format meets the template requirements. Based on the rendering tags, variables from the annotation data are populated into the document template as needed, applying data processing methods. Format the populated data for presentation, adjusting table layout, fonts, and colors to meet personalized needs. Save the generated report and return it to the front-end via email or web interface.
[0115] Through this embodiment, the first control unit controls the front end to receive the personalized needs, annotation data and preset document template of the medical institution. The personalized needs are used to define the data processing method, display format and display method of the annotation data filled into the preset document template. The annotation data includes the patient's test results and the explanatory information of the test results; the second control unit controls the front end to store the preset document template and annotation data to the back end according to the preset path; when the back end monitors the presence of a write operation under the preset path, the third control unit controls the back end to obtain the customer's personalized needs from the front end, inserts the rendering tag into the preset document template according to the personalized needs, and obtains the target template. The rendering tag is used to define the data variable name, data processing method, display method and display format of the insertion position; the fourth control unit controls the back end to fill the corresponding annotation data into the corresponding insertion position according to the data variable name of the rendering tag in the target template and processes it according to the corresponding data processing method, display method and display format to obtain the test result report; the fifth control unit controls the back end to send the test result report to the front end to visualize the test result report. This application proposes to convert the user's personalized needs into a label language, and then integrate the label language into a universal template to form a target template that is adaptive based on customer needs. The above setting system can automatically modify the template according to customer needs, without the need for manual code development for data processing in the document generation process based on customer needs. This solves the problem in the existing technology of using python-docx to achieve personalized report customization, which requires manual code modification and leads to a high error rate.
[0116] In order to insert the tag language into the general template to form a personalized customized template, in an optional embodiment, the third control unit includes:
[0117] The first acquisition module is used to parse personalized requirements to extract template layout information, data display logic, speech configuration, personalized annotations and additional information. The personalized annotations are used to explain the preset nouns in the test results. The additional information includes literature citation information.
[0118] Specifically, it parses the personalized demand information submitted by medical institutions through the Web front-end, including template layout information, data display logic, speech configuration, personalized annotations and additional information (such as literature citations).
[0119] In the specific implementation, after the backend Django service receives the requirements, it uses Python's built-in JSON or XML parsing library to parse the requirements and extract the above key elements.
[0120] A first processing module is configured to insert a style tag corresponding to the template layout into a preset document template to obtain a first candidate template, wherein the value of the style tag is used to define the style of the data at the insertion position;
[0121] Specifically, the parsed template layout information is obtained. In the pre-set docx document template, style tags are added based on the layout information using the docx-tpl module or other compatible Python libraries. These tags define the specific styles of elements such as text, tables, and images, such as font size, color, and alignment, to ensure visual consistency of the report.
[0122] A second processing module is configured to insert a conditional judgment tag, a loop tag, and a declarative tag corresponding to the data display logic into the first candidate template to obtain a second candidate template, wherein the conditional judgment tag is used to determine whether the conclusion data is displayed based on the conditional data at the insertion position, the loop tag is used to traverse the data at the insertion position, and the declarative tag is used to limit the calculation and assignment of the insertion position;
[0123] Specifically, after parsing the data, the display logic is obtained and conditional tags (such as {% if ... %}), loop tags (such as {% for ... %}), and declarative tags (such as {% set ... %}) are used to dynamically display data in reports. For example, if a test result is outside the normal range, the conditional tag automatically highlights the result. For multiple test indicators, loop tags can ensure that each indicator is displayed correctly.
[0124] The third processing module is used to insert the filter tag corresponding to the speech configuration into the second candidate template to obtain a third candidate template. The filter tag is used to limit the filter engine called at the insertion position. Different filter engines correspond to different language styles.
[0125] Specifically, the parsed script configuration information is obtained and filter tags are added to the document template. These tags point to specific filter engines, and the report's language style is adjusted as needed, such as by simplifying professional terms and adding patient care statements. This step ensures that the report is not only accurate but also more user-friendly and suitable for different audiences.
[0126] The fourth processing module is used to insert the data rendering tag corresponding to the personalized annotation into the third alternative template and insert the data rendering tag corresponding to the additional information into the third alternative template to obtain the target template. The data rendering tag is used to convert the variable at the insertion position into an actual value.
[0127] Specifically, personalized annotations and additional information are obtained after parsing. Explanations of specific test terms are added to the template through data rendering tags (such as {{variable_name}}) to increase report readability. Similarly, additional content such as literature citations can be embedded in a similar manner to enhance the report's professionalism and reference value.
[0128] Through the above-described embodiments, automated processing significantly reduces the time required for manual tabulation and report filling, improving report generation efficiency. The application of dynamic data filling and conditional logic ensures the accuracy of report content and avoids errors that may be caused by manual operation. The dynamic configuration capability of pre-set document templates enables the system to quickly adapt to the diverse needs of different medical institutions, reducing maintenance costs and improving system flexibility and scalability.
[0129] In order to obtain the above-mentioned detection result report, in an optional embodiment, the above-mentioned fourth control unit includes:
[0130] The first control module is used to control the backend to fill the corresponding annotation data into the corresponding insertion position according to the condition judgment tag, loop tag, declarative tag and data rendering tag in the target template;
[0131] Specifically, the target template (including rendering tags, conditional tags, loop tags, and declarative tags) and the processed annotation data are obtained. The {{data_variable}} tag in the template is read and populated with patient test data from anno.xlsx. Conditional tags {%if condition%} and loop tags {%for item in data%} are used to determine whether to display or how to iterate over the data based on specific attributes of the annotation data. The declarative tag {%setvariable%} is used to define local variables and preprocess data to accommodate complex data display logic.
[0132] The second control module is used to control the backend to modify the style of the annotation data at the insertion position according to the style tag in the target template;
[0133] Specifically, the style tags and the filled annotation data in the target template are obtained. The style tags are applied to modify the data style at the insertion location to ensure that the visual effects of the report meet the requirements of the medical institution while enhancing the readability and professionalism of the report.
[0134] The third control module is used to control the backend to query the preset engine in the preset engine library according to the filter tag to obtain the target filter engine;
[0135] Specifically, the system retrieves annotation data for the filter tag and insertion location. Based on the filter call in {{variable | filter}}, the system queries the preset engine library to find the corresponding wording configuration, language style, or data formatting engine, such as the "Professional Terminology Simplification Filter" or the "Patient Care Statement Addition Engine."
[0136] The fourth control module is used to control the backend to process the annotation data of the corresponding insertion position through the target filter engine to obtain a detection result report.
[0137] Specifically, the target filter engine is used to process the annotation data at the insertion position, for example, converting professional terms into easy-to-understand explanations, or adjusting the language style according to the preferences of medical institutions to generate test result reports that meet the needs.
[0138] Through the above-described embodiments, medical institutions can freely customize the report layout, data display logic, and language style as needed, significantly improving the level of report personalization. The system accurately applies the medical institution's display rules while processing data through a filter engine to ensure the professionalism and accuracy of reports. Automated processing significantly reduces report generation time and improves work efficiency, which is particularly significant for the rapid generation of large numbers of reports.
[0139] In order to build a personalized engine, in an optional embodiment, the above-mentioned device includes:
[0140] A sixth control unit is configured to query a preset engine in a preset engine library based on a filter tag on the control backend. Before obtaining a target filter engine, the control backend constructs a filter engine based on conditional statements and functions at different filter levels to obtain multiple candidate engines. The filter level is used to represent the similarity between the data output by the filter engine and the speech configuration.
[0141] Specifically, by leveraging Python's function definition capabilities and logical conditional statements, combined with specific conditions provided by medical institutions (such as data accuracy, frequency of terminology, and sentiment), multiple alternative filter engines are constructed. These engines use internal algorithms (such as natural language processing technology and machine learning models) to evaluate the similarity between their output data and the medical institution's language configuration, using this as a quantitative standard for filtering levels. Based on the medical institution's preset data presentation logic and language style, the conditional statements and functions in the alternative filter engines are parameterized to optimize their processing performance for specific data types. For example, for reports containing a large amount of professional terminology, filters can be adjusted to add term explanations or replacements to improve report readability. For situations where data comparisons need to be emphasized, conditional statements can be adjusted to optimize data highlighting.
[0142] The seventh control unit is used to control the backend to adjust the conditional statements and functions of the candidate engines according to the data display logic, obtain the preset engine, and store the preset engine in the preset engine library.
[0143] Specifically, the preset engine storage process: the filter engine optimized through the above steps is marked as a preset engine and stored in the preset engine library so that it can be called when generating reports later.
[0144] Through the above embodiment, by dynamically building and adjusting the filter engine, the generated report can better incorporate the care statements expected by medical institutions, making the report more humane. The effective simplification of professional terms increases the readability of the report, reduces the understanding barriers for non-professionals, and improves the patient experience.
[0145] In order to complete the insertion of annotation data, in an optional embodiment, the first control module includes:
[0146] The first control submodule is used to control the backend to clean the annotation data to obtain candidate filling data, convert the candidate filling data into JSON format, and obtain target filling data;
[0147] Specifically, the input is raw annotation data provided by medical institutions, which may contain disorganized text, numbers, and symbols. Processing: The data is read and cleaned using the Python pandas library, removing irrelevant information and formatting errors to ensure data integrity and consistency. The cleaned data is converted to JSON format for subsequent parsing and rendering. JSON (JavaScript Object Notation) is a lightweight data exchange format that is easy for humans to read and write, as well as for machines to parse and generate.
[0148] The second control submodule is used to control the backend to traverse the target template to identify the conditional judgment tags, loop tags, declarative tags and data rendering tags in the target template;
[0149] Specifically, the backend service traverses the target template and uses a Python template engine (such as Jinja2) to identify all conditional judgment tags (such as {% if %}), loop tags (such as {% for %}), declarative tags (such as {% set %}), and data rendering tags (such as {{variable name}}).
[0150] The third control submodule is used to control the backend to process the target filling data based on the condition judgment tag, loop tag, declarative tag and data rendering tag, and fill the processing result into the filling position corresponding to the rendering tag.
[0151] Specifically, for conditional tags: decide whether to render or skip a specific part based on the corresponding field value in the JSON data. For example, if a test result is lower than the normal threshold, the abnormal result part in the template will be rendered. For loop tags: traverse the list or dictionary in the JSON data and repeatedly render the specified fragment in the template. For example, for multiple test results, a result row will be generated for each item. For declarative tags: define local variables or execute specific functions to prepare the data required for rendering. For example, pre-calculate the mean or median of the results for subsequent comparative descriptions. For data rendering tags: directly fill the placeholders in the template with the field values in the JSON data to generate the final report content.
[0152] Through the above-described implementation, data cleaning and structuring ensure the accuracy and completeness of input data, avoiding reporting errors caused by data errors. Based on conditional judgment and loop processing, the system can intelligently identify and fill in data, especially highlighting abnormal results, enhancing the warning effect of reports. Medical institutions can generate personalized reports that fully meet their needs by defining different tags and conditions, improving the professionalism of reports and user satisfaction.
[0153] In order to monitor the write operation under the preset path, in an optional implementation manner, the above-mentioned device further includes:
[0154] The eighth control unit is used to create a scheduled task based on the Django project in the back-end Linux server before controlling the back-end to obtain the customer's personalized needs from the front-end. The scheduled task is used to periodically poll the annotation data under the preset path. When new annotation data appears, the data processing task is triggered. The data processing task is used to control the back-end to capture personalized needs from the front-end.
[0155] Specifically, the input defines instructions for creating a scheduled task on the Linux server, as well as a script or view in the Django project for data processing. Processing: Using tools such as cron or anacron, a scheduled task is created on the Linux server. This task specifies a frequency for checking annotation data files in a preset path, for example, every five minutes. The scheduled task script calls a data processing function in the Django project, which monitors file changes and triggers subsequent processing. When the scheduled task runs, the Django script checks for new or updated annotation data files in the preset path. If a file change is detected, the data processing task is immediately triggered, invoking a view or script in the Django project for data capture and preprocessing. The data processing task begins executing, interacting with the front-end web application to capture the latest personalized requirements of the medical institution, including report templates, presentation logic, and language style. The data processing task further cleans and formats the collected annotation data to prepare the input for report generation. Using the processed annotation data and the acquired personalized requirements, the final medical test report is generated through the previously established report generation process (such as template rendering and data population).
[0156] Through the above embodiment, the system can respond to the update of medical institution data in a timely manner through the polling mechanism of scheduled tasks, ensuring the real-time and accurate generation of reports. Once the annotation data file changes are detected, the system automatically triggers subsequent processing, reducing the need for manual intervention and improving efficiency.
[0157] In order to save space occupied by the report, in an optional implementation, the above method further includes:
[0158] a ninth control unit, configured to control the backend to compress and encapsulate the test result report in a preset manner before the backend controls the test result report to be sent to the frontend for visual display, to obtain a report to be displayed;
[0159] Specifically, the generated test result report (.docx file) is processed using Python's zipfile module to compress the report file into a .z01 or .zip archive, reducing the file size and facilitating network transmission. During the compression process, additional information files (such as the report generation timestamp and report type) can be optionally added to enhance the report's encapsulation.
[0160] The tenth control unit is used to control the backend to store the report to be displayed according to a preset path, and store the preset path to the frontend.
[0161] Specifically, the compressed report is stored in a pre-set directory on the Linux server, such as the / report_storage / directory. A database (such as MySQL) is used to store the pre-set directory and report metadata (such as the report ID, generation time, and client code) for easy front-end query and location. The pre-set directory and metadata are sent to the front-end through the Django framework's API. Upon receiving the directory and metadata, the front-end web application can immediately load and display the corresponding compressed report file.
[0162] The above-described embodiment significantly reduces network transmission time by compressing report files. Compression and encapsulation not only reduce file size but also enhance the security of report data, preventing tampering or misinterpretation during transmission. Pre-set storage and automatic loading mechanisms enable front-end users to seamlessly and quickly access the latest test result reports without manual searching, improving the user experience.
[0163] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0164] The embodiment of the present application also provides a report display device based on the docx format. It should be noted that the report display device based on the docx format of the embodiment of the present application can be used to execute the report display method based on the docx format provided in the embodiment of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation methods, and the details that have been explained will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and conceived.
[0165] The docx-based report display device includes a processor and memory. The first, second, third, fourth, and fifth control units are stored in the memory as program units. The processor executes the program units stored in the memory to implement the corresponding functions. The modules are all located in the same processor; alternatively, the modules can be located in different processors in any combination.
[0166] The processor contains a kernel, which retrieves the corresponding program unit from the memory. You can set one or more kernels, and adjust the kernel parameters to improve the accuracy and efficiency of report generation.
[0167] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0168] An embodiment of the present invention provides a computer-readable storage medium, which includes a stored program. When the program is executed, the device where the computer-readable storage medium is located is controlled to execute the report display method based on the docx format.
[0169] An embodiment of the present invention provides a processor, which is used to run a program, wherein the program executes the report display method based on the docx format when it is run.
[0170] An embodiment of the present invention provides a communication system, which includes a primary communication domain, a secondary communication domain processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, steps of a report display method based at least on the docx format are implemented.
[0171] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initiating steps of a report presentation method based at least on the docx format.
[0172] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, can be centralized on a single computing device, or can be distributed across a network of multiple computing devices. They can be implemented using program code executable by the computing device, and thus, can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described herein can be performed in a different order than that shown, or can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0173] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0174] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0175] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0176] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0177] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0178] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0179] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can be implemented using any method or technology for information storage. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change RAM (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, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0180] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0181] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:
[0182] 1) The report display method based on the docx format of the present application, first, controls the front end to receive the personalized needs, annotation data and preset document template of the medical institution, the personalized needs are used to define the data processing method, display format and display method of the annotation data filling in the preset document template, and the annotation data includes the patient's test results and the explanation information of the test results; then, controls the front end to store the preset document template and annotation data to the back end according to the preset path; thereafter, when the back end monitors the presence of a write operation under the preset path, controls the back end to obtain the customer's personalized needs from the front end, inserts the rendering tag into the preset document template according to the personalized needs, and obtains the target template. The rendering tag is used to define the data variable name, data processing method, display method and display format of the insertion position; thereafter, controls the back end to fill the corresponding annotation data into the corresponding insertion position according to the data variable name of the rendering tag in the target template and processes it according to the corresponding data processing method, display method and display format to obtain the test result report; finally, controls the back end to send the test result report to the front end for visual display of the test result report. This application proposes to convert the user's personalized needs into a label language, and then integrate the label language into a universal template to form a target template that is adaptive based on customer needs. The above setting system can automatically modify the template according to customer needs, without the need for manual code development for data processing in the document generation process based on customer needs. This solves the problem in the existing technology of using python-docx to achieve personalized report customization, which requires manual code modification and leads to a high error rate.
[0183] 2) The report display device based on the docx format of the present application, the first control unit controls the front end to receive the personalized needs, annotation data and preset document template of the medical institution, the personalized needs are used to define the data processing method, display format and display method of the annotation data filled into the preset document template, and the annotation data includes the patient's test results and the explanatory information of the test results; the second control unit controls the front end to store the preset document template and annotation data to the back end according to the preset path; when the back end monitors the presence of a write operation under the preset path, the third control unit controls the back end to obtain the customer's personalized needs from the front end, inserts the rendering tag into the preset document template according to the personalized needs, and obtains the target template. The rendering tag is used to define the data variable name, data processing method, display method and display format of the insertion position; the fourth control unit controls the back end to fill the corresponding annotation data into the corresponding insertion position according to the data variable name of the rendering tag in the target template and processes it according to the corresponding data processing method, display method and display format to obtain the test result report; the fifth control unit controls the back end to send the test result report to the front end for visual display of the test result report. This application proposes to convert the user's personalized needs into a label language, and then integrate the label language into a universal template to form a target template that is adaptive based on customer needs. The above setting system can automatically modify the template according to customer needs, without the need for manual code development for data processing in the document generation process based on customer needs. This solves the problem in the existing technology of using python-docx to achieve personalized report customization, which requires manual code modification and leads to a high error rate.
[0184] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A report display method based on docx format, characterized in that: include: The control front end receives personalized requirements, annotation data and preset document templates from the medical institution, wherein the personalized requirements are used to define the data processing method, display format and display method of the annotation data when filling the preset document template, and the annotation data includes the patient's test results and explanation information of the test results; Controlling the front end to store the preset document template and annotation data to the back end according to a preset path; When the backend monitors a write operation under a preset path, the backend is controlled to obtain the personalized requirements of the customer from the frontend, and a rendering tag is inserted into the preset document template according to the personalized requirements to obtain a target template, wherein the rendering tag is used to define a data variable name at an insertion position, the data processing method, the display method, and the display format; Controlling the backend to fill the corresponding annotation data into the corresponding insertion position according to the data variable name of the rendering tag in the target template and processing the data according to the corresponding data processing method, the display method and the display format to obtain a detection result report; Control the backend to send the test result report to the frontend to visualize the test result report.
2. The method according to claim 1, characterized in that Inserting a rendering tag into the preset document template according to the personalized requirement to obtain a target template, the method further includes: Parsing the personalized requirements to extract template layout information, data display logic, speech configuration, personalized annotations, and additional information, wherein the personalized annotations are used to explain the preset nouns in the test results, and the additional information includes literature citation information; Inserting a style tag corresponding to the template layout information into the preset document template to obtain a first candidate template, wherein the value of the style tag is used to define the style of the data at the insertion position; Inserting a conditional judgment tag, a loop tag, and a declarative tag corresponding to the data display logic into the first candidate template to obtain a second candidate template, wherein the conditional judgment tag is used to determine whether conclusion data is displayed based on the conditional data at the insertion position, the loop tag is used to traverse the data at the insertion position, and the declarative tag is used to limit the operation and assignment of the insertion position; Inserting a filter tag corresponding to the speech configuration into the second candidate template to obtain a third candidate template, wherein the filter tag is used to limit the filter engine called at the insertion position, and different filter engines correspond to different language styles; Inserting the data rendering tag corresponding to the personalized annotation into the third candidate template and inserting the data rendering tag corresponding to the additional information into the third candidate template to obtain the target template, the data rendering tag is used to convert the variable at the insertion position into an actual value.
3. The method according to claim 2, characterized in that Controlling the backend to fill the corresponding annotation data into the corresponding insertion position according to the data variable name of the rendering tag in the target template and processing it according to the corresponding data processing method, the display method and the display format to obtain a detection result report, including: Controlling the backend to fill the corresponding annotation data into the corresponding insertion position according to the condition judgment tag, the loop tag, the declarative tag and the data rendering tag in the target template; Controlling the backend to modify the style of the annotation data at the insertion position according to the style tag in the target template; Control the backend to query a preset engine in a preset engine library according to the filter tag to obtain a target filter engine; The backend is controlled to process the annotation data corresponding to the insertion position through the target filter engine to obtain the detection result report.
4. The method according to claim 3, characterized in that Before controlling the backend to query a preset engine in a preset engine library according to the filter tag to obtain a target filter engine, the method includes: Controlling the backend to construct a filter engine based on conditional statements and functions of different filtering levels to obtain multiple candidate engines, wherein the filtering level is used to characterize the similarity between the data output by the filter engine and the speech configuration; The backend is controlled to adjust the conditional statements and the functions of the candidate engines according to each data display logic to obtain the preset engine, and the preset engine is stored in the preset engine library.
5. The method according to claim 3, characterized in that Controlling the backend to fill the corresponding annotation data into the corresponding insertion position according to the conditional judgment tag, the loop tag, the declarative tag, and the data rendering tag in the target template includes: Controlling the backend to clean the annotation data to obtain candidate filling data, converting the candidate filling data into JSON format to obtain target filling data; Controlling the backend to traverse the target template to identify the conditional judgment tag, the loop tag, the declarative tag, and the data rendering tag in the target template; The backend is controlled to process the target filling data based on the conditional judgment tag, the loop tag, the declarative tag and the data rendering tag, and fills the processing result into the filling position corresponding to the rendering tag.
6. The method according to claim 1, characterized in that Before controlling the backend to obtain the personalized needs of the customer from the frontend, the method further includes: A scheduled task based on the Django project is created in the Linux server of the backend. The scheduled task is used to periodically poll the annotation data under the preset path. When new annotation data appears, a data processing task is triggered. The data processing task is used to control the backend to capture the personalized needs from the frontend.
7. The method according to any one of claims 1 to 6, characterized in that Before controlling the backend to send the test result report to the frontend for visually displaying the test result report, the method further includes: Controlling the backend to compress and encapsulate the test result report in a preset manner to obtain a report to be displayed; The backend is controlled to store the report to be displayed according to the preset path, and the preset path is stored in the frontend.
8. A report display device based on docx format, characterized in that: The device comprises: A first control unit is configured to control the front end to receive personalized requirements, annotation data, and a preset document template from a medical institution, wherein the personalized requirements are used to define a data processing method, a display format, and a display method for filling the annotation data into the preset document template, and the annotation data includes a patient's test results and information explaining the test results; A second control unit is used to control the front end to store the preset document template and annotation data to the back end according to a preset path; a third control unit, configured to, when the backend monitors a write operation under a preset path, control the backend to obtain the customer's personalized requirements from the frontend, insert a rendering tag into the preset document template according to the personalized requirements, and obtain a target template, wherein the rendering tag is used to define a data variable name at an insertion position, the data processing method, the display method, and the display format; a fourth control unit, configured to control the backend to fill the corresponding annotation data into the corresponding insertion position according to the data variable name of the rendering tag in the target template and process the data according to the corresponding data processing method, the display method, and the display format to obtain a detection result report; A fifth control unit is used to control the back end to send the test result report to the front end so as to visually display the test result report.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 7.
10. A business system, characterized in that: include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include instructions for executing the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Automatic report generation method and device and report template configuration method and device
CN115796140A
Pathological report generation method and device, computer equipment and storage medium
CN116469510A
Method for automatically generating literal report
CN117131851A
Document generation method, device and system
CN117313655A
Method and device for generating report document and computer readable storage medium
CN120299598A