Medication recommendation method, system, electronic device, and storage medium

By using pharmaceutical knowledge graphs and large language models to assist pharmacists in providing personalized medication recommendations, the problem of insufficient professional knowledge among pharmacists is solved, and efficient and accurate drug recommendations are achieved.

CN119763861BActive Publication Date: 2026-02-10SHENZHEN NEPTUNE STAR TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411822077.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2026-02-10
Estimated Expiration
2044-12-11

AI Technical Summary

Technical Problem

The lack of professional qualifications among pharmacists in pharmacies leads to inaccurate drug recommendations. Existing training programs are inefficient, and generative large language models are rarely used in the pharmaceutical field. There is an urgent need for artificial intelligence to assist in drug recommendations.

Method used

By retrieving medical information corresponding to the symptom descriptions entered by users using a medical knowledge graph, and combining the dynamic updates of the user's symptom information with the output of consultation response information from a large language model, personalized medication recommendations are generated.

Benefits of technology

It improved the accuracy and efficiency of drug recommendations, reduced the risk of mis-selling and incorrect drug purchases, and enhanced user satisfaction with drug purchases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119763861B_ABST
    Figure CN119763861B_ABST
Patent Text Reader

Abstract

The application discloses a medicine recommendation method and system, an electronic device and a storage medium, relates to the technical field of large language models, and comprises the following steps: searching medical information in a preset medical knowledge graph according to symptom description information, and verifying the searched medical information; in the case that the medical information verification fails, outputting corresponding inquiry reply information through a large language model, and updating the symptom description information according to supplementary symptom description information, so as to return to the step of searching medical information based on the updated symptom description information; and in the case that the medical information verification passes, generating medicine recommendation information based on the medical information, and outputting the medicine recommendation information through the large language model. Through iterative dialogue and accurate information retrieval, the application provides more accurate and personalized medicine recommendation, reduces the risk of wrong and mistaken sales of medicines, and realizes the effect of assisting pharmacists by using artificial intelligence technology to provide professional medicine recommendation for medicine users.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of large language model technology, and in particular to a method, system, electronic device and storage medium for recommending medication. Background Technology

[0002] In recent years, hospital outpatient pharmacies have gradually begun to transform into a new model of cooperation between hospitals and pharmacies. This has brought unprecedented development opportunities and broad prospects to the pharmacy industry. However, there is still a significant shortage of licensed pharmacists, and most pharmacy staff do not have professional pharmacist qualifications. During the process of seeking medical treatment and purchasing medicine, pharmacists in stores often find it difficult to provide personalized drug recommendations based on customers' specific symptom descriptions and health conditions, leading to situations such as incorrect or mistaken sales of medicines. This exacerbates the difficulties customers face in seeking medical treatment and purchasing medicines. Therefore, while the demand for licensed pharmacists in pharmacies is increasing, the requirements for the professionalism of pharmacists are also constantly rising.

[0003] Currently, pharmacies primarily address this issue by training pharmacists with pharmaceutical-related materials. However, pharmacists often lack sufficient experience in dispensing medications and have limited pharmaceutical knowledge in the early stages. With the development of generative large language models, more and more pharmaceutical professionals are recognizing the impact and empowerment of AI technology on the industry. However, relevant pharmaceutical data and practical applications are still limited, and most focus on the biomedical field. There remains significant room for development in the medication dispensing process, which urgently needs in-depth exploration and development.

[0004] Therefore, how to use artificial intelligence technology to assist pharmacists and provide professional medication recommendations to patients is an urgent problem to be solved. Summary of the Invention

[0005] The main purpose of this application is to provide a medication recommendation method, system, electronic device, and storage medium, aiming to solve the technical problem of how to use artificial intelligence technology to assist pharmacists in providing professional medication recommendations to medication users.

[0006] To achieve the above objectives, this application proposes a medication recommendation method, which includes:

[0007] Receive input symptom description information and retrieve corresponding medical information from a preset medical knowledge graph based on the symptom description information;

[0008] The medical information is verified. If the medical information fails the verification, a pre-trained large language model outputs the consultation response information corresponding to the symptom description information based on the medical information.

[0009] If supplementary symptom description information is received based on the consultation response information, the symptom description information is updated according to the supplementary symptom description information, and the step of retrieving corresponding medical information in the preset medical knowledge graph based on the updated symptom description information is returned.

[0010] If the medical information passes the verification, medication recommendation information is generated based on the medical information, and the medication recommendation information is output through the large language model.

[0011] In one embodiment, the preset medical knowledge graph records the pairwise relationships between symptoms, diseases, and drugs. The step of retrieving corresponding medical information from the preset medical knowledge graph based on the symptom description information includes:

[0012] The symptoms corresponding to the symptom description information are determined by the large language model, and the target disease and target drug are retrieved in the preset medical knowledge graph based on the symptoms;

[0013] The target disease and the target drug are used as the medical information.

[0014] In one embodiment, the step of retrieving the target disease and target drug from a preset medical knowledge graph based on the symptoms includes:

[0015] Receive the input medication user's identity information and obtain the corresponding medication purchase record based on the medication user's identity information;

[0016] Identify the historical medications in the purchase records, and based on the symptoms and the historical medications, retrieve the target disease and target medication from a preset medical knowledge graph.

[0017] In one embodiment, the medication recommendation method further includes:

[0018] Acquire a collection of medical and pharmaceutical data, and perform named entity recognition on the collection to obtain the symptoms, diseases, drugs, and their interrelationships in the collection. The interrelationships include the pairwise relationships between any two symptoms, diseases, and drugs.

[0019] Based on the symptoms, diseases, drugs, and their interrelationships, the preset medical knowledge graph is constructed.

[0020] In one embodiment, after the step of constructing the preset medical knowledge graph, the method further includes:

[0021] Obtain a supplementary set of medical-related data, and merge the supplementary set of medical-related data with the original set of medical-related data to obtain a new set of medical-related data;

[0022] Based on the new medical-related data set, the step of performing named entity recognition on the medical-related data set is returned to update the preset medical knowledge graph.

[0023] In one embodiment, the medication recommendation method further includes:

[0024] Acquire consultation dialogue data and adjust the structure of the consultation dialogue data according to the data format corresponding to the large language model;

