Medication consultation method and device based on large language model

Through a large language model, rewrite, semantic analysis and optimize the sorting of drug use consultation issues, solve the problem of intricate drug recommendations in the existing technology, and achieve a more rigorous and reliable drug use recommendation generation.

CN120197622APending Publication Date: 2025-06-24SHANGHAI SHANGTANG SHANCUI MEDICAL TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510259606.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-05
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

The drug recommendation results generated by the prior art Chinese medicine consultation methods are not rigorous enough to recommend more suitable drugs to users.

Method used

By receiving and calling large language models to understand drug use consultation problems, rewriting the problem and text semantic analysis, extracting drug use consultation keywords, finding matching information based on the drug database, conducting in-depth semantic analysis and optimized sorting, and generating more rigorous drug use suggestions.

Benefits of technology

It has achieved the generation of drug recommendations that are more in line with the real consulting needs, improved the rigor and reliability of the recommendations, and can recommend applicable drugs more accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120197622A_ABST
    Figure CN120197622A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence, discloses a medication consultation method and device based on a large language model, electronic equipment, a computer readable storage medium and a computer program product, and is used for solving the problems that a medication recommendation result generated by a medication consultation method in the prior art is not strict enough; and more suitable drugs cannot be recommended to the user. The method comprises the following steps: receiving and calling a large language model to understand a first medication consultation question, and rewriting the first medication consultation question to generate a second medication consultation question; calling a large language model to perform text semantic analysis on the second medication consultation question, and extracting medication consultation keywords; searching medicine information matched with the medication consultation keyword in a pre-constructed medicine database to obtain a medicine result set; and performing deep semantic analysis based on the drug result set and the second medication consultation question, performing optimization sorting on the drug information, obtaining a target drug, and generating a suggestion reply of medication consultation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a large model-based medication consultation method, device, electronic equipment, computer storage medium and computer program product. Background Art

[0002] With the rapid development of the Internet and artificial intelligence, the medical and health field has ushered in opportunities for change, especially in drug treatment. Rational use of drugs is crucial to improving cure rates and reducing adverse reactions. However, it is difficult for ordinary patients to understand complex prescriptions and drug instructions, leading to incorrect medication. Medical medication consultation is the process of patients seeking advice on drug use from professionals. The traditional method relies on the experience of doctors or pharmacists. Although it is professional, it is inefficient and resources are unevenly distributed.

[0003] In existing technologies, since knowledge in the medical field is extremely complex and highly specialized, traditional large language models often lack in-depth medical professional background, and the generated answers may be one-sided or imprecise, resulting in the generated reply suggestions being not rigorous and reliable enough. Summary of the invention

[0004] The main purpose of the present invention is to solve the technical problem that the medication recommendation results generated by the medication consultation method in the prior art are not rigorous enough and cannot recommend more suitable drugs to users.

[0005] The first aspect of the present invention provides a medication consultation method based on a large language model, comprising:

[0006] Receiving and calling the large language model to understand the first medication consultation question, and rewriting the first medication consultation question to generate a second medication consultation question;

[0007] Calling the large language model to perform text semantic analysis on the second medication consultation question, and extracting medication consultation keywords based on the analysis result;

[0008] According to the medication consultation keywords, matching drug information is searched in a pre-built drug database to obtain a drug result set;

[0009] Calling the large language model to perform deep semantic analysis based on the drug result set and the second medication consultation question, and then optimizing and sorting the drug information in the drug result set to obtain a target drug;

[0010] A suggested response to the medication consultation is generated based on the target drug.

[0011] Optionally, in a first implementation of the first aspect of the present invention, rewriting the first medication consultation question to generate a second medication consultation question includes:

[0012] Call the large language model to identify the semantic ambiguity and potential polysemy of the first medication consultation question;

[0013] Combining the semantic ambiguity of the first medication consultation question, the potential polysemy, and the existing medical knowledge base, call the large language model to obtain the true consultation needs of the first medication consultation question through multi-level semantic reasoning;

[0014] Based on the preset standard expression rules, rewrite the question according to the true consultation needs to obtain the second medication consultation question.

[0015] Optionally, in the second implementation manner of the first aspect of the present invention, the large language model is called to perform text semantic analysis on the second medication consultation question, and the medication consultation keywords extracted based on the analysis result include:

[0016] Identify the relevant vocabulary of the second medication consultation question, where the relevant vocabulary includes drug names, patient symptoms, treatment goals, contraindications, and drug interactions;

[0017] Classify the relevant vocabulary to obtain multi-type keywords, where the multi-type keywords include drug information keywords, symptom keywords, and treatment behavior keywords;

[0018] According to the preset keyword extraction rules, select and rearrange the multi-type keywords to obtain the medication consultation keywords.

[0019] Optionally, in the third implementation manner of the first aspect of the present invention, the large language model is called to perform in-depth semantic analysis based on the drug result set and the second medication consultation question, and then optimize and sort the drug information in the drug result set to obtain the target drugs, including:

[0020] Pass the drug result set and the second medication consultation question into the large language model through embedding prompt words, and call the large language model to establish the relationship between the second medication consultation question and the drug information included in the drug result set;

[0021] By analyzing the semantic information, calculate the correlation score between each piece of drug information included in the drug result set and the second medication consultation question, and sort according to the correlation score to obtain the sequence of the target drugs corresponding to the second medication consultation question.

