A health memory intelligent management method based on cross-session user dimension

CN123017346APending Publication Date: 2026-10-30BEIJING XIAOYI YANNIAN INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611201120.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-10
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0003]第一,现有AI对话助手通常以会话(session)为维度管理上下文信息,当用户开启新对话或切换会话时,之前的健康信息(如用药记录、体征数据、症状描述等)即丢失,无法实现跨会话的信息累积和回顾

Benefits of technology

[0012]1)跨会话健康信息累积:通过以用户标识而非会话标识为维度存储健康事件,使用户在不同会话中产生的健康信息实现跨会话累积,无论开启多少次新对话,历史健康记忆始终可用。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123017346A_ABST
    Figure CN123017346A_ABST
Patent Text Reader

Abstract

The application discloses a health memory intelligent management method and system based on cross-session user dimensions and belongs to the technical field of artificial intelligence dialogue systems. The method carries out deterministic substring matching on user dialogue messages through a keyword library of eight specific categories in the care field, extracts structured information such as event types, time, drug names and sign values by using a regular expression when a hit occurs, and actively stores the structured information into a health memory library with user identification as a dimension to realize cross-session accumulation. In subsequent dialogue, the most recent event is formatted and injected into system prompt words to make an AI reply refer to historical health information. The application is different from file-level storage and semantic vector retrieval, and realizes automatic extraction of dialogue-level health events and cross-session memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence dialogue system technology, specifically to a health memory intelligent management method and system based on cross-conversation user dimensions, applicable to application scenarios such as intelligent care, elderly care assessment, and health management. Background Technology

[0002] With the development of artificial intelligence technology, AI conversational assistants are being used more and more widely in fields such as elderly care and health management. However, existing AI conversational systems have the following technical problems in health information management:

[0003] First, existing AI conversational assistants typically manage contextual information at the session level. When a user starts a new conversation or switches sessions, previous health information (such as medication records, vital sign data, symptom descriptions, etc.) is lost, making it impossible to accumulate and review information across sessions. Users repeatedly describe the same health information in multiple conversations, resulting in a poor experience and a high risk of missing key information.

[0004] Second, some existing health-related AI assistants use a record-level memory solution, meaning users need to actively upload medical records, physical examination reports, or synchronize data through smart devices to build a health record. This solution has the following shortcomings: users need to actively upload data, which raises the barrier to entry; the data source depends on external devices or documents and cannot be automatically obtained from daily conversations; the record data is a structured document rather than a conversational event, and cannot reflect the real-time changes in health status described by the user during conversations.

[0005] Third, some existing AI dialogue systems use a general dialogue memory scheme, which uses semantic vector similarity calculation to retrieve relevant segments from historical dialogues. This scheme has the following shortcomings: semantic vector retrieval is based on probabilistic matching of semantic similarity, which may retrieve irrelevant dialogue segments; it lacks classification management of health events, with information such as medication, vital signs, and symptoms stored in a mixed manner, making it impossible to retrieve by category; and the extracted information is dialogue segments rather than structured events, lacking structured fields such as time, drug name, and vital sign values.

[0006] Fourth, even if some systems can store health information, they lack a mechanism to inject historical health events as context into the current conversation, making it impossible for AI responses to refer to the user's historical health data, thus reducing the relevance and accuracy of the responses.

[0007] Therefore, there is an urgent need for a technical solution that can automatically extract structured health events from users' natural language dialogues, accumulate and store them across sessions at the user level, and automatically inject them as context in subsequent dialogues. Moreover, this solution should be based on care domain-specific classifications and rule matching, rather than general semantic vector retrieval. Summary of the Invention

[0008] To address the shortcomings of existing technologies, this invention provides a health memory intelligent management method and system based on cross-session user dimensions. It realizes a technical solution that automatically extracts structured health events from users' natural language messages through a care domain-specific keyword library and rule matching, accumulates and stores them across sessions with user identifiers as the dimension, and automatically injects them as context in subsequent dialogues.

[0009] The core difference between this invention and existing technologies lies in the following: health event extraction is based on keyword databases and regular expression rule matching for eight specific categories in the care field, rather than general semantic vector similarity retrieval; health event storage consists of structured events (including time, drug name, and vital sign values) actively extracted from dialogues, rather than relying on user-uploaded archives or device-synchronized data; and health event classification is based on the actual needs of care business scenarios (eight categories including medication, vital signs, excretion, and services), rather than general semantic clustering.

