A hospital health education intelligent question and answer method based on a large language model and a knowledge base
By constructing an intelligent question-and-answer system based on a large language model and knowledge base, the problems of personalization, low efficiency, and insufficient accuracy in hospital health education have been solved. This system achieves efficient, accurate, and personalized health education question-and-answer, thereby improving patient satisfaction and the quality of education.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHUJIANG HOSPITAL OF SOUTHERN MEDICAL UNIVERSITY
- Filing Date
- 2025-09-05
- Publication Date
- 2026-06-19
Smart Images

Figure CN121119151B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent question-answering technology, and in particular to an intelligent question-answering method for hospital health education based on a large language model and knowledge base. Background Technology
[0002] In the hospital medical service system, patient health education is a key link in improving the quality of medical services and promoting patient recovery. Its core objective is to convey key information to patients, such as disease awareness, treatment plans, nursing care points and rehabilitation knowledge, to help patients better cooperate with the diagnosis and treatment process.
[0003] Currently, hospitals primarily conduct patient health education through traditional methods, including distributing printed materials, verbal explanations by medical staff, and simple electronic health education systems used by some hospitals. However, these existing solutions have several significant drawbacks, as follows:
[0004] Lack of personalization: Existing health education content is mostly based on generic templates, failing to provide customized information according to the patient's specific condition (such as disease type and stage), treatment plan (such as type of surgery and medication regimen), and individual needs (such as age and underlying diseases). For example, the focus of postoperative care varies among different patients, but existing systems struggle to deliver targeted and appropriate information, resulting in content that lacks precise guidance for patients.
[0005] Inefficiency: Medical staff need to spend a lot of time repeatedly explaining the same health education content. Especially when there are many patients, it is difficult to cover the consultation needs of all patients. This not only increases the workload of medical staff, but also causes some patients' questions to go unanswered in a timely manner, affecting the coverage and timeliness of health education.
[0006] Insufficient information accuracy: Some simple electronic health education systems mainly rely on keyword matching or preset templates to generate content, lacking a deep understanding and verification mechanism for medical knowledge. When dealing with complex medical knowledge (such as drug interactions and contraindications for medication in special populations), information errors or biases are likely to occur, which may mislead patients and bring health risks.
[0007] Low patient participation: Current methods are mostly one-way information transmission, lacking interactivity. Patients can only passively receive pre-set content and cannot actively seek information based on their own real-time questions, resulting in weak patient participation in health education and making it difficult to motivate them to actively acquire health knowledge.
[0008] Untimely information updates: Medical knowledge is constantly being updated (such as new treatment plans and guideline revisions), but traditional paper materials and simple electronic systems are difficult to update in real time. As a result, the knowledge that patients acquire may lag behind the latest medical advances, affecting their correct understanding of diseases and treatments.
[0009] The aforementioned problems directly lead to low quality of patient health education, low patient satisfaction, and may even cause misunderstandings between doctors and patients due to poor information transmission. There is an urgent need for an efficient, accurate, personalized, and highly interactive technical solution to overcome the limitations of existing technologies and improve the overall effectiveness of hospital health education. Summary of the Invention
[0010] This invention provides an intelligent question-and-answer method for hospital health education based on a large language model and knowledge base, in order to solve the aforementioned technical problems.
[0011] This invention provides an intelligent question-and-answer method for hospital health education based on a large language model and knowledge base, including: Step 1: collecting relevant document data on hospital health education and preprocessing it to form text blocks, wherein the preprocessing includes: format conversion, parsing and text segmentation;
[0012] Step 2: Convert the text blocks into vector form using a vector embedding model, store them in an AI native database along with metadata, and build an index to form a hospital health education knowledge base;
[0013] Step 3: Receive health consultation questions input by users, perform semantic analysis and keyword extraction on the questions, and retrieve relevant knowledge fragments from the hospital's health education knowledge base through various strategies such as semantic vector retrieval, keyword retrieval, and structured query;
[0014] Step 4: Merge and reorder the retrieved knowledge fragments, calculate the relevance score, and select the top K knowledge fragments with the highest scores;
[0015] Step 5: Substitute the selected knowledge fragments and user questions into the preset prompt word engineering template to generate prompt words, and input the prompt words into the large language model to generate answers to the user questions and provide feedback to the user.
[0016] Preferably, the retrieved knowledge fragments are merged and reordered, including:
[0017] The vector similarity score obtained from semantic vector retrieval, the keyword matching score obtained from keyword retrieval, and the structured data matching score obtained from structured query are obtained respectively.
[0018] The vector similarity score, keyword matching score, and structured data matching score are weighted and summed according to preset weights to obtain the comprehensive relevance score of each knowledge fragment.
[0019] The knowledge segments are sorted according to their comprehensive relevance scores, and the top K knowledge segments are selected.
[0020] Preferred options also include:
[0021] Collect and analyze users' individual data, combine a rule engine and a large language model, and generate a personalized health education content push plan based on users' individual data and historical interaction records. The individual data includes diagnostic information, treatment plans and examination results.
[0022] Based on the aforementioned push plan, corresponding health education content will be pushed to users.
[0023] Preferably, the prompt word template includes context placeholders and question placeholders, and the prompt word generation step specifically includes:
[0024] Fill the selected knowledge fragments into the context placeholders, and fill the user's questions into the question placeholders;
[0025] The template constraint allows the large language model to generate answers based solely on the filled knowledge fragments. If the knowledge fragment contains no relevant content, it directly returns a message indicating that no relevant information is available.
[0026] Preferred options also include:
[0027] The system receives negative feedback from users regarding generated answers. This feedback includes negative ratings for accuracy, completeness, and semantic discrepancies. It associates negative feedback with corresponding knowledge fragments, recording the fragment's unique identifier, its reference position in the answer generation process, and the generation logic parameters of the large language model. Negative feedback is categorized by weight, with higher weights for accuracy and completeness. Based on the marking results, if the negative feedback pertains to the knowledge fragment itself, its retrieval weight in the knowledge base index is reduced, triggering a re-review process for the corresponding source document. If the negative feedback pertains to the generation logic, the system extracts the defect types from the generation logic parameters and adjusts the constraints of the prompt word template accordingly, including adding mandatory domain terminology matching rules or limiting the hierarchical format of the answer structure. Finally, it verifies the adjusted index weights and prompt word templates using positive feedback examples from historical user interaction data, confirming the optimization effect before applying it to subsequent question-and-answer processes.
[0028] Preferred options also include:
[0029] Encrypt and store individual user data and health consultation records;
[0030] Configure access control policies to allow only authorized personnel to access sensitive data;
[0031] Regularly conduct security audits of data transmission and storage processes to ensure compliance with data security and privacy protection regulations;
[0032] Specifically, user individual data and health consultation records are stored in encrypted form.
[0033] Determine the first volume of each user's individual data and the second volume of health consultation records;
[0034] The prevalence of each health consultation question in the health consultation records was analyzed, and important tags were assigned to each health consultation question based on the chronological order of the health consultation questions.
[0035] Based on the numerical differences between the tag types of the important tags and the corresponding ordinary tags, and combined with the tag weights of the corresponding tag types, a difference set is constructed. The maximum difference in the difference set and the numerical difference corresponding to the tag type with the largest weight are extracted. The protection coefficient is obtained by combining the first size relationship between the average difference of the difference set and a preset threshold, and the second size relationship between the difference variance and a preset variance. The tag type is related to the problem type.
[0036] Based on the protection coefficient, the problem to be encrypted is obtained by extracting problems from the difference set. Problem extraction refers to extracting health consultation problems that are greater than or equal to the protection coefficient.
[0037] A question storage matrix for health consultation questions is constructed based on important tags, and the element positions of the questions to be encrypted in the question storage matrix are locked. Based on the position distribution of all element positions in the question storage matrix and the ratio of the required capacity to the second capacity, a first position identifier is set for each question to be encrypted.
[0038] For each element, a second position identifier for a non-encrypted problem is randomly selected sequentially from the row, column, and diagonal of the element's position to form an identifier array. When a second position identifier is not found in one or more of the corresponding row, column, and diagonal, a random number is generated to replace the non-existent second position identifier.
[0039] Encrypt all questions to be encrypted based on the first position identifier and the identifier array;
[0040] Based on the required capacity of the problem to be encrypted, and combined with the maximum capacity compression of the first and second capacities, a first storage space is allocated to the user.
[0041] Preferably, the system receives health consultation questions input by the user, performs semantic parsing and keyword extraction on the questions, including:
[0042] Based on the semantic parsing model, the health consultation question is coarsely parsed to obtain coarse logic, wherein the coarse logic contains several sub-logic and each sub-logic corresponds to an intent;
[0043] Based on the logical mining model, each intent is mined sequentially to determine its mining depth and breadth, thereby obtaining the detailed logic of the corresponding intent. The mining depth is related to the deep dimension of the intent, and the mining breadth is related to the broad meaning of the same deep dimension of the intent. The broad meaning is obtained by sequentially inputting each intent into the logical mining model, mining and associating the representative identifier of the intent with historical identifier depth dimension according to the deep mining layer in the logical mining model, and mining and associating the same dimension according to the same dimension extension layer in the logical mining model.
[0044] Each detailed logic is deeply encoded and then concatenated according to the depth dimension to obtain the full-depth encoding of the corresponding detailed logic;
[0045] Extract the logic vectors obtained from the coarse logic to determine the surface features and core features, and encode the surface features and core features to obtain the corresponding surface codes and core codes.
[0046] Obtain the first comparison code and the first bias code of the full-depth encoding and the surface encoding, and the second comparison code and the second bias code of the full-depth encoding and the core encoding to determine the dual mapping relationship;
[0047] The target code of the fine logic is obtained based on the dual mapping relationship, and the target code is semantically transformed to obtain a new question, from which keywords are extracted.
[0048] Preferably, according to the same-dimensional extension layer in the logical mining model, same-dimensional association hits are performed on the mined association hits to obtain the broad meaning of each mined association hit, including:
[0049] According to the mining association hit, the representative identifier is extracted and segmented using the same hit protocol, and the sub-replacement identifier with the highest matching degree with each sub-segment identifier is traversed in the intent database and replaced.
[0050] All sub-segment identifiers involved in the representative identifier are reordered according to the semantic execution order to obtain an identifier array, wherein the identifier array contains several new identifiers after at least one sub-segment identifier has been replaced;
[0051] The first sub-identifier of each new identifier is expanded by extending the left side and the last sub-identifier of the new identifier is expanded by extending the right side to obtain the expanded identifier;
[0052] A semantic analysis is performed on each of the extended identifiers to obtain the broad meaning of the corresponding mining association hits.
[0053] Compared with the prior art, the beneficial effects of this application are as follows:
[0054] By deeply integrating individual patient medical data and historical interaction habits, leveraging a rule engine to ensure medical professionalism, and a large language model to improve content adaptability, the system generates and pushes health education content that precisely matches the patient's disease stage and needs. This avoids the ineffective push of generic content, enhances patients' acceptance and practicality of health knowledge, and improves the efficiency of hospital health education and patient satisfaction.
[0055] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings.
[0056] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0057] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0058] Figure 1 This is a flowchart of a hospital health education intelligent question-and-answer method based on a large language model and knowledge base, as described in an embodiment of the present invention.
[0059] Figure 2 This is a system architecture implementation diagram in an embodiment of the present invention;
[0060] Figure 3 This is a flowchart illustrating the specific implementation of steps 1-5 in this embodiment of the invention;
[0061] Figure 4 This is a server distribution topology diagram based on steps 1 to 5 in an embodiment of the present invention;
[0062] Figure 5 This is a schematic diagram of the software architecture based on steps 1 to 5 in an embodiment of the present invention. Detailed Implementation
[0063] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0064] This invention provides an intelligent question-answering method for hospital health education based on a large language model and knowledge base, such as... Figure 1 As shown, the process includes: Step 1: Collecting and preprocessing data from hospital health education documents to form text blocks. The preprocessing includes format conversion, parsing, and text segmentation.
[0065] Step 2: Convert the text blocks into vector form using a vector embedding model, store them in an AI native database along with metadata, and build an index to form a hospital health education knowledge base;
[0066] Step 3: Receive health consultation questions input by users, perform semantic analysis and keyword extraction on the questions, and retrieve relevant knowledge fragments from the hospital's health education knowledge base through various strategies such as semantic vector retrieval, keyword retrieval, and structured query;
[0067] Step 4: Merge and reorder the retrieved knowledge fragments, calculate the relevance score, and select the top K knowledge fragments with the highest scores;
[0068] Step 5: Substitute the selected knowledge fragments and user questions into the preset prompt word engineering template to generate prompt words, and input the prompt words into the large language model to generate answers to the user questions and provide feedback to the user.
[0069] In this embodiment, hospital health education related document data refers to various materials used for patient health education within the hospital, covering disease knowledge, treatment plans, nursing points, rehabilitation guidance, drug instructions, etc., in the form of structured data (such as diagnosis and treatment guidelines in spreadsheets), unstructured documents (such as Word version of diabetes nursing manual, PDF version of postoperative rehabilitation guide), presentation slides (such as PPT version of hypertension prevention and treatment courseware), etc. For example, a hospital's "Postoperative Nursing Guidelines for Orthopedics" (Word document), "Instructions for Coronary Heart Disease Medication" (PDF document), and "Nursing Guidelines for Common Pediatric Diseases" (Excel spreadsheet).
[0070] Preprocessing is the process of standardizing the collected document data. Its purpose is to convert documents of different formats and structures into a unified form that can be used for subsequent knowledge base construction. Specifically, it involves using the DocumentParser tool to process multi-format documents, using OCR technology to extract text from image documents (such as scanned nursing manuals), using DocumentLayoutAnalyze to parse document layout (such as distinguishing between titles and body text), and using TableStructureRecognition to recognize table content (such as drug dosage tables).
[0071] Format conversion is the process of converting non-text format documents into plain text format, solving incompatibility issues between different formats. For example, it can convert a PDF document like "Dietary Guidelines for Diabetes" into a TXT file, or extract the text content from a PPT document like "Stroke Rehabilitation Training" into a Word document.
[0072] Parsing is the process of breaking down and identifying the structure and content of a document. It includes layout parsing (distinguishing heading levels and paragraphs) and content parsing (identifying tables, formulas, special symbols, etc.). For example, parsing a PDF of "List of Drug Side Effects" with tables can identify columns such as drug names, side effects, and contraindications in the tables; parsing a Word version of "Postoperative Care Steps" can identify heading levels such as 1 day postoperatively and 3 days postoperatively.
[0073] Text segmentation is the operation of splitting preprocessed text into independent fragments according to the natural structure of the document (chapter, title, paragraph), which facilitates subsequent vectorization and retrieval. For example, the document "Diabetes Health Education" can be split into 4 text blocks according to chapters such as etiology, symptoms, diet management, and exercise guidance; the diet management chapter can be split into sub-text blocks such as staple food selection and vegetable intake according to paragraphs.
[0074] A text block is an independent content unit formed after text is segmented. Each unit contains relatively complete topic information and has a unique identifier (e.g., diabetes - diet management - staple food selection). For example: It is recommended that diabetic patients control their daily staple food intake to 250-400 grams, prioritizing whole grains such as brown rice and oats, and avoiding refined rice and flour.
[0075] Vector embedding models are AI models that can convert text into high-dimensional vectors that preserve semantic features. Models adapted for the medical field need to be trained on medical text (such as medical embedding models based on BERT fine-tuning). For example, using a BERT model in the medical field, the text block "insulin needs to be stored in cold storage" can be converted into a 1024-dimensional vector. This vector is close in space to the vector of the storage method of hypoglycemic drugs (due to semantic correlation).
[0076] Vector form is the numerical representation of a text block after it has been transformed by a vector embedding model. It exists in the form of a high-dimensional array and can measure the semantic relevance of the text through mathematical calculations (such as cosine similarity). For example, the vector form of the text block that the postoperative wound needs to be disinfected daily is [0.23,0.15,...,0.89] (a 1024-dimensional array).
[0077] Metadata is auxiliary information related to text blocks, used for tracing, management, and retrieval optimization. It includes unique identifiers of text blocks, source document names, chapter titles, update times, and topic tags. For example, the metadata of a certain text block is: Identifier: Postoperative care - wound disinfection; Source document: "Postoperative care manual"; Update time: 2024-05-10; Topic tags: wound care, disinfection.
[0078] AI-native databases are databases designed specifically for Large Language Models (LLM) and Retrieval Augmentation (RAG) applications. They support vector storage, efficient retrieval, and multimodal data management, such as the Infinity database. For example, the Infinity database can be used to store text block vectors and metadata, and its built-in Approximate Nearest Neighbor (ANN) retrieval function can quickly match similar vectors.
[0079] An index is a retrieval optimization structure built for vector data in a database to accelerate similar vector queries. Common types include inverted indexes, tree indexes, and ANN indexes. For example, in the Infinity database, an ANN index is built for medical text vectors, and the retrieval speed is further improved through hierarchical indexing strategies (such as partitioning by internal medicine and surgery topics).
[0080] The hospital health education knowledge base is a structured knowledge collection composed of preprocessed text blocks, vector data, metadata, and indexes. It covers authoritative medical knowledge required for hospital health education and supports efficient retrieval. For example, a knowledge base containing multiple thematic sections such as cardiovascular diseases, post-orthopedic surgery, and pediatric nursing can quickly respond to searches for questions such as "Can patients with hypertension eat egg yolks?" and "How to supplement calcium after a fracture?"
[0081] Health consultation questions are natural language questions related to health, disease, treatment, and nursing that patients ask through smart terminals (such as tablets in hospital rooms). These questions support text or voice input. Examples include: "I just had gallbladder removal surgery, when can I eat solid food?" and "What should I do if I forget to take my blood sugar medication?"
[0082] Semantic parsing is a process of deeply understanding user questions, identifying the intent of the question, eliminating ambiguity (such as clarifying the specific drug referred to by combining patient medical records), and extracting semantic logic. For example, it can use medical natural language processing (NLP) models (such as fine-tuned BERT models) to parse questions. For example, parsing "I have severe postoperative pain, can I take painkillers?" can identify the intent as whether painkillers can be used for postoperative pain and associate it with the patient's medical record information from one day after orthopedic surgery.
[0083] Keyword extraction involves extracting core terms, entities, or keywords from user questions to accurately match professional content in a knowledge base. For example, from the question "How do diabetic patients control their postprandial blood sugar?", keywords such as "diabetes", "postprandial blood sugar", and "control" can be extracted.
[0084] Semantic vector retrieval converts user questions into vectors and retrieves semantically related knowledge fragments by calculating the similarity (such as cosine similarity) with vectors in the hospital's health education knowledge base. For example, converting the question "What should I do about postoperative wound infection?" into a vector allows retrieval of semantically similar text blocks in the knowledge base, such as "postoperative infection treatment" and "wound anti-inflammatory methods".
[0085] Keyword retrieval is based on extracted keywords. It uses text matching algorithms (such as BM25) to retrieve knowledge fragments containing the keywords in the knowledge base, ensuring accurate matching of professional terms. For example, using the keywords insulin and side effects, the BM25 algorithm can match text blocks in the knowledge base that describe common side effects of insulin and how to deal with them.
[0086] Structured queries convert user queries into structured query statements (such as SQL) to retrieve structured data (such as patient test results and medication records) from medical databases (such as HIS and EMR systems). For example, the question "What is my most recent blood glucose test result?" can be converted into an SQL statement to query the patient's blood glucose test record table and retrieve the structured data "Fasting blood glucose 6.5 mmol / L on July 20, 2024".
[0087] Knowledge fragments are text blocks or structured data fragments related to user questions that are obtained from the hospital's health education knowledge base using the above retrieval strategies. For example, regarding postoperative diet issues, two knowledge fragments were retrieved: liquid foods are recommended for 1-3 days after surgery, and spicy and irritating foods should be avoided.
[0088] The prompt word template is a preset text format used to constrain the generation logic of the large language model, ensuring that the answer is based on the retrieved knowledge fragments and conforms to the norms of the medical scenario. For example, the template content is context information: {knowledge fragment 1} {knowledge fragment 2}...; question: {user question}; please answer in the tone of a medical professional, based solely on the context, using plain language. If there is no relevant content in the context, reply 'No relevant information available'.
[0089] The prompt words are the complete input text generated by substituting the first K knowledge fragments and the user's question into the prompt word engineering template. They are used to guide the large language model in generating an answer. For example, the prompt words might be contextual information: 1. After gallbladder removal surgery, liquid foods (such as rice water) are recommended for 1-2 days, transitioning to semi-liquid foods (such as porridge) after 3-5 days; 2. Avoid greasy foods after surgery. Question: When can I eat solid foods after gallbladder removal? Please answer from a medical professional's perspective, based solely on the context.
[0090] Large language models are large language models fine-tuned for the medical field (such as fine-tuned GPT-4 and LLaMA), which have the ability to understand medical terms and generate natural language responses. For example, using an LLM fine-tuned with medical data from a top-tier hospital, a response can be generated based on prompts: 5-7 days after gallbladder removal surgery, if recovery is going smoothly, you can gradually try soft solid foods (such as soft rice) and avoid greasy and spicy foods.
[0091] The response is a natural language reply generated by a large language model based on prompt words. It must meet the requirements of medical accuracy and accessibility. Finally, it is fed back to the user through a smart terminal. For example, the response to the user is: Hello, based on your postoperative condition, it is recommended that you try soft solid foods (such as soft rice and steamed eggs) 5-7 days after the operation. Avoid fried foods, fatty meats and other greasy foods. If you experience abdominal bloating after eating, you can stop and consult medical staff.
[0092] In this embodiment, steps 1 to 5 also rely on the system architecture, which includes five layers: infrastructure layer, data layer, model layer, enhancement technology layer, and application layer. Figure 2 As shown.
[0093] Infrastructure Layer: Network, used for data transmission and connections between communication devices; Storage, primarily referring to hardware disks, used to store vector databases, embedded vector models, vector indexes, prompt engineering templates, knowledge base documents, user session history data, and basic and medical information of patients in the hospital. Computing, referring to GPUs and CPUs, used for computational tasks such as vector cosine similarity calculation, instruction parsing, and instruction execution. Security, including firewalls, network gateways, antivirus software, and auditing systems, used to provide a secure environment for intelligent technologies.
[0094] Data Layer: Vector Database. Hospital health education documents undergo data collection and preprocessing (text parsing, format conversion, text segmentation, and index vectorization) before being stored in an AI-native database to build a hospital health education knowledge base. Medical Database: Used by the application platform to bind basic patient information and obtain medical information at key stages of the patient's medical process (admission, hospitalization, discharge).
[0095] Model Layer: The model layer includes embedding models and Large Language Models (LLMs). Embedding models transform data into vector representations, which are then used for similarity calculations and semantic matching to select the most relevant content before being injected into the Large Language Model. Large Language Models (LLMs) are a crucial technology in artificial intelligence. Trained using deep learning algorithms, they are capable of understanding and generating natural language. These models are typically pre-trained on massive amounts of text data to learn the statistical patterns and semantic information of language, thus acquiring powerful language understanding and generation capabilities.
[0096] Enhancement Technology Layer: Health consultation questions input by the client are vectorized using a vectorized embedding model. These vectors are then fused and re-ranked in a hospital health education knowledge AI native database. The top K vector blocks with the highest similarity scores are selected as input for prompt engineering. Prompt engineering, also known as contextual learning, refers to guiding LLM behavior through carefully designed prompting techniques without altering model weights. Its goal is to align the model output with human intent for a given task. Figure 1 To.
[0097] Application Layer: Question Answer Generation: Combining retrieved knowledge with a large language model to generate high-quality, accurate answers. Personalized Push Notifications: Pushing personalized health education content based on individual user data (such as diagnostic information, treatment plans, and historical records), dynamically adjusting the content based on real-time user data and feedback. Knowledge Base Management: Responsible for the construction, updating, and maintenance of the knowledge base, ensuring the timeliness and accuracy of its content. Feedback Analysis: Collecting and analyzing user feedback information for system optimization.
[0098] The individual user data involved in this embodiment of the invention has been authorized by the parties involved, and the relevant data is used for research purposes.
[0099] In this embodiment, the specific implementation process of steps 1-5 is as follows: Figure 3 As shown.
[0100] For the server distribution topology in steps 1 to 5, such as Figure 4 As shown.
[0101] The software architecture for steps 1 to 5 is illustrated with module diagrams, including the inputs, outputs, and processing procedures of each module, as well as the interaction processes between modules. Figure 5 As shown.
[0102] The beneficial effects of the above technical solution are: through standardized knowledge base construction, multi-strategy precise retrieval, and constraint-based answer generation, it achieves high efficiency (second-level response), precision (based on authoritative medical knowledge), and personalization (matching the specific situation of patients) in hospital health education Q&A. It not only solves the problems of information lag and repetitive explanation in traditional health education, but also reduces the burden on medical staff and improves patients' efficiency and satisfaction in acquiring health knowledge.
[0103] This invention provides an intelligent question-answering method for hospital health education based on a large language model and knowledge base, which integrates and reorders retrieved knowledge fragments, including:
[0104] The vector similarity score obtained from semantic vector retrieval, the keyword matching score obtained from keyword retrieval, and the structured data matching score obtained from structured query are obtained respectively.
[0105] The vector similarity score, keyword matching score, and structured data matching score are weighted and summed according to preset weights to obtain the comprehensive relevance score of each knowledge fragment.
[0106] The knowledge segments are sorted according to their comprehensive relevance scores, and the top K knowledge segments are selected.
[0107] In this embodiment, the fusion re-ranking is a comprehensive calculation of the results of semantic vector retrieval, keyword retrieval, and structured query. The candidate knowledge fragments are ranked by weighted calculation to improve retrieval accuracy. For example, the results of the three retrieval strategies are fused, and a comprehensive score is calculated based on preset weights (such as vector similarity 0.5, keyword matching 0.3, and structured matching 0.2), and then ranked by the score.
[0108] The relevance score is a comprehensive indicator that measures the relevance of a knowledge fragment to a user's question. It is obtained by weighted summation of vector similarity score, keyword matching score, and structured data matching score. For example, if a knowledge fragment has a vector similarity score of 0.8, a keyword matching score of 0.7, and a structured data matching score of 0.6, the weighted relevance score is calculated as follows: relevance score = 0.8 × 0.5 + 0.7 × 0.3 + 0.6 × 0.2 = 0.73.
[0109] The top K knowledge fragments are selected after being sorted in descending order of relevance score. The top K (e.g., K=5) knowledge fragments are used as the basis for generating subsequent answers to ensure that the information is comprehensive and accurate. For example, for the question of hypertension medication, the top 5 knowledge fragments with the highest relevance scores are selected, covering the types of commonly used antihypertensive drugs, dosage, side effects, etc.
[0110] The beneficial effects of the above technical solution are: by comprehensively evaluating the three dimensions of semantic association, keyword matching, and structured data adaptation, it balances the semantic accuracy and terminology precision of the retrieval, effectively avoids the one-sidedness of a single retrieval strategy, and ensures that the selected top K knowledge fragments are highly relevant and comprehensive to the user's question, providing a reliable basis for the subsequent generation of accurate and professional answers by the large language model.
[0111] This invention provides an intelligent question-answering method for hospital health education based on a large language model and knowledge base, and also includes:
[0112] Collect and analyze users' individual data, combine a rule engine and a large language model, and generate a personalized health education content push plan based on users' individual data and historical interaction records. The individual data includes diagnostic information, treatment plans and examination results.
[0113] Based on the aforementioned push plan, corresponding health education content will be pushed to users.
[0114] In this embodiment, diagnostic information refers to the doctor's diagnosis of the patient's disease, including the disease name, cause, type, severity, etc.; treatment plan refers to the treatment measures formulated for the patient's condition, including surgical methods, medication regimens, rehabilitation training plans, etc.; and examination results refer to the various examination data of the patient during the diagnosis and treatment process (such as laboratory results, imaging reports, vital sign records, etc.).
[0115] The rule engine refers to a logical rule base based on medical standards and clinical pathways, used to determine the timing, frequency, and core content framework of push notifications (ensuring that the push notifications conform to medical professionalism). For example, preset rules include pushing wound care tips 1-3 days after surgery, pushing emergency blood sugar control measures when blood sugar is >7.0mmol / L for diabetic patients, and pushing side effect management for chemotherapy patients 24 hours after medication. The large language model refers to a language model finely tuned in the medical field, used to generate personalized content that fits the user's understanding ability and specific needs based on individual data and the framework of the rule engine (such as converting professional terms into colloquial expressions and highlighting the user's current focus).
[0116] Historical interaction records refer to the user's past interaction data with the system, including questions asked (such as "How long after surgery can I take a shower?") and feedback on pushed content (such as clicking to view "dietary guidance" many times).
[0117] The health education content delivery plan refers to a phased and focused delivery arrangement formed by combining individual data and historical interaction records, with the framework determined by a rule engine and the content refined by a large language model, which clarifies "what to push, when to push, and the form of push".
[0118] Personalized health education content refers to health knowledge generated according to the push plan and adapted to the individual user's situation. It includes text, pictures, videos and other forms. The content focuses on the core needs of the user at the current stage of diagnosis and treatment. For example, push "foot care practice video (for patients with numbness)" to patients with "type 2 diabetes mellitus complicated with peripheral neuropathy" and prefer video content; push "emergency guide for treating redness and swelling of wound" to patients with "postoperative wound redness and swelling".
[0119] The beneficial effects of the above technical solution are as follows: by deeply integrating individual patient diagnosis and treatment data with historical interaction habits, leveraging rule engines to ensure medical professionalism and large language models to improve content adaptability, it generates and pushes health education content that accurately matches the patient's disease stage and needs and preferences, avoiding the ineffective push of general content, enhancing patients' acceptance and practicality of health knowledge, and improving the efficiency of hospital health education and patient satisfaction.
[0120] This invention provides an intelligent question-answering method for hospital health education based on a large language model and knowledge base. The prompt word engineering template includes context placeholders and question placeholders. The specific steps for generating prompt words are as follows:
[0121] Fill the selected knowledge fragments into the context placeholders, and fill the user's questions into the question placeholders;
[0122] The template constraint allows the large language model to generate answers based solely on the filled knowledge fragments. If the knowledge fragment contains no relevant content, it directly returns a message indicating that no relevant information is available.
[0123] In this embodiment, the context placeholder refers to the marker (usually represented by symbols such as {context}) used to fill knowledge fragments in the prompt word engineering template. It is the "knowledge source" entry point for the model to generate answers, ensuring that the model outputs only based on the retrieved relevant knowledge. For example, in the above template, {context} is a context placeholder. If the selected knowledge fragment is "diabetic patients can eat low-GI fruits (such as apples and pears) in moderation, not exceeding 200 grams per day, and avoid high-GI fruits such as lychees and mangoes", then this fragment will be filled into the {context} position.
[0124] Question placeholders are markers (usually represented by symbols such as {query}) used in the prompt word engineering template to fill in the user's original question. They clearly define the specific question that the model needs to answer and avoid generating content that deviates from the user's needs. For example, in the template above, {query} is a question placeholder. If the user's question is "Can diabetic patients eat fruit?", then the question will be filled in the {query} position.
[0125] The prompt word generation step refers to the process of filling knowledge fragments and user questions into corresponding placeholders to form complete prompt words. It is a key link connecting knowledge retrieval and model generation, ensuring that the model obtains both "answer basis" and "answer target" at the same time. Specifically, the program automatically reads the filtered knowledge fragments and user questions, replaces the placeholders according to the template format, and generates text that can be directly input into the large language model.
[0126] Constraining large language models refers to limiting the model's generation logic through instructions in templates (such as "strictly based on context information rather than its own knowledge"), preventing the model from relying on its own training data to output incorrect or outdated information, and ensuring that the answer is based only on the provided knowledge fragments. For example, the instruction in the template "strictly based on context information, without using external knowledge" can constrain the model to only rely on the filled knowledge fragments when answering "dietary practices for diabetic patients" and not arbitrarily add unverified "folk remedies".
[0127] The beneficial effects of the above technical solution are as follows: by using preset prompt word engineering templates and placeholder mechanisms, the large language model is strictly constrained to generate answers based only on the retrieved authoritative knowledge fragments. This avoids errors caused by the model relying on its own training data, and also fits the communication style of medical scenarios. This significantly improves the accuracy, reliability, and professionalism of intelligent Q&A in hospital health education, and enhances patients' trust in the answers.
[0128] This invention provides an intelligent question-answering method for hospital health education based on a large language model and knowledge base, and also includes:
[0129] The system receives negative feedback from users regarding generated answers. This feedback includes negative ratings for accuracy, completeness, and semantic discrepancies. It associates negative feedback with corresponding knowledge fragments, recording the fragment's unique identifier, its reference position in the answer generation process, and the generation logic parameters of the large language model. Negative feedback is categorized by weight, with higher weights for accuracy and completeness. Based on the marking results, if the negative feedback pertains to the knowledge fragment itself, its retrieval weight in the knowledge base index is reduced, triggering a re-review process for the corresponding source document. If the negative feedback pertains to the generation logic, the system extracts the defect types from the generation logic parameters and adjusts the constraints of the prompt word template accordingly, including adding mandatory domain terminology matching rules or limiting the hierarchical format of the answer structure. Finally, it verifies the adjusted index weights and prompt word templates using positive feedback examples from historical user interaction data, confirming the optimization effect before applying it to subsequent question-and-answer processes.
[0130] In this embodiment, negative feedback information is the evaluation information submitted by the user when they are dissatisfied with the answer generated by the system. It is used to identify the problems in the answer and is an important basis for system optimization.
[0131] Accuracy-related negative feedback is when users believe the answer is inconsistent with the facts (such as incorrect medication dosage or incorrect nursing methods). Completeness-related negative feedback is when users believe the answer omits key information (such as not mentioning drug side effects or not explaining nursing procedures). Semantic inconsistency is when users believe the answer does not accurately understand the question's intent and the content is irrelevant to the question.
[0132] Association tagging binds negative feedback to the knowledge fragment on which the answer was generated, clarifying the source of the problem (whether the knowledge fragment itself is wrong or the generation process is flawed). The unique identifier of the knowledge fragment is its exclusive code in the knowledge base (such as "diabetic diet-003"), which is used to accurately locate the problem fragment.
[0133] The location where the knowledge fragment is referenced in the answer generation is the specific part of the answer content that the knowledge fragment is quoted from (such as a sentence or a key point).
[0134] The generation logic parameters of a large language model are parameters that affect the model's generated answers (such as the prompt word template version, the temperature coefficient during model generation, output length limits, etc.).
[0135] The grading system is based on the degree of impact of negative feedback on users (such as misinformation potentially misleading treatment, which is more serious than incomplete information). For example, Level 1 (poor accuracy rating), Level 2 (semantic mismatch rating), and Level 3 (poor completeness rating).
[0136] Feedback intensity is the severity of negative feedback, usually determined by the urgency level marked by the user (e.g., "very inaccurate" vs. "slightly inaccurate") or the type of problem.
[0137] The weight value is a numerical value that quantifies the importance of feedback. The higher the weight, the higher the priority for system optimization. For example, the weight of a poor accuracy rating is 0.5, the weight of a semantic mismatch tag is 0.3, and the weight of a poor completeness rating is 0.2, reflecting the optimization principle of "accuracy first".
[0138] Retrieval weight is the priority of a knowledge fragment in a knowledge base retrieval. When the weight is reduced, the probability of the fragment being retrieved decreases. The source document re-review process is a process that triggers medical experts to review and correct the original document corresponding to the knowledge fragment.
[0139] The reason for negative feedback in the generation logic is that there are defects in the model generation process (such as insufficient constraints of the prompt word template causing the answer to deviate from the knowledge fragment, rather than the knowledge fragment itself being wrong). The defect type is the specific parameter defect that causes the problem in the generation process (such as the prompt word template lacking the constraint of "must include the medication time"). The constraints of the prompt word engineering template are the instructions in the template used to standardize the model generation (such as must include 3 key points and must specify the medication time).
[0140] Positive feedback cases are records of users' satisfaction with past answers, which are used as a reference standard for optimization results. Optimization results refer to the degree of improvement in the accuracy, completeness, and semantic matching of the system's answers after adjustments.
[0141] The beneficial effects of the above technical solution are as follows: by accurately capturing and classifying negative user feedback, the problem is located to knowledge fragments or generation logic, the knowledge base retrieval weight and prompt word templates are optimized in a targeted manner, and the effect is verified by combining historical positive cases, forming a closed loop of feedback-location-optimization-verification. This effectively reduces incorrect answers, improves the completeness of content and semantic matching, continuously enhances the accuracy of the system and user satisfaction, and makes the hospital's intelligent health education Q&A service more in line with the needs of patients.
[0142] This invention provides an intelligent question-answering method for hospital health education based on a large language model and knowledge base, and also includes:
[0143] Encrypt and store individual user data and health consultation records;
[0144] Configure access control policies to allow only authorized personnel to access sensitive data;
[0145] Regularly conduct security audits of data transmission and storage processes to ensure compliance with data security and privacy protection regulations;
[0146] Specifically, user individual data and health consultation records are stored in encrypted form.
[0147] Determine the first volume of each user's individual data and the second volume of health consultation records;
[0148] The prevalence of each health consultation question in the health consultation records was analyzed, and important tags were assigned to each health consultation question based on the chronological order of the health consultation questions.
[0149] Based on the numerical differences between the tag types of the important tags and the corresponding ordinary tags, and combined with the tag weights of the corresponding tag types, a difference set is constructed. The maximum difference in the difference set and the numerical difference corresponding to the tag type with the largest weight are extracted. The protection coefficient is obtained by combining the first size relationship between the average difference of the difference set and a preset threshold, and the second size relationship between the difference variance and a preset variance. The tag type is related to the problem type.
[0150] Based on the protection coefficient, the problem to be encrypted is obtained by extracting problems from the difference set. Problem extraction refers to extracting health consultation problems that are greater than or equal to the protection coefficient.
[0151] A question storage matrix for health consultation questions is constructed based on important tags, and the element positions of the questions to be encrypted in the question storage matrix are locked. Based on the position distribution of all element positions in the question storage matrix and the ratio of the required capacity to the second capacity, a first position identifier is set for each question to be encrypted.
[0152] For each element, a second position identifier for a non-encrypted problem is randomly selected sequentially from the row, column, and diagonal of the element's position to form an identifier array. When a second position identifier is not found in one or more of the corresponding row, column, and diagonal, a random number is generated to replace the non-existent second position identifier.
[0153] Encrypt all questions to be encrypted based on the first position identifier and the identifier array;
[0154] Based on the required capacity of the problem to be encrypted, and combined with the maximum capacity compression of the first and second capacities, a first storage space is allocated to the user.
[0155] In this embodiment, the health consultation record includes all of the user's health consultation questions.
[0156] In this embodiment, the access control strategy is based on the data access scope and operation permission rules set by user roles (such as patients, attending physicians, and administrators) to prevent unauthorized access. Specifically, a role-based access control (RBAC) model is adopted, and a unique permission identifier is assigned to each role (such as patient role ID-001 corresponding to read-only permission for their own data). The system verifies the legality of access through the permission identifier.
[0157] Security auditing involves regularly checking data transmission logs (such as who accessed the data and when it was transmitted) and storage status (such as whether encryption has failed and whether there has been any abnormal access) to identify security vulnerabilities.
[0158] Data security and privacy protection regulations are designed to regulate data processing practices.
[0159] The first capacity is the storage size of individual user data (e.g., 5MB, including diagnostic reports, examination records, etc.), and the second capacity is the storage size of health consultation records (e.g., 2MB, including 10 historical questions and answers).
[0160] Problem prevalence is the frequency of health consultation questions in the system, represented by a value from 0 to 10 (10 being extremely common and 0 being extremely rare). For example, "Can patients with high blood pressure eat salt?" has a prevalence of 9 (extremely common) and "Postoperative care for rare disease XX" has a prevalence of 2 (extremely rare).
[0161] The importance label is an important indicator (represented by a value of 0-10) assigned to each consultation question, taking into account both the prevalence of the question and the time sequence (recent questions are more important). Specifically, the importance label value = (10 - prevalence) × 0.6 + time coefficient × 0.4, where the time coefficient is: 10 for the past week, 7 for the past month, 4 for the past 3 months, and 2 for the past 6 months. The time frame is set within the past six months. For example, postoperative care for rare disease XX (prevalence 2, question asked in the past week) → importance label value = (10-2) × 0.6 + 10 × 0.4 = 4.8 + 4 = 8.8 (high importance).
[0162] The standard label is a basic label value that does not take into account universality and time (fixed at 5, as a reference benchmark).
[0163] The difference set is a set consisting of the numerical difference between important labels and ordinary labels multiplied by the label weight. The label weight is the question type weight (e.g., treatment-related weight 0.7, nursing-related weight 0.3). The difference value = (important label value - ordinary label value) × label weight. The difference set = {difference value 1, difference value 2, ..., difference value n}, where n is the same as the number of health consultation questions. The protection coefficient is a threshold extracted from the difference set and used to determine the question to be encrypted. It is calculated as follows:
[0164]
[0165]
[0166] Where maxz represents the maximum difference; maqz represents the numerical difference of the label with the largest weight. This is the adjustment coefficient; For variance; The variance is preset. For judgment functions; The value is 0.01; The value of is 2.
[0167] The questions to be encrypted are those in the health consultation record whose difference value corresponding to important tags is greater than or equal to the protection coefficient. For example, if the protection coefficient is 4.5, and a certain question has a difference value of 5.2 (≥ 4.5), it will be extracted as a question to be encrypted.
[0168] The question storage matrix is a two-dimensional matrix that arranges health consultation questions in chronological order (rows = time batch, columns = question number in the same batch). Each element corresponds to a question. For example, 3 batches of questions → the matrix is 3 rows and 4 columns, and the element (2,3) represents the 3rd question in the 2nd batch.
[0169] The element position is the coordinate of the problem to be encrypted in the matrix (e.g., (2,3)).
[0170] The first position identifier is a unique position code that marks the question to be encrypted in the matrix (such as "2-3-001"), which is generated by combining the matrix position distribution and capacity ratio (required capacity / second capacity).
[0171] The identifier array is a random selection of the position identifiers (second position identifiers) of non-encrypted problems from the row, column, and diagonal of the problem to be encrypted. If it does not exist, it is replaced with a random number. This is used to enhance the encryption complexity. For example, if the problem to be encrypted is at position (2,3), and there are no other non-encrypted problems in the row, a random number "5-7" is generated to replace it. The column is selected as (4,3), and the diagonal is selected as (1,1). The identifier array is {5-7,4-3,1-1}.
[0172] Problem encryption combines the first position identifier and the identifier array, and uses a confusion encryption algorithm (such as performing an XOR operation between the problem to be encrypted and the identifier array) to encrypt the problem content.
[0173] Maximum capacity compression uses the LZ77 compression algorithm to compress individual data and consultation records (mainly compressing the first capacity and the remaining capacity after removing the encryption issues in the second capacity) to minimize storage capacity (e.g., the compressed capacity is 60% of the original capacity).
[0174] The first storage space is a dedicated storage space allocated to the user based on the total capacity of the uncompressed and encrypted problem to be encrypted, the initial capacity, and the remaining capacity.
[0175] The beneficial effects of the above technical solution are as follows: by using layered encryption (dynamically determining the encryption scope based on the importance of the question), access control (strictly restricting data access), and regular auditing (ensuring compliance), combined with differential computation and matrix encryption to enhance security, it achieves efficient storage while protecting the privacy of individual user data and health consultation records, effectively preventing the risk of data leakage, complying with medical data security regulations, enhancing patients' trust in the system, and providing security for the compliant operation of intelligent Q&A for hospital health education.
[0176] This invention provides an intelligent question-answering method for hospital health education based on a large language model and knowledge base. It receives health consultation questions input by users, performs semantic parsing and keyword extraction on the questions, including:
[0177] Based on the semantic parsing model, the health consultation question is coarsely parsed to obtain coarse logic, wherein the coarse logic contains several sub-logic and each sub-logic corresponds to an intent;
[0178] Based on the logical mining model, each intent is mined sequentially to determine its mining depth and breadth, thereby obtaining the detailed logic of the corresponding intent. The mining depth is related to the deep dimension of the intent, and the mining breadth is related to the broad meaning of the same deep dimension of the intent. The broad meaning is obtained by sequentially inputting each intent into the logical mining model, mining and associating the representative identifier of the intent with historical identifier depth dimension according to the deep mining layer in the logical mining model, and mining and associating the same dimension according to the same dimension extension layer in the logical mining model.
[0179] Each detailed logic is deeply encoded and then concatenated according to the depth dimension to obtain the full-depth encoding of the corresponding detailed logic;
[0180] Extract the logic vectors obtained from the coarse logic to determine the surface features and core features, and encode the surface features and core features to obtain the corresponding surface codes and core codes.
[0181] Obtain the first comparison code and the first bias code of the full-depth encoding and the surface encoding, and the second comparison code and the second bias code of the full-depth encoding and the core encoding to determine the dual mapping relationship;
[0182] The target code of the fine logic is obtained based on the dual mapping relationship, and the target code is semantically transformed to obtain a new question, from which keywords are extracted.
[0183] Preferably, according to the same-dimensional extension layer in the logical mining model, same-dimensional association hits are performed on the mined association hits to obtain the broad meaning of each mined association hit, including:
[0184] According to the mining association hit, the representative identifier is extracted and segmented using the same hit protocol, and the sub-replacement identifier with the highest matching degree with each sub-segment identifier is traversed in the intent database and replaced.
[0185] All sub-segment identifiers involved in the representative identifier are reordered according to the semantic execution order to obtain an identifier array, wherein the identifier array contains several new identifiers after at least one sub-segment identifier has been replaced;
[0186] The first sub-identifier of each new identifier is expanded by extending the left side and the last sub-identifier of the new identifier is expanded by extending the right side to obtain the expanded identifier;
[0187] A semantic analysis is performed on each of the extended identifiers to obtain the broad meaning of the corresponding mining association hits.
[0188] Semantic parsing models refer to AI models used to parse the semantics of natural language questions (such as the BERT model fine-tuned based on the medical field). They can identify the core logic and intent in the question. Specifically, a semantic parsing model trained on hospital health education corpus is used to extract the logical structure of the question through lexical analysis and syntactic analysis.
[0189] Coarse semantic parsing is the process of performing preliminary semantic decomposition of a problem and identifying surface-level logical relationships.
[0190] Coarse logic is the overall logical framework obtained from preliminary analysis, which contains multiple sub-logic.
[0191] Sub-logic is a subdivision of logic that is broken down from coarse logic, and each sub-logic corresponds to a specific intention.
[0192] The intent is the user's actual need corresponding to the sub-logic (such as asking when to eat after surgery or when to get out of bed after surgery). For example, after performing coarse semantic parsing on the question "After gallbladder removal surgery, when can I eat and get out of bed?", we get the coarse logic "Postoperative care related time consultation", which contains two sub-logic "Eating time consultation" and "Getting out of bed time consultation", corresponding to the two intents "want to know when to eat after surgery" and "want to know when to get out of bed after surgery", respectively.
[0193] The logic mining model is a model used for in-depth analysis of intent. It includes a deep mining layer and a same-dimensional extension layer, which can mine the deep dimensions and broad meanings of intent. Specifically, the model adopts a dual-channel structure. The deep mining layer learns the deep associations of intent based on the LSTM network, and the same-dimensional extension layer expands the same-dimensional meaning based on the attention mechanism.
[0194] Mining depth refers to the extent to which the intent is explored in its deeper dimensions (e.g., from "eating time" to deeper information such as "eating type (liquid / solid)" and "eating quantity limit"). Mining breadth refers to the coverage of the broad meaning of the same deep dimension of the intent (e.g., the broad meaning of "eating type" includes specific food forms such as "rice soup, porridge, and soft rice"). Specifically, mining depth is obtained by the deep dimension association hit of historical identifiers through the deep mining layer, while mining breadth is obtained by the same dimension extension layer for same-dimensional association hits of deep dimensions (including sub-segmentation, replacement, expansion, and other operations).
[0195] The deeper dimension is the subdivided dimension implied behind the intention (such as the deeper dimension of "postoperative eating" including "time point", "food type" and "forbidden food").
[0196] The broad meaning refers to specific manifestations or related concepts within the same deep dimension (such as the broad meaning of "time point" including "6 hours, 12 hours, and 24 hours after surgery").
[0197] The representative identifier is the core feature identifier of the intent (e.g., the representative identifier for "postoperative eating" is "postoperative + eating").
[0198] The deep mining layer determines the deep dimension of the current intent by matching historical intent identifiers (such as "eating after cholecystectomy" with "6 hours of liquid diet" in the history). For example, if "eating after surgery" is associated with "time and type" in the history, then the current mining association for "eating after cholecystectomy" is "time and type".
[0199] Same-dimensional association hits are a same-dimensional extension layer that expands the deep dimensions of the association hits to obtain a wider range of meanings (such as "time" being expanded to "6 hours, 12 hours").
[0200] Detailed logic is the detailed logic obtained after in-depth and in-depth mining. It includes the deep dimension and broad meaning of the intention. For example, mining the intention of "wanting to know the postoperative eating time" yields the detailed logic "postoperative eating time after cholecystectomy (deep dimension): liquid (such as rice soup) can be consumed 6 hours after surgery, and semi-liquid (such as porridge) can be consumed 12 hours after surgery (broad meaning)".
[0201] Deep coding is a process that converts fine logic into numerical codes that can be recognized by computers, while retaining semantic features with deep dimensions and broad meanings. Specifically, it uses the Transformer model to encode fine logic, with each deep dimension corresponding to an independent encoding vector.
[0202] The splicing process combines the codes of each dimension into a whole code according to the logical order of the deep dimensions (such as "time → type → taboo").
[0203] Full-depth encoding is the complete encoding obtained after concatenation, containing all the semantic information of the fine logic. For example, the depth encoding of the fine logic "liquid diet 6 hours after surgery, semi-liquid diet 12 hours after surgery" is [0.8,0.2,...] (time dimension) and [0.3,0.7,...] (type dimension), which, after concatenation, yields the full-depth encoding [0.8,0.2,0.3,0.7,...].
[0204] Logical vectors are vector representations generated based on coarse logic, reflecting the overall logical characteristics of a problem.
[0205] Surface features are the surface-level information of a problem (such as explicit words like "when" or "eat").
[0206] The core characteristic is the deep-seated needs implied by the problem (such as "dietary safety during the postoperative recovery phase" behind "postoperative eating time").
[0207] Surface coding is the numerical coding of surface features, while core coding is the numerical coding of core features. For example, in the coarse logic "postoperative care related time consultation", the surface features are "time, eating, getting out of bed", coded as surface coding [0.6,0.5,0.4,...]; the core feature is "diet and activity safety during the postoperative recovery stage", coded as core coding [0.9,0.7,0.3,...].
[0208] The first matching code is the matching degree code between the full-depth code and the surface code (reflecting the degree of correlation between fine logic and surface features), and the first bias code is the difference code between the full-depth code and the surface code (reflecting the deviation between the deep layer and the surface layer).
[0209] The second matching code is the matching degree code between the full-depth code and the core code (reflecting the degree of association between fine logic and core features), and the second bias code is the difference code between the full-depth code and the core code (reflecting the deviation between the deep layer and the core).
[0210] The dual mapping relationship is the mapping relationship between full-depth encoding and surface encoding and core encoding respectively (including matching degree and deviation). It is used to verify whether the fine logic fits the surface information and core requirements at the same time. For example, the first comparison code between full-depth encoding and surface encoding is 0.8 (high matching) and the first bias code is 0.1 (low deviation); the second comparison code with core encoding is 0.9 (high matching) and the second bias code is 0.05 (low deviation). The dual mapping relationship is "high matching - low deviation".
[0211] The target encoding is a fine-logic encoding that is selected based on a dual mapping relationship and simultaneously fits surface features and core features.
[0212] Semantic conversion is the process of converting target encoding into more explicit and precise natural language problems (eliminating ambiguity and focusing on core needs).
[0213] The new question is a clearly defined question obtained after semantic transformation, which facilitates accurate retrieval of knowledge.
[0214] Keyword extraction involves extracting core terms (such as disease, procedure, time, etc.) from a new question. For example, the target encoding corresponds to the fine logic "six hours after cholecystectomy, liquid diet is allowed; 12 hours after cholecystectomy, semi-liquid diet is allowed." The semantics are transformed into the new question "Can I eat rice water six hours after cholecystectomy? Can I eat porridge 12 hours after cholecystectomy?", and the keywords "cholecystectomy", "6 hours", "rice water", "12 hours", and "porridge" are extracted.
[0215] The preferred approach is to obtain broad meanings by performing same-dimensional association hits on the mining association hits based on the same-dimensional extension layer in the logical mining model. The same hit protocol is a unified rule for segmenting representative identifiers (such as segmenting by "action + object").
[0216] Sub-segmentation identifiers are the subdivisions of a representation identifier after being segmented according to the hit protocol (e.g., "postoperative eating" is segmented into "postoperative" and "eating"). Sub-sub-replacement identifiers are alternative identifiers with semantic similarity to the sub-segmentation identifiers (e.g., "postoperative" is replaced with "after surgery", and "eating" is replaced with "eating").
[0217] The identifier array is an array of sub-segment identifiers that have been replaced and reordered (in the semantic execution order) (e.g., "post-surgery" and "eating" are sorted as "post-surgery eating").
[0218] Left-side label expansion involves adding relevant labels to the left of the first sub-label of the new label (e.g., adding "cholecystectomy" to the left of "post-surgery").
[0219] Right-side label expansion: Add relevant labels to the right of the sub-label at the end of the new label (e.g., add "time" to the right of "eating").
[0220] Expanded label: The complete label after being expanded left and right (e.g., "Time to eat after gallbladder removal surgery").
[0221] Meaning analysis: The broad meaning obtained from the analysis of the extended identifier (such as "specific requirements for eating 6 hours and 12 hours after cholecystectomy").
[0222] The beneficial effects of the above technical solution are as follows: First, coarse semantic parsing initially deconstructs the question's intent. Then, a logical mining model is used to extract the deeper dimensions and broader meanings of the intent in both depth and breadth. Next, encoding mapping and semantic transformation convert the ambiguous question into a precise new question, ultimately extracting accurate keywords. This process significantly improves the semantic understanding accuracy of users' health consultation questions, effectively eliminates ambiguity, and ensures that subsequent knowledge retrieval accurately matches the user's actual needs. This lays the foundation for generating accurate and relevant health education answers, improving the response quality and user experience of the intelligent question-answering system.
[0223] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A hospital health education intelligent question-answering method based on a large language model and knowledge base, characterized in that, The process includes: Step 1: Collecting and preprocessing relevant hospital health education documents to form text blocks. The preprocessing includes format conversion, parsing, and text segmentation. Step 2: Convert the text blocks into vector form using a vector embedding model, store them in an AI native database along with metadata, and build an index to form a hospital health education knowledge base; Step 3: Receive health consultation questions input by users, perform semantic analysis and keyword extraction on the questions, and retrieve relevant knowledge fragments from the hospital's health education knowledge base through various strategies such as semantic vector retrieval, keyword retrieval, and structured query; Step 4: Merge and reorder the retrieved knowledge fragments, calculate the relevance score, and select the top K knowledge fragments with the highest scores; Step 5: Substitute the selected knowledge fragments and user questions into the preset prompt word engineering template to generate prompt words, and input the prompt words into the large language model to generate answers to the user questions and provide feedback to the user; This also includes: Collect and analyze users' individual data, combine a rule engine and a large language model, and generate a personalized health education content push plan based on users' individual data and historical interaction records. The individual data includes diagnostic information, treatment plans and examination results. Based on the aforementioned push plan, corresponding health education content will be pushed to users. This also includes: Encrypt and store individual user data and health consultation records; Configure access control policies to allow only authorized personnel to access sensitive data; Regularly conduct security audits of data transmission and storage processes to ensure compliance with data security and privacy protection regulations; Specifically, user individual data and health consultation records are stored in encrypted form. Determine the first volume of each user's individual data and the second volume of health consultation records; The prevalence of each health consultation question in the health consultation records was analyzed, and important tags were assigned to each health consultation question based on the chronological order of the health consultation questions. Based on the numerical differences between the tag types of the important tags and the corresponding ordinary tags, and combined with the tag weights of the corresponding tag types, a difference set is constructed. The maximum difference in the difference set and the numerical difference corresponding to the tag type with the largest weight are extracted. The protection coefficient is obtained by combining the first size relationship between the average difference of the difference set and a preset threshold, and the second size relationship between the difference variance and a preset variance. The tag type is related to the problem type. Based on the protection coefficient, the problem to be encrypted is obtained by extracting problems from the difference set. Problem extraction refers to extracting health consultation problems that are greater than or equal to the protection coefficient. A question storage matrix for health consultation questions is constructed based on important tags, and the element positions of the questions to be encrypted in the question storage matrix are locked. Based on the position distribution of all element positions in the question storage matrix and the ratio of the required capacity to the second capacity, a first position identifier is set for each question to be encrypted. For each element, a second position identifier for a non-encrypted problem is randomly selected sequentially from the row, column, and diagonal of the element's position to form an identifier array. When a second position identifier is not found in one or more of the corresponding row, column, and diagonal, a random number is generated to replace the non-existent second position identifier. Encrypt all questions to be encrypted based on the first position identifier and the identifier array; Based on the required capacity of the problem to be encrypted, and combined with the maximum capacity compression of the first and second capacities, a first storage space is allocated to the user.
2. The method according to claim 1, characterized in that, The retrieved knowledge fragments are merged and reordered, including: The vector similarity score obtained from semantic vector retrieval, the keyword matching score obtained from keyword retrieval, and the structured data matching score obtained from structured query are obtained respectively. The vector similarity score, keyword matching score, and structured data matching score are weighted and summed according to preset weights to obtain the comprehensive relevance score of each knowledge fragment. The knowledge segments are sorted according to their comprehensive relevance scores, and the top K knowledge segments are selected.
3. The method according to claim 1, characterized in that, The prompt word template includes context placeholders and question placeholders. The specific steps for generating prompt words are as follows: Fill the selected knowledge fragments into the context placeholders, and fill the user's question into the question placeholders; The template constraint allows the large language model to generate answers based solely on the filled knowledge fragments. If there is no relevant content in the knowledge fragment, a message indicating that no relevant information is returned directly.
4. The method according to claim 1, characterized in that, Also includes: Receive negative feedback from users on the generated answer, including negative feedback on accuracy, negative feedback on completeness, and semantic mismatch markers; Negative feedback is associated with and tagged with corresponding knowledge fragments, and the unique identifier of the corresponding knowledge fragment, its reference position in the answer generation, and the generation logic parameters of the large language model are recorded. Negative feedback is categorized and assigned different weights based on its intensity, with accuracy-related negative feedback receiving a higher weight than completeness-related negative feedback. Based on the tagging results, if the negative feedback targets the knowledge fragment itself, the retrieval weight of the corresponding knowledge fragment in the knowledge base index is reduced, and a re-review process for the source document corresponding to that knowledge fragment is triggered. If the negative feedback targets the generation logic, the defect type in the generation logic parameters is extracted, and the constraints of the prompt word engineering template are adjusted accordingly, including adding domain terminology mandatory matching rules or limiting the hierarchical format of the answer structure. The adjusted index weights and prompt word templates are verified by combining positive feedback cases from users' historical interaction data, and the optimization effect is applied to subsequent question-and-answer processes after confirmation.
5. The method according to claim 1, characterized in that, It receives health consultation questions input by users, performs semantic analysis and keyword extraction on the questions, including: Based on the semantic parsing model, the health consultation question is coarsely parsed to obtain coarse logic, wherein the coarse logic contains several sub-logic and each sub-logic corresponds to an intent; Based on the logical mining model, each intent is mined sequentially to determine its mining depth and breadth, thereby obtaining the detailed logic of the corresponding intent. The mining depth is related to the deep dimension of the intent, and the mining breadth is related to the broad meaning of the same deep dimension of the intent. The broad meaning is obtained by sequentially inputting each intent into the logical mining model, mining and associating the representative identifier of the intent with historical identifier depth dimension according to the deep mining layer in the logical mining model, and mining and associating the same dimension according to the same dimension extension layer in the logical mining model. Each detailed logic is deeply encoded and then concatenated according to the depth dimension to obtain the full-depth encoding of the corresponding detailed logic; Extract the logic vectors obtained from the coarse logic to determine the surface features and core features, and encode the surface features and core features to obtain the corresponding surface codes and core codes. Obtain the first comparison code and the first bias code of the full-depth encoding and the surface encoding, and the second comparison code and the second bias code of the full-depth encoding and the core encoding to determine the dual mapping relationship; The target code of the fine logic is obtained based on the dual mapping relationship, and the target code is semantically transformed to obtain a new question, from which keywords are extracted.
6. The method according to claim 5, characterized in that, Based on the same-dimensional extension layer in the logical mining model, same-dimensional association hits are performed on the mined association hits to obtain the broad meaning of each mined association hit, including: According to the mining association hit, the representative identifier is extracted and segmented using the same hit protocol, and the sub-replacement identifier with the highest matching degree with each sub-segment identifier is traversed in the intent database and replaced. All sub-segment identifiers involved in the representative identifier are reordered according to the semantic execution order to obtain an identifier array, wherein the identifier array contains several new identifiers after at least one sub-segment identifier has been replaced; The first sub-identifier of each new identifier is expanded to the left and the last sub-identifier of the new identifier is expanded to the right to obtain the expanded identifier; A semantic analysis is performed on each of the extended identifiers to obtain the broad meaning of the corresponding mining association hits.