Medical document OFD document generation method and device based on XML format

CN122886547APending Publication Date: 2026-10-09南京海泰医疗信息系统有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611008496.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-07
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

(1)信息损失严重:从结构化数据到PDF是一次“不可逆”的呈现过程,再从PDF到OFD又是一次“再封装”过程,原始结构化数据中的字段、属性、层级关系等细粒度信息完全丢失

Benefits of technology

本申请提供了一种基于XML版式的医疗文书OFD文档生成方法及装置,获取待处理医疗文书的版式参数和内容节点;根据待处理医疗文书的版式参数确定页面的内容区域;按照待处理医疗文书的文档结构顺序,依次遍历待处理医疗文书的各内容节点,确定内容节点在页面的内容区域内的位置数据;根据各内容节点在页面的内容区域内的位置数据、各内容节点的结构化的语义内容和预定义的XML版式文档结构规范生成XML版式文档;根据XML版式文档生成待处理医疗文书对应的OFD版式文档。本申请依次遍历待处理医疗文书的各内容节点,对各内容节点的位置进行动态排版计算,最终基于位置数据和结构化语义内容生成XML版式文档,再基于XML版式文档生成OFD版式文档,通过XML版式这一中间层,能够保留结构化语义,避免信息损失,也无须设置任何OFD模板,降低模板开发成本,无需业务系统强耦合。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122886547A_ABST
    Figure CN122886547A_ABST
Patent Text Reader

Abstract

The application discloses an XML format-based medical document OFD document generation method and device, relates to the technical field of document format conversion, and comprises the following steps: acquiring a format parameter and a content node of a medical document to be processed; determining a content area of a page according to the format parameter of the medical document to be processed; sequentially traversing each content node according to a document structure sequence of the medical document to be processed, and determining position data of the content node in the content area of the page; generating an XML format document according to the position data of each content node in the content area of the page, the structured semantic content of each content node and a pre-defined XML format document structure specification; and generating an OFD format document corresponding to the medical document to be processed according to the XML format document. The application generates an OFD format document based on an XML format document, and through the intermediate layer of the XML format, the structured semantic content can be retained, and any OFD template does not need to be set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of document format conversion technology, and in particular to a method and apparatus for generating medical document OFD documents based on XML format. Background Technology

[0002] With the deepening of medical informatization, electronic medical records, as an important record-keeping medium for medical activities, have an increasingly urgent need for long-term preservation and cross-institutional sharing. The OFD (Open Fixed-layout Document) format, due to its advantages such as openness, security, and support for national cryptographic standards, is gradually becoming the recommended format for long-term preservation and cross-institutional sharing of electronic medical records. Both the OFD Archive Application Guidelines and the Technical Requirements for Electronic Medical Record Layout Documents (OFD-H) provide clear specifications for the application of the OFD format in the medical field.

[0003] Currently, the mainstream methods for medical institutions to generate OFD medical record files include: 1. Convert to PDF first, then to OFD (indirect conversion method) The business system interface is converted to PDF using a print driver or virtual printer, and then converted to OFD using a conversion tool. This method has the following drawbacks: (1) Severe information loss: The process of converting structured data to PDF is an “irreversible” presentation process, and the process of converting PDF to OFD is another “re-encapsulation” process. Fine-grained information such as fields, attributes, and hierarchical relationships in the original structured data is completely lost.

[0004] (2) Data cannot be used: When extracting data from archived OFD documents, it can only be parsed in reverse by OCR technology, which is inefficient and inaccurate.

[0005] (3) The conversion chain is long, inefficient, and the intermediate links are complex to manage.

[0006] 2. Template-based data method (template + data) OFD templates are pre-designed for each type of document (such as admission records, discharge summaries, and surgical records), and the business system organizes and fills in data according to the template structure. While this method can retain some structured information, it still has the following drawbacks: (1) High template construction cost: There are many types of documents in hospitals (up to hundreds of types), and each document requires a separate template design and maintenance, which makes template construction cost high.

[0007] (2) Strong coupling with business systems: Business systems need to organize data according to template requirements, and changes to the template require synchronous modifications to the business systems.

[0008] (3) Data depends on external templates: Data extraction still depends on the original template, and the document itself does not have self-descriptive properties.

[0009] In summary, existing OFD document generation technologies generally suffer from the common problem of "separation between the presentation layer and the data layer". Summary of the Invention

[0010] The purpose of this application is to provide a method and apparatus for generating medical document OFD documents based on XML format, which can retain the structured semantic structure when generating OFD documents and does not require any OFD template.

