Generation method of diagnostic dialogue data set with interpretable reason

By building a decision tree and using the ChatGPT model to generate diagnostic paths in natural language descriptions, the problem of lack of high-quality medical diagnostic dialogue data sets in the existing technology is solved, and the generation of large-scale, interpretable dialogue data sets is realized, and dialogue is improved. Accuracy of generating tasks.

CN119202123APending Publication Date: 2024-12-27EAST CHINA UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311101514.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-29
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The existing technology lacks large-scale, high-quality medical diagnostic conversation datasets, and the existing datasets cannot explain the reasons why doctors ask questions, resulting in conversation models that cannot generate interpretable responses.

Method used

By building a decision tree, the diagnostic flowchart in the literature is extracted into action nodes and conditional nodes, the diagnostic path text of natural language description is generated, and the ChatGPT model is used to generate dialogues with interpretable reasons under zero shot and few shot learning methods. Dataset, reason for joining doctor responses.

Benefits of technology

The generated data sets are of high quality and large scale, which solves the problems of low quality and small scale of existing data sets, improves the accuracy of dialogue generation tasks and inference tasks, and is suitable for evaluating and fine-tuning the performance of large language models in the medical field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119202123A_ABST
    Figure CN119202123A_ABST
Patent Text Reader

Abstract

The invention provides a method for generating a diagnostic dialogue data set with an interpretable reason. Comprising the following steps: acquiring original decision tree information, and extracting each node in a flow chart and an edge between the nodes; constructing a decision tree by using the condition nodes and the action nodes; generating a diagnosis path text set described by a natural language according to the constructed decision tree; generating a dialogue set with an interpretable reason based on the ChatGPT model; constructing a context example of an interpretable dialogue for adding interpretability in an inquiry dialogue, generated by ChatGPT, between a patient and a doctor; and finally, the final dialogue data with the interpretability is generated in a feed shot learning mode. According to the method, a large-scale high-quality dialogue data set with an interpretable reason can be automatically constructed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, in particular to the field of dataset construction, and more particularly to a method for generating a diagnostic dialogue dataset with explainable reasons. Background Art

[0002] With the application of artificial intelligence technology in the medical field, conversational intelligent disease diagnosis methods and medical consultation systems have become a hot topic in current research. These systems can provide patients with timely and accurate medical information, and can also help medical institutions alleviate the pressure on medical resources. In these systems, since a large amount of conversation data, namely training corpus, is the basis for studying various conversation models, diagnostic conversation datasets are of great value for automatic diagnosis.

[0003] However, there is currently a lack of large-scale, high-quality datasets of medical diagnosis dialogues. The main reason is that most of the consultation process between doctors and patients is conducted face-to-face and is not recorded in text. Existing speech recognition technology has poor results in real clinical diagnosis and treatment environments and cannot convert the speech of the consultation process into accurate text. In order to solve this problem, existing technologies usually use crawler technology to crawl diagnostic dialogues from online consultation websites or use manual collation to obtain clinical diagnostic dialogue datasets. The dialogue datasets obtained by web crawling technology have problems such as irregular corpus format and low dataset quality. Manually collated diagnostic dialogue datasets are usually only for a specific disease and require a large amount of human resources. In addition, neither the clinically obtained dialogue dataset nor the web crawled dataset can explain the reasons why the doctor asked the question. This means that the dialogue model cannot generate interpretable responses.

[0004] In summary, existing techniques fail to address the problem of automatically generating diagnostic dialogue datasets with explainable justifications. Summary of the invention

[0005] The purpose of the present invention is to provide a method for generating a diagnostic dialogue dataset with explainable reasons, and to automatically construct a large-scale, high-quality dialogue dataset with explainable reasons.

[0006] In order to achieve the above object, the present invention provides the following scheme:

[0007] A method for generating a diagnostic dialogue dataset with explainable reasons, comprising:

