Electronic medical record LLM generation method based on animal injury

By employing speech recognition and semantic anchor pool generation methods for animal injury medical scenarios, this approach addresses the insufficient context modeling in existing technologies, enabling efficient and accurate generation and compliance verification of electronic medical records, thereby enhancing the automation and security of animal injury medical records.

CN121237293APending Publication Date: 2025-12-30GUANGZHOU WUCHUAN ELECTRONIC TECHNOLOGY CO LTD +1
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202511442190.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-10
Publication Date
2025-12-30

AI Technical Summary

Technical Problem

Existing technologies in animal injury medical scenarios suffer from insufficient context modeling capabilities, strong static syntactic dependencies, lack of semantic anchor utilization, and weak clinical logic verification, resulting in inaccurate electronic medical record generation and delayed information filling, which affects clinical safety and standardization.

Method used

By collecting voice signals from doctor-patient dialogues and performing speech recognition and standardized text generation, a semantic anchor pool is generated. Using the semantic anchor pool, enhanced input text is generated, and prompt word templates containing semantic anchoring-logical deduction structures are designed to guide the large language model to extract context-sensitive relationships and perform clinical logic rule verification to generate compliant electronic medical records.

Benefits of technology

It enables accurate extraction and context awareness of semantic information in dynamic medical scenarios, improves the automation rate and compliance of electronic medical record generation, reduces manual intervention and rework time, lowers the probability of logical conflict events, and improves the clinical usability and security of medical records.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121237293A_ABST
    Figure CN121237293A_ABST
Patent Text Reader

Abstract

The invention discloses an electronic medical record LLM generation method based on animal injury, which realizes dialogue structuring and timestamp synchronization through multistage speech recognition and role affiliation. Using standardized medical term mapping and coding to align the free text to a standardized medical entity, and constructing a high-confidence medical entity network based on a semantic anchor point pool; according to the method, context-sensitive entity relationship extraction is realized by combining a large language model and a semantic enhancement template, a high-accuracy structured relationship chain is generated through clinical logic rule set verification, and finally, an electronic medical record template under diagnosis and treatment specifications is automatically filled and privacy desensitization processing is completed. The semantic consistency, the structural accuracy and the data security of automatic generation of the electronic medical record are improved, and standardization and intelligent circulation of medical information are effectively promoted.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of medical artificial intelligence and electronic medical record structuring, and in particular relates to an electronic medical record LLM generation method based on animal injury. BACKGROUND

[0002] In the current technical field of medical artificial intelligence and electronic medical record structuring, facing animal injury and related clinical scenarios, various methods of automatic generation of electronic medical records and extraction of medical entity relationships have emerged. The mainstream solution usually includes: using natural language processing (NLP) technology to perform entity recognition on doctor-patient conversation text, extracting medical record structured fields based on rules or statistical models, and using large language models (LLM) to perform information summarization and relationship reasoning of multiple rounds of doctor-patient conversation; However, due to the fact that patient complaints, doctor follow-up, medical history and other information in dynamic medical conversation scenarios may be scattered in different rounds, the correct identification of the relationship between entities highly depends on complex context modeling. The existing technology still has the following shortcomings: (1) Limited context modeling capability: Many models only focus on single round or adjacent round information, making it difficult to capture complex semantic dependencies, resulting in difficulty in accurately inferring "cross-round", "multiple mentions" and "context indicative relationships"; (2) Strong static syntax dependency: The mainstream extraction method relies on syntax dependency trees, rule templates or short text embeddings, and the historical semantic anchor points in dynamic conversation flow are not fully utilized, which may cause information loss or relationship misjudgment; (3) Lack of utilization of semantic anchors: For entities such as allergy history and complaints that repeatedly appear and affect treatment plans, existing systems lack mechanisms to actively identify and dynamically call, and cannot achieve context penetration and reasoning reinforcement of key semantics; (4) Weak clinical logic verification: Although entity, relationship triples can be automatically generated, they often do not match clinical logic (such as "no allergy history but drug allergy is prompted"), which may cause potential errors in medical record structured information, affecting clinical safety and data standardization; (5) Structured medical record filling lag: In the context of multiple rounds of complex conversation, entity relationship chains are often incomplete or semantically broken, resulting in missing information such as complaints and medical history, reducing the clinical value and standardization of automatic electronic medical records. SUMMARY

[0003] The present application provides an electronic medical record LLM generation method based on animal injury to solve the above technical problems.

[0004] The technical solution of the present application is as follows: an electronic medical record LLM generation method based on animal injury, comprising: S1: Collect the voice signal of the doctor-patient conversation, and convert the voice signal into text data through a voice recognition engine to generate a timestamped conversation turn division result; S2: Perform medical terminology standardization processing on the text data, map the unstructured expression to the standard terminology defined in the Common Animal Injury Treatment and Diagnosis Specification (2021 Edition), and generate a correspondence table between the term code and the original text; S3: Based on the standard terms appearing in the historical conversation turns and their frequencies, a semantic anchor pool is constructed, which contains high-confidence medical entities and their context association information; S4: The text of the current conversation turn is spliced with the entities and relationships in the semantic anchor pool to generate an enhanced input text, and a prompt word template containing a semantic anchor-logic derivation structure is designed to guide the large language model to perform context-sensitive relationship extraction; S5: The enhanced input text is input into the large language model to perform the medical entity relationship extraction task, and the preliminary structured relationship chain containing entity-relation-entity triplets is output; S6: Based on the preset clinical logic rule set, the structured relationship chain is checked to identify and filter relationship triplets with semantic conflicts or logical contradictions, and a high-confidence final structured relationship chain is generated; S7: Map the final structured relationship chain to the corresponding fields of the electronic medical record template to complete the automatic filling of key information such as chief complaint, history of present illness, past history, and allergy history, and generate a structured electronic medical record document that meets the requirements of the Common Animal Injury Treatment and Diagnosis Specification (2021 Edition); S8: After the electronic medical record is generated, privacy information detection and desensitization processing is performed to identify and replace sensitive fields such as patient identification and contact information in the text, and generate a desensitized electronic medical record output result.

[0005] The animal injury-based electronic medical record LLM generation method provided by the present application has the following beneficial effects: (1) The present application extracts and standardizes important semantic information such as patient complaints and doctor follow-up questions in different temporal turns, and constructs a high-confidence semantic anchor pool. Innovatively, the current conversation is semantically aligned with the high-frequency diagnosis and treatment terms in history, solving the problem of insufficient context awareness of traditional single sentence / static syntax dependent relationship extraction for cross-turn and long-distance dependence, making the entity relationship discrimination more accurate; (2) The “semantic anchoring-logical deduction” prompt word structure designed in this invention explicitly integrates key historical diagnostic elements (chief complaint, allergy history, previous medications, etc.) as reasoning anchors into the LLM input process, effectively avoiding the problem of missing or misjudging important relationships due to context omissions. This explicit anchoring mechanism is particularly applicable in dynamic medical consultation scenarios, giving the model similar expert-level traceability and inference capabilities, and improving the model's rapid adaptation to changes in semantic background; (3) This invention, through standardized processes of entities and relationships, and automated processing steps such as verification and desensitization, can efficiently and seamlessly map free-flowing spoken dialogues into standard structured medical record templates. The automation rate of the entire electronic medical record generation process is significantly improved. The compliance verification and desensitization process ensures the compliance and privacy security of medical records, reducing manual intervention and rework time; (4) This invention effectively identifies and eliminates semantically contradictory and logically incomplete relation triples through a comprehensive verification mechanism of clinical rules and confidence levels, preventing medical risks caused by model misjudgment and improving the clinical usability and security of structured data. Compared with traditional entity relation extraction, it significantly reduces the probability of logical conflict events. Attached Figure Description

[0006] Fig. 1 This is a flowchart of an electronic medical record (LLM) generation method based on animal injury according to the present invention; Fig. 2 This is a sub-flowchart of an electronic medical record (LLM) generation method based on animal injury according to the present invention; Fig. 3 This is another sub-flowchart of the present invention for a method of generating an electronic medical record (LLM) based on animal injury. Detailed Implementation