[0025] The pre-trained large language model is obtained by fine-tuning the pre-set large language model based on the structured consultation dialogue data.

[0026] In one embodiment, the preset large language model integrates a LoRA layer, and the step of fine-tuning the preset large language model based on the structure-adjusted consultation dialogue data to obtain the pre-trained large language model includes:

[0027] The preset large language model is trained based on the consultation dialogue data after the structure adjustment, and the parameters in the LoRA layer are adjusted during the training process to obtain the preset large language model after LoRA layer parameter adjustment.

[0028] By performing reinforcement learning on the pre-set large language model after adjusting the parameters of the LoRA layer using a pre-set reward function, a consciousness-aligned pre-set large language model is obtained, and the consciousness-aligned pre-set large language model is used as the pre-trained large language model.

[0029] In addition, to achieve the above objectives, this application also proposes a medication recommendation system, which includes a user terminal and a server terminal, wherein the server terminal is configured with a pre-trained large language model;

[0030] The user terminal is used to receive input symptom description information and supplementary symptom description information, and transmit the symptom description information and supplementary symptom description information to the server, wherein the supplementary symptom description information is input based on the consultation response information output by the server;

[0031] The server is used to retrieve corresponding medical information from a preset medical knowledge graph based on the symptom description information;

[0032] The medical information is verified. If the medical information fails the verification, a pre-trained large language model outputs the consultation response information corresponding to the symptom description information to the user terminal based on the medical information.

[0033] If the user receives supplementary symptom description information transmitted based on the consultation response information, the symptom description information is updated according to the supplementary symptom description information, and the step of retrieving corresponding medical information in the preset medical knowledge graph based on the updated symptom description information is returned.

[0034] If the medical information passes the verification, medication recommendation information is generated based on the medical information, and the medication recommendation information is output to the user terminal through the large language model.

[0035] In addition, to achieve the above objectives, this application also proposes an electronic device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the medication recommendation method as described above.

[0036] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps of the medication recommendation method described above.

[0037] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the medication recommendation method as described above.

[0038] One or more technical solutions proposed in this application have at least the following technical effects:

[0039] This application first receives input symptom description information and retrieves corresponding medical information from a preset medical knowledge graph based on the symptom description information. This allows for rapid and accurate retrieval of relevant medical information based on the user's input symptom description information using a preset medical knowledge graph model, improving the targeting and efficiency of drug recommendations. The medical information is then validated. If the validation fails, a pre-trained large language model outputs a consultation response based on the symptom description information. This consultation response guides the user to further clarify their symptoms when faced with too many possible medical information, thereby narrowing the scope of medical information retrieval and improving the accuracy of drug recommendations. If a request is received based on the input symptom description information... If the user provides supplementary symptom descriptions in the consultation response, the system updates the symptom descriptions based on these supplementary descriptions. Then, based on the updated symptom descriptions, it retrieves corresponding medical information from a pre-defined medical knowledge graph. By continuously collecting supplementary symptom information from users, the retrieval of medical information becomes more accurate, better meeting users' personalized needs for medications. If the medical information passes verification, medication recommendations are generated based on the medical information and output through the large language model. This provides users with clear medication recommendations, avoiding the difficulty of choosing due to too many options and improving the user's medication purchase experience.

[0040] In summary, this application avoids the problem of inaccurate drug recommendations caused by pharmacists' insufficient professional knowledge or experience by using a method that retrieves medical information corresponding to the user's input symptom description from a medical knowledge graph, combined with dynamic updates of the user's symptom information and relevant verification of the retrieved medical information. Based on the user's input symptom description, it provides more accurate and personalized medication recommendations through iterative dialogue and precise information retrieval, thereby improving the efficiency of drug recommendations and user satisfaction. It also reduces the risk of mis-selling or incorrectly selling drugs, thus achieving the effect of using artificial intelligence technology to assist pharmacists in providing professional medication recommendations to users. Attached Figure Description

[0041] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0042] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0043] Figure 1 This is a flowchart illustrating the recommended medication method in Example 1 of this application.

[0044] Figure 2 This is a flowchart illustrating Example 2 of the recommended medication method in this application.

[0045] Figure 3 A simplified flowchart illustrating the medication recommendation method provided in Embodiment 2 of this application;

[0046] Figure 4 A schematic diagram illustrating a scenario for the medication recommendation method provided in Embodiment 2 of this application;

[0047] Figure 5 This is a schematic diagram of the module structure of the medication recommendation system in an embodiment of this application;

[0048] Figure 6 This is a schematic diagram of the hardware operating environment involved in the medication recommendation method in the embodiments of this application.

[0049] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0050] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0051] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0052] The main solution of this application embodiment is as follows: receiving input symptom description information, and retrieving corresponding medical information from a preset medical knowledge graph based on the symptom description information; verifying the medical information, and if the medical information fails the verification, outputting consultation response information corresponding to the symptom description information based on the medical information using a pre-trained large language model; if supplementary symptom description information is received based on the consultation response information, updating the symptom description information based on the supplementary symptom description information, and returning to the step of retrieving corresponding medical information from the preset medical knowledge graph based on the updated symptom description information; if the medical information passes the verification, generating medication recommendation information based on the medical information, and outputting the medication recommendation information through the large language model.

[0053] Due to a significant shortage of licensed pharmacists and the fact that most pharmacy staff lack professional pharmacist qualifications, pharmacists often struggle to provide personalized medication recommendations based on customers' specific symptoms and health conditions. This leads to errors in medication dispensing and other misuse, exacerbating the difficulties customers face in accessing medical care and purchasing medications. Consequently, while the demand for licensed pharmacists is increasing, the required level of professional expertise among them is also rising. Currently, pharmacies primarily address this issue by training pharmacists with pharmaceutical-related materials. However, pharmacists often lack sufficient experience in dispensing medications and have limited pharmaceutical knowledge in the early stages. With the development of generative large language models, more and more pharmaceutical professionals are recognizing the impact and empowerment of AI technology in the pharmaceutical industry. However, relevant pharmaceutical data and practical applications are still limited, primarily focusing on the biomedical field. Significant untapped potential remains in the dispensing process, requiring in-depth exploration and development. Therefore, how to utilize artificial intelligence technology to assist pharmacists and provide professional medication recommendations to patients is a pressing issue that needs to be addressed.

