Intelligent parsing method and system for medical files

By employing cascaded adaptive parsing and parallel task processing, the problems of missing semantic understanding and poor generalization ability of rule templates in OCR are solved, enabling fast, accurate, and stable interpretation of medical documents and improving the efficiency and reliability of medical record interpretation.

CN122177328APending Publication Date: 2026-06-09SHENZHEN BODE RUIJIE HEALTH TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN BODE RUIJIE HEALTH TECH CO LTD
Filing Date
2026-03-09
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing technologies suffer from a lack of semantic understanding in OCR, poor generalization ability of rule templates, low efficiency of serial extraction, and unstable output, resulting in time-consuming and unreliable interpretation of medical documents.

Method used

A cascaded adaptive parsing method is adopted, which extracts table structure data and text content through OCR recognition and lightweight markup language formatting. The report type is identified by combining a large language model, and a set of parallel tasks is constructed for parallel processing, ultimately generating intelligent parsing results.

Benefits of technology

It enables rapid, accurate, and stable interpretation of medical documents, balancing accuracy, generalizability, and engineering usability, thereby improving the efficiency and reliability of medical record interpretation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122177328A_ABST
    Figure CN122177328A_ABST
Patent Text Reader

Abstract

The application discloses a kind of intelligent analysis method and system of medical file, wherein, the method includes: based on the medical file of user uploaded, the medical file is cascade adaptive analysis processing, obtain the analysis data corresponding to the medical file of the medical file, and based on the analysis data determine the report type identification of the medical file;Based on the report type identification, the parallel task set corresponding to the report type identification is constructed;The parallel task set is executed, and based on the execution result of the parallel task set, result assembly processing is carried out, and the intelligent analysis result of the medical file is obtained.The application effectively solves the problems of OCR semantic understanding missing, poor rule template generalization ability, low efficiency of serial extraction and unstable output in the prior art, realizes the medical record fast interpretation considering accuracy, generalization and engineering usability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of medical information processing technology, and more specifically, to a method and system for intelligent parsing of medical documents. Background Technology

[0002] Medical records, prescriptions, laboratory / examination reports, and physical examination reports issued by medical institutions are characterized by diverse formats, specialized content, and inconsistent structures. Patients or non-specialist personnel often require doctors to explain each item when reading them; and doctors, under the high workload of outpatient clinics, also spend a lot of time interpreting each document.

[0003] However, existing technologies mainly suffer from the following problems: 1) OCR alone does not understand semantics: OCR can convert images / PDFs into text, but it cannot perform medical semantic understanding and field extraction, let alone generate readable interpretation summaries. 2) The rule-based template method has poor generalization ability: The column names, layouts, and abbreviations of tables exported from different hospitals / different testing instruments / different software vary greatly, and fixed templates or rule matching are prone to failure when faced with new formats. 3) The serial extraction process is inefficient: The traditional serial process of "extracting basic information first, then medical history, then diagnosis and treatment, and then writing recommendations" results in long processing times for a single report and insufficient throughput. 4) Unstable / unparsable output: Generative model output is prone to missing fields and format drift, leading to system-side parsing failures and service unavailability.

[0004] Therefore, there is an urgent need for a technology solution for generating rapid medical record interpretation reports that can balance accuracy, generalizability, efficiency, and engineering usability. Summary of the Invention

[0005] This invention provides an intelligent parsing method and system for medical documents, which effectively solves the problems of lack of semantic understanding in OCR, poor generalization ability of rule templates, low efficiency of serial extraction, and unstable output in the prior art.

[0006] According to one aspect of the present invention, a method for intelligent parsing of medical documents and a system method for intelligent parsing of medical documents are provided, comprising: performing cascaded adaptive parsing processing on medical documents uploaded by users to obtain parsing data corresponding to the medical documents, and determining a report type identifier of the medical documents based on the parsing data; constructing a set of parallel tasks corresponding to the report type identifier; executing the set of parallel tasks, and performing result assembly processing based on the execution results of the set of parallel tasks to obtain an intelligent parsing result of the medical documents.

[0007] According to another aspect of the present invention, an intelligent parsing system for medical documents is also provided, comprising: a parsing module configured to perform cascaded adaptive parsing processing on medical documents uploaded by users to obtain parsing data corresponding to the medical documents, and to determine a report type identifier of the medical documents based on the parsing data; a task construction module configured to construct a set of parallel tasks corresponding to the report type identifier based on the report type identifier; and a task execution module configured to execute the set of parallel tasks and perform result assembly processing based on the execution results of the set of parallel tasks to obtain the intelligent parsing result of the medical documents.

[0008] This invention effectively solves the problems of lack of semantic understanding in existing OCR technologies, poor generalization ability of rule templates, low efficiency of serial extraction, and unstable output, and realizes rapid interpretation of medical records that balances accuracy, generalization and engineering usability. Attached Figure Description

[0009] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0010] Figure 1 This is a flowchart of an optional intelligent parsing method for medical documents according to an embodiment of the present invention;

[0011] Figure 2 This is a flowchart of another optional intelligent parsing method for medical documents according to an embodiment of the present invention;

[0012] Figure 3 This is a timing diagram of an optional intelligent parsing method for medical documents according to an embodiment of the present invention;

[0013] Figure 4 This is a flowchart of an optional parallel medical record / prescription extraction task according to an embodiment of the present invention;

[0014] Figure 5 This is a flowchart of an optional three-stage inspection report processing method according to an embodiment of the present invention;

[0015] Figures 6 to 8 This is an interface diagram of an optional intelligent medical document parsing APP according to an embodiment of the present invention. Detailed Implementation

[0016] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0017] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0018] This invention discloses an intelligent parsing method and system for medical documents. The method includes: performing cascaded adaptive parsing processing on a user-uploaded medical document to obtain parsed data corresponding to the medical document; determining a report type identifier for the medical document based on the parsed data; constructing a set of parallel tasks corresponding to the report type identifier based on the report type identifier; executing the set of parallel tasks; and assembling the results based on the execution results of the set of parallel tasks to obtain the intelligent parsing result of the medical document. This invention effectively solves the problems of lack of semantic understanding in existing OCR technologies, poor generalization ability of rule templates, low efficiency of serial extraction, and unstable output, achieving rapid interpretation of medical records while balancing accuracy, generalization, and engineering usability.