[0007] To make the objectives and advantages of the present invention clearer, the present invention will be further described below with reference to embodiments; it should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.

[0008] Preferred embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.

[0009] When used herein, the singular forms of “a,” “an,” and “the” may also include the plural forms unless the context clearly indicates otherwise. It should also be understood that the terms “comprising / including” or “having,” etc., specify the presence of the stated features, wholes, steps, operations, components, parts, or combinations thereof, but do not preclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, components, parts, or combinations thereof. Meanwhile, the term “and / or” as used in this specification includes any and all combinations of the associated listed items.

[0010] Please see Figs. 1-3 As shown, a method for generating an electronic medical record (LLM) based on animal-induced injury includes: S1: Collect the voice signal of the doctor-patient dialogue, and convert the voice signal into text data through the voice recognition engine to generate the dialogue round division result with timestamp; S2: Perform medical terminology standardization processing on the text data, map the unstructured expression to the standard terms defined in the "Common Animal Injury Treatment Guidelines (2021 Edition)", and generate a correspondence table between terminology codes and the original text; S3: Based on the standard terms and their frequency that appear in the historical dialogue rounds, construct a semantic anchor pool, which contains high-confidence medical entities and their contextual association information; S4: Concatenate the text of the current dialogue turn with the entities and relations in the semantic anchor pool to generate enhanced input text, and design prompt word templates containing semantic anchoring-logical deduction structures to guide the large language model to extract context-sensitive relations. S5: Input the enhanced input text into the large language model, perform the task of extracting relationships between medical entities, and output a preliminary structured relationship chain containing entity-relation-entity triples; S6: Based on a preset set of clinical logic rules, the structured relationship chain is verified, and relationship triples with semantic conflicts or logical contradictions are identified and filtered to generate a final structured relationship chain with high confidence. S7: Map the final structured relationship chain to the corresponding fields of the electronic medical record template, complete the automatic filling of key information such as chief complaint, present illness, past medical history, and allergy history, and generate a structured electronic medical record document that meets the requirements of the "Guidelines for the Diagnosis and Treatment of Common Animal Injuries (2021 Edition)". S8: After the electronic medical record is generated, perform privacy information detection and desensitization processing, identify and replace sensitive fields such as patient identification and contact information contained in the text, and generate desensitized electronic medical record output results.

[0011] Step S1: Collect the voice signal of the doctor-patient dialogue, and convert the voice signal into text data through a speech recognition engine to generate a dialogue turn segmentation result with timestamps. Specifically, this includes: S1.1: Perform noise reduction and speech endpoint detection processing on multi-channel audio signals in doctor-patient dialogue scenarios to improve the signal-to-noise ratio of speech recognition and determine sentence boundaries; For multi-channel audio signals in doctor-patient dialogue scenarios, the raw voice data collected into the system as input needs to be optimized for signal quality first to ensure the accuracy and robustness of the subsequent speech recognition stage. An adaptive spectral subtraction algorithm (parameters: spectral smoothing factor α=0.98, noise estimation update coefficient β=0.8) is used to perform frequency domain noise reduction on the audio of each channel, thereby dynamically estimating non-stationary background noise and reducing noise components. Furthermore, by using a multi-channel beamforming algorithm (Delay-and-Sum Beamforming, parameters: sampling rate Fs=16kHz, beam pointing angle 0°), the spatial information of different channels is used to enhance the target speaker signal and suppress interference from non-target sources in space, thereby improving the signal-to-noise ratio (SNR). Furthermore, bandpass filtering (filtering range: 300Hz~3400Hz) is employed to suppress low-frequency environmental noise and high-frequency unwanted components, retain the effective frequency band required for clear speech, and reduce the interference of unnecessary spectral components on endpoint detection. Furthermore, an endpoint detection algorithm combining short-time energy and zero-crossing rate (window length 20ms, frame shift 10ms, energy threshold Te=0.4×Emax, zero-crossing rate threshold Tz=0.6×Zmax) is used to perform temporal analysis on the denoised audio, thereby achieving accurate localization of the start and end points of the speech. Furthermore, by combining the endpoint decision method based on spectral entropy, secondary speech segment boundary correction is performed on the short-time energy and zero-crossing rate decision results to ensure that the sentence boundaries can still be accurately defined in the complex acoustic environment unique to medical scenarios, such as pauses, interruptions, and soft voices. By using the above noise reduction and speech endpoint detection processing methods, the original multi-channel audio signal is converted into a denoised effective speech segment and its start and end time index, so as to realize high-precision input preparation for the subsequent speech recognition module. For example, in an outpatient dialogue application scenario involving two sound sources (doctor and patient) and background air conditioning noise, the acquisition system records dual-channel audio signals at a sampling rate of 16kHz and a quantization precision of 16bit. First, adaptive spectral subtraction is performed on the signal with a spectral smoothing factor of 0.98 and a noise estimation update coefficient of 0.8. After noise reduction, the SNR is improved from the original 12dB to 22dB. Then, delay-summated beamforming is applied. Assuming the distance between the two microphones is d = 0.08m and the speed of sound is c = 343m / s, the delay compensation calculation formula is as follows: Where θ is the beam pointing angle of 0°, the delay compensation time for the two channels is approximately 0ms, and the directional gain of the synthesized signal reaches 6dB. A 300Hz~3400Hz bandpass filter is applied to the beamforming output, with a filter order of 64 and a stopband attenuation greater than 60dB. Then, using a short-time energy threshold Te=0.4×Emax=0.4×0.35=0.14, a zero-crossing rate threshold Tz=0.6×Zmax=0.6×0.12=0.072, and a spectral entropy threshold of 0.85, endpoint detection and boundary correction are performed. This results in 12 accurately segmented effective speech segments from continuous dialogue, each with a start and end timestamp error of less than 5ms, ensuring direct use by the ASR model in stage S1.2. In actual verification, the speech segment recognition accuracy of this processing chain is improved by approximately 15% compared to the un-denoised version, significantly improving the stability of medical dialogue speech-to-text conversion. S1.2: Based on the speech segments after endpoint detection, a pre-trained end-to-end speech recognition model is used to perform acoustic-language joint modeling and decoding on the speech signal to generate a preliminary text sequence; Based on the valid speech segments after endpoint detection, a pre-trained end-to-end speech recognition model (architecture: Transformer-Transducer, acoustic feature dimension 80, language model fusion weight λ=0.3) is used to perform acoustic-language joint modeling and decoding on the speech signal to generate a preliminary text sequence. The Mel frequency cepstral coefficients (MFCC) feature extraction method (parameters: window length 25ms, frame shift 10ms, number of Mel filter banks 80) is used to perform frame-level feature processing on the speech segments after endpoint segmentation, so as to realize the speech feature representation in the time-frequency domain. Furthermore, a spatial-frequency pattern enhancement process is performed on the frame-level features using a fully convolutional neural network (VGG-like CNN, with a kernel size of 3×3 and a three-level progression of 64 / 128 / 256 channels) to extract robust local acoustic pattern embeddings, thereby reducing the perturbation of feature distribution by noise in the medical scene. Furthermore, a multi-layer Transformer encoder (12 layers, 512 hidden units, 8 self-attention heads, and 2048 feedforward layers) is employed to perform global context modeling on the convolutionally enhanced feature sequence, capturing long-range dependency information across time steps and generating context-sensitive acoustic representation vectors. ; Furthermore, a dual-decoder structure based on Transformer-Transducer is constructed, where the prediction network uses historically identified label sequences. Generate a prediction representation from the input. Joint networks utilize nonlinear mappings. Output the conditional probability distribution of each time-label pair. The following loss function is used for optimal path alignment optimization: in, For the set of all possible alignment paths, For acoustic time step index, For tag step indexing; Furthermore, the trained end-to-end ASR model is applied to the medical speech sequence after endpoint detection, and combined with the online language model score re-scoring mechanism (LM weight λ=0.3, dictionary coverage ≥99%), the decoding accuracy of colloquial medical terms is improved. Through this acoustic-language joint modeling decoding chain, the high SNR effective speech segments obtained in the previous step are converted into preliminary text sequences synchronized with the original timeline, achieving high-accuracy output of medical scenario dialogue transcription. For example, in outpatient dog bite consultations, 80-dimensional MFCC features (window length 25ms, frame shift 10ms) are extracted from 12 valid speech segments (average length 3.5 seconds, sampling rate 16kHz) processed by S1.1 endpoint detection. These features are then processed by a VGG-like three-layer convolutional network and input into a 12-layer Transformer encoder to generate an acoustic representation matrix. The prediction network takes a historical label sequence as input with a length ranging from [1, 15] and outputs a predicted representation. The conditional probability distribution is calculated via a joint network, and the alignment path set is used. The dynamic programming algorithm in the code optimizes the loss function. During the online decoding stage, a customized medical 4-gram language model (99.3% coverage) is integrated for score re-scoring. The final word error rate (CER) on the test set is 2.8%, with an average end-to-end latency of 150ms. The generated preliminary text sequence fully retains key information such as "whether rabies vaccine has been administered" and "whether there is a penicillin allergy," and can be seamlessly integrated with the subsequent punctuation and speaker annotation module in S1.3. Each text segment in the output includes start and end timestamps, with a timestamp error of less than ±5ms, meeting the accuracy requirements for real-time transcription and structured processing of medical dialogues. S1.3: Perform punctuation restoration and doctor / patient role attribution annotation on the initial text sequence to obtain a structured text stream with speaker identifiers; S1.4: Based on speaker identifiers and voice timestamp information, perform dialogue turn segmentation on the structured text stream to generate text segments divided by turn and their corresponding start and end timestamp sets; S1.5: Perform integrity verification and timeline alignment optimization on the timestamped dialogue turn division results to ensure temporal continuity and contextual consistency between turns, forming standardized text input that can be used for subsequent semantic analysis.