[0008] S1: Obtain the original decision tree information, obtain the diagnostic flowchart in the literature, extract each node in the flowchart and the edges between nodes, and divide the nodes into two categories: action nodes and conditional nodes. The action nodes are the content of differential diagnosis, which are used to represent the final diagnosis results. The conditional nodes are the basis for diagnosis, which are used to represent the conditions for further differential diagnosis based on the confirmed symptoms. The edges between nodes represent the judgment condition relationship between nodes.

[0009] S2: construct a decision tree using the condition nodes and action nodes;

[0010] S3: Generate a text set of diagnostic paths described in natural language based on the constructed decision tree;

[0011] S4: Generate a dialogue set with explainable reasons based on the ChatGPT model, call ChatGPT in a zeroshot manner according to the constructed prompt to generate dialogue data, and call the interface provided by the ChatGPT model to generate a consultation dialogue set between patients and doctors. The constructed prompt includes two parts: task description and diagnosis path. The task description is used to help ChatGPT better understand the requirements, and the diagnosis path is the generated diagnosis path text.

[0012] S5: Constructing an example of context with explainable dialogue, which is used to add explainability to the patient-doctor consultation dialogue generated by ChatGPT, that is, adding the reasons for the doctor's response after the doctor's response;

[0013] S6: Generate the final interpretable dialogue data using few shot learning.

[0014] Among them, S2 uses the condition nodes and action nodes to construct a decision tree step, which specifically includes:

[0015] S21: Define a decision tree. The decision tree includes two classes: ConditionNode and ActionNode. The decision tree is a multi-branch tree, in which:

[0016] The structure of the condition node ConditionNode class is: {"id":node id,"parent_id":parent node id,"nodeName":"medical term description","Conditions":"conditional statements in natural language form"};

[0017] The structure of the action node ActionNode class is: {"id":node id,"parent_id":parent node id,"action":"differential diagnosis of diseases"};

[0018] S22: Construct a decision tree. According to the decision tree definition defined in S21, the conditional nodes and action nodes will input the extracted node information into the configuration file. Then, the breadth-first search method is adopted to construct a tree with the main complaint as the root node. Then, nodes with a parent node id of 0 are obtained from the configuration file. These nodes are added as child nodes of the root node. Then, child nodes are constructed one by one. The process is repeated until all leaf nodes are action nodes representing the names of diagnosed diseases.

[0019] Step S3 generates a diagnostic path text set described in natural language based on the constructed decision tree, specifically including:

[0020] S31: Starting from the root node of the constructed decision tree, the initial diagnosis path text is set as: "according to the general practitioner's differential diagnosis medical book" + main complaint symptoms + "differential diagnosis depends on";

[0021] S32: Starting from the root node, the decision tree is traversed in depth-first order. If there are unvisited child nodes of the current node, one of the child nodes is selected for access. The process of accessing the node is to pass the diagnostic process text of the path that has been taken plus the judgment condition of the current node to the child node. The diagnostic path text of the current node is concatenated as: the diagnostic path text of the parent node + "If the condition is met: {the judgment condition of the current node}", and the diagnostic path texts between different child nodes are separated by line breaks "\n";

[0022] Repeat this process until a leaf node is visited, and modify the diagnosis path text to: the diagnosis path text of the parent node + "the final diagnosis is: {the differential diagnosis disease of the leaf node}", the differential diagnosis path text is a complete differential diagnosis path text, and the complete differential diagnosis path text is added to the diagnosis path text set;

[0023] S33: Use the method of S32 to repeatedly traverse the decision tree to obtain the complete differential diagnosis path text set of the main complaint symptom.

[0024] Step S5 constructs a context example with explainable dialogue, which is used to add explainability to the patient-doctor consultation dialogue generated by chatGPT, that is, adding the reasons for the doctor's reply after the doctor's reply, including:

[0025] S51: Select some high-quality data from the generated dialogue set. The selection process consists of two parts: ChatGPT selection and manual verification. In the ChatGPT selection process, the sentence "I need you to carefully read a medical consultation dialogue and a diagnostic path. Your task is to determine whether this dialogue fully maps the diagnostic path" is used as a prompt to call the ChatGPT interface to generate a path recognized by the model; the manual verification process is used for the path recognized by the model, and then it is manually verified to ensure the quality of the dialogue data.