[0019] Figure 1 This is a flowchart of a smart parsing method for medical documents according to an embodiment of the present invention. The method mainly includes:

[0020] Step S102: Based on the medical files uploaded by the user, perform cascaded adaptive parsing processing on the medical files to obtain the parsing data corresponding to the medical files, and determine the report type identifier of the medical files based on the parsing data.

[0021] Based on the medical files uploaded by the user, cascaded adaptive parsing processing is performed on the medical files to obtain the parsed data corresponding to the medical files. The report type identifier of the medical files is determined based on the parsed data, including OCR recognition of the medical files and lightweight markup language formatting processing of the OCR recognition results to obtain formatted data. Table structure data and text content are extracted from the formatted data to obtain the parsed data.

[0022] Step S104: Based on the report type identifier, construct a set of parallel tasks corresponding to the report type identifier;

[0023] When the report type is identified as medical record or prescription, at least one of the following parallel task sets is constructed: basic information extraction task, medical history information extraction task, diagnosis and treatment information extraction task, and health advice generation task;

[0024] When the report type is identified as an inspection report, at least one of the following parallel task sets is constructed: the parallel task set includes at least: a series of subtasks consisting of a table preprocessing task and an indicator extraction task, and a basic information extraction task and a health suggestion generation task executed in parallel with the series of subtasks;

[0025] When the report type is identified as a physical examination report, at least one of the following sets of parallel tasks is constructed: basic information extraction task and joint extraction task of abnormal indicators and health suggestions.

[0026] Step S106: Execute the set of parallel tasks, and perform result assembly processing based on the execution results of the set of parallel tasks to obtain the intelligent parsing result of the medical document;

[0027] When the report type is identified as a test report, a three-level cascaded column name matching mechanism is used to unify the tables in the medical documents from different hospitals and / or different devices into a standard field set, forming a computable standardized table; the test items in the standardized table are parsed row by row to extract the indicator array corresponding to the test items, and the field data in the indicator array is subjected to normalization and cleaning processing to obtain a normalized indicator data set.

[0028] In some embodiments, a three-level cascaded column name matching mechanism is employed to unify tables from medical documents from different hospitals and / or different devices into a standard field set, forming a computable standardized table. This includes: performing precise string matching between the original column names in the table and a predefined thesaurus, wherein the original column names include at least the following required fields: project name, result value, and reference range; if the string matching is successful, establishing a mapping relationship between the original column names and the standard column names in the thesaurus; otherwise, vectorizing the original column names and performing semantic alignment based on the vectorized representation in a vector database to obtain standard column names with a similarity of not less than a preset threshold; if a standard column name with a similarity of not less than the preset threshold is found, establishing a mapping relationship between the original column names and the standard column names in the vector database; otherwise, extracting sample data from the table and using a large language model to complete and / or truncate the semantic meaning of the original column names in the table to obtain standard column names corresponding to the original column names.

[0029] The method, after standardizing the field set, further includes: scanning the column name sequence of the standardized table to detect at least one set of duplicate column names; if duplicate column names are detected, horizontally splitting the standardized table using the first occurrence of the duplicate column name as the column block boundary point to obtain at least two column blocks with the same column structure; aligning the column structures of each column block and vertically merging them along the row direction to generate a long table with a unified structure; cleaning the data in the long table by deleting completely empty rows and rows where required fields are empty.

[0030] In some embodiments, the test items in the standardized table are parsed row by row to extract the indicator array corresponding to the test items, and the field data in the indicator array is subjected to normalization and cleaning processing to obtain a normalized indicator data set, including: cleaning the item name field in the indicator array with at least one of the following: removing leading serial numbers and non-semantic symbols, removing English abbreviations in parentheses or suffixes, and unifying the character format of the item name; cleaning the English abbreviation field in the indicator array with at least one of the following: removing Chinese characters, removing leading numbers, and uniformly converting the English abbreviations to a preset uppercase and lowercase format; parsing and cleaning the result value field in the indicator array with at least one of the following: parsing the comparison symbols contained in the result value and extracting the corresponding numerical results. Alternatively, retain the qualitative result string and mark the corresponding data type identifier for the result value; perform at least one of the following cleaning and parsing processes on the reference range field in the indicator array: unify the connector format in the reference range, and extract the lower limit and upper limit of the reference range if parsable; perform at least one of the following cleaning processes on the unit field in the indicator array: remove null value markers and redundant whitespace characters; after completing the field cleaning process, for result values ​​of data type numeric, perform interval comparison based on the result value and the corresponding lower limit and upper limit of the reference range to generate an indicator status identifier corresponding to the test item, wherein the indicator status identifier includes at least normal, low and high; for qualitative results of data type non-numerical, perform keyword mapping judgment to cover all indicator statuses.

[0031] When the report type is identified as a medical record or prescription, the set of parallel tasks is executed, including: parsing the text content in the parsed data, extracting the patient's basic information corresponding to the medical document, and obtaining basic information; performing semantic recognition and extraction processing on the medical history-related text in the parsed data to obtain medical history information; parsing and processing the diagnosis and treatment-related text in the parsed data to obtain treatment information; and generating health advice content based on the parsed data as health advice.

[0032] In some embodiments, cascaded adaptive parsing processing is performed on the medical document to obtain parsed data corresponding to the medical document, including: performing OCR recognition on the medical document and performing lightweight markup language formatting processing on the OCR recognition result to obtain formatted data; extracting table structure data and text content from the formatted data to obtain the parsed data.

[0033] Finally, the execution results of the parallel task set are processed by at least one of the following: verification, field repair, and completion; and the processed execution results of the parallel task set are assembled.

