Method for converting CDA document into PDF document

By converting CDA documents to PDF documents using XML templates and PDF interface technology, the usability and security issues of HL7 CDA documents are resolved. The generated PDF documents are easy to view and tamper-proof.

CN121525633APending Publication Date: 2026-02-13FUJIAN FOXIT SOFTWARE DEV LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411105944.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2026-02-13

AI Technical Summary

Technical Problem

HL7 CDA documents require a special browser to view and pose security risks, making them difficult to view and transfer directly.

Method used

By creating XML template files and parsing CDA document structured data, PDF documents are dynamically generated, including control elements and data binding. The PDF interface capabilities are used to calculate control positions and generate PDF documents, and Flatten operations are performed on interactive elements.

Benefits of technology

It enables convenient viewing of CDA documents and improves security. The generated PDF documents cannot be tampered with, solving the usability and security issues of HL7 CDA documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121525633A_ABST
    Figure CN121525633A_ABST
Patent Text Reader

Abstract

The invention discloses a method for converting a CDA document into a PDF document, and the method comprises the steps: S1, creating an XML template file which comprises predefined basic control element and field information, a relative or absolute relation of positions between different controls in a page, and a key-value of an actual content data file corresponding to attributes of the controls; s2, analyzing and obtaining the structured data content of the CDA document by using an XML analysis technology; s3, document type items containing CDA document definition are obtained from the structured data, each document type corresponds to the created template file, and the template file is filled with data content according to the document type items; s4, directly and dynamically calculating the positions, the sizes and the generation sequence of different controls according to a preset template file for self-defined data used for exchange between different systems and equipment in the CDA document, and performing dynamic layout according to actual content needing to be input to generate a PDF (Portable Document Format) document; and S5, converting the interactive elements generated in the PDF document into static contents.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and particularly relates to a method for converting a CDA document into a PDF document. BACKGROUND

[0002] Clinical Document Architecture (CDA) is a standard of electronic document structure in the American Health Information Exchange Standard HL7 (Health Level Seven International). The HL7 CDA defines a standard format for exchanging clinical documents. The CDA document contains electronic document information such as patient medical records, diagnoses, image reports, laboratory reports, medical record abstracts, diagnosis certificates, and discharge summaries. The HL7 CDA document is a document written in XML format, and a special browser is usually required when viewing the CDA document, and there is a certain risk in security. SUMMARY

[0003] In order to solve the above problems, the present application provides a method for converting a CDA document into a PDF document, which dynamically generates a PDF file by using the structured data parsed from the CDA document and a pre-constructed XML template file, so as to convert the CDA document into a PDF document, thereby solving the problems of not easy to view and security of the CDA document.

[0004] To achieve the above purpose, the present application provides a method for converting a CDA document into a PDF document, which comprises the following steps:

[0005] Step S1: creating an XML template file, which includes information of pre-defined basic control elements and fields, relative or absolute relationship of positions between different controls in a page, and attributes of the controls to correspond to the key-value of the actual content data file;

[0006] Step S2: using an XML parsing technology to parse and obtain the structured data content of the CDA document;

[0007] Step S3: obtaining the document type items defined by the CDA document from the structured data, each document type corresponding to the created XML template file, and filling each data content into the XML template file according to the document type items;

[0008] Step S4: directly and dynamically calculating the positions, sizes and generation sequence of different controls according to the preset XML template file for the custom data in the CDA document for exchanging between different systems and devices, and dynamically arranging according to the actual content input as needed, to generate a PDF document;

[0009] Step S5: converting the generated interactive elements in the PDF document into static content.

[0010] In an embodiment of the present application, the basic control elements in step S1 include container elements, text elements, image elements, and table elements; the relative or absolute relationship of the positions of different controls in a page includes the spacing between the controls and the alignment of the controls in the container, and the text properties of the controls; and the actual content data file includes data that can be parsed by a CDA file or a data content file provided by a third party.

[0011] In an embodiment of the present application, the specific process of step S1 of creating an XML template file includes:

[0012] Step S101: inputting data to be used to create an XML template file and a json file of template data into an editing module;

[0013] Step S102: editing the data to be used to create an XML template file by an XML template editing module of the editing module, checking whether the XML controls and their properties are valid, if valid, then checking whether the XML property binding syntax is correct, if correct, then inputting into a layout module;

[0014] Step S103: editing the json file of template data by a json file editing module of the editing module and inputting into the layout module;

[0015] Step S104: dynamically calculating control positions, sizes, and other information by the layout module, and then generating a preview view;

[0016] Step S105: generating and exporting an XML template file and a data file if the preview view meets the expectation.

[0017] In an embodiment of the present application, the dynamic layout of step S4 is specifically to directly dynamically calculate the positions, sizes, and generation order of different controls according to the underlying PDF interface capability, PDF text objects, or form objects, and to dynamically layout according to the input actual content file, so as to generate a PDF document.

[0018] In an embodiment of the present application, step S5 is specifically to perform a Flatten operation on the interactive elements of the PDF document.

[0019] The method for converting a CDA document into a PDF document provided by the present application solves the problems of CDA document not easy to view and the security of the CDA document by generating a PDF document containing CDA document data from the CDA document, compared with the prior art. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to make the technical solutions of the embodiments of the present application or the prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description only aim to some of the embodiments of the present application, and other drawings can be obtained by those of ordinary skill in the art without any creative effort.

[0021] Figure 1 The flowchart of an embodiment of the present application is shown in

[0022] Figure 2 The flowchart of creating a template of an embodiment of the present application is shown in DETAILED DESCRIPTION

[0023] The technical solutions in the embodiments of the present application will be described clearly and completely in combination with the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without any creative effort belong to the protection scope of the present application.

[0024] Figure 1 The flowchart of an embodiment of the present application is shown in Figure 1 As shown, the embodiment provides a method for converting a CDA document into a PDF document, which comprises the following steps:

[0025] Step S1: creating an XML template file, which comprises the information of predefined basic control elements and fields, the relative or absolute relationship of the positions between different controls in a page, and an attribute similar to the ID of the control to correspond to the key-value of an actual content data file. The basic control elements may, for example, comprise container elements, text elements, image elements, table elements, etc. (all of which can be constrained by the CDT of XML); the relative or absolute relationship of the positions between different controls in a page may, for example, comprise the spacing between controls and the alignment of controls in a container, control text, etc. attributes; and the actual content data file may, for example, comprise data parsed from a CDA file or a data content file provided by a third party.

[0026] Figure 2 The flowchart of creating a template of an embodiment of the present application is shown in Figure 2 As shown, in the embodiment, the specific process of step S1 of creating an XML template file comprises:

[0027] Step S101: inputting the data of the XML template file to be created and the json file of the template data into an editing module;

[0028] Step S102: editing the data of the XML template file to be created by the XML template editing module of the editing module, and checking whether the XML control and its attributes are valid, if yes, then checking whether the XML attribute binding syntax is correct, if yes, then inputting to the layout module;

[0029] Step S103: editing the template data json file by the json file editing module of the editing module and inputting to the layout module;

[0030] Step S104: dynamically calculating the control position, size and other information by the layout module, and then generating a preview view;

[0031] Step S105: if the preview view meets the expectation, then generating and exporting the XML template file and the data file.

[0032] The control elements of the embodiment are supported by the syntax rules of the controls, which include basic controls such as shown below, and also support extended custom controls:

[0033] -Page page;

[0034] -TextBlock control with text;

[0035] -Image picture control;

[0036] The container controls for arrangement may, for example, include:

[0037] -Grid container for arranging controls like a table;

[0038] -StackPanel container for arranging controls vertically or horizontally;

[0039] -ListView list control containing multiple items;

[0040] -Table table control.

[0041] And these controls have control basic attributes supporting them, for example, the following attributes possessed by general controls:

[0042] Name-control name;

[0043] Uid-control ID;

[0044] Width-control width;