[0022] Optionally, in the fourth implementation manner of the first aspect of the present invention, the drug database is a multi-level structured database;

[0023] Before receiving and calling the large language model to understand the first medication consultation question, it further includes:

[0024] Collect and parse the content included in the instructions of various drugs, preprocess the data in the drug instructions, and obtain drug description information in a unified information format;

[0025] Associate multiple similar drugs according to the generic names and trade names of various drugs included in the drug description information;

[0026] Adjust the data structure of the associated drug description information, and use a retrieval model to generate index entries corresponding to the drug description information;

[0027] Call an embedding model to encode the drug description information to obtain the drug database with a multi-level structure.

[0028] Optionally, in the fifth implementation manner of the first aspect of the present invention, after generating the recommended reply for the medication consultation based on the target drug, it further includes:

[0029] Receive the feedback information of the user on the recommended reply for the medication consultation;

[0030] Generate the corrected content or supplementary explanation of the recommended reply based on the feedback information and the drug information in the drug result set.

[0031] The second aspect of the present invention provides a medication consultation device based on a large language model, including:

[0032] A rewriting module for receiving and calling a large language model to understand the first medication consultation question, and rewriting the first medication consultation question to generate a second medication consultation question;

[0033] An extraction module for calling the large language model to perform text semantic analysis on the second medication consultation question, and extracting medication consultation keywords based on the analysis result;

[0034] A query module for searching for matching drug information in a pre-constructed drug database according to the medication consultation keywords to obtain a drug result set;

[0035] A sorting module for calling the large language model to perform in-depth semantic analysis based on the drug result set and the second consultation question, and then optimizing and sorting the drug information in the drug result set to obtain the target drug corresponding to the medication consultation question;

[0036] A reply module for generating a recommended reply for the medication consultation based on the target drug.

[0037] In the third aspect of the present invention, a medication consultation device based on a large language model is provided, including: a memory and at least one processor, wherein instructions are stored in the memory; the at least one processor calls the instructions in the memory to cause the medication consultation device based on the large language model to execute the steps of the above-mentioned medication consultation method based on the large language model.

[0038] In the fourth aspect of the present invention, a computer-readable storage medium is provided, in which instructions are stored. When it runs on a computer, it causes the computer to execute the steps of the above-mentioned medication consultation method based on the large language model.

[0039] In the fifth aspect of the present invention, a computer program product is provided, including a computer program / instructions, characterized in that when the computer program / instructions are executed by a processor, the steps of the above-mentioned medication consultation method based on the large language model are implemented.

[0040] In the technical solution provided by the present invention, a large language model is received and called to understand the first medication consultation question, and the first medication consultation question is rewritten to generate a second medication consultation question; the large language model is called to perform text semantic analysis on the second medication consultation question, and medication consultation keywords are extracted based on the analysis result; according to the medication consultation keywords, matching drug information is found in a pre-constructed drug database to obtain a drug result set; the large language model is called to perform in-depth semantic analysis based on the drug result set and the second medication consultation question, and then optimize and sort the drug information in the drug result set to obtain a target drug; a recommended reply for the medication consultation is generated based on the target drug. This method can generate medication recommendations that more conform to the actual consultation needs, and the replies given can be more rigorous and reliable. Moreover, an apparatus, an electronic device, a computer-readable storage medium, and a computer program product provided by the present invention also solve the corresponding technical problems. Description of the Drawings

[0041] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation to the present application. In the drawings:

[0042] Figure 1 It is a schematic flowchart of the first embodiment of the medication consultation method based on the large language model in the embodiments of the present invention;

[0043] Figure 2 It is a schematic flowchart of the second embodiment of the medication consultation method based on the large language model in the embodiments of the present invention;

[0044] Figure 3Schematic diagram of an embodiment of the medication consultation device based on a large language model in an embodiment of the present invention;

[0045] Figure 4 Schematic diagram of another embodiment of the medication consultation device based on a large language model in an embodiment of the present invention;

[0046] Figure 5 Schematic diagram of an embodiment of the medication consultation device based on a large language model in an embodiment of the present invention;

[0047] Figure 6 Schematic diagram of the principle of a computer-readable medium in an embodiment of the present invention. Detailed implementation manners

[0048] Now, the exemplary embodiments of the present invention will be described more comprehensively with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in various forms and should not be construed as limited to the embodiments described herein. On the contrary, providing these exemplary embodiments enables the present invention to be more comprehensive and complete, and more convenient to fully convey the inventive concept to those skilled in the art. Identical reference numerals in the figures represent the same or similar elements, components, or parts, and thus their repeated description will be omitted.

[0049] On the premise of conforming to the technical concept of the present invention, the features, structures, characteristics, or other details described in a specific embodiment may not be excluded from being combined in a suitable manner in one or more other embodiments.

[0050] In the description of the specific embodiments, the features, structures, characteristics, or other details described in the present invention are for enabling those skilled in the art to fully understand the embodiments. However, it does not exclude that those skilled in the art can practice the technical solutions of the present invention without one or more of the specific features, structures, characteristics, or other details.

[0051] The flowcharts shown in the accompanying drawings are only illustrative and do not necessarily include all the contents and operations / steps, nor are they necessarily executed in the described order. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined, so the actual execution order may be changed according to the actual situation.