[0012] Step S2: Perform medical terminology standardization processing on the text data, mapping unstructured expressions to standard terms defined in the "Common Animal Injury Treatment Guidelines (2021 Edition)," and generating a correspondence table between terminology codes and the original text. Specifically, this includes: S2.1: Preprocess the medical entity representations in the speech recognition text data, and normalize and clean the unstructured expressions based on regular expressions and rule dictionaries to remove repetitive, ambiguous and redundant expressions and generate standardized text corpus. The structured text stream containing doctor-patient consultation content output from the S1 main step is used as input. A method combining regular expression matching and rule dictionary retrieval is adopted (parameters: regular expression pattern set size M≥200, rule dictionary size N≥5000) to realize the formatted detection and extraction of unstructured medical entity representations. Furthermore, by using pattern rules built from the regular expression pattern library for common animal species, injured parts, symptom descriptions, drug names, etc., fragments in the text that conform to specific character patterns, position patterns, and semantic patterns are quickly located and segmented to obtain a preliminary list of entity candidates. Furthermore, a rule-based dictionary matching algorithm (based on a Trie tree index structure, with an upper limit of B=256 for the number of node branches) is used to perform dictionary exact matching and longest matching priority filtering on the above entity candidates. Combined with a thesaurus (coverage ≥95%), synonym expressions are unified to generate a preliminary normalized entity result set. Furthermore, a context-window-based ambiguity resolution strategy (window size w=5 words) is used to calculate the mutual information between candidate entities and context keywords. The formula is: in, For entities With context The joint probability, and Each value represents a marginal probability. Based on the mutual information value, the semantic rationality of the entity in the context is determined, and values ​​below a threshold are excluded. Candidate entities are eliminated; Furthermore, the remaining entities are deduplicated using a duplicate detection algorithm (based on SimHash text fingerprint, fingerprint length 64 bits, similarity threshold S=0.9), eliminating the same entity that appears repeatedly in different rounds or different expressions, thus ensuring the uniqueness of the entity list; Through the above-mentioned regular expression matching, dictionary alignment, contextual ambiguity resolution and duplication correction processing methods, the ASR output text of the previous step is transformed into a standardized medical entity text corpus with unified format, eliminated ambiguity and no redundancy, so as to realize the accurate input preparation for subsequent terminology standardization mapping. For example, in a dog bite consultation scenario, the input text "I was bitten on the hand by a big yellow dog yesterday, it bled badly, and I got a tetanus shot; I'm allergic to penicillin" is processed. First, "bitten by a big yellow dog" is detected based on a regular expression pattern, and "big yellow dog" is uniformly mapped to "dog" based on a dictionary, with the entry corresponding to ICD animal category A92. Rule matching is used to match "tetanus shot" to the standard term "tetanus vaccine," and "penicillin allergy" is aligned with "penicillin-type drug allergy" in synonym normalization. Mutual information between "tetanus vaccine" and the context "bleeding" is calculated based on a context window (5 words in length). The similarity between "dog bite" and "being bitten by a dog" was 0.93, which was higher than the threshold of 0.9, so only the normalized expression of "dog bite" was retained. The final output normalized text corpus was: "dog bite", "tetanus vaccination", "penicillin allergy". This result was accurately used in the subsequent terminology encoding in S2.2 and semantic anchor construction in S3. S2.2: Construct a standard terminology dictionary based on the "Common Animal Injury Treatment Guidelines (2021 Edition)". The standard terminology dictionary includes medical entities corresponding to structured fields such as chief complaint, present illness, past medical history, and allergy history, as well as their ICD-10 codes or treatment guidelines codes, to form a mapping system between terms and codes. S2.3: Perform term matching task on the cleaned standardized text corpus. Based on the edit distance algorithm and semantic similarity model, perform term alignment on the medical entity descriptions in the original text to identify candidate terms that match the standard terminology dictionary. S2.4: A term mapping strategy based on contextual semantic enhancement is used to perform semantic verification of candidate terms in local contexts and to use pre-trained language models such as BERT to calculate the semantic relevance between candidate terms and context in order to select semantically consistent matching terms. S2.5: Perform term encoding annotation on the text data after term mapping is completed, bind the successfully matched standard terms with their corresponding ICD-10 codes or treatment specification codes, and generate a correspondence table between term codes and original text to support subsequent semantic anchor pool construction and context-sensitive relation extraction.

