Multi-agent hospital data analysis system and method based on self-evolution mechanism
By constructing a multi-agent hospital data analysis system with a self-evolutionary mechanism, the problem of inaccurate query results in hospital data analysis was solved, achieving efficient, accurate, and dynamically adaptable medical data, and meeting the diverse query needs of hospital operations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU GUANGSHU MEDICAL TECHNOLOGY CO LTD
- Filing Date
- 2026-01-30
- Publication Date
- 2026-05-19
AI Technical Summary
Existing technologies struggle to provide intuitive, convenient, and diverse queries in hospital data analysis, and large language models lack a deep understanding of medical-specific knowledge, resulting in inaccurate query results that do not comply with medical management standards.
A multi-agent hospital data analysis system based on a self-evolution mechanism is constructed, including a data fusion module, a multi-agent collaboration module, and a self-evolution optimization module. The system uses planning agents to perform intent recognition and task planning, combines multi-agent analysis of medical scenarios, generates structured call instructions, and dynamically adapts prompts to improve query accuracy.
It enables efficient, accurate, and diversified querying of medical data, improves the automation level and professional accuracy of hospital data analysis, dynamically enhances adaptability, and meets the diverse needs of hospital operations.
Smart Images

Figure CN122067680A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical data processing technology, specifically to a multi-agent hospital data analysis system and method based on a self-evolution mechanism. Background Technology
[0002] Modern hospitals accumulate massive amounts of heterogeneous data from various business systems such as surgery, diagnosis and treatment, testing, and equipment in their daily operations. These data are not standardized and are stored in a scattered manner, and the calculation rules for the various business indicators (such as operating room utilization) involved are also quite complex. At the same time, hospital administrators have increasingly diverse needs for data queries, from real-time status queries to historical trend analysis, all hoping to obtain intuitive and convenient access methods.
[0003] However, existing technical solutions are insufficient to meet this demand. Traditional fixed reporting models lack flexibility and require a long development cycle to respond to new requirements. Although business intelligence tools enhance analytical capabilities, they still have high requirements for users' technical background, and non-technical personnel cannot operate them directly. In recent years, attempts to directly use large language models for natural language queries have improved the convenience of interaction, but have also brought new problems. Due to the domain characteristics of medical data, it contains a large amount of proprietary, implicit, and unpublished business knowledge, such as internal departmental accounting rules, specific equipment performance evaluation standards, and mapping relationships of medical insurance policies. Large language models themselves lack a deep understanding of this hospital-specific business knowledge, and existing systems generally rely on generalized or static prompts. This fails to effectively inject medical-specific knowledge into the model's reasoning process and is difficult to adapt to the multi-stage parsing needs in medical scenarios. Consequently, the model is prone to deviations when interpreting query intent and generating computational logic, ultimately outputting inaccurate or non-compliant query results. More importantly, current systems rely heavily on manually written, fixed templates. These templates are not only highly customized and poorly reusable, but also lack adaptability across medical business scenarios and cannot match the reasoning characteristics of different large language models, further exacerbating the instability of query results and the limitations of system usage. Summary of the Invention
[0004] The purpose of this invention is to provide a multi-agent hospital data analysis system and method based on a self-evolution mechanism to solve the problems mentioned in the background art.
[0005] To address the aforementioned technical problems, this invention provides the following technical solution: a multi-agent hospital data analysis system based on a self-evolution mechanism, comprising a data fusion module, a multi-agent collaboration module, a business logic module, and a self-evolution optimization module; The data fusion module collects operational data from multiple heterogeneous business systems in the hospital and preprocesses it to form fused data of a unified specification; The multi-agent collaboration module includes a planning agent and a medical scenario multi-agent; after receiving a user's natural language query, the planning agent combines multi-round interaction history and dynamically constructed business scenario prompts to perform intent recognition and cross-scenario task planning, and generate scheduling decisions. The multi-agent system for medical scenarios is used to parse queries for corresponding medical business scenarios and generate invocation instructions based on scheduling decisions. The parsing includes semantic completion based on medical dialogue context, intent classification according to medical business logic, medical domain slot extraction, and medical term entity linking. Among them, the multi-agent system in the medical scenario includes a surgical agent for surgical data analysis and a medical technology resource agent for medical technology resource data analysis. The business logic module receives medical business parameters and page operation parameters from the call command, performs business calculations, indicator statistics and pagination sorting operations based on the fused data, and returns structured query results and generates natural language responses. The self-evolutionary optimization module continuously collects state records, query parsing paths, execution results, and feedback information generated during the interaction process. By analyzing the interaction logs and organizing new datasets, it automatically evaluates and iteratively optimizes the agent's intent classification, business parameter extraction, response generation, and prompt word dynamic adaptation capabilities.
[0006] Furthermore, the data fusion module includes a data source access unit, a data processing unit, and a data storage unit; The data source access unit is used to build a unified data access platform and uses database master-slave replication technology to create read-only copies for multiple heterogeneous business systems of the hospital. These heterogeneous business systems include, but are not limited to, business systems that generate operational data, such as Hospital Information System (HIS), Picture Archiving and Communication System (PACS), Surgical Anesthesia Information System (SAP System), Laboratory Information System (LIS), and Electronic Medical Record System (EMR). The data processing unit deploys ETL tools to first extract medical operation-related data from read-only copies of various data sources using structured query statements, and then performs data cleaning and standardization processing according to preset rules. The operation-related data includes, but is not limited to, surgical schedules, medical records, laboratory test reports, and equipment operation data. The data storage unit builds a unified data warehouse based on MySQL, classifies and stores the pre-processed fused data, and synchronizes the latest data from the data processing unit at preset cycles through a scheduled task mechanism.
[0007] Furthermore, the planning agent in the multi-agent collaboration module is configured with a state data structure specifically for medical scenarios. This data structure includes at least: the user's original query statement, a scheduling decision control field for identifying which business sub-agent needs to be called, an exception information field, and a multi-round interaction history field. After receiving a user's natural language query, the system reads the multi-round interaction history from the state data structure and concatenates them in chronological order to form a medical business-related text containing a complete contextual dialogue. Based on the user's query, and according to a pre-defined medical keyword system, core semantic keywords such as surgical type, equipment name, statistical indicators, and department name are identified and extracted. Using these extracted core semantic keywords as the retrieval basis, information related to surgical rules and equipment management specifications is retrieved from structured or semi-structured data sources relevant to hospital operations. Structured data sources mainly refer to the core database tables of various hospital business systems; semi-structured data sources mainly refer to hospital regulations and operating guidelines in document form. The retrieval process calculates the cosine similarity between the vector generated based on the user's query keywords and the entry vectors in the pre-built medical knowledge base, filtering out information with a relevance higher than a pre-defined threshold. Based on the retrieved related information, the system organizes and fills the information according to a preset prompt template to generate prompts that integrate medical business attributes. The prompts use the desc format to standardize field definitions and a unified output format template. The format is fixed as "business rule summary + agent call constraint + query adaptation direction". For example: "The current query involves the core keywords [CT equipment, usage efficiency]. The business rules to be followed are: CT equipment usage efficiency = actual running time / appointment time × 100%, only data of equipment under normal operating conditions are counted; medical technology resource agents can be called, but surgical agents cannot be called; the query adaptation direction is a medical technology resource stored procedure call, and core parameters such as equipment type and statistical time period need to be extracted." Initialize an inference component that encapsulates API calls of a large language model. This component is used to convert natural language queries into structured scheduling decisions adapted to medical scenarios. Inject the dynamically generated prompts into this component to enable it to perform analysis adapted to medical business scenarios. After inputting the user query and the text associated with the medical business into the inference component, the component calls the large language model to perform scheduling planning inference and finally outputs a scheduling decision on whether to call the surgical agent or the medical technology resource agent. The specific workflow of the inference component is as follows: Dynamically generated prompts are used as system instructions, and user queries and medical business-related text are used as user input. Together, these form a complete request conforming to the API call format of the large language model. The request explicitly constrains the output to be structured text containing core fields such as "whether to call the surgical agent" and "whether to call the medical resource agent." Next, a call is made to the large language model service. The model performs intent analysis based on the injected medical business rules and constraints, outputting a structured result containing scheduling decisions. Finally, the inference output is subjected to structured parsing adapted to the medical scenario to determine whether the output conforms to the aforementioned preset expected format. If the parsing is successful, the parsed scheduling decision result is written into the scheduling decision control field of the planning agent's state data structure. If the parsing fails, such as due to incorrect output format, missing core fields, or invalid field values, the preset medical data query security default scheduling strategy is automatically adopted: the planning agent simultaneously sends scheduling instructions and original queries to the surgical agent and the medical technology resource agent, starts dual-path parallel analysis, and records the abnormal information in the abnormal information field of the state data structure.
[0008] Furthermore, the surgical agent is used to execute query parsing and instruction generation for surgical data analysis; the surgical agent is configured and maintains a state data structure that includes thread ID, original user question, question type, rewritten question, function name, topic name, whether it is a comparison type question, SQL statement, SQL query result, query result preview, query result summary, final reply, chart type, chart x-axis name_key, chart y-axis data_key, dialogue history messages and returned data status; After receiving the scheduling decision from the planning agent, the system reads the user's original question and dialogue history messages in the state data structure to determine whether there is any unclear reference or missing context in the current medical dialogue. If rewriting is required, the system constructs prompt words based on the dialogue history and pre-stored standard question examples for surgical scenarios and calls a large language model to complete and rewrite the question with medical semantics, generating a rewritten question that includes one or more necessary slots such as a clear time period, surgical indicators, surgical building, operating room, surgical name, department, personnel name, and delay reason. The rewritten question is converted into a vector representation using a semantic embedding model; standard question example libraries for surgical scenarios (BI and TOPIC categories) are retrieved from the medical knowledge base; the two types of standard examples are vectorized separately using the same semantic embedding model to construct BI and TOPIC example vector libraries; the cosine similarity between the rewritten question vector and the vectors of each entry in the two vector libraries is calculated, and the M standard examples with the highest relevance (M≥1) are selected; combined with the classification task description of "determining whether the question is BI or TOPIC", prompt words containing "classification requirements + rewritten question + M similar examples" are constructed, and a large language model is called for reasoning; Among them, the BI class represents a statistical query for a single medical business indicator, used to obtain specific values, rankings and other quantitative results, corresponding to a single predefined stored procedure; The TOPIC class represents a multi-dimensional integrated analysis query for medical business topics, used to obtain comprehensive conclusions such as cause analysis and correlation. It corresponds to the combined call of multiple predefined stored procedures; finally, based on the reasoning results of the large language model, the intent category of the current rewritten query is determined.
[0009] The surgical agent performs corresponding operations based on the determined intent category: When the question type is BI, the specific BI type and corresponding predefined stored procedure name are determined by matching the cosine similarity between the rewritten question vector and the subdivided example library of surgical scenario BI types. The subdivided example library consists of standard question examples with different specific BI business intentions, and each subdivided example in the library is associated with a unique predefined stored procedure name. Based on the preset surgical business slot definition, parameter values such as department name, operating room name, and personnel name are extracted from the rewritten question and mapped to standard medical terms through entity links. Specifically, entity alignment is achieved by querying the hospital's internal standardized medical terminology dictionary and using terminology string matching and semantic similarity verification. Simultaneously, the natural language time period is parsed and converted into a standardized time format of "start time + end time," and the sorting conditions implicitly or explicitly mentioned by the user are extracted, such as descending order by delay duration or ascending order by number of surgeries. When the question type is TOPIC, the corresponding analysis topic is matched according to the intent classification result, and the predefined stored procedure combination of the topic is retrieved; according to the parameter requirements of each stored procedure in the combination, the above parameter extraction, entity linking and time period parsing steps are executed in a loop. Based on the established predefined stored procedures, mapped standardized parameters, parsed time periods, and sorting conditions, the SQL statements and related execution parameters are encapsulated into standardized calling instructions. These instructions are in JSON format, with core fields including "proc_name" (predefined stored procedure name), "params" (standardized parameter set, including time range, department, sorting conditions, etc.), and "page_info" (default pagination parameters, such as page number and number of data per page). This results in standardized calling instructions that can be directly parsed and executed by business logic modules.
[0010] The medical technology resource agent in the multi-agent collaboration module is used to perform query parsing and instruction generation for medical technology resource data analysis; the medical technology resource agent configures and maintains a state data structure consistent with the surgical agent structure; and executes the same multi-stage parsing process as the surgical agent, including question rewriting, intent classification, structured parameter extraction and mapping, and instruction generation; In the process of parsing, the domain knowledge base, predefined business slots, entity linking rules and predefined stored procedures used by the medical technology resource intelligent agent are all dedicated to the medical technology resource business scenario, and ultimately generate standardized calling instructions for medical technology resource type queries.
[0011] Furthermore, the business logic module deploys a stored procedure engine, and the encapsulated predefined stored procedures are divided into surgical stored procedures and medical technology resource stored procedures according to business scenarios; The input parameters of the stored procedure are uniformly defined in JSON format, including business calculation parameters, pagination parameters, and sorting parameters. The business calculation parameters are mapped one-to-one with the standardized slot parameters extracted by the corresponding intelligent agent. The pagination parameters specify the page number of the data acquisition and the amount of data per page. The sorting parameters specify the sorting field and sorting direction. After receiving the standardized call command, the system first parses the JSON format input parameters to extract the business calculation parameters, pagination parameters, and sorting parameters. Based on the fused data, it executes the business calculation logic and indicator statistics rules encapsulated in the storage process, and at the same time, it filters and adjusts the order of the calculation results according to the pagination parameters and sorting parameters. The business calculation logic and indicator statistics rules are derived from the hospital's official operating standards, such as surgical efficiency calculation specifications, equipment utilization rate statistics rules, and departmental diagnosis and treatment business requirements. The query results are output according to a preset structured format, which includes field names, data types, numerical units, and result descriptions.
[0012] Furthermore, the self-evolution optimization module includes a business logic optimization unit and a prompt word self-evolution unit; The business logic optimization unit continuously collects business-related data during the interaction process, including a complete record of the state data structure of each intelligent agent, intermediate results of each stage of query parsing, structured query results returned by stored procedure execution, and user feedback and suggestions on the analysis results. By constructing an agent performance evaluation model, five core indicators are quantitatively evaluated: planning agent scheduling accuracy, BI / TOPIC intent classification accuracy, BI intent classification accuracy, TOPIC intent classification accuracy, and slot extraction accuracy. Among them, the planning agent scheduling accuracy rate is the ratio of the number of queries that correctly judge "calling surgical agent / medical technology resource agent" to the total number of queries; BI / TOPIC intent classification accuracy is the ratio of the number of queries that correctly classify queries into BI / TOPIC categories to the total number of queries. BI intent classification accuracy is the ratio of the number of queries that correctly match a BI category query to a specific subcategory to the total number of BI category queries. TOPIC intent classification accuracy is the ratio of the number of queries that correctly match a TOPIC query to a specific analysis topic to the total number of TOPIC queries. The slot extraction accuracy rate is the ratio of the number of correctly extracted slot parameters to the total number of slot parameters that should be extracted. In the intelligent agent performance evaluation model, the weights of each indicator are preset. Combined with the business priority of the hospital operation data analysis scenario, the weight allocation of each core indicator is preset. The model calculates the comprehensive performance score of the intelligent agent by weighted summation of (single indicator score × corresponding weight), where the single indicator score is the actual ratio of the indicator × 100. Simultaneously, optimization trigger thresholds are set: Preset benchmarks for each core indicator and a pass / fail line for overall performance. When any core indicator score falls below the corresponding benchmark, or the overall performance score falls below the overall pass / fail line, the system automatically initiates an iterative optimization process: Optimization targets are located based on the evaluation results. If the planning agent scheduling accuracy is not up to standard, then the following measures will be taken: supplementing with manually annotated cross-scenario scheduling examples, optimizing the medical keyword system, and reconstructing the structured prompt word templates used for planning agent scheduling decisions; if the BI / TOPIC intent classification accuracy is not up to standard, then manually annotated BI and TOPIC class standard question examples will be added, the semantic embedding model will be retrained, and the knowledge base vector library will be updated to improve semantic matching accuracy; if the BI intent classification accuracy is not up to standard, then the correlation deviation between BI class sub-intents and predefined stored procedures will be corrected, sub-type standard examples will be added, and prompt words used for BI sub-category determination will be optimized; if the TOPIC intent classification accuracy is not up to standard, then the definition scope of the analysis topic will be adjusted, examples of stored procedure combinations associated with the topic will be added, and prompt words used for topic matching will be optimized; if the slot extraction accuracy is not up to standard, based on slot extraction error cases, slot identification keywords will be added, fuzzy expression matching rules will be expanded, and slot extraction logic will be refined; at the same time, non-standard terms with failed entity links but semantic similarity ≥85% will be automatically collected and added to the hospital's internal standardized medical terminology dictionary after manual review.
[0013] The prompt word self-evolution unit is used to automatically evaluate and optimize the prompt words used by each agent during the parsing process: For each business field in the slot extraction task, evaluate its extraction accuracy separately. When the extraction accuracy of a certain field is lower than its set threshold, the self-evolution process is initiated. Extract all execution cases of relevant tasks from historical interaction logs as the initial training set; Using the target large language model currently deployed in the system, re-execute on all cases in the initial training set; select the cases that the model can execute completely correctly to form case set A; Set random parameter dimensions for the initial training set, including the number of cases extracted, the order of cases, and whether to enable mind chain guidance; N case subsets are randomly constructed from case set A. Each subset contains a complete example structure of user medical query and standard medical slot output. The structured description parameters of the extracted slots are adjusted simultaneously, including the medical scenario business description of the slots and the slot output format definition. For each subset of cases, temporary prompt words are constructed by combining the corresponding structured description parameters. The target large language model is then called to test new medical query cases that have not participated in training, and the extraction accuracy of each field is calculated. If the accuracy does not meet the preset requirements, modify the random parameter combination, adjust the structured description of the extracted slots, reconstruct the case subset and evaluate it until the optimal performance threshold parameter combination and case subset for slot extraction accuracy is found, and new prompt words are constructed. When the system switches to use different large language models, repeat the above steps to automatically filter and build a set of suitable cases and prompt words for the new model; The business logic optimization unit and the prompt word self-evolution unit collaborate through a shared interaction log database, and each triggers its own optimization process independently.
[0014] Multi-agent hospital data analysis methods based on self-evolutionary mechanisms include: S1: Collect operational data from multiple heterogeneous business systems in the hospital, clean, transform, and standardize it to form unified data fusion data; S2: Receive the natural language query input by the user. The planning agent combines the history of multiple rounds of interaction with dynamically constructed business scenario prompts to perform intent recognition and task planning on the query and generate a scheduling decision. Based on the scheduling decision, the corresponding medical scenario multi-agent is invoked to perform semantic completion, intent classification, business slot extraction and entity linking on the query, and generate standardized invocation instructions based on the parsing results. S3: Invoke the predefined stored procedure corresponding to the standardized invocation instruction, perform business calculations, indicator statistics and pagination sorting operations based on the fused data, and return structured query results to generate a natural language response; S4: Continuously collect and analyze the state records, parsing paths, execution results and feedback information generated during the interaction process of steps S2 and S3. Organize new datasets by analyzing interaction logs, and automatically evaluate and iteratively optimize the agent's intent classification, business parameter extraction, response generation and prompt word dynamic adaptation capabilities.
[0015] Compared with the prior art, the beneficial effects achieved by the present invention are: This invention overcomes the limitations of existing general-purpose multi-agent systems in adapting to medical data analysis scenarios by constructing a multi-agent collaborative mechanism and a two-dimensional self-evolutionary optimization system specifically for medical scenarios. Unlike existing technologies that only use general intent classification, fixed prompt word templates, and single-dimensional optimization, this invention innovatively binds the multi-agent collaborative process with the operational needs of hospitals. It designs medical-specific intent classification logic for BI (simple indicator query) and TOPIC (integrated analysis query), completes the necessary slots such as time period and surgical indicators by medical-customized prompt words, extracts specific parameters such as surgical department and equipment type and completes the entity linking of medical terms, and then combines scenario-based predefined stored procedures to realize standardized instruction calls, forming a closed loop of medical adaptation for the entire process of intent recognition, parameter parsing, instruction generation, and business execution. This solves the problems that existing technologies cannot handle, such as inconsistent medical terms, complex business logic, and missing parameters. Meanwhile, this invention achieves dual-dimensional iteration of business rules and prompt word adaptation through a self-evolutionary optimization module. It focuses on core medical indicators such as intent classification accuracy and slot extraction accuracy, dynamically adjusts the vector representation of the medical knowledge base, entity mapping dictionary, and prompt word features, and continuously improves the system's parsing accuracy and business adaptability. Compared with the shortcomings of existing multi-agent systems that can only complete general tasks and have a single optimization dimension, this invention achieves a fundamental leap from general technology application to medical scenario customization, significantly improving the automation level, professional accuracy, and dynamic adaptation capability of hospital data analysis, and providing efficient and reliable technical support for hospital operational decision-making. Attached Figure Description
[0016] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a system architecture diagram of a multi-agent hospital data analysis system based on a self-evolution mechanism; Figure 2 This is a flowchart of the business logic optimization for a multi-agent hospital data analysis system based on a self-evolution mechanism; Figure 3 This is a flowchart of the prompt word optimization process for a multi-agent hospital data analysis system based on a self-evolution mechanism. Detailed Implementation
[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0018] Please see Figures 1-3 The present invention provides a technical solution: a multi-agent hospital data analysis system based on a self-evolution mechanism, including a data fusion module, a multi-agent collaboration module, a business logic module, and a self-evolution optimization module; The data fusion module collects operational data from multiple heterogeneous business systems in the hospital and preprocesses it to form fused data of a unified specification; The multi-agent collaboration module includes a planning agent and a medical scenario multi-agent; after receiving a user's natural language query, the planning agent combines multi-round interaction history and dynamically constructed business scenario prompts to perform intent recognition and cross-scenario task planning, and generate scheduling decisions. The multi-agent system for medical scenarios is used to parse queries for corresponding medical business scenarios and generate invocation instructions based on scheduling decisions. The parsing includes semantic completion based on medical dialogue context, intent classification according to medical business logic, medical domain slot extraction, and medical term entity linking. Among them, the multi-agent system in the medical scenario includes a surgical agent for surgical data analysis and a medical technology resource agent for medical technology resource data analysis. The business logic module receives medical business parameters and page operation parameters from the call command, performs business calculations, indicator statistics and pagination sorting operations based on the fused data, and returns structured query results; The self-evolutionary optimization module continuously collects state records, query parsing paths, execution results, and feedback information generated during the interaction process. By analyzing the interaction logs, it automatically evaluates and iteratively optimizes the agent's intent classification, parameter mapping, and result generation.
[0019] Furthermore, the data fusion module includes a data source access unit, a data processing unit, and a data storage unit; The data source access unit is used to build a unified data access platform and uses database master-slave replication technology to create read-only copies for multiple heterogeneous business systems of the hospital. These heterogeneous business systems include, but are not limited to, business systems that generate operational data, such as Hospital Information System (HIS), Picture Archiving and Communication System (PACS), Surgical Anesthesia Information System (SAP System), Laboratory Information System (LIS), and Electronic Medical Record System (EMR). The data processing unit deploys ETL tools to first extract medical operation-related data from read-only copies of various data sources using structured query statements, and then performs data cleaning and standardization processing according to preset rules. The operation-related data includes, but is not limited to, surgical schedules, medical records, laboratory test reports, and equipment operation data. The data storage unit builds a unified data warehouse based on MySQL, classifies and stores the pre-processed fused data, and synchronizes the latest data from the data processing unit at preset cycles through a scheduled task mechanism.
[0020] Furthermore, the planning agent in the multi-agent collaboration module is configured with a state data structure specifically for medical scenarios. This data structure includes at least: the user's original query statement, a scheduling decision control field for identifying which business sub-agent needs to be called, an exception information field, and a multi-round interaction history field. After receiving a user's natural language query, the system reads the multi-round interaction history from the state data structure and concatenates them in chronological order to form a medical business-related text containing a complete contextual dialogue. Based on the user's query and a pre-defined medical keyword system, core semantic keywords such as surgery type, equipment name, statistical indicators, and department name are identified and extracted. Using these extracted keywords as the retrieval basis, information related to surgical rules and equipment management specifications is retrieved from structured or semi-structured data sources relevant to hospital operations. Structured data sources primarily refer to core database tables of various hospital business systems, such as surgical management specification tables, equipment standard operating procedure tables, and departmental diagnosis and treatment business rule tables storing specific business rules and constraints. Semi-structured data sources primarily refer to hospital regulations and operating guidelines in document form, such as medical equipment usage and maintenance manuals, operating room management system documents, and medical technology resource scheduling and emergency guidelines. The retrieval process calculates the cosine similarity between the vector generated based on the user's query keywords and the entry vectors in the pre-built medical knowledge base, filtering out information with a relevance higher than a pre-defined threshold. Based on the retrieved related information, the system organizes and fills the information according to a preset prompt template to generate prompts that integrate medical business attributes. The prompts use the desc format to standardize field definitions and a unified output format template. The format is fixed as "business rule summary + agent call constraint + query adaptation direction". For example: "The current query involves the core keywords [CT equipment, usage efficiency]. The business rules to be followed are: CT equipment usage efficiency = actual running time / appointment time × 100%, only data of equipment under normal operating conditions are counted; medical technology resource agents can be called, but surgical agents cannot be called; the query adaptation direction is a medical technology resource stored procedure call, and core parameters such as equipment type and statistical time period need to be extracted." Initialize an inference component that encapsulates API calls of a large language model. This component is used to convert natural language queries into structured scheduling decisions adapted to medical scenarios. Inject the dynamically generated prompts into this component to enable it to perform analysis adapted to medical business scenarios. After inputting the user query and the text associated with the medical business into the inference component, the component calls the large language model to perform scheduling planning inference and finally outputs a scheduling decision on whether to call the surgical agent or the medical technology resource agent. The specific workflow of the inference component is as follows: Dynamically generated prompts are used as system instructions, and user queries and medical business-related text are used as user input. Together, these form a complete request conforming to the API call format of the large language model. The request explicitly constrains the output to be structured text containing core fields such as "whether to call the surgical agent" and "whether to call the medical resource agent." Next, a call is made to the large language model service. The model performs intent analysis based on the injected medical business rules and constraints, outputting a structured result containing scheduling decisions. Finally, the inference output is subjected to structured parsing adapted to the medical scenario to determine whether the output conforms to the aforementioned preset expected format. If the parsing is successful, the parsed scheduling decision result is written into the scheduling decision control field of the planning agent's state data structure. If the parsing fails, such as due to incorrect output format, missing core fields, or invalid field values, the preset medical data query security default scheduling strategy is automatically adopted: the planning agent simultaneously sends scheduling instructions and original queries to the surgical agent and the medical technology resource agent, starts dual-path parallel analysis, and records the abnormal information in the abnormal information field of the state data structure.
[0021] Furthermore, the surgical agent in the multi-agent collaboration module is used to execute query parsing and instruction generation for surgical data analysis; the surgical agent configures and maintains a state data structure that includes thread ID, original user question, question type, rewritten question, function name, topic name, whether it is a comparison type question, SQL statement, SQL query result, query result preview, query result summary, final reply, chart type, chart x-axis name_key, chart y-axis data_key, dialogue history messages and returned data status; After receiving the scheduling decision from the planning agent, the system reads the user's original question and dialogue history messages in the state data structure to determine whether there is any unclear reference or missing context in the current medical dialogue. If rewriting is required, the system constructs prompt words based on the dialogue history and pre-stored standard question examples for surgical scenarios and calls a large language model to complete and rewrite the question with medical semantics, generating a rewritten question that includes one or more necessary slots such as a clear time period, surgical indicators, surgical building, operating room, surgical name, department, personnel name, and delay reason. The rewritten question is converted into a vector representation using a semantic embedding model; standard question example libraries for surgical scenarios (BI and TOPIC categories) are retrieved from the medical knowledge base; the two types of standard examples are vectorized separately using the same semantic embedding model to construct BI and TOPIC example vector libraries; the cosine similarity between the rewritten question vector and the vectors of each entry in the two vector libraries is calculated, and the M standard examples with the highest relevance (M≥1) are selected; combined with the classification task description of "determining whether the question is BI or TOPIC", prompt words containing "classification requirements + rewritten question + M similar examples" are constructed, and a large language model is called for reasoning; Among them, the BI class represents a statistical query for a single medical business indicator, used to obtain specific values, rankings and other quantitative results, corresponding to a single predefined stored procedure; The TOPIC class represents a multi-dimensional integrated analysis query for medical business topics, used to obtain comprehensive conclusions such as cause analysis and correlation. It corresponds to the combined call of multiple predefined stored procedures; finally, based on the reasoning results of the large language model, the intent category of the current rewritten query is determined.
[0022] The surgical agent performs corresponding operations based on the determined intent category: When the question type is BI, the specific BI type and corresponding predefined stored procedure name are determined by matching the cosine similarity between the rewritten question vector and the subdivided example library of surgical scenario BI types. The subdivided example library consists of standard question examples for different specific BI business intentions (e.g., number of delayed first surgeries, distribution of surgeries with downtime). Each subdivided example in the subdivided example library is associated with a unique predefined stored procedure name. Based on the preset surgical business slot definition, parameter values such as department name, operating room name, and personnel name are extracted from the rewritten question and mapped to standard medical terms through entity links. Specifically, entity alignment is achieved by querying the hospital's internal standardized medical terminology dictionary (including standard terminology tables for departments, surgeries, and personnel) and using terminology string matching and semantic similarity verification. Simultaneously, the natural language time period is parsed and converted into a standardized time format of "start time + end time," and the sorting conditions implicitly or explicitly mentioned by the user are extracted, such as descending order by delay duration or ascending order by number of surgeries. When the question type is TOPIC, the corresponding analysis topic is matched according to the intent classification result, and the predefined stored procedure combination of the topic is retrieved; according to the parameter requirements of each stored procedure in the combination, the above parameter extraction, entity linking and time period parsing steps are executed in a loop. Based on the established predefined stored procedures, mapped standardized parameters, parsed time periods, and sorting conditions, the SQL statements and related execution parameters are encapsulated into standardized calling instructions. These instructions are in JSON format, with core fields including "proc_name" (predefined stored procedure name), "params" (standardized parameter set, including time range, department, sorting conditions, etc.), and "page_info" (default pagination parameters, such as page number and number of data per page). This results in standardized calling instructions that can be directly parsed and executed by business logic modules.
[0023] The medical technology resource agent in the multi-agent collaboration module is used to perform query parsing and instruction generation for medical technology resource data analysis; the medical technology resource agent configures and maintains a state data structure consistent with the surgical agent structure; and executes the same multi-stage parsing process as the surgical agent, including question rewriting, intent classification, structured parameter extraction and mapping, and instruction generation; In the process of parsing, the domain knowledge base, predefined business slots, entity linking rules and predefined stored procedures used by the medical technology resource intelligent agent are all dedicated to the medical technology resource business scenario, and ultimately generate standardized calling instructions for medical technology resource type queries.
[0024] Furthermore, the business logic module deploys a stored procedure engine, and the encapsulated predefined stored procedures are divided into surgical stored procedures and medical technology resource stored procedures according to business scenarios; The input parameters of the stored procedure are uniformly defined in JSON format, including business calculation parameters, pagination parameters, and sorting parameters. The business calculation parameters are mapped one-to-one with the standardized slot parameters extracted by the corresponding intelligent agent. The pagination parameters specify the page number of the data acquisition and the amount of data per page. The sorting parameters specify the sorting field and sorting direction. After receiving the standardized call command, the system first parses the JSON format input parameters to extract the business calculation parameters, pagination parameters, and sorting parameters. Based on the fused data, it executes the business calculation logic and indicator statistics rules encapsulated in the storage process, and at the same time, it filters and adjusts the order of the calculation results according to the pagination parameters and sorting parameters. The business calculation logic and indicator statistics rules are derived from the hospital's official operating standards, such as surgical efficiency calculation specifications, equipment utilization rate statistics rules, and departmental diagnosis and treatment business requirements. The query results are output according to a preset structured format, which includes field names, data types, numerical units, and result descriptions.
[0025] Furthermore, the self-evolution optimization module includes a business logic optimization unit and a prompt word self-evolution unit; like Figure 2 As shown, the business logic optimization unit continuously collects business-related data during the interaction process, specifically including a complete record of the state data structure of each intelligent agent, intermediate results of each stage of query parsing, structured query results returned by the execution of stored procedures, and user feedback and suggestions on the analysis results; By constructing an agent performance evaluation model, five core indicators are quantitatively evaluated: planning agent scheduling accuracy, BI / TOPIC intent classification accuracy, BI intent classification accuracy, TOPIC intent classification accuracy, and slot extraction accuracy. Among them, the planning agent scheduling accuracy rate is the ratio of the number of queries that correctly judge "calling surgical agent / medical technology resource agent" to the total number of queries; BI / TOPIC intent classification accuracy is the ratio of the number of queries that correctly classify queries into BI / TOPIC categories to the total number of queries. BI intent classification accuracy is the ratio of the number of queries that correctly match a BI category query to a specific subcategory to the total number of BI category queries. TOPIC intent classification accuracy is the ratio of the number of queries that correctly match a TOPIC query to a specific analysis topic to the total number of TOPIC queries. The slot extraction accuracy rate is the ratio of the number of correctly extracted slot parameters to the total number of slot parameters that should be extracted. In the intelligent agent performance evaluation model, the weights of each indicator are preset. Combined with the business priority of the hospital operation data analysis scenario, the weight allocation of each core indicator is preset. The model calculates the comprehensive performance score of the intelligent agent by weighted summation of (single indicator score × corresponding weight), where the single indicator score is the actual ratio of the indicator × 100. Simultaneously, optimization trigger thresholds are set: Preset benchmarks for each core indicator and a pass / fail line for overall performance. When any core indicator score falls below the corresponding benchmark, or the overall performance score falls below the overall pass / fail line, the system automatically initiates an iterative optimization process: Optimization targets are located based on the evaluation results. If the scheduling accuracy of the planning agent is not up to standard, the following measures will be taken: supplementing manually annotated cross-scenario scheduling examples, optimizing the medical keyword system, and reconstructing the structured prompt word template used for the planning agent's scheduling decisions; for example: supplementing manually annotated examples of "querying MRI equipment failure rate requires calling the medical technology resource agent"; adding medical technology equipment keywords such as "MRI, ultrasound" to the medical keyword system; and reconstructing the prompt word template to clarify the constraint that "when querying equipment operating status, the medical technology resource agent should be called first"; If the accuracy of BI / TOPIC intent classification is not up to standard, the semantic embedding model is retrained and the knowledge base vector library is updated by adding manually annotated standard question examples for BI and TOPIC classes to improve semantic matching accuracy. For example, manually annotated examples of "querying the number of surgeries in June 2025" (BI class) and "analyzing the correlation between surgical delays and equipment failures" (TOPIC class) are added; the semantic embedding model is retrained with the new examples, and the vector data of the two classes of examples in the knowledge base are updated. If the accuracy of BI intent classification is not up to standard, the following measures can be taken: correct the correlation deviation between BI category sub-intents and predefined stored procedures, supplement standard examples of sub-types, and optimize the prompt word logic used for BI sub-category determination; for example: correct the correlation deviation between "first surgery on-time rate query" and the stored procedure p_first_ontime_rate; supplement the BI sub-example of "query operating room utilization rate"; optimize the prompt word logic to clarify that "queries with single indicator statistics that need to return specific values should be matched with the corresponding BI sub-types"; If the accuracy of TOPIC intent classification is not up to standard, adjust the definition scope of the analysis topic, supplement examples of stored procedure combinations associated with the topic, and optimize the prompt words used for topic matching; for example: expand the definition scope of the topic "surgical efficiency analysis" to "including on-time rate, turnover rate, and reasons for delay"; supplement examples of stored procedure combinations associated with "surgical efficiency analysis" and "on-time rate statistics and delay reason investigation"; optimize prompt words to clarify that "multi-dimensional analysis queries need to match the topic and stored procedure combination corresponding to the TOPIC class"; If the slot extraction accuracy is not up to standard, based on the slot extraction error cases, the system supplements slot identification keywords, expands fuzzy expression matching rules, and refines the slot extraction logic. Simultaneously, it automatically includes non-standard terms with failed entity links but semantic similarity ≥ 85%, which are then added to the hospital's internal standardized medical terminology dictionary after manual review. For example, in the query "statistics on the number of minimally invasive surgeries in cardiac surgery," the system failed to correctly extract the department slot "cardiac surgery," possibly because the user wrote "heart surgery." Based on such error cases, the system supplements the identification keywords and aliases for "cardiac surgery" in the department slot definition, such as "heart surgery" and "cardiovascular surgery." At the same time, the system automatically includes the term "heart surgery," which has failed entity links, and because its semantic similarity to the standard term "heart surgery" is higher than 85%, it is added to the hospital's standardized medical terminology dictionary as a synonym after manual review.
[0026] The prompt word self-evolution unit is used to automatically evaluate and optimize the prompt words used by each agent during the parsing process: For each business field in the slot extraction task, evaluate its extraction accuracy separately. When the extraction accuracy of a certain field is lower than its set threshold, the self-evolution process is initiated. Extract all execution cases of relevant tasks from historical interaction logs as the initial training set; Using the target large language model currently deployed in the system, re-execute on all cases in the initial training set; select the cases that the model can execute completely correctly to form case set A; Set random parameter dimensions for the initial training set, including the number of cases extracted, the order of cases, and whether to enable mind chain guidance; N case subsets are randomly constructed from case set A. Each subset contains a complete example structure of user medical query and standard medical slot output. The structured description parameters of the extracted slots are adjusted simultaneously, including the medical scenario business description of the slots and the slot output format definition. For each subset of cases, temporary prompt words are constructed by combining the corresponding structured description parameters. The target large language model is then called to test new medical query cases that have not participated in training, and the extraction accuracy of each field is calculated. If the accuracy does not meet the preset requirements, modify the random parameter combination, adjust the structured description of the extracted slots, reconstruct the case subset and evaluate it until the optimal performance threshold parameter combination and case subset for slot extraction accuracy is found, and new prompt words are constructed. When the system switches to use different large language models, repeat the above steps to automatically filter and build a set of suitable cases and prompt words for the new model; The business logic optimization unit and the prompt word self-evolution unit collaborate through a shared interaction log database, and each triggers its own optimization process independently.
[0027] like Figure 3 As shown: This invention uses the DSPy framework to perform the prompt word optimization process, and the specific optimization process is as follows: When a user inputs a natural language query, the query is first received by the surgical agent or medical resource agent and enters the DSPy compilation and optimization phase. This phase begins by defining structured slots, clarifying the slot type, business rules, and output format requirements for the current medical scenario to be optimized. Then, a no-example mode is initiated to extract slots, initially verifying the extraction accuracy of the current prompt words without example assistance. Next, the initial training set is input into the DSPy framework, and a pre-defined prompt word optimization program is run on the training set to determine if the slot extraction accuracy meets the preset standards. If it does, the successful inference trajectory of this optimization is recorded, and the corresponding case is added to the Bootstrap example pool. If it fails or further accuracy improvement is needed, a cyclical optimization is performed: a subset of examples is randomly sampled from the Bootstrap example pool according to preset random parameters, including the number of cases extracted, the order of arrangement, and whether the thought chain is enabled. Simultaneously, the example order is randomly adjusted or the mind chain activation status is switched to form multiple sets of candidate parameter combinations. For each candidate combination, temporary prompt words are constructed based on the adjusted slot structured description parameters. The target large language model is then called to test new medical query cases that have not participated in training, and the extraction accuracy of each field is recalculated. This loop is continuously iterated until the slot extraction accuracy reaches the preset optimal performance threshold. At this point, it is determined that the optimal slot extraction effect in the current scenario has been obtained, and the optimal prompt word configuration is updated and solidified to form a few-shot prompt word containing medical scenario examples, task descriptions, and formatting constraints. After optimization, the system performs slot extraction based on the solidified optimal prompt word configuration and outputs structured slot results. This structured slot result serves as an intermediate result, which, combined with entity linking logic, forms the call parameters for the stored procedure, ultimately generating standardized query instructions that meet the execution requirements of the business logic module.
[0028] This invention is applied to the information center of a tertiary hospital. The system first establishes read-only copies of the online hospital information system, surgical anesthesia information system, image archiving and communication system through database master-slave replication technology. Every morning, an ETL task is automatically started to incrementally extract raw data such as the previous day's surgical schedule records, patient treatment information, and CT equipment reservation and execution logs from these copies. This data is then cleaned according to rules, such as filtering out records with empty "operating room" fields or incorrect time formats. It is then standardized and transformed, for example, by mapping department names from different sources to terms in a standard name library. Finally, the data is classified and stored in subject database tables such as "surgical operations" and "equipment resources". In the morning, a hospital administrator entered a natural language query into the system interface: "Compare the on-time rate of the first surgery in the operating room and the day surgery center last month." The planning agent received this query, combined it with the context of no historical dialogue, and retrieved "on-time rate of the first surgery" from the hospital knowledge base, defining it as "(number of on-time surgeries / total number of first surgeries) × 100%"; it dynamically constructed a structured prompt: "Business rule: On-time rate of the first surgery = (number of on-time surgeries / total number of first surgeries × 100%; Please determine whether this query should call the surgical agent or the medical technology resource agent." This prompt and the user query were input into the Large Language Model (LLM). The LLM output the decision text, and the system successfully parsed {"need_surgery_agent":true, "need_medresource_agent":false}, thus scheduling the surgical agent; The surgical agent initiates its multi-stage parsing: first, semantic completion of the query is performed; if there is no referent, no rewriting is required; then, the query is vectorized and classified into BI category (indicator comparison query) based on cosine similarity matching by comparing it with a large number of examples in the knowledge base; subsequently, the specific BI type is determined to be "first-time rate comparison", which is mapped to the stored procedure p_first_ontime_rate_compare; and slot values such as "operating building", "day surgery center", and "last month" are accurately extracted to complete entity links; finally, a standardized call instruction in JSON format is assembled and generated, which includes the process name, time range, comparison department parameters, and sorting requirements; After receiving the above call command, the business logic module parses the JSON parameters and calls a predefined stored procedure named p_first_ontime_rate_compare. This stored procedure encapsulates complex SQL logic: it automatically calculates the time range based on the passed "last month" parameter, correlates the surgical schedule table and surgical record table from the fused data, and separately counts the total number of first surgeries and the number of on-time surgeries in the surgical building and the day surgery center, and calculates the on-time rate according to business rules. The entire process is completed within the database engine, and sorting and pagination are implemented directly through the ORDER BY and LIMIT clauses. Finally, the calculation results are returned in a structured tabular data format, such as a list containing fields like "department unit," "total number of first surgeries," "number of on-time surgeries," and "on-time rate." After the system had been running for a period of time, the self-evolutionary optimization module's prompt word self-evolutionary unit detected that the extraction accuracy of the "percentage" field had decreased in queries involving "percentage of emergency surgeries"; thus, an optimization process was automatically triggered. Extract all query cases containing "percentage" from historical logs as the initial set, including different scenario cases such as "percentage of emergency surgeries in the first quarter of 2025" and "statistics on the percentage of cardiac surgery emergency surgeries"; Re-execute these cases using the currently deployed LLM, filter out all cases that are completely and correctly parsed by the LLM, and form a case set A; Set random parameter dimensions for the initial training set: 5-10 cases to be extracted, random case order, and enable mind chain guidance. Randomly construct 5 case subsets from case set A. Each subset contains a complete structure of "user medical query + standard medical slot output". At the same time, adjust the slot structured description parameters, clarify the medical scenario business description that "the percentage field needs to be associated with the surgical type (emergency / general), statistical range (department / hospital-wide), and statistical time period", and define the output format as "percentage type, statistical range, statistical time period". For each subset of cases, temporary prompt words are constructed, and LLM is called to test new medical query cases that have not participated in training. For example, the percentage of orthopedic emergency surgeries in April 2025 is used to calculate the extraction accuracy of the "percentage" field. If the accuracy of a certain subset does not meet the preset requirements, the random parameter combination is modified, the number of cases extracted is adjusted to 8, the mind chain guidance is turned off, the case subset is reconstructed and evaluated. After continuous iteration, until the extraction accuracy of the 'percentage' field reaches the preset performance target threshold, it is determined that the optimal parameter combination for the current scenario has been found: 8 cases extracted, arranged in reverse chronological order, and mind chain guidance enabled. Based on this combination, new prompt words containing medical scenario-specific examples, task descriptions, and formatting constraints are generated.
[0029] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
Claims
1. A multi-agent hospital data analysis system based on a self-evolution mechanism, characterized in that: The system includes a data fusion module, a multi-agent collaboration module, a business logic module, and a self-evolution optimization module; The data fusion module collects operational data from multiple heterogeneous business systems in the hospital and preprocesses it to form fused data of a unified specification. The multi-agent collaboration module includes a planning agent and a medical scenario multi-agent; after receiving a user's natural language query, the planning agent combines the multi-round interaction history with the generated medical business attribute prompts to perform intent recognition and task planning, and generate scheduling decisions. The multi-agent system in the medical scenario parses the query and generates a call instruction based on scheduling decisions; The parsing process drives a large language model to perform semantic completion based on the medical dialogue context, intent classification according to medical business logic, medical domain slot extraction, and medical term entity linking through preset structured prompt words. The business logic module receives medical business parameters and page operation parameters from the call instruction, performs business calculations, indicator statistics and pagination sorting operations in combination with the fused data, and returns structured query results and generates natural language responses. The self-evolutionary optimization module continuously collects state records, query parsing paths, execution results, and feedback information generated during the interaction process. By analyzing the interaction logs and organizing new datasets, it automatically evaluates and iteratively optimizes the agent's intent classification, business parameter extraction, response generation, and prompt word dynamic adaptation capabilities.
2. The multi-agent hospital data analysis system based on self-evolution mechanism according to claim 1, characterized in that: The planning agent in the multi-agent collaboration module is configured with a state data structure specifically for medical scenarios. This data structure includes at least: the user's original query statement, scheduling decision control field, exception information field, and multi-round interaction history field. The multi-agent in the medical scenario includes a surgical agent for surgical data analysis and a medical technology resource agent for medical technology resource data analysis. After receiving a user's natural language query, the planning agent reads the multi-round interaction history from the state data structure and organizes it into medical business-related text; based on the user's query content, it retrieves information related to surgical rules and equipment management specifications from hospital business-related structured or semi-structured data sources, and dynamically generates prompt words that integrate medical business attributes; Initialize an inference component that encapsulates API calls of a large language model. This component is used to convert natural language queries into structured scheduling decisions adapted to medical scenarios. After the dynamically generated prompts, user queries, and medical business-related texts are input into the inference component, the component calls the large language model to perform scheduling planning inference and finally outputs a scheduling decision on whether to call the surgical agent or the medical technology resource agent.
3. The multi-agent hospital data analysis system based on self-evolution mechanism according to claim 2, characterized in that: The surgical agent is used to perform query parsing and instruction generation for surgical data analysis; After receiving the scheduling decision from the planning agent, the system reads the user's original question and dialogue history messages in the state to determine whether there are unclear references or missing context in the multi-round medical dialogue. If rewriting is required, the system constructs prompt words based on the dialogue history and pre-stored standard question examples for surgical scenarios and calls a large language model to complete and rewrite the question with medical semantics, generating a rewritten question that contains one or more necessary slots in the surgical scenario medical business. The rewritten question is converted into a vector representation using a semantic embedding model. Standard question examples for surgical scenarios (BI and TOPIC categories) are obtained from a medical knowledge base and vectorized accordingly. By calculating cosine similarity, the top M examples with the highest similarity to the rewritten question vector are selected from the BI and TOPIC standard question examples. Prompt words are constructed by combining the classification task description and the selected top M examples, and a large language model is invoked for reasoning to determine whether the current question belongs to the BI or TOPIC category. Here, M is a preset positive integer. The BI category represents a statistical query targeting a single medical business indicator, corresponding to a single predefined stored procedure; the TOPIC category represents an integrated analysis query targeting a medical business theme, corresponding to a combined call of multiple predefined stored procedures.
4. The multi-agent hospital data analysis system based on self-evolution mechanism according to claim 3, characterized in that: The surgical agent performs corresponding operations based on the determined BI or TOPIC class intent; If it is a BI type, then based on the vector representation of the rewritten question, calculate its cosine similarity with the standard example vectors of multiple predefined BI sub-types in the medical knowledge base; based on the similarity matching results, determine the specific BI sub-type and its corresponding predefined stored procedure name; according to the preset surgical business slot definition, extract the parameter values related to the surgical scenario medical business from the question, and map them to standard medical terms through entity links; at the same time, parse the natural language time period and extract the sorting conditions; If it is a TOPIC type, according to the rewritten question, match the corresponding analysis topic and the predefined combination of stored procedures for that topic; according to the needs of each stored procedure in the combination, cyclically execute the above parameter extraction, entity linking and time period parsing steps; Based on the established stored procedures, mapped standard medical terminology, parsed time periods, and sorting conditions, the calling instructions are assembled and generated.
5. The multi-agent hospital data analysis system based on self-evolution mechanism according to claim 4, characterized in that: The medical technology resource intelligent agent is used to perform query parsing and instruction generation for medical technology resource data analysis; the medical technology resource intelligent agent configures and maintains a state data structure consistent with the surgical intelligent agent structure; and executes the same multi-stage parsing process as the surgical intelligent agent. In the process of parsing, the domain knowledge base, predefined business slots, entity linking rules, predefined stored procedures called, and prompt words driving the large language model used by the medical technology resource intelligent agent are all specifically designed for medical technology resource business scenarios, ultimately generating standardized calling instructions for medical technology resource type queries.
6. The multi-agent hospital data analysis system based on self-evolution mechanism according to claim 1, characterized in that: The business logic module deploys a stored procedure engine, and the encapsulated predefined stored procedures are divided into surgical stored procedures and medical technology resource stored procedures according to business scenarios. The input parameters of the stored procedure are uniformly defined in JSON format, including business calculation parameters, pagination parameters, and sorting parameters. The business calculation parameters are mapped one-to-one with the standardized slot parameters extracted by the corresponding intelligent agent. The pagination parameters specify the page number of the data acquisition and the amount of data per page. The sorting parameters specify the sorting field and sorting direction. After receiving the standardized call command, first parse the JSON format input parameters and extract the business calculation parameters, pagination parameters and sorting parameters; Based on the business calculation logic and indicator statistics rules encapsulated in the execution storage process of the fused data, the calculation results are filtered and the order is adjusted according to the pagination parameters and sorting parameters, and the query results are output in a preset structured format.
7. The multi-agent hospital data analysis system based on self-evolution mechanism according to claim 1, characterized in that: The self-evolution optimization module includes a business logic optimization unit and a prompt word self-evolution unit; The business logic optimization unit continuously collects business-related data during the interaction process, specifically including a complete record of the state data structure of each intelligent agent, intermediate results of each stage of query parsing, structured query results returned by the execution of stored procedures, and user feedback and suggestions on the analysis results; By constructing an agent performance evaluation model, five core indicators are quantitatively evaluated: planning agent scheduling accuracy, BI / TOPIC intent classification accuracy, BI intent classification accuracy, TOPIC intent classification accuracy, and slot extraction accuracy. Among them, the planning agent scheduling accuracy rate is the ratio of the number of queries that correctly determine the call to surgical agents / medical resource agents to the total number of queries; BI / TOPIC intent classification accuracy is the ratio of the number of queries that correctly classify queries into BI / TOPIC categories to the total number of queries. BI intent classification accuracy is the ratio of the number of queries that correctly match a BI category query to a specific subcategory to the total number of BI category queries. TOPIC intent classification accuracy is the ratio of the number of queries that correctly match a TOPIC query to a specific analysis topic to the total number of TOPIC queries. The slot extraction accuracy rate is the ratio of the number of correctly extracted slot parameters to the total number of slot parameters that should be extracted. In the agent performance evaluation model, the weights of each indicator are preset. The comprehensive performance score of each agent is calculated by weighted summation of (single indicator score × corresponding weight), where the score of a single indicator is the actual ratio of that indicator × 100. At the same time, optimization trigger thresholds are set, and the qualified baselines for each core indicator and the qualified line for the comprehensive performance of the agent are preset. When the score of any core indicator is lower than the corresponding baseline, or the comprehensive performance score is lower than the comprehensive qualified line, the system iterative optimization process is automatically started. Based on the evaluation results, the optimization target is located and targeted adjustments are performed.
8. The multi-agent hospital data analysis system based on self-evolution mechanism according to claim 7, characterized in that: The prompt word self-evolution unit is used to automatically evaluate and optimize the prompt words used by each agent during the parsing process: For each business field in the slot extraction task, evaluate its extraction accuracy separately. When the extraction accuracy of a certain field is lower than its set threshold, the self-evolution process is initiated. Extract all execution cases of relevant tasks from historical interaction logs as the initial training set; Using the target large language model currently deployed in the system, re-execute on all cases in the initial training set; select the cases that the model can execute completely correctly to form case set A; Set random parameter dimensions for the initial training set, including the number of cases extracted, the order of cases, and whether to enable mind chain guidance; N case subsets are randomly constructed from case set A. Each subset contains a complete example structure of user medical query and standard medical slot output. The structured description parameters of the extracted slots are adjusted simultaneously, including the medical scenario business description of the slots and the slot output format definition. For each subset of cases, temporary prompt words are constructed by combining the corresponding structured description parameters. The target large language model is then called to test new medical query cases that have not participated in training, and the extraction accuracy of each field is calculated. If the accuracy does not meet the preset requirements, modify the random parameter combination, adjust the structured description of the extracted slots, reconstruct the case subset and evaluate it until the parameter combination and case subset that achieve the preset optimal performance threshold for slot extraction accuracy are found, and new prompt words are constructed. When the system switches to use different large language models, repeat the above steps to automatically filter and build a set of suitable cases and prompt words for the new model; The business logic optimization unit and the prompt word self-evolution unit collaborate through a shared interaction log database, and each independently triggers the optimization process.
9. A multi-agent hospital data analysis method based on a self-evolutionary mechanism, applied to any one of the multi-agent hospital data analysis systems based on a self-evolutionary mechanism as described in claims 1-8, characterized in that: The method includes: S1: Collect operational data from multiple heterogeneous business systems in the hospital, clean, transform, and standardize it to form unified data fusion data; S2: Receive the natural language query input by the user. The planning agent combines the history of multiple rounds of interaction with dynamically constructed business scenario prompts to perform intent recognition and task planning on the query and generate a scheduling decision. Based on the scheduling decision, the corresponding medical scenario multi-agent is invoked to perform semantic completion, intent classification, business slot extraction and entity linking on the query, and generate standardized invocation instructions based on the parsing results. S3: Invoke the predefined stored procedure corresponding to the standardized invocation instruction, perform business calculations, indicator statistics and pagination sorting operations based on the fused data, and return structured query results to generate a natural language response; S4: Continuously collect and analyze the state records, parsing paths, execution results and feedback information generated during the interaction process of steps S2 and S3. Organize new datasets by analyzing interaction logs, and automatically evaluate and iteratively optimize the agent's intent classification, business parameter extraction, response generation and prompt word dynamic adaptation capabilities.