[0052] The block diagrams shown in the accompanying drawings are only functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0053] The term "and / or" or "and / or" includes all combinations of any one or more of the associated listed items.

[0054] Please refer to Figure 1 , the first embodiment of the medication consultation method based on a large language model in the embodiments of the present invention includes:

[0055] S101. Receive and call a large language model to understand the first medication consultation question, and rewrite the first medication consultation question to generate a second medication consultation question;

[0056] It can be understood that the execution subject of the present invention can be a medication consultation device based on a large language model, or a terminal or a server. Specifically, it is not limited here. The embodiments of the present invention will be described by taking the server as the execution subject as an example.

[0057] After receiving a medication consultation request, the server obtains the first medication consultation question included in the medication consultation request, where the first medication consultation question is the original consultation content from a patient or a user.

[0058] In the scenario of medical medication consultation, the patient's query questions often contain colloquial expressions, vague descriptions or ambiguities. These non-standardized inputs will lead to deviations in subsequent retrieval or matching. Therefore, in this embodiment, when receiving the first medication consultation question, the large language model is first called for semantic analysis and understanding, and this consultation question is rewritten to convert it into a clear and concise user query statement, obtaining the second medication consultation question.

[0059] In a specific implementation manner, the large language model is called to identify the semantic ambiguity and potential polysemy of the first medication consultation question; combining the semantic ambiguity of the first medication consultation question, the potential polysemy and the existing medical knowledge base, the large language model is called to obtain the real consultation demand of the first medication consultation question through multi-level semantic reasoning; based on a preset standard expression rule, the problem is rewritten according to the real consultation demand to obtain the second medication consultation question.

[0060] S102. Call a large language model to perform text semantic analysis on the second medication consultation question, and extract medication consultation keywords based on the analysis result;

[0061] In this embodiment, to address the knowledge deficiency and information timeliness issues of general large language models in the medical field, the drug consultation method based on large language models also incorporates the Retrieval-Augmented Generation (RAG) technology. It can retrieve information related to the question from a pre-established medical knowledge base and use the retrieved information as the context input for the large language model, thereby enhancing the understanding ability of the large language model. Among them, the medical knowledge base can be an existing open database or a database constructed by obtaining information according to actual needs in advance.

[0062] Therefore, to achieve a better retrieval effect, after rewriting to obtain the second drug consultation question, the text semantic analysis of the second drug consultation question will be performed again, and key words for this drug consultation will be extracted based on the analysis results.

[0063] In a specific implementation manner, it specifically includes identifying relevant words in the second drug consultation question, where the relevant words include drug names, patient symptoms, treatment goals, contraindications, and drug interactions; classifying the relevant words to obtain multiple types of key words, where the multiple types of key words include drug information key words, symptom key words, and treatment behavior key words; and selecting and rearranging the multiple types of key words according to a preset key word extraction rule to obtain drug consultation key words.

[0064] S103. According to the drug consultation key words, search for matching drug information in the pre-constructed drug database to obtain a drug result set;

[0065] To provide more accurate and reasonable drug recommendation results during drug consultation, a drug database is pre-constructed in this embodiment. Among them, the constructed drug database does not belong to a traditional semantic database but is a database based on structured data, which contains different hierarchical systems of drugs and can improve the retrieval accuracy and efficiency during subsequent retrieval.

[0066] Based on the drug consultation key words obtained in the previous step, search and locate in the pre-constructed drug database to obtain the drug information matching the second drug consultation question, and construct a drug result set.

[0067] S104. Call the large language model to perform in-depth semantic analysis based on the drug result set and the second drug consultation question, and then optimize the sorting of the drug information in the drug result set to obtain the target drug;

[0068] Based on the preliminary drug result set obtained in the previous step, call the large language model to conduct in-depth semantic analysis on the drug result set and the second drug consultation question, determine whether the drug information contained in each drug result set is relevant to the second drug consultation question, obtain the relevance results, and optimize the sorting of the drug information in the drug result set according to the relevance. Screen the target drug according to the sorting result.

[0069] S105. Generate a recommended reply for drug consultation based on the target drug.

[0070] Call the large language model to generate a recommended reply in natural language form based on the first drug consultation question and the obtained target drug. Moreover, when recommending drugs, generate drug usage suggestions according to the indications, drug taboos and other information recorded for the target drug in the pre-constructed drug database.

[0071] The embodiments of the present invention can rewrite the input query question, and screen out the finally used drug information according to the rewritten question in combination with the drug information contained in the pre-constructed drug database; it can also output accurate and reliable answers in the case where the input query is a fuzzy spoken expression, and can provide more suitable drugs for users or provide more accurate drug guidance for users.

[0072] Please refer to Figure 2 , the second embodiment of the drug consultation method based on the large language model in the embodiments of the present invention includes:

[0073] S201. Collect and analyze the content contained in the specifications of various drugs, preprocess the data in the drug specifications, and obtain drug description information in a unified information format.

[0074] To support the system's quick response to user queries, this embodiment needs to construct a multi-level drug database based on drug specifications. The difference between this drug database and the traditional semantic database in the prior art is that the drug database in this embodiment optimizes the drug classification and retrieval methods by introducing a more structured and refined drug hierarchy system, thereby improving the system retrieval efficiency and accuracy. Specifically, the drug database can be divided into a generic name level and a trade name level, and classify and associate similar products with different brand names, so as to construct a drug database with a clearer structure, which is convenient for faster positioning of the required information during subsequent retrieval.