[0054] This application provides a solution that retrieves medical information corresponding to user-inputted symptom descriptions from a medical knowledge graph. By combining this with dynamic updates to the user's symptom information and relevant verification of the retrieved medical information, it avoids inaccurate drug recommendations caused by pharmacists' insufficient professional knowledge or experience. Based on the user's input symptom descriptions, it provides more accurate and personalized medication recommendations through iterative dialogue and precise information retrieval, thereby improving the efficiency of drug recommendations and user satisfaction. It also reduces the risk of incorrect or accidental drug sales, ultimately achieving the effect of using artificial intelligence technology to assist pharmacists in providing professional medication recommendations to users.

[0055] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device capable of performing the above functions. The following description uses an electronic device as an example to illustrate this embodiment and the subsequent embodiments.

[0056] Based on this, the embodiments of this application provide a method for recommending medication, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the drug recommendation method of this application.

[0057] In this embodiment, the medication recommendation method includes steps S10 to S40:

[0058] Step S10: Receive the input symptom description information, and retrieve the corresponding medical information in the preset medical knowledge graph based on the symptom description information;

[0059] It should be noted that symptom description information refers to words, phrases, or sentences used by users to describe their symptoms or discomfort, such as "headache," "fever," "runny nose," "fever up to 39 degrees Celsius, with persistent headache and cough," etc. These can be symptom prompts selected by the user or text content freely entered by the user. This embodiment does not specifically limit the types of symptom description information. The preset medical knowledge graph refers to a relationship network that includes medical knowledge such as symptoms, diseases, drugs, and the relationships between symptoms, diseases, drugs, and other medical entities, capable of representing the complex relationships and attributes between these entities. Medical information refers to information such as the names of relevant diseases, potentially applicable drugs, usage and dosage, precautions, and the probability of disease, retrieved from the medical knowledge graph based on the user's symptom description information.

[0060] Understandably, since inexperienced pharmacists often struggle to recommend accurate medication information based on the symptoms described by the patient, step S10 avoids inaccurate drug recommendations due to insufficient pharmacist expertise. By retrieving the corresponding medical information from the medical knowledge graph, a reliable data foundation is provided for quickly determining personalized drug recommendations.

[0061] For example, a user selects the corresponding symptom option and enters a symptom prompt such as "cough" in the user-side chat interface. The system then sends the symptom prompt to the server, where a pre-trained large language model analyzes the input symptom prompt and retrieves all medical information related to "cough" from a pre-set medical knowledge graph.

[0062] For example, a user verbally describes symptoms, such as "I have a sore throat," through a user-end voice assistant device. The voice assistant converts the speech into text-based symptom description information and transmits it to the server. The server then uses a large language model to retrieve matching medical information from a pre-defined medical knowledge graph based on the text-based symptom description information.

[0063] In one feasible implementation, the preset medical knowledge graph records the pairwise relationships between symptoms, diseases, and drugs. Step S10, which involves retrieving corresponding medical information from the preset medical knowledge graph based on the symptom description information, may include steps S11 to S12:

[0064] Step S11: Determine the symptoms corresponding to the symptom description information through the large language model, and retrieve the target disease and target drug in the preset medical knowledge graph based on the symptoms;

[0065] It should be noted that the target disease refers to the corresponding disease record recorded in the medical knowledge graph, which is inferred by the system based on the symptom description information entered by the user and the search results of the medical knowledge graph; the target drug refers to the drug recommended by the system for treating or alleviating the target disease, based on the entities in the medical knowledge graph and the relationships between entities.

[0066] Understandably, step S11 is necessary because it requires converting users' non-professional symptom descriptions into standard medical symptoms and inferring possible diseases and corresponding treatments. This avoids incorrect drug recommendations due to vague or inaccurate user symptom descriptions and prevents automated drug recommendations based on symptoms. By accurately identifying symptoms, the accuracy and relevance of drug recommendations are improved.

[0067] For example, after receiving symptom description information, the server-side large language model first performs semantic analysis, mapping the user's natural language description to standard medical symptom terms, such as mapping "fever" and "high body temperature" to the symptom "fever". Next, the large language model searches a pre-defined medical knowledge graph for disease nodes associated with these standard symptom terms. Nodes in the medical knowledge graph may include entities representing various symptoms, diseases, and medications, while edges represent the relationships between these entities. The large language model identifies disease entities (such as "influenza") related to the symptom in the medical knowledge graph as the target disease, and medication entities (such as "a certain antiviral drug" or "a certain antipyretic drug") related to the symptom as the target medication.

[0068] In one feasible implementation, the step of retrieving the target disease and target drug from a preset medical knowledge graph based on the symptoms in step S11 may include steps S111 to S112:

[0069] Step S111: Receive the input medication user identity information and obtain the corresponding medication purchase record based on the medication user identity information;

[0070] It should be noted that user identity information refers to data that can uniquely identify a user, such as name, ID number, user account, etc.; purchase records refer to a user's drug purchase history over a period of time, including information such as the name, quantity, and purchase time of the drugs purchased.

[0071] Understandably, step S111 is performed in order to understand the user's medication history and provide more personalized services. This avoids inappropriate drug recommendations caused by ignoring the user's medication history, and allows for more personalized drug recommendations based on the user's medication habits and needs.

[0072] Step S112: Determine the historical drugs in the purchase record, and search for the target disease and target drug in the preset medical knowledge graph based on the symptoms and the historical drugs.

[0073] It should be noted that historical medications refer to medications that appeared in the user's past medication purchase records, and these medications may be related to the user's current symptoms.

[0074] Understandably, step S112 is performed to recommend suitable medications more accurately by combining the user's historical medication history. This avoids recommending medications based solely on current symptoms while ignoring potential interactions or duplicate medication issues arising from the user's past medication history. By comprehensively considering the user's past medication history and current symptoms, more accurate and safer medication recommendations are provided.

[0075] For example, the system server first extracts historical drug information from the user's medication purchase records, including drug names and purchase times. Then, the system server combines the user's currently input symptoms with this historical drug information and uses a pre-set medical knowledge graph to perform a search. Through the disease-symptom-drug relationship in the graph, the system finds target diseases and target drugs that match the user's symptoms and historical medication history. In this way, the system can more comprehensively consider the user's personal medication history and improve the safety and accuracy of drug recommendations.