[0026] S52: Use langchain to add explainability to the conversation data. The prompt consists of the conversation data, the consultation path and the task description, where the task description is "I need you to add an explanation after the doctor's reply in this consultation dialogue based on the relevant content in the medical literature." The literature is segmented through langchain, and the relevant chapters are used as external knowledge to let the model generate an explanation of the doctor's consultation. Langchain encodes the literature, calculates the similarity with the prompt, generates a new prompt and calls ChatGPT to get a reply. The reply is the explained conversation data and can be used as a context example for few shot learning.

[0027] In step S6, the final interpretable dialogue data is generated in a few shot learning manner. Specifically, interpretable prompts are constructed. The interpretable prompts consist of three parts: context learning examples, task descriptions, and diagnostic paths. The context learning examples are the interpretable dialogue data generated in S52. The task description is used to inform the language model of the background of the current task and guide the model to generate dialogue data in the desired manner. The diagnostic path is the structured diagnostic path generated after constructing the decision tree. Langchain is then used to connect the diagnostic knowledge in the literature with the language model, thereby providing a knowledge source for the model to generate explanations.

[0028] It can be seen from the above technical solutions that the present invention expresses the diagnosis and treatment process in the literature as a structured diagnosis and treatment path described in natural language by constructing a decision tree, and then generates a dialogue data set containing the doctor's reply explanation reasons by calling ChatGPT twice. The advantages of the dialogue data set with explainable reasons constructed by this method are: (1) high quality. The data set constructed by the decision tree follows the medical diagnosis path, which solves the problem of some meaningless or erroneous dialogue data in web crawling and real data sets; (2) large scale. ChatGPT can be used to construct large-scale data sets based on different diseases, which solves the problem of small scale of existing real medical dialogue data sets. The constructed data set can be used in various dialogue tasks based on large models to help the model understand the doctor-patient dialogue and improve the accuracy of dialogue generation tasks and reasoning tasks. The dialogue data set can be used as an indicator for evaluating large language models in the medical field, and can also be used for fine-tuning language models in the medical field. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] After reading the specific embodiments of the present invention with reference to the accompanying drawings, readers will understand the various aspects of the present invention more clearly.

[0030] Figure 1 A flowchart showing a method for generating a diagnostic conversation dataset with explainable reasons proposed by the present invention;

[0031] Figure 2 An example of a method for generating a diagnostic conversation dataset with explainable reasons according to the present invention is shown. DETAILED DESCRIPTION

[0032] Reference Figure 1 The dialogue generation flow chart is mainly divided into six steps: obtaining the diagnosis process starting from the main symptoms from the literature, constructing a decision tree based on the diagnosis process and supplementing the information of the conditional nodes, using the decision tree to generate a diagnosis path described in natural language, calling ChatGPT to generate dialogues in a zero-shot manner, adding the explanation of the doctor's reply to the generated dialogue to construct a context learning example, and calling ChatGPT in a few-shot manner to generate interpretable dialogue data. Specifically, it includes:

[0033] S1: Obtain the original decision tree information, obtain the diagnostic flowchart in the literature, extract each node in the flowchart and the edges between the nodes, and divide the nodes into two categories: action nodes and conditional nodes. The action nodes are the content of differential diagnosis and are used to represent the final diagnosis results. The conditional nodes are the basis for diagnosis and are used to represent the conditions for differential diagnosis. The edges between nodes represent the judgment conditional relationship between nodes.

[0034] Among them, if the flowchart starts with the chief complaint, the edges between the nodes are directly extracted from the flowchart; if the flowchart does not have the chief complaint, a root node is first constructed to describe the chief complaint, and then other nodes are extracted from the flowchart, and the first node extracted from the flowchart is constructed with an edge connecting the root node describing the chief complaint.