[0075] In this step, when constructing the drug database, various drug instructions on the market need to be collected and parsed first. Among them, the drug instructions can be sourced from official databases and official public information in other pharmaceutical industry databases. After collecting the instructions of various drugs, the content included in the instructions of various drugs is parsed to obtain information such as the generic names, trade names, and drug attributes of various drugs. Among them, the drug attributes include dosage, indications, side effects, etc.

[0076] Subsequently, the data in the drug instructions is preprocessed to obtain drug instruction information in a unified information format. For example, the information in each instruction data is split according to structured fields and subjected to unified standardization processing to ensure the consistency and accuracy of the data.

[0077] S202. Associate multiple drugs of the same type according to the generic names and trade names of the drugs included in the drug instruction information;

[0078] In this embodiment, when constructing the drug database, a hierarchical structure of the database is established. The drug database is designed with two levels, namely the generic name level and the trade name level. Among them, the generic name usually represents the main active ingredient of the drug, and the trade name is usually the brand name used for marketing. The generic name level is based on the scientific name of the drug, and the trade name level is based on the brand name in the market. Drugs of the same type with multiple trade names are set with a unified generic name and associated with the generic name, classified according to the main ingredients of the drugs and unifiedly summarized to avoid retrieval obstacles caused by different brand names, so as to ensure the unified management of drugs of the same type in the database.

[0079] For example, the instructions of a drug contain the following information: "Generic name: Aspirin, Trade name: Bayer Aspirin", and the instructions of another drug contain the following information: "Generic name: Aspirin, Trade name: Aojina Aspirin Enteric-coated Tablets". Then, when constructing the drug database, "Bayer Aspirin" and "Aojina Aspirin Enteric-coated Tablets" are associated.

[0080] S203. Adjust the data structure of the associated drug instruction information and use a retrieval model to generate index entries corresponding to the drug instruction information;

[0081] S204. Call an embedding model to encode the drug instruction information to obtain a drug database with a multi-level structure;

[0082] Associate the associated drug description information, organize each piece of data into the structure of "drug name + drug attributes", and use a retrieval model to generate efficient index entries for the drug name and its attributes (such as dosage, specification, indications, etc.), optimizing the retrieval speed of the database. Among them, the retrieval model can generate multi-level expression indexes such as inverted index, vector space model or semantic retrieval algorithm based on deep learning to improve the hierarchy of the database. Further, the entity relationship can also be incorporated into the index by constructing a knowledge graph, thereby improving the speed and accuracy of subsequent information query based on the drug database.

[0083] In this embodiment, after constructing the index, an embedding model is also used to encode the drug features, converting the feature information of the drug into a vector representation, so as to realize the rapid positioning of the drug in a large-scale database and improve the accuracy and efficiency of retrieval. For example, the embedding model can be constructed by algorithms such as Word2vec, GloVe (Global Vectors for Word Representation), and BERT (Bidirectional Encoder Representation from Transformers).

[0084] The following is a specific example for illustration. The data of an original instruction manual is as follows:

[0085] "Generic name: Aspirin; Trade name: Bayer Aspirin; Attributes: Dosage 100mg, indications, prevention of cardiovascular diseases, contraindications, prohibited for pregnant women";

[0086] Then the index structure in the generated drug database is as follows: "Level 1: Aspirin; Level 2: Bayer Aspirin; Attributes: Dosage 100mg; Indications: Prevention of cardiovascular diseases; Contraindications: Prohibited for pregnant women".

[0087] S205. Invoke the large language model to identify the semantic ambiguity and potential polysemy of the first medication consultation question;

[0088] In the embodiment of the present invention, the server is taken as an example of the execution entity for illustration. After receiving the medication consultation request, the server obtains the first medication consultation question included in the medication consultation request, where the first medication consultation question is the original consultation content from a patient or a user.

[0089] In the scenario of medical drug consultation, the patient's query questions often contain colloquial expressions, vague descriptions, or ambiguities. These non-standardized inputs can lead to biases in subsequent retrieval or matching. Therefore, in this embodiment, when receiving the first drug consultation question, the large language model is first called for semantic analysis and understanding to identify the semantic ambiguity and potential polysemy in the first drug consultation question, so as to obtain various possible query requirements included in the drug consultation question.

[0090] S206. Combine the semantic ambiguity, potential polysemy of the first drug consultation question, and the existing medical knowledge base, and call the large language model to obtain the true consultation requirement of the first drug consultation question through multi-level semantic reasoning;

[0091] Combine the semantic ambiguity and potential polysemy of the first drug consultation question obtained in the foregoing steps, obtain the relevant information of various disease symptoms included in the existing medical knowledge base, and use the context-driven query rewriting method to deeply analyze the patient's drug use requirements; specifically, different from the prior art that only relies on simple prompt words to perform superficial rewriting of the query, this embodiment can adopt the method of embedding prompt words to call the large language model to combine the above information as the context, and obtain the true consultation requirement of the first drug consultation question through multi-level semantic reasoning.

[0092] In a specific implementation manner, the medical record information, medical history information, etc. of the user who currently proposes the first drug consultation question can also be obtained as the context information for the multi-level semantic reasoning of the large language model to match the true consultation requirement.