[0076] In this embodiment, by combining the user's historical medication history, the problems of inaccurate drug recommendations and potential drug interaction risks caused by the lack of a user's personal medication history are avoided. This enables more accurate and personalized drug recommendations based on the user's individual medication history and current symptoms, thereby improving medication safety and the accuracy of medication recommendations.

[0077] Step S12: The target disease and the target drug are used as the medical information.

[0078] In this embodiment, a pre-trained large language model retrieves corresponding diseases and drugs from the medical knowledge graph based on the input symptom description information. This avoids the problem of inappropriate drug recommendations caused by insufficient professional knowledge of pharmacists or inaccurate symptom descriptions by users. It realizes the accurate transformation of non-professional symptom descriptions of drug users into medical symptoms, and provides medical information that matches the user's condition through deep association analysis of the medical knowledge graph. This provides a reliable data foundation for improving the personalization and safety of drug recommendations.

[0079] Step S20: The medical information is tested. If the medical information fails the test, the pre-trained large language model outputs the consultation response information corresponding to the symptom description information based on the medical information.

[0080] It should be noted that the consultation response information refers to the questions generated by the system based on the symptom description information entered by the user, which are used to further inquire about the user's condition, such as "Have you been in contact with anyone who has a cold or flu recently?", "Did your symptoms appear suddenly or gradually worsen?", "Besides fever, cough and headache, do you have any other symptoms?", etc.

[0081] Understandably, after the large language model verifies the retrieved medical information, the current retrieved medical information may be quite complex, and some medical information may not conform to medical knowledge related to the symptom information. Therefore, it is necessary to further clarify the user's symptom information. Hence, step S20 is performed, which guides the user to further improve their symptom description or medication needs through the output consultation response information. This can avoid the problem of the medical information retrieved from the medical knowledge graph being too complex, thereby narrowing the scope of medical information retrieval by outputting consultation response information and improving the accuracy of medical information retrieval.

[0082] For example, medical information (such as symptoms) in the medical knowledge graph is assigned corresponding weights. For instance, the symptom "fever" is assigned a weight of 0.02, the symptom "palpitation" is assigned a weight of 0.45, and the symptom "sudden death" is assigned a weight of 0.75. When the large language model identifies "fever" as the symptom description information entered by the user, and the weight of the symptom 0.02 is found to be less than the preset threshold of 0.7, the retrieved medical information is deemed to have failed the test. Then, the large language model outputs the corresponding consultation response information to the user in text form based on the medical information retrieved based on "fever".

[0083] For example, the large language model on the server analyzes and judges the content of the retrieved medical information. If the model detects that the medical information contains contradictions, is incomplete, or does not conform to common clinical sense, it determines that the medical information fails the test. At this time, the large language model will generate a series of targeted consultation questions based on this medical information and the symptom description information, and output these consultation responses to the user in text form, so that pharmacists or customers can further supplement or clarify the symptom description based on these questions, thereby improving the accuracy of medication recommendations.

[0084] Step S30: If supplementary symptom description information is received based on the consultation response information, the symptom description information is updated according to the supplementary symptom description information, and the step of retrieving corresponding medical information in the preset medical knowledge graph based on the updated symptom description information is returned.

[0085] It should be noted that supplementary symptom description information refers to additional symptom information provided by the user based on the system's consultation response information, used to more accurately describe their condition. For example: based on the consultation response information "Have you been in contact with anyone who has a cold or flu recently?", the supplementary symptom prompt entered is "No"; based on the consultation response information "Did these symptoms appear suddenly or gradually worsen?", the supplementary symptom prompt entered is "Gradually worsening"; based on the consultation response information "Besides fever, cough, and headache, do you have any other symptoms?", the supplementary symptom prompt entered is "Sore throat, sneezing, runny nose".

[0086] Understandably, step S30 is necessary to make more accurate drug recommendations based on more detailed symptom information from users. This avoids the problem of recommending too many drugs or making biased recommendations due to insufficient symptom descriptions. It also improves the accuracy of drug recommendations through iterative dialogue with users.

[0087] For example, based on the consultation response information returned by the server and displayed on the user's end, "Have you been in contact with anyone who has a cold or flu recently?", the user provides supplementary symptom prompts on the user's end, such as "No". The system server then combines the original symptom prompts "fever, cough, headache" with the supplementary symptom prompt "No" to generate new symptom prompts "fever, cough, headache, no contact with anyone who has a cold or flu". The system server then uses the new symptom prompts to retrieve more accurate medication recommendations from the large language model.

[0088] Step S40: If the medical information passes the verification, medication recommendation information is generated based on the medical information, and the medication recommendation information is output through the large language model.

[0089] Understandably, since the filtered drug recommendations are already accurate enough under the control of the threshold (i.e., the preset quantity) and can be directly presented to the user, step S40 can avoid the problem of user confusion caused by providing too much drug recommendation information, thereby simplifying the user's decision-making process and optimizing the user's drug purchase experience.

[0090] For example, medical information (such as symptoms) in the medical knowledge graph is assigned corresponding weights. For instance, the symptom "fever" is assigned a weight of 0.02, the symptom "palpitation" is assigned a weight of 0.45, and the symptom "sudden death" is assigned a weight of 0.75. When the large language model identifies the symptom description information entered by the user as "sudden death", if the weight of the symptom 0.75 is found to be greater than or equal to the preset threshold of 0.7, the retrieved medical information is deemed to have passed the test. Then, based on the medical information retrieved from the medical knowledge graph for the symptom "sudden death", medication recommendation information is generated and displayed to the user through the large language model, providing it to pharmacists or customers.

[0091] For example, the system server will automatically generate a medication recommendation message based on verified pharmaceutical information, combined with logical relationships and medication rules in a pre-defined pharmaceutical knowledge graph. This message will include detailed information such as recommended medications, dosages, frequency of use, and precautions. Subsequently, this recommendation message will be input into a pre-trained large language model. The model will format and optimize the information to ensure that the output is linguistically accurate and easy to understand. Finally, the large language model will output the recommendation message in text or speech format to pharmacists or customers, enabling them to make appropriate medication selections and use based on these suggestions.