[0034] Figure 2 This is another intelligent parsing method for medical documents according to an embodiment of the present invention. Figure 3 The timing diagram for this method is as follows: Figure 2 , 3 As shown, the method includes the following steps:

[0035] Step S202: Obtain the input file.

[0036] Receive medical report files uploaded by users and recognize them as PDFs or images.

[0037] Specifically, after receiving a medical record file to be interpreted from a user-uploaded file or an external interface, the system first performs file type detection to determine the subsequent parsing path. To avoid misjudgment based solely on the file extension (e.g., missing extension, modified extension, or lost during transmission), the system adopts an extension-independent detection method: it reads the first few bytes of the input file's binary data and matches them with preset file header features to complete the type determination. Specifically, if the first 4 bytes read are "%PDF" or match the header features of a PDF file, the input is determined to be a PDF file; if it does not match the PDF features, it is further matched with the magic number features of common image formats (such as JPEG, PNG, etc.). If the match is successful, the input is determined to be an image file; if it still cannot be recognized, the input is classified as "other types" and enters a degradation strategy, such as directly attempting OCR recognition, prompting the user to re-upload a recognizable format file, or transferring the input to an exception handling process, to ensure the system remains usable in complex input scenarios.

[0038] After completing file type detection and determining the processing path, this embodiment performs preprocessing operations on the input file to improve the accuracy and stability of subsequent OCR recognition. For image files or page images obtained by splitting PDFs, the system can first perform rotation correction and skew correction based on the layout detection or text direction detection results to eliminate recognition interference caused by shooting angle, tilt, or inversion. At the same time, for input images with low resolution, high noise, or uneven lighting, the system can perform enhancement processing such as noise reduction and contrast enhancement to improve the distinguishability of text edges, thereby improving the OCR recognition effect on low-quality images. In an optional embodiment, if the input is a multi-page PDF file, the system can split the PDF into multiple page objects by page and perform parallel or pipelined preprocessing and OCR recognition on each page. Then, the recognition results are summarized and merged according to the original page order to improve the overall processing efficiency and ensure the integrity of the output results.

[0039] Step S204: Perform OCR / parsing.

[0040] If the file is a PDF, the PDF parsing or rendering recognition interface is called to obtain the Markdown text and table structure; if the file is an image, the image OCR interface is called to obtain the Markdown text and table structure. The table is parsed from the Markdown structured result returned by the OCR. If the first row of the table might be a header, it is promoted to column names and the column name strings are normalized.

[0041] In this embodiment, the OCR recognition module is used to convert the input medical record file into a structured text result that can be used for subsequent information extraction and intelligent interpretation. After receiving the input file, the system first reads the file content in binary data stream form and uses the aforementioned file type detection mechanism to determine whether the input is a PDF document or an image file. Subsequently, the system selects and calls the corresponding OCR / parsing interface according to the detection result: when the input is a PDF document, the system can perform page parsing or page-level recognition on the PDF; when the input is an image file, the system performs OCR recognition on the image. The output of the OCR / parsing interface is preferably structured text in Markdown format, which may simultaneously contain structured tag information such as body paragraphs, heading levels, lists, and tables. After the OCR output is acquired, the system uses the Markdown structured text as a unified intermediate representation so that subsequent modules can parse and extract in a consistent manner. Furthermore, the system parses the table tags in the OCR output, identifies and extracts the table content separately from the Markdown text to form a table result, so as to achieve separate storage and subsequent parallel processing of text content and table content.

[0042] To improve the usability of the structured table results and the accuracy of subsequent field extraction, the system further performs column name promotion and normalization processing after table extraction. Specifically, when the OCR output table structure has a clearly defined header area, the system preferentially uses the header as the set of column names for the table and establishes the correspondence between column names and column data accordingly. If the table is missing a header, or the OCR result fails to correctly label the header, the system adopts a degradation strategy: by default, the first row of data in the table is promoted to column names, and the remaining rows are treated as data rows, to ensure that the table can still form a parsable column structure.

[0043] After the column names are determined, the system performs normalization processing on the column names to reduce the risk of field matching failures caused by multi-source input, OCR noise, and differences between full-width and half-width characters. The normalization processing may include: removing extra spaces and leading and trailing whitespace in the column names; standardizing the style of brackets; unifying full-width and half-width characters; and removing invisible or control characters.

[0044] Step S206, report type classification.

[0045] The OCR text is input into a large language model, and combined with prompt words and structured output constraints, the primary and secondary categories are output.

[0046] In this embodiment, the intelligent report classification module is used to automatically determine the type of the input report after OCR recognition, thereby identifying its primary and secondary categories and providing a basis for subsequent traffic routing and differentiated parsing strategies. The system first acquires the structured text content of the OCR output and optionally performs truncation or summarization processing based on the input length limit of the large model. For example, the text is limited to a preset length without destroying key semantic information, or highly relevant segments such as titles, key fields, diagnostic descriptions, test item names, and prescription drug information are prioritized to form text input for classification. Subsequently, the system constructs classification prompts, explicitly writing the classification task, category constraints, and output format requirements into the prompts. These prompts include at least: the task is to identify the primary and secondary categories of the report; the primary category is limited to the enumerated set "medical records, prescriptions, test reports, physical examination reports, and others"; the output must be a strict JSON structure for program parsing; and a fault tolerance specification is provided, i.e., when the model cannot determine the category, "other" is output as the default result. These methods improve classification stability and ensure the controllability and executableness of subsequent links.

[0047] For example, the system performs preliminary classification of medical documents based on a multimodal large model. Given text feature vectors... The file is classified as a report type by using the Softmax function. probability :

[0048]

[0049] in For the model to the first The original score of the report. The system selects the category with the highest probability as the report type identifier and triggers the corresponding parallel parsing task. This is set to the preset total number of categories.

