Automatic follow-up dialogue method and device, electronic equipment and storage medium
By using an automated follow-up dialogue method, leveraging a large language model and follow-up configuration files, the chronic disease management follow-up process can be precisely controlled. This solves the problem of premature switching when information is not fully collected in existing technologies, ensuring complete information collection and the rigor of medical logic.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUXI BAUHINIA ZHIKANG TECHNOLOGY CO LTD
- Filing Date
- 2026-03-20
- Publication Date
- 2026-07-14
Smart Images

Figure CN122392836A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence dialogue technology, and in particular to an automatic follow-up dialogue method, apparatus, electronic device and storage medium. Background Technology
[0002] In current chronic disease management and follow-up scenarios, doctors or follow-up personnel need to interact with patients to collect key information such as symptom changes, medication adherence, and adverse reactions in order to conduct subsequent risk assessments and health guidance. Therefore, how to reduce the burden on medical staff and automate and efficiently complete the collection of follow-up information is a common technological need in this field.
[0003] To meet these needs, one existing approach is based on fixed electronic questionnaires or scales. Patients fill out the questionnaires according to pre-set questions, and the system stores and simply summarizes the results. However, the interaction logic of this approach is fixed, and it cannot dynamically adjust the questioning strategy based on the patient's answers. Another approach utilizes general-purpose chatbots for open-ended follow-up dialogues. Although the interaction method is more flexible, due to a lack of understanding of the specific clinical goals and phased logic of the follow-up task, the dialogue process is often not very targeted. The system can usually only perform simple plain text saving or keyword extraction of the dialogue records, making it difficult to directly form structured follow-up records that can be used for clinical analysis.
[0004] Because follow-up information typically has clear clinical semantic boundaries and is phased—for example, asthma follow-up requires sequential data collection at different stages, such as Asthma Control Test (ACT) assessment, pulmonary function tests, and medication adherence—existing technologies often struggle to ensure that the questioning order and dialogue objectives strictly align with the pre-defined clinical pathway when controlling the conversation flow. More importantly, existing solutions lack reliable mechanisms to determine whether all information for the current stage has been collected. Therefore, in process control, it frequently occurs that the next follow-up stage is prematurely moved before all required information for the current stage has been collected. This not only leads to missing or incomplete follow-up data but may also cause contradictions between the final follow-up summary and the actual collected fragmented data, affecting the medical logical rigor of the entire follow-up process. Summary of the Invention
[0005] This invention provides an automated follow-up dialogue method, device, electronic device, and storage medium to address the deficiency in the prior art of lacking a dialogue process control mechanism that can ensure strict adherence to the clinical pathway sequence and reliably determine whether information collection at each stage is complete.
[0006] This invention provides an automatic follow-up dialogue method, comprising the following steps: A serialized follow-up process is defined; the serialized follow-up process includes multiple follow-up stages, each follow-up stage is associated with a set of information collection tasks, the information collection tasks are used to collect dialogue responses in the follow-up stage, and the dialogue responses are used to fill the target slots associated with the follow-up stage. Obtain the dialogue response for the current follow-up stage in the serialized follow-up process, and determine the filling status of all target slots associated with the current follow-up stage based on the dialogue response; Based on the filling status of all the target slots, the completion status of the current follow-up phase is determined; the completion status is used to indicate whether the current follow-up phase is completed, and the completed status of the current follow-up phase means that all the target slots corresponding to the information collection task associated with the current follow-up phase are filled. If the current follow-up stage is in the completed state, the next follow-up stage in the serialized follow-up process is updated to the new current follow-up stage until all follow-up stages in the serialized follow-up process have reached the completed state.
[0007] An automatic follow-up dialogue method provided by the present invention further includes: If the current follow-up phase is incomplete, determine the current number of retries for the unfilled target slots corresponding to the information collection task associated with the current follow-up phase. If the current number of retries is less than a preset retry threshold, return to the steps of obtaining the dialogue response for the current follow-up phase in the serialized follow-up process, determining the filling status of all target slots associated with the current follow-up phase based on the dialogue response, and determining the phase completion status of the current follow-up phase based on the filling status of all target slots, until the phase completion status of the current follow-up phase is completed. If the current number of retries is greater than or equal to the preset retry threshold, the unfilled target slot is forcibly assigned a value until the current follow-up phase is completed.
[0008] According to an automatic follow-up dialogue method provided by the present invention, obtaining a dialogue response for the current follow-up stage in the serialized follow-up process includes: Based on the diagnostic type associated with the automatic follow-up dialogue, a follow-up configuration file is loaded; wherein, the follow-up configuration file includes multiple follow-up stages executed sequentially, and each follow-up stage includes a stage name, a stage description, and a slot definition for at least one of the target slots; the slot definition includes at least one of key name, collection intent, question prompt, and option mapping; Based on the user's answers to the previous round of questions in the current follow-up phase, determine the current interaction data; The collection intent, question prompts, and option mappings corresponding to the current follow-up stage in the follow-up configuration file, along with the current interaction data, are combined into prompt words; The prompt words are input into the large language model to obtain the structured output of the large language model; The dialogue response is obtained by parsing the structured output.
[0009] According to an automatic follow-up dialogue method provided by the present invention, the structured output includes slot update data; The step of inputting the prompt word into the large language model to obtain the structured output of the large language model further includes: Based on the key name corresponding to the target slot in the slot update data, the slot value in the slot update data is filled into the target slot.
[0010] According to an automatic follow-up dialogue method provided by the present invention, the method further includes filling the target slot with the slot value in the slot update data based on the key name corresponding to the target slot in the slot update data, and then further comprising: Extract key historical information from the dialogue responses during the current follow-up phase; Input the data of all the filled target slots and the historical key information into the large language model to obtain the key information output by the large language model; The key information includes at least one of the following: symptoms and signs, medication behavior, and behavioral triggers.
[0011] According to an automatic follow-up dialogue method provided by the present invention, the step of updating the next follow-up stage of the current follow-up stage in the serialized follow-up process to a new current follow-up stage further includes: All the filled target slots and the risk determination rules corresponding to the diagnosis type are input into the large language model to obtain the risk assessment results output by the large language model, including risk level and risk factors.
[0012] An automatic follow-up dialogue method provided by the present invention is executed based on a preset state diagram control flow; The state diagram includes multiple nodes and the connection relationships between the nodes, and the connection relationships are used to represent the logical order of process execution; The nodes include single-turn dialogue processing nodes, phase completion check nodes, and phase switching nodes; The single-turn dialogue processing node is used to obtain the dialogue response to the current follow-up stage in the serialized follow-up process; the stage completion check node is used to determine the stage completion status of the current follow-up stage; the stage switching node is used to update the next follow-up stage of the current follow-up stage in the serialized follow-up process to the new current follow-up stage when the stage completion status of the current follow-up stage is the completed status.
[0013] An automatic follow-up dialogue method provided by the present invention further includes: If the current follow-up stage is the target follow-up stage and all the target slots in the target follow-up stage are filled, all the target slots that have been filled in all follow-up stages are integrated to obtain an integration result; the target follow-up stage is the last follow-up stage of the serialized follow-up process. The integration results are input into the large language model to obtain the follow-up summary document output by the large language model; the follow-up summary document includes a follow-up overview, risk warning, and personalized instructions and guidance.
[0014] The present invention also provides an automatic follow-up dialogue device, comprising the following modules: A determination module is used to determine the serialized follow-up process; the serialized follow-up process includes multiple follow-up stages, each follow-up stage is associated with a set of information collection tasks, the information collection tasks are used to collect dialogue responses in the follow-up stage, and the dialogue responses are used to fill the target slots associated with the follow-up stage. The acquisition module is used to acquire the dialogue response to the current follow-up stage in the serialized follow-up process, and based on the dialogue response, determine the filling status of all target slots associated with the current follow-up stage; The status determination module is used to determine the stage completion status of the current follow-up stage based on the filling status of all the target slots; the stage completion status is used to indicate whether the current follow-up stage is completed, and the completed status of the current follow-up stage means that all the target slots corresponding to the information collection task associated with the current follow-up stage are filled. The update module is used to update the next follow-up stage in the serialized follow-up process to a new current follow-up stage when the stage completion status of the current follow-up stage is the completed state, until all follow-up stages in the serialized follow-up process have reached the completed state.
[0015] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the automatic follow-up dialogue method as described above.
[0016] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the automatic follow-up dialogue method as described above.
[0017] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the automatic follow-up dialogue method as described above.
[0018] The present invention provides an automated follow-up dialogue method, apparatus, electronic device, and storage medium. It determines a serialized follow-up process, obtains dialogue responses for the current follow-up stage within the serialized follow-up process, determines the filling status of all target slots associated with the current follow-up stage based on the dialogue responses, determines the stage completion status of the current follow-up stage based on the filling status of all target slots, and updates the next follow-up stage in the serialized follow-up process to the new current follow-up stage when the current follow-up stage is in a completed state, until all follow-up stages in the serialized follow-up process have reached a completed state. This allows for accurate and objective determination of the true completeness of information collection in the current follow-up stage, ensuring that the process only switches to the next follow-up stage after all target slots associated with the current follow-up stage have been confirmed to be filled. This solves the problem in existing technologies where the lack of a reliable stage completion determination mechanism leads to premature switching of the follow-up process before complete information collection, thus guaranteeing the medical logical rigor and the integrity of the follow-up dialogue data in the entire automated follow-up process. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0020] Figure 1 This is one of the flowcharts of the automatic follow-up dialogue method provided by the present invention.
[0021] Figure 2 This is a flowchart illustrating the parsing of dialogue responses provided by the present invention.
[0022] Figure 3 This is a flowchart illustrating the process of determining key information provided by the present invention.
[0023] Figure 4 This is the second flowchart of the automatic follow-up dialogue method provided by the present invention.
[0024] Figure 5This is a schematic diagram of the automatic follow-up dialogue device provided by the present invention.
[0025] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0027] This invention provides an automated follow-up dialogue method, which can be applied to automated doctor-patient dialogue systems in scenarios such as chronic disease management, post-discharge follow-up, or community health management. The system can be deployed on servers, cloud platforms, or terminal electronic devices. Figure 1 This is one of the flowcharts illustrating the automatic follow-up dialogue method provided by the present invention, such as... Figure 1 As shown, the method includes the following: Step 110: Determine the serialized follow-up process; the serialized follow-up process includes multiple follow-up stages, each follow-up stage is associated with a set of information collection tasks, the information collection tasks are used to collect dialogue responses in the follow-up stage, and the dialogue responses are used to fill the target slots associated with the follow-up stage.
[0028] Specifically, first, the serialized follow-up process is determined. The serialized follow-up process includes multiple follow-up stages, each associated with a set of information collection tasks. The information collection tasks are used to collect dialogue responses during the follow-up stage, and the dialogue responses are used to fill the target slots associated with the follow-up stage.
[0029] Here, a sequential follow-up process refers to a complete follow-up task, such as an asthma follow-up, which is divided into multiple clinically significant stages performed in a pre-defined order. For example, an asthma follow-up might sequentially include an asthma control test scale assessment stage, a pulmonary function test information collection stage, a medication adherence inquiry stage, and an adverse reaction collection stage. The current follow-up stage refers to the specific stage the dialogue process is currently in. This staged design ensures the structure and medical logic of the follow-up dialogue.
[0030] Here, the information collection task refers to the specific information collection items that need to be completed during a specific follow-up phase. For example, during the medication adherence inquiry phase, the information collection task may include collecting information such as drug name, dosage, frequency of medication, and number of missed doses. This embodiment of the invention does not specifically limit this.
[0031] Here, the target slot can usually be understood as a data field that needs to be filled, corresponding to a specific information collection task.
[0032] Here, dialogue response refers to the text content generated by the large language model and intended to be presented to the user to guide the user to provide information in order to complete the information collection task.
[0033] Large language models can refer to any deep learning model pre-trained on a large corpus and possessing powerful natural language understanding and generation capabilities. For example, a large language model could be a Transformer-based model, such as the LLaMA series, or a specialized large language model fine-tuned for the medical field. In this method, the large language model acts as a follow-up physician, responsible for understanding the user's answers and generating questions. It also assesses the completeness of information gathering and generates the next round of questions.
[0034] Step 120: Obtain the dialogue response for the current follow-up stage in the serialized follow-up process, and determine the filling status of all target slots associated with the current follow-up stage based on the dialogue response.
[0035] Specifically, the dialogue response to the current follow-up stage in the serialized follow-up process is obtained, and based on the dialogue response, the filling status of all target slots associated with the current follow-up stage is determined.
[0036] During the current follow-up phase, the system retrieves dialogue responses to populate their associated target slots. A specific implementation of retrieving dialogue responses can be to input prompts containing dialogue context information and current task instructions into a large language model and receive the output returned by the large language model. Based on the input information, the large language model attempts to parse and populate the target slots relevant to the current follow-up phase from the user's latest response, while simultaneously generating the next response to guide the dialogue forward.
[0037] The "fill status" refers to whether the target slot has been assigned a value. "Filled" here can mean that the target slot's value is not null, not an empty string, or has any valid value other than the initial default value. This determination process is the result of the system's objective check of the structured data storage of the current session.
[0038] Step 130: Based on the filling status of all the target slots, determine the completion status of the current follow-up phase; the completion status indicates whether the current follow-up phase is complete, and the completion status of the current follow-up phase means that all the target slots corresponding to the information collection tasks associated with the current follow-up phase are filled. Specifically, after determining the filling status of all target slots, the system determines the completion status of the current follow-up phase. The phase completion status indicates whether the current follow-up phase is complete. A completed current follow-up phase means that all target slots corresponding to the information collection tasks associated with the current follow-up phase have been filled.
[0039] Correspondingly, the incomplete status means that at least one target slot in the information collection task associated with the current follow-up phase has not yet been filled.
[0040] Step 140: If the completion status of the current follow-up stage is the completed state, update the next follow-up stage of the current follow-up stage in the serialized follow-up process to the new current follow-up stage, until all follow-up stages in the serialized follow-up process have reached the completed state.
[0041] Specifically, if the current follow-up phase is in the completed state, then the next follow-up phase will be taken as the new current follow-up phase.
[0042] In this context, the next follow-up stage refers to the logical stage immediately following the current follow-up stage in a multi-stage follow-up process. For example, if the current follow-up stage is the asthma control test scale assessment stage, the next follow-up stage could be the pulmonary function test information collection stage. If the current follow-up stage is the last stage, then the entire sequential follow-up process is complete.
[0043] The specific implementation of taking the next follow-up stage as the new current follow-up stage involves the system updating its internally maintained session state and changing the identifier of the current follow-up stage to the identifier of the next follow-up stage. Thereafter, subsequent dialogue interactions will revolve around the new current follow-up stage and its corresponding target slot.
[0044] The method provided in this invention determines a serialized follow-up process, obtains dialogue responses for the current follow-up stage in the serialized follow-up process, determines the filling status of all target slots associated with the current follow-up stage based on the dialogue responses, determines the stage completion status of the current follow-up stage based on the filling status of all target slots, and updates the next follow-up stage in the serialized follow-up process to the new current follow-up stage when the stage completion status of the current follow-up stage is "completed," until all follow-up stages in the serialized follow-up process have reached the "completed" status. This allows for an accurate and objective determination of the true completeness of information collection in the current follow-up stage, ensuring that the process only switches to the next follow-up stage after all target slots associated with the current follow-up stage have been confirmed to be filled. This solves the problem in existing technologies where the lack of a reliable stage completion determination mechanism leads to premature switching of the follow-up process before complete information collection, thus guaranteeing the medical logic rigor and the integrity of the follow-up dialogue data in the entire automated follow-up process.
[0045] Based on the above embodiments, the method further includes: Step 141: If the completion status of the current follow-up stage is incomplete, determine the current number of retries for the unfilled target slots corresponding to the information collection task associated with the current follow-up stage. If the current number of retries is less than a preset retry threshold, return to the steps of obtaining the dialogue response for the current follow-up stage in the serialized follow-up process, determining the filling status of all target slots associated with the current follow-up stage based on the dialogue response, and determining the completion status of the current follow-up stage based on the filling status of all target slots, until the completion status of the current follow-up stage is completed. Step 142: If the current number of retries is greater than or equal to the preset retry threshold, the unfilled target slot is forcibly assigned a value until the current follow-up phase is completed.
[0046] Specifically, firstly, if the current follow-up phase is incomplete, determine the current number of retries for the unfilled target slots corresponding to the information collection tasks associated with the current follow-up phase.
[0047] If the current number of retries is less than the preset retry threshold, then return to the step of obtaining the dialogue response for the current follow-up stage in the serialized follow-up process, and based on the dialogue response, determining the filling status of all target slots associated with the current follow-up stage; and then, based on the filling status of all target slots, determining the stage completion status of the current follow-up stage, until the stage completion status of the current follow-up stage is a completed state.
[0048] If the current number of retries is greater than or equal to the preset retry threshold, then the unfilled target slots will be forcibly assigned a value until the current follow-up phase is completed.
[0049] The current retries count refers to the number of times the system attempts to have the large language model regenerate questions to complete the information after determining that the current follow-up stage is incomplete. The current retries count is typically a counter variable associated with the current follow-up stage; this counter increments each time a retry is triggered due to incompleteness. This mechanism controls and records the number of automatic error correction attempts for insufficient information collection.
[0050] The preset retry threshold refers to the maximum number of retries allowed by the system for the same stage due to its incomplete state. This is a pre-set, configurable integer value, such as 2 or 3 times, and this embodiment of the invention does not specifically limit it. The purpose of the preset retry threshold is to set an upper limit for the automatic retry mechanism to prevent the dialogue flow from getting stuck in an infinite loop due to the large language model's continuous inability to correctly understand the task.
[0051] Here, forced assignment refers to a strategy adopted by the system to ensure that the current stage reaches a completed state after the current retries have reached or exceeded a preset retry threshold. In a specific embodiment, the system automatically fills all unfilled target slots in the current follow-up stage with a pre-defined specific string or value representing "no information" or "not provided," such as "N / A" or "information not provided." This operation ensures that all target slots in this stage have values in the data structure, thus satisfying the filling condition, allowing the stage completion state to be determined as completed, and enabling the process to continue execution.
[0052] The method provided in this invention constructs a limited retry gating mechanism by introducing the current number of retries and a preset retry threshold. This provides the system with a limited number of automated dialogue correction opportunities when a large language model makes a misjudgment, attempting to complete the information through dialogue. Furthermore, after the number of retries is exhausted, by forcibly assigning values to the unfilled target slots and continuing to the next follow-up stage, the method can effectively avoid the dialogue process dead loop caused by the continuous misjudgment of the large language model, greatly enhancing the robustness and fault tolerance of the entire automatic follow-up dialogue process.
[0053] In related technologies, fixed questionnaires cannot determine the content of the next question based on the patient's previous answer, which easily leads to invalid questions or repeated follow-up questions; open dialogues lack clear information collection objectives, resulting in lengthy dialogue rounds or information omissions. Furthermore, rule engines rely on preset questions and options, making it difficult to accurately map patients' colloquial expressions, partial completions, or answers that do not completely match the options to scale scores or slots, which easily leads to misfills or blanks.
[0054] Based on the above embodiments, step 110 includes: Step 1101: Based on the diagnostic type associated with the automatic follow-up dialogue, load the follow-up configuration file; wherein, the follow-up configuration file includes multiple follow-up stages executed sequentially, and each follow-up stage includes a stage name, a stage description, and a slot definition for at least one of the target slots; the slot definition includes at least one of key name, collection intent, question prompt, and option mapping; Step 1102: Determine the current interaction data based on the user's answer to the previous round of questions in the current follow-up phase; Step 1103: Combine the collection intent, question prompts and option mappings corresponding to the current follow-up stage in the follow-up configuration file, and the current interaction data into prompt words; Step 1104: Input the prompt word into the large language model to obtain the structured output of the large language model; Step 1105: Parse the dialogue response from the structured output.
[0055] Specifically, Figure 2 This is a flowchart illustrating the parsing of dialogue responses provided by the present invention, as shown below. Figure 2 As shown, firstly, a follow-up configuration file can be loaded based on the diagnostic type associated with the automated follow-up dialogue. The follow-up configuration file includes multiple follow-up stages executed sequentially, and each follow-up stage includes a stage name, a stage description, and a slot definition for at least one of the target slots. The slot definition includes at least one of a key name, collection intent, question prompt, and option mapping.
[0056] Here, the diagnosis type reflects the specific disease or health condition targeted by this automated follow-up task. For example, the diagnosis type could be hypertension, asthma, etc., and this embodiment of the invention does not specifically limit this. The diagnosis type is the key entry point driving the personalization and configuration of the entire follow-up process. The system can obtain the diagnosis type from the user's electronic medical record or from the user or medical staff specifying it at the start of the follow-up task.
[0057] The follow-up configuration file refers to a structured set of rules that defines the complete follow-up process for a specific diagnostic type. The follow-up configuration file can be in a machine-readable format, such as JSON, YAML, or XML. It separates the specific medical follow-up logic from the general dialogue execution framework, enabling configurable management of the follow-up process.
[0058] Here, follow-up phases are logical units that are pre-declared in the follow-up configuration file and arranged in a specific order. For example, a follow-up configuration file for an asthma diagnosis type can define multiple follow-up phases that are executed sequentially, such as ACT scale assessment, medication adherence, and adverse reactions.
[0059] Phase names and phase descriptions are metadata for follow-up phases, used for internal system identification and easy human understanding. For example, a phase name could be phase_act_score, and a phase description could be the collection of patients' asthma control test questionnaire scores.
[0060] In this context, slot definition refers to the detailed and structured description of each target slot that needs to be collected in the follow-up configuration file, which is the key basis for the large language model to understand its task. Key name refers to the unique identifier of the target slot in the system data structure, which is a field name used internally by the program. For example, the key name can be the number of times emergency medicine is used, the number of times chest tightness occurs per day, etc. This embodiment of the invention does not make specific limitations on this.
[0061] The collection intent reflects the collection purpose, semantic definition, and data usage of the target slot in a specific clinical or business scenario. It aims to provide clear and interpretable data collection context and target guidance for large language models. For example, for the key name night_symptoms_frequency, its collection intent could be: This slot is used to collect information on the frequency of sleep disturbances caused by asthma symptoms at night.
[0062] The question prompts are used to provide specific question formats or templates for the target slot, aiming to guide the large language model in generating natural language questions that align with the data collection intent. For example, a question prompt could be, "How many times in the past week have you woken up at night due to asthma symptoms?"
[0063] Option mapping is used to pre-define a list of standard options and their corresponding standardized values for the target slots in multiple-choice questions. Its function is to guide the large language model to accurately map and convert users' natural language responses, such as vague expressions and colloquial descriptions, into structured standardized values. For example, for a question, the option mapping could be {"A. Never": 1, "B. 1-2 times": 2, "C. 3-4 times": 3}. This helps the large language model accurately map users' colloquial responses, such as "maybe once or twice," to the standardized value "2".
[0064] In this embodiment, when an automatic follow-up session begins, the system first obtains the diagnosis type of this session, and then loads the matching follow-up configuration file from the repository based on the diagnosis type. This follow-up configuration file defines in detail all the follow-up stages required for this follow-up and their execution order, as well as the detailed slot definitions of all target slots that need to be filled within each stage. The entire subsequent dialogue flow will strictly follow the guidance of this follow-up configuration file.
[0065] Understandably, by loading follow-up configuration files containing multi-stage and detailed slot definitions based on diagnosis type, the specific and variable medical follow-up logic is decoupled from the general and stable dialogue execution framework. Consequently, the system can flexibly execute highly customized dialogue processes for different diseases based on different follow-up configuration files, solving the problem of developing different follow-up systems for different diseases. This makes it possible to support follow-up processes for new diseases simply by adding new configuration files without modifying the core program code, greatly improving the scalability, maintainability, and applicability of the entire automated follow-up dialogue method.
[0066] Furthermore, the current interaction data can be determined based on the user's answers in the previous round of inquiries during the current follow-up phase. The user's answers in the previous round of inquiries refer to the original text information entered by the user in the previous dialogue. For example, when the system asks, "How have you been taking your medication lately?", the user's response, "I feel fine, I've been taking my medication on time," would be the user's answer in the previous round of inquiries.
[0067] Here, current interaction data refers to the most directly relevant contextual information prepared for this round of dialogue processing. In this embodiment, current interaction data is mainly determined based on the user's answer to the previous round of inquiry, but broadly speaking, it can also include the content of the system's questions in the previous round, together constituting the core input of this round of dialogue.
[0068] After obtaining the current interaction data, the collection intent, question prompts, and option mappings corresponding to the current follow-up stage in the follow-up configuration file, along with the current interaction data, can be combined into prompt words.
[0069] In this context, a cue word refers to a block of text that contains complete instructions and contextual information, which is ultimately input into the large language model. A cue word is a string whose purpose is to provide the large language model with all the necessary background information, constraints, and output format requirements for performing the current task (i.e., slot filling and response generation).
[0070] Finally, the prompt words can be input into the large language model to obtain the structured output of the large language model, and the dialogue response can be obtained from the structured output.
[0071] Structured output refers to the output returned by the large language model, which is not pure natural language text but has a specific data structure, such as JSON format. The output format of structured output is pre-agreed upon between the system and the large language model. Structured output separates the dialogue text generated by the large language model from the slot information extracted by the large language model, facilitating system parsing and processing. For example, a structured output could be {"slot_updates": {"medication_adherence": "on_time"}, "reply_text": "Okay, I'm glad to hear that you're taking your medication on time. Have you experienced a dry cough or wheezing recently?"}.
[0072] The method provided in this invention combines static rule information such as the collection intent, question prompts, and option mappings explicitly stated in the follow-up configuration file with dynamic dialogue context information such as the current interaction data to form a rich and clearly structured prompt word. This provides the large language model with a complete and accurate task context and boundary constraints in each round of dialogue interaction. Consequently, under the strong guidance of the prompt word, the large language model can accurately understand the user's colloquial answers and precisely map them to predefined target slots, while generating logically coherent and goal-oriented questions for the next round of questions, greatly improving the accuracy of slot filling and the quality of the dialogue process.
[0073] Based on the above embodiments, the structured output includes slot update data; Step 1104, followed by: Step 1104-1: Based on the key name corresponding to the target slot in the slot update data, fill the slot value in the slot update data into the target slot.
[0074] Specifically, the structured output includes slot update data. Accordingly, the slot value in the slot update data can be filled into the target slot based on the key name in the slot update data that corresponds to the target slot.
[0075] Here, slot update data refers to the portion of the structured output specifically containing the slot information extracted in this interaction. Slot update data is typically a collection of one or more key-value pairs. For example, in JSON format output, it can be an object where the key is the target slot name and the value is the slot value to be populated. For example: "slot_updates": {"night_symptoms_frequency": 2}.
[0076] The slot value refers to the specific information that the large language model actually extracts and standardizes from the user's answer. The slot value will be used to fill the target slot. For example, when a user answers "probably once or twice last week", the slot value extracted and mapped by the large language model could be the integer 2.
[0077] In this embodiment, after the system obtains structured output from the large language model, it will specifically parse a portion of it. The system will traverse each key-value pair in the slot update data, using the key name as an index to find the corresponding target slot in the data structure maintained internally by the system and associated with the current session, and then assign the value in the key-value pair, i.e., the slot value, to the target slot.
[0078] The method provided in this invention establishes a clear and unambiguous inter-machine communication protocol by defining a structured format for the output of a large language model that includes slot update data, and performing a fill operation based on the unique key name within it. This seamlessly integrates the understanding results of the large language model with the system's structured data storage. Furthermore, the system can automatically and programmatically parse the output of the large language model and accurately update the corresponding data fields, resolving parsing errors or matching confusion that may occur when extracting information from unstructured or semi-structured model responses. This ensures that every piece of information obtained from the user is accurately recorded in the preset data structure, significantly improving the accuracy and reliability of data collection during automatic follow-up dialogues.
[0079] Based on the above embodiments, step 1104-1 further includes: Step 310: Extract key historical information of dialogue responses in the current follow-up phase; Step 320: Input the data of all the filled target slots and the historical key information into the large language model to obtain the key information output by the large language model; The key information includes at least one of the following: symptoms and signs, medication behavior, and behavioral triggers.
[0080] Specifically, Figure 3 This is a flowchart illustrating the process of determining key information provided by the present invention, such as... Figure 3 As shown, firstly, key historical information from the dialogue responses in the current follow-up phase can be extracted. This key historical information refers to summaries of key information generated and stored in previous dialogue rounds. Using this key historical information as one of the inputs for this incremental update allows the large language model to supplement or correct existing summaries, rather than starting from scratch.
[0081] Then, the data from all filled target slots and historical key information can be input into the large language model to obtain the key information output by the large language model. This key information may include at least one of the following: symptoms and signs, medication behavior, and behavioral triggers.
[0082] The key information refers to a text generated by a large language model that summarizes and generalizes the currently collected structured slot data using natural language. This key information is not a mere listing of raw data, but rather a concise description that has been refined and summarized to suit clinical reading habits. It is typically output in a structured format for easy front-end display.
[0083] Here, symptoms and signs, medication behavior, and behavioral triggers are used to categorize specific information. Symptoms and signs describe the patient's physiological state and disease manifestations, such as a patient reporting mild chest tightness for the past week. Medication behavior summarizes the patient's medication adherence and habits, such as increased frequency of emergency medication use. Behavioral triggers summarize factors that may trigger symptoms or affect the condition, such as symptoms often appearing after emotional excitement.
[0084] The method provided in this invention drives a large language model to incrementally generate categorized key information during the dialogue process by utilizing pre-filled slot data and historical key information. This achieves real-time conversion from discrete, machine-readable slot data to continuous, human-readable clinical summaries. Consequently, medical staff can dynamically and clearly grasp the core points of the patient's condition during the dialogue without waiting for the follow-up to end or reading the original dialogue record. This solves the problems of opaque process information and difficulty in real-time monitoring in existing technologies, greatly improving the monitoring efficiency of the follow-up process and the readability of clinical information.
[0085] In related technologies, simple keyword extraction cannot be consistently aligned with clinical risk assessment rules. If the collected structured data and risk assessment logic are not explicitly injected into the large model, the generated risk descriptions and instructions are prone to inconsistencies with the data or omission of key risk factors.
[0086] Based on the above embodiments, step 140, which involves updating the next follow-up stage of the current follow-up stage in the serialized follow-up process to a new current follow-up stage, further includes: Step 1401: Input all the filled target slots and the risk determination rules corresponding to the diagnosis type into the large language model to obtain the risk assessment results output by the large language model, including risk level and risk factors.
[0087] Specifically, all the filled target slots and the risk determination rules corresponding to the diagnosis type are input into the big language model to obtain the risk assessment results output by the big language model, which include risk level and risk factors.
[0088] Risk assessment rules refer to a set of explicit and formalized clinical assessment logics associated with a specific diagnostic type. Risk assessment rules are typically derived from clinical guidelines and encoded as text with injectable cue words. For example, for asthma, a risk assessment rule might be: "If the total ACT score is below 20, the risk level is poor control; and the total ACT score is considered one of the risk factors."
[0089] Risk assessment results refer to the structured assessment conclusions output by the large language model based on the input data and risk determination rules. Risk levels are used to reflect the qualitative rating of the patient's current disease control status, such as well-controlled, poorly controlled, or using color-coded warning levels such as green, yellow, and red.
[0090] Risk factors reflect the specific objective basis for a particular risk level rating; that is, specific data items found from the filled slot data that meet the triggering conditions in the risk assessment rules. For example, an ACT total score of 18 and the use of emergency medication 3 times in the past week.
[0091] In this embodiment, a risk assessment task is triggered whenever the system successfully completes a follow-up phase and is ready to move to the next phase. The system combines all the filled slot data from the just-completed phase with risk determination rules that match the current diagnosis type, read from the follow-up configuration file or a dedicated rule base, into a prompt word and inputs it into the large language model. The large language model is strictly required to analyze the data according to the provided rules and output a risk assessment result that includes risk level and risk factors.
[0092] The method provided in this invention explicitly injects objective slot data and authoritative risk assessment rules into the large language model in the prompt words, thereby strictly constraining the evaluation process of the large language model within a preset logical framework that conforms to clinical guidelines. Consequently, the risk assessment results output by the large language model no longer rely on its internal uncontrollable knowledge, but become a reliable conclusion that is evidence-based, interpretable, and highly consistent with clinical logic. This solves the fundamental problem that general large models may produce illusions or deviate from clinical standards when conducting risk assessments, ensuring the accuracy, consistency, and clinical credibility of automated risk assessment.
[0093] Based on the above embodiments, the method is executed based on a preset state diagram control flow; The state diagram includes multiple nodes and the connection relationships between the nodes, and the connection relationships are used to represent the logical order of process execution; The nodes include single-turn dialogue processing nodes, phase completion check nodes, and phase switching nodes; The single-turn dialogue processing node is used to obtain the dialogue response for the current follow-up stage in the serialized follow-up process; the stage completion check node is used to verify the filling completion status of all target slots corresponding to the current follow-up stage and obtain the verification result; the stage switching node is used to update the next follow-up stage of the current follow-up stage in the serialized follow-up process to the new current follow-up stage when the verification result is that all target slots have been filled.
[0094] Specifically, the automatic follow-up dialogue method in this embodiment of the invention is executed based on a preset state diagram control flow.
[0095] The state diagram includes multiple nodes and the connections between them, which are used to represent the logical order of process execution.
[0096] Here, a state diagram refers to a visual formal model used to describe the execution flow of the method of the present invention. The state diagram abstracts the entire complex dialogue control logic into a series of discrete states (i.e., nodes) and rules for transitioning between these states (i.e., connections), making the flow control logic clear and easy to manage.
[0097] In this context, a node is a basic processing unit in a state diagram, representing a specific action or state in the process. A connection is a directed link between nodes, representing the execution order of the process. Connections are usually accompanied by triggering conditions, determining under what circumstances the process will transition from one node to another.
[0098] Here, nodes can include single-turn dialogue processing nodes, phase completion check nodes, and phase switching nodes. Single-turn dialogue processing nodes are used to obtain dialogue responses for the current follow-up phase in the serialized follow-up process; phase completion check nodes are used to determine the phase completion status of the current follow-up phase; and phase switching nodes are used to update the next follow-up phase in the serialized follow-up process to the new current follow-up phase when the phase completion status of the current follow-up phase is "completed".
[0099] In this embodiment, the execution of the entire automated follow-up dialogue process is driven by a state graph engine. For example, the process starts from a single-turn dialogue processing node. After the single-turn dialogue processing node is executed, different connection relationships are triggered based on its output (whether the dialogue response is empty): if the response is not empty, the process may point to an end node and wait for the user's next input; if the response is empty, the process enters the stage completion check node along another connection relationship. After the stage completion check node is executed, different connection relationships are triggered based on its verification result (whether all slots are filled), respectively leading to a stage switching node (if filled) or returning to the single-turn dialogue processing node (if not filled and needs to be retried).
[0100] The method provided in this invention uses state diagrams to model and implement the dialogue control flow, thereby transforming complex control logic containing branches and loops into a series of standardized nodes and clear connections, achieving separation of process definition and process execution engine. Consequently, the maintenance, modification, and expansion of the entire dialogue flow become extremely simple. Developers can adjust the follow-up logic through graphical configuration or modification of state diagrams without changing the underlying code, solving the problem that traditional hard-coded processes are difficult to adapt to changes in requirements, and significantly improving the architectural robustness, flexibility, and maintainability of the entire system.
[0101] In related technologies, existing solutions either output unstructured dialogue records or long text summaries, or only save form key-value pairs without any correlation with dialogue turns, stage transitions, key information extraction results, and risk levels. It is difficult to continuously maintain a slot data that evolves in stages within a single follow-up session, and simultaneously produce multi-level structured outputs such as key information summaries, risk levels, and follow-up summary documents. It also cannot support incremental analysis and streaming display triggered by stages or by session completion status.
[0102] Based on the above embodiments, the method further includes: Step 410: If the current follow-up stage is the target follow-up stage and all the target slots in the target follow-up stage are filled, integrate all the target slots that have been filled in all follow-up stages to obtain an integration result; the target follow-up stage is the last follow-up stage of the serialized follow-up process. Step 420: Input the integration result into the large language model to obtain the follow-up summary document output by the large language model; the follow-up summary document includes a follow-up overview, risk warning and personalized instructions.
[0103] Specifically, if the current follow-up stage is the target follow-up stage and all target slots in the target follow-up stage are filled, all the target slots that have been filled in all follow-up stages are integrated to obtain the integration result. The target follow-up stage is the last follow-up stage in the serialized follow-up process.
[0104] Here, the target follow-up phase refers to a specific phase that marks the end of the entire multi-phase follow-up process. The integrated results are used to reflect a complete dataset containing all filled slot data collected in all phases of this follow-up.
[0105] In this embodiment, when the system detects that the currently completed stage is the predefined last follow-up stage (i.e., the target follow-up stage), it triggers the final analysis and document generation task.
[0106] Before generating the final follow-up summary document, this invention can further trigger a suggested treatment plan analysis task. Specifically, the aforementioned integrated results (i.e., all collected slot data) are used as input, and the large language model generates several concise treatment suggestions and outputs them as a list, such as suggesting that the patient have their lung function checked or strengthening medication adherence education for the patient. To ensure the quality and relevance of the suggestions, the prompts used for this task are also carefully designed: the part before injection defines the role of the large language model, clarifies the data source, limits the dimensional range and maximum number of suggestions, and the output format; the part after injection contains the diagnosis type of this session and the JSON serialized text of all collected slot data, based on which the large language model will generate a highly targeted list of suggestions.
[0107] Based on this, after obtaining the integration results, the integration results can be input into the large language model to obtain the follow-up summary document output by the large language model. The follow-up summary document may include a follow-up overview, risk warning, and personalized instructions and guidance.
[0108] The follow-up summary document refers to a comprehensive final follow-up report generated by a large language model. The follow-up summary document is the final product intended for review by doctors or delivered directly to patients.
[0109] Here, "follow-up overview" refers to the section in the follow-up summary document that briefly summarizes the symptoms and medication information collected during this follow-up visit. "Medication behavior analysis" refers to a specific section in the follow-up summary document that summarizes the medication and adherence information from the slot data and clearly identifies any noteworthy issues, such as frequent use of emergency medications or missed use of long-term control medications.
[0110] The risk warning section is used to reflect the risk descriptions in the follow-up summary document. It references the risk assessment results obtained at each stage, translating the professional control levels, warning levels, and specific risk factors into easily understandable warnings for a clinical setting. Furthermore, this section can incorporate the medical knowledge built into the large language model to provide brief explanations of long-term risks such as airway remodeling and the risk of acute exacerbations.
[0111] Here, personalized instructions refer to the specific action recommendations provided in the follow-up summary document. It generates highly personalized recommendations based on the patient's specific behaviors (such as medication habits) and identified risk points during this follow-up visit. For example, it may recommend using the life anchor method or setting an alarm clock to improve medication adherence, or suggest that the patient record the frequency of emergency medication use and attend follow-up visits on time.
[0112] To ensure the quality and consistency of the follow-up summary document, the prompts used to generate it were also specially designed. The prompts at the beginning of the summary document strictly define the semantic boundaries and specific writing requirements for each paragraph (such as follow-up overview and risk warnings), and specifically mandate that the instructions and guidance section be based on the data collected and identified risk factors during this follow-up. The prompts at the end of the summary document contain a summary of the collected data and risk assessment results. In this way, the content of the instructions and guidance generated by the large language model is strictly constrained, avoiding vague and empty suggestions and ensuring close consistency between the final document content and the follow-up data and medical logic.
[0113] The final follow-up summary document can be output as a standalone document, or it can be returned through an interface along with the aforementioned key information, risk level, and other analysis results for doctors to review, modify, or archive directly.
[0114] Furthermore, this invention proposes to persist the follow-up processor state to external storage at the session level. The state includes diagnosis type, follow-up identifier, current stage, a list of all stages, data collected for each stage, dialogue history, key information extraction results, risk assessment results, and suggested solutions. In multiple requests within the same follow-up session, this state is loaded using the session identifier and follow-up identifier. New messages are parsed to extract the previous assistant's question and the user's answer, then injected into the state graph for execution. After execution, the updated state is written back to persistent storage, thus supporting breakpoint resumption and multi-round dialogues. In the response to a single request, the system determines whether the current stage or all stages are complete based on the execution result of the current graph. Based on this, asynchronous tasks such as key information extraction, risk assessment, and suggested solutions are created according to the conditions. Key information extraction tasks can be created in each round, risk assessment tasks are created only when a stage or all stages are completed, and suggested solutions tasks are created only when all stages are completed. Each task is executed concurrently. Upon completion, the results are written back to the corresponding fields in the follow-up processor and encapsulated into streaming data blocks according to predetermined block names, which are then pushed sequentially to the front end. Examples of blocks include response content, key information, risk level, and recommended treatment. If a task is not triggered in this round or fails to execute, the existing cached content or empty content of that block is returned, ensuring the stability of the front end's display structure. Through persistence and multi-block streaming output, this invention achieves continuity of follow-up sessions and real-time visibility of analysis results, meeting the requirements of clinical use for recoverable status and hierarchical display of results.
[0115] The method provided in this invention, after the follow-up process is fully completed, uses the integrated result of all validated structured slot data as the sole data source to drive a large language model to generate a follow-up summary document. This ensures that the content of the final generated report is entirely derived from and faithful to the objective data collected and verified during the dialogue. Furthermore, this mechanism fundamentally eliminates the possibility of inconsistencies between the report content and the actual data or the possibility of the model fabricating information. It solves the problems of low efficiency in manually writing summaries or unreliable reports due to the model's free interpretation in the prior art. It realizes the automated generation of high-quality, highly credible, complete, and clearly structured clinically usable documents, significantly improving the overall efficiency and output quality of follow-up work.
[0116] Based on any of the above embodiments Figure 4 This is the second flowchart of the automatic follow-up dialogue method provided by the present invention, as shown below. Figure 4As shown, the system first receives a follow-up request. Then, it initializes by loading the follow-up status, which includes the contextual information needed for the current session, specifically the patient's diagnosis, stage, data, and history. Next, the process enters the core single-round processing stage, which is responsible for dialogue generation and data collection. This involves calling the large language model to interact and attempt to fill the target slots. After the single-round processing, the system judges the response from the large language model: if the judgment result is negative (response is not empty), it means the current follow-up stage is not yet complete and the model has generated a new question. At this point, the system performs key information extraction, extracting information about symptoms, signs, and medication from the user's answer, and pushes and persists the updated status through the single-round status output module. Then, it enters a state of waiting for the user's answer. Upon receiving a new answer, it returns to the single-round processing stage, forming a closed loop of dialogue interaction. If the judgment result is positive (response is empty), it indicates that the large language model considers the current stage complete. At this point, the process enters the backend verification stage, namely the stage check node, which performs (all slots not empty check). The verification result is evaluated as follows: If the result is negative (stage incomplete), it indicates an error in the model's judgment, with unfilled slots. The process then enters the retry or forced advancement module, which is responsible for (executing the strategy or forcibly filling missing slots). It then returns to the single-round processing stage to attempt to complete the information or confirm the forced filling result. If the stage check result is positive (stage completed), it means the current stage information is complete, and the process enters the next stage judgment node to determine (whether) the next follow-up stage exists. If the result is positive (exists), the process enters the stage transition and first question module to (switch and generate the first question), and then continues the dialogue to the next stage after waiting for user responses. If the next stage judgment result is negative (does not exist), it indicates that all follow-up stages are completed, and the process enters the final follow-up end state, specifically executing the (mark end and generate summary) tasks. After the summary is generated, the system outputs all results, including a persistent summary, risks, and recommendations, and finally enters the complete follow-up termination state.
[0117] Based on any of the above embodiments, this invention proposes a complete technical path for automatic follow-up dialogue and intelligent analysis of chronic diseases and generation of follow-up summaries based on a large model. Its core idea is to combine multi-stage slot collection driven by diagnosis type configuration, stage completion judgment and flow gating driven by state graph, key information extraction and risk level judgment based on a large model, and automatic generation of follow-up summary and follow-up summary documents to form an automated pipeline from dialogue collection to structured data and clinically usable documents. The connection between modules is as follows: After a request is received, the session layer loads or initializes the follow-up processor state based on the session identifier and follow-up identifier, and injects the parsed previous assistant question and user answer into the state graph entry point; the state graph executes steps such as processing a single round of dialogue, checking the completion of the phase, switching phases, automatically initializing the next phase, or data analysis and aggregation according to nodes and conditional edges, and the state update generated in each step is written back to the follow-up processor; after the graph execution is completed, analysis tasks such as key information extraction, risk assessment, and suggested handling are triggered asynchronously according to conditions based on whether the phase of this round is completed or all phases are completed, and the results of each task are written back to the processor state and pushed to the front end in a streaming manner according to the predetermined block name; the processor state of the same session is persisted to external storage when the request ends, for loading in the next request, thereby realizing the dynamic evolution of the process and breakpoint resumption.
[0118] Specifically, the solution disclosed in this embodiment may include the following: First, a multi-stage slot definition and follow-up dialogue generation method based on diagnostic type configuration. This invention proposes loading the corresponding follow-up configuration file according to the diagnostic type. The configuration file declares several stages to be executed sequentially. Each stage includes a stage name, stage description, and several slots. Each slot includes a key name, collection intent, question prompt, and optional option mapping. The system maintains the follow-up processor state at the session dimension, including the current stage, a list of all stages, the key-value structure of the data collected in each stage, and a limited number of dialogue history rounds. In each round of dialogue, the system inputs the current stage configuration, the data collected in the current stage, the dialogue history, the assistant's question from the previous round, and the user's answer into the large model. The large model is required to update the updatable slots based on understanding the user's answer and generate the next reply to the user or output an empty reply when all slots in the current stage are filled. The output of the large model adopts a predetermined structured format, including a slot update dictionary and reply text. After parsing, the system only updates the slots corresponding to the current stage and does not write across stages, thus ensuring clear boundaries of data in each stage. In terms of prompt design, the system-side fixed content before injection includes role settings and core responsibility descriptions, strict conventions for output format, and a written description of decision-making logic and precautions. The role and responsibility section clearly defines the large model as the follow-up doctor, responsible for understanding user responses, updating slots, and generating the next response. The output format section stipulates that a JSON structure containing a slot update dictionary and response text must be output, and that the response field must be empty when a slot is full. The decision-making logic section specifies that questions should only be asked for currently empty slots, prohibits asking follow-up questions for filled slots, allows follow-up questions and nulling rules for invalid user responses, and requires a self-check that the response must be empty when a slot is full. The user-side dynamic content after injection includes follow-up status, current stage name, overview of all stages, complete configuration JSON for the current stage, key-value JSON of data collected for the current stage, dialogue history text, and the original text of the assistant's questions and user responses from the previous round. Before invoking the large model, the system concatenates the aforementioned fixed system prompts and dynamic user prompts into a complete request. This allows the large model to determine which slots to update and the next question to ask in each round based on the latest stage configuration and collected data, enabling the questioning strategy to dynamically evolve with the conversation state. By unifying the semantics of stages and slots, the logic of follow-up questions and nullification, and the rule of stopping questioning when a slot is full, this invention realizes a pipeline for collecting data from user natural language responses to multi-stage structured slot data, providing a stable and interpretable input source for subsequent key information extraction and risk assessment. For different chronic diseases, only the configuration files and corresponding analysis modules need to be added or switched to reuse the same dialogue and flow framework.
[0119] Second, a state diagram-based stage completion determination, flow, and retry gating strategy. This invention proposes using state diagrams to orchestrate the follow-up process at the session dimension. Nodes include processing single-turn dialogues, checking if the current stage is complete, switching stages, automatically initializing the first question for the next stage, and optional data analysis aggregation nodes. The dynamic evolution of the process is achieved through conditional routing and retry gating, with the following judgment criteria and strategy content. After the single-turn dialogue processing node is completed, the routing judgment is based on whether the response returned by the large model is empty. If the response is not empty, it means that there are still unfilled slots in the current stage and the large model has generated the next question; the routing points to the end, the current stage state update is written back and returned to the front end; if the response is empty, it means that the large model believes that all slots in the current stage are filled or that questioning should stop; the routing points to the stage completion check node, entering the stage completion determination and subsequent flow. In the check phase completion node, the method for determining whether a phase is complete is as follows: based on all slot key names declared in the configuration file for the current phase, the corresponding values of this phase in the collected data are read item by item. If any slot value is empty or unassigned, the phase is considered incomplete; if all slot values are not empty, the phase is considered complete. The combination of the determination result and the premise of an empty response triggers different strategies: if the phase is complete, the route points to the phase switching node; if the phase is not complete and the large model has returned an empty response, it is considered a model misjudgment, and the system increments the retry count. If the preset retry limit has not been reached, the route points back to the single-turn dialogue processing node, and the large model is called again to generate questions without clearing the dialogue history; if the limit has been reached, the forced blank filling strategy is executed, that is, the slots that are still empty in the current phase are assigned values one by one to the agreed string representing no information, the phase is considered complete, and the route is routed to the phase switching node, thereby avoiding an infinite loop caused by continuous model misjudgment. In the phase switching node, the system calculates the next phase based on the complete phase list and the current phase name. If a next phase exists, the current phase of the session is updated to the next phase, the dialogue history is cleared or reset, the response is set to null, and the system is routed to the automatic next phase initialization node, where the large model generates the first question for this phase without user response input. If no next phase exists, the session status is marked as follow-up ended, and the system can optionally route to the data analysis aggregation node. The automatic next phase initialization node calls the dialogue generation method again, with both the user response and the previous round of questions passed as empty strings. The large model generates the first question only based on the current phase configuration and empty slots. The routing after this node is completed also depends on whether the response is empty, determining whether to enter the check phase completion node or end the process. The above conditional edges and retry gating together constitute a dynamic evolution strategy system for the process, ensuring that the phase boundaries are consistent with medical logic and that the system is not stuck due to a single model misjudgment.
[0120] Third, a method for extracting key information and assessing risks based on collected data and a large-scale model. This invention proposes to trigger two types of analysis tasks based on the session status during follow-up conversations. The first type is key information extraction, which can be triggered after each round of dialogue slot updates. The input is all currently collected slot data and existing key information extraction results. The large-scale model performs incremental updates and outputs structured results, including fields such as symptoms and signs, medication behavior, and triggers. Each field is a concise natural language summary and does not directly expose slot key names or original scores, making it easy for doctors to quickly browse. The second category is risk assessment, triggered upon completion of the current phase or all phases. Input consists of all currently collected slot data and existing risk assessment results. The large model incrementally updates the data according to the rules corresponding to the diagnosis type and outputs structured results, including fields such as control level, warning level, and risk factors. For diseases with scales, such as asthma, the configuration can specify the ACT score calculation method and the order and conditions for red, yellow, and green warnings. Under the constraints of the prompt words, the large model first determines whether the red condition is met, then the yellow condition, and then the green condition, summarizing all met conditions into a risk factor description. Both types of analysis tasks use a combination of fixed rules before injection and dynamic data after injection for the prompt words. The pre-injection content for key information extraction includes the analysis role, incremental update principles, output JSON field definitions, and constraints prohibiting the output of slot key names and original scores. The post-injection content includes the diagnosis type, the JSON serialization of all currently collected slot data, and the JSON serialization of existing key information extraction results, for the large model to compare and only update fields with new information. The pre-injection content for risk assessment includes roles and incremental principles, as well as the scale scoring rules corresponding to the diagnosis type, the judgment order of red, yellow, and green alerts and the list of conditions for each level, and the rule that all risk factors must be listed. The post-injection content includes the diagnosis type, the JSON of all currently collected data, and the JSON of existing risk assessment results. Based on this, the large model first calculates computable indicators, then determines the alert level in order and summarizes the risk factors. The system dynamically selects the analysis module based on the diagnosis type. If a dedicated analysis module exists for that diagnosis, its prompt word construction function is used; otherwise, it falls back to the general analysis module, ensuring that the output is consistent with clinical semantics. The analysis results are written to the follow-up processor status and returned to the front end in blocks via streaming or non-streaming interfaces, supporting incremental display of key information and risk levels during the dialogue.
[0121] Fourth, a method for generating recommended treatment plans and follow-up summary documents based on a large-scale model. This invention proposes triggering a recommended treatment plan analysis task after all follow-up phases are completed. The input is all collected slot data, and the large-scale model generates several concise treatment suggestions and outputs a list, such as reviewing lung function and strengthening medication adherence education. The prompts for the recommended treatments are injected into the first part specifying the roles, data source descriptions, the dimensional range and maximum number of suggestions, and the output format; the second part is the diagnosis type and JSON of all collected slot data, based on which the large-scale model generates a targeted suggestion list. On this basis, the system can further call the large-scale model to generate follow-up summary documents, the document structure of which includes a follow-up overview, medication behavior analysis, risk warnings, and instructions. The follow-up overview provides a brief summary of the symptoms and medication information collected during this follow-up visit. The medication behavior analysis summarizes the medication and adherence information from the slot data, identifying issues such as frequent use of emergency medications or missed use of long-term control medications. The risk warning section cites the aforementioned risk assessment results, transforming control levels, warning grades, and risk factors into clinically readable alerts, and can briefly explain airway remodeling and acute exacerbation risks using medical knowledge. The instruction guidance section generates personalized suggestions based on the patient's specific behaviors and risk points, such as lifestyle anchors, alarm reminders, records of emergency medication usage frequency, and follow-up appointment recommendations. The follow-up summary's pre-injection section defines the semantic boundaries and writing requirements of each paragraph, and mandates that instructions be based on the collected data and risk factors. The post-injection section is a summary of the collected data and risk assessment results; the large model uses this to constrain the content when generating instructions, avoiding generalities and ensuring consistency between the document and the follow-up data and medical logic. Follow-up summary documents can be output as standalone documents or returned via an interface along with key information and risk levels for doctors to review or archive.
[0122] Fifth, a mechanism for persistent follow-up session state, caching analysis results, and multi-block streaming output. This invention proposes to persist the follow-up processor state to external storage at the session level. The state includes diagnosis type, follow-up identifier, current stage, list of all stages, data collected for each stage, dialogue history, key information extraction results, risk assessment results, and suggested handling solutions. In multiple requests within the same follow-up session, this state is loaded using the session identifier and follow-up identifier. After parsing the previous assistant's question and user's answer from a new message, it is injected into the state graph for execution. The updated state after execution is written back to persistent storage, thus supporting breakpoint resumption and multi-round dialogues. In the response to a single request, the system determines whether the current stage or all stages are completed based on the execution results of the current graph. Based on this, asynchronous tasks such as key information extraction, risk assessment, and suggested handling are created according to the conditions. Key information extraction tasks can be created in each round, risk assessment tasks are created only when a stage or all stages are completed, and suggested handling tasks are created only when all stages are completed. Each task is executed concurrently. Upon completion, the results are written back to the corresponding fields in the follow-up processor and encapsulated into streaming data blocks according to predetermined block names, which are then pushed sequentially to the front end. Examples of blocks include response content, key information, risk level, and recommended treatment. If a task is not triggered in this round or fails to execute, the existing cached content or empty content of that block is returned, ensuring the stability of the front end's display structure. Through persistence and multi-block streaming output, this invention achieves continuity of follow-up sessions and real-time visibility of analysis results, meeting the requirements of clinical use for recoverable status and hierarchical display of results.
[0123] The method provided in this invention constructs a complete, end-to-end automated follow-up solution, achieving significant improvements in four dimensions: efficiency, accuracy, medical logic, and structure. This solution enhances efficiency through configuration-driven dialogue generation; ensures accuracy through rule-injection-based prompt word engineering; guarantees medical logic through state graph-driven stage transition gating; and achieves a high degree of structure through state persistence and asynchronous hierarchical output. This complete technical path systematically overcomes many shortcomings of current chronic disease follow-up solutions, providing a solid technical foundation for achieving scalable, highly reliable, and intelligent automated follow-up.
[0124] The automatic follow-up dialogue device provided by the present invention is described below. The automatic follow-up dialogue device described below can be referred to in correspondence with the automatic follow-up dialogue method described above.
[0125] Based on any of the above embodiments, the present invention provides an automatic follow-up dialogue device. Figure 5 This is a schematic diagram of the automatic follow-up dialogue device provided by the present invention, as shown below. Figure 5 As shown, the device includes: The determination module 510 is used to determine the serialized follow-up process; the serialized follow-up process includes multiple follow-up stages, each follow-up stage is associated with a set of information collection tasks, the information collection tasks are used to collect dialogue responses in the follow-up stage, and the dialogue responses are used to fill the target slots associated with the follow-up stage. The acquisition module 520 is used to acquire the dialogue response to the current follow-up stage in the serialized follow-up process, and determine the filling status of all target slots associated with the current follow-up stage based on the dialogue response. The status determination module 530 is used to determine the stage completion status of the current follow-up stage based on the filling status of all the target slots; the stage completion status is used to indicate whether the current follow-up stage is completed, and the completed status of the current follow-up stage means that all the target slots corresponding to the information collection task associated with the current follow-up stage are filled. The update module 540 is used to update the next follow-up stage of the current follow-up stage in the serialized follow-up process to a new current follow-up stage when the stage completion status of the current follow-up stage is the completed state, until all follow-up stages in the serialized follow-up process have reached the completed state.
[0126] The apparatus provided in this invention determines a serialized follow-up process, obtains dialogue responses for the current follow-up stage in the serialized follow-up process, determines the filling status of all target slots associated with the current follow-up stage based on the dialogue responses, determines the stage completion status of the current follow-up stage based on the filling status of all target slots, and updates the next follow-up stage in the serialized follow-up process to the new current follow-up stage when the stage completion status of the current follow-up stage is "completed," until all follow-up stages in the serialized follow-up process have reached the "completed" status. This allows for accurate and objective determination of the true completeness of information collection in the current follow-up stage, ensuring that the process only switches to the next follow-up stage after all target slots associated with the current follow-up stage have been confirmed to be filled. This solves the problem in existing technologies where the follow-up process switches prematurely before complete information collection due to the lack of a reliable stage completion determination mechanism, thus ensuring the medical logic rigor and the integrity of the follow-up dialogue data in the entire automated follow-up process.
[0127] Based on any of the above embodiments, a retry module is further included, wherein the retry module is specifically used for: If the current follow-up phase is incomplete, determine the current number of retries for the unfilled target slots corresponding to the information collection task associated with the current follow-up phase. If the current number of retries is less than a preset retry threshold, return to the steps of obtaining the dialogue response for the current follow-up phase in the serialized follow-up process, determining the filling status of all target slots associated with the current follow-up phase based on the dialogue response, and determining the phase completion status of the current follow-up phase based on the filling status of all target slots, until the phase completion status of the current follow-up phase is completed. If the current number of retries is greater than or equal to the preset retry threshold, the unfilled target slot is forcibly assigned a value until the current follow-up phase is completed.
[0128] Based on any of the above embodiments, the acquisition module 520 is specifically used for: Based on the diagnostic type associated with the automatic follow-up dialogue, a follow-up configuration file is loaded; wherein, the follow-up configuration file includes multiple follow-up stages executed sequentially, and each follow-up stage includes a stage name, a stage description, and a slot definition for at least one of the target slots; the slot definition includes at least one of key name, collection intent, question prompt, and option mapping; Based on the user's answers to the previous round of questions in the current follow-up phase, determine the current interaction data; The collection intent, question prompts, and option mappings corresponding to the current follow-up stage in the follow-up configuration file, along with the current interaction data, are combined into prompt words; The prompt words are input into the large language model to obtain the structured output of the large language model; The dialogue response is obtained by parsing the structured output.
[0129] Based on any of the above embodiments, the structured output includes slot update data; It also includes a filling module, which is specifically used for: Based on the key name corresponding to the target slot in the slot update data, the slot value in the slot update data is filled into the target slot.
[0130] Based on any of the above embodiments, an extraction module is further included, wherein the extraction module is specifically used for: Extract key historical information from the dialogue responses during the current follow-up phase; Input the data of all the filled target slots and the historical key information into the large language model to obtain the key information output by the large language model; The key information includes at least one of the following: symptoms and signs, medication behavior, and behavioral triggers.
[0131] Based on any of the above embodiments, an evaluation module is further included, wherein the evaluation module is specifically used for: All the filled target slots and the risk determination rules corresponding to the diagnosis type are input into the large language model to obtain the risk assessment results output by the large language model, including risk level and risk factors.
[0132] Based on any of the above embodiments, an execution module is further included, the execution module including a state diagram; The state diagram includes multiple nodes and the connection relationships between the nodes, and the connection relationships are used to represent the logical order of process execution; The nodes include single-turn dialogue processing nodes, phase completion check nodes, and phase switching nodes; The single-turn dialogue processing node is used to obtain the dialogue response to the current follow-up stage in the serialized follow-up process; the stage completion check node is used to determine the stage completion status of the current follow-up stage; the stage switching node is used to update the next follow-up stage of the current follow-up stage in the serialized follow-up process to the new current follow-up stage when the stage completion status of the current follow-up stage is the completed status.
[0133] Based on any of the above embodiments, an integration module is further included, the integration module being specifically used for: If the current follow-up stage is the target follow-up stage and all the target slots in the target follow-up stage are filled, all the target slots that have been filled in all follow-up stages are integrated to obtain an integration result; the target follow-up stage is the last follow-up stage of the serialized follow-up process. The integration results are input into the large language model to obtain the follow-up summary document output by the large language model; the follow-up summary document includes a follow-up overview, risk warning, and personalized instructions and guidance.
[0134] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6As shown, the electronic device may include: a processor 610, a communications interface 620, a memory 630, and a communications bus 640, wherein the processor 610, the communications interface 620, and the memory 630 communicate with each other through the communications bus 640. The processor 610 can call logic instructions in the memory 630 to execute an automatic follow-up dialogue method, the method comprising: determining a serialized follow-up process; the serialized follow-up process comprising multiple follow-up stages, each follow-up stage being associated with a set of information collection tasks, the information collection tasks being used to collect dialogue responses in the follow-up stage, the dialogue responses being used to fill target slots associated with the follow-up stage; obtaining dialogue responses for the current follow-up stage in the serialized follow-up process, and based on the dialogue responses, determining the filling status of all target slots associated with the current follow-up stage; based on the filling status of all target slots, determining the stage completion status of the current follow-up stage; the stage completion status being used to indicate whether the current follow-up stage is completed, the completed status of the current follow-up stage referring to all target slots corresponding to the information collection tasks associated with the current follow-up stage being filled; if the stage completion status of the current follow-up stage is the completed status, updating the next follow-up stage of the current follow-up stage in the serialized follow-up process to a new current follow-up stage, until all follow-up stages in the serialized follow-up process have reached the completed status.
[0135] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0136] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the automatic follow-up dialogue method provided by the above methods. The method includes: determining a serialized follow-up process; the serialized follow-up process includes multiple follow-up stages, each follow-up stage being associated with a set of information collection tasks, the information collection tasks being used to collect dialogue responses in the follow-up stage, the dialogue responses being used to fill target slots associated with the follow-up stage; obtaining the dialogue response for the current follow-up stage in the serialized follow-up process, based on the dialogue... The system responds by determining the filling status of all target slots associated with the current follow-up phase; based on the filling status of all target slots, it determines the phase completion status of the current follow-up phase; the phase completion status indicates whether the current follow-up phase is complete, and the completed status of the current follow-up phase means that all target slots corresponding to the information collection tasks associated with the current follow-up phase are filled; if the phase completion status of the current follow-up phase is the completed status, the next follow-up phase in the serialized follow-up process is updated to the new current follow-up phase, until all follow-up phases in the serialized follow-up process reach the completed status.
[0137] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements an automatic follow-up dialogue method provided by the methods described above. The method includes: determining a serialized follow-up process; the serialized follow-up process includes multiple follow-up stages, each follow-up stage being associated with a set of information collection tasks, the information collection tasks being used to collect dialogue responses in the follow-up stage, the dialogue responses being used to fill target slots associated with the follow-up stage; obtaining a dialogue response for the current follow-up stage in the serialized follow-up process; and based on the dialogue response, determining the current follow-up stage's relationship to... The filling status of all target slots in the series is determined; based on the filling status of all target slots, the completion status of the current follow-up stage is determined; the completion status is used to indicate whether the current follow-up stage is completed, and the completed status of the current follow-up stage means that all target slots corresponding to the information collection tasks associated with the current follow-up stage are filled; if the completion status of the current follow-up stage is the completed status, the next follow-up stage in the serialized follow-up process is updated to the new current follow-up stage, until all follow-up stages in the serialized follow-up process reach the completed status.
[0138] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0139] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0140] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An automatic follow-up dialogue method, characterized in that, include: Determine the serialized follow-up process; The serialized follow-up process includes multiple follow-up stages, each of which is associated with a set of information collection tasks. The information collection tasks are used to collect dialogue responses in the follow-up stage, and the dialogue responses are used to fill the target slots associated with the follow-up stage. Obtain the dialogue response for the current follow-up stage in the serialized follow-up process, and determine the filling status of all target slots associated with the current follow-up stage based on the dialogue response; Based on the filling status of all the target slots, determine the completion status of the current follow-up phase; The stage completion status is used to indicate whether the current follow-up stage is completed. The completed status of the current follow-up stage means that all the target slots corresponding to the information collection tasks associated with the current follow-up stage have been filled. If the current follow-up stage is in the completed state, the next follow-up stage in the serialized follow-up process is updated to the new current follow-up stage until all follow-up stages in the serialized follow-up process have reached the completed state.
2. The automatic follow-up dialogue method according to claim 1, characterized in that, The method further includes: If the current follow-up phase is incomplete, determine the current number of retries for the unfilled target slots corresponding to the information collection task associated with the current follow-up phase. If the current number of retries is less than a preset retry threshold, return to the steps of obtaining the dialogue response for the current follow-up phase in the serialized follow-up process, determining the filling status of all target slots associated with the current follow-up phase based on the dialogue response, and determining the phase completion status of the current follow-up phase based on the filling status of all target slots, until the phase completion status of the current follow-up phase is completed. If the current number of retries is greater than or equal to the preset retry threshold, the unfilled target slot is forcibly assigned a value until the current follow-up phase is completed.
3. The automatic follow-up dialogue method according to claim 1, characterized in that, The step of obtaining a dialogue response for the current follow-up stage in the serialized follow-up process includes: Based on the diagnostic type associated with the automatic follow-up dialogue, a follow-up configuration file is loaded; wherein, the follow-up configuration file includes multiple follow-up stages executed sequentially, and each follow-up stage includes a stage name, a stage description, and a slot definition for at least one of the target slots; the slot definition includes at least one of key name, collection intent, question prompt, and option mapping; Based on the user's answers to the previous round of questions in the current follow-up phase, determine the current interaction data; The collection intent, question prompts, and option mappings corresponding to the current follow-up stage in the follow-up configuration file, along with the current interaction data, are combined into prompt words; The prompt words are input into the large language model to obtain the structured output of the large language model; The dialogue response is obtained by parsing the structured output.
4. The automatic follow-up dialogue method according to claim 3, characterized in that, The structured output includes slot update data; The step of inputting the prompt word into the large language model to obtain the structured output of the large language model further includes: Based on the key name corresponding to the target slot in the slot update data, the slot value in the slot update data is filled into the target slot.
5. The automatic follow-up dialogue method according to claim 4, characterized in that, The step of filling the target slot with the slot value from the slot update data based on the key name corresponding to the target slot in the slot update data, and then further includes: Extract key historical information from the dialogue responses during the current follow-up phase; Input the data of all the filled target slots and the historical key information into the large language model to obtain the key information output by the large language model; The key information includes at least one of the following: symptoms and signs, medication behavior, and behavioral triggers.
6. The automatic follow-up dialogue method according to claim 3, characterized in that, The step of updating the next follow-up stage of the current follow-up stage in the serialized follow-up process to the new current follow-up stage further includes: All the filled target slots and the risk determination rules corresponding to the diagnosis type are input into the large language model to obtain the risk assessment results output by the large language model, including risk level and risk factors.
7. The automatic follow-up dialogue method according to any one of claims 1 to 6, characterized in that, The method is executed based on a preset state diagram control flow; The state diagram includes multiple nodes and the connection relationships between the nodes, and the connection relationships are used to represent the logical order of process execution; The nodes include single-turn dialogue processing nodes, phase completion check nodes, and phase switching nodes; The single-turn dialogue processing node is used to obtain the dialogue response for the current follow-up stage in the serialized follow-up process; the stage completion check node is used to determine the stage completion status of the current follow-up stage. The stage switching node is used to update the next follow-up stage in the serialized follow-up process to a new current follow-up stage when the stage completion status of the current follow-up stage is the completed state.
8. The automatic follow-up dialogue method according to any one of claims 1 to 6, characterized in that, The method further includes: If the current follow-up stage is the target follow-up stage and all the target slots in the target follow-up stage are filled, all the target slots that have been filled in all follow-up stages are integrated to obtain an integration result; the target follow-up stage is the last follow-up stage of the serialized follow-up process. The integration results are input into the large language model to obtain the follow-up summary document output by the large language model; the follow-up summary document includes a follow-up overview, risk warning, and personalized instructions and guidance.
9. An automatic follow-up dialogue device, characterized in that, include: The determination module is used to determine the serialization follow-up process; The serialized follow-up process includes multiple follow-up stages, each of which is associated with a set of information collection tasks. The information collection tasks are used to collect dialogue responses in the follow-up stage, and the dialogue responses are used to fill the target slots associated with the follow-up stage. The acquisition module is used to acquire the dialogue response to the current follow-up stage in the serialized follow-up process, and based on the dialogue response, determine the filling status of all target slots associated with the current follow-up stage; The status determination module is used to determine the stage completion status of the current follow-up stage based on the filling status of all the target slots. The stage completion status is used to indicate whether the current follow-up stage is completed. The completed status of the current follow-up stage means that all the target slots corresponding to the information collection tasks associated with the current follow-up stage have been filled. The update module is used to update the next follow-up stage in the serialized follow-up process to a new current follow-up stage when the stage completion status of the current follow-up stage is the completed state, until all follow-up stages in the serialized follow-up process have reached the completed state.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the automatic follow-up dialogue method as described in any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the automatic follow-up dialogue method as described in any one of claims 1 to 8.