[0092] This embodiment provides a medication recommendation method. By retrieving medical information corresponding to the user's input symptom description from a medical knowledge graph, and combining this with dynamic updates to the user's symptom information and relevant verification of the retrieved medical information, it avoids the problem of inaccurate medication recommendations caused by insufficient professional knowledge or experience of pharmacists. Based on the user's input symptom description, it can provide more accurate and personalized medication recommendations through iterative dialogue and precise information retrieval, thereby improving the efficiency of medication recommendations and user satisfaction. It also reduces the risk of mis-selling or incorrectly selling medications, thus achieving the effect of using artificial intelligence technology to assist pharmacists in providing professional medication recommendations for users.

[0093] In one feasible implementation, the medication recommendation method may further include steps S100 to S200:

[0094] Step S100: Obtain a collection of medical-related data and perform named entity recognition on the collection of medical-related data to obtain each symptom, each disease, each drug and their interrelationships in the collection of medical-related data, wherein the interrelationships include the relationship between any two symptom, any disease and any drug.

[0095] It should be noted that a collection of pharmaceutical-related data refers to a database or dataset containing various pharmaceutical information, such as medical literature, drug instructions, and clinical guidelines; named entity recognition refers to identifying specific entities from text data, such as the names of symptoms, diseases, and drugs; and interrelationships refer to the associations between symptoms, diseases, and drugs, such as a symptom being related to a certain disease, or a disease potentially requiring specific drug treatment.

[0096] Understandably, since it is necessary to extract useful information from unstructured medical data to construct a knowledge graph, step S100 is performed to avoid the problems of difficulty in information extraction and low accuracy caused by unstructured data. This enables the accurate identification of key entities and their interrelationships from a large amount of medical data, providing effective and reliable structured data for constructing a knowledge graph.

[0097] For example, web scraping technology is used to collect pharmaceutical-related data from sources such as medical literature, drug instructions, and electronic health records, forming a pharmaceutical-related data set. Next, natural language processing tools are used to preprocess this data set, including text cleaning, word segmentation, and part-of-speech tagging. Then, named entity recognition algorithms (such as Conditional Random Fields, deep learning-based BiLSTM-CRF models, etc.) are applied to identify entities such as symptoms, diseases, and drugs. Simultaneously, entity relation extraction techniques (such as dependency parsing or relation extraction models) are used to determine the relationships between entities, such as the causal relationship between symptoms and diseases, and the treatment relationship between diseases and drugs. Finally, these entities and their relationships are stored as structured data, providing foundational information for constructing a pharmaceutical knowledge graph.

[0098] Step S200: Based on the symptoms, diseases, drugs, and their interrelationships, construct the preset medical knowledge graph.

[0099] Understandably, since it is necessary to organize the extracted entities and their relationships into a structured knowledge system to facilitate efficient knowledge retrieval and reasoning, step S200 is performed. This avoids the problems of low knowledge utilization efficiency and insufficient reasoning ability caused by the lack of a systematic knowledge structure, and realizes the construction of a comprehensive and systematic medical knowledge graph that can support complex query and reasoning tasks, thereby improving the accuracy and efficiency of drug recommendations.

[0100] In this embodiment, by employing a named entity recognition algorithm, entity relationships between various diseases, symptoms, and drugs are established, forming a medical knowledge graph for intelligent consultation. This avoids the problems of data utilization difficulties, inaccurate knowledge extraction, and incomplete knowledge association caused by the unstructured and fragmented nature of medical information. It enables the efficient extraction of entities such as symptoms, diseases, and drugs and their interrelationships from a large amount of medical-related data, and constructs a structured and semantically rich medical knowledge graph. This improves the intelligence level and accuracy of the drug recommendation system, providing a reliable data foundation for personalized and precise drug recommendations.

[0101] In one feasible implementation, steps S200 may be followed by steps S300 to S400:

[0102] Step S300: Obtain a supplementary set of medical-related data, and merge the supplementary set of medical-related data with the original set of medical-related data to obtain a new set of medical-related data;

[0103] It should be noted that supplementary medical data collections refer to medical information obtained from additional data sources. These data may include the latest medical research, drug listing information, patient feedback, epidemiological reports, etc., which supplement and expand upon the original medical data collections.

[0104] Understandably, since medical knowledge is constantly being updated and developed, new data needs to be introduced regularly to maintain the timeliness and completeness of the knowledge graph. Therefore, performing step S300 can avoid the problem of inaccurate and outdated knowledge graphs caused by outdated or incomplete data, thereby ensuring that the medical knowledge graph can reflect the latest medical information and improve the accuracy and reliability of drug recommendations and medical decisions.

[0105] Step S400: Based on the new medical-related data set, return to the step of performing named entity recognition on the medical-related data set to update the preset medical knowledge graph.

[0106] Understandably, since the addition of new data necessitates the re-identification and extraction of entities and their relationships to update the medical knowledge graph, step S400 avoids the problem of outdated or inaccurate information in the medical knowledge graph, thus maintaining the dynamic updating of the medical knowledge graph and ensuring that the system can provide personalized medication recommendations and services based on the latest medical knowledge.

[0107] In this implementation, by performing data fusion and incremental updates, the problems of outdated knowledge graphs and missing important medical information caused by untimely updates of medical knowledge are avoided. Dynamic maintenance and updates of the medical knowledge graph are achieved, ensuring its timeliness and accuracy, thereby improving the intelligence level and decision support capabilities of the drug recommendation system. Furthermore, by conveniently updating only the medical knowledge graph within the large language model without modifying the underlying framework, rapid updates and iterations of medical information can be achieved, improving the convenience of updating medical information in practical applications.

[0108] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in Embodiment 1 above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2 The medication recommendation method further includes steps S01 to S02:

[0109] Step S01: Obtain the consultation dialogue data and adjust the structure of the consultation dialogue data according to the data format corresponding to the large language model;

[0110] It should be noted that consultation dialogue data refers to the dialogue records between patients and doctors, including the patient's symptom descriptions, the doctor's questions and answers, etc.; data format refers to the data structure that the large language model can accept and process, which usually includes specific fields and serialization methods.