[0035] The diagnostic flowchart is represented in the form of a binary tree or a multi-branch tree, where the leaf nodes are the types of diseases that are finally diagnosed, and the non-leaf nodes are each condition that needs to be judged starting from the main symptoms. This is consistent with the representation of the decision tree, so first extract the conditional nodes representing the differential diagnosis conditions and the leaf nodes representing the types of diseases from the flowchart.

[0036] In order to solve the problem that there are differences in the expression of nodes in the flowcharts of different diagnosis medical books, the present invention defines a unified decision tree node structure and constructs a decision tree based on it.

[0037] S2: constructing a decision tree using the condition nodes and action nodes; specifically including:

[0038] S21: Define a decision tree. The decision tree includes two classes: ConditionNode and ActionNode.

[0039] The structure of the condition node ConditionNode class is: {"id":node id,"parent_id":parent node id,"nodeName":"medical term description","Conditions":"conditional statements in natural language form"}. The root node that describes the main complaint symptoms belongs to the condition node;

[0040] The structure of the action node ActionNode class is: {"id":node id,"parent_id":parent node id,"action":"differential diagnosis of disease"}, and the decision tree is a multi-branch tree;

[0041] S22: Construct a decision tree. According to the decision tree definition defined in S21, the conditional nodes and action nodes will extract the node information into the configuration file. Then, the breadth-first search method is adopted to construct the main complaint symptoms as the root node. Then, the nodes with the parent node id of 0 are obtained from the configuration file, and these nodes are added as child nodes of the root node. Then, the child nodes are constructed one by one, and the process is repeated until all leaf nodes are action nodes representing disease types.

[0042] The conditional node representation consists of a dictionary. Among them, "id" defines the node number, "parent_id" is the parent node id of the node, and a fictitious node numbered 0 is used to represent the parent node of the root node; nodeName is the qualitative representation of the current node. For example, in the flowchart where the main complaint is dyspnea, it is necessary to determine whether the dyspnea is acute or chronic, but acute and chronic are not conditions that can be directly judged. It is based on the condition of the duration of dyspnea to determine whether it is acute. If there is no qualitative representation, it can be represented by an overview. Conditions is the condition that needs to be judged at the current node. Only when the condition is met can the child node of the node be entered. Otherwise, the node does not meet the condition and the other child nodes of its parent node are judged instead. In the decision tree with dyspnea as the main complaint, {"id":1, "parent_id":0, "nodeName": "acute", "Conditions": "duration less than one week"} is the condition node used to judge acute dyspnea.

[0043] Action nodes are also represented by dictionaries, where id and parent_id are represented in the same way as condition nodes and are numbered uniformly with condition nodes. disease is the disease type information of the final differential diagnosis. {"id":4,"parent_id":3,"action":"pneumonia"} represents an action node diagnosed as pneumonia.

[0044] To construct a decision tree based on the extracted conditional nodes and disease leaf nodes, enter the extracted node information into the configuration file. The decision tree module will automatically build a decision tree based on the configuration file. Then, you can make differential diagnosis decisions through the decision tree and obtain the decision path text for each disease. The configuration file is configured using a json file.

[0045] The decision tree is constructed using the breadth-first search approach. Starting from the root node of the main complaint, the nodes whose parent node id is 0 are first obtained from the configuration file, and these nodes are added as child nodes of the root node. Then, the child nodes are constructed one by one, and the nodes whose parent node id is the current child node id are also searched in the configuration file. This registration and construction continues until all leaf nodes are action nodes representing disease types.

[0046] S3: Generate a diagnostic path text set described in natural language based on the constructed decision tree, specifically including:

[0047] S31: Set the initial diagnosis path text as: "According to the general practitioner's differential diagnosis medical book" + main complaint symptoms + "differential diagnosis depends on";

[0048] S32: Starting from the root node, traverse the decision tree in depth-first order.