[0013] Step S3: Based on the standard terms and their frequency appearing in historical dialogue rounds, a semantic anchor pool is constructed. This semantic anchor pool contains high-confidence medical entities and their contextual information. For example... Fig. 2 As shown, it specifically includes: S3.1: Perform term frequency statistics processing on the correspondence table between the term codes output by S2 and the original text to obtain the frequency of occurrence of each standard term in the dialogue history; S3.2: Based on the statistical results of term frequency, standard terms that appear more frequently than a preset threshold are selected to form a high-frequency term candidate set in order to identify key entities with diagnostic orientation in the dialogue; For the frequency statistics of each standard term output from step S3.1 in the historical dialogue, a frequency threshold filtering algorithm is used (e.g., setting a threshold). This allows for the initial filtering of standard terms; Furthermore, by configuring threshold parameters Experience values ​​related to the diagnosis and treatment scenario, such as Extract all occurrences The standard terminology is used to form a candidate entity set for high-frequency terms; Based on the statistical results, each standard term is sequentially evaluated using a Boolean judgment to determine whether it meets the threshold requirement, employing the following judgment formula: in, For the first The frequency of occurrence of standard terms in the history of the dialogue Candidate identifier; Furthermore, for all The standard terms are used to perform a set merging operation to generate a high-frequency term candidate set. ; By using high-frequency term candidate sets It operates on the original terminology encoding and text correspondence table to achieve preliminary identification of diagnostic key entities in the dialogue history; This step can significantly improve the coverage of key entities in subsequent tasks such as terminology context extraction and anchor pool construction. For example, for a single historical doctor-patient dialogue record, set The frequency statistics of the terms {"dog bite": 3, "swelling": 1, "penicillin allergy": 2, "rabies vaccine": 1} were filtered using Boolean discrimination to obtain a candidate set of high-frequency terms that met the criteria: {"dog bite", "penicillin allergy"}. This candidate set was then prioritized in the subsequent contextual sliding extraction and anchor confidence scoring stages. With this parameter configuration, key terms are retained, which helps to accurately identify core diagnostic elements such as the chief complaint and allergy history, resulting in a higher-frequency term candidate set. ={“dog bite”, “penicillin allergy”}, which meets the key entity identification requirements in animal-inflicted injury scenarios; S3.3: For each standard term in the high-frequency term candidate set, perform context window sliding processing to extract its text context in several rounds before and after the dialogue rounds in order to construct a semantic association graph of term context. For high-frequency term candidate sets Each standard term in the document employs a context window sliding algorithm based on round index (parameter: window radius). (round), to achieve the previous position of the target term in the dialogue history. Wheel and rear Text fragment extraction from each round to capture semantic dependency information across rounds; Furthermore, a method combining text concatenation and sentence segmentation within the window is used (the sentence segmentation rules cover the size of the punctuation mark set). This enables the semantic unitization of the original context statement and generates a sequence of semantic units. This provides node granularity for subsequent semantic graph construction; Furthermore, based on the co-occurrence relationship between terms and context units, a term-context adjacency matrix is ​​constructed. , of which elements Defined as a term With semantic units The co-occurrence frequencies, after normalization To quantify the strength of the association; Furthermore, TF-IDF weight adjustment is performed on the normalized adjacency matrix using the following formula: in For semantic units Inverse document frequency weighting in the global dialogue corpus is used to reduce the noise impact of high-frequency meaningless context. Furthermore, the weighted adjacency matrix is ​​input into the graph construction module, generating a graph with term nodes and context semantic nodes as vertices and weights... semantic association graph of terminology context for edge attributes This graph fully characterizes the contextual semantic distribution features of terms in multi-turn dialogues; Through the above-mentioned context window sliding and graph construction processing methods, the multi-round contextual features of high-frequency terms are transformed into structured graph data with quantifiable correlation, realizing the orderly storage of term association information in dynamic medical contexts and the usability of subsequent semantic similarity modeling. For example, in the high-frequency term candidate set Below, for the term "penicillin allergy", set the window radius. Extract the original text from the context of its appearance in the 5th round of the historical dialogue [rounds 3 and 7], such as round 3: "The condition is stable after the tetanus shot," round 4: "Have there been any adverse reactions to the medication?", round 6: "Can cephalosporins be used?", round 7: "Previously mentioned penicillin allergy." Segment the text within the window to obtain... ={“Condition stable after tetanus shot”, “Have there been any adverse drug reactions?”, “Can cephalosporins be used?”, “Previously reported penicillin allergy”}. Construct an adjacency matrix by calculating the co-occurrence frequency of terms and semantic units. ,like The values ​​are {1, 1, 1, 2}, after normalization ={0.5,0.5,0.5,1.0}. Calculate each [value] based on the global corpus. of Values, such as {0.8, 0.7, 0.9, 0.6}, yield the weights. ={0.4,0.35,0.45,0.6}. The results are used to construct a term context semantic association graph, forming a weighted graph structure with "penicillin allergy" as the central node, connected to four context semantic nodes with weights of 0.4, 0.35, 0.45, and 0.6 respectively. This graph structure provides accurate input for the context-aware vector representation of terms in subsequent graph neural network embedding calculations. S3.4: Based on the semantic association graph of term context, calculate the semantic similarity between each term and its context, and use a graph neural network model to perform graph embedding representation of term-context relationship to obtain context-aware vector representation of term; The term context semantic association graph constructed based on step S3.3 As input, a semantic similarity calculation method based on vertex-edge structure is used (parameter: similarity metric type). =cosine similarity), to realize the semantic similarity measurement calculation between term nodes and context semantic nodes; Furthermore, by analyzing each term node in the graph... and its directly connected context nodes Extract semantic representation vectors based on TF-IDF weights and Calculate the cosine similarity: in, For the term With context semantic similarity value, This represents the vector dot product operation. The vector magnitude; Furthermore, the similarity matrix is ​​normalized (range [0,1]) and used as the initial edge weight matrix for the graph neural network (GNN). ; Furthermore, a Graph Convolutional Network (GCN) is employed (parameter: number of convolutional layers). Hidden layer dimensions Node feature embedding computation is performed on the term-context graph to achieve context-aware representation of term nodes. The GCN update formula is: in, For adjacency matrices with self-loops, for The corresponding degree matrix, For the first Layer node feature matrix For the first Layer trainable weight matrix, It is a non-linear activation function (such as ReLU); Furthermore, based on the GCN embedding results, global average pooling is used to enhance the representation of term nodes after multiple convolutions. Transform into a fixed-length context-aware vector representation This is used to quantify the semantic embedding state of the term within the overall dialogue history context; Through the semantic similarity calculation and GCN graph embedding processing methods described above, the structured association information between terms and context is transformed into a computable context-aware vector, enabling the construction of high-precision input features for subsequent term confidence scoring and semantic anchor selection. For example, in the high-frequency term candidate set In the semantic association graph of term context, let the term node {“penicillin allergy”} be associated with the context node. The TF-IDF vector corresponding to "Can cephalosporins be used?" is: and ,calculate The similarity of all term-context pairs is padded into a matrix and normalized as follows: Input two layers of GCN ( Perform convolutional embedding to obtain the context-aware vector of the term "penicillin allergy". Its L2 norm normalized value is 1.0, which allows it to be directly incorporated into the S3.5 confidence scoring model, achieving an improvement in term selection accuracy of no less than 12%. S3.5: Based on the context-aware vector representation of the terms, combined with the term frequency and contextual semantic richness, perform term confidence scoring processing, filter terms with confidence scores higher than a set threshold, and construct a semantic anchor pool to serve as context enhancement input for subsequent relation extraction tasks.

[0014] Step S4: Concatenate the text of the current dialogue turn with the entities and relations in the semantic anchor pool to generate enhanced input text, and design prompt word templates containing semantic anchoring-logical deduction structures to guide the large language model in context-sensitive relation extraction. For example... Fig. 3 As shown, it specifically includes: S4.1: Perform context window truncation processing on the text of the current dialogue turn to extract context information related to the current dialogue turn, thereby enhancing the semantic integrity of the input text; In this sub-step, the input data is the timestamped dialogue round division results and standardized medical terminology mapping information output by step S3. The goal is to extract a continuous text window containing contextual information within the current dialogue round so as to provide complete semantic support in subsequent relation extraction. A context window truncation algorithm based on timestamps and round indices is adopted (parameter: window radius). (Unit: rounds), enabling expansion forward and backward from the current dialogue round. Text content extraction in each round; Furthermore, by performing role separation and matching processing on the extracted original context text (parameters: role labels are doctor D and patient P), the doctor's consultation text and the patient's response text are independently preserved and indexed and bound, so as to maintain the role consistency and logical structure of the context semantics; Furthermore, a semantic relevance pruning algorithm (based on the BERT embedding model, threshold) is employed. Semantic filtering is performed on the extracted context fragments, removing those with a semantic similarity lower than that of the core entity in the current round. Remove non-critical information and retain highly relevant segments to enhance context density; Furthermore, multi-granularity sentence segmentation is performed on the semantically filtered context (rules cover the punctuation set). (Including periods, commas, semicolons, question marks, exclamation marks, and pauses), breaking long sentences down into complete semantic subunits. This is to facilitate subsequent alignment and splicing with the semantic anchor pool; Furthermore, through a context weight allocation model, for Each sub-unit is calculated in relation to the central entity of the current round. semantic weight : in, Embed cosine similarity for BERT, Satisfy normalization constraints ; By using context window capture, semantic filtering, sentence segmentation and weight allocation, the standardized terms and timestamp data from the previous step are transformed into a structured and weighted set of context semantic units, thereby enhancing the semantic integrity and relevance of the input text. For example, in an animal-injury scenario, let's say the current round is round 8, and the core entity is "penicillin allergy". Text is extracted from rounds [6,10]. After indexing, the doctor's question "Have you used this type of drug before?", the patient's answer "Penicillin causes rashes", and other context are obtained. BERT embedding is used to calculate similarity, assuming similarity with the core entity. The values ​​are {0.92, 0.87, 0.45}, and the threshold is... The first two sentences are retained. The retained sentences are divided into four sub-units, and their weights are calculated: (e.g.) The value is {0.92, 0.87, 0.61, 0.75}, then The output context unit set and weights are: {(u1,0.28),(u2,0.27),(u3,0.19),(u4,0.23)}, which can be directly used for semantic anchor alignment operations in S4.2. During the verification phase, the context coverage rate is improved to 93%, and the relation extraction accuracy is improved by 8% compared to the no-context mode. S4.2: Based on the high-confidence medical entities and their contextual association information stored in the semantic anchor pool, perform entity matching and context alignment operations to identify semantic anchors related to the current dialogue round, thereby constructing a context-aware semantic association network; In this sub-step, the input data is the weighted set of context semantic units output from step S4.1. and the corresponding weights And the semantic anchor pool output by step S3.5, which contains high-confidence medical entities. and its context-aware vector ; A method based on multimodal semantic vector matching is adopted (parameter: similarity metric type). =cosine similarity), to calculate the semantic similarity between context units and anchor entities, and generate a similarity matrix. Its elements are defined as ; Furthermore, a threshold filtering algorithm is used (parameter: matching similarity threshold). ), to achieve matrix The binarization process forms a matching indicator matrix. ,in Represents context unit With anchor point entity Match successful. Indicates a mismatch; Furthermore, a context-aligned sorting algorithm is employed (parameter: sorting weight). The successfully matched context units will be ranked according to their overall scores. Sort in descending order to prioritize and retain matching pairs that perform well in both weight and similarity; Furthermore, by constructing a bidirectional association mapping table, each anchor entity is... Associated with several matched context units Simultaneously record the context unit The corresponding set of all associated anchor points To form a context-aware semantic association network ,in This is the set of matching relationships between anchor points and their context. Furthermore, a relation density calculation method is used to analyze the network. Perform node centrality analysis and calculate the context connectivity of each anchor entity. Simultaneously calculate the anchor point coverage of the context unit. This serves as a metric for the importance of context in subsequent relation extraction. By matching and alignment, context units are associated with entities in the semantic anchor pool with high precision, thereby constructing a context-aware semantic association network that can be used for assembly in step S4.3. For example, in an animal-inflicted injury scenario, let... ={(u1,0.28),(u2,0.27),(u3,0.19),(u4,0.23)}, where the anchor pool entities are E1="Penicillin Allergy" and E2="Dog Bite", and their context vectors are respectively Using cosine similarity as a metric, the calculation is performed. :like .set up ,generate matrix: The rest are 0. Let... Calculate the overall score, such as After sorting, we obtain the contexts associated with E1 {u1, u2, u4} and the contexts associated with E2 {u3}, forming network N and calculating node centrality: The output semantic association network can improve the matching accuracy to over 95% on the validation set, providing high-confidence association information for enhanced text concatenation in S4.3; S4.3: Concatenate the text of the current dialogue turn with the entities and their relationship information in the matched semantic anchor pool to generate enhanced input text, thereby expanding the contextual semantic support required for model inference; In this sub-step, the input data is the context-aware semantic association network output from step S4.2. ,in For the set of matched anchor entities, For the context unit set, This is a set of relationships between anchor points and their context. Employing a context-anchor information fusion algorithm (parameter: concatenation strategy) =Sequential splicing), realizes the concatenation and combination of the text of the current dialogue turn with its associated anchor entities and relational information, forming a basic text block for multi-source information fusion; Furthermore, a semantic weight-driven fusion ranking method (weight coefficients) is used. The order of occurrence of context units and anchor entities during the splicing process is optimized, and the overall weight is calculated. : in For the context weight of the context unit, This represents the semantic similarity between the context unit and the anchor entity. Furthermore, a segmented identifier injection method is employed (parameter: identifier set). ={[ANCHOR], [REL]}), add explicit annotations to anchor entities and relational information in the concatenated text so that the large language model can distinguish different information sources and categories during subsequent parsing; Furthermore, through the relational chain expansion algorithm (maximum expansion depth) =2), append adjacency triples known from the semantic anchor pool of the anchor entities to the concatenated text, prioritizing those with semantic similarity to the topic entity of the current dialogue round not less than the threshold. This information provides relational details, thereby supplementing implicit semantic connections that may appear across rounds. Furthermore, a context consistency verification mechanism (based on BERT embedding similarity, threshold) is adopted. =0.65), and perform a global consistency check on the completed text to remove relational segments that deviate too much from the topic of the current dialogue round in order to eliminate the risk of semantic offset; By processing information fusion, weight ranking, explicit annotation, relation expansion and consistency verification, the context-aware semantic association network is transformed into enhanced input text containing multiple sources, multiple relations and semantic continuity, so as to provide input data with high confidence and high context coverage for relation extraction of large language models. For example, in a medical dialogue about animal injury, assuming the current dialogue text in round 8 is "Can cephalosporins be used?", its semantic association network contains the context unit E1 = "Penicillin allergy" {u1: "Patients develop rashes after taking penicillin", w1=0.28, Sim=0.93; u2: "Doctors recommend avoiding penicillin", w2=0.27, Sim=0.91}. A sequential concatenation strategy is used, placing the current dialogue text first, followed by the text corresponding to u1 and u2 in sequence, and inserting [ANCHOR] tags at entity positions. The known relation triples {(penicillin allergy, contraindication, penicillin)} for E1 are retrieved from the anchor pool and appended to the end of the text with the [REL] annotation. The weight calculation formula yields Wc(u1) = 0.5 × 0.28 + 0.5 × 0.93 = 0.605, and Wc(u2) = 0.5 × 0.27 + 0.5 × 0.91 = 0.59. The original order is maintained. (Expanding depth) =1, add 1 related relation triple, perform consistency check and retain all entries, generate enhanced input text: "Can cephalosporin drugs be used? [ANCHOR] Penicillin allergy patients will develop rashes after taking penicillin. Doctors recommend avoiding the use of penicillin drugs REL". It has been verified that this version achieves 96% context coverage and 9% improvement in relation accuracy during the relation extraction stage. S4.4: A prompt word template design method based on semantic anchoring-logical deduction structure is used to construct a formal prompt word template that includes anchor entities, relation reasoning paths and target relation types, so as to explicitly guide the large language model to activate key semantic anchors in the relation extraction process. S4.5: The enhanced input text is fused with the prompt word template to generate structured prompt text that adapts to the input format of the large language model, thereby improving the model's context modeling ability and relation extraction accuracy in dynamic dialogue scenarios.

[0015] Step S5: The enhanced input text is input into the large language model to perform a medical entity relation extraction task, outputting a preliminary structured relation chain containing entity-relation-entity triples. Specifically, this includes: S5.1: Preprocess the enhanced input text, including word segmentation, part-of-speech tagging and syntactic dependency analysis, to extract the syntactic structural features of the text and generate a structured text feature vector; S5.2: Based on the pre-trained Large Language Model (LLM) architecture, contextual semantic encoding is performed on the feature vectors of structured text to obtain the semantic embedding representation of medical entities in the text and generate an entity semantic vector space; In this sub-step, the input data is the structured text feature vector output by step S5.1. This feature vector already contains information on word segmentation, part-of-speech tagging, and syntactic dependency parsing. The input text is context-sensitive input text enhanced by step S4. The goal is to perform context semantic encoding based on the pre-trained Large Language Model (LLM) architecture to obtain the semantic embedding representation of each medical entity in the text and construct a high-dimensional entity semantic vector space to provide a semantic foundation for subsequent entity recognition and relational reasoning. An LLM context semantic coding algorithm based on the Transformer encoder structure is adopted (parameter: hidden layer dimension). =1024, number of attention heads =16, number of stacking layers =24), to achieve multi-head self-attention modeling of structured text feature vectors, and capture long-range dependencies across sentences and rounds; Furthermore, through the positional encoding injection method (parameter: positional encoding type) =Learnable sinusoidal hybrid coding) embeds time series and round position information into feature vectors to achieve explicit modeling of the temporal logic of medical dialogue, thereby enhancing the time perception capability of entity representation; Furthermore, a multi-source feature fusion strategy is adopted (parameter: fusion method). =weighted concatenation), combining syntactic dependency feature vectors With part-of-speech tag feature vector According to weight and With LLM encoding output Perform fusion to generate a fusion vector. : in, As a comprehensive semantic representation enhanced with global context, it supports subsequent vector space construction. Furthermore, by utilizing layer normalization and residual connection mechanisms, the fused vector is normalized while maintaining information without loss, ensuring that the semantic representation after multiple rounds of iterative updates maintains numerical stability and gradient transitivity across different feature domains. Furthermore, through the entity boundary alignment encoding method (parameter: boundary label set) ={B-ENT, I-ENT,O}), which maps the known medical entity boundary information to the time step dimension of the fusion vector, to achieve precise binding between the vector representation and the entity location; Through the above algorithm chain, the initial structured text feature vector is transformed into a set of entity representations embedded in a high-dimensional entity semantic vector space, thereby achieving the separability and consistency of medical entities in the semantic space. For example, in a sample medical dialogue about animal injury, the enhanced input text contains "[ANCHOR] Penicillin-allergic patients will develop rashes after taking penicillin; doctors recommend avoiding penicillin-type drugs." The structured feature vector output by S5.1 has a dimension of 768, and is set... =1024, =16, The output after processing by the Transformer encoder with a value of 24 is... The dimension is 1024 × sequence length 80. Position encoding uses a learnable sinusoidal mixture form, mapping time step indices 0-79 to a 1024-dimensional array and then... Addition. Syntactic dependency features The dimension is 512, and the part-of-speech features are... The dimension is 128, let =0.2, =0.1, then The calculation is as follows: The resulting fused vector has a dimension of 1024. The fused vector is then normalized using LayerNorm, and the residuals retain the original values. Information is collected and labeled with entity boundary tags: B-ENT (penicillin allergy), I-ENT (rash), and O (other). The final output entity semantic vector space achieves a clustering purity of over 92% among entities of the same type of allergy under the cosine distance metric, significantly improving the accuracy of subsequent entity recognition and relation extraction. S5.3: Perform entity recognition algorithm on entity semantic vector space to identify medical entities appearing in text, including allergy drugs, animal types, wound features, etc., and generate entity set and its corresponding location index; In this sub-step, the input data is the high-dimensional entity semantic vector space output by step S5.2. This vector space already contains context-aware semantic embeddings generated from the enhanced input text, and has been optimized and bound in terms of dimension, location information and multi-source feature fusion. The goal is to perform accurate location-level medical entity recognition on the semantic embeddings and output the entity set and its position index in the sequence. A sequence labeling algorithm based on BiLSTM-CRF was used (parameter: number of hidden units). =512, dropout ratio =0.3, regularization coefficient =1e-5), to achieve bidirectional dependency modeling of context feature sequences in the time dimension and decoding of the globally optimal label sequence, generating entity boundary marker sequences; Furthermore, using the BIO sequence labeling specification (label sets B-ENT, I-ENT, O), the embedding vector at each time step is sorted according to the Conditional Random Field (CRF) score matrix. Perform dynamic programming to solve the problem and select the optimal path. This enables the decoding of entity boundaries under global constraints. Furthermore, a standardized medical terminology type classifier is employed (parameter: number of classification categories). =Allergic drugs, animal type, wound features, others), perform multi-class softmax classification on the candidate entity fragments obtained from BIO decoding, and calculate the probability. : in, For entity fragments in category The linear mapping score is used to output the category with the highest probability as the entity type label. Furthermore, a position index generation algorithm (parameter: based on the start and end token positions of the original sequence) is used to map each identified entity back to the token position range of the original input text. This ensures the traceability of entities in their original text locations and the accuracy of subsequent relationship reasoning; Furthermore, a confidence score fusion strategy (fusion weight coefficient) is adopted. =0.7), combined CRF path score With class softmax probability Calculate the recognition confidence score for each entity: Only keep Above the threshold Entities with a value of 0.8 are entered into the entity set for output; By using sequence labeling decoding, multi-class classification, location index labeling and confidence fusion processing, the high-dimensional semantic vector space is transformed into a set of medical entities with precise boundaries, type identification and location information, so as to achieve high-precision detection of multiple types of entities such as allergic drugs, animal types, wound features; For example, in an animal injury medical dialogue corpus, the input vector space has a dimension of 1024 × sequence length of 85. The BiLSTM-CRF decoding outputs a BIO tag sequence such as: B-ENT, I-ENT, O, ..., B-ENT, O. The first and second tokens correspond to "penicillin allergy," with a CRF path score of 0.92 and a softmax probability of type classification of {allergic drug: 0.95, animal type: 0.03, wound feature: 0.02}. Taking the type as allergic drug, the position interval is [0,1]. Tokens exceeding the 0.8 threshold are retained. Similarly, the 45th token, corresponding to "dog," has a probability distribution of {animal type: 0.91, allergy drug: 0.05, wound feature: 0.04}, a position interval of [45, 45], and a confidence score of 0.907. It is added to the entity set. The final output entity set includes {("penicillin allergy", type = allergy drug, position = [0, 1], confidence = 0.929), ("dog", type = animal type, position = [45, 45], confidence = 0.907)}. In the validation set, the entity recognition F1 score reaches over 94%, significantly improving the input quality of subsequent relation classification. S5.4: Based on the semantic anchoring-logical deduction structure defined in the prompt word template, perform relation classification model reasoning on entity pairs in the entity set to determine whether there is a semantic relationship between entities and generate a candidate relation triplet set; S5.5: Sort the candidate relation triples by confidence and filter them by threshold, retaining the entity-relation-entity triples with high confidence to form a preliminary structured relation chain output.