[0111] Additionally, it should be noted that the consultation dialogue data may also include user evaluations of the consultation response information output by the large language model. This evaluation can be implemented through the evaluation function configured on the user's end when the large language model outputs each consultation response information. This evaluation can be used to guide the process of fine-tuning the large language model.

[0112] Understandably, since consultation dialogue data is usually unstructured and needs to be converted into a format that large language models can understand, step S01 is necessary to avoid the problem that large language models cannot correctly process consultation dialogue data due to data format mismatch. This ensures that consultation dialogue data can be effectively utilized by large language models, thereby providing accurate basic data for subsequent model training and medication recommendations.

[0113] For example, firstly, patient-doctor consultation dialogue data is extracted from hospital information systems, online medical service platforms, or electronic health records. This data includes text-based dialogue records. Next, Natural Language Processing (NLP) techniques, such as regular expressions, syntactic analyzers, and entity recognition tools, are used to parse the raw consultation dialogue data, extracting key information such as patient symptoms, doctor's diagnosis, and treatment plan. Then, this extracted information is reorganized according to the input format required by the server-side large language model. For example, the raw consultation dialogue data is converted into JSON or XML format, containing predefined fields such as "symptom description" and "doctor's advice," to ensure that the data can be correctly read and processed by the large language model.

[0114] Step S02: Fine-tune the preset large language model based on the structure-adjusted consultation dialogue data to obtain the pre-trained large language model.

[0115] Understandably, since pre-trained large language models may not possess specific medical vertical domain knowledge, fine-tuning is needed to adapt them to specific medical scenarios. Therefore, performing step S02 can avoid the problem of inaccurate medication recommendations due to the model's inability to adapt to specific medical vertical domains. Fine-tuning enables the large language model to better understand and process medical consultation dialogues, thereby improving the targeting and accuracy of medication recommendations.

[0116] For example, after adjusting the data structure, this structured data is used as a training dataset to fine-tune a pre-trained large language model. Specific operations may include setting appropriate training parameters, such as learning rate, batch size, and number of iterations, as well as a designated target layer for the large language model (determined based on the selected large language model). Then, the model is trained several times using backpropagation and gradient descent to optimize its performance in a specific medical vertical domain's consultation process. During fine-tuning, the focus is on the model's understanding of medical-related vocabulary and concepts, and its ability to process the context of consultation dialogues. Ultimately, fine-tuning yields a pre-trained large language model adapted to a specific medical vertical domain's consultation scenario, enabling it to more accurately understand and generate medical-related text information.

[0117] In one feasible implementation, the preset large language model integrates a LoRA layer, and step S02 may include steps S021 to S022:

[0118] Step S021: Train the preset large language model based on the consultation dialogue data after the structure adjustment, and adjust the parameters in the LoRA layer during the training process to obtain the preset large language model after the LoRA layer parameter adjustment.

[0119] It should be noted that the LoRA layer refers to a specific layer used for low-rank adaptation in a large language model. It adjusts the model's behavior by introducing a set of low-rank matrices, enabling the model to quickly adapt to a specific task without changing the original pre-training parameters. The parameters in the LoRA layer refer to the elements in these low-rank matrices.

[0120] Understandably, in order to quickly adapt to specific tasks without retraining the entire model, step S021 is performed. By introducing the LoRA layer, the high computational cost and time consumption caused by large-scale pre-training can be avoided, thereby improving the performance and generalization ability of the large language model in specific medical fields.

[0121] For example, first, consultation dialogue data is collected and structured, and then fed into a large language model. During training, the focus is on the parameters of the LoRA layer, and optimization algorithms such as gradient descent are used to fine-tune the parameters until the model's performance on consultation dialogue data reaches a preset standard.

[0122] Step S022: Perform reinforcement learning on the preset large language model after adjusting the parameters of the LoRA layer through a preset reward function to obtain a consciousness-aligned preset large language model, and use the consciousness-aligned preset large language model as the pre-trained large language model.

[0123] It should be noted that the preset reward function is a function used to evaluate the quality of the model's output. It can score the model based on factors such as the accuracy, relevance, and fluency of the consultation response information generated by the model. Reinforcement learning is a machine learning method that uses reward and punishment mechanisms to guide the model to learn how to make optimal decisions in a specific environment. The consciousness-aligned preset large language model refers to a large language model that, after being adjusted by reinforcement learning, can generate responses that conform to the professional knowledge and user needs of a specific medical vertical field.

[0124] Understandably, in order to further optimize the model's behavior and ensure that the responses generated by the model are not only accurate but also meet professional standards and user needs, step S022 is performed. This avoids the problem of the model generating irrelevant or inaccurate responses, thereby improving the model's professionalism and practicality in dialogues within specific medical verticals.

[0125] For example, after the LoRA layer parameters are adjusted, a reward function is defined to provide feedback on the effectiveness of the consultation responses generated by the model. Using reinforcement learning algorithms, such as policy gradient or Q-learning, the model attempts to generate responses in a simulated environment and adjusts its policy based on the feedback from the reward function. After multiple iterations, the model learns to generate responses aligned with professional knowledge and user needs, ultimately forming a pre-defined large language model aligned with user awareness. This model can then be deployed to a server to assist pharmacists in conducting consultations or providing patient counseling services.

[0126] In this embodiment, the model is trained based on the restructured consultation dialogue data. Simultaneously, LoRA layer parameter updates and reinforcement learning algorithms are combined to achieve intent alignment of the large language model. This avoids the problem of inaccurate consultation response information caused by insufficient or excessive training of the large language model. It enables the large language model to better and faster adapt to the specific task requirements of consultations in specific medical vertical fields while retaining its original broad medical knowledge. This enhances the large language model's personalized natural language processing capabilities in vertical applications, while also improving the accuracy and adaptability of its responses in medical consultation scenarios. This ensures the model achieves the preset performance indicators, thereby increasing the model's practical application value.

[0127] In this embodiment, the large language model is fine-tuned based on real medical consultation dialogue data, avoiding the problems of incompatibility between the original medical consultation dialogue data and the large language model, as well as the insufficient generalization ability of the model when applied in specific medical vertical fields. This achieves the effect of transforming unstructured medical dialogue data into a form that the model can process, and improving the model's professionalism and the accuracy of medication recommendations in specific medical vertical fields.

