Medical label intelligent generation method and system based on cooperation of knowledge graph and large language model, electronic device, storage medium
Patent Information
- Application Number
- CN202611273566.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-21
- Publication Date
- 2026-10-30
AI Technical Summary
[0003]但是,现有技术在面向医疗标签批量生产的过程中时,仍存在多种技术缺陷
提升医疗标签的生产效率,保障医疗标签的生成准确性,尽可能避免医疗场景特有的术语歧义问题,实现医疗标准编码的融入深度与可维护性,适配临床路径的异常场景,打通了端到端的医疗标签生产通路,降低医疗标签生产的技术知识门槛。
Smart Images

Figure CN123011912A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of medical artificial intelligence, specifically relating to a method, system, electronic device, and storage medium for intelligent generation of medical tags based on the collaboration of knowledge graph and large language model. Background Technology
[0002] Medical data tags are fundamental data elements supporting clinical research, medical quality control, and refined hospital management. They are generated by processing raw diagnostic and treatment data from sources such as Hospital Information Systems (HIS), Electronic Medical Records (EMR), and Laboratory Information Systems (LIS) through structured extraction, aggregation calculation, and semantic annotation, forming reusable standardized indicators. Currently, the production of medical tags mainly relies on data development engineers manually writing SQL data retrieval logic according to business needs, resulting in long configuration cycles, high technical knowledge barriers, and poor cross-project reusability. To reduce the technical knowledge barrier of tag production, existing technologies have proposed automated solutions based on natural language processing or large language models. For example, Chinese patent CN120804301B discloses an intelligent slot filling and pattern linking method based on RAG and M-Schema. This method matches user questions using the RAG knowledge base, performs entity normalization based on the medical knowledge base, verifies fields using database M-Schema metadata, identifies terminological ambiguities, clarifies them through interactive pop-up windows, and finally generates a single SQL query and returns the analysis results. For example, Chinese patent CN112289454B discloses a method and apparatus for labeling clinical data, which generates derived label data by annotating the original clinical data through preset rules or templates.
[0003] However, the prior art still has a variety of technical defects in the process of mass production of medical labels. First, the production link of medical labels is incomplete; the natural language to SQL scheme adopted in the prior art only realizes the immediate response of a single query, and does not cover the full life cycle links such as standardized mass label production, version management, scheduled scheduling, and API reuse, resulting in the need for a large amount of manual connection in label production. Second, there is a lack of context disambiguation mechanisms for clinical scenarios; medical terms are scenario-dependent, for example, "post-operation" may refer to "immediate post-operation" within 24 hours after the end of the operation, or "post-operation recovery period" within 30 days. The prior art adopts fixed keyword mapping or manual pop-up clarification, which cannot automatically distinguish relevant semantic differences based on clinical pathway nodes. Third, there is a lack of linkage mapping capability for multiple sets of medical standard codes; the production of medical labels involves the mapping of multiple sets of standard codes such as ICD-10, ICD-9-CM-3, LOINC, ATC to data table fields and aggregation methods. The prior art only supports metadata verification of a single standard code, and lacks multi-level automatic mapping in the order of terms, codes, fields, and aggregation methods. Fourth, there is a lack of temporal reasoning capability for clinical event anchors; the time window calculation with surgery and admission as anchors needs to adapt to special situations such as multiple surgeries, failed surgeries, and department transfers. The fixed offset calculation method adopted in the prior art cannot handle the uncertainties therein. Fifth, there is a lack of a verification closed loop executed based on real data; the prior art only performs semantic or grammatical verification on the generated results, cannot find hidden logical deviations such as wrong time window direction and wrong aggregation method, and lacks a mechanism for constraint signals to reversely correct the generation. Contents of the Invention
[0004] To solve one or more of the above problems, a first aspect of the present application provides an intelligent medical label generation method based on the collaboration of a knowledge graph and a large language model, a second aspect provides an intelligent medical label generation system based on the collaboration of a knowledge graph and a large language model, a third aspect provides an electronic device, and a fourth aspect provides a storage medium, which are used to generate medical labels with accurate clinical semantics that can be directly used in real hospital databases based on natural language descriptions.
[0005] The technical solutions of the present application are as follows.
[0006] In the first aspect, an intelligent medical label generation method based on the collaboration of a knowledge graph and a large language model includes: Receiving a natural language description for describing the SQL data retrieval requirement of a medical label; Performing context disambiguation on the natural language description based on the clinical pathway nodes in the medical term knowledge graph, to obtain a structured semantic representation including anchor events, relative time windows, and anchor selection strategies; Based on the structured semantic representation, the enhanced retrieval is enhanced by RAG to obtain a three-layer mapping relationship from natural language description to medical standard code, from medical standard code to data table field, and from data table field to available aggregation methods, thereby constructing an enhanced context; The large language model is invoked to generate structured data retrieval logic containing SQL drafts based on the enhanced context; The structured data retrieval logic is executed in the corresponding medical database. Based on the execution results, a structured correction instruction containing the error diagnosis dimension is constructed and fed back to the large language model for closed-loop verification. Then, the structured data retrieval logic is regenerated until the structured correction instruction no longer contains the error diagnosis dimension. The data retrieval logic that passes the closed-loop verification is input into the SQL template engine, which generates an executable SQL statement based on the anchor selection strategy. Create corresponding medical labels based on executable SQL statements.
[0007] Preferably, context disambiguation includes: Extract scenario keywords from natural language descriptions and match clinical path nodes containing scenario keywords in the medical terminology knowledge graph to form a candidate node set; The target indicator type and time range in the natural language description are matched with the associated test items and default time windows of each clinical pathway node in the candidate node set, and the mismatched clinical pathway nodes are filtered out. Anchor events, relative time windows, and anchor selection strategies are determined based on the filtered clinical pathway nodes.
[0008] Preferably, each layer of the three-layer mapping relationship is maintained independently, and manual confirmation is triggered when any layer fails to map.
[0009] Preferably, obtaining the three-layer mapping relationship through RAG-enhanced retrieval includes: Based on the clinical scenario field in the structured semantic representation, select the corresponding knowledge subgraph from the mapping table from clinical scenario to knowledge subgraph; Within the selected knowledge subgraph, entity links are performed, linking medical entities in the natural language description with standard concept nodes, and then the corresponding medical standard codes, synonyms, and superordinate and subordinate concepts are returned. Based on the medical standard code, query the field mapping table of the core thesaurus of the medical terminology knowledge graph, and return the candidate data table fields, field data types, common aggregation methods, and value ranges; The medical standard codes, synonyms, hyponyms and hypernyms, candidate data table fields, field data types, common aggregation methods, and value ranges are sorted and pruned according to their relevance to the current SQL data retrieval requirements to build an enhanced context.
[0010] Preferably, the structured modification instructions include: When the execution result is empty, construct a structured correction instruction to check the time window direction, the tightness of the encoding matching conditions, and the table association relationship; When an abnormal value is found in the execution result, a structured correction instruction is constructed to check the correctness of field mapping and unit conversion requirements; When an error occurs during execution, the system first performs automatic repair based on predefined SQL syntax correction rules. If repair fails, a structured correction instruction is constructed to check the correctness of table names, field names, and SQL syntax.
[0011] Preferably, the executable SQL statements generated by the SQL template engine include: When the anchor point selection strategy is the default anchor point, the time window filtering conditions are generated directly using the anchor point time field. When the anchor selection strategy is the first anchor, the minimum anchor time is selected by aggregation through common table expressions; When the anchor selection strategy is the last anchor, the maximum anchor time is selected by aggregation through common table expressions. Generate surgical failure filtering conditions, department transfer exclusion conditions, and cross-day surgical anchor time field selection conditions based on hospital business configuration rules.
[0012] Preferably, the process includes the following steps before invoking the large language model: Based on the natural language features in the natural language description, the computational pattern corresponding to the user's intent is automatically inferred through predefined inference rules; The calculation modes include one or more of the following: direct mapping, transformation mapping, aggregation statistics, existence judgment, formula calculation, and relative event interval. When a natural language description contains multiple natural language features, the computation mode is a combination mode.
[0013] Secondly, a medical label intelligent generation system based on the collaboration of knowledge graphs and large language models includes: The request access module is used to receive natural language descriptions that describe the SQL data retrieval requirements for medical tags. The clinical scenario context disambiguation module is used to perform context disambiguation on natural language descriptions based on clinical path nodes in the medical terminology knowledge graph, and obtain a structured semantic representation that includes anchor events, relative time windows, and anchor selection strategies. The RAG enhanced retrieval module is used to obtain a three-layer mapping relationship from natural language description to medical standard code, medical standard code to data table field, and data table field to available aggregation methods based on structured semantic representation, thereby constructing an enhanced context. The large language model generation module is used to call the large language model and generate structured data retrieval logic containing SQL drafts based on the enhanced context; The closed-loop verification module is used to execute the structured data retrieval logic in the corresponding medical database, construct a structured correction instruction containing the error diagnosis dimension based on the execution result, and feed it back to the large language model for closed-loop verification. Then, the structured data retrieval logic is regenerated until the structured correction instruction no longer contains the error diagnosis dimension. The SQL automatic synthesis module is used to input the data retrieval logic that has passed the closed-loop verification into the SQL template engine. The SQL template engine generates executable SQL statements based on the anchor point selection strategy. The label creation module is used to create corresponding medical labels based on executable SQL statements.
[0014] Thirdly, an electronic device includes a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor, when executing the computer program, implements the intelligent generation method for medical labels based on the collaboration of knowledge graphs and large language models of the first aspect.
[0015] Fourthly, a storage medium, which is a computer-readable storage medium, stores computer instructions for enabling a computer to implement the intelligent medical label generation method based on the collaboration of knowledge graph and large language model in the first aspect.
[0016] Compared with the prior art, the advantages of this application are as follows: This improves the production efficiency of medical labels, ensures the accuracy of medical label generation, avoids ambiguity in medical terminology, integrates medical standard coding with depth and maintainability, adapts to abnormal scenarios in clinical pathways, opens up an end-to-end medical label production path, and lowers the technical knowledge threshold for medical label production. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating one of the intelligent medical label generation methods based on the collaboration of knowledge graph and large language model in this application.
[0018] Figure 2 This is a schematic diagram of the structural framework of one of the intelligent medical label generation systems based on the collaboration of knowledge graph and large language model in this application.
[0019] Figure 3 This is a schematic diagram of the frame of one of the electronic devices in this application. Detailed Implementation
[0020] Referring to the illustrations, the principles of this application are illustrated by way of example implementation in a suitable operating environment. The following description is based on the illustrative specific embodiments of this application and should not be construed as limiting other specific embodiments not detailed herein, such as corresponding adjustments to the order of steps of the method of this application based on the principles of the technical concept.
[0021] This application declares that it only performs tag generation processing on standardized medical data records that have been anonymized or de-identified in the business systems of medical institutions, and does not directly process sensitive data such as patients' personal identity information or privacy content in free text of medical records; the large language model involved is deployed on local computing nodes or medical private networks, and the medical-related knowledge graph and database are also located in a controlled network environment, which complies with the relevant provisions of the "Personal Information Protection Law of the People's Republic of China" and the "Data Security Law of the People's Republic of China" regarding de-identification, minimum necessary processing and data security.
[0022] like Figure 1 As shown in the figure, this application discloses a method for intelligent generation of medical tags based on the collaboration of knowledge graph and large language model, including the following steps.
[0023] S1. Receive a natural language description describing the SQL data retrieval requirements for medical tags.
[0024] S2. Based on the clinical path nodes in the medical terminology knowledge graph, the natural language description is disambiguated to obtain a structured semantic representation that includes anchor events, relative time windows, and anchor selection strategies.
[0025] In this embodiment, context disambiguation includes: extracting scenario keywords from natural language descriptions, matching clinical path nodes containing scenario keywords in a medical terminology knowledge graph to form a candidate node set; matching the target indicator type and time range in the natural language description with the associated test items and default time windows of each clinical path node in the candidate node set, and filtering out unmatched clinical path nodes; and determining anchor events, relative time windows, and anchor selection strategies based on the filtered clinical path nodes.
[0026] S3. Based on the structured semantic representation, the RAG-enhanced retrieval method obtains a three-layer mapping relationship from natural language description to medical standard coding, from medical standard coding to data table fields, and from data table fields to available aggregation methods, thereby constructing an enhanced context.
[0027] In this embodiment, each of the three mapping relationships is maintained independently, and manual confirmation is triggered when any mapping layer fails.
[0028] In this embodiment, obtaining the three-layer mapping relationship through RAG-enhanced retrieval includes: S31. Based on the clinical scenario field in the structured semantic representation, select the corresponding knowledge subgraph from the mapping table from clinical scenario to knowledge subgraph; S32. Perform entity linking within the selected knowledge subgraph, linking medical entities in the natural language description with standard concept nodes, and then return the corresponding medical standard codes, synonyms, and superordinate and subordinate concepts. S33. Query the field mapping table of the core thesaurus of medical terminology knowledge graph based on medical standard codes, and return the candidate data table fields, field data types, common aggregation methods, and value ranges; S34. Sort and trim the medical standard codes, synonyms, hyponyms and hypernyms, candidate data table fields, field data types, common aggregation methods, and value ranges according to their relevance to the current SQL data retrieval requirements, and build an enhanced context.
[0029] In this embodiment, the medical terminology knowledge graph may optionally include at least the following node types: clinical concept nodes, standard encoding nodes, standard data layer field nodes, clinical path nodes, and clinical scenario nodes; and the following relationship types may be included at least: synonym relationships, mapping relationships, field mapping relationships, aggregation method relationships, value range relationships, path attribution relationships, anchor field relationships, and scenario triggering relationships. The RAG retrieval strategy includes four layers: the first layer is clinical scenario routing, which selects the corresponding knowledge subgraph from the mapping table based on the clinical scenario fields in the structured semantic representation; the second layer is entity linking, which links medical entities with standard concept nodes; the third layer is field mapping retrieval, which queries the field mapping table in the core thesaurus based on standard encoding; and the fourth layer is context pruning, which sorts by relevance and retains the top K records to construct an enhanced context.
[0030] S4. Call the large language model to generate structured data retrieval logic containing SQL drafts based on the enhanced context.
[0031] In this embodiment, before calling the large language model, the method further includes: automatically inferring the calculation mode corresponding to the user's intent based on the natural language features in the natural language description and through predefined inference rules; wherein, the calculation mode includes one or more of the following: direct mapping, transformation mapping, aggregation statistics, existence judgment, formula calculation, and relative interval of events; when the natural language description contains multiple natural language features, the calculation mode is a combined mode.
[0032] In this embodiment, the relative interval of the event can optionally be defined by the following configuration parameters: event domain, used to indicate the clinical event category to which the anchor event belongs; event code, used to indicate the medical standard code of the anchor event; matching method, including exact matching, fuzzy matching, or code set matching; time field, including the event occurrence time or recording time; relative direction, including preoperative, postoperative, or past; fixed offset, used to indicate the time offset and unit from the anchor point; mapping field, used to indicate the field of the target data; anchor point selection strategy, including default, first, or last.
[0033] Optionally in this embodiment, before calling the large language model to generate structured data retrieval logic, a structured prompt word is constructed based on the computational pattern of structured semantic representation, enhanced context, and inference; the prompt word includes at least the following constraint information: (a) Output format constraints: The large language model is required to output the specified fields in JSON format and is prohibited from outputting explanatory text other than JSON format; (b) User requirements: i.e., natural language description; (c) Disambiguated semantic representation: including event domain, anchor event, anchor time field, time window, target indicator, clinical scenario, and anchor selection strategy; (d) Multi-layer coding mapping results: including three layers of mapping from natural language description to medical standard coding, from medical standard coding to data table fields, and from data table fields to available aggregation methods; (e) Coding value constraints: The candidate surgical code set and test code set in the medical standard coding are clearly listed. The large language model is required to select only from the candidate surgical code set and test code set and shall not make up codes on its own. (f) Whitelist of available data sources: Clearly list the available data tables and fields in the medical database. The large language model is required to select tables and fields only from the whitelist and must not fabricate table or field names. (g) Few-shot examples: These include multiple examples of the same type as the current clinical scenario. The examples cover common patterns such as relative intervals of events, aggregate statistics, and existence judgments, guiding the large language model to imitate the output format and reasoning path. (h) Security constraints: The large language model must not include patient identity information or original medical record text in the generation logic, and only anonymous identifiers and standardized fields are allowed.
[0034] In this embodiment, optionally, after the large language model outputs the structured data retrieval logic, the JSON-formatted structured data retrieval logic is parsed, and the draft_sql record is extracted from it as the SQL draft for subsequent closed-loop verification.
[0035] S5. Execute the structured data retrieval logic in the corresponding medical database. Based on the execution result, construct a structured correction instruction containing the error diagnosis dimension and feed it back to the large language model for closed-loop verification. Then, regenerate the structured data retrieval logic until the structured correction instruction no longer contains the error diagnosis dimension.
[0036] In this embodiment, constructing structured correction instructions includes: when the execution result is empty, constructing structured correction instructions to check the time window direction, the tightness of encoding matching conditions, and table relationships; when the execution result has an abnormal value, constructing structured correction instructions to check the correctness of field mapping and unit conversion requirements; when the execution result has an error, first performing automatic repair based on predefined SQL syntax correction rules, and if repair is not possible, constructing structured correction instructions to check the correctness of table names, field names, and SQL syntax.
[0037] In this embodiment, the closed-loop verification includes code validity verification, trial execution verification, value range verification, and user confirmation verification; the content of each verification is as follows: (i) Code validity check: Check whether the generated medical standard code exists in the core lexicon and is a valid version; check whether the hierarchical relationship in the medical standard code is correct, for example, whether the category and / or subcategory of the surgical code and operation code of ICD-9-CM-3 are consistent with the anatomical system or surgical type to which they belong; check whether the components of the code conform to the LOINC six-axis model; if the code validity check fails, construct a structured correction instruction to return to the large language model for regeneration.
[0038] (j) Trial execution validation: Attach a LIMIT-10 condition (LIMIT is a description of returning a specified number of records) to the SQL draft and execute a quick trial query in the medical database; when the execution result is empty, construct a structured correction instruction to check the time window direction, the tightness of the encoding matching condition, and the table relationship; when the execution result has an outlier, construct a structured correction instruction to check the correctness of the field mapping and the unit conversion requirements; when the execution result has an execution error, first perform automatic repair based on the predefined SQL syntax correction rules, and if repair is not possible, construct a structured correction instruction to check the correctness of the table name, field name, and SQL syntax; the structured correction instruction also includes constraints that preserve other dimensions that have passed validation.
[0039] (k) Value range verification: Based on the successful verification of the trial execution, the SQL draft is appended with the LIMIT-100 condition, and then a statistical trial query is executed in the medical database; the result of the trial execution is compared with the value range defined in the knowledge graph core vocabulary. The value range includes the normal range and the critical value range, and is configured according to the population dimension and the detection method dimension; the proportion of outliers is calculated. When the proportion of outliers exceeds the preset threshold, it is marked as requiring manual review. Then, the distribution of outliers and possible causes are shown to the user, who can manually judge whether it is an SQL logic error and decide whether to return to the large language model for correction.
[0040] (l) User confirmation and verification: Before entering the SQL template engine to synthesize the final SQL, the user is shown the current clinical scenario disambiguation results, medical entity and standard code mapping, multi-level code mapping results, inferred calculation mode, and trial execution results; after user confirmation, the SQL synthesis step is entered. When the user makes corrections, the structured data retrieval logic for modifying natural language descriptions or manually adjusting is returned.
[0041] In this embodiment, optionally, if multiple rounds of closed-loop verification fail and the large language model is regenerated, and the cumulative number of retries exceeds a preset threshold but still fails, the automatic correction process is terminated, and the user is shown the current problem type, previous correction records, and reasons for failure, allowing the user to intervene manually.
[0042] In this embodiment, optionally, the confirmation results collected during manual intervention are used to automatically update the historical mapping table, knowledge base, rule base, and intent inference rules; when the same type of error and correction repeatedly occurs in a preset number of manual confirmations, the structured correction instruction template and SQL syntax correction rules are automatically updated; and the confidence level threshold of the execution results is dynamically adjusted based on the consistency between the manual confirmation results and the system evaluation results according to a preset periodic statistical analysis.
[0043] S6. Input the data retrieval logic that has passed the closed-loop verification into the SQL template engine. The SQL template engine generates an executable SQL statement based on the anchor selection strategy.
[0044] In this embodiment, the SQL template engine generates executable SQL statements including: (1) When the anchor point selection strategy is the default anchor point, the time window filtering conditions are generated directly using the anchor point time field; (2) When the anchor selection strategy is the first anchor, the minimum anchor time is selected by aggregation through the common table expression; (3) When the anchor selection strategy is the last anchor, the maximum anchor time is selected by aggregation through the common table expression; (4) Generate surgical failure filtering conditions, transfer exclusion conditions, and cross-day surgical anchor time field selection conditions according to the hospital business configuration rules.
[0045] Optionally in this embodiment, the SQL template engine takes the SQL draft and the structured data retrieval logic after verification as input, and performs structured rewriting according to the standard template corresponding to the corresponding calculation mode. The structured rewriting includes unifying table alias naming, completing the abnormal scenario handling conditions, verifying the field reference and encoding matching conditions, and adding the security and performance constraints required for the production environment.
[0046] In this embodiment, optionally, for scenarios where surgery fails and / or is not performed, the SQL template engine generates filtering conditions based on the surgical status field configured by the hospital; for scenarios where the same patient undergoes multiple surgeries, different common table expression aggregation logic is generated based on the anchor point selection strategy; for scenarios where patients are transferred to other departments and / or transferred to the ICU, NOT-EXISTS exclusion logic is generated based on the transfer record table configured by the hospital; for scenarios where surgeries span multiple days, the generation end time or generation start time is selected as the anchor point benchmark according to the business configuration rules.
[0047] S7. Create corresponding medical labels based on executable SQL statements.
[0048] Optionally, in this embodiment, the creation of medical labels may also include a step of verifying the accuracy of the label business. The label business accuracy verification includes: randomly selecting N medical record data as verification samples; executing the final SQL statement to obtain the actual label output; displaying the test results, including patient identifier, visit identifier, result value, source record, and clinical context summary; having medical and / or data experts manually determine whether the label value conforms to the business semantics; and, if the verification is successful, executing the label release; if the verification fails, returning to modify the natural language description or having a data engineer manually adjust the SQL statement.
[0049] In this embodiment, optionally, after the medical tag is created, the publishing of the medical tag includes: previewing the complete tag information, including the naming system, calculation mode, data source, aggregation method, and SQL statement; executing the publishing after confirming that there are no circular dependencies; changing the tag status to published and entering the standard tag library; and other data terminals referencing the medical tag through the tag service API. Referencing through the tag service API includes: receiving the patient identifier and the list of medical tags, and outputting the medical tag production result, which includes the tag name, value, timestamp, and data source, and supports batch querying and scheduled production task scheduling.
[0050] In other embodiments of this application, a mapping rule library from natural language description to data retrieval logic can be predefined, and user input can be parsed through regular expressions and keyword matching; calculation pattern inference and SQL statement generation use a rule engine and a predefined SQL template library; clinical scenario disambiguation uses a lightweight model for term disambiguation and entity recognition; the multi-layer encoding mapping and verification mechanism remain unchanged.
[0051] Compared with the prior art, the advantages of this application are as follows: This application improves the production efficiency of medical tags by transforming tag configuration from manually writing SQL to generating tags using a knowledge graph with natural language input and a large language model. This shortens the configuration cycle of a single tag and eliminates the existing technology where medical tag production relies on data development engineers manually writing SQL to retrieve data based on the needs of business personnel. This avoids the drawbacks of long configuration cycles and high technical knowledge thresholds, enabling ordinary business personnel to generate medical tags. To ensure the accuracy of medical label generation, this application avoids semantic interpretation bias from the source through a context disambiguation mechanism. By combining a large language model with a real medical database for closed-loop verification, and using the execution results of real data to inversely constrain the generation model, it can discover hidden logical errors that ordinary semantic verification cannot capture. Thus, it can identify and correct deviations in the generation logic before medical label creation, avoiding the defects of existing technologies that use fixed keyword mapping or manual pop-up clarification to process natural language descriptions, which may deviate from the user's true intent in the data retrieval logic. To minimize the terminology ambiguity issues specific to the medical scenario, this application's disambiguation method, through attribute constraints and multi-dimensional matching of clinical pathway nodes, can accurately capture the temporal intent and anchor point selection strategy in natural language descriptions, reduce the error rate of medical label production caused by terminology ambiguity, and avoid the shortcomings of existing technologies that lack terminology disambiguation mechanisms and are difficult to adapt to the medical scenario. This application achieves greater integration and maintainability of medical standard coding. By extending medical standards from the data processing stage to the core of the label calculation logic through a three-layer mapping relationship, it improves the maintainability and scalability of the medical label generation process and avoids the shortcomings of existing technologies that lack multi-layer automatic mapping capabilities. Adapting to abnormal scenarios in clinical pathways; This application uses an SQL template engine to generate executable SQL statements based on anchor point selection strategies, which can adapt to branches and abnormal scenarios in clinical pathways, improve the robustness of tag logic in real clinical data, and avoid the shortcomings of existing technologies that use fixed offset calculation time window configurations and cannot handle the uncertainty of clinical pathways such as multiple surgeries for the same patient, surgical failures, departmental transfers, and surgeries across days. This application establishes an end-to-end automated tag production chain. By sequentially executing natural language description reception, context disambiguation, RAG-enhanced retrieval, large language model generation, multi-round iterative closed-loop verification, SQL template synthesis, and medical tag creation, it forms an end-to-end automated chain from natural language input to executable SQL statements and then to medical tag output. This eliminates the manual intermediary link between data governance and tag production, and avoids the problem that existing technologies focus on single natural language queries, model training, and rule-based annotation, failing to cover the complete lifecycle of medical tag output. This application lowers the technical knowledge threshold for label production. It initiates medical label configuration through natural language description to complete disambiguation, retrieval, generation, verification and synthesis. Business personnel do not need to have SQL writing skills. This can transform label configuration from a task exclusively for data development engineers into a collaborative mode in which business personnel can participate. This avoids the difficulty of existing technologies that require data development engineers to have SQL writing skills and medical standard coding knowledge, making it difficult for business personnel to directly participate in label configuration.
[0052] like Figure 2 As shown in the figure, this application discloses a medical tag intelligent generation system based on the collaboration of knowledge graph and large language model, including: The request access module is used to receive natural language descriptions that describe the SQL data retrieval requirements for medical tags. The clinical scenario context disambiguation module is used to perform context disambiguation on natural language descriptions based on clinical path nodes in the medical terminology knowledge graph, and obtain a structured semantic representation that includes anchor events, relative time windows, and anchor selection strategies. The RAG enhanced retrieval module is used to obtain a three-layer mapping relationship from natural language description to medical standard code, medical standard code to data table field, and data table field to available aggregation methods based on structured semantic representation, thereby constructing an enhanced context. The large language model generation module is used to call the large language model and generate structured data retrieval logic containing SQL drafts based on the enhanced context; The closed-loop verification module is used to execute the structured data retrieval logic in the corresponding medical database, construct a structured correction instruction containing the error diagnosis dimension based on the execution result, and feed it back to the large language model for closed-loop verification. Then, the structured data retrieval logic is regenerated until the structured correction instruction no longer contains the error diagnosis dimension. The SQL automatic synthesis module is used to input the data retrieval logic that has passed the closed-loop verification into the SQL template engine. The SQL template engine generates executable SQL statements based on the anchor point selection strategy. The label creation module is used to create corresponding medical labels based on executable SQL statements.
[0053] Optionally, in this embodiment, the system is deployed with an architecture including a data source layer, a data governance engine layer, a tag center layer, and an application service layer. The data source layer includes: a source data layer for storing raw data collected from hospital information systems, electronic medical record systems, laboratory information systems, image archiving, and communication systems; and a standard data layer for storing standardized data after light governance, including standard data tables for patients, visits, diagnoses, medical orders, tests, examinations, surgeries, costs, and medical records. The data governance engine layer includes: a light governance layer for data cleaning, format standardization, and basic field mapping; a knowledge engine layer for maintaining a core thesaurus, a medical terminology knowledge graph, ontology management, and an inference engine; and a deep governance layer for terminology normalization, natural language processing-based structuring, and knowledge fusion. The tag center layer includes: a data view for defining source table associations, filtering conditions, and field mappings; tag computation for automatically generating scalar values from meta-patterns through computational patterns and natural language; and AI-driven automated configuration, including clinical scenario context disambiguation, RAG-enhanced retrieval, multi-layer encoding automatic mapping, intent-guided computational pattern inference, large language model generation, multi-round iterative verification, and automatic SQL synthesis. The application service layer includes: a tag service API for inputting patient identifiers and medical tag lists and returning production results; and intelligent research, management, and quality control applications for consuming wide tag tables for analysis and report generation. Regarding data security, information directly identifying patient identities is anonymized or hashed in the source data layer and standard data layer; anonymous identifiers are used as primary keys during medical tag production; exploratory execution in multi-round closed-loop verification only returns sample results with a LIMIT of 10 or LIMIT of 100; the medical terminology knowledge graph, core thesaurus, and standard database are deployed on the hospital's local network or a dedicated medical network environment; the large language model is deployed privately; tag configuration, SQL generation, and tag publishing operations are authorized by roles and recorded in audit logs. Hybrid cloud deployment is also possible: the medical terminology knowledge graph and its core word database are deployed locally; the large language model inference is deployed in the cloud; and retrieval results and generation instructions are transmitted through encrypted channels.
[0054] The system described in the above embodiments is used to execute the corresponding medical label intelligent generation method based on the collaboration of knowledge graph and large language model in the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0055] like Figure 3 As shown, based on the same application concept, and corresponding to any of the above embodiments, this application also discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the above-mentioned intelligent medical label generation method based on the collaboration of knowledge graph and large language model.
[0056] Specifically, the device includes: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected within the device via the bus 1050.
[0057] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), GPU (Graphics Processing Unit), or one or more integrated circuits, to implement relevant programs and achieve the technical solutions provided in the embodiments of this specification.
[0058] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1020 and called by the processor 1010. The input / output interface 1030 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices can include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices can include displays, projectors, speakers, vibrators, indicator lights, etc.
[0059] The communication interface 1040 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB (Universal Serial Bus), network cable, etc.) or wireless means (such as mobile network, WIFI (Wireless Fidelity), Bluetooth, etc.).
[0060] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.
[0061] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.
[0062] The electronic device described in the above embodiments is used to implement the corresponding medical label intelligent generation method based on the collaboration of knowledge graph and large language model in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0063] Based on the same application concept, and corresponding to any of the above embodiments, this application also discloses a computer-readable storage medium that stores computer instructions for enabling a computer to implement the above-described intelligent medical label generation method based on the collaboration of knowledge graph and large language model.
[0064] The computer-readable storage medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium, which can be used to store information accessible by a computing device. The computer instructions stored in the storage medium of the above embodiments are used to enable the computer to implement the intelligent medical label generation method based on knowledge graph and large language model collaboration as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0065] The above description is merely a preferred embodiment and the technical principles employed in this application. This application is not limited to the specific embodiments or combinations thereof, and various obvious changes, readjustments, and substitutions that can be made by those skilled in the art will not depart from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the claims.
Claims
1. A method for intelligent generation of medical tags based on the collaboration of knowledge graph and large language model, characterized in that, include: Receive a natural language description of the SQL data retrieval requirements for medical tags; Based on the clinical path nodes in the medical terminology knowledge graph, the natural language description is disambiguated to obtain a structured semantic representation that includes anchor events, relative time windows, and anchor selection strategies. Based on the structured semantic representation, an enhanced context is constructed by obtaining a three-layer mapping relationship from natural language description to medical standard code, from medical standard code to data table field, and from data table field to available aggregation methods through RAG enhanced retrieval. The large language model is invoked to generate structured data retrieval logic containing SQL drafts based on the enhanced context; The structured data retrieval logic is executed in the corresponding medical database. Based on the execution result, a structured correction instruction containing the error diagnosis dimension is constructed and fed back to the large language model for closed-loop verification. Then, the structured data retrieval logic is regenerated until the structured correction instruction no longer contains the error diagnosis dimension. The data retrieval logic that has passed closed-loop verification is input into the SQL template engine, which generates an executable SQL statement according to the anchor selection strategy. The corresponding medical label is created based on the executable SQL statement.
2. The intelligent medical tag generation method based on the collaboration of knowledge graph and large language model as described in claim 1, characterized in that, Context disambiguation includes: Scene keywords are extracted from natural language descriptions, and clinical path nodes containing the scene keywords are matched in the medical terminology knowledge graph to form a candidate node set; The target indicator type and time range in the natural language description are matched with the associated test items and default time windows of each clinical pathway node in the candidate node set, and non-matching clinical pathway nodes are filtered out. The anchor event, the relative time window, and the anchor selection strategy are determined based on the filtered clinical pathway nodes.
3. The intelligent medical tag generation method based on the collaboration of knowledge graph and large language model according to claim 1, characterized in that, Each of the three mapping layers is maintained independently, and manual confirmation is triggered when any layer fails to map.
4. The intelligent medical tag generation method based on the collaboration of knowledge graph and large language model according to claim 1, characterized in that, The three-layer mapping relationship obtained through RAG-enhanced retrieval includes: Based on the clinical scenario field in the structured semantic representation, the knowledge subgraph corresponding to the clinical scenario field is selected from the mapping table from clinical scenario to knowledge subgraph; Within the selected knowledge subgraph, entity links are performed, linking medical entities in the natural language description with standard concept nodes, and then the corresponding medical standard codes, synonyms, and superordinate and subordinate concepts are returned. Based on the medical standard code, query the field mapping table of the core thesaurus of the medical terminology knowledge graph, and return the candidate data table fields, field data types, common aggregation methods, and value ranges; The enhanced context is constructed by sorting and pruning the medical standard codes, synonyms, hyponyms and hypernyms, candidate data table fields, field data types, common aggregation methods, and value ranges according to their relevance to the current SQL data retrieval requirements.
5. The intelligent medical tag generation method based on the collaboration of knowledge graph and large language model according to claim 1, characterized in that, The construction of structured modification instructions includes: When the execution result is empty, construct a structured correction instruction for checking the time window direction, the tightness of the encoding matching conditions, and the table association relationship; When an abnormal value is found in the execution result, a structured correction instruction is constructed to check the correctness of field mapping and unit conversion requirements; When an error occurs during execution, the system first performs automatic repair based on predefined SQL syntax correction rules. If repair fails, a structured correction instruction is constructed to check the correctness of table names, field names, and SQL syntax.
6. The intelligent medical tag generation method based on the collaboration of knowledge graph and large language model according to claim 1, characterized in that, Generating executable SQL statements using an SQL template engine includes: When the anchor point selection strategy is the default anchor point, the time window filtering conditions are generated directly using the anchor point time field. When the anchor selection strategy is the first anchor, the minimum anchor time is selected by aggregation through common table expressions; When the anchor selection strategy is the last anchor, the maximum anchor time is selected by aggregation through common table expressions. Generate surgical failure filtering conditions, department transfer exclusion conditions, and cross-day surgical anchor time field selection conditions based on hospital business configuration rules.
7. The intelligent medical tag generation method based on the collaboration of knowledge graph and large language model according to claim 1, characterized in that, The process includes the following steps before invoking the large language model: Based on the natural language features in the natural language description, the computational pattern corresponding to the user's intent is automatically inferred through predefined inference rules; The calculation modes include one or more of the following: direct mapping, transformation mapping, aggregation statistics, existence judgment, formula calculation, and event relative interval. When a natural language description contains multiple natural language features, the computation mode is a combination mode.
8. A medical label intelligent generation system based on the collaboration of knowledge graph and large language model, characterized in that, include: The request access module is used to receive natural language descriptions that describe the SQL data retrieval requirements for medical tags. The clinical scenario context disambiguation module is used to perform context disambiguation on the natural language description based on clinical path nodes in the medical terminology knowledge graph, so as to obtain a structured semantic representation that includes anchor events, relative time windows, and anchor selection strategies. The RAG enhanced retrieval module is used to obtain a three-layer mapping relationship from natural language description to medical standard code, from medical standard code to data table field, and from data table field to available aggregation method based on the structured semantic representation, thereby constructing an enhanced context. The large language model generation module is used to call the large language model and generate structured data retrieval logic containing SQL drafts based on the enhanced context. The closed-loop verification module is used to execute the structured data retrieval logic in the corresponding medical database, construct a structured correction instruction containing the error diagnosis dimension based on the execution result and feed it back to the large language model for closed-loop verification, and then regenerate the structured data retrieval logic until the structured correction instruction no longer contains the error diagnosis dimension. The SQL automatic synthesis module is used to input the data retrieval logic that has passed the closed-loop verification into the SQL template engine, and the SQL template engine generates executable SQL statements according to the anchor point selection strategy. The label creation module is used to create corresponding medical labels based on the executable SQL statements.
9. An electronic device, characterized in that, The invention includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the intelligent medical label generation method based on the collaboration of knowledge graph and large language model as described in any one of claims 1-7.
10. A storage medium, which is a computer-readable storage medium, characterized in that, The device stores computer instructions for instructing the computer to implement the intelligent medical label generation method based on the collaboration of knowledge graph and large language model as described in any one of claims 1-7.
Citation Information
Patent Citations
Methods, devices, storage media, and terminals for labeling clinical data
CN112289454B
A Smart Slot Filling and Pattern Linking Method Based on RAG and M-Schema
CN120804301B