[0016] Step S6: Based on a preset set of clinical logic rules, the structured relation chain is validated, identifying and filtering relation triples with semantic conflicts or logical contradictions, and generating a high-confidence final structured relation chain. Specifically, this includes: S6.1: Parse the preliminary structured relation chain output from the large language model, extract the entity-relation-entity triples to obtain a preliminary relation triple set; the preliminary structured relation chain includes medical entities and their relation information enhanced based on context-sensitive modeling; the output of this step provides standardized triple input for the next step to perform clinical logic rule verification; S6.2: Perform semantic consistency verification on the preliminary set of relation triples based on a preset set of clinical logic rules to identify triples that violate medical logic; the set of clinical logic rules includes, but is not limited to, taboo relation rules, time sequence rules, causal association rules, and terminology standardization mapping rules; the output of this step is a list of candidate relation triples containing semantic conflicts or logical contradictions, which are used for subsequent filtering. In this sub-step, the input object is the preliminary set of relation triples output by S6.1. The set contains medical entities and their relation information after context-sensitive enhancement processing. Semantic consistency verification needs to be performed based on a preset set of clinical logic rules to identify medical logic conflicts. A rule-based matching engine approach is adopted (parameter: rule set size). =128 entries), which performs a one-to-one matching of each relation triple with the clinical logic rules, generating a rule matching state matrix. Matrix elements Indicates the first The triplet and the first The matching results of the rules (0 indicates no match, 1 indicates a match that satisfies the rule conditions, and -1 indicates a match that violates the rule conditions). Furthermore, a taboo relation rule detection algorithm (parameter: subset of taboo rules) is used. (Matching mode = exact match) This function performs logical conflict detection on triples involving the co-occurrence of known allergenic drugs and prescription drugs, and outputs conflict flags. In this process, the Boolean intersection of the entity type vector and the rule subset condition vector is calculated. A conflict tag is triggered when the intersection is non-empty and the relation points to "use". Furthermore, a time sequence rule verification algorithm is used (parameter: time window threshold). =72 hours), enabling time sequence validity verification of event triples containing timestamp information. Using the formula: in, The timestamp of the earlier event. For the timestamp of the later event, when or The time stamp is marked as a timing logic conflict, and a corresponding tag is generated. ; Furthermore, through a causal association rule inference algorithm (parameter: inference depth) =2), to verify the correctness of causal chains in the set of triples. A path matching method based on causal graphs is used to calculate the Jaccard similarity between the derived path and the rule-defined path: in, Derive the set of path nodes for triples. For a set of rule path nodes, if (set up If the value is 0.5, it is defined as causal inconsistency and labeled as conflicting. ; Furthermore, the algorithm is validated through terminology standardization mapping rules (parameter: minimum mapping similarity threshold). =0.85), the similarity between the entity expressions in the triples and the term encoding mapping table generated by S2.5 is verified using BERT vector cosine similarity calculation: in, For the BERT vector of the entity text, For the BERT vector in standard terminology, if If the entity term mapping is abnormal, a conflict label will be attached. ; By using a multi-label fusion strategy (fusion method = logical OR operation) to... , , and Aggregate to generate a conflict tag set for candidate relation triples. The final output is a list of candidate relation triples containing semantic conflicts or logical contradictions, which is used for confidence scoring in S6.3. By combining rule matching, logical conflict detection, and semantic mapping consistency verification, potential erroneous relationships in the initial structured relationship chain are accurately identified as conflict candidates, thereby achieving the consistency of relational semantics and the verifiability of medical logic in the structured electronic medical record generation chain. For example, in a medical dialogue scenario involving animal injury, the input triplet set includes ("Penicillin allergy" - contraindicated use - "Penicillin sodium injection", timestamp=null), ("Dog bite" - occurrence time - 2023 / 08 / 01 10:20), ("Patient admission" - occurrence time - 2023 / 08 / 01 09:50), and ("Use of tetanus immunoglobulin" - due to - "Dog bite"). The contraindication rule matching detects that the first triplet contains a relationship between the known allergenic drug "penicillin" and the prescribed drug "penicillin sodium", triggering... =1. During time sequence verification, the second and third triplets are calculated. Minutes less than 0 trigger =1. Causal association detection calculates the causal chain similarity for the fourth triplet. The similarity of all entities was above the threshold of 0.5, indicating no conflict. Terminology standardization mapping detection showed that all entities had similarities >0.9, indicating no terminology conflicts. After multi-label aggregation, the candidate conflict list included the first and second triples, which were output to S6.3 for confidence scoring, providing a basis for filtering low-quality relationships. These detections reduced the semantic conflict rate before medical record generation to below 5%, significantly improving the logical compliance of structured medical record data. S6.3: Perform a confidence score calculation on each triple in the candidate relation triple list to quantify its deviation from the clinical logic rule; the confidence score is calculated based on rule matching degree, contextual semantic matching degree, and terminology standardization mapping quality; the output of this step is the confidence score result for each candidate triple, used to determine whether to filter it; S6.4: Filter candidate relation triples based on confidence scores to remove triples that do not conform to clinical logic rules; set a confidence threshold, and if the confidence score of a triple is lower than the threshold, remove it from the preliminary structured relation chain; the output of this step is a structured relation chain after semantic filtering, which significantly improves semantic consistency. S6.5: Perform integrity verification and repair processing on the filtered structured relationship chain to ensure that it is logically complete and conforms to the clinical diagnosis and treatment process; the integrity verification includes checking whether key entities are missing, whether relationships are closed, and whether logical chains are broken; if missing or broken entities are found, they are supplemented and repaired based on high-confidence entity information in the semantic anchor pool; the output of this step is a high-confidence final structured relationship chain for use by the subsequent electronic medical record filling module.