[0050] To ensure that the classification results can be stably parsed by the program and directly used for subsequent automated processing, the system constrains and validates the JSON structure of the large model output. Specifically, a JSON schema corresponding to the classification output can be predefined and validated accordingly. For example, `report_type` must be a required field with a value that is one of the preset enumerations, and `report_sub_type` must be a required field and be a string type. At the same time, the output is restricted from containing non-JSON text or missing key fields. When the output fails the schema validation, the system triggers a repair strategy to improve robustness. The repair strategy may include rule repair and secondary prompts: rule repair is used to automatically truncate possible JSON fragments and fill in common format errors such as missing quotation marks or parentheses or remove redundant prefixes and suffixes. Secondary prompts are used to require the model to output only JSON that conforms to the schema and regenerate it for validation again. If the repair and secondary prompts still fail, the system reverts to the default classification to continue the process, such as classifying the report as "other" or, in a specific scenario, reverting to "medical records" to ensure that the overall processing chain is not interrupted.

[0051] If the report type is a test report, execute steps S208 and S210; if it is another type, execute step S208.

[0052] Step S208, parallel information extraction.

[0053] Information extraction comprises two sub-tasks: basic information extraction and health advice generation. Advice generation can employ differentiated prompt templates based on different report types: for medical records / prescriptions, it should focus on diagnosis, symptoms, medication, and examination recommendations; for laboratory reports, it can focus on abnormal indicators, follow-up recommendations, and dietary and lifestyle adjustments; and for physical examination reports, it should emphasize explanations of abnormal items and corresponding medical guidance. A compliance notice must also be added, clearly stating that the above advice is for reference only and cannot replace the diagnostic opinions of a professional physician.

[0054] The information extraction process will be described in detail below for reports of medical records or prescriptions.

[0055] When a report is categorized as a medical record or prescription, the system breaks down the interpretation process into multiple relatively independent subtasks that are executed in parallel. The preferred subtasks include basic information extraction, medical history information extraction, diagnosis and treatment process extraction, and suggestion generation, in order to shorten the overall processing time.

[0056] Figure 4 The diagram shows the flowchart for the parallel extraction of medical records / prescriptions. In this embodiment, after the report intelligent classification module determines the input report as either a "medical record" or a "prescription," the system enters the medical record / prescription processing module, and proceeds as follows... Figure 4The system employs a parallel extraction approach to organize task execution: based on OCR structured text, it simultaneously triggers four sub-tasks—basic information extraction, medical history information extraction, diagnosis and treatment information extraction, and health suggestion generation—to run in parallel. Each sub-task extracts or generates information from different dimensions to shorten overall processing latency and improve the completeness of the output. After each sub-task is completed, the system performs field-level merging and consistency processing on the four outputs to form a unified output object. The details of each sub-task are described below.

[0057] 1) Basic Information Extraction

[0058] In this embodiment, the basic information extraction task is used to extract the basic elements of patients and medical records from OCR text. After parsing the main text paragraphs, header information, and possible table fields, the system extracts basic fields including but not limited to name, gender, age, hospital, department, and record time. The "record time" can be further standardized into a unified date format or Unix timestamp. When some fields are missing in the input text or cannot be reliably identified, the system can return null values ​​and keep the fields in place. Optionally, the system records the source location and confidence level of the fields to improve traceability and fault tolerance.

[0059] 2) Extraction of medical history information

[0060] In this embodiment, the medical history information extraction task is used to extract key content related to medical history from medical records or prescription-related text. The system identifies common medical history paragraph structures, key prompts and semantic clues to organize medical history fields in a structured manner. The extracted fields include, but are not limited to, chief complaint, present illness, past medical history, family history, vaccination history, allergy history, etc.

[0061] 3) Extraction of medical information

[0062] In this embodiment, the diagnostic information extraction task is used to extract diagnostic conclusions, examination and treatment-related information during the medical visit. The system identifies diagnostic descriptions, treatment records, medical orders and examination results from OCR text, and outputs structured fields such as a list of diagnosed diseases, a list of symptoms, a list of drugs, and a list of examination items. At the same time, it can further extract information such as physical examinations, auxiliary examinations, and treatment plans. To facilitate subsequent understanding, the system can normalize diseases / drugs / examination items with the same or different writing styles, and retain the necessary original text evidence or frequency information in the results to improve the reliability and interpretability of the extraction results.

[0063] 4) Health advice generation

[0064] In this embodiment, the health advice generation task is used to generate concise and readable health tips and follow-up suggestions for users without altering the facts of the original medical records. The system generates suggestion text based on disease, symptom, medication, and examination information extracted from the medical records / prescriptions. The length of the suggestion text is configurable (e.g., limited to 150 characters), and the content is required to focus on the diseases / symptoms / examination results explicitly mentioned in the report, emphasizing general and robust health management points such as follow-up visits and check-ups, medication adherence, and lifestyle management. At the same time, it avoids using potentially misleading wording such as "confirmed diagnosis" or "over-inference," ensuring that the output is carefully worded, clearly defined, and suitable for users in various scenarios.

[0065] In this embodiment, after all four parallel subtasks are completed, the system merges their outputs into a unified structured output object according to the field mapping relationship: basic information, medical history information, diagnosis and treatment information and health advice are written into the corresponding fields respectively, and consistency checks and conflict resolution can be performed during the merging stage; the final output object can be provided to the outside world as the medical record / prescription interpretation result for front-end display, user download or interface with downstream systems.

[0066] The following example uses an experience report. When a report is categorized as a physical examination report, the system enters the physical examination report processing module and adopts a relatively simplified processing flow to improve processing speed and robustness while ensuring usability. Specifically, the system breaks down the physical examination report processing into two parallel tasks: Parallel Task A extracts basic information from the OCR structured text, including but not limited to name, gender, age, examination institution / hospital, and examination date, and performs necessary normalization and missing value tolerance on the time field; Parallel Task B uses a large model to extract a "list of abnormal indicator names" from the main text and table content of the physical examination report in one go and generates brief suggestions corresponding to the abnormal items. These suggestions focus on robust expressions such as follow-up reminders, medical advice, and lifestyle management, avoiding inferences beyond the scope of the report's evidence.