[0049] If there are unvisited child nodes of the current node, any child node is selected for access. During the node access process, the diagnostic text of the path that has been taken plus the judgment condition of the current node is passed to the child node. The diagnostic path text of the current node is concatenated as: the diagnostic path text of the parent node + "If the condition is met: {the judgment condition of the current node}". The diagnostic path texts of different child nodes are separated by line breaks "\n".

[0050] Repeat this process until a leaf node is visited, and modify the diagnosis path text to: the diagnosis path text of the parent node + "the final diagnosis is: {the differential diagnosis disease of the leaf node}", the differential diagnosis path text is a complete differential diagnosis path text, and the complete differential diagnosis path text is added to the diagnosis path text set;

[0051] S33: Use the method of S32 to repeatedly traverse the decision tree to obtain the text set of all differential diagnosis paths for the main complaint. A diagnostic path text with dyspnea as the main complaint is expressed as follows: if the condition of dyspnea is met, if the condition of duration is less than one week is met, if the condition of fever is met, the final diagnosis is: pneumonia. Among them, dyspnea is the root node of the decision tree, the condition nodes include duration less than one week and fever symptoms, and the diagnosis of pneumonia is the action node.

[0052] S4: Generate a set of medical consultation dialogues between doctors and patients based on the ChatGPT model. Call ChatGPT in a zero-shot manner according to the constructed prompt to generate dialogue data. Call the interface provided by the ChatGPT model to generate a set of medical consultation dialogues between patients and doctors. The constructed prompt includes two parts: task description and diagnosis path. The task description is used to help ChatGPT better understand the requirements, and the diagnosis path is the generated diagnosis path text.

[0053] Task description helps ChatGPT better understand the requirements. For example, use the sentence "Now I ask you to read a diagnostic path text. Your task is to generate a dialogue between the patient and the doctor based on the diagnostic path of this text. When there are multiple diseases in the diagnostic path that cannot be identified, please ask the doctor to recommend further examinations";

[0054] The diagnostic path is the generated diagnostic path text, for example, "If {condition A} is met, if {condition B} is met..., then consider {disease or recommended action}". After splicing the task description and the diagnostic path, the gpt-3.5-turbo interface provided by OpenAI is called to automatically generate a patient-doctor consultation dialogue, and the consultation logic imitates the diagnostic path provided in the prompt, that is, the doctor's inquiry needs to cover the judgment conditions in the path.

[0055] S5: Constructing an example of context with explainable dialogue, which is used to add explainability to the patient-doctor consultation dialogue generated by ChatGPT, that is, adding the reasons for the doctor's reply after the doctor's reply. Specifically,

[0056] S51: Select some high-quality data from the generated dialogue set. The selection process consists of two parts: ChatGPT selection and manual verification. In the ChatGPT selection process, the sentence "I need you to carefully read a medical consultation dialogue and a diagnostic path. Your task is to determine whether this dialogue fully maps the diagnostic path" is used as a prompt to call the chatGPT interface to generate a path recognized by the model; the manual verification process is used for the path recognized by the model, and then it is manually verified to ensure the quality of the dialogue data.

[0057] S52: Obtain diagnostic knowledge for the symptom from medical literature, and use langchain to add interpretability to the conversation data. Langchain is an open source application framework that provides an external knowledge interaction interface for language models. It can retrieve relevant fragments from external documents and summarize them to improve the prompt. The prompt consists of the conversation data, the diagnostic path and the task description, where the task description is "I need you to add an explanation to the doctor's reply in this consultation dialogue based on the relevant content in the medical literature." The diagnostic knowledge is fragmented through langchain, and the model is used as external knowledge to generate an explanation of the doctor's consultation. Then langchain encodes the fragmented diagnostic knowledge, calculates the similarity with the prompt, generates a new prompt and calls the model's interface to get a reply. The reply is the explained conversation data, which serves as a context example for fewshot learning.

[0058] In step S51, if the conversation contains diseases, recommended examinations, etc. that are not mentioned in the diagnosis path, the conversation is also considered unqualified.