[0017] Step S7: Map the final structured relationship chain to the corresponding fields of the electronic medical record template, automatically fill in key information such as chief complaint, present illness, past medical history, and allergy history, and generate a structured electronic medical record document that meets the requirements of the "Guidelines for the Diagnosis and Treatment of Common Animal Injuries (2021 Edition)". Specifically, this includes: S7.1: Perform field matching preprocessing on the structured relation chain after verification by the clinical logic rule set. Based on the mapping rules between entity types in relation triples and field definitions in electronic medical record templates, generate a field filling mapping table to clarify the position of the electronic medical record field to be filled for each entity. S7.2: Based on the field filling mapping table, perform field mapping operation on the entity-relationship-entity triple in the structured relationship chain, and fill key information such as chief complaint, present illness, past medical history, and allergy history into the corresponding structured fields in the electronic medical record template to generate preliminary structured medical record content. S7.3: Perform format compliance verification on the filled electronic medical record template. Based on the field naming conventions, data type requirements and field hierarchy structure definitions of the "Common Animal Injury Treatment and Diagnosis Guidelines (2021 Edition)," detect and correct field content that does not conform to the specifications in order to generate a standard-compliant structured electronic medical record document framework. The format compliance verification algorithm (parameter: specification version number = 2021-AD-STD) is used to verify the consistency between the field format of the medical record template and the field definition of the "Common Animal Injury Treatment and Diagnosis Specification (2021 Edition)" on the preliminary structured medical record content generated by the S7.2 field mapping operation. Furthermore, through a field naming comparison method (parameter: size of the naming rule set) =256 entries), which performs a string-by-string matching and comparison of each structured field name in the template with the standardized naming table, and generates a field name matching matrix. Matrix elements Indicates the first The first field and the second The matching status of the naming rules; Furthermore, a data type validation method (parameter: type set T={string,date,float,enum}) is used to compare the data type of the values ​​filled in each field with the required types according to the specification, employing a type mapping function. field The value is mapped to a type identifier and compared with the expected type identifier using an equality comparison. If Then record the type error label. ; Furthermore, a field-level consistency verification algorithm is used (parameter: maximum level depth). =5), which implements parsing and path matching of the template XML / JSON hierarchical structure, and uses depth-first traversal to generate the actual hierarchical path set. , and the reference path set defined by the specification Calculate path difference rate when (set up When the value is 0.1, it is determined that the hierarchy structure is inconsistent and a hierarchy error label is set. ; Furthermore, the validation method is performed using field value formatting rules (parameter: size of the regular expression pattern set). =64), which implements format matching of date, time, and encoding field values ​​according to predefined regular expressions, and generates format error labels for non-matching items. ; By using a multi-label merging strategy (method = logical OR operation) to merge , , , Aggregate into a set of field compliance errors And call the automatic correction rule base (rule size) =128) The system can automatically correct items by replacing values ​​or adjusting the structure to generate a structured electronic medical record document framework that conforms to the specifications. Through the format compliance verification and correction process, the initial medical record content is converted into a standardized document that meets the requirements of naming consistency, data type correctness, field hierarchy integrity and value format legality, so as to achieve structural consistency and scalability of electronic medical records in the storage, exchange and display stages. S7.4: Perform semantic consistency verification on the field content in the structured electronic medical record document framework, and perform terminology standardization verification on the field values ​​based on the preset clinical terminology consistency rule set to ensure that the field content is consistent with the "Common Animal Injury Treatment and Diagnosis Guidelines (2021 Edition)" in terms of semantics and terminology usage, so as to improve the clinical usability of medical record documents; S7.5: Output the structured electronic medical record document framework that has passed the terminology consistency verification as a persistently stored structured format file. The structured format includes, but is not limited to, JSON, XML or HL7 FHIR format, to support subsequent electronic medical record archiving, retrieval and system integration, and realize the standardized flow of medical record information.

