A graphRAG-based graph model collaborative intelligent medication recommendation method
Patent Information
- Application Number
- CN202610869208.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-16
- Publication Date
- 2026-10-27
AI Technical Summary
[0009]本发明的目的在于提供一种基于GraphRAG的图模协同智能用药推荐方法及系统,以解决现有技术中用药推荐准确性低、可解释性差、知识静态化及个性化适配能力不足的技术问题
[0033](1)采用静态知识图谱与动态病例向量库的双知识基底架构,静态图谱保障用药推荐的科学性与合规性,动态病例库提供真实诊疗情境的个体化适配,实现从标准化答案到个性化方案的质变。
Smart Images

Figure CN122991445A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and smart healthcare, specifically to a graph-based collaborative intelligent medication recommendation method and system. Background Technology
[0002] As artificial intelligence technology is gradually applied to the field of medical services, existing intelligent medical applications still have several technical problems in the medication guidance process.
[0003] First, existing large language models inherently carry the risk of generating illusions, easily outputting fabricated facts and erroneous medical information, seriously threatening medication safety and diagnostic accuracy. Second, the knowledge generated by these large models is constrained by the deadline for training data, making it impossible to synchronize with the latest clinical guidelines and drug evidence-based data, resulting in a shortcoming in knowledge timeliness and difficulty in meeting the updating needs of clinical practice.
[0004] Secondly, while traditional interpretability methods such as the standard Chain of Thought (CoT) can provide a complete chain of reasoning, their inherent chronological nature generates a large amount of redundant information, increasing the review burden on clinicians and reducing decision-making efficiency.
[0005] Furthermore, patients often have multiple complications and contraindications, making precise medication recommendations challenging in complex individual cases. Numerous alternative drugs exist for similar conditions, and drug interactions are complex, making it difficult to control rational and safe combination therapies. Existing systems rely on static rules and lack clinical context support, failing to meet the needs of precise and personalized clinical medication.
[0006] Furthermore, existing knowledge graph construction methods are mostly one-time constructions, lacking automated update mechanisms, resulting in high maintenance costs and prominent issues of knowledge obsolescence. For example, although Chinese patent application CN119719383B discloses an intelligent construction and retrieval method for medical knowledge graphs based on GraphRAG and LLM, this method is mainly geared towards medical literature retrieval and does not address the issues of personalized clinical medication recommendations and interpretable reasoning.
[0007] In conclusion, there is an urgent need for an intelligent medication recommendation method and system that can balance medical rigor with clinical suitability, and possess interpretability and automated evolution capabilities. Summary of the Invention
[0008] Purpose of the invention
[0009] The purpose of this invention is to provide a graph-based collaborative intelligent medication recommendation method and system to solve the technical problems of low accuracy, poor interpretability, static knowledge, and insufficient personalized adaptation capabilities in existing medication recommendations.
[0010] Technical solution
[0011] To achieve the above objectives, the present invention adopts the following technical solution.
[0012] According to a first aspect of the present invention, a graph-RAG-based collaborative intelligent medication recommendation method is provided, comprising the following steps:
[0013] S1: Construct a dual knowledge base consisting of a static authoritative medical knowledge graph and a dynamic similar case vector database.
[0014] The static authoritative medical knowledge graph uses authoritative medical data such as national-level treatment guidelines, clinical pathways, and pharmacopoeias as data sources. Through entity recognition, relation extraction, and attribute standardization, it constructs a structured graph with drugs and diseases as dual core entities and stores it in the Neo4j graph database. The dynamic similar case vector database performs semantic vectorization processing on desensitized historical cases, generates 1024-dimensional semantic vectors based on the BGE-M3 model, and achieves efficient retrieval based on the cosine similarity algorithm and HNSW index. It is stored in the Chroma vector database.
[0015] S2: Receive natural language case text, perform entity recognition and terminology normalization on the case text, and extract core entities.
[0016] S3: Based on the core entity in step S2, perform dual-path retrieval simultaneously—conduct structured Cypher query retrieval in the static knowledge graph constructed in step S1, and at the same time conduct similarity vector retrieval in the dynamic similar case vector database to obtain structured knowledge retrieval results and similar case retrieval results.
[0017] The static knowledge graph provides standardized knowledge at the level of drug instructions, and is responsible for ensuring safety baselines, verifying compliance, and screening contraindications; the dynamic similar case vector library stores semantic diagnosis and treatment experience of desensitized historical cases, and is responsible for individualized adaptation, reference to real clinical experience, and priority ranking.
[0018] S4: Integrate the structured knowledge retrieval results and similar case retrieval results output from step S3 through prompt word engineering, input them into the large language model for reasoning and generation, and obtain an initial medication recommendation plan.
[0019] The reasoning generation employs a reinforcement learning-based thought chain pruning interpretation mechanism. Specifically, a reward function is designed to score the reasoning steps. Bonus points include retaining key clinical nodes such as medication indication matching and contraindication screening, while deduction points include redundant reasoning, repetitive content, and irrelevant reasoning that deviates from the medication issue. Based on the reinforcement learning scoring results, redundant reasoning steps are automatically pruned, and a simplified thought chain is output after retaining key clinical nodes, achieving a balance between reasoning efficiency and accuracy.
[0020] S5: Perform secondary verification on the initial medication recommendation plan generated in step S4, including drug interaction verification and contraindication verification, generate safety verification results and alternative plans, and output the final medication recommendation plan and interpretable decision basis.
[0021] Furthermore, the method also includes an automated knowledge evolution step: automatically capturing the latest authoritative medical data by monitoring the agent, extracting entities and relationships from the captured data by the extraction agent, updating the extraction results to the static knowledge graph by updating the agent; and automatically vectorizing the desensitized new cases after clinical use and incorporating them into a dynamic similar case vector library to achieve continuous iteration and self-reinforcement of the knowledge graph and case library.
[0022] According to a second aspect of the present invention, a graph-RAG-based collaborative intelligent medication recommendation system is provided, comprising:
[0023] Data processing and knowledge base construction module: configured to build a dual knowledge base consisting of a static authoritative medical knowledge graph and a dynamic similar case vector library;
[0024] The graph-model collaborative intelligent recommendation engine module is configured to receive natural language case text, perform entity recognition and terminology normalization on the case text to extract core entities, and simultaneously perform static knowledge graph structured retrieval and dynamic similar case vector library similarity retrieval based on the core entities. It then performs fusion reasoning on the dual-path retrieval results through a large language model to generate an initial medication recommendation plan, and executes steps S2 to S4.
[0025] Medication safety protection module: configured to perform drug interaction verification, contraindication verification, and individualized risk quantification assessment on recommended medication regimens, and output safety verification results and alternative solutions;
[0026] Human-computer interaction module: configured to provide a case input interface, a structured recommendation result display interface, and a traceability display of the reasoning path and the basis for matching cases.
[0027] Furthermore, the graph-model collaborative intelligent recommendation engine module incorporates a reinforcement learning-based thought chain pruning and interpretation unit. This unit is configured to score inference steps by designing a reward function, automatically prune redundant inference steps, retain key clinical nodes, and output a simplified thought chain.
[0028] Furthermore, the system also includes an automated knowledge evolution module, which is configured to automatically capture the latest authoritative medical data through an intelligent agent workflow to complete knowledge updates, and to automatically include desensitized new cases after clinical use into a dynamic similar case vector library.
[0029] According to a third aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.
[0030] According to a fourth aspect of the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method.
[0031] Beneficial effects
[0032] Compared with the prior art, the present invention has the following beneficial effects:
[0033] (1) A dual knowledge base architecture of static knowledge graph and dynamic case vector library is adopted. The static knowledge graph ensures the scientificity and compliance of drug recommendations, while the dynamic case library provides individualized adaptation to real diagnosis and treatment scenarios, realizing a qualitative change from standardized answers to personalized solutions.
[0034] (2) A reinforcement learning-based thinking chain pruning interpretation mechanism is introduced. Through reward function scoring (see claim 4) and intelligent pruning, the lengthy standard thinking chain reasoning process is condensed into a concise path that focuses on core clinical decisions. While retaining key safety nodes, the review efficiency and system trust are greatly improved, solving the problems of information redundancy and low efficiency of traditional interpretability methods.
[0035] (3) Construct a multi-dimensional medication safety protection system. Through three levels of safety verification—a rule-based hard verification layer, a risk quantification assessment layer, and a human-machine collaborative review layer—accurate early warning and filtering of drug interactions and contraindications can be achieved, ensuring medication safety from the source.
[0036] (4) Design an automated knowledge evolution mechanism to realize the continuous automatic updating of knowledge graph and case database based on intelligent agent workflow, so that the system has the ability to self-iterate and continuously enhance, fundamentally solving the pain points of static knowledge and high maintenance cost of traditional system.
[0037] (5) By integrating dual-source information, human-machine collaborative decision-making and transparent decision path tracing, the interpretability and traceability of AI decision-making have been realized, effectively breaking through the black box problem of medical AI and enhancing the trust of clinicians. Attached Figure Description
[0038] Figure 1 This is a flowchart of the intelligent medication recommendation method according to an embodiment of the present invention;
[0039] Figure 2 This is a diagram illustrating the overall system architecture and core functional modules of an embodiment of the present invention.
[0040] Figure 3This is a flowchart illustrating the reinforcement learning-based thought chain pruning explanation mechanism according to an embodiment of the present invention.
[0041] Figure 4 This is a flowchart illustrating the three-level verification process for medication safety protection in an embodiment of the present invention. Detailed Implementation
[0042] To enable those skilled in the art to better understand the present invention and to make the above-mentioned objectives, technical solutions and advantages of the present invention more apparent, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0043] Example 1
[0044] This embodiment provides a graph-based collaborative intelligent medication recommendation method.
[0045] like Figure 1 As shown, the intelligent medication recommendation method of the present invention includes the following steps: S1, constructing a dual knowledge base consisting of a static authoritative medical knowledge graph and a dynamic similar case vector database; S2, receiving natural language case text, performing entity recognition and terminology normalization, and extracting core entities; S3, simultaneously performing dual-path retrieval based on the core entities; S4, integrating the dual-path retrieval results through prompt word engineering, and generating an initial medication recommendation scheme through large language model reasoning; S5, performing drug interaction verification and contraindication verification on the initial scheme, and outputting the final medication recommendation scheme and interpretable decision basis.
[0046] like Figure 2 As shown, the system of the present invention includes dual knowledge bases (knowledge graph, similar cases), patient profiles, original cases and other input sources. It completes retrieval and reasoning collaboratively through intelligent agents. The retrieval and reasoning memory is used to store intermediate retrieval results to support multi-round interaction. Figure 2 The "ranking" module sorts the relevance of the dual-path search results and sends them to the medication recommendation generator, ultimately outputting recommended medications and a CoT (CoT) explanation. The overall architecture employs a dual-knowledge-based and graph-model collaborative reasoning mechanism. Core functional modules include: a data processing and knowledge base construction module, a graph-model collaborative intelligent recommendation engine module, a medication safety protection module, and a human-computer interaction module. Specifically, the data processing and knowledge base construction module is responsible for building a static authoritative medical knowledge graph and a dynamic similar case vector library; the graph-model collaborative intelligent recommendation engine module receives natural language case text and simultaneously performs static knowledge graph structured retrieval and dynamic vector library similarity retrieval, using a large language model for fusion reasoning; the medication safety protection module performs three levels of security verification on the recommendation results; and the human-computer interaction module provides an interface for case input, result display, and decision-making basis tracing.
[0047] Construction of a dual knowledge base
[0048] The construction process of the static authoritative medical knowledge graph is as follows. Using authoritative medical data such as national-level treatment guidelines, clinical pathways, pharmacopoeias, and drug instructions as the original data source, after preprocessing such as data cleaning, terminology normalization, and entity disambiguation, structured knowledge is extracted through entity recognition and relation extraction techniques. The graph uses disease and drug as dual core entities, constructing four core semantic relationships: (1) treats relationship, describing the standard treatment indications of a drug for a disease; (2) treats_complication relationship, describing the therapeutic effect of a drug on disease complications; (3) contraindicates relationship, describing the contraindications of a drug to disease or patient characteristics; and (4) interactions_with relationship, describing the interactions between drugs. All nodes and relationships are labeled with confidence level and data source to ensure the traceability and verifiability of knowledge. The static knowledge graph is stored in the Neo4j graph database.
[0049] The construction process of the dynamic similar case vector database is as follows: Real, desensitized historical clinical cases are collected. The case texts are cleaned, medical terminology is normalized, and all numerical clinical indicators are converted into standardized degree-of-fact descriptions (e.g., fasting blood glucose is converted from a specific numerical value to "severely elevated diabetes"). Redundant content is filtered to form semantically structured unit text. Based on the BGE-M3 model, the semantically structured text is encoded into 1024-dimensional high-dimensional semantic vectors. Cosine similarity is used as the similarity measurement algorithm, combined with HNSW indexing technology to achieve efficient retrieval, and the data is stored in the Chroma vector database. Each record in the vector database contains a unique vector identifier, semantically embedded text, a 1024-dimensional semantic vector, a standard disease name, associated treatment drugs, and case source information, facilitating system retrieval and result traceability.
[0050] Dual-path retrieval and fusion reasoning
[0051] After receiving natural language medical record text input by doctors through a human-computer interaction interface, the system performs entity recognition on the text, extracts core disease entities and key symptom entities, and simultaneously performs medical terminology normalization. Based on the extracted core entities, the system performs dual-path retrieval simultaneously.
[0052] In the static knowledge graph retrieval path, the system converts core entities into Cypher query statements, performs structured queries in the Neo4j graph database, and performs multi-hop retrieval along relational paths such as treats, contraindicates, and interactions_with to obtain drug-disease association information, contraindication constraint information, and drug interaction information, and outputs structured knowledge retrieval results.
[0053] In the dynamic vector library retrieval path, the system inputs the normalized case text into the BGE-M3 model to generate query vectors, performs cosine similarity retrieval in the Chroma vector database, and recalls the Top-K most similar clinical cases. The recall results include semantic descriptions of the similar cases' conditions, associated treatment drugs, and original medical record tracing information.
[0054] The system integrates dual-source retrieval results through prompt word engineering. The prompt word template is designed with a hierarchical architecture, which includes: (1) system role setting; (2) dual-source information integration area; (3) reasoning constraints; (4) thought chain guidance; and (5) output format constraints. The integrated prompt words are input into the large language model for reasoning generation to obtain an initial medication recommendation plan.
[0055] RL-CoT-based pruning interpretation mechanism
[0056] The reasoning process employs a reinforcement learning-based thought chain pruning interpretation mechanism (RL-CoT). For example... Figure 3 As shown, this mechanism treats inference chain pruning as a sequential decision problem, and the specific process is as follows:
[0057] First, the original CoT inference chain is input, and the complete inference steps are organized into a decision sequence through sequence decision modeling.
[0058] Secondly, a reinforcement learning pruning algorithm is executed. This algorithm interacts with the medical environment (knowledge graph and case database) through a policy network, receives environmental feedback signals, and dynamically learns the optimal pruning strategy. The medical environment provides knowledge constraints and case experience support for the pruning decision.
[0059] Then, through reward function optimization, two objectives are balanced during the pruning process: explanatory efficiency (reducing redundant steps) and decision accuracy (preserving key information). The reward function scores each reasoning step, with bonus points for key clinical nodes such as medication indication matching, contraindication screening, and dosage calculation, and deduction points for redundant reasoning, repetitive content, and irrelevant reasoning that deviates from the medication question.
[0060] At the same time, the algorithm enforces a hard constraint to retain safety-critical nodes, ensuring that safety-related steps such as contraindication checks and drug interaction verification are not pruned or removed.
[0061] Finally, a concise reasoning summary is output, which is highly condensed and focuses on core clinical insights, significantly improving doctors' review efficiency while ensuring safety.
[0062] After generating the initial medication recommendation plan, the system performs a three-level security check. For example... Figure 4As shown, the first level is the rule-based hard validation layer, which directly verifies the existence of contraindication conflicts and drug interactions through the `contraindicates` and `interacts_with` relationships in the graph. The second level is the risk quantification assessment layer, which calculates an individualized medication risk score based on individual patient characteristics (age, liver and kidney function, allergy history, etc.). The third level is the human-machine collaborative review layer, which presents the validation results on the doctor's interface, supporting doctor review and confirmation or manual adjustment of the treatment plan. After three levels of safety validation, the system outputs the final medication recommendation plan and the interpretable decision-making basis after RL-CoT pruning.
[0063] Example 2
[0064] This embodiment further includes an automated knowledge evolution step based on Embodiment 1.
[0065] The automated knowledge evolution mechanism employs an intelligent agent workflow to achieve continuous iterative updates of the knowledge graph and case database. Specifically, it includes four levels:
[0066] Data input layer: Receives new desensitized medical records, medication effect feedback data, and clinical doctors' revision opinions, serving as an incremental data source from the real world.
[0067] Medical record database update layer: When a new desensitized medical record is entered, the system automatically executes the medical record semanticization and vectorization processing flow, generates a 1024-dimensional semantic vector, and appends it to the Chroma vector database, while simultaneously updating the similar case index.
[0068] Knowledge Graph Validation Layer: Based on an agent-driven graph update mechanism, the pre-set agent workflow periodically crawls authoritative data sources such as the latest drug instruction manual updates and clinical guideline revisions. Entity extraction and relation extraction are completed with the assistance of a large model. The agent automatically identifies new drug interactions, changes in indications, and contraindications updates. After confidence screening, normalized triples are generated and incrementally updated to Neo4j knowledge graph nodes and relation edges.
[0069] Model feedback layer: The updated knowledge base is used to examine the reasoning logic and optimize the strategy. By adjusting the prompt word template and reward function parameters, the system reasoning is made to better align with the latest medical knowledge and clinical guidelines.
[0070] Example 3
[0071] This embodiment provides a graph-based collaborative intelligent medication recommendation system. The system adopts a B / S architecture and includes a data processing and knowledge base construction module, a graph-based collaborative intelligent recommendation engine module, a medication safety protection module, and a human-computer interaction module. The connection relationships and data flow between the modules are as follows: Figure 2 As shown.
[0072] Among them, the graph-model collaborative intelligent recommendation engine module has a built-in reinforcement learning-based thought chain pruning interpretation unit, which follows... Figure 3 The procedure shown executes the pruning operation; the medication safety protection module follows... Figure 4 The system employs a three-level verification process for security checks; it also includes an automated knowledge evolution module to enable continuous iteration of the knowledge graph and case database.
[0073] Example 4
[0074] This embodiment provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method described in Embodiment 1 or Embodiment 2.
[0075] Example 5
[0076] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the method described in Embodiment 1 or Embodiment 2.
[0077] Experimental results
[0078] The system constructed using the above embodiments was validated in a real clinical testing environment. Using a 56-year-old male with type 2 diabetes and no history of drug allergies as the test input, the system retrieved indications and contraindications information for core drugs such as metformin and acarbose from a knowledge graph search, and recalled real-world cases with similar conditions from a vector database search. After graph-model collaborative reasoning, the system generated a personalized medication plan including metformin as the basic treatment and acarbose as an adjunct for blood sugar control. The system also performed dual checks on drug interactions and contraindications at the safety verification layer. The final output, a concise thought process chain, clearly presented the three key decision-making steps: indication matching, contraindication screening, and dosage assessment. The reasoning process was highly readable and contained minimal redundant information.
[0079] The results of a multi-person trial survey show that the system is simple to operate and runs stably. By relying on RL-CoT pruning to optimize the inference logic, it solves the problems of messy and poor readability of traditional AI inference. The system provides accurate medication recommendations and clear risk warnings. It is also suitable for both professional medical treatment and ordinary family medication scenarios, and has high practicality and application value.
[0080] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A graph-based collaborative intelligent medication recommendation method, characterized in that, Includes the following steps: S1: Construct a dual knowledge base consisting of a static authoritative medical knowledge graph and a dynamic similar case vector database; S2: Receive natural language medical case text, perform entity recognition and terminology normalization on the medical case text, and extract core entities; S3: Based on the core entity in step S2, perform dual-path retrieval simultaneously—perform structured Cypher query retrieval in the static knowledge graph constructed in step S1, and simultaneously perform similarity vector retrieval in the dynamic similar case vector database to obtain structured knowledge retrieval results and similar case retrieval results; S4: Integrate the structured knowledge retrieval results and similar case retrieval results output from step S3 through prompt word engineering, input them into the large language model for reasoning and generation, and obtain the initial medication recommendation plan; S5: Perform secondary verification on the initial medication recommendation plan generated in step S4, including drug interaction verification and contraindication verification, generate safety verification results and alternative plans, and output the final medication recommendation plan and interpretable decision basis.
2. The graph-RAG-based collaborative intelligent medication recommendation method according to claim 1, characterized in that, The static authoritative medical knowledge graph described in step S1 uses drugs and diseases as dual core entities, and further includes auxiliary entities such as symptoms and examination items; it constructs four semantic relationships: treats: drugs treat diseases; treats_complication: drugs treat complications; contraindicates: drugs are contraindicated for diseases or conditions; and interactions_with: interactions between drugs. This knowledge graph is stored in the Neo4j graph database.
3. The graph-RAG-based collaborative intelligent medication recommendation method according to claim 1, characterized in that, The dynamic similar case vector library described in step S1 semantically vectorizes and stores desensitized historical cases. It uses the BGE-M3 model to generate 1024-dimensional semantic vectors, achieves efficient retrieval based on the cosine similarity algorithm and HNSW index, and stores them in the Chroma vector database.
4. The graph-RAG-based collaborative intelligent medication recommendation method according to claim 1, characterized in that, The reasoning generation in step S4 employs a reinforcement learning-based thought chain pruning interpretation mechanism, specifically including: designing a reward function. ,in The scores for key clinical milestones (medication indication matching, contraindication screening, dosage calculation, etc.) are weighted. ; For redundant reasoning, repetitive content, and deviations from the medication issue, the weights are as follows: Based on reinforcement learning scoring results, redundant reasoning steps are automatically pruned, and a simplified thought chain is output after retaining key clinical nodes, achieving a balance between reasoning efficiency and accuracy.
5. The graph-RAG-based collaborative intelligent medication recommendation method according to claim 1, characterized in that, The method also includes an automated knowledge evolution step: automatically capturing the latest authoritative medical data by monitoring the intelligent agent, extracting entities and relationships from the captured data by the extraction intelligent agent, and updating the extraction results to the static knowledge graph by updating the intelligent agent. Furthermore, it automatically vectorizes desensitized new cases after clinical use and incorporates them into a dynamic similar case vector library, enabling continuous iteration and self-reinforcement of the knowledge graph and case library.
6. A graph-based collaborative intelligent medication recommendation system, characterized in that, include: Data processing and knowledge base construction module: Configured to build a dual knowledge base consisting of a static authoritative medical knowledge graph and a dynamic similar case vector library, and execute step S1; The graph-model collaborative intelligent recommendation engine module is configured to receive natural language case text, perform entity recognition and terminology normalization on the case text to extract core entities, and simultaneously perform static knowledge graph structured retrieval and dynamic similar case vector library similarity retrieval based on the core entities. It then performs fusion reasoning on the dual-path retrieval results through a large language model to generate an initial medication recommendation plan, and executes steps S2 to S4. Medication safety protection module: configured to perform drug interaction verification, contraindication verification and individualized risk quantification assessment on the recommended medication regimen, generate safety verification results and alternative solutions, output the final recommended medication regimen and interpretable decision basis, and execute step S5; Human-computer interaction module: configured to provide a case input interface, a structured recommendation result display interface, and a traceability display of the reasoning path and the basis for matching cases.
Citation Information
Patent Citations
Intelligent Construction and Retrieval Method of Medical Knowledge Graph Based on GraphRAG and LLM
CN119719383B