[0093] S207. Based on the preset standard expression rules, rewrite the question according to the true consultation requirement to obtain the second drug consultation question;

[0094] In this embodiment, standard expression rules are preset, wherein the standard expression rules may include information such as statement length limit, sentence component supplement rules, and question priority rules. Through the deep rewriting technology, the system transforms the query into a clearer, more structured, and medically standard expression, eliminates ambiguity and polysemy, and ensures that the query can be accurately matched with the system database.

[0095] For example, for a relatively vague query question such as "I've been feeling dizzy lately. Could it be related to the medication I'm taking?", the method in this embodiment will infer potential causal relationships based on the semantic relationships between medications and symptoms; adjust long sentences into short sentences that are less likely to be ambiguous according to the sentence length limit; replenish the omitted parts in the sentence components of each short sentence in the colloquial expression based on the sentence component replenishment rules; and re-adjust the order of the questions based on the question priority rules, and finally transform it into a standardized query. For example, it is adjusted to: "During the use of a certain medication by the patient, dizziness symptoms occurred. Is it caused by side effects of the medication? Does the patient need to adjust the medication dosage?"

[0096] In the rewritten query, the system transforms the patient's description into a more structured and specific expression. It clarifies the potential association between the dizziness symptom and the use of a specific medication, and at the same time clarifies the patient's core concern, that is, whether the medication dosage can be adjusted. This rewritten expression not only improves the clarity of the query but also helps the system to conduct subsequent medication consultations more accurately.

[0097] S208. Invoke the large language model to perform text semantic analysis on the second medication consultation question, and extract medication consultation keywords based on the analysis results;

[0098] Based on the second medication consultation question obtained after rewriting, identify the relevant vocabulary of the second medication consultation question. Specifically, invoke the large language model to perform semantic analysis to determine the core vocabulary included in the second medication consultation question, where the relevant vocabulary includes drug names, patient symptoms, treatment goals, contraindications, and drug interactions; for example, symptom keywords such as "dizziness" and "nausea", and treatment behavior keywords such as "dose adjustment" and "drug replacement", which will not be elaborated here.

[0099] In a specific implementation manner, after extracting the preliminary keywords, redundant or polysemous keywords will also be optimized to ensure that the extracted keywords are accurate and concise; the optimized keywords will be used for subsequent retrieval and answer generation. Specifically, first classify the relevant vocabulary to obtain multi-type keywords, where the multi-type keywords include drug information keywords, symptom keywords, and treatment behavior keywords; according to the preset keyword extraction rules, select and rearrange the multi-type keywords to obtain medication consultation keywords, where the preset keyword extraction rules may include selection weights for different types of keywords, arrangement priorities for different keywords, and other preset rules as well as simplification rules for similar keywords. In order to provide a clear direction for subsequent retrieval through the selected keywords and avoid interference from information unrelated to the query to the retrieval results.

[0100] For example, when the second medication consultation question is "During the use of a certain drug by a patient, the patient experiences dizziness. Is this caused by a drug side effect? Do we need to adjust the patient's drug dosage?", the extracted keywords are as follows: "Drug name: a certain drug", "Symptom: dizziness", and "Concern: dosage".

[0101] S209. According to the keywords of the medication consultation, search for the matching drug information in the pre-constructed drug database to obtain a drug result set;

[0102] Based on the extracted keywords of the medication consultation, perform a preliminary drug match by querying in the pre-constructed drug database, and sort according to the relevance of the query. Screen out the top k relevant entries in the sequence to construct a preliminary result set.

[0103] S210. Call the large language model to perform in-depth semantic analysis based on the drug result set and the second medication consultation question, then optimize and sort the drug information in the drug result set to obtain the target drug, and generate a recommended reply for the medication consultation based on the target drug;

[0104] After embedding the prompt words, pass the drug result set and the second medication consultation question into the large language model. Use the information contained in the drug result set and the second medication consultation question as context information to input into the large language model for understanding; establish the relationship between the second medication consultation question and the drug information contained in the drug result set through the large language model; calculate the correlation score between each piece of drug information contained in the drug result set and the second medication consultation question by analyzing semantic information, sort according to the correlation score to obtain the sequence of the target drug corresponding to the second medication consultation question, and generate a recommended reply for the medication consultation in natural language form according to the sequence of the target drug corresponding to the second medication consultation question.

[0105] For example, when the second medication consultation question is "During the use of a certain drug by a patient, the patient experiences dizziness. Is this caused by a drug side effect?", the preliminary search results for the question itself and its keywords "Drug name: a certain drug", "Symptom: dizziness" are as follows: "Indications of a certain drug: dizziness.", "Indications of a certain drug: hypertension.", etc. Based on the correlation score, this method will rank the information of the drug "Indications of a certain drug: dizziness." which is the closest to the query in the front, so as to preferentially display the answer most relevant to the query.

[0106] In a preferred embodiment, in order to further optimize the accuracy of drug recommendation, the method provided in this embodiment also includes a common drug matching scheme. Specifically, before performing the query step, it also includes obtaining the common diseases in the season or region corresponding to the current query according to the statistical information of the diseases, and preferentially recommending the information related to the common diseases.