[0045] Height-control height;

[0046] Margin-distance between the control and other controls;

[0047] Visibility-whether visible;

[0048] HorizontalAlignment - The horizontal alignment of the control;

[0049] VerticalAlignment - The vertical alignment of the control;

[0050] Furthermore, each control supports its own unique properties, such as:

[0051] The TextBlock control supports its own unique properties such as Text, FontSize, FontFamily, and Foreground, among which:

[0052] Text - Text string;

[0053] FontSize - Font size;

[0054] FontFamily - Font name;

[0055] Foreground - Font color;

[0056] The Image control supports its own unique properties such as Source and Stretch, among which:

[0057] The property source corresponding to Source-Image;

[0058] Stretch-Image's image stretching method;

[0059] The StackPanel control supports container-specific properties such as Orientation and Padding, including:

[0060] Orientation - The arrangement of controls within the container, either vertical or horizontal;

[0061] Padding - the spacing between the container and its internal controls;

[0062] Both ListView and Table controls support the ItemsSource property:

[0063] ItemsSource - The data source for binding multiple controls.

[0064] The syntax of the data binding of the control property is explained, and the json data can be dynamically updated from the data file without changing the XML template file. In this way, the template can be fixed without modification, but the data file can be modified to update the text content style, etc. The flexible modification of the data json file can achieve the effect of flow layout. For example, the string format of x:Bind is bound to the Text in TextBlock, such as <TextBlock Text="{x:Bind Header}", "{x:Bind Header}" such format identifies the Text property of TextBlock is bound to the value corresponding to the Header of the json data file.

[0065] The following code example shows the case where the container control contains sub-controls. The StackPanel container contains an Image and TextBlock control:

[0066] <StackPanel Orientation="Vertical" Margin="10,10">

[0067] <Image Source="Assets\StoreLogo.png" Width="30" Height="30" VerticalAlignment="Center">

[0068] <TextBlock Text="{x:Bind Header}" Margin="10,0,0,0" VerticalAlignment="Center" Foreground="{x:Bind HeaderColor}">

[0069]

[0070] Step S2: using XML parsing technology to parse and obtain CDA document structured data content;

[0071] Step S3: obtaining the document type item containing the CDA document definition from the structured data, such as medical record, diagnosis, etc. Each document type corresponds to the created XML template file, and according to the document type item, each data content is filled into the XML template file. For example, the data is "name: Zhang San", and "Zhang San" is filled into the position of "name" in the template file;

[0072] Step S4: The custom data in the CDA document for exchange between different systems and devices is directly dynamically calculated according to preset XML template files for different control positions, sizes and generation sequences, and is dynamically laid out according to actual content inputted to generate a PDF document.

[0073] The embodiment directly depends on the underlying PDF interface capability, PDF text objects or form objects, etc. to directly dynamically calculate different control positions, sizes and generation sequences, and to realize dynamic layout according to inputted actual content files to generate a PDF document. The original binary data or content is embedded into the PDF document, for example, text or binary data can be added to the dictionary of the document object. The embedding into the PDF document means that the data is added to the document structure dictionary of the PDF file.

[0074] The HL7 CDA document is a document written in XML format, which includes a header and a body. The HL7 CDA specification has defined some common entry types. In addition, custom data needs to be added to the CDA document. The CDA document can be realized by adding or extending elements in the body part of the document. For example, a custom element "PatientCustomData" is created, and sub-elements such as "CustomDataPoint1", "CustomDataPoint2" are added under it to store custom data, and actual data is stored in the "value" attribute of each sub-element. The data can be normal text data, or formatted text data (such as json format), or binary data base64 encoded base64 string. The data itself is contained in the structured data of the CDA document. The structured data contains all the data in the CDA document. Some of the data is not necessary to be displayed in the PDF template file, and some data such as image data can be processed, for example, processed into a PDF image object, so that it can be directly displayed and viewed in a PDF reader. The data part that cannot be processed can be selectively embedded into the PDF document according to the needs of the user viewing the PDF document.