[0011] To achieve the above objectives, this application provides the following solution: Firstly, this application provides a method for generating OFD (Organizational Documentation) medical documents based on XML format, including: Obtain the format parameters and content nodes of the medical document to be processed; Determine the content area of ​​the page based on the layout parameters of the medical document to be processed; According to the document structure order of the medical documents to be processed, each content node of the medical documents to be processed is traversed in turn to determine the position data of the content node within the content area of ​​the page. An XML document is generated based on the position data of each content node within the content area of ​​the page, the structured semantic content of each content node, and the predefined XML document structure specification. Generate OFD formatted documents corresponding to the medical documents to be processed based on XML formatted documents.

[0012] Secondly, this application provides a medical document OFD document generation system based on XML format, including: The data acquisition module is used to acquire the layout parameters and content nodes of the medical documents to be processed; The page area determination module is used to determine the content area of ​​the page based on the layout parameters of the medical document to be processed. The location calculation module is used to traverse each content node of the medical document to be processed in the order of the document structure and determine the location data of the content node within the content area of ​​the page. The XML document generation module is used to generate XML format documents based on the position data of each content node within the content area of ​​the page, the structured semantic content of each content node, and the predefined XML format document structure specifications. The OFD document generation module is used to generate OFD format documents corresponding to the medical documents to be processed based on XML format documents.

[0013] Thirdly, this application provides a computer device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described method for generating medical document OFD documents based on XML format.

[0014] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method for generating medical document OFD documents based on XML format.

[0015] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method for generating medical document OFD documents based on XML format.

[0016] According to the specific embodiments provided in this application, this application has the following technical effects: This application provides a method and apparatus for generating OFD documents for medical documents based on XML layout. The method involves: acquiring layout parameters and content nodes of the medical document to be processed; determining the content area of ​​the page based on the layout parameters; sequentially traversing each content node of the medical document according to its document structure order to determine the position data of each content node within the page's content area; generating an XML layout document based on the position data of each content node within the page's content area, the structured semantic content of each content node, and a predefined XML layout document structure specification; and generating an OFD layout document corresponding to the medical document to be processed based on the XML layout document. This application sequentially traverses each content node of the medical document to be processed, dynamically calculates the position of each content node, and finally generates an XML layout document based on the position data and structured semantic content. Then, it generates an OFD layout document based on the XML layout document. Through this intermediate layer of XML layout, the structured semantics are preserved, information loss is avoided, and no OFD template is required, reducing template development costs and eliminating the need for strong coupling with business systems. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is an application environment diagram of a method for generating medical document OFD documents based on XML format according to an embodiment of this application; Figure 2A flowchart illustrating a method for generating medical document OFD files based on XML format, provided in an embodiment of this application; Figure 3 A schematic diagram of the functional modules of a medical document OFD document generation device based on XML format provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0020] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0021] The method for generating medical document OFD files based on XML format provided in this application can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be set up independently, integrated into server 104, or placed in the cloud or on another server. Terminal 102 can send the layout parameters and content nodes of the medical document to be processed to server 104. After receiving the layout parameters and content nodes, server 104 determines the content area of ​​the page based on the layout parameters; according to the document structure order of the medical document, it sequentially traverses each content node of the medical document to determine the position data of the content node within the content area of ​​the page; it generates an XML layout document based on the position data of each content node within the content area of ​​the page, the structured semantic content of each content node, and the predefined XML layout document structure specification; and it generates an OFD layout document corresponding to the medical document to be processed based on the XML layout document. Server 104 can then feed back the obtained OFD layout document corresponding to the medical document to terminal 102. In addition, in some embodiments, the method for generating medical document OFD documents based on XML layout can also be implemented separately by server 104 or terminal 102. For example, terminal 102 can directly generate medical document OFD documents based on XML layout by targeting the layout parameters and content nodes of the medical document to be processed, or server 104 can obtain the layout parameters and content nodes of the medical document to be processed from the data storage system and generate medical document OFD documents based on XML layout.

[0022] Among them, terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, IoT devices and portable wearable devices, and server 104 can be implemented by independent servers or server clusters composed of multiple servers, or it can be a cloud server.

[0023] In one exemplary embodiment, such as Figure 2 As shown, a method for generating OFD (Organizational Documentation) medical documents based on XML format is provided. This method is executed by a computer device, specifically by a terminal or server alone, or by both a terminal and a server. In this embodiment, the method is applied to... Figure 1 Taking server 104 as an example, the explanation includes the following steps 201 to 205. Wherein: Step 201: Obtain the layout parameters and content nodes of the medical document to be processed.