[0107] Furthermore, it also includes a personalized label screening scheme for drugs. Specifically, before performing the query step, personalized information of the patient, such as age, weight, liver and kidney function, medication history, etc., will be obtained to construct the patient's personalized label. When matching drugs, not only will drugs be matched according to common disease information and specific disease symptoms, but the weight of the recommended drugs will also be dynamically adjusted according to the patient's personalized information. Among them, after the common drugs are matched, the system further introduces multi-dimensional label screening. In addition to traditional factors such as age and allergy history, information such as the patient's medication history, liver and kidney function, and other complications will also be analyzed to ensure that the recommended drugs are the most suitable for the patient. The system analyzes and predicts the possible reactions of the patient under different drugs through a machine learning model, and dynamically sorts the drugs when recommending drugs; when recommending drugs, the system considers multiple dimensions such as the indications of the drugs, the patient's disease history, the contraindications of the drugs, and the patient's preferences, and provides multi-level drug options. The drugs are intelligently sorted according to these dimensions, so as to ensure that the patient can obtain more appropriate and safer drug recommendations.

[0108] For example, when the information obtained by the large language model is that the patient is an elderly person and asks about cold medications, the specific screening logic is divided into the following steps: (1) Multi-dimensional common drug matching: The system first matches the common drugs for colds; (2) Personalized label screening: For the elderly population, the system will give priority to recommending drugs that do not contain side effects such as drowsiness; (3) The system further screens the drugs according to the patient's medication history and allergy history, and makes adaptive adjustments according to real-time liver and kidney function data; (4) Multi-level recommendation: The system provides multiple drug options and sorts them according to the patient's actual health status, and gives priority to recommending the most suitable drugs.

[0109] Based on the above-obtained target drugs, combined with the sorted drug information, this solution generates a personalized and detailed medication consultation answer by combining the retrieved drug data and the patient's specific situation. The system can combine information such as the patient's query content, the patient's health record, drug allergy history, and medication reaction to generate more personalized medication advice, especially in terms of drug interactions and individual differences, and the finally screened drug information, to generate a personalized, detailed and easy-to-understand answer. This answer not only includes the recommended drug name and its attributes (such as dosage, usage, indications, etc.), but also can provide corresponding medication advice and precautions according to the patient's specific situation.

[0110] S211. Receive the feedback information on the recommended reply to the medication consultation, and generate the corrected content or supplementary explanation of the recommended reply based on the feedback information and the drug information in the drug result set.

[0111] After generating a recommended response to a medication consultation, it is also possible to receive feedback information from the user regarding the recommended response to the medication consultation, obtain the user needs contained in the feedback information, adjust the response content in real time, refine the side effect description or recommend alternative medications, and, automatically adjust the dosage, frequency, and precautions of the medication recommendation based on the feedback information from the user regarding the recommended response to the medication consultation, assess the risk based on the patient's constitution and medical history, and provide preventive measures. This can refer to the patient's health record to generate a customized response to ensure the relevance and safety of the recommendation.

[0112] The solution provided in the embodiments of the present invention can rewrite the input query question, combine patient information, and screen out appropriate drug information according to the rewritten question in combination with the drug information contained in the pre-constructed drug database; it can also output accurate and reliable answers in the case where the input query is a blurred spoken expression, and through intelligent sorting of drugs considering multiple dimensions of information, it can provide more suitable drugs to the user or provide more accurate medication guidance to the user, greatly enhancing the personalization and accuracy of drug recommendation and ensuring the relevance and safety of the recommendation.

[0113] The above described the method for medication consultation based on a large language model in the embodiments of the present invention. Next, the apparatus for medication consultation based on a large language model in the embodiments of the present invention will be described. Please refer to Figure 3 , an embodiment of the apparatus for medication consultation based on a large language model in the embodiments of the present invention includes:

[0114] A rewriting module 301, configured to receive and call a large language model to understand a first medication consultation question, and rewrite the first medication consultation question to generate a second medication consultation question;

[0115] An extraction module 302, configured to call the large language model to perform text semantic analysis on the second medication consultation question, and extract medication consultation keywords based on the analysis result;

[0116] A query module 303, configured to find matching drug information in a pre-constructed drug database according to the medication consultation keywords to obtain a drug result set;

[0117] A sorting module 304, configured to call the large language model to perform in-depth semantic analysis based on the drug result set and the second medication consultation question, and then optimize the sorting of the drug information in the drug result set to obtain a target drug;

[0118] A reply module 305, configured to generate a recommended response to the medication consultation based on the target drug.

[0119] The embodiments of the present invention can rewrite the input query question, and screen out the ultimately used drug information according to the rewritten question in combination with the drug information contained in the pre-constructed drug database; it can also output accurate and reliable answers in the case of a fuzzy spoken expression of the input query, and can provide more suitable drugs for users or provide more accurate medication guidance for users.

[0120] Please continue to refer to Figure 3 and Figure 4 , in another embodiment of the present application, the rewriting module 301 is specifically configured to:

[0121] Call the large language model to identify the semantic ambiguity and potential polysemy of the first medication consultation question;

[0122] Combined with the semantic ambiguity of the first medication consultation question, the potential polysemy and the existing medical knowledge base, call the large language model to obtain the true consultation needs of the first medication consultation question through multi-level semantic reasoning;

[0123] Based on the preset standard expression rules, rewrite the question according to the true consultation needs to obtain the second medication consultation question.

[0124] In another embodiment of the present application, the extraction module 302 is specifically configured to:

[0125] Identify the relevant vocabulary of the second medication consultation question, where the relevant vocabulary includes drug names, patient symptoms, treatment goals, contraindications, and drug interactions;