[0075] Step S5: The interactive elements generated in the PDF document are converted into static content.

[0076] The interactive elements in the embodiment are generally PDF form objects. The template file itself can predefine some form name fields to have a corresponding relationship with the structured data of the CDA, so the corresponding data text can be directly filled into the corresponding form.

[0077] In the embodiment, the step S5 is specifically performing a Flatten operation on the interactive elements of the PDF document, and after the Flatten operation, the elements cannot be edited or changed, but only become page content, thereby avoiding the generated PDF document from being tampered.

[0078] The "Flatten" operation is a function of a general PDF reader, which is used to convert interactive elements (such as annotations, filled forms, etc.) into static content, and after the operation, the elements have become part of the PDF page content, and thus cannot be edited or changed by user interaction input. As for which content can be subjected to the Flatten operation, whether to perform the Flatten operation can be specified in the attribute of the document root node of the XML template file, and other extended attributes such as whether to mark the control and hide can be specified.

[0079] The method for converting a CDA document into a PDF document provided by the application solves the problem of difficulty in viewing the CDA document and the security problem of the CDA document by generating a PDF document containing CDA document data from the CDA document.

[0080] Those skilled in the art can understand that the accompanying drawings are only schematic diagrams of an embodiment, and the modules or processes in the drawings are not necessarily essential for implementing the application.

[0081] Those skilled in the art can understand that the modules in the device in the embodiment can be distributed in the device in the embodiment as described in the embodiment, or can be changed and located in one or more devices different from the embodiment. The modules in the above embodiment can be combined into one module, or can be further split into multiple sub-modules.

[0082] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the application, and not to limit them; although the application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the application.

Claims

1. A method for converting CDA documents into PDF documents, characterized in that, Includes the following steps: Step S1: Create an XML template file. The XML template file includes information on predefined basic control elements and fields, the relative or absolute relationships between different controls on the page, and the key-value pairs of control attributes that correspond to the actual content data file. Step S2: Use XML parsing technology to parse and obtain the structured data content of the CDA document; Step S3: Extract document type items containing CDA document definitions from the structured data. Each document type corresponds to a created XML template file. Based on the document type items, populate the data content into the XML template file. Step S4: Based on the preset XML template file, dynamically calculate the position, size, and generation order of different controls in the CDA document for exchange between different systems and devices, and dynamically lay out the data according to the actual content input as needed to generate a PDF document. Step S5: Convert the interactive elements generated in the PDF document into static content.

2. The method for converting CDA documents to PDF documents according to claim 1, characterized in that, The basic control elements in step S1 include container elements, text elements, image elements, and table elements; the relative or absolute relationship between different controls on the page includes the spacing between controls and the alignment of controls within the container, as well as the text attributes of controls; the actual content data file includes data that can be parsed from the CDA file or data content files provided by third parties.

3. The method for converting CDA documents to PDF documents according to claim 1, characterized in that, The specific process of creating the XML template file in step S1 includes: Step S101: Input the data to be created in the XML template file and the JSON file of the template data into the editing module; Step S102: Edit the data of the XML template file to be created through the XML template editing module of the editing module, and check whether the XML controls and their properties are valid. If they are valid, continue to check whether the XML attribute binding syntax is correct. If it is correct, input it into the layout module. Step S103: Edit the JSON file of the template data through the JSON file editing module of the editing module and input it into the layout module; Step S104: The layout module dynamically calculates the position, size, and other information of the controls, and then generates a preview view; Step S105: If the preview view meets expectations, generate and export the XML template file and data file.

4. The method for converting CDA documents to PDF documents according to claim 1, characterized in that, The dynamic layout in step S4 specifically involves dynamically calculating the position, size, and generation order of different controls based on the underlying PDF interface capabilities, PDF text objects, or form objects, and then dynamically laying them out according to the actual input content file to generate a PDF document.

5. The method for converting CDA documents to PDF documents according to claim 1, characterized in that, Step S5 specifically involves performing a Flatten operation on the interactive elements of the PDF document.