[0024] Parse raw medical document data from the business system, which includes at least layout parameters and content nodes.

[0025] The layout parameters include paper type, page size (width, height), margins (left margin mleft, right margin mright, top margin mtop, and bottom margin mbottom), and page orientation (isLandScape).

[0026] Content nodes include structured fields and their attributes. Each field is associated with font information (font name, size, whether to bold, color, etc.) and its corresponding area (header, body text, footer). Content nodes include text nodes, fixed-length control nodes, image nodes, table nodes, line nodes, and graphic nodes.

[0027] As an example, the layout parameters are shown in Table 1.

[0028] Table 1. Examples of Layout Parameters

[0029] As an example, content nodes (structured fields and their attributes) are shown in Table 2.

[0030] Table 2 Examples of Content Nodes

[0031] The above data is parsed into a traversable content node tree, with each content node recording meta-information such as field name, field value, font attributes, and region (e.g., coordinates and width / height).

[0032] Step 202: Determine the content area of ​​the page based on the layout parameters of the medical document to be processed.

[0033] Determine the effective content area of ​​the page based on paper type, page size, and margins, and initialize the current cursor position.

[0034] Using the aforementioned layout parameter example as an example, with the bottom left corner of the page as the origin, the effective content area is determined according to the layout parameters: Effective X range: left margin 56px to right margin 738px (794-56).

[0035] Effective Y range: bottom margin 94px to top margin 1028px (1122-94).

[0036] Initial cursor position: (56, 1028) Define the line height calculation rule: line height = font size × 1.2 (empirical coefficient). For a 12pt font, the line height is approximately 16px.

[0037] Step 203: According to the document structure order of the medical document to be processed, traverse each content node of the medical document to be processed in turn to determine the position data of the content node within the content area of ​​the page.

[0038] Step 204: Generate an XML layout document based on the position data of each content node within the content area of ​​the page, the structured semantic content of each content node, and the predefined XML layout document structure specification.

[0039] Step 205: Generate the OFD format document corresponding to the medical document to be processed based on the XML format document.

[0040] By implementing steps 201 to 205 above, this application sequentially traverses each content node of the medical document to be processed, dynamically calculates the position of each content node, and finally generates an XML format document based on the position data and structured semantic content. Then, an OFD format document is generated based on the XML format document. Through the XML format as an intermediate layer, the contradiction between "loss of structured data information" and "high template adaptation cost" in the existing OFD generation method can be resolved, and a high-fidelity conversion of the original medical document data to the OFD format document can be achieved.

[0041] In existing OFD documents converted from PDF, fine-grained information such as fields, attributes, and hierarchical relationships in the original structured data is completely lost. The unique feature of this application is its method of converting raw medical record data into an intermediate XML format for OFD. The OFD format generated in this way is initially plain text, and then the meaning of the content is marked by the tagName attribute, solving the problem of unusable existing data. Furthermore, this application converts structured data into an XML format first, eliminating the intermediate steps of first converting to PDF, then to OFD, and finally reverse parsing.

[0042] In another exemplary embodiment of this application, in step 203, when the currently traversed content node is any one of a text node, a fixed-length control node (such as a text box, radio button, checkbox, time frame, etc.), or an image node, the position data of the content node within the content area of ​​the page is determined, specifically including: (1) Determine the content width and content height corresponding to the content node.

[0043] When the content node is a regular text node, a text measurement algorithm is used to calculate the text rendering width (corresponding to the content width) and rendering height (corresponding to the content height) based on font attributes (font name, size, whether it is bold, etc.).

[0044] Fixed-length controls have a predefined fixed width (width property) and a fixed height (which can be determined based on font line height or control type). During layout, fixed-length controls are treated as a fixed-size "block".

[0045] Images have a fixed width and height, derived from the image's own dimensions or specified by the user. When layout, the image is treated as an indivisible block.

[0046] (2) Based on the content width, determine whether the remaining width of the line where the current cursor position is located in the content area of ​​the current page can accommodate the content (text / fixed-length control / image) corresponding to the current content node, and obtain the first judgment result.

[0047] (3) If the first judgment result is yes, then determine the position data of the current content node according to the current cursor position, and update the current cursor position according to the content width corresponding to the current content node.

[0048] For a text node, its corresponding coordinates are the current cursor position (x, y). Update the x at the current cursor position to x + the text rendering width.

[0049] For a fixed-length control node, its corresponding coordinates are equal to the current cursor position (x, y). Update the x at the current cursor position to x + the width of the control.