[0126] Classify the relevant vocabulary to obtain multi-type keywords, where the multi-type keywords include drug information keywords, symptom keywords, and treatment behavior keywords;

[0127] According to the preset keyword extraction rules, select and rearrange the multi-type keywords to obtain medication consultation keywords.

[0128] In another embodiment of the present application, the sorting module 304 is specifically configured to:

[0129] Input the drug result set and the second medication consultation question into the large language model through embedding prompt words, and call the large language model to establish the relationship between the second medication consultation question and the drug information contained in the drug result set;

[0130] By analyzing semantic information, calculate the correlation score between each piece of drug information contained in the drug result set and the second medication consultation question, and sort according to the correlation score to obtain the sequence of the target drugs corresponding to the second medication consultation question.

[0131] In another embodiment of the present application, the drug database is a database with a multi-level structure; the drug use consultation device based on the large language model further includes a drug database construction module 306;

[0132] The drug database construction module 306 is specifically configured to collect and parse the content included in the specifications of various drugs, preprocess the data in the drug specifications, and obtain drug description information in a unified information format;

[0133] Associate multiple similar drugs according to the generic names and trade names of various drugs included in the drug description information;

[0134] Adjust the data structure of the associated drug description information, and use a retrieval model to generate index entries corresponding to the drug description information;

[0135] Call an embedding model to encode the drug description information to obtain the drug database with a multi-level structure.

[0136] In another embodiment of the present application, the drug use consultation device based on the large language model further includes a supplement module 307;

[0137] The supplement module 307 is specifically configured to receive feedback information on the recommended reply to the drug use consultation from the user;

[0138] Generate corrected content or supplementary explanations for the recommended reply based on the feedback information and the drug information in the drug result set.

[0139] The solution provided in the embodiment of the present invention can rewrite the input query question, combine patient information, and screen out appropriate drug information according to the rewritten question in combination with the drug information included in the pre-constructed drug database; it can also output accurate and reliable answers in the case where the input query is a fuzzy spoken expression, and through intelligent sorting of drugs considering multiple dimensions of information, it can provide more suitable drugs for users or provide more accurate drug use guidance for users, greatly improving the personalization and accuracy of drug recommendations, and ensuring the relevance and safety of the recommendations.

[0140] Based on the same inventive concept, the embodiment of the present specification also provides an electronic device for drug use consultation based on the large language model. The electronic device for drug use consultation based on the large language model in the embodiment of the present invention will be described in detail below from the perspective of hardware processing.

[0141] Figure 5 It is a schematic structural diagram of an electronic device provided in the embodiment of the present specification. The following refers to Figure 5 to describe the electronic device 500 according to this embodiment of the present invention. Figure 5The displayed electronic device 500 is merely an example and shall not impose any limitation on the functions and scope of use of the embodiments of the present invention.

[0142] As Figure 5 shown, the electronic device 500 is presented in the form of a general-purpose computing device. The components of the electronic device 500 may include, but are not limited to: at least one processing unit 510, at least one storage unit 520, a bus 530 connecting different system components (including the storage unit 520 and the processing unit 510), a display unit 540, etc.

[0143] Among them, the storage unit stores program code, and the program code can be executed by the processing unit 510, so that the processing unit 510 executes the steps according to various exemplary embodiments of the present invention described in the above processing method part of this specification. For example, the processing unit 510 can execute as Figure 1 or Figure 2 shown in the steps.

[0144] The storage unit 520 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 5201 and / or a cache storage unit 5202, and may further include a read-only storage unit (ROM) 5203.

[0145] The storage unit 520 may also include a program / utility 5204 having a set (at least one) of program modules 5205. Such program modules 5205 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data. The implementation of a network environment may be included in each or some combination of these examples.

[0146] The bus 530 may represent one or more of several types of bus structures, including a storage unit bus or a storage unit controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any bus structure in a variety of bus structures.

[0147] The electronic device 500 can also communicate with one or more external devices 100 (such as a keyboard, a pointing device, a Bluetooth device, etc.), and can also communicate with one or more devices that enable a user to interact with the electronic device 500, and / or communicate with any device that enables the electronic device 500 to communicate with one or more other computing devices (such as a router, a modem, etc.). Such communication can be carried out through the input / output (I / O) interface 550. Moreover, the electronic device 500 can also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through the network adapter 560. The network adapter 560 can communicate with other modules of the electronic device 500 through the bus 530. It should be understood that although Figure 5 not shown in the figure, other hardware and / or software modules can be used in combination with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0148] In addition, the present invention also provides a computer program product, including a computer program / instructions, which when executed by a processor, implements the method for drug use consultation based on a large language model described in any of the above embodiments.

[0149] Through the description of the above embodiments, those skilled in the art can easily understand that the exemplary embodiments described in the present invention can be implemented by software, or can be implemented by the way of software combined with necessary hardware. Therefore, the technical solutions according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the present invention. When the computer program is executed by a data processing device, the computer-readable medium can implement the above method of the present invention, that is: as Figure 1 or Figure 2 the method shown.

[0150] Figure 6 It is a schematic diagram of the principle of a computer-readable medium provided by the embodiments of this specification.

