Respiratory disease interactive processing analysis method and system based on medical record time axis
By constructing an interactive processing and analysis method based on the medical record timeline, we organized and analyzed medical record data of respiratory diseases. Combined with treatment guidelines, this method solved the problems of contextual limitations and insufficient logical reasoning in large language models when processing long medical records, and achieved efficient and accurate auxiliary diagnosis and treatment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-24
- Publication Date
- 2026-04-10
AI Technical Summary
Existing large language models suffer from limitations in context length, lack of time dimension, and insufficient logical reasoning ability when processing long medical records of respiratory diseases, resulting in low accuracy and efficiency in assisted diagnosis and treatment.
By constructing an interactive processing and analysis method based on the timeline of medical records, medical records are organized into key-value pair format, and timeline JSON files are generated. A hierarchical processing architecture is adopted for data parsing and multi-round thinking. Combined with treatment guidelines and real medical record experience, multi-level output is carried out to improve the accuracy and efficiency of diagnosis and treatment.
It achieves efficient medical record processing under the limited context length of a large language model, adds a time dimension, improves the accuracy and efficiency of diagnosis and treatment, can display the complete chain of cause-intervention-outcome, and enhances causal reasoning ability.
Smart Images

Figure CN121835873A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical information processing technology, and in particular to an interactive processing and analysis method for respiratory diseases based on a medical record timeline, and an interactive processing and analysis system for respiratory diseases based on a medical record timeline. Background Technology
[0002] Respiratory diseases, including respiratory infections, chronic obstructive pulmonary disease (COPD), and pneumonia, are common and frequently occurring illnesses. It has been reported that chronic respiratory diseases are the third leading cause of death globally, after cardiovascular diseases and malignant tumors. Early diagnosis and systematic management of respiratory diseases can significantly improve patient prognosis. For patients hospitalized for respiratory diseases, fully utilizing the diverse and heterogeneous clinical time-series data with strong temporal attributes generated during their diagnosis and treatment, and transforming it into a medical knowledge base required for personalized treatment, is fundamental to achieving intelligent assisted diagnosis and ultimately precision medicine. In recent years, large language model technology based on semantic understanding and logical reasoning in the field of artificial intelligence has been considered a key support for realizing the above process. However, currently, the application of large language model technology in the field of respiratory diseases for assisted diagnosis and treatment generally suffers from the following shortcomings:
[0003] (1) There is a lack of real-world case studies of respiratory diseases in my country, and the functions of existing auxiliary diagnosis and treatment systems are limited to guidelines, Q&A, or general knowledge.
[0004] Currently, medical models used for assisted diagnosis and treatment mainly rely on existing general-purpose models (such as Llama, Qwen, and DeepSeek) for fine-tuning using treatment guidelines or building a knowledge base based on treatment guidelines using Retrieval-Augmented Generation (RAG) technology, enabling knowledge-based question answering at the guideline level. However, due to the lack of real-world clinical experience, these models often lack in-depth understanding and reasoning ability when analyzing clinical cases in real-world scenarios, resulting in poor operability, repetitive content, and significant illusions in the question-and-answer content. Especially in the Chinese context, due to the scarcity of privacy settings and processing methods, high-quality real-world medical records of respiratory diseases suitable for assisted diagnosis and treatment are particularly lacking, making it difficult to realize specialized assisted diagnosis and treatment systems for respiratory diseases.
[0005] (2) The length of the medical record text exceeds the limit, which is beyond the processing capacity of the existing language model.
[0006] Patients with chronic and critical respiratory illnesses often have long hospital stays, resulting in exceptionally long medical records, sometimes exceeding one million words, far surpassing the current limitations of large language models' input and output byte counts (context). Excessive context information can lead to anomalies in processing large amounts of input text, such as "Lostin the Middle," where the model remembers the beginning and end well but suffers significant ambiguity or loss of understanding of the majority of information in the middle. The quality of generated content decreases significantly with length, easily leading to repetition, logical inconsistencies, and contradictions. This performance deteriorates further when complex formats (such as Markdown) are required. Computational complexity increases quadratically, resulting in extremely slow inference speeds, very high latency, and explosive memory (GPU) usage, primarily due to the need to cache the entire sequence of key-value pairs (KV Cache), making it highly susceptible to Out of Memory (OOM) errors. Manually truncating the required context can lead to the loss of essential information (case analysis requires a detailed understanding of the patient's past medical history and current course of illness), and the output process cannot guarantee the completeness of the content and the coherence of the meaning.
[0007] (3) Existing large language models and traditional vector-based medical record / guideline knowledge bases are "semantically flattened" and lack a time dimension.
[0008] Current general-purpose large language models (RAGs) generate question-and-answer sequences that largely rely on the co-occurrence relationships of words and concepts, rather than logically clear tree or graph structures. Instead of retrieving data from a structured knowledge base, the model generates a statistically most probable sequence of answers based on language rules learned from training data. In traditional RAG knowledge base architectures, knowledge is transformed into vectors (a set of numbers) and stored in a vector database. During retrieval, the system also transforms user questions into vectors and then searches for the "nearest" knowledge fragments, improving semantic search capabilities. However, this is essentially a distance calculation in a high-dimensional space, similarly lacking an inherent, explicit logical hierarchy and temporal dimension. Both the inherent knowledge of large language models and vectorized knowledge bases excel at capturing semantic relationships of "what," but are weak in clearly expressing logical chains of "why" and temporal sequences of "when," i.e., they generally lack a temporal dimension. This makes it difficult to understand disease evolution and establish reliable temporal logical relationships between various clinical events.
[0009] (4) The fragmented information provided by the knowledge base retrieval is insufficient to reflect the full picture of the medical records, making it difficult for the large language model to fully receive and understand the past experience and shortcomings in the medical records.
[0010] When interacting with a large model using RAG technology, the question-answering system combines prompts with context obtained from knowledge base retrieval and feeds them back to the large model. This approach meets user needs in knowledge base question-answering systems primarily based on guidelines, as guidelines have a high concentration of knowledge points, and the number of characters stored in blocks within the knowledge base can generally cover the corresponding areas of the guidelines relatively completely. However, in free text retrieval of long or very long medical records, the stored content may consist of unrelated modules such as medical orders and lab reports; while effective clinical information is usually hidden in the daily, repetitive records of disease progression (such as new signs appearing that day or ward rounds by senior physicians) and treatments. Therefore, under the existing knowledge base retrieval mechanism, the content submitted after retrieving medical records is mainly fragmented (e.g., containing a large amount of invalid information or only disease descriptions without disease treatment), lacking a dynamic correlation between disease progression and treatment improvement, making it difficult to form a logical chain of "cause-intervention-outcome," and failing to effectively feed past experience back into the current auxiliary diagnosis and treatment process. The fragmented information mentioned above contributes very little to the final answer generated by the large model, making it difficult for the experience generated from previous medical records to effectively assist the current diagnosis and treatment model.
[0011] Therefore, there is an urgent need for a method that can fully process real-world medical records within the limited context length of large language models, make reasonable use of the experience and shortcomings in these records, and combine them with treatment guidelines to improve the current level of diagnosis and treatment, thereby enhancing the practicality of large language models for the auxiliary diagnosis and treatment of respiratory diseases. Summary of the Invention
[0012] To overcome the shortcomings of existing technologies, the technical problem to be solved by this invention is to provide an interactive processing and analysis method for respiratory diseases based on a medical record timeline. This method can construct an interactive intelligent auxiliary diagnosis and treatment system for respiratory diseases based on real medical records, thereby improving the accuracy and practicality of auxiliary diagnosis of respiratory diseases.
[0013] The technical solution of this invention is: an interactive processing and analysis method for respiratory diseases based on a medical record timeline, which includes the following steps:
[0014] (1) Merge and organize the structured, semi-structured and unstructured medical records of a single patient into a text format stored as key-value pairs, and delete irrelevant or repetitive redundant information in the process;
[0015] (2) The text obtained in step (1) is organized into a timeline-based core information JSON file through interaction with the large language model;
[0016] (3) A layered processing architecture is adopted: Timeline data is extracted through a JSON parser, and then the structured fields are converted into natural language descriptions using field mapping rules; a multi-layered metadata system containing basic identifiers, time dimensions, and content features is constructed; data format compatibility is ensured through metadata filtering, and semantic understanding rules in the medical field are adopted to ensure that the output documents meet the requirements of natural language processing and medical professional standards, and finally the structured JSON is processed.
[0017] File parsing, categorized into the vector knowledge base;
[0018] (4) Based on the parameter requirements in the retrieval enhancement RAG, query the timeline knowledge base and return the matching results; according to the parameter settings, input the n timeline medical records with the highest matching degree into the large language model respectively, and perform the first round of single case summary, setting...
[0019] With temperature=0, the large language model performs analysis and summarization entirely based on the input data.
[0020] After collecting and vertically merging the results of the above n timeline case summaries, the summary results are submitted to the large language model via the application programming interface (API) for a second round of reflection and case experience summarization; the returned results will be used as prompt words.
[0021] (5) Based on system prompts and user questions, retrieve the diagnosis and treatment guidelines in the knowledge base separately. After collecting n guidelines based on the search parameters, input them into the large model via API for aggregation and return the results of the large model's guideline parsing.
[0022] (6) Integrate the results of multiple case summaries, combine them with the guideline analysis results, use them together as context, and submit them to the large language model for final question answering along with system prompts. The output content is as follows:
[0023] Summary of previous cases and experiences, summary of guideline recommendations, and comprehensive recommendations.
[0024] Compared with the prior art, the present invention has the following beneficial technical effects:
[0025] 1. It organically combines real-world experience with guidelines, ensuring high credibility and accuracy, and possessing significant promotional value.
[0026] This invention is developed based on real-world clinical experience in respiratory diseases. It can intelligently summarize the experiences and shortcomings from multiple real medical records, and provide comprehensive recommendations after combining them with a guideline knowledge base. It combines theory and practice, has high credibility and accuracy, and can effectively improve the diagnostic and treatment capabilities of primary care physicians.
[0027] 2. Overcome the contextual limitations of large language models in processing extremely long medical records, and improve the efficiency of knowledge base retrieval.
[0028] The diagnostic and treatment timeline method proposed in this invention strips away patients' private information and other redundant data, retaining only key information such as daily new or changing symptoms, the latest test results, corresponding treatment measures, treatment outcomes, etc., significantly reducing the length of medical records. Through multiple rounds of analysis, it intelligently organizes and summarizes experiences and shortcomings from multiple real medical records, further compressing the length of medical records and thus overcoming the contextual limitations of large language models in processing extremely long medical records. This invention achieves multi-dimensional intelligent parsing of medical data, constructing a multi-level metadata system including basic identifiers, time dimensions, and content features. It supports precise retrieval based on multiple conditions such as date, symptom type, and treatment measures, and has the ability to verify the integrity of medical events. It can achieve complete medical narratives containing complete symptoms, treatments, and results in RAG retrieval, with semantic coherence and completeness, improving retrieval efficiency and laying the foundation for summarizing and organizing diagnostic and treatment experience.
[0029] 3. A time dimension has been added, which can show the complete chain of cause-intervention-outcome.
[0030] In the diagnosis and treatment of respiratory diseases, this invention adds a time dimension, that is, it constructs a detailed diagnosis and treatment timeline for each patient, upgrades static medical records into dynamic knowledge, shows the complete chain of etiology-intervention-outcome, and dynamically links the evolution of the disease with the improvement of diagnosis and treatment. This not only solves the core pain point of "lack of temporal context" in the current application of large medical models, but also improves the logical ability of the model for causal reasoning, and effectively feeds back past experience to the current auxiliary diagnosis and treatment process.
[0031] An interactive processing and analysis system for respiratory diseases based on a medical record timeline is also provided, which includes:
[0032] The medical record merging module merges and organizes the structured, semi-structured, and unstructured medical records of a single patient into a text format stored as key-value pairs, while deleting irrelevant or duplicate redundant information in the process.
[0033] The diagnosis and treatment timeline construction module organizes the text obtained by the medical record merging module into a JSON file containing core information based on the timeline through interaction with a large language model;
[0034] The diagnosis and treatment timeline data parsing module adopts a layered processing architecture: it extracts timeline data through a JSON parser, then uses field mapping rules to convert structured fields into natural language descriptions; it constructs a multi-layered metadata system that includes basic identifiers, time dimensions, and content features; it ensures data format compatibility through metadata filtering, adopts semantic understanding rules in the medical field to make the output documents conform to the needs of natural language processing and medical professional standards, and finally parses the structured JSON file and incorporates it into the vector knowledge base;
[0035] The multi-round thinking module in timeline data retrieval queries the timeline knowledge base and returns matching results based on the parameter requirements in the RAG (Research Enhancement Group) generated by the retrieval enhancement. According to the parameter settings, the top n timeline medical records with the highest matching degree are input into the large language model for the first round of single-case summary. Temperature is set to 0, allowing the large language model to analyze and summarize entirely based on the input data. After collecting and vertically merging the results of the summaries of the above n timeline medical records, the summary result is submitted to the large language model via the application programming interface (API) for the second round of thinking and case experience summary. The returned results will serve as prompt words.
[0036] The treatment guideline parsing module retrieves treatment guidelines from the knowledge base based on system prompts and user queries. After collecting n guidelines based on the search parameters, it passes them to a large model via API for aggregation and returns the results of the large model's guideline parsing.
[0037] The multi-level output module integrates the results of multiple case summaries, combines them with the model's question-and-answer results, and uses them together as context. These, along with system prompts, are submitted to the large language model for final question-and-answer processing. The output includes: summaries of past cases and experiences, summary of guideline recommendations, and more.
[0038] Recommendations are accepted. Attached Figure Description
[0039] Figure 1 A flowchart of an interactive processing and analysis method for respiratory diseases based on a medical record timeline according to the present invention is shown.
[0040] Figure 2 A flowchart illustrating the organization and integration of the diagnosis and treatment timeline according to the present invention is shown.
[0041] Figure 3 A flowchart of the interactive intelligent assisted diagnosis and treatment according to the present invention is shown. Detailed Implementation
[0042] like Figure 1 As shown, this interactive processing and analysis method for respiratory diseases based on the medical record timeline includes the following steps:
[0043] (1) Merge and organize the structured, semi-structured, and unstructured medical records of a single patient into a text format stored as key-value pairs, deleting irrelevant or redundant information during the process; Output format: For example, for patient 001, organize their medical record content into "Gender: Male; Age:
[0044] 60; Primary diagnosis: Lung infection” format, merge and store into one large medical record text:
[0045] “001.txt”.
[0046] (2) The text obtained in step (1) (such as “001.txt” above) is organized into a JSON file of core information based on the timeline through interaction with the large language model;
[0047] (3) Adopt a layered processing architecture: extract timeline data through a JSON parser, and then use field mapping rules to convert structured fields into natural language descriptions; construct a multi-layered metadata system that includes basic identifiers, time dimensions, and content features; ensure data format compatibility through metadata filtering; adopt semantic understanding rules in the medical field to make the output documents meet the needs of natural language processing and medical professional standards; and finally parse the structured JSON file and incorporate it into the vector knowledge base.
[0048] (4) Based on the parameter requirements in the retrieval enhancement RAG, query the timeline knowledge base and return the matching results; according to the parameter settings, input the n timeline medical records with the highest matching degree into the large language model respectively, and perform the first round of single case summary, setting...
[0049] With temperature=0, the large language model performs analysis and summarization entirely based on the input data.
[0050] After collecting and vertically merging the results of the multi-case summaries across the above n timelines, the results are submitted to the large language model via the application programming interface (API) for a second round of reflection and case experience summarization; the returned results will serve as prompt words.
[0051] For example:
[0052] The preset prompt words are:
[0053] f"""
[0054] You are a professional medical expert, skilled at extracting key information from medical record timelines and generating clear disease progress summaries. Based on the following patient's disease progress timeline, please provide a summary for the patient...
[0055] {patient_id} generates a concise and clear summary of the patient's medical history.
[0056] Patient query: {query}
[0057] Disease progression timeline:
[0058] {timeline_text}
[0059] Please generate a professional and clear summary of the patient's medical history, including:
[0060] 1. Timeline of disease progression
[0061] 2. Main diagnostic and treatment measures
[0062] 3. Disease prognosis
[0063] 4. Key treatment milestones and efficacy evaluation
[0064] Please reply in Chinese, keeping it professional and easy to understand:
[0065] """
[0066] The prompt words are constructed as follows:
[0067] Please summarize the following medical history information from {len(patient_summaries)} patients concisely and accurately:
[0068] {patient_summary_text} Please pay special attention to: the timeline of disease progression, major diagnostic and treatment measures, disease outcome, key treatment milestones, and effectiveness evaluation.
[0069] """
[0070] (5) Based on system prompts and user questions, retrieve the diagnosis and treatment guidelines in the knowledge base separately. After collecting n guidelines based on the search parameters, input them into the large model via API for aggregation and return the model's question and answer results.
[0071] (6) Integrate the results of multiple case summaries, combine them with the guideline analysis results, use them together as context, and submit them to the large language model for final question answering along with system prompts. The output content is as follows:
[0072] Summary of previous cases and experiences, summary of guideline recommendations, and comprehensive recommendations.
[0073] Compared with the prior art, the present invention has the following beneficial technical effects:
[0074] 1. It organically combines real-world experience with guidelines, ensuring high credibility and accuracy, and possessing significant promotional value.
[0075] This invention is developed based on real-world clinical experience in respiratory diseases. It can intelligently summarize the experiences and shortcomings from multiple real medical records, and provide comprehensive recommendations after combining them with a guideline knowledge base. It combines theory and practice, has high credibility and accuracy, and can effectively improve the diagnostic and treatment capabilities of primary care physicians.
[0076] 2. Overcome the contextual limitations of large language models in processing extremely long medical records, and improve the efficiency of knowledge base retrieval.
[0077] The diagnostic and treatment timeline method proposed in this invention strips away patients' private information and other redundant data, retaining only key information such as daily new or changing symptoms, the latest test results, corresponding treatment measures, treatment outcomes, etc., significantly reducing the length of medical records. Through multiple rounds of analysis, it intelligently organizes and summarizes experiences and shortcomings from multiple real medical records, further compressing the length of medical records and thus overcoming the contextual limitations of large language models in processing extremely long medical records. This invention achieves multi-dimensional intelligent parsing of medical data, constructing a multi-level metadata system including basic identifiers, time dimensions, and content features. It supports precise retrieval based on multiple conditions such as date, symptom type, and treatment measures, and has the ability to verify the integrity of medical events. It can achieve complete medical narratives containing complete symptoms, treatments, and results in RAG retrieval, with semantic coherence and completeness, improving retrieval efficiency and laying the foundation for summarizing and organizing diagnostic and treatment experience.
[0078] 3. A time dimension has been added, which can show the complete chain of cause-intervention-outcome.
[0079] In the diagnosis and treatment of respiratory diseases, this invention adds a time dimension, that is, it constructs a detailed diagnosis and treatment timeline for each patient, upgrades static medical records into dynamic knowledge, shows the complete chain of etiology-intervention-outcome, and dynamically links the evolution of the disease with the improvement of diagnosis and treatment. This not only solves the core pain point of "lack of temporal context" in the current application of large medical models, but also improves the logical ability of the model for causal reasoning, and effectively feeds back past experience to the current auxiliary diagnosis and treatment process.
[0080] Preferably, in step (1), batch processing and merging are performed using Python or R.
[0081] Preferably, step (2) includes the following sub-steps:
[0082] (2.1) Set prompt words for interaction with the large language model;
[0083] For example:
[0084] f"""
[0085] You are a professional medical information analyst. Please carefully analyze the following patient's inpatient medical records and extract the timeline of key medical events arranged chronologically.
[0086] #Output Requirements:
[0087] - Sort by specific date, each date must contain the following fields:
[0088] -`date`: The date the event occurred (format: year-month-day).
[0089] -`symptom`: Describe in detail the newly appearing symptoms or signs (such as "discovery of a breast lump", "nausea and vomiting"), or the patient's presentation as recorded in the medical record; examinations or tests performed (such as ultrasound, CT, MRI, complete blood count, biochemistry, coagulation, microbiology, infection markers, immunology, pathology, etc.), display the name of all examinations, only show the specific numbers of abnormal indicators, and do not show the specific numbers of normal results;
[0090] -`diagnoses`: The diagnosis made (e.g., "Admission diagnosis: breast nodule", "Pathological diagnosis: invasive ductal carcinoma", "Revised diagnosis: breast cancer", "Discharge diagnosis: breast cancer").
[0091] -`Physician_order`: This field lists the following procedures or operations performed (e.g., radical mastectomy, central venous catheterization), the start or discontinuation of a medication (e.g., starting epirubicin + cyclophosphamide chemotherapy, administering ondansetron for antiemetic purposes). Only list the category: core drug name, such as: anti-infectives: piperacillin / tazobactam; acid suppression: omeprazole; diuretics: furosemide; nutritional support: TPN; albumin supplementation: human serum albumin; etc. Information such as solvent / volume / dosage / compatibility / pump rate / tubing / flush / single-use (st) is not allowed.
[0092] -`result`: The outcome of treatment (e.g., "improvement", "worsening", "reduction of edema", "voluntary discharge", "discontinuation of treatment", "transfer to another hospital").
[0093] -`discharge_instruction`: Detailed instructions given upon discharge.
[0094] - Output only a plain JSON array, without any additional explanation or text. #Event type definition:
[0095] #Special Note:
[0096] - All times are only up to the "day", not the hour, minute and second. If the "year-month-day" is consistent, it is considered to be the same day.
[0097] - If the time is on the day of admission, in addition to the content already recorded in `discharge_instruction`, also record "Day 1 of admission".
[0098] - If the time is the day of discharge, in addition to the information already recorded in `discharge_instruction`, also record "Discharge Date."
[0099] - If the extracted time occurred before admission, in addition to the content already recorded in `discharge_instruction`, also record "This is a pre-admission medical history".
[0100] - If the relative time cannot be determined, please try to infer or mark it as "Time Unknown".
[0101] -Supplementing with albumin is not nutritional support; it's simply called "albumin supplementation: human serum albumin".
[0102] - If multiple records are found on the same day, merge them into one day.
[0103] Now, please analyze the following medical records:
[0104] "{text}"
[0105] """
[0106] (2.2) Divide the long text into multiple paragraphs and send them to the large language model for processing via API;
[0107] (2.3) Merge the files into a JSON file and output it.
[0108] Preferably, step (2.2) includes the following sub-steps:
[0109] (2.2.1) Use a fixed-length segmentation method based on the length of the large language model context in the local server;
[0110] (2.2.2) Ensure that the splits are made at natural breaks, preferably at the end of the paragraph; if this is not possible, try splitting at the end of the sentence; if this is not possible, split at word boundaries and preserve overlapping areas to ensure contextual coherence.
[0111] (2.2.3) Sort the timeline results returned by the API by date and then merge them;
[0112] (2.2.4) Standardize the dates in the merged timeline, find the first event that contains the first day of admission as the admission baseline, and then update all subsequent times to the form of the day of admission;
[0113] Merge events from the same day again; assign dates prior to day 1 as past events.
[0114] Preferably, in step (6), the output content is displayed and the results are updated in real time using WebSocket technology.
[0115] This invention can be deployed and run in the following scenarios:
[0116] Clinical Decision Support System (CDSS);
[0117] Electronic medical record analysis platform for respiratory and critical care medicine departments / emergency departments / intensive care units;
[0118] Multimodal medical question-answering system (combining image and text);
[0119] A training system to assist resident physicians or interns in the preliminary diagnosis of respiratory diseases;
[0120] Training system for specialist physicians in assisted respiratory and critical care medicine;
[0121] A diagnostic platform for primary healthcare institutions.
[0122] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium. When executed, the program includes the steps of the methods of the above embodiments. The storage medium can be ROM / RAM, magnetic disk, optical disk, memory card, etc. Therefore, corresponding to the method of the present invention, the present invention also includes an interactive processing and analysis system for respiratory diseases based on a medical record timeline. This system is typically represented in the form of functional modules corresponding to the steps of the method. The system includes:
[0123] The medical record merging module merges and organizes the structured, semi-structured, and unstructured medical records of a single patient into a text format stored as key-value pairs, while deleting irrelevant or duplicate redundant information in the process.
[0124] The diagnosis and treatment timeline construction module organizes the text obtained by the medical record merging module into a JSON file containing core information based on the timeline through interaction with a large language model;
[0125] The diagnosis and treatment timeline data parsing module adopts a layered processing architecture: it extracts timeline data through a JSON parser, then uses field mapping rules to convert structured fields into natural language descriptions; it constructs a multi-layered metadata system that includes basic identifiers, time dimensions, and content features; it ensures data format compatibility through metadata filtering, adopts semantic understanding rules in the medical field to make the output documents conform to the needs of natural language processing and medical professional standards, and finally parses the structured JSON file and incorporates it into the vector knowledge base;
[0126] The multi-round thinking module in timeline data retrieval queries the timeline knowledge base and returns matching results based on the parameter requirements in the RAG (Research Enhancement Group) generated by the retrieval enhancement. According to the parameter settings, the top n timeline medical records with the highest matching degree are input into the large language model for the first round of single-case summary. Temperature is set to 0, allowing the large language model to analyze and summarize entirely based on the input data. After collecting and vertically merging the results of the summaries of the above n timeline medical records, the summary result is submitted to the large language model via the application programming interface (API) for the second round of thinking and case experience summary. The returned results will serve as prompt words.
[0127] The treatment guideline parsing module retrieves treatment guidelines from the knowledge base based on system prompts and user questions. After collecting n guidelines based on the search parameters, it passes them to a large model via API for aggregation and returns the results of the guideline parsing from the large model.
[0128] The multi-level output module integrates the results of multiple case summaries, combines them with the model's question-and-answer results, and uses them together as context. Together with system prompts, these are submitted to the large language model for final question-and-answer processing. The output content includes: summaries of past cases and experiences, summary of guideline recommendations, and comprehensive recommendations.
[0129] Preferably, the medical record merging module uses Python or R for batch processing and merging.
[0130] Preferably, the diagnosis and treatment timeline construction module includes:
[0131] The settings unit configures the prompt words that interact with the large language model;
[0132] The segmentation unit divides long texts into multiple paragraphs, which are then sent to a large language model for processing via API.
[0133] The output unit merges the files into a JSON file and outputs it.
[0134] Preferably, the segmentation unit performs the following steps:
[0135] (2.2.1) Use a fixed-length segmentation method based on the length of the large language model context in the local server;
[0136] (2.2.2) Ensure that the splits are made at natural breaks, preferably at the end of the paragraph; if this is not possible, try splitting at the end of the sentence; if this is not possible, split at word boundaries and preserve overlapping areas to ensure contextual coherence.
[0137] (2.2.3) Sort the timeline results returned by the API by date and then merge them;
[0138] (2.2.4) Standardize the dates in the merged timeline, find the first event that contains the first day of admission as the admission baseline, and then update all subsequent times to the form of the day of admission;
[0139] Merge events from the same day again; assign dates prior to day 1 as past events.
[0140] Preferably, in the multi-level output module, the output content is displayed, and the results are updated and fed back in real time via WebSocket.
[0141] To better illustrate the present invention, the following two embodiments demonstrate the specific workflow of the system in the task of assisted diagnosis of respiratory diseases.
[0142] Example 1: Organizing and integrating the diagnosis and treatment timeline
[0143] By specifying the hospitalized patient information for a particular respiratory disease, all text data for that patient is entered into this system (or accessed through the information technology department interface). After being processed by various modules, it is integrated into the timeline knowledge base, as detailed below:
[0144] 1. Initialize the configuration and logging system, and retrieve medical records and organize them into key-value pairs.
[0145] Based on the actual configuration, medical record text can be obtained in two ways: directly obtaining JSON format through a data interface and exporting multi-source heterogeneous documents. Both types of text are further processed into key-value pairs, as shown in the following example:
[0146] Patient ID: 39984;
[0147] [Basic Information]; Age: 26; Gender: Female; Admission Time: (omitted); Discharge Time: (omitted); [Beginning of Basic Data]; Department: Respiratory and Critical Care Medicine; [End of Basic Data];
[0148] [Electronic Medical Record Begins]; Admission Diagnosis: Pulmonary Infection; Treatment Course:; ECG Monitoring: None; Oxygen Administration: No Oxygen Administered; Drug Treatment:; Intravenous Infusion: None; Treatment Process: Temperature Monitoring, Symptomatic Cooling Treatment Administered; Pathogen Examination: Novel Coronavirus Nucleic Acid Test: Negative; Condition at Discharge: Improved; Present Illness: The patient reported developing a fever 1 day prior without any obvious cause, with a maximum temperature of 37.8℃, without chills, accompanied by cough with phlegm that was difficult to expectorate, and shortness of breath, without chest pain, abdominal pain, diarrhea, or other discomfort. The patient presented to our hospital's fever emergency department. A complete blood count (CBC) on September 25, 2021 showed: white blood cell count 7.85*10^9 / L, neutrophil count 5.66*10^9 / L, monocyte count 0.65*10^9 / L (↑), neutrophil percentage 72.1%, lymphocyte percentage 14.4% (↓), red blood cell count 4.77*10^12 / L, hemoglobin 134g / L, and rapid C-reactive protein 11.34mg / L (↑). A chest CT scan showed ground-glass opacities in the right middle lobe. The patient was admitted for COVID-19 infection screening. Past medical history: none; Chief complaint: fever and cough for 1 day; Physical examination: temperature 37.5℃, heart rate 76.0 bpm, respiratory rate 20 breaths / min, blood pressure 109 / 75 mmHg; oxygen saturation (breathing air): 99%. ; Mental status: lucid, drowsy, confused, delirious, lethargic, comatose; Other specialist examinations: ; Discharge diagnosis: Lung infection, not consistent with COVID-19 infection. ; If classified as a confirmed case of COVID-19 infection: Mild case, moderate case, severe case; Discharge instructions and precautions: ; 1. Rest, close contacts should seek medical attention promptly if they have similar symptoms; ; 2. Continue oral anti-infective medication, outpatient follow-up in 1 week; ; 3. Follow up if feeling unwell; Chief complaint: Fever with cough for 1 day; Present illness: The patient reported developing fever 1 day ago without obvious cause, with a maximum temperature of 37.8℃, without chills, accompanied by cough with phlegm that is difficult to expectorate, accompanied by shortness of breath, without chest pain, abdominal pain, diarrhea, or other discomfort. The patient presented to our hospital's fever emergency department. A complete blood count (CBC) on September 25, 2021 showed: white blood cell count 7.85*10^9 / L, neutrophil count 5.66*10^9 / L, monocyte count 0.65*10^9 / L (↑), neutrophil percentage 72.1%, lymphocyte percentage 14.4% (↓), red blood cell count 4.77*10^12 / L, hemoglobin 134g / L, and rapid C-reactive protein 11.34mg / L (↑). A chest CT scan showed ground-glass opacities in the right middle lobe of the lung. The patient was admitted for COVID-19 infection screening. Past medical history: none; Physical examination: temperature 37.5℃, heart rate 76.0 bpm, respiratory rate 20 breaths / min, blood pressure 109 / 75 mmHg; oxygen saturation (breathing air): 99%. Consciousness: Alert; Admission diagnosis: Lung infection; Treatment course:; Condition at discharge: Improved; Discharge diagnosis: Lung infection, not consistent with COVID-19 infection.If the case is a confirmed case of novel coronavirus infection and the classification is mild; discharge instructions and precautions: 1. Rest, close contacts should seek medical attention promptly if they have similar symptoms; 2. Continue oral anti-infective drugs, and have a follow-up outpatient visit in 1 week; 3. Follow up if feeling unwell; actual hospital stay (days): 1; outpatient (emergency) diagnosis: lung infection; whether there is a plan to be readmitted within 31 days of discharge: 1; discharge method: 1; condition upon admission: 1; date of diagnosis after admission: (omitted); discharge Hospital's primary diagnosis: Pulmonary infection; [Start of medical record]; Date: (omitted); Record name: Diagnostic certificate; Medical record: Gender: Female; Age: 26; Admission date: (omitted); Admitting department: Department of Respiratory and Critical Care Medicine; Discharge department: Department of Respiratory and Critical Care Medicine; Discharge date: (omitted); Single disease management: No; Clinical diagnosis: Pulmonary infection J98.402; Other diagnoses: Pulmonary infection; Recommendations:; See discharge record for details; [End of medical record].
[0149] 2. Check the length of the medical record and segment it.
[0150] Based on the preset text length, such as 20,000 characters (set according to the context length of the large language model in the configuration environment), set the text segmentation criteria and check whether the length of the above inpatient medical record exceeds the preset length; if it does, split it into several segments; otherwise, do not split it.
[0151] 3. Organizing large language models
[0152] Each segment (assuming the total text length exceeds the preset length) is sent to the large language model via a standard API interface, organized according to the relevant prompts in the diagnosis and treatment timeline construction module, and the results are returned vertically (sorted by date).
[0153] 4. Timeline standardization
[0154] The first event containing "Day 1 of Admission" was identified as the admission baseline, and all subsequent dates were updated to the format "Day X of Admission." Events on the same day were then merged again. Dates prior to Day 1 were assigned the value "Past Medical History." The final timeline data is as follows:
[0155]
[0156] 5. Intelligent analysis and integration of timeline data
[0157] The intelligent parsing module for the treatment timeline data (structured JSON file) was invoked to read, parse, and validate the aforementioned timeline JSON file, extract field logic rules (extracting date, symptoms, medical orders, outcomes, and discharge summaries), and construct a natural language description strategy. The results are shown below:
[0158] Original JSON event → "Symptoms: Fever, cough. Prescription: Anti-infective: Ceftriaxone. Outcome: Improved. Discharge instructions: Day 1 of admission"
[0159] Simultaneously, basic metadata fields are constructed, and the metadata is standardized and filtered to ensure Chroma-compatible formats. Finally, a Documents object is created, and the medical record is added to the document list for RAG retrieval when the question-and-answer module starts.
[0160] Example 2: Intelligent Case Analysis and Assisted Diagnosis
[0161] This system can also be embedded in community hospitals or CDSS systems. Doctors input case details, and the system retrieves, summarizes, and reasons through a process, returning conclusions and treatment suggestions via a web interface. The following is a specific example:
[0162] 1. Input and Assisted Diagnosis System Initialization
[0163] The doctor entered the following case to be answered on the interactive platform:
[0164] Case Analysis: The patient is a 48-year-old male. He has experienced shortness of breath after exertion for over two years. He has a history of lower extremity deep vein thrombosis. Physical examination: T 36.5℃, HR 95 bpm, RR 21 bpm, BP 115 / 85 mmHg. He is alert and oriented. Breath sounds are clear bilaterally, without any dry or wet rales. P2 > A2. Mild edema in both lower extremities. D-dimer level is 0.45 mg / L. Echocardiography showed: 1. Enlarged right atrium and right ventricle; 2. Severely elevated pulmonary artery pressure (estimated pulmonary systolic pressure 113 mmHg); 3. Moderate tricuspid regurgitation; 4. Dilation of the main pulmonary artery and its branches. Pulmonary CTA showed multiple webbed and eccentric mural filling defects in the right pulmonary trunk, interlobar arteries, upper lobe proximal segment, and middle and lower lobe pulmonary arteries. What is the likely progression of his condition? How should it be managed?
[0165] After input, the case is first passed to the jieba module in the RAG service for preprocessing, which extracts keywords, removes stop words, and retains key medical terms.
[0166] 2. Timeline data retrieval and multi-round thinking process
[0167] Based on the preset parameters in the RAG search, the system queries the timeline knowledge base using the aforementioned split medical terminology and returns matching results. According to the parameter settings, the top 5 timeline case data (e.g., 5) with the highest matching scores are input into the large language model via the standard API for the first round of single-case summarization. Temperature is set to 0 to ensure the large language model analyzes and summarizes entirely based on the input data. After summarization, the results of the 5 single-case summaries are collected and vertically merged. This summary result is then resubmitted to the large language model via API for the second round of reflection and case experience summarization. The returned summary result (denoted as "case experience") is saved.
[0168] 3. The process of retrieving knowledge from the clinical practice guidelines.
[0169] Based on the medical terminology segmented above, the system queries the guideline knowledge base, collects 5 pieces of guideline evidence, and then inputs them together with the case into the large model via API for analysis and summarization, returning the guideline parsing results of the large model (denoted as "guideline knowledge").
[0170] 4. A multi-level output process integrating multi-case analysis and guideline analysis.
[0171] The system sends case studies, medical experience, and guideline knowledge to the large model via API and generates final recommendations.
[0172] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention shall still fall within the protection scope of the present invention.
Claims
1. An interactive processing and analysis method for respiratory diseases based on a medical record timeline, characterized by: It includes the following steps: (1) Merge and organize the structured, semi-structured and unstructured medical records of a single patient into a text format stored as key-value pairs, and delete irrelevant or repetitive redundant information in the process; (2) The text obtained in step (1) is organized into a timeline-based core information JSON file through interaction with the large language model; (3) Adopt a layered processing architecture: extract timeline data through a JSON parser, and then use field mapping rules to convert structured fields into natural language descriptions; construct a multi-layered metadata system that includes basic identifiers, time dimensions, and content features; ensure data format compatibility through metadata filtering; adopt semantic understanding rules in the medical field to make the output documents meet the needs of natural language processing and medical professional standards; and finally parse the structured JSON file and incorporate it into the vector knowledge base. (4) Based on the parameter requirements in the retrieval enhancement RAG, query the timeline knowledge base and return the matching results; according to the parameter settings, input the n timeline medical records with the highest matching degree into the large language model respectively, and perform the first round of single case summary, setting... With temperature=0, the large language model is analyzed and summarized entirely based on the input data. After collecting and vertically merging the results of the summaries of the above n timeline medical cases, the summary results are submitted to the large language model through the application programming interface (API) for a second round of reflection and case experience summarization. The returned results will be used as prompt words; (5) Based on system prompts and user questions, retrieve the diagnosis and treatment guidelines in the knowledge base separately. After collecting n guidelines based on the search parameters, input them into the large model via API for aggregation and return the model's question and answer results. (6) Integrate the results of multiple case summaries, combine them with the guideline analysis results, use them together as context, and submit them to the large language model for final question and answer along with system prompts. The output content is: summary of previous cases and experience, summary of guideline recommendations, and comprehensive recommendations.
2. The interactive processing and analysis method for respiratory diseases based on medical record timeline according to claim 1, characterized in that: In step (1), Python or R is used to batch process and merge the de-anonymized medical record data.
3. The interactive processing and analysis method for respiratory diseases based on medical record timeline according to claim 2, characterized in that: Step (2) includes the following sub-steps: (2.1) Set prompt words for interaction with the large language model and organize medical records according to timeline information; (2.2) Divide the long text into multiple paragraphs and send them to the large language model for processing via API; (2.3) Merge the files into a JSON file and output it.
4. The interactive processing and analysis method for respiratory diseases based on medical record timeline according to claim 3, characterized in that: Step (2.2) includes the following sub-steps: (2.2.1) Use a fixed-length segmentation method based on the length of the large language model context in the local server; (2.2.2) Ensure that the splits are made at natural breaks, preferably at the end of the paragraph; if this is not possible, try splitting at the end of the sentence; if this is not possible, split at word boundaries and preserve overlapping areas to ensure contextual coherence. (2.2.3) Sort the timeline results returned by the API by date and then merge them; (2.2.4) Standardize the dates in the merged timeline, find the first event that contains the first day of admission as the admission baseline, and then update all subsequent times to the day of admission; merge the events of the same day again; assign the dates before the first day to the past history.
5. The interactive processing and analysis method for respiratory diseases based on medical record timeline according to claim 4, characterized in that: In step (6), the output content is displayed, and the results are updated in real time using WebSocket technology.
6. An interactive processing and analysis system for respiratory diseases based on a medical record timeline, characterized in that: It includes: The medical record merging module merges and organizes the structured, semi-structured, and unstructured medical records of a single patient into a text format stored as key-value pairs, while deleting irrelevant or duplicate redundant information in the process. The diagnosis and treatment timeline construction module organizes the text obtained by the medical record merging module into a JSON file containing core information based on the timeline through interaction with a large language model; The diagnosis and treatment timeline data parsing module adopts a layered processing architecture: it extracts timeline data through a JSON parser, then uses field mapping rules to convert structured fields into natural language descriptions; it constructs a multi-layered metadata system that includes basic identifiers, time dimensions, and content features; it ensures data format compatibility through metadata filtering, adopts semantic understanding rules in the medical field to make the output documents conform to the needs of natural language processing and medical professional standards, and finally parses the structured JSON file and incorporates it into the vector knowledge base; The multi-round thinking module in timeline data retrieval generates parameters in the RAG based on the enhanced retrieval parameters, queries the timeline knowledge base and returns matching results. According to the parameter settings, the n timeline medical records with the highest matching degree are input into the large language model for the first round of single case summary. The temperature is set to 0 so that the large language model analyzes and summarizes entirely based on the input data. After collecting and vertically merging the results of the above n timeline medical record summaries, the summary result is submitted to the large language model through the application programming interface (API) for the second round of thinking and case experience summary. The returned results will be used as prompt words; The clinical practice guideline parsing module retrieves clinical practice guidelines from the knowledge base based on system prompts and user questions. After collecting n guidelines based on the search parameters, it passes them to a large model via API for aggregation and returns the guidelines parsing results from the large model. The multi-level output module integrates the results of multiple case summaries with the results of the treatment guideline analysis module, using them together as context and system prompts to submit to the large language model for final question and answer. The output content includes: a summary of past cases and experience, a summary of guideline recommendations, and comprehensive recommendations.
7. The interactive processing and analysis system for respiratory diseases based on a medical record timeline according to claim 6, characterized in that: The medical record merging module uses Python or R to batch process and merge records.
8. The interactive processing and analysis system for respiratory diseases based on medical record timeline according to claim 7, characterized in that: The diagnosis and treatment timeline construction module includes: The settings unit configures the prompt words that interact with the large language model; The segmentation unit divides long texts into multiple paragraphs, which are then sent to a large language model for processing via API. The output unit merges the files into a JSON file and outputs it.
9. The interactive processing and analysis system for respiratory diseases based on a medical record timeline according to claim 8, characterized in that: The segmentation unit performs the following steps: (2.2.1) Use a fixed-length segmentation method based on the length of the large language model context in the local server; (2.2.2) Ensure that the splits are made at natural breaks, preferably at the end of the paragraph; if this is not possible, try splitting at the end of the sentence; if this is not possible, split at word boundaries and preserve overlapping areas to ensure contextual coherence. (2.2.3) Sort the timeline results returned by the API by date and then merge them; (2.2.4) Standardize the dates in the merged timeline, find the first event that contains the first day of admission as the admission baseline, and then update all subsequent times to the day of admission; merge the events of the same day again; assign the dates before the first day to the past history.
10. The interactive processing and analysis system for respiratory diseases based on a medical record timeline according to claim 9, characterized in that: The multi-level output module displays the output content and updates the results in real time using WebSocket technology.