[0050] For image nodes, their corresponding coordinates can be set to the top-left corner of the image as the current cursor position (x, y), and the x coordinate at the current cursor position can be updated to x + image width. For the y coordinate, it's assumed that each line is top-aligned, and the y coordinate only needs to be updated when a newline occurs. If it's bottom-aligned, since the bottom-left corner of the paper is the origin, the y coordinate should be updated to y = y - image height + original text line height.

[0051] (4) If the first judgment result is negative, the margin of the current page content area, the current cursor position, and the content height corresponding to the current content node determine the position data of the current content node, and update the current cursor position according to the content width.

[0052] To arrange text nodes, with the bottom left corner of the page as the origin, the coordinates of the current text node are (left margin, y-line height). Update the current cursor position: x = left margin + text width, y = y-line height.

[0053] For a fixed-length control node, its corresponding coordinates are (left margin, y - control height). To update the current cursor position, x = left margin + control width, and y = y - control height.

[0054] For an image node, its corresponding coordinates are (left margin, y - image height). Update the current cursor position: x = left margin + image width, y = y - image height.

[0055] For radio button / checkbox controls, it is also necessary to record their checked status (isChecked) and the position of the associated text. If the text is displayed on the right side, the starting point of the associated text position = control x-coordinate + control width + spacing. The spacing herein can be understood as the width of the small circle used for selection in front of the radio button.

[0056] A. Description based on the content of the foregoing step 203, in combination with the foregoing example of content node: (1) Using a text measurement algorithm, the actual rendering width of the text of the content node under the specified font is calculated according to attributes such as font name, size, and whether it is bold. For example: For the 3 Chinese characters "Chief Complaint: ", with font Song 12pt, the text rendering width = 3×12 = 36px, which is a simplified calculation herein.

[0057] For the 7 Chinese characters "Fever and cough for 3 days", the text rendering width = 7×12 = 84px.

[0058] (2) Line break judgment and coordinate assignment The current cursor position is (56, 1028), and the remaining width of the current line = 738 - 56 = 682px.

[0059] The width of the node "Chief Complaint: " is 36px, which is less than or equal to the remaining width, so it is placed on the same line: coordinates (56, 1028). Update the cursor x = 56 + 36 = 92.

[0060] The width of the node "Content of chief complaint" is 84px, which is less than or equal to the remaining width (682 - 36 = 646px), so it is placed on the same line: coordinates (92, 1028). Update the cursor x = 92 + 84 = 176.

[0061] The width of the node "Present illness: " is 36px, the remaining width of the current line = 738 - 176 = 562px, which is sufficient for placement. It is placed at (176, 1028). Update the cursor x = 176 + 36 = 212.

[0062] The width of the node "Content of present illness" is estimated to be 500px (long text), the remaining width of the current line = 738 - 212 = 526px, which is sufficient for placement, so it is placed at (212, 1028). Update the cursor x = 212 + 500 = 712.

[0063] Subsequent nodes are processed continuously. When a line break is required (for example, the text width of a text node is greater than the remaining width of the current line), the line break operation is performed: the y-coordinate of the cursor decreases by one line height (16px), the x-coordinate of the cursor is reset to the left margin 56px, and the next node is placed at the starting position of the new line.

[0064] B. Description based on the content of the foregoing step 203, taking a fixed-length control node as a body temperature value text box as an example: Suppose there is a body temperature textbox control, type textbox, width 120px, height 24px (determined by font size and border). The cursor is currently positioned at (200, 900). If the remaining width of the current line is 500px ≥ 120px, then place it on the same line. The top-left corner coordinates of the control are (200, 900). Record the control type, width, text content, selection state, and other attributes. Update the cursor x = 200 + 120 = 320. If the remaining width is insufficient, wrap to the next line, with the new line starting at (56, 900 - 24) = (56, 876).

[0065] C. Based on the content of step 203 above, the following explanation will be given using the patient's avatar as an example: Assume the image is 80px wide and 80px high. The current cursor position is (56, 800), the remaining width of the current line is 682px (≥ 80px), and the image is placed on the same line. The top-left corner coordinates of the image are (56, 800). Record the image reference number. Update the cursor x = 56 + 80 = 136. By default, each line is top-aligned; the y-coordinate only needs to be updated when a newline occurs.

[0066] In another exemplary embodiment of this application, in step 203, when the currently traversed content node is a table node, determining the position data of the content node within the content area of ​​the page specifically includes: (1) Update the current cursor position in the content area of ​​the current page to the starting point of a new row, and use it as the starting coordinate of the table node.