[0151] Implement Figure 1 or Figure 2The computer program of the method shown can be stored on one or more computer-readable media. The computer-readable media can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0152] The computer-readable storage medium can include a data signal propagated in a baseband or as part of a carrier wave, in which the readable program code is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable storage medium can also be any readable medium other than the readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination of the above.

[0153] The program code for performing the operations of the present invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and also including conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, executed as a stand-alone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, by using an Internet service provider to connect through the Internet).

[0154] In summary, the present invention can be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that general data processing devices such as microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the embodiments of the present invention. The present invention can also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present invention can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0155] The specific embodiments described above further describe the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the present invention is not inherently related to any specific computer, virtual device or electronic device, and various general devices can also implement the present invention. The above description is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

[0156] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0157] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.

[0158] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various modifications and changes can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims

1. A medication consultation method based on a large language model, characterized in that: include: Receiving and calling the large language model to understand the first medication consultation question, and rewriting the first medication consultation question to generate a second medication consultation question; Calling the large language model to perform text semantic analysis on the second medication consultation question, and extracting medication consultation keywords based on the analysis result; According to the medication consultation keywords, matching drug information is searched in a pre-built drug database to obtain a drug result set; Calling the large language model to perform deep semantic analysis based on the drug result set and the second medication consultation question, and then optimizing and sorting the drug information in the drug result set to obtain a target drug; A suggested response to the medication consultation is generated based on the target drug.

2. The medication consultation method based on a large language model according to claim 1, characterized in that: The rewriting of the first medication consultation question to generate a second medication consultation question includes: Calling the large language model to identify the semantic ambiguity and potential polysemy of the first medication consultation question; In combination with the semantic fuzziness of the first medication consultation question, the potential ambiguity and the existing medical knowledge base, the large language model is called to obtain the real consultation demand of the first medication consultation question through multi-level semantic reasoning; Based on the preset standard expression rules, the question is rewritten according to the actual consultation needs to obtain a second medication consultation question.

3. The medication consultation method based on a large language model according to claim 1, characterized in that: The calling of the large language model to perform text semantic analysis on the second medication consultation question, and extracting medication consultation keywords based on the analysis result includes: Identifying relevant words for the second medication consultation question, wherein the relevant words include drug name, patient symptoms, treatment goals, contraindications, and drug interactions; Classifying the related words to obtain multiple types of keywords, wherein the multiple types of keywords include drug information keywords, symptom keywords, and treatment behavior keywords; According to preset keyword extraction rules, the multi-type keywords are separated, selected and rearranged to obtain medication consultation keywords.

4. The medication consultation method based on a large language model according to claim 1, characterized in that: The calling of the large language model to perform deep semantic analysis based on the drug result set and the second medication consultation question optimizes and sorts the drug information in the drug result set, and obtains target drugs including: The drug result set and the second medication consultation question are passed into the large language model through embedded prompt words, and the large language model is called to establish a relationship between the second medication consultation question and the drug information included in the drug result set; By analyzing the semantic information, the correlation score between the drug information contained in each drug result set and the second medication consultation question is calculated, and the drug information is sorted according to the correlation score to obtain a sequence of target drugs corresponding to the second medication consultation question.

5. The medication consultation method based on a large language model according to claim 1, characterized in that: The drug database is a multi-level structure database; Before receiving and calling the large language model to understand the first medication consultation question, the method further includes: Collect and analyze the contents contained in the instructions of various drugs, pre-process the data in the drug instructions, and obtain drug instructions in a unified information format; Associating multiple similar drugs based on the generic names and trade names of various drugs contained in the drug description information; Adjusting the data structure of the associated drug description information, and using a retrieval model to generate index entries corresponding to the drug description information; The embedding model is called to encode the drug description information to obtain the drug database with a multi-level structure.

6. A medication consultation method based on a large language model according to any one of claims 1-5, characterized in that: After generating a suggested response to the medication consultation based on the target drug, the method further includes: Receiving feedback information from the user regarding the suggested response to the medication consultation; Based on the feedback information and the drug information in the drug result set, a correction content or supplementary description of the suggested reply is generated.

7. A medication consultation device based on a large language model, characterized in that: The medication consultation device based on the large language model includes: A rewriting module, configured to receive and call the large language model to understand the first medication consultation question, and rewrite the first medication consultation question to generate a second medication consultation question; An extraction module, configured to call the large language model to perform text semantic analysis on the second medication consultation question, and extract medication consultation keywords based on the analysis result; A query module, used to search for matching drug information in a pre-built drug database according to the drug consultation keywords, and obtain a drug result set; A sorting module, configured to call the large language model to perform deep semantic analysis based on the drug result set and the second medication consultation question, and then optimize and sort the drug information in the drug result set to obtain a target drug; A response module is used to generate a suggested response to the medication consultation based on the target drug.

8. A medication consultation device based on a large language model, characterized in that: The medication consultation device based on the large language model comprises: a memory and at least one processor, wherein the memory stores instructions; The at least one processor calls the instructions in the memory to enable the large language model-based medication consultation device to perform the steps of the large language model-based medication consultation method as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the program / instructions are executed by a processor, the steps of the medication consultation method based on a large language model as described in any one of claims 1 to 6 are implemented.

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the medication consultation method based on a large language model as described in any one of claims 1-6 are implemented.

Citation Information

Cited By

  • Emotional dialect interactive medicine taking intelligent medicine box for grassroots multi-disease coexistence old people

    CN121999959A