Medication recommendation method and system, electronic equipment and storage medium
Through retrieval in the medical knowledge graph and assisted by large language model, the inaccurate drug recommendation problem caused by insufficient pharmacist professional knowledge is solved, and personalized and efficient drug recommendation is achieved.
Patent Information
- Application Number
- CN202411822077.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-11
AI Technical Summary
It is difficult for existing technology to assist pharmacists through artificial intelligence to provide personalized drug recommendations for drug users, resulting in problems such as missed selling of drugs and missed selling of drugs.
By receiving the user's symptom description information, searching relevant medical information in the preset medical knowledge graph, and using the pre-trained large language model for information testing and consultation reply, dynamically update the symptom description information, and finally generating drug recommendation information.
It improves the accuracy and personalization of drug recommendations, reduces the risk of misselling and misselling drugs, and improves the drug purchase experience and satisfaction of drug users.
Smart Images

Figure CN119763861A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of large language models, and in particular to a medication recommendation method, system, electronic device and storage medium. Background Art
[0002] In recent years, hospital outpatient pharmacies have gradually begun to transform to a new model of cooperation between hospitals and pharmacies, which has brought unprecedented development opportunities and broad space to the pharmacy industry. However, there is still a large gap in practicing pharmacists, and most pharmacy clerks do not have professional pharmacist qualifications. In the process of seeking medical treatment and buying medicines, it is difficult for store pharmacists to provide personalized drug recommendations based on customers' specific symptom descriptions and health conditions, resulting in the wrong sale of drugs, etc., which has gradually aggravated the difficulties customers have in seeing a doctor and buying medicines. Therefore, while the demand for practicing pharmacists in pharmacies has increased, the requirements for the professionalism of pharmacists have also continued to increase.
[0003] The current solution to this problem in pharmacies is to train pharmacists through medical materials, but pharmacists are prone to lack of experience in dispensing medicine and lack of medical knowledge in the early stage. With the development of generative large language models, more and more medical practitioners have seen the impact and empowerment of AI technology on the pharmaceutical industry, but the relevant medical data and practical applications are still few, and most of them are focused on the biomedical field. There is still huge room for development in the field of dispensing medicine, which needs to be explored and developed in depth.
[0004] Therefore, how to use artificial intelligence technology to assist pharmacists and provide professional medication recommendations to users is a problem that needs to be solved urgently. 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 and provide professional medication recommendations to users.
[0006] To achieve the above objectives, the present application proposes a medication recommendation method, which includes:
[0007] Receive input symptom description information, and retrieve corresponding medical information in a preset medical knowledge graph according to the symptom description information;
[0008] Inspecting the medical information, and if the medical information fails the inspection, outputting the medical consultation reply information corresponding to the symptom description information according to the medical information through a pre-trained large language model;
[0009] If supplementary symptom description information input based on the medical consultation reply information is received, the symptom description information is updated according to the supplementary symptom description information, and based on the updated symptom description information, the step of returning to perform a step of retrieving corresponding medical information in a preset medical knowledge graph according to the symptom description information is performed;
[0010] When the medical information is verified to be good, 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 relationship between symptoms, diseases and drugs, and the step of retrieving corresponding medical information in the preset medical knowledge graph according to the symptom description information includes:
[0012] Determine the symptom 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 according to the symptom;
[0013] The target disease and the target drug are used as the medical information.
[0014] In one embodiment, the step of searching for a target disease and a target drug in a preset medical knowledge graph according to the symptom includes:
[0015] Receiving input identity information of a medication user, and obtaining corresponding medication purchase records based on the identity information of the medication user;
[0016] The historical drugs in the drug purchase record are determined, and according to the symptoms and the historical drugs, the target disease and the target drug are retrieved in the preset medical knowledge graph.
[0017] In one embodiment, the medication recommendation method further includes:
[0018] Acquire a collection of medicine-related data, and perform named entity recognition on the collection of medicine-related data to obtain symptoms, diseases, drugs and their relationships in the collection of medicine-related data, wherein the relationships include relationships between any symptom, any disease and any drug;
[0019] Based on the symptoms, the diseases, the drugs and the relationships, 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] Acquire a supplementary medicine-related data collection, and merge the supplementary medicine-related data collection with the medicine-related data collection to obtain a new medicine-related data collection;
[0022] Based on the new medicine-related data collection, the step of performing named entity recognition on the medicine-related data collection is returned to update the preset medicine knowledge graph.
[0023] In one embodiment, the medication recommendation method further includes:
[0024] Acquire medical consultation dialogue data, and perform structural adjustment on the medical consultation dialogue data according to a data format corresponding to the large language model;
[0025] The preset large language model is fine-tuned based on the structurally adjusted medical consultation dialogue data to obtain the pre-trained large language model.
[0026] In one embodiment, the preset large language model is integrated with a LoRA layer, and the step of fine-tuning the preset large language model based on the structurally adjusted consultation dialogue data to obtain the pre-trained large language model includes:
[0027] The preset large language model is trained based on the medical consultation dialogue data after the structural adjustment, and during the training process, the parameters in the LoRA layer are adjusted to obtain the preset large language model after the parameters of the LoRA layer are adjusted;
[0028] The preset large language model after the LoRA layer parameters are adjusted is reinforced by a preset reward function to obtain a consciousness-aligned preset large language model, and the consciousness-aligned preset large language model is used as the pre-trained large language model.
[0029] In addition, to achieve the above-mentioned purpose, the present application also proposes a medication recommendation system, the medication recommendation system comprising a user end and a server end, wherein the server end is configured with a pre-trained large language model;
[0030] The user end is used to receive the input symptom description information and the supplementary symptom description information, and transmit the symptom description information and the supplementary symptom description information to the server end, wherein the supplementary symptom description information is input based on the medical consultation reply information output by the server end;
[0031] The server is used to retrieve corresponding medical information in a preset medical knowledge graph according to the symptom description information;
[0032] Inspecting the medical information, and if the medical information fails the inspection, outputting the medical consultation reply information corresponding to the symptom description information to the user end through the pre-trained large language model according to the medical information;
[0033] If the supplementary symptom description information transmitted by the user terminal based on the medical consultation reply information is received, the symptom description information is updated according to the supplementary symptom description information, and based on the updated symptom description information, the step of retrieving corresponding medical information in a preset medical knowledge graph according to the symptom description information is returned;
[0034] When the medical information is verified to be good, medication recommendation information is generated based on the medical information, and the medication recommendation information is output to the user end through the large language model.
[0035] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the medication recommendation method as described above.
[0036] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which 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, the steps of the medication recommendation method described above are implemented.
[0037] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the medication recommendation method described above.
[0038] One or more technical solutions proposed in this application have at least the following technical effects:
[0039] The present application first receives input symptom description information, and retrieves corresponding medical information in a preset medical knowledge graph based on the symptom description information, so as to quickly and accurately retrieve relevant medical information based on the symptom description information input by the user through a preset medical knowledge graph model, thereby improving the pertinence and efficiency of drug recommendations; the medical information is tested, and if the medical information test fails, the pre-trained large language model is used to output the consultation reply information corresponding to the symptom description information based on the medical information, so as to guide the drug user to further clarify the symptoms through the consultation reply information when faced with too much possible medical information, thereby narrowing the search scope of medical information and improving the accuracy of drug recommendations; if a medical information based on the received If the supplementary symptom description information is input in the consultation reply information, the symptom description information is updated according to the supplementary symptom description information, and based on the updated symptom description information, the step of retrieving corresponding medical information in the preset medical knowledge graph according to the symptom description information is returned, so as to make the retrieval of medical information more accurate by continuously collecting the symptom information supplemented by the drug users, so as to better meet the personalized needs of drug users for drugs; if the medical information inspection passes, the drug recommendation information is generated based on the medical information, and the drug recommendation information is output through the large language model, so as to provide clear drug recommendations for drug users, avoid the difficulty of drug users in choosing due to too many options, and improve the drug purchasing experience of drug users.
[0040] In summary, the present application avoids the problem of inaccurate drug recommendations due to insufficient professional knowledge or lack of experience of pharmacists by retrieving medical information corresponding to the symptom description information input by the user in the medical knowledge graph, combining the dynamic update of the symptom information of the drug user and the method of performing relevant tests on the retrieved medical information. It can provide more accurate and personalized medication recommendations based on the symptom description information input by the user through iterative dialogue and precise information retrieval, thereby improving the efficiency of drug recommendations and user satisfaction with drug purchases, while also reducing the risk of mis-selling and mistaken selling of drugs, thereby achieving the effect of using artificial intelligence technology to assist pharmacists in providing professional medication recommendations to drug users. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0043] Figure 1 A schematic diagram of the process provided for Example 1 of the medication recommendation method of this application;
[0044] Figure 2 A schematic diagram of the process provided for Example 2 of the recommended medication method of this application;
[0045] Figure 3 A brief flowchart of the medication recommendation method provided in Example 2 of the present application;
[0046] Figure 4 A schematic diagram of a scenario of a medication recommendation method provided in Example 2 of the present application;
[0047] Figure 5 This is a schematic diagram of the module structure of the medication recommendation system of the present application embodiment;
[0048] Figure 6 Schematic diagram of the device structure of the hardware operating environment involved in the medication recommendation method in the embodiment of the present application.
[0049] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0050] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0051] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0052] The main solution of the embodiment of the present application is: receiving input symptom description information, and retrieving corresponding medical information in a preset medical knowledge graph according to the symptom description information; inspecting the medical information, and if the medical information inspection fails, outputting medical consultation reply information corresponding to the symptom description information according to the medical information through a pre-trained large language model; if supplementary symptom description information input based on the medical consultation reply information is received, updating the symptom description information according to the supplementary symptom description information, and returning to execute the step of retrieving corresponding medical information in a preset medical knowledge graph according to the symptom description information based on the updated symptom description information; if the medical information inspection passes, generating medication recommendation information based on the medical information, and outputting the medication recommendation information through the large language model.
[0053] Since there is still a large gap in the number of licensed pharmacists, and most pharmacy staff do not have professional pharmacist qualifications, it is difficult for store pharmacists to provide personalized drug recommendations based on the customer's specific symptom description and health status during the process of medical treatment and drug purchase, resulting in the mis-selling of drugs, etc., which makes it increasingly difficult for customers to see a doctor and buy drugs. Therefore, while the demand for licensed pharmacists in pharmacies increases, the requirements for pharmacists' professionalism are also constantly increasing. The current solution to this problem in pharmacies is mainly to train pharmacists through medical-related materials, but pharmacists are prone to lack of dispensing experience and medical knowledge in the early stage. With the development of generative large language models, more and more medical practitioners have seen the impact and empowerment of AI technology on the pharmaceutical industry, but the relevant medical data and landing applications are still few, and most of them focus on the biomedical field. In the field of dispensing, there is still huge room for development, which needs to be deeply explored and developed. Therefore, how to use artificial intelligence technology to assist pharmacists and provide professional medication recommendations for drug users is a problem that needs to be solved urgently.
[0054] The present application provides a solution, which avoids the problem of inaccurate drug recommendations due to insufficient professional knowledge or lack of experience of pharmacists by retrieving medical information corresponding to the symptom description information input by the user in the medical knowledge graph, and combines it with the dynamic update of the symptom information of the drug user and relevant inspection of the retrieved medical information. It can provide more accurate and personalized medication recommendations based on the symptom description information input by the user through iterative dialogue and precise information retrieval, thereby improving the efficiency of drug recommendations and user satisfaction with drug purchases, while also reducing the risk of mis-selling and mistaken selling of drugs, thereby achieving the effect of using artificial intelligence technology to assist pharmacists in providing professional medication recommendations to drug users.
[0055] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device that can realize the above functions. The following takes an electronic device as an example to illustrate this embodiment and the following embodiments.
[0056] Based on this, the present application embodiment provides a method for recommending medication. Figure 1 , Figure 1 This is a flow chart of the first embodiment of the medication recommendation method of the present application.
[0057] In this embodiment, the medication recommendation method includes steps S10 to S40:
[0058] Step S10, receiving the input symptom description information, and searching for corresponding medical information in a preset medical knowledge graph according to 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 own symptoms or discomforts, such as "headache", "fever", "runny nose", "fever reaches 39 degrees, and still has headache and cough", etc. It can be a symptom prompt word selected by the user, or it can be text content freely entered by the user. In this embodiment, the type of symptom description information is not specifically limited; the preset medical knowledge graph refers to a relationship network of medical field knowledge including symptoms, diseases, drugs, and the relationship between symptoms and symptoms, symptoms and diseases, symptoms and drugs, diseases and diseases, diseases and drugs, and drugs and drugs, which can represent the complex relationships and attributes between these entities; medical information refers to related diseases, names of potentially applicable drugs, usage and dosage, precautions, and probability of illness retrieved in the medical knowledge graph based on the user's symptom description information.
[0060] It is understandable that since inexperienced pharmacists often find it difficult to recommend accurate medication information based on the corresponding symptoms described by the user, performing step S10 can avoid the problem of inaccurate drug recommendations due to insufficient professional knowledge of the pharmacist, thereby retrieving the corresponding medical information in the medical knowledge graph, providing a reliable data basis for quickly determining personalized drug recommendations.
[0061] Exemplarily, the user selects the corresponding symptom option in the user-side chat interface and enters a symptom prompt word such as "cough". The system then sends the symptom prompt word to the server, which analyzes the input symptom prompt word through the pre-trained large language model in the server, and retrieves the preset medical knowledge graph through the large language model to find all medical information related to "cough".
[0062] Exemplarily, the user verbally describes the symptoms through the user-side voice assistant device, such as "I have a sore throat", and the voice assistant converts the speech into text-based symptom description information and transmits it to the server, so that the large language model on the server can be used to retrieve medical information matching the symptom description information in the preset medical knowledge graph based on the text-based symptom description information.
[0063] In a feasible implementation, the preset medical knowledge graph records the relationship between symptoms, diseases and drugs. The step of retrieving corresponding medical information in the preset medical knowledge graph according to the symptom description information in step S10 may include steps S11 to S12:
[0064] Step S11, determining the symptom corresponding to the symptom description information through the large language model, and searching for a target disease and a target drug in a preset medical knowledge graph according to the symptom;
[0065] It should be noted that the target disease refers to the corresponding disease record recorded in the medical knowledge graph inferred by the system based on the symptom description information input 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 relationship between entities.
[0066] It is understandable that since it is necessary to convert the user's non-professional symptom description into standard symptoms in the medical field and infer possible diseases and corresponding therapeutic drugs, step S11 is performed to avoid incorrect drug recommendations due to vague or inaccurate user symptom descriptions, as well as the inability to automatically recommend drugs based on symptoms. Through accurate symptom identification, the accuracy and relevance of drug recommendations can be improved.
[0067] Exemplarily, after the server-side large language model receives the symptom description information, it first performs semantic analysis to map the user's natural language description to standard medical symptom terms, such as mapping symptom description information such as "fever" and "high body temperature" to the "fever" symptom. Then, the large language model searches for disease nodes associated with these standard symptom terms in the preset medical knowledge graph. The nodes in the medical knowledge graph may include entities of various symptoms, diseases, and drugs, while the edges represent the relationships between the entities. The large language model determines that the disease entity in the medical knowledge graph that has a relationship with the symptom (such as "influenza") is the target disease, and the drug entity that has a relationship with the symptom (such as "a certain antiviral drug" or "a certain antipyretic drug") is the target drug.
[0068] In a feasible implementation, the step of searching for a target disease and a target drug in a preset medical knowledge graph according to the symptom in step S11 may include steps S111 to S112:
[0069] Step S111, receiving the input identity information of the medication user, and acquiring the corresponding medication purchase record based on the identity information of the medication user;
[0070] It should be noted that the identity information of the drug user refers to the data that can uniquely identify the drug user, such as name, ID number, user account, etc.; the drug purchase record refers to the drug user's drug purchase history in the past period of time, including the name, quantity, purchase time and other information of the purchased drugs;
[0071] It is understandable that in order to understand the user's medication history and to provide more personalized services, step S111 is performed to avoid inappropriate drug recommendations caused by ignoring the user's medication history, thereby providing drug recommendations that are more in line with the user's personal situation based on the user's medication habits and needs.
[0072] Step S112, determining the historical drugs in the drug purchase record, and searching for target diseases and target drugs in a preset medical knowledge graph based on the symptoms and the historical drugs.
[0073] It should be noted that historical drugs refer to drugs that appeared in the user's past drug purchase records, and these drugs may be related to the user's current symptoms.
[0074] It is understandable that in order to more accurately recommend suitable medicines based on the user's historical medication, step S112 is performed. This can avoid making drug recommendations based solely on current symptoms while ignoring possible interactions or duplications caused by the user's historical medication. By comprehensively considering the user's historical medication and current symptoms, more accurate and safe drug recommendations can be provided.
[0075] Exemplarily, the system server first extracts historical drug information from the user's drug purchase records, including drug name and purchase time, etc.; then, the system server combines the symptoms currently input by the user with these historical drug information, and uses the preset medical knowledge graph to search, and through the disease-symptom-drug relationship in the graph, finds the target disease and target drug that matches the user's symptoms and historical medication. 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 due to lack of the user's personal medication history are avoided, and more accurate and personalized drug recommendations are provided based on the user's personalized medication history and current symptoms, thereby improving medication safety and the accuracy of medication recommendations.
[0077] Step S12, taking the target disease and the target drug as the medical information.
[0078] In this implementation, a pre-trained large language model is used to retrieve corresponding diseases and drugs in the medical knowledge graph based on the input symptom description information, thereby avoiding the problem of inappropriate drug recommendations due to insufficient professional knowledge of pharmacists or inaccurate symptom descriptions of users, and accurately converting the user's non-professional symptom descriptions into medical symptoms. Through deep correlation analysis of the medical knowledge graph, medical information matching the user's condition is provided, thereby providing a reliable data foundation for improving the personalization and safety of drug recommendations.
[0079] Step S20, testing the medical information, and if the medical information fails the test, outputting the medical consultation reply information corresponding to the symptom description information according to the medical information through the pre-trained large language model;
[0080] It should be noted that medical consultation response information refers to 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 with a cold or flu recently?", "Did your symptoms appear suddenly or gradually worsen?", "In addition to fever, cough and headache, do you have other symptoms that are not caused by colds?", etc.
[0081] It is understandable that after the retrieved medical information has been verified by the large language model, the currently retrieved medical information may be relatively complex, and some medical information does not conform to the medical knowledge related to the symptom information. Therefore, it is necessary to further clarify the user's symptom information, so step S20 is performed to guide the user to further improve his or her symptom description or medication needs through the output consultation reply information, which can avoid the problem of too much complex medical information retrieved in the medical knowledge graph, thereby narrowing the search scope of medical information by outputting consultation reply information, thereby improving the accuracy of medical information retrieval.
[0082] Exemplarily, the medical information (such as symptoms, etc.) in the medical knowledge graph is configured with corresponding weights, such as the symptom "fever" is configured with a weight of 0.02, the symptom "palpitations" is configured with a weight of 0.45, the symptom "sudden death" is configured with a weight of 0.75, etc. When the large language model is retrieved and identifies that the symptom corresponding to the symptom description information input by the user is "fever", it is checked that the weight of the symptom 0.02 is less than the preset threshold value 0.7, and it is judged that the retrieved medical information has failed the inspection. Then, the large language model is used to output the corresponding consultation reply information to the user in text form based on the medical information retrieved based on "fever".
[0083] For example, the large language model in the server side analyzes and judges the content of the retrieved medical information. If the model detects that the medical information is contradictory, incomplete, or inconsistent with clinical common sense, it is determined that the medical information inspection has failed. At this time, the large language model will generate a series of targeted medical questions based on these medical information and symptom description information, and output these medical response information to the user side in text form, so that the pharmacist or customer 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 input based on the medical consultation reply information is received, the symptom description information is updated according to the supplementary symptom description information, and based on the updated symptom description information, the step of returning to perform a step of retrieving corresponding medical information in a preset medical knowledge graph according to the symptom description information is performed;
[0085] It should be noted that supplementary symptom description information refers to additional symptom information provided by the user based on the system's questionnaire response information, which is used to more accurately describe his or her condition, for example: based on the questionnaire response information "Have you had any contact with anyone with a cold or flu recently?" the supplementary symptom prompt word "No" entered; based on the questionnaire response information "Did these symptoms appear suddenly or gradually worsen?" the supplementary symptom prompt word "Gradually worsen" entered; based on the questionnaire response information "In addition to fever, cough and headache, do you have other symptoms that are not...?" the supplementary symptom prompt word "sore throat, sneezing, runny nose" entered.
[0086] It is understandable that since more accurate drug recommendations are needed based on more detailed symptom information of the user, performing step S30 can avoid the problem of excessive drug recommendations or recommendation bias due to insufficient symptom description, and improve the accuracy of drug recommendations through iterative dialogue with the user.
[0087] Exemplarily, the user provides a supplementary symptom prompt word on the user side based on the consultation reply information "Have you had any contact with anyone with a cold or flu recently?" returned by the server and displayed on the user side. For example, "No". The system server then combines the original symptom prompt words "fever, cough, headache" with the supplementary symptom prompt word "no" to generate new symptom prompt words "fever, cough, headache, no contact with anyone with a cold or flu". The system server then uses the new symptom prompt words to retrieve more accurate medication recommendation information from the large language model.
[0088] Step S40, when the medical information verification passes, generating medication recommendation information based on the medical information, and outputting the medication recommendation information through the large language model.
[0089] It can be understood that, since the drug recommendation results after screening are accurate enough under the control of the threshold (i.e., the preset number) and can be directly presented to the user, performing step S40 can avoid the problem of user confusion caused by providing too much medication recommendation information, thereby simplifying the user decision-making process and optimizing the user's drug purchasing experience.
[0090] Exemplarily, the medical information (such as symptoms, etc.) in the medical knowledge graph is configured with corresponding weights, such as the symptom "fever" is configured with a weight of 0.02, the symptom "palpitations" is configured with a weight of 0.45, the symptom "sudden death" is configured with a weight of 0.75, etc. When the large language model is retrieved and identifies that the symptom corresponding to the symptom description information input by the user end is "sudden death", it is checked that the weight of the symptom 0.75 is greater than or equal to the preset threshold value 0.7, and it is judged that the retrieved medical information has passed the inspection, then the medical information retrieved in the medical knowledge graph for the symptom "sudden death" is generated for medication recommendation information, and the medication recommendation information is displayed to the user end through the large language model output, and provided to the pharmacist or customer.
[0091] For example, the system server will automatically generate a medication recommendation information containing detailed information such as recommended drugs, dosage, frequency of use, and precautions based on verified medical information and the logical relationships and medication rules in the preset medical knowledge graph. Subsequently, the medication recommendation information will be input into the pre-trained large language model, which will format and optimize the information to ensure that the output medication recommendation information is accurate and easy to understand. Finally, the large language model will output the medication recommendation information in the form of text or voice and provide it to pharmacists or customers so that they can make reasonable drug selections and use based on these suggestions.
[0092] This embodiment provides a medication recommendation method, which avoids the problem of inaccurate drug recommendations due to insufficient professional knowledge or lack of experience of pharmacists by retrieving medical information corresponding to the symptom description information input by the user in the medical knowledge graph, and combines the method of dynamically updating the symptom information of the drug user and performing relevant tests on the retrieved medical information. It can provide more accurate and personalized medication recommendations based on the symptom description information input by the user through iterative dialogue and precise information retrieval, thereby improving the efficiency of drug recommendations and user satisfaction with drug purchases, while also reducing the risks of mis-selling and mistaken selling of drugs, thereby achieving the effect of using artificial intelligence technology to assist pharmacists in providing professional medication recommendations to drug users.
[0093] In a feasible implementation, the medication recommendation method may further include steps S100 to S200:
[0094] Step S100, obtaining a collection of medicine-related data, and performing named entity recognition on the collection of medicine-related data to obtain each symptom, each disease, each drug and their mutual relationship in the collection of medicine-related data, wherein the mutual relationship includes the relationship between any symptom, any disease and any drug;
[0095] It should be noted that the collection of medical-related data refers to a database or data set containing various medical information, such as medical literature, drug instructions, clinical guidelines, etc.; named entity recognition refers to the identification of specific entities from text data, such as the names of symptoms, diseases and drugs; relationships refer to the correlation between symptoms, diseases and drugs, such as a symptom may be related to a certain disease, and a certain disease may require specific drug treatment, etc.
[0096] It is understandable that since it is necessary to extract useful information from unstructured medical data to construct a knowledge graph, performing step S100 can avoid the problems of difficulty and low accuracy in information extraction due to the unstructured data, and accurately identify key entities and their relationships from a large amount of medical data, providing effective and reliable structured data for constructing a knowledge graph.
[0097] Exemplarily, medical-related data is collected from sources such as medical literature, drug instructions, and electronic health records through crawler technology to form a collection of medical-related data. Next, the collection of medical-related data is preprocessed using natural language processing tools, including text cleaning, word segmentation, and part-of-speech tagging. Then, a named entity recognition algorithm (such as conditional random fields, BiLSTM-CRF models based on deep learning, etc.) is applied to identify the preprocessed text and extract entities such as symptoms, diseases, and drugs. At the same time, the relationships between entities are determined through entity relationship extraction techniques (such as dependency syntax analysis or relationship extraction models), such as the causal relationship between symptoms and diseases, the therapeutic relationship between diseases and drugs, etc. Finally, these entities and their relationships are stored as structured data to provide basic information for building a medical knowledge graph.
[0098] Step S200, constructing the preset medical knowledge graph based on the symptoms, the diseases, the drugs and the relationships.
[0099] It is understandable that since the extracted entities and their relationships need to be organized into a structured knowledge system to facilitate efficient knowledge retrieval and reasoning, step S200 is performed to avoid the problems of low knowledge utilization efficiency and insufficient reasoning ability caused by the lack of a systematic knowledge structure, and to build a comprehensive and systematic medical knowledge graph that can support complex query and reasoning tasks and improve the accuracy and efficiency of drug recommendations.
[0100] In this implementation, by adopting a named entity recognition algorithm, entity relationships between diseases, symptoms, and drugs are established to form a medical knowledge graph for intelligent medical consultation, thereby avoiding the problems of difficulty in data utilization, inaccurate knowledge extraction, and incomplete knowledge association caused by the unstructured and fragmented medical information. It achieves efficient extraction of entities such as symptoms, diseases, and drugs and their relationships from a large amount of medical-related data, and constructs a structured and semantically rich medical knowledge graph, thereby improving the intelligence level and accuracy of the drug recommendation system, and providing a reliable data foundation for realizing personalized and accurate drug recommendations.
[0101] In a feasible implementation manner, after step S200, steps S300 to S400 may also be included:
[0102] Step S300, obtaining a supplementary medicine-related data collection, and merging the supplementary medicine-related data collection with the medicine-related data collection to obtain a new medicine-related data collection;
[0103] It should be noted that the supplementary medical-related data collection refers to medical information obtained from additional data sources. These data may include the latest medical research, drug marketing information, patient feedback, epidemiological reports, etc. They are supplements and extensions to the original medical-related data collection.
[0104] It is understandable that since medical knowledge is constantly updated and developed, new data needs to be introduced regularly to maintain the timeliness and integrity of the knowledge graph. Therefore, performing step S300 can avoid the problem of inaccurate and backward knowledge graph 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 medicine-related data collection, returning to execute the step of performing named entity recognition on the medicine-related data collection, so as to update the preset medicine knowledge graph.
[0106] It is understandable that as new data is added, entities and their relationships need to be re-identified and extracted to update the medical knowledge graph, so step S400 is performed to avoid the problem of outdated or inaccurate information contained in the medical knowledge graph, thereby maintaining the dynamic update 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 problem of outdated knowledge graphs and omission of important medical information due to untimely updates of medical knowledge is avoided, and dynamic maintenance and updating of medical knowledge graphs are achieved, ensuring the timeliness and accuracy of knowledge graphs, thereby improving the intelligence level and decision support capabilities of the drug recommendation system. At the same time, by conveniently updating only the medical knowledge graph in the large language model without changing the large language model base, rapid updates and iterations of medical information can be achieved, which improves the convenience of updating medical information in actual application.
[0108] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 2 The medication recommendation method further includes steps S01 to S02:
[0109] Step S01, obtaining medical consultation dialogue data, and adjusting the structure of the medical consultation dialogue data according to the data format corresponding to the large language model;
[0110] It should be noted that medical consultation dialogue data refers to the conversation record between the patient and the doctor, including the patient's symptom description, the doctor's questions and answers, etc.; the data format refers to the data structure that can be accepted and processed by the large language model, usually including specific fields and serialization methods.
[0111] In addition, it should be noted that the medical consultation dialogue data may also include the user's evaluation of the medical consultation response information output by the large language model. The evaluation may be implemented through an evaluation function configured by the user end when the large language model outputs each medical consultation response information. The evaluation may be used to guide the process of fine-tuning the large language model.
[0112] It is understandable that since the medical consultation dialogue data is usually unstructured and needs to be converted into a format that can be understood by the large language model, performing step S01 can avoid the problem that the large language model cannot correctly process the medical consultation dialogue data due to data format mismatch, and ensure that the medical consultation dialogue data can be effectively used by the large language model, thereby providing accurate basic data for subsequent model training and medication recommendations.
[0113] Exemplarily, first, extract the patient-doctor consultation conversation data from the hospital information system, online medical service platform or electronic health record, which includes the conversation record in text form. Then, use natural language processing (NLP) technology, such as regular expressions, syntax analyzers and entity recognition tools, to parse the original consultation conversation data and extract key information such as patient symptoms, doctor's diagnosis and treatment plan. Then, reorganize the extracted information according to the input format required by the server-side large language model, for example, convert the original consultation conversation data into JSON or XML format, which contains 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-tuning the preset large language model based on the structurally adjusted medical consultation dialogue data to obtain the pre-trained large language model.
[0115] It is understandable that since the pre-trained large language model may not have specific medical vertical field knowledge, it needs to be fine-tuned to adapt to the medical scenarios of the specific vertical field. Therefore, performing step S02 can avoid the problem of inaccurate medication recommendations due to the model not being suitable for the specific medical vertical field. Through fine-tuning, the large language model can better understand and process medical consultation dialogues, thereby improving the pertinence and accuracy of medication recommendations.
[0116] Exemplarily, after completing the data structure adjustment, these structured data are used as training data sets to fine-tune the 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 the corresponding designated target layer of the large language model (the designated target layer is determined based on the selected large language model), and then training the model for several rounds through the back propagation algorithm and the gradient descent method to optimize the performance of the model in consultations in specific medical vertical fields. During the fine-tuning process, focus is placed on the model's ability to understand medical-related vocabulary and concepts, as well as its ability to handle the context of the consultation dialogue. Ultimately, a pre-trained large language model adapted to the consultation scenario of a specific medical vertical field is obtained through fine-tuning, which can more accurately understand and generate medical-related text information.
[0117] In a feasible implementation manner, the preset large language model is integrated with a LoRA layer, and step S02 may include steps S021 to S022:
[0118] Step S021, training a preset large language model based on the structure-adjusted consultation dialogue data, and during the training process, adjusting the parameters in the LoRA layer to obtain a preset large language model after the LoRA layer parameters are adjusted;
[0119] It should be noted that the LoRA layer refers to a specific layer used for low-rank adaptation in the large language model. It adjusts the behavior of the model by introducing a set of low-rank matrices, so that the model can quickly adapt to specific tasks without changing the original pre-training parameters. The parameters in the LoRA layer refer to the elements in these low-rank matrices.
[0120] It is understandable that 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 verticals.
[0121] For example, first, collect and structure the consultation dialogue data, and then input it into the large language model. During the training process, focus on the parameters of the LoRA layer, and use optimization algorithms such as gradient descent to fine-tune the parameters until the model's performance on the consultation dialogue data reaches the preset standard.
[0122] Step S022, reinforcement learning is performed on the preset large language model after the LoRA layer parameters are adjusted through a preset reward function to obtain a consciousness-aligned preset large language model, and the consciousness-aligned preset large language model is used as the pre-trained large language model.
[0123] It should be noted that the preset reward function refers to a function used to evaluate the quality of model output. It can score the consultation response information generated by the model based on factors such as accuracy, relevance, and fluency; 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 reinforcement learning adjustment, can generate responses that are consistent with the expertise and user needs in a specific medical vertical field.
[0124] It is understandable that in order to further optimize the behavior of the model 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 to avoid the problem of the model generating irrelevant or inaccurate responses, thereby improving the professionalism and practicality of the model in conversations in specific medical verticals.
[0125] For example, after the LoRA layer parameter adjustment is completed, a reward function is defined to feedback the effect of the consultation response generated by the model. Through reinforcement learning algorithms, such as policy gradient or Q learning, the model tries to generate responses in a simulated environment and adjusts its strategy based on the feedback of the reward function. After multiple iterations, the model learns to generate responses that are aligned with professional knowledge and user needs, and finally forms a preset large language model with consciousness alignment. This model can then be deployed on the server to assist pharmacists in conducting consultations or providing patient consultation services.
[0126] In this implementation, model training is performed based on the structurally adjusted medical consultation dialogue data, and the LoRA layer parameter update and reinforcement learning algorithm are combined to achieve intent alignment of the large language model, thereby avoiding the problem of inaccurate medical consultation response information due to insufficient or over-training of the large language model. The large language model can better and quickly adapt to the specific task requirements of medical consultations in specific medical vertical fields while retaining the original extensive medical knowledge, thereby improving the personalized natural language processing capabilities of the large language model in vertical field applications, and at the same time improving the accuracy and adaptability of the large language model's responses in medical consultation scenarios, ensuring that the model can meet the preset performance indicators, thereby enhancing the actual application value of the model.
[0127] In this embodiment, the large language model is fine-tuned based on real medical consultation conversation data, avoiding the incompatibility between the original medical consultation conversation data and the large language model and the insufficient generalization ability of the model when applied in specific medical vertical fields. It realizes the conversion of unstructured medical conversation data into a form that can be processed by the model, and improves the professionalism of the model in specific medical vertical fields and the accuracy of medication recommendations.
[0128] For example, to help understand the implementation process of the medication recommendation method obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 3 , Figure 3 A brief flowchart of a medication recommendation method is provided, specifically:
[0129] First, the medication recommendation system identifies the user's intention and collects data, including the names and descriptions of diseases, symptoms, and drugs, as well as disease precautions. Then, named entity recognition is performed on the collected medical-related data collection, including data extraction, information extraction, and structured data, to obtain a medical knowledge graph, wherein the medical knowledge graph records disease entities, symptom entities, drug entities, and the relationship between them, and the medical knowledge graph supports knowledge updating, that is, it can integrate and supplement the medical-related data collection. Fine-tune the preset generative large language model, including fine-tuning the model using multiple rounds of real consultation dialogue data, and aligning the model's intentions through reinforcement learning. In the actual application of the model, based on the prompt word engineering, the identification of the user's consultation intention and multiple rounds of consultation are realized, so as to obtain the final consultation result (i.e., medication recommendation information), including the probability of illness, medication suggestions, precautions, etc.
[0130] For further information, please refer to Figure 4 , the figure shows a scenario in which the medication recommendation method is applied on the user side. The chat box on the left side of the figure, namely "I'm very happy...", "How have you been recently..." and other contents are the consultation reply information and medication recommendation information output by the medication recommendation system server based on the pre-trained large language model. The chat box on the right side of the figure, namely "Fever...", "No" and other contents are the symptom description information entered by the user on the user side. The medication recommendation information finally output by the server side includes two target diseases: influenza and upper respiratory tract infection, among which the probability of the user suffering from influenza is 99%. In addition, the input method of the symptom description information in the user side of the present application can be text input in the input box at the bottom of the figure, or it can be input by voice. In this embodiment, the input method of the symptom description information is not specifically limited.
[0131] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the medication recommendation method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0132] This application also provides a medication recommendation system, please refer to 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] The user terminal 10 is used to receive the input symptom description information and the supplementary symptom description information, and transmit the symptom description information and the supplementary symptom description information to the server terminal 20, wherein the supplementary symptom description information is input based on the medical consultation reply information output by the server terminal 20;
[0134] The server 20 is used to retrieve corresponding medical information in a preset medical knowledge graph according to the symptom description information;
[0135] The medical information is tested. If the medical information fails the test, the pre-trained large language model is used to output the medical consultation reply information corresponding to the symptom description information to the user terminal 10 according to the medical information;
[0136] If the supplementary symptom description information transmitted by the user terminal 10 based on the medical consultation reply information is received, the symptom description information is updated according to the supplementary symptom description information, and based on the updated symptom description information, the step of searching for corresponding medical information in the preset medical knowledge graph according to the symptom description information is returned;
[0137] When the medical information is verified to be passed, 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 relationship between symptoms, diseases and drugs, and the server 20 is further used to:
[0139] Determine the symptom 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 according to the symptom;
[0140] The target disease and the target drug are used as the medical information.
[0141] Optionally, the user terminal 10 is further used for:
[0142] Receive the input identity information of the medication user, and transmit the identity information of the medication user to the service end 20;
[0143] The server 20 is also used for:
[0144] Obtaining corresponding drug purchase records based on the drug user identity information transmitted by the user terminal 10;
[0145] The historical drugs in the drug purchase record are determined, and according to the symptoms and the historical drugs, the target disease and the target drug are retrieved in the preset medical knowledge graph.
[0146] Optionally, the server 20 is further configured to:
[0147] Acquire a collection of medicine-related data, and perform named entity recognition on the collection of medicine-related data to obtain symptoms, diseases, drugs and their relationships in the collection of medicine-related data, wherein the relationships include relationships between any symptom, any disease and any drug;
[0148] Based on the symptoms, the diseases, the drugs and the relationships, the preset medical knowledge graph is constructed.
[0149] Optionally, the server 20 is further configured to:
[0150] Acquire a supplementary medicine-related data collection, and merge the supplementary medicine-related data collection with the medicine-related data collection to obtain a new medicine-related data collection;
[0151] Based on the new medicine-related data collection, the step of performing named entity recognition on the medicine-related data collection is returned to update the preset medicine knowledge graph.
[0152] Optionally, the server 20 is further configured to:
[0153] Acquire medical consultation dialogue data, and perform structural adjustment on the medical consultation dialogue data according to a data format corresponding to the large language model;
[0154] The preset large language model is fine-tuned based on the structurally adjusted medical consultation dialogue data to obtain the pre-trained large language model.
[0155] Optionally, the preset large language model is integrated with a LoRA layer, and the server 20 is further used for:
[0156] The preset large language model is trained based on the medical consultation dialogue data after the structural adjustment, and during the training process, the parameters in the LoRA layer are adjusted to obtain the preset large language model after the parameters of the LoRA layer are adjusted;
[0157] The preset large language model after the LoRA layer parameters are adjusted is reinforced by a preset reward function to obtain a consciousness-aligned preset large language model, and the consciousness-aligned preset large language model is used as the pre-trained large language model.
[0158] The medication recommendation system provided by this application adopts the medication recommendation method in the above embodiment, which can solve the technical problem of how to use artificial intelligence technology to assist pharmacists and provide professional medication recommendations for medication users. Compared with the prior art, the beneficial effects of the medication recommendation system provided by this application are the same as the beneficial effects of the medication recommendation method provided by the above embodiment, and other technical features in the medication recommendation system are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0159] The present 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, and the instructions are executed by the at least one processor so that the at least one processor can execute the medication recommendation method in the above-mentioned embodiment one.
[0160] Reference below Figure 6 , which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application. The electronic devices in the embodiments of the present application may include but are not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0161] like Figure 6 As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0162] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0163] The electronic device provided by this application adopts the medication recommendation method in the above embodiment, which can solve the technical problem of how to use artificial intelligence technology to assist pharmacists and provide professional medication recommendations for medication users. Compared with the prior art, the beneficial effects of the electronic device provided by this application are the same as the beneficial effects of the medication recommendation method provided in the above embodiment, and the other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0164] It should be understood that the various parts disclosed in this application can be implemented by 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 one or more embodiments or examples in a suitable manner.
[0165] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0166] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the medication recommendation method in the above-mentioned embodiment.
[0167] The computer-readable storage medium provided in the present 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 of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. 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 combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0168] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0169] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by an electronic device, the electronic device: receives input symptom description information, and retrieves corresponding medical information in a preset medical knowledge graph according to the symptom description information; verifies the medical information, and if the medical information verification fails, outputs medical consultation reply information corresponding to the symptom description information according to the medical information through a pre-trained large language model; if supplementary symptom description information input based on the medical consultation reply information is received, the symptom description information is updated according to the supplementary symptom description information, and based on the updated symptom description information, returns to execute the step of retrieving corresponding medical information in a preset medical knowledge graph according to the symptom description information; if the medical information verification passes, generates medication recommendation information based on the medical information, and outputs the medication recommendation information through the large language model.
[0170] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Python, SQL, Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0171] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0172] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0173] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned medication recommendation method, and can solve the technical problem of how to use artificial intelligence technology to assist pharmacists and provide professional medication recommendations for medication users. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the medication recommendation method provided in the above-mentioned embodiment, and will not be repeated here.
[0174] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned medication recommendation method when executed by a processor.
[0175] The computer program product provided in this application can solve the technical problem of how to use artificial intelligence technology to assist pharmacists and provide professional medication recommendations for medication users. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the medication recommendation method provided in the above embodiment, and will not be repeated here.
[0176] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for recommending medication, characterized in that: The recommended methods of medication include: Receive input symptom description information, and retrieve corresponding medical information in a preset medical knowledge graph according to the symptom description information; Inspecting the medical information, and if the medical information fails the inspection, outputting the medical consultation reply information corresponding to the symptom description information according to the medical information through a pre-trained large language model; If supplementary symptom description information input based on the medical consultation reply information is received, the symptom description information is updated according to the supplementary symptom description information, and based on the updated symptom description information, the step of returning to perform a step of retrieving corresponding medical information in a preset medical knowledge graph according to the symptom description information is performed; When the medical information is verified to be good, 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 according to claim 1, characterized in that: The preset medical knowledge graph records the relationship between symptoms, diseases and drugs, and the step of retrieving corresponding medical information in the preset medical knowledge graph according to the symptom description information includes: Determine the symptom 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 according to the symptom; The target disease and the target drug are used as the medical information.
3. The medication recommendation method according to claim 2, characterized in that: The step of searching the target disease and the target drug in the preset medical knowledge graph according to the symptom comprises: Receiving input identity information of a medication user, and obtaining corresponding medication purchase records based on the identity information of the medication user; The historical drugs in the drug purchase record are determined, and according to the symptoms and the historical drugs, the target disease and the target drug are retrieved in the preset medical knowledge graph.
4. The medication recommendation method according to claim 1, characterized in that: The medication recommendation method also includes: Acquire a collection of medicine-related data, and perform named entity recognition on the collection of medicine-related data to obtain symptoms, diseases, drugs and their relationships in the collection of medicine-related data, wherein the relationships include relationships between any symptom, any disease and any drug; Based on the symptoms, the diseases, the drugs and the relationships, the preset medical knowledge graph is constructed.
5. The medication recommendation method according to claim 4, characterized in that: After the step of constructing the preset medical knowledge graph, the method further includes: Acquire a supplementary medicine-related data collection, and merge the supplementary medicine-related data collection with the medicine-related data collection to obtain a new medicine-related data collection; Based on the new medicine-related data collection, the step of performing named entity recognition on the medicine-related data collection is returned to update the preset medicine knowledge graph.
6. The medication recommendation method according to claim 1, characterized in that: The medication recommendation method also includes: Acquire medical consultation dialogue data, and perform structural adjustment on the medical consultation dialogue data according to a data format corresponding to the large language model; The preset large language model is fine-tuned based on the structurally adjusted medical consultation dialogue data to obtain the pre-trained large language model.
7. The medication recommendation method according to claim 6, characterized in that: The preset large language model is integrated with a LoRA layer, and the step of fine-tuning the preset large language model based on the structurally adjusted consultation dialogue data to obtain the pre-trained large language model includes: The preset large language model is trained based on the medical consultation dialogue data after the structural adjustment, and during the training process, the parameters in the LoRA layer are adjusted to obtain the preset large language model after the parameters of the LoRA layer are adjusted; The preset large language model after the LoRA layer parameters are adjusted is reinforced by a preset reward function to obtain a consciousness-aligned preset large language model, and the consciousness-aligned preset large language model is used as the pre-trained large language model.
8. A medication recommendation system, characterized in that: The medication recommendation system includes a user end and a server end, wherein the server end is configured with a pre-trained large language model; The user end is used to receive the input symptom description information and the supplementary symptom description information, and transmit the symptom description information and the supplementary symptom description information to the server end, wherein the supplementary symptom description information is input based on the medical consultation reply information output by the server end; The server is used to retrieve corresponding medical information in a preset medical knowledge graph according to the symptom description information; Inspecting the medical information, and if the medical information fails the inspection, outputting the medical consultation reply information corresponding to the symptom description information to the user end through the pre-trained large language model according to the medical information; If the supplementary symptom description information transmitted by the user terminal based on the medical consultation reply information is received, the symptom description information is updated according to the supplementary symptom description information, and based on the updated symptom description information, the step of retrieving corresponding medical information in a preset medical knowledge graph according to the symptom description information is returned; When the medical information is verified to be good, medication recommendation information is generated based on the medical information, and the medication recommendation information is output to the user end through the large language model.
9. An electronic device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the medication recommendation method according to any one of claims 1 to 7.
10. 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, the steps of the medication recommendation method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Intelligent medication recommendation method, system and device
CN113593669A
Drug recommendation reason generation method and device, medium and equipment
CN117252664A
Intelligent hospital division and guidance method and device based on medical big language model and electronic equipment
CN118098530A
Medical AI assistant implementation method and system based on data driving and large model
CN118098585A
Medication consultation method, device and system, all-in-one machine and storage medium
CN118197532A
Cited By
Intelligent health management method and system, storage medium and electronic equipment
CN120809248A