[0067] (2) Determine the position of each cell line by line and cell by cell according to the current cursor position, and record the index column and row number of each cell.

[0068] For table nodes, first parse the number of columns, column width (cwidth), row height (cheight), and border style. The table as a whole is a block-level element and typically needs to occupy a single line (after a previous node wraps, the table starts on a new line). Determine the table's starting coordinates (x_table, y_table), and then calculate the position of each cell within it, row by row and cell by cell: The cell's x = x_table + the sum of the widths of the first c-1 columns; The cell's y = y_table - (r - 1) × row height; Finally, the system records information such as the coordinates, width, height, bound column name (e.g., testName), and row number (rownum) of each cell.

[0069] Taking a lab results table as an example, the entire table occupies a single row. The current cursor position is y=700, and the starting point is x=56. Calculate the column widths: [80, 60, 60], and the row height is 24px. Traverse the rows: Row 1 (header row): y_table=700. Cell 1 has coordinates (56,700) and a width of 80; Cell 2 has coordinates (136,700) and a width of 60; Cell 3 has coordinates (196,700) and a width of 60.

[0070] Line 2: y_table=700-24=676. Cell 1 coordinates are (56,676), cell 2 coordinates are (136,676), and cell 3 coordinates are (196,676).

[0071] In another exemplary embodiment of this application, in step 203, when the currently traversed content node is a line node, determining the position data of the content node within the content area of ​​the page specifically includes: (1) Determine the relative positional relationship between the starting point and the ending point of the line corresponding to the line node.

[0072] The starting and ending coordinates are usually specified externally.

[0073] (2) Determine the position data of the line node based on the current cursor position, and update the current cursor position based on the relative positional relationship between the start and end points of the line.

[0074] When the content node is a QR code or barcode, it has a fixed width and height, and can be laid out in accordance with the layout method of fixed-length controls.

[0075] After calculating the position of each content node, its precise coordinates on the page are recorded, and a content mapping relationship is established between the content node and the corresponding original data field. If the name is mapped to "name" and the department to "dept", then specific data can be extracted from OFD using "name" and "dept" later.

[0076] After the position of each content node is calculated, a data record is generated for each content node, which includes: node identifier (e.g., the node identifier for a name is name), position coordinates (x, y), width and height (optional), and original field name (for subsequent semantic annotation).

[0077] In another exemplary embodiment of this application, step 204, generating an XML formatted document based on the position data of each content node within the content area of ​​the page, the structured semantic content of each content node, and the predefined XML formatted document structure specification, specifically includes: (1) Traverse each content node to determine the font type of each font. Different types of fonts have different font attributes.

[0078] (2) Traverse each content node, determine the content nodes that need to retain structured semantics, and set semantic identifiers and semantic content for the content nodes that need to retain structured semantics.

[0079] (3) Create a blank XML document according to the predefined XML layout document structure specification. In the blank XML document, create a font type control element for each font type, insert the corresponding font type attribute into each font type control element, and assign a font number to each font type control element.

[0080] For example: <fonts> <font name="宋体" size="12.0" bold="false" color="#000000" bgcolor="#FFFFFF">< / font> <font name="宋体" size="12.0" bold="true" color="#000000" bgcolor="#FFFFFF">< / font> < / fonts> As an example, font number 0 corresponds to the first font, and font number 1 corresponds to the second font.

[0081] (4) In the current XML document, generate page control elements and fill in the layout parameters of the medical document to be processed in the page control elements.

[0082] Generate page nodes based on layout parameters, for example: <page pagetype="A4" pw="794" ph="1122" mleft="56" mright="56" mtop="226" mbottom="94" islandscape="false"> (5) In the current XML document, generate the corresponding page content control elements according to the node type of each content node, and fill in the element attributes for each page content control element; the element attributes include position data, font number, semantic identifier, semantic content (corresponding to text: text content and tagName: semantic name below), and content node type.

[0083] Generate corresponding page content control elements based on node type, including but not limited to: 1) <range>Unstructured text (can be wrapped); 2) <formctl>Fixed-length controls (text boxes, radio buttons, checkboxes, etc.); 3) <qrcode>:QR code; 6) <barcode>Barcode; 7) <path>:line.

