Medical question and answer data generation method and system, terminal and medium
By constructing patient agents and doctor agents, simulating real doctor-patient dialogues, the problem of insufficient authenticity and practicality of existing medical Q&A system data is solved, and efficient and accurate medical Q&A data generation is achieved.
Patent Information
- Application Number
- CN202510457685.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-14
- Publication Date
- 2025-05-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing medical Q&A system lacks real doctor-patient interaction processes when generating data for training large language models in the medical and health field, resulting in insufficient authenticity and practicality of the data.
By building patient agents and doctor agents, setting their conversation strategies, and building their knowledge base based on real medical records, simulate doctor-patient dialogue to generate original question-and-answer data.
It improves the authenticity and practicality of the generated Q&A data, ensures that the data complies with medical specifications and professional requirements, and can quickly generate a large amount of data, improving the training efficiency of large language models.
Smart Images

Figure CN119993562A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of large-scale language models, and in particular to a method, system, terminal and medium for generating medical question and answer data. Background Art
[0002] With the rapid development of artificial intelligence technology, large language models (LLMs) have shown great application potential in various fields, especially in the field of medical health. These models can understand and generate natural language texts through the training of massive data, providing a solid foundation for intelligent question-answering systems.
[0003] However, high-quality medical question-answering training data for large-scale language models in the healthcare field is still scarce, such as follow-up data and consultation data in real medical scenarios, which poses a challenge to improving the accuracy and practicality of medical question-answering systems. Traditional methods rely on manual collection and annotation, which is not only time-consuming and labor-intensive, but also difficult to cover the breadth and complexity of the medical field.
[0004] The particularity of the medical environment requires that the question-answering system not only has the ability to accurately understand the patient's symptoms and medical history, but also needs to be able to give appropriate advice or guidance based on the latest medical research results. Therefore, it is particularly important to build a dialogue system that can simulate the doctor's professional diagnosis and reflect the patient's real needs.
[0005] Currently, although there have been some attempts to use agent technology to simulate medical conversations, most of them focus on the simulation of a single role and lack a comprehensive simulation of the interaction process between patients and doctors, and lack authenticity and practicality. Summary of the invention
[0006] In order to solve the technical problem that when generating medical question and answer training data for training large-scale language models in the medical and health field, the existing simulated dialogue system focuses on the simulation of a single role and lacks the authenticity and practicality of the doctor-patient interaction process, the present invention provides a medical question and answer data generation method, and also provides a medical question and answer data generation system, a terminal and a medium.
[0007] To achieve the above-mentioned purpose, in a first aspect, a technical solution adopted by a method for generating medical question and answer data in the present invention is: A method for generating medical question and answer data comprises the following steps: Construct patient agents and doctor agents, and set the dialogue strategy between the patient agents and doctor agents; Obtain real medical records from the medical database, and build the knowledge base of the patient agent and the doctor agent based on the real medical records; Control the patient agent and doctor agent to simulate doctor-patient dialogue based on dialogue strategies and their respective knowledge bases to generate original question-and-answer data.
[0008] As a preferred implementation of a medical question-and-answer data generation method, real medical records include: patient information, patient symptoms, purpose of visit, visit department, auxiliary examination report, diagnosis results, diagnosis basis and treatment plan.
[0009] As a preferred implementation of a method for generating medical question-answering data, building a knowledge base of a patient agent and a doctor agent based on real medical records includes the following steps: Build a knowledge base of patient agents based on patient information, patient symptoms, purpose of visit, and auxiliary examinations in real medical records; Acquire the diagnosis and treatment knowledge related to the visiting department in the real medical records, and build the knowledge base of the doctor agent based on diagnosis and treatment knowledge, auxiliary examinations, diagnosis results, diagnosis basis and treatment plan.
[0010] By adopting the above technical solution, firstly, medical knowledge is updated quickly. The knowledge base of the doctor agent uses the diagnosis and treatment knowledge related to the visiting department in the real medical records as one of the knowledge sources, which can ensure that the original question and answer data can reflect the latest medical knowledge. Secondly, the patient agent can communicate with the doctor agent based on the information about the patient recorded in the real medical records, ensuring that the patient agent can interact effectively with the doctor agent.
[0011] As a preferred implementation of a method for generating medical question and answer data, after generating the original question and answer data, the method includes: Extract key medical information from the original question and answer data, compare the key medical information with the corresponding content in the real medical records, optimize the original question and answer data based on the comparison results, and output the optimized question and answer data.
[0012] By adopting the above technical solution, the original question and answer data is compared and optimized based on real medical records, so as to further improve the authenticity and accuracy of the output results of the present invention.
[0013] As a preferred implementation of a method for generating medical question and answer data, the key medical information includes: patient symptoms, auxiliary examinations, diagnosis results, diagnostic basis and treatment plan.
[0014] As a preferred implementation of a method for generating medical question and answer data, optimizing the original question and answer data based on the comparison results includes the following steps: If the key medical information is consistent with the corresponding content in the real medical record, the corresponding key medical information is marked as "accurate" in the original question and answer data; If the key medical information is inconsistent with the corresponding content in the real medical record, the corresponding key medical information is marked as "needs to be corrected" in the original question and answer data, and correction suggestions are provided. Based on the correction suggestions, the key medical information marked as "needs to be corrected" in the original question and answer data is corrected; If key medical information is missing, the missing key medical information will be supplemented in the original question and answer data.
[0015] By adopting the above technical solution, if the key medical information extracted from the original question and answer data is inconsistent with the corresponding content in the real medical record, or the key medical information is missing, corrections and supplements will be made in the corresponding part of the original question and answer data to improve the authenticity and accuracy of the question and answer data.
[0016] As a preferred implementation of a medical question-and-answer data generation method, the dialogue strategy includes: the patient agent initiates a dialogue with the doctor agent and describes the symptoms based on the patient agent's knowledge base; the doctor agent conducts a dialogue with the patient agent based on the patient agent's description and the doctor agent's knowledge base, and finally gives a diagnosis result, diagnostic basis and treatment plan.
[0017] In the second aspect, a technical solution adopted by a medical question and answer data generation system in the present invention is: A medical question-answering data generation system includes an agent building module, a knowledge base building module, and a dialogue module, wherein: The agent building module is configured to build a patient agent and a doctor agent, and set a dialogue strategy between the patient agent and the doctor agent; The knowledge base construction module is configured to obtain real medical records from a medical database, and to construct knowledge bases of patient agents and doctor agents respectively based on the real medical records; The dialogue module is configured to control the patient agent and the doctor agent to simulate doctor-patient dialogue based on dialogue strategies and their respective knowledge bases to generate original question-and-answer data.
[0018] In a third aspect, a technical solution adopted by a terminal in the present invention is: A terminal comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the medical question and answer data generating method as described above when executing the program.
[0019] In a fourth aspect, a technical solution adopted by a medium in the present invention is: A storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of a method for generating medical question and answer data as described above.
[0020] The beneficial effects of the present invention include: First, the present invention sets two agents, namely the patient agent and the doctor agent, to simulate real doctor-patient interaction and improve the authenticity and practicality of the generated original question-and-answer data. Second, the doctor-patient dialogue in the present invention is based on real medical records, which can ensure that the generated original question-and-answer data meets medical standards and professional requirements and has high accuracy. Third, a large amount of original question-and-answer data can be automatically and quickly generated, which greatly improves the training efficiency of large-scale language models used in the medical and health field and reduces training costs compared to manually generated question-and-answer data. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0022] Figure 1 It is a schematic diagram of a specific embodiment of the present invention; Figure 2 It is a structural schematic diagram of a specific implementation mode of the present invention. DETAILED DESCRIPTION
[0023] The question-answer pair training data of the large language model refers to paired data consisting of questions and corresponding correct answers. These data are specifically used to train the language model so that it can accurately understand and generate reasonable answers to various questions. After a large number of question-answer pair training, the large language model can learn how to accurately understand the intentions of various questions, so that the large language model can learn what accurate answers should be generated for different questions.
[0024] The particularity of the medical environment requires that the large language model in the question-answering system not only has the ability to accurately understand the patient's symptoms and medical history, but also needs to be able to give appropriate advice or guidance based on the latest medical research results. Therefore, the training data for question-answering needs to be authentic and practical, be able to simulate real doctor-patient interactions, and reflect the latest medical knowledge.
[0025] Based on this, this embodiment proposes a method for generating medical question and answer data that can simulate real doctor-patient dialogues, generate question and answer data, and reflect the latest medical knowledge.
[0026] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical scheme of the present invention will be clearly and completely described below in conjunction with the drawings in this specific embodiment. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0027] like Figure 1 As shown, a method for generating medical question and answer data in this embodiment includes the following steps: S1. Construct the patient agent and the doctor agent, and set the dialogue strategy between the patient agent and the doctor agent; S2, obtain real medical records from the medical database, and build the knowledge base of the patient agent and the doctor agent based on the real medical records; S3. Control the patient agent and doctor agent to simulate doctor-patient dialogue based on the dialogue strategy and their respective knowledge bases to generate original question-answering data.
[0028] First, this embodiment sets up two agents, namely the patient agent and the doctor agent. The patient agent can simulate the behavior patterns of real patients, including preparation before consultation, inquiry during consultation, and subsequent feedback, focusing on reflecting the patient's emotional and cognitive characteristics; the doctor agent has the functions of diagnosing diseases and recommending treatment plans, and can analyze the patient's medical records and provide professional medical advice based on the medical knowledge graph and the latest medical literature. The patient agent and the doctor agent can simulate real doctor-patient interactions and improve the authenticity and practicality of the generated original question-and-answer data.
[0029] Second, the doctor-patient dialogue in this embodiment is based on real medical records, which can ensure that the generated original question and answer data meets medical standards and professional requirements and has high accuracy.
[0030] Third, this embodiment can automatically and quickly generate a large amount of original question and answer data. Compared with manually generated question and answer data, it greatly improves the training efficiency of large-scale language models used in the medical and health field and reduces training costs.
[0031] Those skilled in the art should understand that the construction of intelligent agents is a prior art, that is, those skilled in the art have mastered the method of how to construct patient intelligent agents and doctor intelligent agents, so this embodiment will not go into details about how to construct patient intelligent agents and doctor intelligent agents.
[0032] The collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of the case data involved in the technical solution disclosed in this application are in compliance with the provisions of relevant laws and regulations, are used for legal purposes and do not violate public order and good morals, and necessary measures are taken to prevent the illegal use of case data to maintain case data security, network security and national security. In this embodiment, the real medical record includes: patient information, patient symptoms, purpose of treatment, treatment department, auxiliary examination report, diagnosis results, diagnosis basis and treatment plan.
[0033] In this embodiment, when the dialogue task between the patient agent and the doctor agent begins, the information of the patient agent and the doctor agent is initialized. The patient agent initialization information and the doctor agent initialization information are as follows: (I) The patient agent initialization information is as follows: You are a patient and your task is to communicate with the doctor. Below is your personal information and medical record summary, please use this information in the conversation.
[0034] Personal Information: Age: [age of patient] Gender: [patient's gender] Occupation: [patient's occupation] Medical Record Excerpt: History of present illness: [Description of the patient's present illness] Past medical history: [Description of the patient's past medical history] Personal History: [Description of the patient's personal history] Conversation rules: The doctor will diagnose your physical condition. You need to: 1. Your answers should be based on your personal information and medical record summary. Do not provide answers that contradict this information.
[0035] 2. When your doctor asks about your medical history, provide detailed information based on your medical record summary.
[0036] 3. Your answer should be colloquial, concise and clear, providing only the most critical information.
[0037] 4. After the doctor gives the diagnosis and treatment plan, use “<End>” to end the conversation.
[0038] Now, the conversation begins. Your first task is to describe your current main symptoms and discomfort.
[0039] (II) The initialization information of the doctor agent is as follows: You are a professional doctor and you are diagnosing a patient. You will get detailed information about the patient's condition by talking to <patient>.
[0040] Patient symptoms: [Description of patient symptoms] Auxiliary examination results: [Description of auxiliary examination results] Please combine patient information, disease knowledge, and guidelines to output your final diagnosis in the following format: #Diagnosis results# (1)xxx (2)xxx #Diagnosis basis# (1)xxx (2)xxx #Treatment plan# (1)xxx (2)xxx Please give your final diagnosis based on the above information and rules.
[0041] In this embodiment, building the knowledge base of the patient agent and the doctor agent based on the real medical records includes the following steps: Build a knowledge base of patient agents based on patient information, patient symptoms, purpose of visit, and auxiliary examinations in real medical records; Acquire the diagnosis and treatment knowledge related to the visiting department in the real medical records, and build the knowledge base of the doctor agent based on diagnosis and treatment knowledge, auxiliary examinations, diagnosis results, diagnosis basis and treatment plan.
[0042] Among them, diagnostic and treatment knowledge includes disease knowledge and diagnostic and treatment guidelines.
[0043] The above measures have two benefits: First, medical knowledge is updated quickly. The knowledge base of the doctor agent uses the diagnosis and treatment knowledge related to the visiting department in the real medical records as one of the knowledge sources, which can ensure that the original question and answer data can reflect the latest medical knowledge. Second, the patient agent can communicate with the doctor agent based on the information about the patient recorded in the real medical records, ensuring that the patient agent can interact effectively with the doctor agent.
[0044] In this embodiment, the RAG system is used, and the above-mentioned real medical records and diagnosis and treatment knowledge are stored in the RAG system. The patient agent and the doctor agent can communicate based on the RAG technology.
[0045] RAG (Retrieval-Augmented Generation) is a technology that combines information retrieval and language generation. It enhances the accuracy and relevance of answers in language generation models (such as Transformer-based language models) by retrieving relevant information from external knowledge bases or document collections.
[0046] In some embodiments, after generating the original question-answer data, the method further includes step S4, which is as follows: S4. Extract key medical information from the original question and answer data, compare the key medical information with the corresponding content in the real medical records, optimize the original question and answer data based on the comparison results, and output the optimized question and answer data.
[0047] After the original question and answer data is generated, the original question and answer data is compared and optimized based on real medical records, which can further improve the authenticity and accuracy of the output results of the present invention.
[0048] Furthermore, this embodiment can construct a medical record agent to complete the above step S4. The task of the medical record agent is to organize and verify the medical record information by analyzing the original question and answer data, compare the content of the original question and answer data with the real medical record, optimize the original question and answer data according to the comparison results, and output the optimized question and answer data, so as to ensure the accuracy and completeness of the information.
[0049] Furthermore, in step S4, the key medical information includes: patient symptoms, auxiliary examinations, diagnosis results, diagnostic basis and treatment plan.
[0050] Further, in step S4, the key medical information in the original question and answer data is extracted, and the key medical information is compared with the corresponding content in the real medical record. Identify the “patient symptoms” part in the original question-and-answer data and compare it with the patient symptoms in the real medical records; Identify the “auxiliary examination” results in the original Q&A data and compare them with the auxiliary examination reports in the real medical records; Identify the “diagnosis results” and “diagnosis basis” in the original question-and-answer data, and compare them with the diagnosis results and diagnosis basis in the real medical records; Identify “treatment plans” in the original question-and-answer data and compare them with the treatment plans in real medical records.
[0051] Further, in step S4, optimizing the original question-answer data based on the comparison result includes the following steps: If the key medical information is consistent with the corresponding content in the real medical record, the corresponding key medical information is marked as "accurate" in the original question and answer data; If the key medical information is inconsistent with the corresponding content in the real medical record, the corresponding key medical information is marked as "needs to be corrected" in the original question and answer data, and correction suggestions are provided. Based on the correction suggestions, the key medical information marked as "needs to be corrected" in the original question and answer data is corrected; If key medical information is missing, the missing key medical information will be supplemented in the original question and answer data.
[0052] In this embodiment, the dialogue strategy includes: the patient agent initiates a dialogue with the doctor agent and describes the symptoms based on the patient agent's knowledge base; the doctor agent conducts a dialogue with the patient agent based on the patient agent's description and the doctor agent's knowledge base, and finally gives a diagnosis result, diagnostic basis and treatment plan.
[0053] In this embodiment, the optimized original question-and-answer data finally outputted includes several question-and-answer pairs, which record patient information, patient symptoms, purpose of visit, visit department, auxiliary examination report, diagnosis results, diagnosis basis and treatment plan.
[0054] like Figure 2 As shown below, a medical question and answer data generating system is provided in an embodiment of the present disclosure. A medical question and answer data generating system and a medical question and answer data generating method in the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiment of a medical question and answer data generating system, please refer to the embodiment of the above-mentioned medical question and answer data generating method.
[0055] The medical question-answering data generation system proposed in this embodiment includes an agent building module, a knowledge base building module, and a dialogue module, wherein: The agent building module is configured to build a patient agent and a doctor agent, and set a dialogue strategy between the patient agent and the doctor agent; The knowledge base construction module is configured to obtain real medical records from a medical database, and to construct knowledge bases of patient agents and doctor agents respectively based on the real medical records; The dialogue module is configured to control the patient agent and the doctor agent to simulate doctor-patient dialogue based on dialogue strategies and their respective knowledge bases to generate original question-and-answer data.
[0056] An embodiment of the present application also proposes a terminal, including a memory, a processor, a communication unit, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of a method for generating medical question and answer data when executing the program; the memory, the processor, and the communication unit communicate via one or more buses.
[0057] The processor may include one or more processing units, for example, the processor may include a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0058] The processor can be the nerve center and command center of the terminal. The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.
[0059] The memory is used to store the execution instructions of the processor, and the memory can be implemented by any type of volatile or non-volatile storage terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. When the execution instructions in the memory are executed by the processor, the terminal is able to execute some or all of the steps in the above-mentioned embodiment of the medical question and answer data generation method.
[0060] The wireless communication function of an electronic device can be realized through an antenna, a wireless communication module, a modem processor, and a baseband processor.
[0061] The wireless communication module can provide wireless communication solutions for electronic devices including wireless LAN, Bluetooth, global navigation satellite system, frequency modulation, short-range wireless communication technology, infrared technology, etc.
[0062] This embodiment further proposes a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the medical question and answer data generation methods described above are implemented.
[0063] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for generating medical question and answer data, characterized in that: The following steps are involved: Construct patient agents and doctor agents, and set the dialogue strategy between the patient agents and doctor agents; Obtain real medical records from the medical database, and build the knowledge base of the patient agent and the doctor agent based on the real medical records; Control the patient agent and doctor agent to simulate doctor-patient dialogue based on dialogue strategies and their respective knowledge bases to generate original question-and-answer data.
2. A method for generating medical question and answer data according to claim 1, characterized in that: Real medical records include: patient information, patient symptoms, purpose of visit, visit department, auxiliary examination reports, diagnosis results, diagnostic basis and treatment plan.
3. A method for generating medical question and answer data according to claim 2, characterized in that: Building the knowledge base of patient agents and doctor agents based on real medical records includes the following steps: Build a knowledge base of patient agents based on patient information, patient symptoms, purpose of visit, and auxiliary examinations in real medical records; Acquire the diagnosis and treatment knowledge related to the visiting department in the real medical records, and build the knowledge base of the doctor agent based on diagnosis and treatment knowledge, auxiliary examinations, diagnosis results, diagnosis basis and treatment plan.
4. A method for generating medical question and answer data according to claim 1, characterized in that: After generating the original question-answer data, the method includes: Extract key medical information from the original question and answer data, compare the key medical information with the corresponding content in the real medical records, optimize the original question and answer data based on the comparison results, and output the optimized question and answer data.
5. A method for generating medical question and answer data according to claim 4, characterized in that: The key medical information includes: patient symptoms, auxiliary examinations, diagnosis results, diagnostic basis and treatment plan.
6. A method for generating medical question and answer data according to claim 4, characterized in that: Optimizing the original question-answering data based on the comparison results includes the following steps: If the key medical information is consistent with the corresponding content in the real medical record, the corresponding key medical information will be marked as "accurate" in the original question and answer data; If the key medical information is inconsistent with the corresponding content in the real medical record, the corresponding key medical information is marked as "needs to be corrected" in the original question and answer data, and correction suggestions are provided. Based on the correction suggestions, the key medical information marked as "needs to be corrected" in the original question and answer data is corrected; If key medical information is missing, the missing key medical information will be supplemented in the original question and answer data.
7. A method for generating medical question and answer data according to claim 1, characterized in that: The dialogue strategy includes: the patient agent initiates a dialogue with the doctor agent and describes the symptoms based on the patient agent's knowledge base; the doctor agent conducts a dialogue with the patient agent based on the patient agent's description and the doctor agent's knowledge base, and finally gives a diagnosis result, diagnostic basis and treatment plan.
8. A medical question and answer data generation system, characterized in that: It includes intelligent agent building module, knowledge base building module and dialogue module, among which: The agent building module is configured to build a patient agent and a doctor agent, and set a dialogue strategy between the patient agent and the doctor agent; The knowledge base construction module is configured to obtain real medical records from a medical database, and to construct knowledge bases of patient agents and doctor agents respectively based on the real medical records; The dialogue module is configured to control the patient agent and the doctor agent to simulate doctor-patient dialogue based on dialogue strategies and their respective knowledge bases to generate original question-and-answer data.
9. A terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of a method for generating medical question and answer data as described in any one of claims 1 to 7 are implemented.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a method for generating medical question and answer data as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Intelligent agent-based medical question and answer method and system and electronic equipment
CN118152544A
Intelligent agent oral hospital diagnosis and treatment model establishment method and device
CN119230121A
Large model agent question and answer method and device based on self-evolution and electronic equipment
CN119418945A
Cited By
Training method of inquiry large model and inquiry method based on large model
CN120849543A
Doctor-patient communication model training method and system based on synthetic roles
CN121148745A
Speech transcription model construction method and device, electronic equipment and storage medium
CN121191490A
Assessment method and system of medical question-answering system and electronic equipment
CN122086734A
Multi-modal medical data synthesis method and device, electronic equipment and storage medium
CN122337676A