[0010] The technical solution of this invention to solve the above-mentioned technical problems is as follows: A health memory intelligent management method based on cross-session user dimensions, comprising the following steps: S1: receiving natural language messages input by users in dialogue interaction; S2: performing deterministic substring matching between the natural language messages and a health event keyword library in the care domain, the keyword library including eight care domain-specific categories; S3: when a match is found, extracting structured health event information through multi-modal regular expressions; S4: storing the structured health event information in a health memory library with user identifiers as the dimension, independent of session identifiers; S5: in subsequent dialogue processing, retrieving the user's most recent events from the health memory library, formatting them into context text, and injecting system prompt words; S6: based on the system prompt words injected with health memory context, calling a language model to generate a response.

[0011] The beneficial effects of this invention are as follows:

[0012] 1) Cross-session health information accumulation: By storing health events using user identifiers rather than session identifiers, health information generated by users in different sessions can be accumulated across sessions. No matter how many new conversations are started, historical health memories are always available.

[0013] 2) Automatic structured data extraction: Using a keyword library of eight care domain-specific categories and multi-pattern regular expressions, structured information such as event type, time, drug name, and vital sign values ​​are automatically extracted from users' natural language messages without requiring users to manually upload structured data or connect to external devices.

[0014] 3) Care-specific classification: Health event classification is based on the actual needs of care business scenarios (eight categories: medication, symptoms, signs, diet, sleep, exercise, excretion, and services), rather than general semantic clustering, so that event classification directly corresponds to care services and management scenarios.

[0015] 4) Contextual Intelligent Injection: By formatting historical health events into contextual text and injecting system prompts, AI responses can refer to the user's historical medication, signs, symptoms, and other information, improving the relevance and accuracy of the responses.

[0016] 5) Security Isolation: By temporarily replacing and restoring system prompts, we ensure that health memory data does not contaminate the original session storage, thus guaranteeing data isolation. Attached Figure Description

[0017] Figure 1 A flowchart of a health memory intelligent management method based on cross-session user dimensions provided in an embodiment of the present invention;

[0018] Figure 2 This is an architecture diagram of a health memory intelligent management system based on cross-session user dimensions, provided in an embodiment of the present invention. Detailed Implementation

[0019] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0020] like Figure 1 As shown, this embodiment provides a health memory intelligent management method based on cross-session user dimensions, including the following steps:

[0021] Step S1: Receive natural language messages input by the user during the dialogue interaction. The user inputs messages through the dialogue interface of the terminal device. The message format is natural language text, such as "I took my blood pressure medication at 10 am" or "Blood pressure 150 / 90, feeling a little dizzy". The system receives the message through the HTTP interface and simultaneously obtains the user identifier and session identifier.

[0022] Step S2: Perform deterministic substring matching between the natural language message and the health event keyword library in the care field. The keyword library includes eight specific categories in the care field: the medication category contains keywords such as "taking medicine", "taking medication", "antihypertensive drug", and "insulin"; the symptom category contains keywords such as "dizziness", "chest tightness", and "insomnia"; the vital sign category contains keywords such as "blood pressure", "blood glucose", and "body temperature"; the diet category contains keywords such as "eating", "breastfeeding", and "complementary food"; the sleep category contains keywords such as "slept", "got up", and "nighttime"; the exercise category contains keywords such as "walking", "exercising", and "rehabilitation training"; the excretion category contains keywords such as "stool", "urine", and "defecation"; the service category contains keywords such as "home visit", "appointment", "assisted bathing", and "accompanying medical consultation". The matching adopts a word-by-word traversal substring matching method instead of semantic vector similarity calculation, and the same message can hit multiple categories. The eight categories are set based on the actual needs of the care business scenario, which is different from the archive-level storage of general health records and the semantic vector storage of general dialogue memory.