[0067] To further improve efficiency and adapt to diverse medical examination templates, the system does not force the parsing and range determination of every value in the medical examination report. Instead, it can selectively parse only key abnormal items or items that are clearly marked as abnormal, thereby reducing the risk of failure due to format differences, missing reference ranges, or OCR noise. After the two types of parallel tasks are completed, the system merges the basic information, the list of abnormal indicator names, and brief suggestions at the field level to form a structured output of the medical examination report for external use.

[0068] In this embodiment, the health advice generation module serves as a general-purpose component, used to output concise, user-oriented advice text based on structured extraction results. It can employ different prompt word templates depending on the report type to ensure content relevance and expression boundaries. Specifically, when the input is a medical record or prescription, the system preferably organizes prompt words around the extracted diagnostic conclusions, symptom descriptions, medication information, and examination / follow-up visit related content, guiding the model to generate advice focusing on medication adherence, follow-up visits, necessary examinations, and lifestyle management. When the input is a test report, the system preferably constructs prompt words around abnormal indicators and their status determination results, emphasizing the explanation of abnormal items, follow-up examinations, and medical reminders, and supplementing with general advice on diet and lifestyle to help users understand the meaning of abnormal indicators and subsequent action directions. When the input is a physical examination report, the system preferably generates brief explanations and medical advice around the list of abnormal item names and verifiable information in the report, avoiding conclusive judgments on unexplained or insufficiently supported evidence.

[0069] To meet compliance and safety requirements, the system uniformly adds a compliance prompt when outputting suggestions, stating that the suggestions are for health management reference only, do not constitute medical diagnosis or treatment plans, and do not replace the professional judgment of doctors. In an optional implementation, the system can also configure the length of the suggestion text, the intensity of the tone, and the level of risk warning to adapt to different product forms and usage scenarios.

[0070] When a report is classified as another type or the model is uncertain, the system can generate only a general summary, provide an unrecognizable prompt, or guide the user to upload clearer and more complete materials to avoid misleading output due to incorrect parsing.

[0071] There is no single way to implement parallel tasks. In different deployment environments, asynchronous I / O combined with thread pools or coroutines can be used to achieve lightweight concurrency. Alternatively, different subtasks can be delivered to multiple consumers for parallel consumption through message queues, or a multi-process / multi-instance horizontal scaling approach can be adopted to support higher concurrency scenarios and larger-scale task processing capabilities.

[0072] Step S210: Three-level cascaded matching and task orchestration.

[0073] Figure 5 The diagram shows a three-stage flowchart for test report processing. In this embodiment, when a report is classified as a test report, the system enters the test report processing module, and proceeds as follows: Figure 5The diagram illustrates a three-stage architecture for structuring and interpreting test data. This architecture sequentially performs table preprocessing, indicator extraction, and parallel auxiliary processing. Table preprocessing unifies diverse tables from different hospitals and equipment into a standardized field system. Indicator extraction generates a computable array of indicators based on the standardized tables and performs field cleaning and status determination. Parallel auxiliary processing, concurrent with indicator extraction, extracts basic information and generates health recommendations, thereby improving overall processing efficiency and output completeness while ensuring the accuracy of the structured data. Figure 5 As shown below, each stage will be described in detail.

[0074] Step S2102, Table preprocessing

[0075] Phase 1 table preprocessing aims to "unify table fields". The system obtains the original table structure from the table list output by OCR and converts it into a computable structured table.

[0076] 1) Matching column names in a three-level cascade.

[0077] To achieve a reliable mapping from "original column name to standard column name", this embodiment employs a three-level cascading column name matching mechanism. This three-level cascading column name matching mechanism includes the following steps:

[0078] First, subprocess A rule matching is executed. The system presets a set of synonyms for each standard column name and performs precise matching. For example, "project name" is associated with synonyms such as "project / inspection project / check project / test project", "result value" is associated with synonyms such as "result / inspection result / measured value / project result", and "reference range" is associated with synonyms such as "reference value / reference interval / biological reference interval / reference". At the same time, corresponding synonym sets are set for fields such as "unit, English abbreviation". The original column names are traversed and mappings are established. It is required that all fields (at least including project name, result value, and reference range) must be matched to pass.

[0079] When the rule matching fails to meet the requirement of complete field integrity, the system proceeds to sub-process B, vector similarity matching. The system generates vector embeddings for the original column names in batches and retrieves the candidates that are most similar to the standard column name vectors from the vector library. If the cosine similarity reaches a threshold (c, for example, 0.8, which is configurable), a mapping is established and the completeness of the required fields is checked again.

[0080] For example, the system semantically vectorizes the original column names to be parsed against the standard column name library. Let the original column name vector be... The standard column name vector is By calculating the cosine similarity between the two To determine semantic consistency:

[0081] in is the dimension of the feature vector. When ( When the preset threshold is 0.8, the system automatically establishes a mapping relationship between the original field and the standard field.

[0082] If vector matching still fails, the system proceeds to the sub-process C Large Language Model (LLM) inference as a fallback. The system extracts the column names, column numbers, and the first N rows of sample data (e.g., 2 rows) from the table to construct prompt words. The model is required to determine the semantics of each column based on the samples and map them to a standard column name enumeration. The output is constrained by JSON Schema. If the number of columns in the model output does not match the number of columns in the table, a padding or truncation strategy is executed to align them. This ensures high accuracy for common formats while also providing generalization capabilities for unknown formats.

[0083] 2) Merge duplicate column names and horizontally parallel blocks.

[0084] To address the common issue of horizontally parallel blocks in inspection reports (such as two or more sets of "Project Name / Result / Reference Range / Unit" columns being horizontally repeated, resulting in duplicate column names, as shown in Table 1), the system further detects the repetition patterns in the column name sequence and identifies the column block demarcation points (such as the position of the second occurrence of the "Project Name" column). Based on this, the original table is divided into multiple column blocks. After standard column name mapping and unified renaming are performed on each column block, the multiple column blocks are vertically joined together in the row direction into a single standard structure. Rows with completely empty rows and rows with required fields being empty are deleted to obtain a standardized table output that can be used for unified calculation and extraction.