[0018] Step S8: After the electronic medical record is generated, privacy information detection and desensitization processing are performed to identify and replace sensitive fields such as patient identification and contact information contained in the text, and generate a desensitized electronic medical record output. Specifically, this includes: S8.1: Perform text preprocessing on the structured medical record documents output by the electronic medical record generation module, and use regular expressions and NLP named entity recognition model to jointly detect patient identification fields in order to extract original text fragments containing sensitive information such as ID card number, name, mobile phone number, and address. S8.2: Based on the extracted patient identification field, a privacy information identification tag set is constructed, and the BERT-BiLSTM-CRF joint model is used to perform context-aware fine-grained entity recognition on potential sensitive fields in medical record text, so as to improve the recall rate of privacy information in unstructured descriptions. S8.3: Based on the identified privacy information tag set, perform field replacement and obfuscation processing, and use a preset desensitization rule library to replace the identified identity fields, replacing the original sensitive fields with virtual identifiers in a unified format to ensure that the information is irreversible and traceable; S8.4: Perform consistency verification on the desensitized electronic medical record documents. Based on the rule engine, detect the matching degree between the replaced fields and the original context semantic logic to ensure that the desensitization process does not destroy the clinical semantic integrity of the medical record content and the logical consistency of the structured fields. S8.5: Generate the de-identified electronic medical record output and record the de-identification log to the audit trail module to achieve auditability and compliance verification of the privacy processing process, and ensure compliance with the Personal Information Protection Law and medical data security specifications.