[0023] Step S3: When a matching hit occurs, extract structured health event information from the natural language message through multi-pattern regular expressions, where the extraction is rule-based pattern matching rather than machine learning-based named entity recognition. Specifically, it includes: (1) Time information extraction: Match the time period plus hour-minute format, the number-dot format, and the expression containing the character "just" that implies the current time through regular expressions, and the extracted time is stored in a standardized 24-hour format. For example, "3 p.m." is extracted as "15:00". (2) Drug name extraction: Match the patterns of "took / took / used plus drug name", "injected plus element or injection", "sprayed plus drug name", and "applied plus plaster" through regular expressions. For example, the drug name extracted from "took antihypertensive drug" is "antihypertensive drug". (3) Vital sign value extraction: Match six vital sign types through regular expressions - blood pressure in the format of number slash number, blood glucose in number format, body temperature in number format, heart rate in number format, blood oxygen in number format, and weight in number format. The vital sign type identifier and the original value string are recorded simultaneously during extraction.

[0024] Step S4: Actively store the structured health event information into the health memory library dimensioned by user identifiers, where the storage is automatically extracted from the dialogue instead of relying on manual user upload or device synchronization. The health memory library adopts a dictionary structure, where the key is the user identifier and the value is the event list of the user. Each event includes: a unique identifier (with an 8-digit UUID prefix), an event type list, an original text summary (truncated to 200 characters), time, drug name, vital sign value, timestamp, and date. The health memory library is independent of session identifiers, enabling cross-session accumulation of health events of the same user in different sessions. The maximum number of stored health events for each user is 500, and when the upper limit is exceeded, the latest 500 entries are automatically retained by truncation.

[0025] Step S5: In subsequent dialogue processing, retrieve the user's 15 most recent health events from the health memory bank, format them as context text, and inject them into the system prompts in the language model. The formatting method is as follows: grouped in descending order by date, sorted by time within each group, and each event displays an event type label, time, original text content, and additional structured information (drug name label and vital sign value label). A temporary replacement mechanism is used during injection: the system prompt content is temporarily replaced with a combination of the original prompt and the health memory context; the original system prompt is restored after the current dialogue processing is completed, ensuring that health memory data does not contaminate the original session storage.

[0026] Step S6: Based on the system prompts injected with the health memory context, the language model is invoked to generate a response. When generating a response, the language model can refer to the user's historical medication, vital signs, symptoms, and other information. For example, when a user asks "When did I take my medicine yesterday?", the system extracts the medication event from the health memory and provides a specific answer.

[0027] like Figure 2 As shown, this embodiment also provides a health memory intelligent management system based on cross-session user dimensions, including: a keyword matching module, an event extraction module, a user dimension storage module, a context injection module, a dialogue management module, and a security filtering module.

[0028] Keyword matching module: Performs deterministic substring matching between the natural language message input by the user and a keyword library containing eight specific categories of health events in the care field, and outputs a list of detected event types.

[0029] Event Extraction Module: Extracts structured health event information from matched messages using multi-pattern regular expressions, including event type, time information, drug name, and vital sign values.

[0030] User-dimensional storage module: Structured health events are proactively stored in the health memory bank using the user identifier as the key. It is independent of the session identifier, supports cross-session accumulation, and has a maximum of 500 records per user.

[0031] Context injection module: Retrieves several recent events from the user's health memory bank, groups them by date and formats them into context text, temporarily injects system prompts, and restores them after the conversation ends.

[0032] Dialogue Management Module: Based on system prompts injected with health memory context, the module invokes a language model and returns the response content via a streaming protocol.

[0033] Security filtering module: Before calling the language model, it performs content boundary checks on user messages (a three-layer mechanism of whitelist priority, blacklist blocking, and default access). After the language model outputs, it performs post-processing on the reply content (detecting and correcting non-compliant negative brand information).

[0034] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A health memory intelligent management method based on cross-session user dimensions, characterized in that, comprising the following steps: S1: receiving a natural language message input by a user in dialog interaction; S2: matching the natural language message with a care domain health event keyword library, where the keyword library includes keywords of eight specific categories in the care domain, namely medication, symptom, physical sign, diet, sleep, exercise, excretion and service, and the matching is word-by-word substring matching instead of semantic vector similarity calculation; S3: when a match is hit, extracting structured health event information from the natural language message through a multi-pattern regular expression, including event type, time information, drug name and physical sign value, where the extraction is rule-based pattern matching instead of machine learning-based named entity recognition; S4: storing the structured health event information into a health memory library with the user identifier as the dimension, where the health memory library is independent of the session identifier, so that health events of the same user in different sessions can be accumulated across sessions, and the storage is actively extracted from the dialog instead of relying on manual user upload or device synchronization; S5: in subsequent dialog processing, retrieving several recent health events of the user from the health memory library, formatting them into context text and injecting the context text into the system prompt of the language model; S6: invoking the language model to generate a response based on the system prompt injected with the health memory context, so that the response refers to the user's historical health information.