[0085]

[0086] Table 1

[0087] In another embodiment, the column names and the first N rows of sample data in the table can be converted into context-enhanced column embedding vectors. These vectors simultaneously include column name semantic vectors, numerical or character distribution features of the first N rows, and adjacent contextual column embedding information. A column similarity matrix is ​​constructed based on these vectors, with matrix elements representing the comprehensive semantic and content similarity between columns. The average similarity between adjacent columns is calculated using a sliding window. Column block boundaries are determined based on the average similarity between adjacent columns and a dynamic threshold. This dynamic threshold is automatically adjusted based on the overall mean and standard deviation of the inter-column similarity to achieve adaptive partitioning for different report sources, different table templates, and multiple sets of duplicate column blocks. Anomaly detection is performed on the partitioned column blocks. When the number of columns in a block is inconsistent with the preset standard number of columns or the column name matching degree is lower than the threshold, a closed-loop correction process is automatically triggered. This closed-loop correction process includes: a) performing vector similarity matching between the column names within the block and the standard column name library to align the column names; b) if vector matching still fails to meet the integrity requirements, a large language model is invoked to infer column semantics based on the column name, column number, and the first N rows of sample data, and then based on JSON... The schema constraints output aligned column names. Finally, all column blocks were vertically concatenated in the row direction after correction, and rows with completely empty rows and rows where required fields were empty were deleted.

[0088] 3) Standardized output of tables

[0089] Ultimately, the standardized table should include at least the following fields: item (project name), item_en (abbreviation), value (result value), ref (reference range), and unit (unit), providing consistent input for the next stage of indicator extraction.

[0090] Step S2104: Indicator extraction and field cleaning.

[0091] As shown in Table 2, there are numerous format variations and noise in the fields of medical test reports. Phase 2 extracts the array of test indicators row by row based on the standardized table, and performs field cleaning and standardization to address the common format variations and noise in medical test reports, thereby improving the reliability of subsequent comparison judgments and suggestion generation.

[0092] Specifically, the system cleans the project name to eliminate the serial number prefix, meaningless symbols, and additional information in parentheses, and unifies the parenthesis style; cleans the English abbreviations to remove the attached Chinese characters, the leading numbers or the remaining serial numbers, and preferably converts them to uppercase for standardized retrieval; performs parsing and type annotation on the result value field, which can identify and split the comparison symbols (such as >, <, ≥, ≤), extracts the numerical value and converts it to a floating-point number when it can be parsed, and at the same time retains the string form of qualitative results such as "negative / positive / normal" and marks the type as string to avoid information loss caused by forced numericalization; normalizes the reference range field to unify the representation form of the connection symbols (such as normalizing ~, —, to, etc. to "-"), and extracts the lower / upper limits to form a computable range when it can be parsed; cleans the unit field to remove the null value mark, control characters, and extra spaces, so as to unify each indicator field to a standardized representation that can be compared, calculated, and traced.

[0093]

[0094] Table 2

[0095] After the system completes the cleaning of the indicator fields, it determines the indicator status. Preferably, it only performs range comparison on the numerical results to obtain interpretable statuses such as "normal / low / high". Specifically, when the result value is numerical and the reference range can be parsed into lower / upper limits, if lower ≤ value ≤ upper, the indicator status is determined to be "normal"; if value < lower, it is determined to be "low"; if value > upper, it is determined to be "high"; when the reference range cannot be parsed (such as missing, abnormally expressed, or only giving a unilateral threshold) or the result value is a string-type qualitative result, the system can set the status to null or mark it as "undetermined" to avoid giving unreliable range judgments when the information is insufficient.

[0096] For example, for the cleaned numerical test results , the system extracts the corresponding lower limit of the reference range and the upper limit , and automatically determines the indicator status and outputs an identifier through the following function :

[0097] This mechanism supports real-time interpretation and abnormal warning of structured data at the medical semantic level.

[0098] Step S2106, parallel auxiliary processing.

[0099] In this embodiment, to improve the completeness and real-time performance of the overall test report output, the system performs auxiliary processing tasks in parallel while performing indicator extraction and status determination. These tasks preferably include two categories: basic information extraction and health suggestion generation. Basic information extraction extracts key information such as name, gender, age, hospital, and report time from the OCR text and performs necessary time standardization and error correction. Health suggestion generation generates explanations and suggestions based on structured abnormal indicators, key test items, and verifiable facts in the report. The suggestions focus on robust expressions such as abnormal item alerts, reminders for follow-up examinations and medical visits, and lifestyle and compliance recommendations, avoiding overdiagnosis or inferences beyond the scope of the report's evidence. Finally, the system integrates and outputs the indicator array, status determination results, basic information, and suggestion text to form a structured interpretation of the test report for the user.

[0100] Step S212: Output the data model.

[0101] In this embodiment, after completing OCR recognition, report classification, traffic routing, and information extraction / suggestion generation of the input report, the system organizes the processing results into a structured output object. The structured output object preferably uses a key-value pair data structure (e.g., JSON or equivalent representation) and employs a combination of "general fields + type-extended fields": general fields describe the basic information and general suggestions required for different report types; type-extended fields carry the differentiated structured content for different report types. Through this unified output data model, the system can output results with a consistent data interface even with diverse input formats and different report types, improving the system's scalability and reusability.

[0102] In this embodiment, the structured output object includes at least the following general fields: a primary report category `report_type` and a secondary report category `report_sub_type`, where the value of `report_type` is limited to one of a preset enumeration set, which includes at least "medical records, prescriptions, laboratory reports, physical examination reports, and others". Additionally, the output object may include basic information fields, including but not limited to name, gender, age, hospital / institution, department, and record_time, where the record time can be standardized into a uniform date format or timestamp format for cross-report alignment and retrieval. Furthermore, the output object includes suggestion text, used to output user-oriented health tips or follow-up recommendations.