[0059] The following is an example of a multi-round dialogue generated after step S5:

[0060] Patient: Hello doctor, I have been having difficulty breathing recently, especially when I do light exercise, I feel chest tightness and can only breathe shallowly.

[0061] Doctor: Have you had this symptom recently? How long has it lasted?

[0062] Reason for asking this question: According to the differential diagnosis book of general practitioners, the differential diagnosis of dyspnea depends on the duration. Dyspnea that lasts for several hours to several days is acute dyspnea, and acidosis, allergic reaction, myocardial ischemia, etc. need to be considered; dyspnea that lasts for a long time is chronic dyspnea, and interstitial lung disease, cardiomyopathy, etc. need to be considered.

[0063] Patient: Yes, in the last week or so, I just had some difficulty breathing occasionally at first, but now it's getting worse.

[0064] Doctor: OK, do you have a fever?

[0065] Reason for asking this question: According to the general practitioner's differential diagnosis book, the current patient is suffering from acute dyspnea. If acute dyspnea is accompanied by fever symptoms, pneumonia should be considered.

[0066] Patient: No, my body temperature has always been normal.

[0067] Doctor: Do you have any chest pain?

[0068] Reason for asking this question: The patient currently has acute dyspnea and no fever. According to the general practitioner's differential diagnosis book, asking whether there is chest pain can help identify respiratory muscle weakness, allergic reaction, myocardial ischemia, and spontaneous pneumothorax.

[0069] Although the dialogue data obtained in step S5 has been verified by the model and humans, the original dialogue is generated by zero-shot. For large language models, the performance of few shots is higher than zero shots. Therefore, the quality of generation can be further improved through few-shot learning.

[0070] S6: Generate the final interpretable dialogue data in a few shot learning manner. Specifically, construct interpretable prompts, which consist of three parts: context learning examples, task descriptions, and diagnostic paths. The context learning examples are the interpretable dialogue data generated in S52. The task description is used to inform the language model of the background of the current task and guide the model to generate dialogue data in the desired manner. The diagnostic path is the structured diagnostic path generated after constructing the decision tree. Langchain is used to connect the diagnostic knowledge in the literature with the language model, thereby providing a knowledge source for the model to generate explanations.

[0071] The task description text is: "Now I ask you to read a diagnostic path text described in natural language. Your task is to learn the given dialogue example and generate a dialogue between the patient and the doctor based on this text. The dialogue needs to include the doctor's answer and the reason why the doctor asks this question. When there are multiple diseases in the diagnostic path that cannot be identified, please ask the doctor to recommend further examination."

[0072] The above embodiments are only used to help understand the method and core idea of ​​the present invention; at the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A method for generating a diagnostic dialogue dataset with explainable reasons, characterized in that: The specific steps are: S1: Obtain the original decision tree information, obtain the diagnostic flowchart in the literature, extract each node in the flowchart and the edges between nodes, and divide the nodes into two categories: action nodes and conditional nodes. The action nodes are the content of differential diagnosis, which are used to represent the final diagnosis results. The conditional nodes are the basis for diagnosis, which are used to represent the conditions for further differential diagnosis based on the confirmed symptoms. The edges between nodes represent the judgment condition relationship between nodes. S2: construct a decision tree using the condition nodes and action nodes; S3: Generate a text set of diagnostic paths described in natural language based on the constructed decision tree; S4: Generate a dialogue set with explainable reasons based on the ChatGPT model, call ChatGPT in a zeroshot manner according to the constructed prompt to generate dialogue data, and call the interface provided by the ChatGPT model to generate a consultation dialogue set between patients and doctors. The constructed prompt includes two parts: task description and diagnosis path. The task description is used to help ChatGPT better understand the requirements, and the diagnosis path is the generated diagnosis path text. S5: Constructing an example of context with explainable dialogue, which is used to add explainability to the patient-doctor consultation dialogue generated by ChatGPT, that is, adding the reasons for the doctor's response after the doctor's response; S6: Generate the final interpretable dialogue data using few shot learning.