[0084] For ordinary text nodes (unstructured text, which can wrap lines), use <range>The control's element attributes include: x, y: coordinates; text: text content; f: font number; isTag: whether it is used as a semantic node (semantic identifier), set to "true" if yes; tagName: semantic name (e.g., "chief complaint tag", "patient name"); parentTag: parent semantic identifier (if any). The following explanation is based on the aforementioned content node example: <range x="56" y="1028" text="主诉:" f="0" isTag="true" tagName="主诉标签" / > <range x="92" y="1028" text="发热、咳嗽3天" f="0" isTag="true" tagName="主诉内容" / > <range x="56" y="1012" text="患者姓名:" f="1" isTag="true" tagName="患者姓名标签" / > <range x="140" y="1012" text="张三" f="1" isTag="true" tagName="患者姓名" / > For fixed-length control nodes (text boxes, radio buttons, checkboxes, etc.), use <formctl>Controls. As an example: <formctl x="200" y="900" width="120" type="textbox" f="0" isTag="true" tagName="体温值" text="36.5" / > For table nodes, use< / formctl> < / range> < / path> < / barcode> < / qrcode> : Table; 4): Image; 5) , <row> 、 <cell>Element. As an example: <row ishead="true"> <cell cwidth="80" cheight="24" colindex="0" group="itemName" rownum="1"> project< / cell> <cell cwidth="60" cheight="24" colindex="1" group="result" rownum="1"> result< / cell> < / row> <row> <cell cwidth="80" cheight="24" colindex="0" group="itemName" rownum="2"> leukocyte< / cell> <cell cwidth="60" cheight="24" colindex="1" group="result" rownum="2"> 6.5< / cell> < / row> In this application, for content nodes that need to retain structured semantics, `isTag="true"` is set, and `tagName` (field name) and `parentTag` (parent semantic identifier) ​​are filled in to establish a mapping relationship (semantic annotation mapping relationship) between the presented content and the original data fields. Correspondingly, the `tagName` node below can be used to annotate the meaning of the text, facilitating subsequent data extraction and utilization. For example, the semantic annotation mapping relationship is as follows: Patient Name Node: isTag="true" tagName="PatientName" Gender node: isTag="true" tagName="Sex" Age tag: isTag="true" tagName="Age" Combining all the examples above, the generated intermediate layer XML layout document has the following structure: <document> <fonts> <font name="宋体" size="12.0" bold="false" color="#000000" bgcolor="#FFFFFF">< / font> <font name="宋体" size="12.0" bold="true" color="#000000" bgcolor="#FFFFFF">< / font> < / fonts> <page pagetype="A4" pw="794" ph="1122" mleft="56" mright="56" mtop="226" mbottom="94" islandscape="false"> <!-- Chief Complaint --> <range x="56" y="1028" text="主诉:" f="0" isTag="true" tagName="ChiefComplaintLabel" / > <range x="92" y="1028" text="发热、咳嗽3天" f="0" isTag="true" tagName="ChiefComplaint" / > <!-- Present Medical History --> <range x="56" y="1012" text="现病史:" f="0" isTag="true" tagName="HPILabel" / > <range x="92" y="1012" text="患者3天前无明显诱因出现发热..." f="0" isTag="true" tagName="HPIContent" / > <!-- Basic Patient Information --> <range x="56" y="896" text="患者姓名:" f="1" isTag="true" tagName="PatientNameLabel" / > <range x="140" y="896" text="张三" f="1" isTag="true" tagName="PatientName" / > <range x="56" y="872" text="性别:" f="0" isTag="true" tagName="SexLabel" / > <range x="92" y="872" text="男" f="0" isTag="true" tagName="Sex" / > <range x="56" y="848" text="年龄:" f="0" isTag="true" tagName="AgeLabel" / > <range x="92" y="848" text="40岁" f="0" isTag="true" tagName="Age" / > <!-- Table Example --> <row ishead="true"> <cell cwidth="80" cheight="24" colindex="0" group="testName" rownum="1"> Inspection items< / cell> <cell cwidth="60" cheight="24" colindex="1" group="result" rownum="1"> result< / cell> <cell cwidth="60" cheight="24" colindex="2" group="unit" rownum="1"> unit< / cell> < / row> <row> <cell cwidth="80" cheight="24" colindex="0" group="testName" rownum="2"> White blood cell count< / cell> <cell cwidth="60" cheight="24" colindex="1" group="result" rownum="2"> 6.5< / cell> <cell cwidth="60" cheight="24" colindex="2" group="unit" rownum="2"> 10^9 / L< / cell> < / row> < / page> < / document> In another exemplary embodiment of this application, the XML layout document constructed in step 204 is encapsulated and saved as an intermediate layer file (e.g., "layoutXML.xml"). This file also includes: (a) Presentation of content: The precise position, style, and content value of all controls.

[0085] (b) Semantic annotation part: Field mapping relationship established through attributes such as isTag, tagName, parentTag, etc.