[0103] To enhance traceability, in one optional implementation, the output object may also include the OCR raw text (raw_text) and the table raw text or structured table representation (raw_table), used for reviewing the extraction results or for anomaly replay. When the optional field is not enabled or data is missing, the system may not output the field or output an empty value to balance data volume control and traceability requirements. To ensure that the output can be parsed stably, the system preferably requires report_type, report_sub_type, and suggestion to be mandatory fields. When basic information fields cannot be reliably obtained from the input, the system may output an empty value or a default value, and optionally annotate the field source or confidence information, but the present invention is not limited thereto.

[0104] In this embodiment, when a report is determined to be a medical record or prescription, the system further outputs a medical record / prescription extended field, `content`, on top of the general fields. This extended field carries structured information related to medical history and treatment. The `content` may include, but is not limited to: a list of diagnosed diseases (disease), a list of symptoms (symptom), a list of medications (drug), a list of examinations (examine), and fields such as `main_statement`, `cur_disease_history`, and `past_disease_history`. Each list field can be stored as an array, and text fields can be stored as strings. The system can merge the results obtained from parallel extraction tasks into the `content` according to field mapping relationships, maintaining a top-level structure consistent with the general fields so that the caller can parse it in a unified way. When some fields are missing or cannot be confirmed, the system can retain placeholder fields and output null values ​​or empty arrays to avoid parsing failures due to structural inconsistencies. An exemplary output format is given below (for illustrative purposes only and does not constitute a limitation on the field range):

[0105] {

[0106] "report_type": "medical records",

[0107] "report_sub_type": "Outpatient Medical Records",

[0108] "name": "Zhang San",

[0109] "gender": "male",

[0110] "age": 35,

[0111] "hospital": "XXX Hospital",

[0112] "department": "Respiratory Medicine"

[0113] "record_time": 1735603200,

[0114] "content": {

[0115] "disease": ["upper respiratory tract infection"],

[0116] "symptom": ["cough", "sore throat"],

[0117] "drug": ["acetaminophen"],

[0118] "examine": ["complete blood count"],

[0119] "main_statement": "Cough and sore throat for 2 days",

[0120] "cur_disease_history": "…",

[0121] "past_disease_history": "…"

[0122] },

[0123] "suggestion": "..."

[0124] }

[0125] In this embodiment, when a report is determined to be an inspection report, the system outputs a set of inspection indicators based on general fields. This set of indicators can be represented as an array, where each indicator record is an indicator object. Specifically, the indicator object may include, but is not limited to: the standardized item name (item), the original item representation (item_raw) or its English abbreviation (item_en), the result value (value), the result type (type), the unit (unit), the reference range (ref), and the upper and lower limits of the reference range (lower / upper), and may include a status field (status) to represent "normal / high / low / not determined," etc. The following provides an exemplary indicator object structure (for illustrative purposes only and does not constitute a limitation on the range of fields):

[0126] {

[0127] "item": "White blood cell count",

[0128] "item_raw": "WBC",

[0129] "item_en": "WBC",

[0130] "value": 12.3,

[0131] "type": "float",

[0132] "unit": "10^9 / L",

[0133] "ref": "3.5-9.5",

[0134] "lower": 3.5,

[0135] "upper": 9.5,

[0136] "status": "Slightly high"

[0137] }

[0138] Optionally, based on this embodiment, the present invention also provides a variety of scalable implementation methods to adapt to more types of medical document formats and more complex usage scenarios, and the extensions do not change the overall technical framework of the present invention: "input access—OCR structuring—intelligent classification—streaming scheduling—type-based extraction / interpretation—unified output". For example:

[0139] (1) Regarding the expansion of report categories, the system can add new secondary categories to cover more medical report types, such as imaging reports and ultrasound reports, while keeping the existing primary categories unchanged or expanding them as needed. Correspondingly, dedicated parsing strategies, field extraction templates and suggested generation templates can be configured for the newly added secondary categories, thereby realizing the structured interpretation output of the new reports.

[0140] (2) In terms of language capability expansion, the system can introduce multilingual OCR capability and multilingual classification capability, so that the input file can contain other languages ​​besides Chinese. In this implementation, the system can automatically select the corresponding OCR model, classification prompt word template and field normalization rule according to the text language detection results, so as to ensure that the data model structure can still be output in different language scenarios.

[0141] (3) In terms of longitudinal analysis of test reports, the system can further support the merging of multiple reports and trend analysis based on the parsing of a single test report: for example, aligning multiple test results of the same user by time axis, normalizing and merging indicators with the same name or synonym, and outputting trend change information and re-examination reminders based on the merged sequence, thereby providing users with cross-time dimension health observation and management assistance.

[0142] The intelligent interpretation system described in this invention can be presented through mobile applications / mini-programs / web applications. After completing report uploading, OCR recognition, report classification, and segmented parsing, the application displays the interpretation results in a "partitioned card" format to balance readability, traceability, and user operation efficiency. Figures 6 to 8 As shown, the "Routine Blood Test Report" is used as an example to illustrate the presentation logic and user interaction flow of the application page; the example is only used to illustrate the application layer implementation of the present invention and does not constitute a limitation on the interface layout, interaction details or visual style.

[0143] Compared with existing technologies, this invention has the following advantages: 1) Stable cross-format input processing: Stable support for image and PDF input through file type detection and differentiated OCR / parsing interfaces; 2) Semantic-level report classification: Improved classification accuracy for complex documents based on semantic understanding of a large language model; Strong generalization alignment of tables; 3) Adoption of a three-level cascaded column name matching mechanism of "rule matching → vector similarity → LLM inference" to adapt to column name differences between different hospitals / equipment; 4) Significantly improved efficiency: Parallelization of multiple extractions and suggestion generation through asynchronous parallel task scheduling, improving throughput and reducing single response latency; 5) Stable and parsable output: Significantly reduced parsing failures caused by format drift through structured output constraints such as JSON Schema; 6) Good scalability: Modular design facilitates the expansion of new report types and field systems, supporting continuous evolution.