2. The method for generating a diagnostic dialogue dataset with explainable reasons according to claim 1, characterized in that: The step S2 specifically includes: S21: Define a decision tree. The decision tree includes two classes: ConditionNode and ActionNode. The decision tree is a multi-branch tree, in which: The structure of the condition node ConditionNode class is: {"id":node id,"parent_id":parent node id,"nodeName":"medical term description","Conditions":"conditional statements in natural language form"}; The structure of the action node ActionNode class is: {"id":node id,"parent_id":parent node id,"action":"differential diagnosis of diseases"}; S22: Construct a decision tree. According to the decision tree definition defined in S21, the conditional nodes and action nodes will input the extracted node information into the configuration file. Then, the breadth-first search method is adopted to construct a tree with the main complaint as the root node. Then, nodes with a parent node id of 0 are obtained from the configuration file. These nodes are added as child nodes of the root node. Then, child nodes are constructed one by one. The process is repeated until all leaf nodes are action nodes representing the names of diagnosed diseases.

3. The method for generating a diagnostic dialogue dataset with explainable reasons according to claim 1, characterized in that: The step S3 specifically includes: S31: Starting from the root node of the constructed decision tree, the initial diagnosis path text is set as: "according to the general practitioner differential diagnosis medical book" + main complaint symptoms + "differential diagnosis depends on"; S32: Starting from the root node, the decision tree is traversed in depth-first order. If there are unvisited child nodes of the current node, one of the child nodes is selected for access. The process of accessing the node is to pass the diagnostic process text of the path that has been taken plus the judgment condition of the current node to the child node. The diagnostic path text of the current node is concatenated as: the diagnostic path text of the parent node + "If the condition is met: {the judgment condition of the current node}", and the diagnostic path texts between different child nodes are separated by line breaks "\n"; Repeat this process until a leaf node is accessed, and modify the diagnosis path text to: the diagnosis path text of the parent node + "the final diagnosis is: {the differential diagnosis disease of the leaf node}", the differential diagnosis path text is a complete differential diagnosis path text, and the complete differential diagnosis path text is added to the diagnosis path text set; S33: Use the method of S32 to repeatedly traverse the decision tree to obtain the complete differential diagnosis path text set of the main complaint symptom.

4. The method for generating a diagnostic dialogue dataset with explainable reasons according to claim 1, characterized in that: The step S5 specifically includes: S51: Select some high-quality data from the generated dialogue set. The selection process consists of two parts: ChatGPT selection and manual verification. In the ChatGPT selection process, the sentence "I need you to read a medical consultation dialogue and a diagnosis path carefully. Your task is to determine whether this dialogue fully maps the diagnosis path" is used as a prompt to call the ChatGPT interface to generate a path recognized by the model; the manual verification process is used for the path recognized by the model, and then manually verified to ensure the quality of the dialogue data; S52: Use langchain to add explainability to the conversation data. The prompt consists of the conversation data, the consultation path and the task description, where the task description is "I need you to add an explanation to the doctor's reply in this consultation dialogue based on the relevant content in the medical literature." The literature is segmented through langchain, and the relevant chapters are used as external knowledge to let the model generate an explanation of the doctor's consultation. Langchain encodes the literature, calculates the similarity with the prompt, generates a new prompt and calls ChatGPT to get a reply. The reply is the explained conversation data and can be used as a context example for few shot learning.

5. The method for generating a diagnostic dialogue dataset with explainable reasons according to claim 1, characterized in that: Step S6 specifically includes: Construct an explainability hint, which consists of three parts: context learning example, task description and diagnostic path. The context learning example is the explained dialogue data generated in S52. The task description is used to inform the language model of the background of the current task and guide the model to generate dialogue data in a desired manner. The diagnostic path is a structured diagnostic path generated after constructing the decision tree. Langchain is then used to connect diagnostic knowledge from the literature with the language model, thus providing a source of knowledge for the model to generate explanations.