Knowledge retrieval enhancement generation method based on double-track evidence chain
By constructing a T0–T4 hierarchical index tree and a multi-medical record aggregated knowledge graph, the semantic differences of multi-source heterogeneous data in electronic medical records and the complexity of integrated traditional Chinese and Western medicine data were resolved. This enabled cross-system joint querying and traceable evidence chains of electronic medical records of both traditional Chinese and Western medicine, improving retrieval accuracy and stability.
Patent Information
- Application Number
- CN202511820368.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-04
- Publication Date
- 2026-02-17
AI Technical Summary
Electronic medical records contain heterogeneous data from multiple sources with significant semantic differences and high difficulty in data association. The complexity of data combining traditional Chinese and Western medicine is increasing, and existing technologies are unable to achieve unified retrieval and evidence chain tracing across systems.
A knowledge retrieval method based on a dual-track evidence chain is constructed. Through a T0–T4 hierarchical index tree and a multi-medical record aggregated knowledge graph, semantic interconnection and traceability of the evidence chain between the two branches of traditional Chinese medicine and Western medicine are realized. A weighted knowledge graph with PPMI, Lift and semantic embedding is used for sparsification and community discovery.
It enables cross-system joint query and comparison of electronic medical records from both traditional Chinese and Western medicine, improving retrieval accuracy and stability. The generated evidence chain is verifiable and traceable, supporting cross-institutional applications.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of medical knowledge retrieval, and in particular to a knowledge retrieval enhancement generation method based on a double-track evidence chain. BACKGROUND
[0002] With the continuous advancement of medical informatization, electronic medical records have become the core carrier for recording the whole process of diagnosis and treatment and managing patient information in medical institutions. Secondary and above hospitals have generally achieved full coverage of electronic medical records, and can generate considerable electronic medical record data every year, covering outpatient, inpatient, examination, imaging, and medication throughout the diagnosis and treatment process. Electronic medical records not only bear the function of recording the process of medical services, but also gradually become an important data basis for clinical decision support, scientific research analysis, and quality supervision, promoting the transformation of medical mode from experience-oriented to data-driven.
[0003] From the data characteristics, electronic medical records present the characteristics of multi-source heterogeneity and multi-layer semantics coexisting: they contain free text (such as medical history records, complaints, and traditional Chinese medicine four diagnostic (observation, smell, question, and cut) descriptions), semi-structured reports (such as imaging conclusions and examination lists), and structured coded information (such as disease, operation, and drug standard codes). The semantic differences between different forms of data are significant, and the data correlation is difficult.
[0004] The extensive application of integrated traditional Chinese and Western medicine further increases the data complexity: the Western medicine system focuses on disease diagnosis, test indicators, and evidence-based diagnosis and treatment paths; the traditional Chinese medicine system focuses on syndrome identification, tongue and pulse characteristics, and prescription compatibility, and the two sets of terminology systems and reasoning logic differ significantly, but need to be presented and supported in the same electronic medical record. In addition, a large number of post-diagnosis generated electronic medical records focus more on the clear recording of diagnosis conclusions and disposal measures, and the recording of time dimension details such as symptom evolution process and examination implementation sequence is relatively brief, resulting in limited applicability of data analysis methods that rely on complete timelines on such data.
[0005] Therefore, it is necessary to provide a retrieval method that organizes the hierarchical semantics of electronic medical records as the main line, takes the parallel carrying of traditional Chinese and Western medicine as the core structure, and constructs an end-to-end complete technical process retrieval method from data warehousing to explainable question answering. SUMMARY
[0006] To address the aforementioned technical problems, this invention provides a knowledge retrieval enhancement generation method based on a dual-track evidence chain. This invention structures electronic medical records (EMRs) from minimal facts to disease-specific summaries into a bidirectionally traversable T0–T4 hierarchical index tree, enabling diagnostic conclusions to be directly traced back to the smallest supporting evidence fragments. This fundamentally solves the problem of untraceable evidence chains in existing RAGs within medical record scenarios. Simultaneously, at the cross-medical record level, a weighted knowledge graph fused with PPMI+Lift+semantic embedding is constructed and subjected to sparsification and community discovery. This ensures that group aggregation is both statistically robust and can be mapped back to specific medical record evidence, forming a closed loop from group discovery to individual evidence tracing, thus resolving the issues of aggregation robustness and community-individual separation.
[0007] The technical means employed in this invention are as follows: A knowledge retrieval enhancement generation method based on a dual-track evidence chain includes: S1, performing unified preprocessing on multi-source, heterogeneous electronic medical record texts to achieve semantic alignment of the index layer, enabling traceability and reversible mapping; S2, at the single medical record level, constructing a bidirectional index tree structure for each medical record based on its semantic structure; S3, at the cross-electronic medical record level, establishing a multi-medical record aggregated knowledge graph based on the semantics and support relationships between nodes in a single medical record; S4, based on the multi-medical record aggregated knowledge graph, dividing communities to generate thematic medical record aggregates. Community; S5. Receive natural language queries input by users, and perform intent recognition and entity extraction using a combination of rules and lightweight language models; S6. Utilize the multi-medical record aggregated knowledge graph to match nodes based on the query anchor set and generate candidate medical records; S7. Through the bidirectional index tree structure of the single medical record, perform constrained downward backtracking from high-level anchors according to the query intent and minimize redundancy to extract the evidence chain; S8. Jointly reorder the candidate medical records and their evidence chains to generate traceable output and realize medical record knowledge retrieval.
[0008] Further, step S1 specifically includes: All original documents are standardized to UTF-8 encoding and Unicode normalized; the documents are divided into functional sub-segments according to document templates or automatic paragraph classifiers, and the character offset of each paragraph is recorded to achieve a one-to-one mapping between original text fragments and structured index nodes; the functional sub-segments include numerical elements, text elements and normalizable medical entities; For the numerical elements, unit normalization and numerical standardization are performed to form standard fields, which include standardized numerical values. and standardized units At the same time, the original values are retained. With original unit The field supports reverse verification and recovery; if the electronic medical record contains a reference interval [L,U], the interval boundaries are standardized using the same conversion factor, and the upper and lower bounds of the interval are recorded in the ref_range field. For text-based elements, negation and uncertainty semantics are jointly identified based on extended NegEx rules and a lightweight BioClinicalBERT classifier, and the output is... ∈{0,1}, ∈{0,1}, when When the value is 0, it indicates no negation semantics; when... When the value is 1, it indicates a negative meaning. When the value is 0, it indicates no uncertainty. A value of 1 indicates uncertainty. For standardized medical entities, a candidate set is generated by integrating multiple source controlled vocabulary lists, and then the highest matching item is selected based on embedding similarity:
[0009] in, The semantic embedding vector of the entity to be matched. For the controlled word list If the similarity of the semantic embedding vectors of an entity is below a threshold, the original representation is retained and labeled as an unmapped entity to ensure that no semantically incorrect mapping occurs.
[0010] Further, step S2 specifically includes: Based on the aforementioned medical record semantic structure, the layers are defined as: original fact layer, clinical element layer, diagnosis and treatment conclusion layer, treatment plan layer, and disease-specific summary layer. The original fact layer T0 takes the structured JSON generated in the preprocessing stage as input and extracts the smallest granular semantic fact units from the medical records through a combination of regular expression template matching and a medical named entity recognition model, thus forming the original fact layer of the index system. Each T0 node corresponds to a basic element fragment in the medical record after standardization. The field format of the original fact layer T0 node is defined as follows: {id,type,key,value*,unit*, ref_range*,negation*, uncertainty*,confidence,provenance,source
[0011] in," "Indicates an optional field, generated only if the corresponding attribute exists for that feature." A unique identifier for the node. Indicates the feature type. This represents the standardized element name mapped to the controlled terminology system. Represents the original value. Indicates the original unit. Represents standardized values. Represents standardized units, Indicates the reference interval [L,U]. These respectively indicate negation and uncertainty. This indicates the original document identifier, subsection, and character offset, used to trace back to the original medical record. Field annotations extract rules or model version information; confidence represents the extraction confidence level. The clinical element layer T1 is used to aggregate homogeneous medical information from the original fact layer into semantically consistent clinical element nodes. Bucketing aggregation is achieved through key space definition rules, ensuring comparability, searchability, and cross-medical record consistency of the elements. The key space... Defined as:
[0012] in, Only quantified elements participate in bucketing to avoid semantic drift caused by mixing different units. The bucket identifier is generated from the key space. The format is:
[0013] The format of the T1 node field in the clinical element layer is defined as follows:
[0014]
[0015] in, Indicates the name of the clinical element node. This represents the list of original fact layer T0 node IDs that make up node T1. Record aggregated statistical information; only non-quantitative elements are retained. and Required fields Used to record derived quantities and their source identifiers calculated by explicit rules and formulas.
[0016] The diagnosis and treatment conclusion layer T2 carries the diagnosis and treatment conclusions directly recorded in the medical records. When constructing the index, a bidirectional support relationship is established between the clinical element layer T1 and the diagnosis and treatment conclusion layer T2. Each conclusion node in T2 is associated with one or more clinical element groups that support its conclusion. A unique evidence_id is assigned to each support group, and its source T1 list and support strength are written into the T2 node. This ensures that in subsequent interpretive searches, all supporting elements and original facts can be retrieved from T2, realizing the reversible evidence chain backtracking of the diagnosis and treatment conclusion and calculating the support strength. The formula is as follows:
[0017] in, Indicates factor weight Indicates the degree of element satisfaction. To indicate a negative punishment, if If so, then this set of elements is considered to support the diagnostic conclusion. This represents a predefined threshold; In terms of horizontal relationships, semantic embedding similarity is calculated between different T2 nodes to establish a sparse mapping; cosine similarity of embedding vectors is calculated for Western medicine diagnosis and traditional Chinese medicine syndrome nodes. (
[0018] Among them, below the threshold Candidate mappings are not retained. This represents the semantic embedding vector of the TCM node in the diagnosis and treatment conclusion layer. The semantic embedding vector representing the Western medicine node in the diagnosis and treatment conclusion layer is used to establish a horizontal two-way support relationship to realize the semantic interconnection between the Chinese and Western medicine diagnosis layers. The treatment plan layer T3 carries the treatment plan information explicitly recorded in the medical record. A bidirectional mapping relationship is established between T3 nodes and T2 nodes to represent the causal relationship between diagnosis and treatment. The cosine similarity of the semantic embedding of the nodes is calculated.
[0019] in, This represents the semantic embedding vector of a node in layer T2. This represents the semantic embedding vector of a node in layer T3. Indicate the semantic similarity between T2 and T3. When determining the correspondence, if , If a predefined threshold is used, the treatment plan is considered to correspond to the diagnosis and treatment conclusion, and a bidirectional reference pointer is written into the index tree; In terms of horizontal relationships, semantic embedding similarity is calculated between different T3 nodes to establish a sparse mapping, and cosine similarity of embedding vectors is calculated for TCM prescriptions and Western medicine prescriptions nodes:
[0020] Among them, below the threshold Candidate mappings are not retained. This represents the semantic embedding vector of the TCM node in the treatment plan layer. The semantic embedding vector representing the Western medicine node in the treatment plan layer is used to establish a horizontal bidirectional support relationship to construct an interconnected network of the Chinese and Western medicine treatment layers. The disease summary layer T4 is used to summarize the results of layers T2 and T3. Key information from layers T2 and T3 is passed to the controlled large language model via structured prompt templates to generate a templated summary. The generated content is limited to the verifiable scope of the original facts. The generation function is defined as follows:
[0021] in, This represents a disease summary generation function based on a controlled large language model. This is the function that generates a controlled large language model. The prompt is a pre-defined structured prompt template input used to constrain the output format and semantic scope.
[0022] Furthermore, step S3 specifically includes: The nodes at levels T1, T2, and T3 in the single medical record index tree are taken as the global node set V. While maintaining traceability, edges are constructed between nodes based on semantic and support relationships, resulting in a weighted interpretable knowledge graph G=(V,E); E represents the set of edges connecting the global nodes. Three types of candidate association edges are established on the node set: positive point mutual information, lift degree, and semantic similarity edges. The Positive Point Mutual Information (PPMI) is used to measure the saliency of two nodes in the same layer of semantic co-occurrence edges co-occurring in the corpus:
[0023] in, For the concept The frequency of medical records For the concept The frequency of medical records The number of co-occurring medical records for both. Total number of medical records Indicates two nodes at the same level; Using the aforementioned lift Indicators are used to measure the strength of conditional support; for cross-layer dependency edges, they measure the conditional support of a factor for a diagnosis or a diagnosis for a treatment.
[0024] in, This indicates the number of cases where both medical record X and medical record Y appear in the same medical record. This indicates the number of medical records containing the letter X. This represents the number of medical records containing Y, where N is the total number of medical records; This represents the effective edge weights after removing negative correlations; The semantically similar edges are used to connect cross-system nodes that express different meanings but are semantically similar, based on nodes. , Calculate cosine similarity:
[0025] The positive point mutual information, lift degree, and semantic similarity edges are normalized and then fused into a comprehensive edge using a weighted strategy. :
[0026]
[0027]
[0028] in, , , For configurable weights, For each node, only the k edges with the highest weights are retained to achieve sparsity processing, generating a sparse and highly reliable edge set E.
[0029] Further, step S4 specifically includes: Based on the multi-medical record aggregated knowledge graph, a weighted community partitioning based on modularity optimization is performed to identify semantically highly cohesive topical medical record aggregated communities. Weighted modularity is used as the partitioning objective function to maximize the difference between the edge weight density within a community and the expected edge weight of the entire graph. A resolution parameter is introduced during the community discovery process. Controlling community granularity:
[0030] in, Represents the modularity function. It is the sum of all edge weights. Representing nodes respectively , The weighting degree, A function indicating community affiliation; The dominant semantics of a community are identified based on the type of nodes within the community and the edge weight centrality. If the dominant node is a Western medicine diagnosis node, the community is labeled as a disease-specific community; if the dominant node is a traditional Chinese medicine syndrome node, it is labeled as a syndrome community; if the dominant node is a treatment plan node, it is labeled as a treatment plan community. Further for each community The internal node embedding vectors are weighted and aggregated to compute the community center vector. As a domain-limiting anchor point for subsequent semantic retrieval and generation stages:
[0031]
[0032] in, For nodes semantic embedding representation, For the normalized weights of the nodes, The normalization coefficient is... This represents the community center vector.
[0033] Further, step S5 specifically includes: The system identifies diagnostic entities, symptoms and signs, laboratory indicators, or treatment plan keywords in the natural language query and maps them to a standardized set of elements in the key space, aligned with the medical record index structure; a query vector is generated for the entire query. ; Perform coarse-grained domain constraint at the community level of the multi-medical record aggregated knowledge graph, and apply this constraint to the query vectors generated during the query parsing phase. Vectors of each community center Similarity calculation is performed, and the scoring function is defined using cosine similarity:
[0034] By score Select the top scorers from highest to lowest. 1 community as candidate set Where h is an adjustable parameter used for detailed inspection and evidence chain extraction; if all scores are below a set threshold... This will adaptively broaden the recall scope to avoid overlooking potentially relevant communities.
[0035] Further, step S6 specifically includes: In each candidate community In the subgraph, based on the query anchor set Perform node matching and medical record scoring; set medical records The subgraph is Query global vector Global vector of medical records The weighted average of the embedded nodes in the medical record graph is obtained as follows:
[0036] in, Let x be the embedding representation of node x. For normalization, This represents the weight of node x. This represents the weight coefficient of the nodes in the treatment plan layer. This represents the weight coefficient of the nodes in the diagnosis and treatment conclusion layer. The weight coefficients of the clinical element layer nodes are used to define the similarity between the nodes and the query.
[0037] in, Represents the similarity function. The path weight of a node in the graph is represented by a weighted path summation. The edge weights at the same level are given by the mutual information between nodes, and the edge weights across levels are given by the lift degree.
[0038] in, This represents the weight of the edge connecting point u and node v. Represents the set of edges at the same level. Represents a set of cross-layer edges; Weight the optimal path from the query anchor to the medical record. Defined as:
[0039] in, This is the set of allowed paths connecting any anchor point to a target node within the medical record graph. A score of ≥0 is penalized for length, affecting the overall medical record score. Defined as:
[0040] in, , The hyperparameter is adjustable, and Penalty(b,Q) represents the negation / uncertainty penalty. All medical records are sorted in descending order of their comprehensive medical record scores, and the top scores are selected. one as a candidate set .
[0041] Further, step S7 specifically includes: When the query intent is for diagnosis or syndrome, T2 is the primary anchor; when the intent is for treatment, T3 is the primary anchor. Let the link path be Under the premise of satisfying structural connectivity and semantic matching constraints, the optimal evidence chain is obtained by minimizing the coverage path length and maximizing the link confidence. Defined as:
[0042] Among them, local matching score for:
[0043] in, Indicates semantic similarity. Indicates coverage. Indicates a negative attribute. Indicates an uncertain property; When multiple feasible paths exist for a node, the path with the highest confidence is selected, and each output chain of evidence carries the node's [confidence / assistance]. With span.
[0044] Furthermore, step S8 specifically includes: The candidate medical records and their evidence chains are jointly reordered and generated in a controlled manner, and a comprehensive scoring function is applied. Defined as:
[0045] in, The confidence score for the link is obtained by summing the node confidence score and the path edge weight; It is an adjustable hyperparameter; The maximum marginal correlation (MMR) algorithm is used to select k chains of evidence.
[0046] Where S is the set of selected chains, This is used to control the balance between correlation and diversity; During the output generation stage, a controlled prompt template based on the evidence chain is adopted, which only allows the language model to generate response text within the scope of the evidence chain content, without introducing any out-of-chain inferences; the output results include: response text, evidence chain number and the original text fragments and medical record sources corresponding to the supporting nodes.
[0047] Compared with the prior art, the present invention has the following advantages: This invention provides a knowledge retrieval enhancement generation method based on a dual-track evidence chain. By constructing a bidirectional index tree (T0–T4) for a single medical record, it achieves reverse locating from the diagnosis and treatment conclusion to the original text fragment, and outputs an evidence chain with source identification, ensuring the verifiability and traceability of the question-and-answer results. Controlled terminology mapping and semantic embedding are introduced at the diagnosis and treatment layers to unify the expression systems of traditional Chinese medicine and Western medicine, enabling cross-system joint queries and comparisons. A multi-medical-record weighted knowledge graph integrating PPMI, Lift, and semantic similarity, along with a community-limited mechanism, is employed to improve retrieval accuracy and stability and reduce interference from irrelevant information. The generation module performs controlled generation based solely on facts within the chain, avoiding logical conflicts and content illusions. The output results include original text location and version information, meeting medical review and compliance requirements. Through key space standardization, unit normalization, negative annotation, and version control, the consistency and reproducibility of medical record data are ensured, supporting cross-institutional applications and expansion. Attached Figure Description
[0048] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1 This is a flowchart of the knowledge retrieval enhancement generation method based on a dual-track evidence chain in this invention.
[0050] Figure 2 This is a flowchart illustrating the construction process of a single electronic medical record index in this invention.
[0051] Figure 3 This is a flowchart of the cross-electronic medical record index construction process in this invention.
[0052] Figure 4 A flowchart for generating search results in this invention. Detailed Implementation
[0053] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0054] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the present invention or its application or use. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0055] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0056] Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps described in these embodiments do not limit the scope of the invention. It should also be understood that, for ease of description, the dimensions of the various parts shown in the drawings are not drawn to actual scale. Techniques, methods, and devices known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and devices should be considered part of the specification. In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values. It should be noted that similar reference numerals and letters in the following figures denote similar items; therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0057] like Figure 1 As shown, this invention provides a knowledge retrieval enhancement generation method based on a dual-track evidence chain. It uses the hierarchical semantics of electronic medical records as the main organizational thread and the parallel implementation of traditional Chinese medicine and Western medicine as the core structural principle, constructing a complete end-to-end technical process from data entry to interpretable question answering. The method is generally divided into two main stages: "index construction" and "retrieval generation." The former, as an offline stage, is used to establish a standardized, structured knowledge carrier; the latter, as an online stage, is used to realize query parsing, evidence chain extraction, and traceable answer generation.
[0058] The core technology of this invention lies in the fact that by combining the vertical traceability structure of a single electronic medical record bidirectional index tree with the horizontal aggregation mechanism of a multi-electronic medical record aggregated knowledge graph, a unified expression of electronic medical record data in three dimensions—hierarchy, semantics, and the dual systems of traditional Chinese and Western medicine—is achieved. This provides a more adaptable new technology path for the intelligent retrieval and generation of electronic medical records in the context of the integration of traditional Chinese and Western medicine.
[0059] S1. Perform unified preprocessing on multi-source, heterogeneous electronic medical record texts to ensure semantic alignment of the index layer, enabling traceability and reversible mapping. Receive multi-source, heterogeneous electronic medical record data, and after unified encoding, format standardization, semantic cleaning, unit normalization, and negative and uncertain semantic recognition, generate standardized structured input data. In a preferred embodiment of this invention, all original documents are unified to UTF-8 encoding and standardized using Unicode; documents are divided into functional sub-segments based on document templates or an automatic paragraph classifier, such as admission records, progress notes, laboratory reports, imaging conclusions, medical orders, prescriptions, etc., and character offsets are recorded for each segment. ={ : Starting character index, The text is structured with a character index ending at '}' to achieve a one-to-one mapping between the original text fragments and the structured index nodes; the functional sub-sections include numerical elements, text elements, and standardized medical entities. For the numerical elements, such as test indicators and drug dosages, the units of execution are normalized and the values are standardized to form standard fields, which include standardized values. and standardized units At the same time, the original values are retained. With original unit The field supports reverse verification and recovery; if the electronic medical record contains a reference range [L,U], the range boundary is standardized by the same conversion factor and the upper and lower bounds of the range are recorded in the ref_range field; this design ensures that numerical elements have consistent dimensions and comparison benchmarks in cross-medical record and cross-institutional environments.
[0060] For textual elements, such as symptoms and traditional Chinese medicine pulse diagnosis, the extended NegEx rules and the lightweight BioClinicalBERT classifier are used to jointly identify negation and uncertainty semantics, and the output is... ∈{0,1}, ∈{0,1}, when When the value is 0, it indicates no negation semantics; when... When the value is 1, it indicates a negative meaning. When the value is 0, it indicates no uncertainty. When the value is 1, it indicates uncertainty. This strategy adopts a "rule priority + model blinding" mechanism: if the rule can be accurately identified, the rule result is directly adopted; otherwise, the model prediction value is used to fill the gap.
[0061] For standardized medical entities, such as disease diagnoses, syndromes, and drugs, a candidate set is generated by integrating multi-source controlled dictionaries, such as ICD-10 / 11, LOINC, and ATC extended dictionaries, and then the highest matching item is selected based on embedding similarity.
[0062] in, The semantic embedding vector of the entity to be matched. For the controlled word list If the similarity of the semantic embedding vectors of an entity is below a threshold, the original representation is retained and labeled as an unmapped entity to ensure that no semantically incorrect mapping occurs.
[0063] Finally, all the cleaned, standardized, and labeled data is output as a unified JSON structure: {id,type,key,value*,unit*, ref_range*,negation*, uncertainty*,confidence,provenance,source
[0064] In this context, "*" indicates an optional field, generated only when the corresponding attribute exists for that feature. "type" indicates the feature type (e.g., lab, symptom, sign, imaging, tcm.tongue, etc.), "key" is the standardized feature name mapped to the controlled terminology system, "ref_range" indicates the reference range [L, U], and "negation" and "uncertainty" represent negation and uncertainty indicators, respectively. "provenance" records the original document identifier, sub-segment, and character offset, used to trace back to the original medical record; the "source" field annotates the extraction rules or model version information.
[0065] The output at this stage strictly maintains the consistency of the original medical record at the semantic level, and achieves reversible mapping and traceable verification of fields at the technical level, providing a unified, standardized, and reproducible data entry point for the subsequent construction of the T0 original fact layer.
[0066] S2. At the single medical record level, a bidirectional index tree structure is constructed based on the semantic structure of the medical record; the aim is to achieve hierarchical convergence and bidirectional traceability from original facts to diagnosis and treatment. In a preferred embodiment of the present invention, the original facts layer, clinical elements layer, diagnosis and treatment conclusion layer, treatment plan layer, and disease-specific summary layer are defined based on the semantic structure of the medical record. The original fact layer T0 takes the structured JSON generated in the preprocessing stage as input and extracts the smallest granular semantic fact units from the medical records through a combination of regular expression template matching and medical named entity recognition models (such as BioBERT-base-Chinese or RoBERTa-Med-Chinese) to form the original fact layer of the indexing system. Each T0 node corresponds to a basic element fragment in the medical record after standardization (such as "blood glucose 8.2 mmol / L" or "cough with sore throat"). The field format of the original fact layer T0 node is defined as follows: {id,type,key,value*,unit*, ref_range*,negation*, uncertainty*,confidence,provenance,source
[0067] in," "Indicates an optional field, generated only if the corresponding attribute exists for that feature." A unique identifier for the node. Indicates the feature type. This represents the standardized element name mapped to the controlled terminology system. Represents the original value. Indicates the original unit. Represents standardized values. Represents standardized units, Indicates the reference interval [L,U]. These respectively indicate negation and uncertainty. This indicates the original document identifier, subsection, and character offset, used to trace back to the original medical record. Field annotations extract rules or model version information, and confidence represents the extraction confidence level. The T0 layer does not perform any generative inference or derived computation; it only records verifiable raw facts from the medical records. This design ensures the smallest reproducible granularity of medical record data and supports upper-level aggregation and lower-level tracing.
[0068] The clinical element layer T1 is used to aggregate homogeneous medical information from the original fact layer into semantically consistent clinical element nodes. Bucketing aggregation is achieved through key space definition rules, ensuring comparability, searchability, and cross-medical record consistency of the elements. The key space... Defined as:
[0069] in, Only quantified elements participate in bucketing to avoid semantic drift caused by mixing different units. The bucket identifier is generated from the key space. The format is:
[0070] The aggregation employs a two-stage process: first, deterministic mapping (rule-first) is performed based on a controlled vocabulary and regular expression templates; then, semantic embedding is used to fill in the gaps in the free text where the rules are not matched. Let the candidate T0 vector be... The existing bucket prototype vector is If the cosine similarity ( Satisfying the threshold If the element is positive, it is merged into the bucket; otherwise, a new candidate bucket is created and labeled as a "candidate element".
[0071] The format of the T1 node field in the clinical element layer is defined as follows:
[0072]
[0073] in, Indicates the name of the clinical element node. This represents the list of original fact layer T0 node IDs that make up node T1. Record aggregated statistical information; only non-quantitative elements are retained. and Required fields This is used to record derived quantities and their source identifiers calculated by explicit rules and formulas. Derived quantities are stored as independent T1 nodes and do not overwrite the original elements. All T1 nodes retain complete T0 traceability information (children[T0_ids] and proofance) and mapping method versions to ensure that the aggregation process is auditable and reproducible.
[0074] The T2 layer, representing the diagnostic conclusions, carries the diagnostic conclusions directly recorded in the medical records, including Western medicine diagnoses, subtypes, severity grading, and traditional Chinese medicine syndrome differentiation elements. All T2 node content is based on the original medical record text, without generation or inference, to maintain the medical authenticity and traceability of the conclusions. For formatted medical records, template extraction is performed by matching anchor paragraphs such as "discharge diagnosis" and "traditional Chinese medicine diagnosis" according to rules; for non-template-based or freely written medical records, the lightweight named entity recognition model BioBERT is used to perform named entity recognition to identify and extract diagnostic phrases. During index construction, a bidirectional support relationship is established between the clinical element layer T1 and the diagnostic conclusion layer T2. Each T2 conclusion node is associated with one or more clinical element groups (aggregated from T1 nodes) supporting its conclusion. A unique evidence_id is assigned to each support group, and its source T1 list and support strength are written into the T2 node. This ensures that subsequent interpretive searches can reverse-engineer all supporting elements and original facts from T2, achieving a reversible evidence chain backtracking for the diagnostic conclusions and calculating support strength. The formula is as follows:
[0075] in, Indicates factor weight Indicates the degree of element satisfaction. To indicate a negative punishment, if If so, then this set of elements is considered to support the diagnostic conclusion. This represents a predefined threshold, such as 0.6.
[0076] In terms of horizontal relationships, semantic embedding similarity is calculated between different T2 nodes to establish a sparse mapping; cosine similarity of embedding vectors is calculated for Western medicine diagnosis and traditional Chinese medicine syndrome nodes. (
[0077] Among them, below the threshold Candidate mappings are not retained. This represents the semantic embedding vector of the TCM node in the diagnosis and treatment conclusion layer. The semantic embedding vector representing the Western medicine node in the diagnosis and treatment conclusion layer is used to establish a horizontal two-way support relationship to achieve semantic interconnection between the Chinese and Western medicine diagnosis layers. The horizontal mapping does not participate in reasoning and is only used for semantic fusion of cross-system indexing and community clustering.
[0078] The treatment plan layer T3 carries treatment plan information explicitly recorded in the medical record, including drug prescriptions, dosages, frequencies, courses of treatment, traditional Chinese medicine formulas, surgical procedures, and other interventions. All content is directly derived from the original medical record. Regular template parsing combined with BioBERT-assisted extraction is used to identify drug names, dosages, and treatment methods from paragraphs such as "medical orders," "prescriptions," and "treatment records," followed by controlled word alignment and standardization. A bidirectional mapping relationship is established between T3 nodes and T2 nodes to represent the causal relationship between diagnosis and treatment. The cosine similarity of the node semantic embeddings is calculated.
[0079] in, This represents the semantic embedding vector of a node in layer T2. This represents the semantic embedding vector of a node in layer T3. Indicate the semantic similarity between T2 and T3. When determining the correspondence, if , This represents a predefined threshold, such as 0.65. The treatment plan is then considered to correspond to the diagnostic conclusion, and a bidirectional reference pointer is written into the index tree; this achieves a reversible path from diagnosis to treatment and from treatment back to diagnosis, ensuring subsequent evidence chain backtracking and interpretive presentation.
[0080] In terms of horizontal relationships, semantic embedding similarity is calculated between different T3 nodes to establish a sparse mapping, and cosine similarity of embedding vectors is calculated for TCM prescriptions and Western medicine prescriptions nodes:
[0081] Among them, below the threshold Candidate mappings are not retained. This represents the semantic embedding vector of the TCM node in the treatment plan layer. The semantic embedding vector represents the Western medicine node in the treatment plan layer, establishing a horizontal two-way support relationship to construct an interconnected network of traditional Chinese and Western medicine treatment layers; providing a semantic bridge for subsequent clustering and retrieval.
[0082] The disease summary layer T4 summarizes the results of layers T2 and T3. This layer differs from the factual nodes of T0–T3; its output is generated based on structured facts through a controlled large language model, belonging to the "fact-constrained generation" stage. Key information from layers T2 and T3 is passed to the controlled large language model via structured prompt templates for template-based summary generation. The generated content is limited to the verifiable range of the original facts. The generation function is defined as follows:
[0083] in, This represents a disease summary generation function based on a controlled large language model. This is the function for generating a controlled large language model. `prompt` is a pre-defined structured prompt template input used to constrain the output format and semantic scope. The model can be a controlled large language model with medical semantic understanding capabilities (such as ChatGLM3-6B, Baichuan2-7B, or the Qwen-Med series) to ensure the medical rationality and interpretability of the abstract content.
[0084] The generated T4 node includes structured fields and establishes a bidirectional dependency relationship T2 in the index tree. T4, T3 T4 allows for the tracing of factual basis for disease-specific summaries and also enables them to be aggregated upwards to form a comprehensive summary of the medical records. The content of the T4 layer is ultimately written back to the top-level node of the medical record index tree, serving as a global summary node for a single medical record.
[0085] S3. At the cross-electronic medical record level, a multi-medical record aggregated knowledge graph is established based on the semantic and support relationships between nodes in a single medical record. In a preferred embodiment of this invention, the nodes at layers T1, T2, and T3 in the single medical record index tree are taken as the global node set V. While maintaining traceability, edges are constructed on the semantic and support relationships between nodes to obtain a weighted interpretable knowledge graph G=(V,E); E represents the set of edges connecting global nodes. Three types of candidate association edges are established on the node set: positive mutual information, lift degree, and semantic similarity edges. The Positive Point Mutual Information (PPMI) is used to measure the saliency of two nodes in the same layer of semantic co-occurrence edges co-occurring in the corpus:
[0086] in, For the concept The frequency of medical records For the concept The frequency of medical records The number of co-occurring medical records for both. Total number of medical records Indicates two nodes at the same level; It removes negative correlations and highlights significant co-occurrences, making it suitable for discovering comorbidities, co-treatments, or common semantic parallel relationships.
[0087] Using the aforementioned lift Indicators are used to measure the strength of conditional support; for cross-layer dependency edges, they measure the conditional support of a factor for a diagnosis or a diagnosis for a treatment.
[0088] in, This indicates the number of cases where both medical record X and medical record Y appear in the same medical record. This indicates the number of medical records containing the letter X. This represents the number of medical records containing Y, where N is the total number of medical records; This represents the effective edge weights after removing negative correlations; only if T1 T2, T2 T3 relationships are only included in the statistics when they occur within the same medical record and there is a clear chain of evidence, in order to eliminate spurious relationships across medical records.
[0089] The semantically similar edges are used to connect cross-system nodes that express different but semantically similar ideas (such as TCM syndromes and Western medicine diagnoses, synonyms under different thesauri), based on nodes. , Calculate cosine similarity:
[0090] Semantic edges are suitable for blinding (when statistical co-occurrence is sparse but semantics are highly similar) and for generating cross-system mapping candidates between traditional Chinese and Western medicine.
[0091] The positive point mutual information, lift degree, and semantic similarity edges are normalized and then fused into a comprehensive edge using a weighted strategy. :
[0092]
[0093]
[0094] in, , , For configurable weights, The normalized form can avoid dimensional differences and control the influence of extreme values. For candidate edges driven only by semantics (when... (When too small or 0), only when In this case, smaller initial statistical weights are considered and assigned. For each node, only the k edges with the highest weights are retained to achieve sparsity processing, generating a sparse and highly reliable edge set E, while improving storage efficiency and retrieval stability.
[0095] S4. Based on the multi-medical record aggregated knowledge graph, communities are divided to generate thematic medical record aggregated communities. Specifically, in a preferred embodiment of this invention, a weighted community division based on modularity optimization is performed on the multi-medical record aggregated knowledge graph to identify semantically highly cohesive thematic medical record aggregated communities. Weighted modularity is used as the partitioning objective function to maximize the difference between the edge weight density within a community and the expected edge weight of the entire graph. To improve the stability and interpretability of the algorithm under heterogeneous node sets, a resolution parameter is introduced during the community discovery process. Controlling community granularity:
[0096] in, Represents the modularity function. It is the sum of all edge weights. Representing nodes respectively , The weighting degree, For the community affiliation indicator function, when , If they belong to the same community, the value is 1; otherwise, it is 0. A more granular community can be obtained at that time. This will lead to a larger, more cohesive community.
[0097] The dominant semantics of a community are identified based on the type of nodes within the community and the edge weight centrality. If the dominant node is a Western medicine diagnosis node, the community is labeled as a disease-specific community; if the dominant node is a traditional Chinese medicine syndrome node, it is labeled as a syndrome community; if the dominant node is a treatment plan node, it is labeled as a treatment plan community. The three types of communities coexist in the same graph structure and are distinguished only by labels, realizing topic aggregation and differentiated retrieval under the dual-body structure of traditional Chinese and Western medicine.
[0098] Further for each community The internal node embedding vectors are weighted and aggregated to compute the community center vector. As a domain-limiting anchor point for subsequent semantic retrieval and generation stages:
[0099]
[0100] in, For nodes semantic embedding representation, For the normalized weights of the nodes, The normalization coefficient is... This represents the community center vector. This community center vector is used as a semantic positioning anchor in the subsequent retrieval generation stage, quickly determining the medical record cluster range to which the user's query or generation request belongs, enabling cross-medical record topic retrieval and evidence chain limitation generation.
[0101] S5. Receive the natural language query input by the user, and perform intent recognition and entity extraction using a combination of rules and a lightweight language model. In a preferred embodiment of this invention, identify diagnostic entities, symptoms and signs, test indicators, or treatment plan keywords in the natural language query, and map them to a standardized set of elements in the key space, aligned with the medical record index structure; generate a query vector for the entire query. ; Coarse-grained domain constraint is implemented at the community level of the multi-disease-record aggregated knowledge graph to reduce the computational complexity of retrieval and maintain the consistency of the traditional Chinese medicine and Western medicine dual-track systems. The query vector generated during the query parsing phase... Vectors of each community center Similarity calculation is performed, and the scoring function is defined using cosine similarity:
[0102] By score Select the top scorers from highest to lowest. 1 community as candidate set Where h is an adjustable parameter used for detailed inspection and evidence chain extraction; if all scores are below a set threshold... This will adaptively broaden the recall scope to avoid overlooking potentially relevant communities.
[0103] S6. Utilizing the multi-medical record aggregated knowledge graph, nodes are matched based on the query anchor set to generate candidate medical records; in a preferred embodiment of the present invention, in each candidate community... In the subgraph, based on the query anchor set Perform node matching and medical record scoring; set medical records The subgraph is Query global vector Global vector of medical records The weighted average of the embedded nodes in the medical record graph is obtained as follows:
[0104] in, Let x be the embedding representation of node x. For normalization, This represents the weight of node x, which determines the contribution of a single node in synthesizing the entire case semantic vector. This represents the weight coefficient of the nodes in the treatment plan layer. This represents the weight coefficient of the nodes in the diagnosis and treatment conclusion layer. This represents the weight coefficient of the clinical element layer nodes. The weights of T2 and T3 are greater than those of T1. It also defines the similarity between the node and the query.
[0105] in, Represents the similarity function. This represents a node in the graph. Path weights are calculated using weighted path summation. Edge weights within the same layer are given by the node's mutual information, while edge weights across layers are given by the lift degree.
[0106] in, This represents the weight of the edge connecting point u and node v. Represents the set of edges at the same level. Represents a set of cross-layer edges; Weight the optimal path from the query anchor to the medical record. Defined as:
[0107] in, This is the set of allowed paths connecting any anchor point to a target node within the medical record graph. A score of ≥0 is penalized for length, affecting the overall medical record score. Defined as:
[0108] in, , The hyperparameter is adjustable, and Penalty(b,Q) represents the negation / uncertainty penalty. All medical records are sorted in descending order of their comprehensive medical record scores, and the top scores are selected. one as a candidate set This provides input for the subsequent evidence chain extraction stage.
[0109] S7. For each candidate medical record Enter its single medical record index tree, and through the bidirectional index tree structure of the single medical record, perform constrained downward backtracking from the high-level anchor point according to the query intent and minimize redundancy to extract the evidence chain; in specific implementation, as a preferred embodiment of the present invention, when the query intent is diagnosis or syndrome, T2 is the main anchor, and when the intent is treatment, T3 is the main anchor. Let the link path be Under the premise of satisfying structural connectivity and semantic matching constraints, the optimal evidence chain is obtained by minimizing the coverage path length and maximizing the link confidence. Defined as:
[0110] Among them, local matching score for:
[0111] in, Indicates semantic similarity. Indicates coverage. Indicates a negative attribute. Indicates an uncertain property; This process prioritizes... The system performs downlink backtracking and allows limited uplinks to close the link when necessary. When multiple feasible paths exist for a node, the path with the highest confidence is selected. Each output chain of evidence carries the node's... With span.
[0112] S8. Jointly reorder the candidate medical records and their evidence chains to generate traceable output, thereby realizing medical record knowledge retrieval. In a preferred embodiment of this invention, the candidate medical records and their evidence chains are jointly reordered and generated in a controlled manner, and a comprehensive scoring function is used... Defined as:
[0113] in, The confidence score for the link is obtained by summing the node confidence score and the path edge weight; It is an adjustable hyperparameter; To improve the diversity and interpretability of responses, the Maximum Marginal Relevance (MMR) algorithm is used to select k chains of evidence:
[0114] Where S is the set of selected chains, This is used to control the balance between correlation and diversity; During the output generation phase, a controlled prompt template based on the evidence chain is used, allowing the language model to generate response text only within the scope of the evidence chain content, without introducing any out-of-chain inferences. The output includes: response text, evidence chain number, original text fragments corresponding to supporting nodes, and medical record sources. Rule checks (such as chain coverage integrity and consistency of diagnostic logic) are automatically performed before and after generation to ensure the verifiability and traceability of the output content.
[0115] Example This invention addresses several key shortcomings of existing Retrieval Enhancement Generation (RAG) technology in the application of medical knowledge, proposing a traceable and engineered solution. To solve the main problems in existing technologies, this invention proposes several different and substantially innovative technical solutions with significant advantages, specifically as follows: Electronic medical records are structured from minimal facts to disease-specific summaries into a bidirectionally traversable T0–T4 hierarchical index tree, enabling diagnostic conclusions to be directly traced back to the smallest supporting evidence fragment, thus fundamentally solving the problem of "untraceable evidence chains" in existing RAGs within medical record scenarios. Simultaneously, a weighted knowledge graph based on a three-dimensional fusion of PPMI+Lift+semantic embedding is constructed at the cross-medical record level, and sparsification and community discovery are performed. This ensures that group aggregation is both statistically robust and can be mapped back to specific medical record evidence, forming a closed loop of "group discovery → individual evidence backtracking," solving the problems of aggregation robustness and community-individual separation.
[0116] This invention also integrates TCM syndromes and Western medicine diagnoses within the same framework, and establishes a sparse lateral mapping through controlled terminology comparison and embedding similarity to avoid system fragmentation and retrieval bias, thereby achieving cross-system retrieval that is compatible with both TCM and Western medicine and is interpretable. The retrieval employs an offline / online hierarchical strategy of "community-limited domain → aggregation graph matching → single medical record index tree backtracking" to balance efficiency and traceability. The generation end implements an anchor-first + controlled template strategy, significantly reducing generation illusions and ensuring consistency of post-diagnosis conclusions. Finally, unified key space standardization and full-chain versioning governance ensure reproducibility and engineering maintainability across institutions and time periods.
[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A knowledge retrieval enhancement generation method based on a dual-track evidence chain, characterized in that, include: S1. Perform unified preprocessing on multi-source, heterogeneous electronic medical record texts to achieve semantic alignment of the index layer, enabling traceability and reversible mapping. S2. At the single medical record level, construct a bidirectional index tree structure for the single medical record based on its semantic structure. S3. At the cross-electronic medical record level, a multi-medical record aggregated knowledge graph is established based on the semantics and support relationships between nodes in a single medical record. S4. Based on the multi-medical record aggregation knowledge graph, the community is divided to generate thematic medical record aggregation communities; S5. Receive natural language queries input by the user and perform intent recognition and entity extraction using a combination of rules and lightweight language models. S6. Using the multi-medical record aggregated knowledge graph, nodes are matched based on the query anchor set to generate candidate medical records; S7. Using the bidirectional index tree structure of the single medical record, perform constrained downward backtracking from the high-level anchor point according to the query intent and minimize redundancy to extract the evidence chain. S8. Perform joint reordering of candidate medical records and their evidence chains to generate traceable output and realize medical record knowledge retrieval.
2. The knowledge retrieval enhancement generation method based on a dual-track evidence chain according to claim 1, characterized in that, Step S1 specifically includes: All original documents are standardized to UTF-8 encoding and Unicode normalized; the documents are divided into functional sub-segments according to document templates or automatic paragraph classifiers, and the character offset of each paragraph is recorded to achieve a one-to-one mapping between original text fragments and structured index nodes; the functional sub-segments include numerical elements, text elements and normalizable medical entities; For the numerical elements, unit normalization and numerical standardization are performed to form standard fields, which include standardized numerical values. and standardized units At the same time, the original values are retained. With original unit The field supports reverse verification and recovery; if the electronic medical record contains a reference interval [L,U], the interval boundaries are standardized using the same conversion factor, and the upper and lower bounds of the interval are recorded in the ref_range field. For text-based elements, negation and uncertainty semantics are jointly identified based on extended NegEx rules and a lightweight BioClinicalBERT classifier, and the output is... ∈{0,1}, ∈{0,1}, when When the value is 0, it indicates no negation semantics; when... When the value is 1, it indicates a negative meaning. When the value is 0, it indicates no uncertainty. A value of 1 indicates uncertainty. For standardized medical entities, a candidate set is generated by integrating multiple source controlled vocabulary lists, and then the highest matching item is selected based on embedding similarity: in, The semantic embedding vector of the entity to be matched. For the controlled word list If the similarity of the semantic embedding vectors of an entity is below a threshold, the original representation is retained and labeled as an unmapped entity to ensure that no semantically incorrect mapping occurs.
3. The knowledge retrieval enhancement generation method based on a dual-track evidence chain according to claim 1, characterized in that, Step S2 specifically includes: Based on the aforementioned medical record semantic structure, the layers are defined as: original fact layer, clinical element layer, diagnosis and treatment conclusion layer, treatment plan layer, and disease-specific summary layer. The original fact layer T0 takes the structured JSON generated in the preprocessing stage as input and extracts the smallest granular semantic fact units from the medical records through a combination of regular expression template matching and a medical named entity recognition model, thus forming the original fact layer of the index system. Each T0 node corresponds to a basic element fragment in the medical record after standardization. The field format of the original fact layer T0 node is defined as follows: {id,type,key,value*,unit*, ref_range*,negation*, uncertainty*,confidence,provenance,source in," "Indicates an optional field, generated only if the corresponding attribute exists for that feature." A unique identifier for the node. Indicates the feature type. This represents the standardized element name mapped to the controlled terminology system. Represents the original value. Indicates the original unit. Represents standardized values. Represents standardized units, Indicates the reference interval [L,U]. These respectively indicate negation and uncertainty. This indicates the original document identifier, subsection, and character offset, used to trace back to the original medical record. Field annotations extract rules or model version information; confidence represents the extraction confidence level. The clinical element layer T1 is used to aggregate homogeneous medical information from the original fact layer into semantically consistent clinical element nodes. Bucketing aggregation is achieved through key space definition rules, ensuring comparability, searchability, and cross-medical record consistency of the elements. The key space... Defined as: in, Only quantified elements participate in bucketing to avoid semantic drift caused by mixing different units. The bucket identifier is generated from the key space. The format is: The format of the T1 node field in the clinical element layer is defined as follows: in, Indicates the name of the clinical element node. This represents the list of original fact layer T0 node IDs that make up node T1. Record aggregated statistical information; only non-quantitative elements are retained. and Required fields Used to record derived quantities and their source identifiers calculated by explicit rules and formulas. The diagnosis and treatment conclusion layer T2 carries the diagnosis and treatment conclusions directly recorded in the medical records. When constructing the index, a bidirectional support relationship is established between the clinical element layer T1 and the diagnosis and treatment conclusion layer T2. Each conclusion node in T2 is associated with one or more clinical element groups that support its conclusion. A unique evidence_id is assigned to each support group, and its source T1 list and support strength are written into the T2 node. This ensures that in subsequent interpretive searches, all supporting elements and original facts can be retrieved from T2, realizing the reversible evidence chain backtracking of the diagnosis and treatment conclusion and calculating the support strength. The formula is as follows: in, Indicates the weight of the elements Indicates the degree of element satisfaction. To indicate a negative punishment, if If so, then this set of elements is considered to support the diagnostic conclusion. This represents a predefined threshold; In terms of horizontal relationships, semantic embedding similarity is calculated between different T2 nodes to establish a sparse mapping; cosine similarity of embedding vectors is calculated for Western medicine diagnosis and traditional Chinese medicine syndrome nodes. ( Among them, below the threshold Candidate mappings are not retained. This represents the semantic embedding vector of the TCM node in the diagnosis and treatment conclusion layer. The semantic embedding vector representing the Western medicine node in the diagnosis and treatment conclusion layer is used to establish a horizontal two-way support relationship to realize the semantic interconnection between the Chinese and Western medicine diagnosis layers. The treatment plan layer T3 carries the treatment plan information explicitly recorded in the medical record. A bidirectional mapping relationship is established between T3 nodes and T2 nodes to represent the causal relationship between diagnosis and treatment. The cosine similarity of the semantic embedding of the nodes is calculated. in, This represents the semantic embedding vector of a node in layer T2. This represents the semantic embedding vector of a node in layer T3. Indicate the semantic similarity between T2 and T3. When determining the correspondence, if , If a predefined threshold is used, the treatment plan is considered to correspond to the diagnosis and treatment conclusion, and a bidirectional reference pointer is written into the index tree; In terms of horizontal relationships, semantic embedding similarity is calculated between different T3 nodes to establish a sparse mapping, and cosine similarity of embedding vectors is calculated for TCM prescriptions and Western medicine prescriptions nodes: Among them, below the threshold Candidate mappings are not retained. This represents the semantic embedding vector of the TCM node in the treatment plan layer. The semantic embedding vector representing the Western medicine node in the treatment plan layer is used to establish a horizontal bidirectional support relationship to construct an interconnected network of the Chinese and Western medicine treatment layers. The disease summary layer T4 is used to summarize the results of layers T2 and T3. Key information from layers T2 and T3 is passed to the controlled large language model via structured prompt templates to generate a templated summary. The generated content is limited to the verifiable scope of the original facts. The generation function is defined as follows: in, This represents a disease summary generation function based on a controlled large language model. This is the function that generates a controlled large language model. The prompt is a pre-defined structured prompt template input used to constrain the output format and semantic scope.
4. The knowledge retrieval enhancement generation method based on a dual-track evidence chain according to claim 1, characterized in that, Step S3 specifically includes: The nodes at levels T1, T2, and T3 in the single medical record index tree are taken as the global node set V. While maintaining traceability, edges are constructed between nodes based on semantic and support relationships, resulting in a weighted interpretable knowledge graph G=(V,E); E represents the set of edges connecting the global nodes. Three types of candidate association edges are established on the node set: positive point mutual information, lift degree, and semantic similarity edges. The Positive Point Mutual Information (PPMI) is used to measure the saliency of two nodes in the same layer of semantic co-occurrence edges co-occurring in the corpus: in, For the concept The frequency of medical records For the concept The frequency of medical records The number of co-occurring medical records for both. Total number of medical records Indicates two nodes at the same level; Using the aforementioned lift Indicators are used to measure the strength of conditional support; for cross-layer dependency edges, they measure the conditional support of a factor for a diagnosis or a diagnosis for a treatment. in, This indicates the number of cases where both medical record X and medical record Y appear in the same medical record. This indicates the number of medical records containing the letter X. This represents the number of medical records containing Y, where N is the total number of medical records; This represents the effective edge weights after removing negative correlations; The semantically similar edges are used to connect cross-system nodes that express different meanings but are semantically similar, based on nodes. , Calculate cosine similarity: The positive point mutual information, lift degree, and semantic similarity edges are normalized and then fused into a comprehensive edge using a weighted strategy. : in, , , For configurable weights, For each node, only the k edges with the highest weights are retained to achieve sparsity processing, generating a sparse and highly reliable edge set E.
5. The knowledge retrieval enhancement generation method based on a dual-track evidence chain according to claim 1, characterized in that, Step S4 specifically includes: Based on the multi-medical record aggregated knowledge graph, a weighted community partitioning based on modularity optimization is performed to identify semantically highly cohesive topical medical record aggregated communities. Weighted modularity is used as the partitioning objective function to maximize the difference between the edge weight density within a community and the expected edge weight of the entire graph. A resolution parameter is introduced during the community discovery process. Controlling community granularity: in, Represents the modularity function. It is the sum of all edge weights. Representing nodes respectively , The weighting degree, A function indicating community affiliation; The dominant semantics of a community are identified based on the type of nodes within the community and the edge weight centrality. If the dominant node is a Western medicine diagnosis node, the community is labeled as a disease-specific community; if the dominant node is a traditional Chinese medicine syndrome node, it is labeled as a syndrome community; if the dominant node is a treatment plan node, it is labeled as a treatment plan community. Further for each community The internal node embedding vectors are weighted and aggregated to compute the community center vector. As a domain-limiting anchor point for subsequent semantic retrieval and generation stages: in, For nodes semantic embedding representation, For the normalized weights of the nodes, The normalization coefficient is... This represents the community center vector.
6. The knowledge retrieval enhancement generation method based on a dual-track evidence chain according to claim 1, characterized in that, Step S5 specifically includes: The system identifies diagnostic entities, symptoms and signs, laboratory indicators, or treatment plan keywords in the natural language query and maps them to a standardized set of elements in the key space, aligned with the medical record index structure; a query vector is generated for the entire query. ; Perform coarse-grained domain constraint at the community level of the multi-medical record aggregated knowledge graph, and apply this constraint to the query vectors generated during the query parsing phase. Vectors of each community center Similarity calculation is performed, and the scoring function is defined using cosine similarity: By score Select the top scorers from highest to lowest. 1 community as candidate set Where h is an adjustable parameter used for detailed inspection and evidence chain extraction; if all scores are below a set threshold... This will adaptively broaden the recall scope to avoid overlooking potentially relevant communities.
7. The knowledge retrieval enhancement generation method based on a dual-track evidence chain according to claim 1, characterized in that, Step S6 specifically includes: In each candidate community In the subgraph, based on the query anchor set Perform node matching and medical record scoring; set medical records The subgraph is Query global vector Global vector of medical records The weighted average of the embedded nodes in the medical record graph is obtained as follows: in, Let x be the embedding representation of node x. For normalization, This represents the weight of node x. This represents the weight coefficient of the nodes in the treatment plan layer. This represents the weight coefficient of the nodes in the diagnosis and treatment conclusion layer. The weight coefficients of the clinical element layer nodes are used to define the similarity between the nodes and the query. in, Represents the similarity function. This represents a node in the graph. Path weights are calculated using weighted path summation. Edge weights within the same layer are given by the node's mutual information, while edge weights across layers are given by the lift degree. in, This represents the weight of the edge connecting point u and node v. Represents the set of edges at the same level. Represents a set of cross-layer edges; Weight the optimal path from the query anchor to the medical record. Defined as: in, This is the set of allowed paths connecting any anchor point to a target node within the medical record graph. A score of ≥0 is penalized for length, affecting the overall medical record score. Defined as: in, , The hyperparameter is adjustable, and Penalty(b,Q) represents the negation / uncertainty penalty. All medical records are sorted in descending order of their comprehensive medical record scores, and the top scores are selected. one as a candidate set .
8. The knowledge retrieval enhancement generation method based on a dual-track evidence chain according to claim 1, characterized in that, Step S7 specifically includes: When the query intent is for diagnosis or syndrome, T2 is the primary anchor; when the intent is for treatment, T3 is the primary anchor. Let the link path be Under the premise of satisfying structural connectivity and semantic matching constraints, the optimal evidence chain is obtained by minimizing the coverage path length and maximizing the link confidence. Defined as: Among them, the local matching score for: in, Indicates semantic similarity. Indicates coverage. Indicates a negative attribute. Indicates an uncertain property; When multiple feasible paths exist for a node, the path with the highest confidence is selected, and each output chain of evidence carries the node's [confidence / assistance]. With span.
9. The knowledge retrieval enhancement generation method based on a dual-track evidence chain according to claim 1, characterized in that, Step S8 specifically includes: The candidate medical records and their evidence chains are jointly reordered and generated in a controlled manner, and a comprehensive scoring function is applied. Defined as: in, The confidence score for the link is obtained by summing the node confidence score and the path edge weight; It is an adjustable hyperparameter; The maximum marginal correlation (MMR) algorithm is used to select k chains of evidence. Where S is the set of selected chains, This is used to control the balance between correlation and diversity; During the output generation stage, a controlled prompt template based on the evidence chain is adopted, which only allows the language model to generate response text within the scope of the evidence chain content, without introducing any out-of-chain inferences; the output results include: response text, evidence chain number and the original text fragments and medical record sources corresponding to the supporting nodes.
Citation Information
Cited By
Staged precise conversion method and system for natural language query ABC
CN122175016A