[0086] The XML layout document, an intermediate layer file in this application, can be used as an independent artifact for debugging, verification, and archiving, or it can be directly used for subsequent OFD generation.

[0087] In another exemplary embodiment of this application, in step 205, the final OFD format document is generated based on the XML format document, specifically: An OFD conversion engine conforming to the GB / T 33190 standard (a technology well known in the art) can be used to convert XML formatted documents into OFD formatted documents. This engine performs the following processing: (1) Parsing the presentation content of an XML layout document ( <range> 、 <formctl> 、

[0088]

[0089]

[0090]

[0091]

[0092]

[0093]

[0094]

[0095]

[0096]

[0097]

[0098] Figure 3

[0099]

[0100]

[0101]

[0102]

[0103] Figure 4

[0104] Figure 4

[0105]

[0106]

[0107]

[0108]

[0109]

[0110]

[0111] (1) Based on the coordinates and style information, the OFD page content flow (the structure within the OFD package) is generated according to the OFD standard. (2) The semantic annotation information such as tagName and parentTag of the element with isTag="true" is converted into a custom index within the OFD package (written into Tags / CustomTag_Medical.xml) to form a semantic description file independent of the content presentation layer. (3) Finally, the .ofd file conforming to the OFD document standard is output. In this application, the OFD format document generated based on the XML format document not only retains the accurate format presentation of the original medical document, but also embeds structured semantic annotations that can be recognized by computers, supporting subsequent reversible extraction and application. This application has the following beneficial effects: (1) Retaining structured semantics: By using the XML format as an intermediate layer, the presentation content and semantic annotation mapping are simultaneously carried, realizing the "human-readable and machine-readable" format document, solving the problem of information loss in the traditional method. (2) Reducing template development costs: There is no need to design OFD templates separately for each document. Only the mapping rules for generating XML need to be defined once, which can be applied to various original documents, greatly reducing the system adaptation and maintenance costs. (3) Compliant with OFD-H standard requirements: The generated OFD format file meets the long-term preservation requirements of GB / T 42133 and the technical requirements for electronic medical record format documents (OFD-H), and is fully compliant in terms of file structure, resource embedding, signature protection, and extended data. (4) Low implementation cost and strong compatibility: This application makes full use of the existing extension mechanism of the OFD standard without modifying the underlying standard. The final OFD generation stage can be implemented using conversion technology known in the field, without relying on specific vendors or tools. (5) Modular decoupling: "Data mapping and association" and "format generation" are separated, and the XML format document can be debugged, verified and archived as an independent product, reducing the coupling between various modules of the system. This application also provides an application scenario in which the above-mentioned medical document OFD document generation method based on XML format is applied. Specifically: The medical document OFD document generation method based on XML format provided in this embodiment can be applied in the electronic medical record generation scenario, which includes: a data export stage and an electronic medical record generation stage; the data export stage is used to access the business system to export medical documents in the business system. The electronic medical record generation stage involves generating OFD-formatted electronic medical records based on exported medical documents using an XML-based medical document OFD document generation method. The XML-based medical document OFD document generation method provided in this embodiment belongs to the electronic medical record generation stage. Based on the same inventive concept, this application also provides an XML-based medical document OFD document generation apparatus for implementing the aforementioned XML-based medical document OFD document generation method.The solution provided by this device is similar to the solution described in the above method. Therefore, the specific limitations of one or more embodiments of the medical document OFD document generation device based on XML format provided below can be found in the limitations of the medical document OFD document generation method based on XML format above, and will not be repeated here. In an exemplary embodiment, as shown, a medical document OFD document generation device based on XML format is provided, including: a data acquisition module M1, used to acquire the format parameters and content nodes of the medical document to be processed; a page area determination module M2, used to determine the content area of ​​the page according to the format parameters of the medical document to be processed; a position calculation module M3, used to sequentially traverse each content node of the medical document to be processed according to the document structure order, and determine the position data of the content node within the content area of ​​the page; an XML document generation module M4, used to generate an XML format document according to the position data of each content node within the content area of ​​the page, the structured semantic content of each content node, and the predefined XML format document structure specification; and an OFD document generation module M5, used to generate an OFD format document corresponding to the medical document to be processed according to the XML format document. In an exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as shown. The computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is connected to the system bus via the I / O interfaces. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device stores data generated from medical document OFD documents based on XML format. The input / output interfaces of the computer device are used for exchanging information between the processor and external devices. The communication interface of the computer device is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for generating medical document OFD documents based on XML format. The structures shown are merely block diagrams of some structures related to the present application and do not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than shown in the figures, or combine certain components, or have different component arrangements. In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.In one exemplary embodiment, a computer-readable storage medium is provided, storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments. In another exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments. It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with relevant regulations and be authorized by the owner of the corresponding device. Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the various embodiments provided in this application may include at least one of relational databases and non-relational databases. Non-relational databases may include distributed databases based on blockchain, etc., and are not limited thereto. The processors involved in the various embodiments provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited thereto.The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application. < / formctl> < / range> < / cell> < / row> < / formctl> < / range> < / page>

Claims

1. A method for generating OFD documents for medical records based on XML format, characterized in that, include: Obtain the format parameters and content nodes of the medical document to be processed; Determine the content area of ​​the page based on the layout parameters of the medical document to be processed; According to the document structure order of the medical documents to be processed, each content node of the medical documents to be processed is traversed in turn to determine the position data of the content node within the content area of ​​the page. An XML document is generated based on the position data of each content node within the content area of ​​the page, the structured semantic content of each content node, and the predefined XML document structure specification. Generate OFD formatted documents corresponding to the medical documents to be processed based on XML formatted documents.

2. The method for generating medical document OFD files based on XML format according to claim 1, characterized in that, When the currently traversed content node is any one of a text node, a fixed-length control node, or an image node, determine the position data of the content node within the content area of ​​the page, specifically including: Determine the content width and content height corresponding to the content node; Based on the content width, determine whether the remaining width of the line where the cursor is located in the content area of ​​the current page is sufficient to accommodate the content corresponding to the current content node, and obtain the first judgment result; If the first judgment result is yes, then determine the position data of the current content node based on the current cursor position, and update the current cursor position based on the content width corresponding to the current content node; If the first judgment result is negative, the position data of the current content node is determined based on the margin of the current page's content area, the current cursor position, and the content height corresponding to the current content node, and the current cursor position is updated based on the content width.

3. The method for generating medical document OFD files based on XML format according to claim 1, characterized in that, When the currently traversed content node is a table node, the position data of the content node within the content area of ​​the page is determined, specifically including: Update the current cursor position in the current page's content area to the start of a new row, and use it as the starting coordinate of the table node; Determine the position of each cell row by row and cell by cell based on the current cursor position, and record the index column and row number of each cell.

4. The method for generating medical document OFD files based on XML format according to claim 1, characterized in that, When the currently traversed content node is a line node, the position data of the content node within the content area of ​​the page is determined, specifically including: Determine the relative positional relationship between the start and end points of the lines corresponding to the line nodes; The position data of the line node is determined based on the current cursor position, and the current cursor position is updated based on the relative positional relationship between the start and end points of the line.

5. The method for generating medical document OFD files based on XML format according to claim 1, characterized in that, An XML layout document is generated based on the position data of each content node within the content area of ​​the page, the structured semantic content of each content node, and the predefined XML layout document structure specification. Specifically, this includes: Iterate through each content node to determine the font type of each font; Traverse each content node, determine the content nodes that need to retain structured semantics, and set semantic identifiers and semantic content for the content nodes that need to retain structured semantics; Create a blank XML document according to the predefined XML layout document structure specification. In the blank XML document, create a font type control element for each font type, insert the corresponding font type attribute into each font type control element, and assign a font number to each font type control element. In the current XML document, generate page control elements and fill in the layout parameters of the medical document to be processed into the page control elements; In the current XML document, corresponding page content control elements are generated based on the node type of each content node, and element attributes are filled into each page content control element; element attributes include position data, font number, semantic identifier, semantic content, size, and content node type.

6. A medical document OFD document generation system based on XML format, characterized in that, include: The data acquisition module is used to acquire the layout parameters and content nodes of the medical documents to be processed; The page area determination module is used to determine the content area of ​​the page based on the layout parameters of the medical document to be processed. The location calculation module is used to traverse each content node of the medical document to be processed in the order of the document structure and determine the location data of the content node within the content area of ​​the page. The XML document generation module is used to generate XML format documents based on the position data of each content node within the content area of ​​the page, the structured semantic content of each content node, and the predefined XML format document structure specifications. The OFD document generation module is used to generate OFD format documents corresponding to the medical documents to be processed based on XML format documents.

7. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that the processor executes the computer program to implement the method for generating medical document OFD documents based on XML format as described in any one of claims 1-5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the method for generating medical document OFD documents based on XML format as described in any one of claims 1-5.

9. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the method for generating medical document OFD documents based on XML format as described in any one of claims 1-5.