[0128] For example, to help understand the implementation flow of the medication recommendation method obtained in this embodiment combined with the above embodiment one, please refer to... Figure 3 , Figure 3 A simplified flowchart of a medication recommendation method is provided, specifically:

[0129] First, a medication recommendation system identifies user intent and collects data, including a collection of medicine-related data such as disease names, symptoms, drug names and descriptions, and precautions. Then, named entity recognition is performed on the collected data, including data extraction, information extraction, and data structuring, resulting in a medical knowledge graph. This knowledge graph records disease entities, symptom entities, drug entities, and the pairwise relationships between them. The knowledge graph supports knowledge updates, meaning it can be integrated and supplemented with other medicine-related data. A pre-set generative large language model is then fine-tuned, including using multi-turn real-world consultation dialogue data and using reinforcement learning to align the model's intent. In practical application, based on Prompt word engineering, the system identifies the user's consultation intent and conducts multi-turn consultations to obtain the final consultation result (i.e., medication recommendation information), including disease probability, medication suggestions, and precautions.

[0130] Further, please refer to Figure 4 The figure illustrates a scenario where the medication recommendation method is applied on the user's end. The chat box on the left, displaying phrases like "I'm glad..." and "Have you recently...", represents the consultation response and medication recommendation information output by the medication recommendation system server based on a pre-trained large language model. The chat box on the right, displaying phrases like "Fever..." and "No", represents the symptom description information entered by the user on the user's end. The final medication recommendation information output by the server includes two target diseases: influenza and upper respiratory tract infection, with a 99% probability that the user has influenza. Furthermore, the symptom description information can be input as text in the input box at the bottom of the figure or via voice input; this embodiment does not specifically limit the input method for symptom description information.

[0131] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the medication recommendation method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.

[0132] This application also provides a medication recommendation system; please refer to [reference needed]. Figure 5 The medication recommendation system includes a user terminal 10 and a server terminal 20, wherein the server terminal 20 is configured with a pre-trained large language model;

[0133] User terminal 10 is used to receive input symptom description information and supplementary symptom description information, and transmit the symptom description information and supplementary symptom description information to server terminal 20, wherein the supplementary symptom description information is input based on the consultation response information output by server terminal 20;

[0134] Server 20 is used to retrieve corresponding medical information from a preset medical knowledge graph based on the symptom description information;

[0135] The medical information is verified. If the medical information fails the verification, a pre-trained large language model outputs the consultation response information corresponding to the symptom description information to the user terminal 10 based on the medical information.

[0136] If the user terminal 10 receives supplementary symptom description information transmitted based on the consultation response information, the symptom description information is updated according to the supplementary symptom description information, and the step of retrieving corresponding medical information in the preset medical knowledge graph based on the updated symptom description information is returned.

[0137] If the medical information passes the verification, medication recommendation information is generated based on the medical information, and the medication recommendation information is output to the user terminal 10 through the large language model.

[0138] Optionally, the preset medical knowledge graph records the relationships between each pair of symptoms, diseases, and drugs, and the server 20 is further used for:

[0139] The symptoms corresponding to the symptom description information are determined by the large language model, and the target disease and target drug are retrieved in the preset medical knowledge graph based on the symptoms;

[0140] The target disease and the target drug are used as the medical information.

[0141] Optionally, the user terminal 10 is further configured to:

[0142] Receive the input medication user identity information and transmit the medication user identity information to the server 20;

[0143] The server 20 is also used for:

[0144] Obtain the corresponding drug purchase record based on the drug user's identity information transmitted by the user terminal 10;

[0145] Identify the historical medications in the purchase records, and based on the symptoms and the historical medications, retrieve the target disease and target medication from a preset medical knowledge graph.

[0146] Optionally, the server 20 is further configured to:

[0147] Acquire a collection of medical and pharmaceutical data, and perform named entity recognition on the collection to obtain the symptoms, diseases, drugs, and their interrelationships in the collection. The interrelationships include the pairwise relationships between any two symptoms, diseases, and drugs.

[0148] Based on the symptoms, diseases, drugs, and their interrelationships, the preset medical knowledge graph is constructed.

[0149] Optionally, the server 20 is further configured to:

[0150] Obtain a supplementary set of medical-related data, and merge the supplementary set of medical-related data with the original set of medical-related data to obtain a new set of medical-related data;

[0151] Based on the new medical-related data set, the step of performing named entity recognition on the medical-related data set is returned to update the preset medical knowledge graph.

[0152] Optionally, the server 20 is further configured to:

[0153] Acquire consultation dialogue data and adjust the structure of the consultation dialogue data according to the data format corresponding to the large language model;

[0154] The pre-trained large language model is obtained by fine-tuning the pre-set large language model based on the structured consultation dialogue data.

[0155] Optionally, the preset large language model integrates a LoRA layer, and the server 20 is further used for:

[0156] The preset large language model is trained based on the consultation dialogue data after the structure adjustment, and the parameters in the LoRA layer are adjusted during the training process to obtain the preset large language model after LoRA layer parameter adjustment.

[0157] By performing reinforcement learning on the pre-set large language model after adjusting the parameters of the LoRA layer using a pre-set reward function, a consciousness-aligned pre-set large language model is obtained, and the consciousness-aligned pre-set large language model is used as the pre-trained large language model.

[0158] The medication recommendation system provided in this application, employing the medication recommendation method described in the above embodiments, can solve the technical problem of how to use artificial intelligence technology to assist pharmacists in providing professional medication recommendations to users. Compared with the prior art, the beneficial effects of the medication recommendation system provided in this application are the same as those of the medication recommendation method provided in the above embodiments, and other technical features of the medication recommendation system are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0159] This application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the medication recommendation method in Embodiment 1 above.

[0160] The following is for reference. Figure 6 The diagram illustrates a structural schematic of an electronic device suitable for implementing embodiments of this application. The electronic devices in these embodiments may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 6 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0161] like Figure 6 As shown, the electronic device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the electronic device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. While electronic devices with various systems are shown in the figures, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0162] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0163] The electronic device provided in this application, employing the medication recommendation method described in the above embodiments, can solve the technical problem of how to use artificial intelligence technology to assist pharmacists in providing professional medication recommendations to patients. Compared with the prior art, the beneficial effects of the electronic device provided in this application are the same as those of the medication recommendation method provided in the above embodiments, and other technical features of the electronic device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0164] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0165] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0166] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to perform the medication recommendation method in the above embodiments.