[0144] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for intelligent parsing of medical documents, characterized in that, include: Based on the medical files uploaded by the user, the medical files are subjected to cascaded adaptive parsing processing to obtain the parsing data corresponding to the medical files, and the report type identifier of the medical files is determined based on the parsing data. Based on the report type identifier, construct a set of parallel tasks corresponding to the report type identifier; The set of parallel tasks is executed, and the results are assembled based on the execution results of the set of parallel tasks to obtain the intelligent parsing results of the medical document.

2. The method according to claim 1, characterized in that, Based on the report type identifier, a set of parallel tasks corresponding to the report type identifier is constructed, including: When the report type is identified as medical record or prescription, at least one of the following parallel task sets is constructed: basic information extraction task, medical history information extraction task, diagnosis and treatment information extraction task, and health advice generation task; When the report type is identified as an inspection report, at least one of the following parallel task sets is constructed: the parallel task set includes at least: a series of subtasks consisting of a table preprocessing task and an indicator extraction task, and a basic information extraction task and a health suggestion generation task executed in parallel with the series of subtasks; When the report type is identified as a physical examination report, at least one of the following sets of parallel tasks is constructed: basic information extraction task and joint extraction task of abnormal indicators and health suggestions.

3. The method according to claim 2, characterized in that, When the report type is identified as an inspection report, the set of parallel tasks is executed, including: A three-level cascading column name matching mechanism is adopted to unify the tables in the medical documents from different hospitals and / or different devices into a standard set of fields, forming a computable standardized table; The test items in the standardized table are parsed row by row to extract the index array corresponding to the test items, and the field data in the index array is subjected to normalization and cleaning to obtain a normalized index data set.

4. The method according to claim 3, characterized in that, A three-level cascading column name matching mechanism is used to unify tables from medical documents from different hospitals and / or different devices into a standard set of fields, forming a computable standardized table, including: Perform exact string matching between the original column names in the table and a predefined thesaurus, wherein the original column names must include at least the following required fields: project name, result value, and reference range; If the string matching is successful, a mapping relationship is established between the original column name and the standard column name in the thesynonym mapping dictionary; otherwise, the original column name is vectorized and semantically aligned in the vector database based on the vectorized representation to obtain a standard column name with a similarity of not less than a preset threshold to the original column name. If a standard column name with a similarity of not less than a preset threshold is found, a mapping relationship is established between the original column name and the standard column name in the vector database. Otherwise, sample data is extracted from the table, and the semantic meaning of the original column name in the table is completed and / or truncated using a large language model to obtain the standard column name corresponding to the original column name.

5. The method according to claim 4, characterized in that, After unifying into a standard set of fields, the method further includes: Scan the column name sequence of the standardized table to detect whether there is at least one set of repeated column names; If the repeated column name is detected, the normalized table is horizontally split using the first recurrence position of the repeated column name as the column block dividing point to obtain at least two column blocks with the same column structure. Align the column structures of each column block, and merge each column block vertically along the row direction to generate a long table with a uniform structure; Clean up the data in the long table by deleting all empty rows and rows where required fields are empty.

6. The method according to claim 4, characterized in that, The test items in the standardized table are parsed row by row to extract the corresponding indicator arrays. The field data in the indicator arrays are then subjected to normalization and cleaning processes to obtain a normalized set of indicator data, including: Perform at least one of the following cleaning processes on the project name field in the indicator array: remove leading serial numbers and non-semantic symbols, remove English abbreviations in parentheses or suffixes, and standardize the character format of the project name; Perform at least one of the following cleaning processes on the English abbreviation field in the indicator array: remove Chinese characters, remove leading numbers, and uniformly convert the English abbreviations to a preset uppercase and lowercase format; Perform at least one of the following parsing and cleaning processes on the result value field in the indicator array: parse the comparison symbols contained in the result value, extract the corresponding numerical result or retain the qualitative result string, and mark the result value with the corresponding data type identifier; Perform at least one of the following cleaning and parsing processes on the reference range field in the indicator array: unify the format of the connector in the reference range, and extract the lower limit and upper limit of the reference range if parsable. Perform at least one of the following cleaning processes on the unit field in the indicator array: remove null value markers and redundant whitespace characters; After completing the field cleaning process, for result values ​​of numerical data type, an interval comparison is performed based on the result value and the corresponding lower and upper limits of the reference range to generate an indicator status identifier corresponding to the test item. The indicator status identifier includes at least normal, low and high. For qualitative results of non-numerical data type, keyword mapping is performed to cover all indicator statuses.

7. The method according to claim 2, characterized in that, When the report type is identified as a medical record or prescription, the set of parallel tasks is executed, including: The text content in the parsed data is parsed to extract the patient's basic information corresponding to the medical document, thus obtaining the basic information. Semantic recognition and extraction are performed on the medical history-related text in the parsed data to obtain medical history information; The diagnostic and treatment-related texts in the parsed data are parsed and processed to obtain diagnostic and treatment information; Based on the analyzed data, health advice is generated and presented as health recommendations.

8. The method according to claim 1, characterized in that, The medical file is subjected to cascaded adaptive parsing to obtain the parsed data corresponding to the medical file, including: The medical document is subjected to OCR recognition, and the OCR recognition result is formatted using a lightweight markup language to obtain formatted data; The table structure data and text content are extracted from the formatted data to obtain the parsed data.

9. The method according to claim 1, characterized in that, The result assembly process based on the execution results of the parallel task set includes: The execution results of the parallel task set shall be processed by at least one of the following: verification, field repair, or completion; The execution results of the processed set of parallel tasks are then assembled.

10. An intelligent parsing system for medical documents, characterized in that, include: The parsing module is configured to perform cascaded adaptive parsing on the medical files uploaded by the user, obtain the parsing data corresponding to the medical files, and determine the report type identifier of the medical files based on the parsing data; The task construction module is configured to construct a set of parallel tasks corresponding to the report type identifier based on the report type identifier; The task execution module is configured to execute the set of parallel tasks and perform result assembly processing based on the execution results of the set of parallel tasks to obtain the intelligent parsing results of the medical document.