[0019] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.

[0020] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and rules of the present invention should be included within the scope of protection of the present invention.

Claims

1. An electronic medical record LLM generation method based on animal injury, characterized by, The method comprises the following steps: S1: Collecting the voice signal of the doctor-patient conversation, and converting the voice signal into text data through a voice recognition engine to generate a timestamped conversation turn division result; S2: Performing medical terminology standardization processing on the text data, mapping non-structured expressions to standard terms, and generating a correspondence table of term encoding and original text; S3: Based on the standard terms appearing in the historical conversation turns and their frequencies, a semantic anchor pool is constructed, which contains high-confidence medical entities and their context association information; S4: The text of the current conversation turn is spliced with the entities and relationships in the semantic anchor pool to generate an enhanced input text, and a prompt word template containing a semantic anchor-logic derivation structure is designed to guide the large language model to perform context-sensitive relationship extraction; S5: Input the enhanced input text into the large language model to perform medical entity relationship extraction tasks, and output a preliminary structured relationship chain containing entity-relation-entity triples; S6: Based on the preset clinical logic rule set, the preliminary structured relationship chain is checked to identify and filter relationship triples with semantic conflicts or logical contradictions, and a final structured relationship chain is generated; S7: Map the final structured relationship chain to the corresponding fields of the electronic medical record template, complete the automatic filling of key information, and generate a structured electronic medical record document that meets the requirements.

2. The electronic medical record LLM generation method based on animal injury according to claim 1, characterized in that, The step S7 further comprises: S8: After the electronic medical record is generated, privacy information detection and desensitization processing is performed to identify and replace sensitive fields contained in the text, and a desensitized electronic medical record output result is generated.

3. The electronic medical record LLM generation method based on animal injury according to claim 1, characterized in that, The step S1 specifically comprises: Performing noise reduction and speech endpoint detection processing on the multi-channel audio signal in the doctor-patient conversation scenario; Based on the speech segment after endpoint detection, a pre-trained end-to-end speech recognition model is used to perform acoustic-linguistic joint modeling decoding to generate a preliminary text sequence; Perform punctuation restoration and doctor / patient role attribution annotation processing on the preliminary text sequence to obtain a structured text stream with speaker identification; Based on the speaker identification and speech timestamp information, perform conversation turn segmentation processing on the structured text stream to generate text segments divided by turns and their corresponding start and end timestamp sets; Perform integrity checking and time axis alignment optimization processing on the timestamped conversation turn division result to form a standardized text input.

4. The electronic medical record LLM generation method based on animal injury according to claim 1, characterized in that, The step S2 specifically comprises: Preprocessing the medical entity expressions in the voice recognition text data, normalizing and cleaning the non-structured expressions based on regular expressions and rule dictionaries to generate a standardized text corpus; Based on the “Common Animal Injury Treatment and Diagnosis Specification (2021 Edition)”, a standard term dictionary is constructed, which contains medical entities and their ICD-10 codes or diagnosis specification codes corresponding to multiple structured fields of medical history information, forming a mapping system of terms and codes; Performing term matching tasks on the standardized text corpus, aligning medical entity expressions in the original text with candidate terms in the standard term dictionary based on edit distance algorithm and semantic similarity model; The candidate terms are subjected to semantic verification in a local context based on a context semantic enhancement term mapping strategy, a pre-trained language model is used to calculate the semantic correlation between the candidate terms and the context, and matching terms with consistent semantics are screened out; Perform term encoding labeling on the text data after term mapping, bind the matching standard terms with their corresponding ICD-10 codes or diagnosis and treatment specification codes, and generate a correspondence table between term encoding and original text.

5. The electronic medical record LLM generation method based on animal injury according to claim 1, characterized in that, The medical term standardization process includes normalizing and cleaning the text, term matching, context semantic verification, and standard term encoding labeling to generate a one-to-one correspondence between term encoding and the original text.

6. The electronic medical record LLM generation method based on animal injury according to claim 1, characterized in that, The step S3 specifically includes: Perform term frequency statistical processing on the correspondence table between term encoding and the original text to obtain the occurrence frequency of each standard term in the dialogue history; Based on the term frequency statistical results, filter standard terms with an occurrence frequency higher than a preset threshold to form a high-frequency term candidate set; For each standard term in the high-frequency term candidate set, perform context window sliding processing to extract the text context of each standard term in the high-frequency term candidate set in the previous and subsequent several turns of the dialogue round, and construct a term context semantic correlation graph; Based on the term context semantic correlation graph, calculate the semantic similarity between each term and its context, use a graph neural network model to represent the term-context relationship by graph embedding, and obtain the context-aware vector representation of the term; According to the context-aware vector representation of the term, combine the term frequency and context semantic richness to perform term confidence score processing, filter terms with a confidence score higher than a set threshold, and construct a semantic anchor point pool.

7. The electronic medical record LLM generation method based on animal injury according to claim 6, characterized in that, The construction of the semantic anchor point pool includes the occurrence frequency statistics of the standard terms in the dialogue history, and the filtering of high-frequency terms based on the frequency threshold, as well as the filtering and retention of high-confidence medical entities as semantic anchors based on semantic richness and context confidence.

8. The animal injury-based electronic medical record LLM generation method of claim 1, wherein, The step S4 specifically includes: Perform context window interception processing on the text of the current dialogue round to extract context information related to the current dialogue round; Based on the high-confidence medical entities and their context association information stored in the semantic anchor point pool, perform entity matching and context alignment operations to identify semantic anchors related to the current dialogue round and construct a context-aware semantic association network; Perform concatenation processing on the text of the current dialogue round and the entities and their relationship information in the matched semantic anchor point pool to generate an enhanced input text; Based on the semantic anchor-point-logic deduction structure prompt word template design method, construct a formal prompt word template containing anchor entities, relationship reasoning paths, and target relationship types; Fuse the enhanced input text and the formal prompt word template to generate a structured prompt text.

9. The animal injury-based electronic medical record LLM generation method of claim 1, wherein, The step S5 specifically includes: Preprocess the enhanced input text to extract the syntactic structure features of the text and generate a structured text feature vector; Based on the pre-training of a large language model architecture, the structured text feature vector is contextually semantically encoded to obtain a semantic embedding representation of medical entities in the text, generating an entity semantic vector space; An entity recognition algorithm is performed on the entity semantic vector space to identify medical entities appearing in the text, generating an entity set and its corresponding position index; Based on the semantic anchor-logic derivation structure defined in the prompt word template, the relationship classification model inference is performed on the entity pairs in the entity set to determine whether there is a semantic relationship between the entities, generating a candidate relationship triple set; The candidate relationship triple set is sorted by confidence and filtered by threshold to form an initial structured relationship chain output result.

10. The electronic medical record LLM generation method based on animal injury according to claim 1, characterized in that, The verification step of the structured relationship chain in step S6 is based on a clinical logic rule set, including logic checks of contraindicated relationships, time sequence, causal association and term standardization, and uses confidence scores to filter triples.

Citation Information

Cited By

  • Scraper disconnection identifying and monitoring method based on sound array and spatial-temporal characteristic network

    CN121708956A

  • Structured report generation method and system for clinical dialogue data

    CN121938547A

  • Doctor-patient dialogue intelligent medical record automatic generation method and system based on semantic comprehension

    CN122087060A

  • Doctor-patient conversation intelligent medical record automatic generation method and system based on semantic understanding

    CN122087060B

  • Surgical operation code generation method, device and equipment based on medical record entity

    CN122337454A