[0167] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0168] The aforementioned computer-readable storage medium may be included in an electronic device or may exist independently without being assembled into an electronic device.

[0169] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by an electronic device, the electronic device causes the following actions: receiving input symptom description information and retrieving corresponding medical information from a preset medical knowledge graph based on the symptom description information; verifying the medical information, and if the medical information fails the verification, outputting a consultation response based on the medical information using a pre-trained large language model; if supplementary symptom description information is received based on the consultation response information, updating the symptom description information based on the supplementary symptom description information, and returning to the step of retrieving corresponding medical information from the preset medical knowledge graph based on the updated symptom description information; and if the medical information passes the verification, generating medication recommendation information based on the medical information and outputting the medication recommendation information using the large language model.

[0170] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include object-oriented programming languages—such as Python, SQL, Java, Smalltalk, and C++—as well as conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0171] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0172] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0173] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., computer programs) for executing the above-described medication recommendation method. This solves the technical problem of how to use artificial intelligence technology to assist pharmacists in providing professional medication recommendations to patients. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the medication recommendation method provided in the above embodiments, and will not be repeated here.

[0174] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the medication recommendation method described above.

[0175] The computer program product provided in this application solves the technical problem of how to use artificial intelligence technology to assist pharmacists in providing professional medication recommendations to patients. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the medication recommendation method provided in the above embodiments, and will not be repeated here.

[0176] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A method for recommending medication, characterized in that, The recommended methods for medication use include: The system receives input symptom description information, determines the symptoms corresponding to the symptom description information through a pre-trained large language model, receives input medication user identity information, and obtains the corresponding medication purchase record based on the medication user identity information. Identify the historical medications in the purchase records, and based on the symptoms and the historical medications, retrieve the target disease and target medications in a preset medical knowledge graph, wherein the preset medical knowledge graph records the pairwise relationships between symptoms, diseases, and medications, as well as the weights corresponding to each symptom; The target disease and the target drug are used as medical information, and the medical information is tested according to the weights corresponding to the medical information. If the medical information fails the test, the large language model outputs the consultation response information corresponding to the symptom description information based on the medical information. If supplementary symptom description information is received based on the consultation response information, the symptom description information is updated according to the supplementary symptom description information, and the step of determining the symptom corresponding to the symptom description information through the large language model is returned based on the updated symptom description information. If the medical information passes the verification, medication recommendation information is generated based on the medical information, and the medication recommendation information is output through the large language model.

2. The medication recommendation method as described in claim 1, characterized in that, The recommended medication method also includes: Acquire a collection of medical and pharmaceutical data, and perform named entity recognition on the collection to obtain the symptoms, diseases, drugs, and their interrelationships in the collection. The interrelationships include the pairwise relationships between any two symptoms, diseases, and drugs. Based on the symptoms, diseases, drugs, and their interrelationships, the preset medical knowledge graph is constructed.

3. The medication recommendation method as described in claim 2, characterized in that, Following the step of constructing the preset medical knowledge graph, the method further includes: Obtain a supplementary set of medical-related data, and merge the supplementary set of medical-related data with the original set of medical-related data to obtain a new set of medical-related data; Based on the new medical-related data set, the step of performing named entity recognition on the medical-related data set is returned to update the preset medical knowledge graph.

4. The medication recommendation method as described in claim 1, characterized in that, The recommended medication method also includes: Acquire consultation dialogue data and adjust the structure of the consultation dialogue data according to the data format corresponding to the large language model; The pre-trained large language model is obtained by fine-tuning the pre-set large language model based on the structured consultation dialogue data.

5. The medication recommendation method as described in claim 4, characterized in that, The preset large language model integrates a LoRA layer. The step of fine-tuning the preset large language model based on the structure-adjusted consultation dialogue data to obtain the pre-trained large language model includes: The preset large language model is trained based on the consultation dialogue data after the structure adjustment, and the parameters in the LoRA layer are adjusted during the training process to obtain the preset large language model after LoRA layer parameter adjustment. By performing reinforcement learning on the pre-set large language model after adjusting the parameters of the LoRA layer using a pre-set reward function, a consciousness-aligned pre-set large language model is obtained, and the consciousness-aligned pre-set large language model is used as the pre-trained large language model.

6. A medication recommendation system, characterized in that, The medication recommendation system includes a user terminal and a server terminal, wherein the server terminal is configured with a pre-trained large language model; The user terminal is used to receive input symptom description information and supplementary symptom description information, and transmit the symptom description information and supplementary symptom description information to the server, wherein the supplementary symptom description information is input based on the consultation response information output by the server; The server is used to determine the symptoms corresponding to the symptom description information through the large language model, receive the input medication user identity information, and obtain the corresponding medication purchase records based on the medication user identity information; Identify the historical medications in the purchase records, and based on the symptoms and the historical medications, retrieve the target disease and target medications in a preset medical knowledge graph, wherein the preset medical knowledge graph records the pairwise relationships between symptoms, diseases, and medications, as well as the weights corresponding to each symptom; The target disease and the target drug are used as medical information, and the medical information is tested according to the weights corresponding to the medical information. If the medical information fails the test, the large language model outputs the consultation response information corresponding to the symptom description information to the user terminal based on the medical information. If the user receives supplementary symptom description information transmitted based on the consultation response information, the symptom description information is updated according to the supplementary symptom description information, and the step of determining the symptom corresponding to the symptom description information through the large language model is returned based on the updated symptom description information. If the medical information passes the verification, medication recommendation information is generated based on the medical information, and the medication recommendation information is output to the user terminal through the large language model.

7. An electronic device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the medication recommendation method as described in any one of claims 1 to 5.

8. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the medication recommendation method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Intelligent medication recommendation method, system and device

    CN113593669A

  • Drug recommendation reason generation method and device, medium and equipment

    CN117252664A

  • Construction method and device of Parkinson's disease individualized medication auxiliary question-answering system

    CN118626613A