2. The method according to claim 1, characterized in that, In step S2, the keyword matching adopts a word-by-word traversal method to perform substring matching on the keyword lists of the eight specific categories in the care domain respectively, and once any keyword is hit, the corresponding category is marked as the detected event type; a single message can hit multiple categories, forming a health event with multiple coexisting types.

3. The method according to claim 1, characterized in that, The eight specific categories in the care domain in step S2 are different from the archive-level storage of general health records and the semantic vector storage of general dialog memory: the medication category includes keywords of oral drug names, injection drug names and external drug names; the physical sign category includes keywords of blood pressure, blood glucose, body temperature, heart rate, blood oxygen and body weight; the excretion category includes keywords related to defecation and urination; the service category includes keywords of door-to-door service, appointment and care service names; the classification is based on the actual requirements of the care business scenario rather than general semantic clustering.

4. The method according to claim 1, characterized in that, In step S3, the time information extraction adopts multiple regular expression patterns, including the hour-minute format with a time period identifier, the format of numbers separated by dots, and the expression containing the Chinese character "gang" (just now) that implies the current time; the extracted time is stored in a standardized 24-hour format.

5. The method according to claim 1, characterized in that, In step S3, the drug name extraction adopts multiple regular expression patterns, including the pattern of "took", "administered" or "used" followed by the drug name, the pattern of "injected" followed by "element" or "injection", the pattern of "sprayed" followed by the drug name, and the pattern of "applied" followed by the plaster name.

6. The method according to claim 1, characterized in that, In step S3, the physical sign value extraction uses regular expressions to match the following six physical sign types: blood pressure adopts the number-slash-number format, and blood glucose, body temperature, heart rate, blood oxygen and body weight all adopt the number format; the physical sign type identifier and the original value string are recorded simultaneously during extraction.

7. The method according to claim 1, characterized in that, In step S4, the maximum number of health events stored for each user is 500. When the limit is exceeded, the most recent 500 events are automatically truncated. Each event record includes a unique identifier, a list of event types, a summary of the original text, time, drug name, vital sign value, timestamp, and date.

8. The method according to claim 1, characterized in that, In step S5, the contextual text formatting includes: grouping by date in descending order, sorting by time within each group, and displaying the event type label, time, original text content, and additional structured information for each event. The additional structured information includes drug name labeling and vital sign value labeling.

9. The method according to claim 1, characterized in that, In step S5, when injecting the healthy memory context, the system prompt words of the language model are temporarily replaced, and the original system prompt words are restored after the current dialogue is processed, so that the healthy memory data does not pollute the original session storage.

10. The method according to claim 1, characterized in that, It also includes output security filtering steps: before calling the language model, the user message is checked for content boundaries, which adopts a three-layer mechanism of whitelist priority, blacklist blocking and default approval; after the language model outputs, the reply content is post-processed to detect and correct non-compliant negative brand information.

11. The method according to claim 1, characterized in that, It also includes a medication reminder step: based on the medication-related health events stored in the health memory bank, a medication reminder plan is generated according to preset rules and pushed to the user terminal through dialogue or message.

12. A health memory intelligent management system based on cross-session user dimensions, characterized in that, include: The keyword matching module is used to perform deterministic substring matching between the natural language message input by the user and a keyword library containing health events of eight specific categories in the care field; The event extraction module is used to extract structured health event information from matched messages using multi-pattern regular expressions. The user-dimensional storage module is used to actively store structured health event information into a health memory bank with user identifier as the dimension. The health memory bank is independent of the session identifier. The context injection module is used to retrieve the user's most recent health events from the health memory bank in subsequent dialogue processing, format them into context text, and inject them into the system prompt words of the language model. The dialogue management module is used to generate responses by calling a language model based on system prompts that have been injected with a healthy memory context.

13. The system according to claim 12, characterized in that, It also includes a security filtering module, which performs content boundary checks on user messages before calling the language model, and performs post-processing on the response content after the language model outputs.