Intelligent prescription recommendation method and system for medicinal material shortage
Generating alternative medicinal materials solutions through deep learning models and linear planning algorithms has solved the treatment delay and resource waste caused by shortage of medicinal materials, achieved personalized prescription recommendations and inventory optimization, and improved medical efficiency and patient satisfaction.
Patent Information
- Application Number
- CN202510515810.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-08-05
AI Technical Summary
The delay in treatment plans and waste of resources caused by the shortage of Chinese medicinal materials in hospital pharmacies. Traditional Chinese medicine prescription generation depends on doctors' experience and is prone to errors.
The deep learning model is used combined with linear planning algorithms to generate alternative medicinal materials solutions and optimize inventory management. Through data collection, processing and artificial intelligence algorithm modules, inventory is monitored in real time and personalized prescription suggestions are provided.
It improves the matching degree between prescriptions and patients' condition, reduces waste of medicinal materials, reduces inventory costs, and improves clinic work efficiency and patient medical experience.
Smart Images

Figure CN120432075A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of medical health, and specifically relates to an intelligent prescription recommendation method and system for when medicinal materials are in short supply. Background Art
[0002] In the current healthcare system, Chinese herbal medicines (TCMs), as an important therapeutic resource, play an indispensable role in hospital pharmacy management. However, due to factors such as the wide variety of TCMs, fluctuations in supply and demand, and limited storage conditions, hospital pharmacies often face the problem of insufficient storage of certain TCMs. This situation not only affects patients' medication experience but may also lead to delays or adjustments to treatment plans. To effectively address this issue, this study aimed to develop an intelligent prescription recommendation method and system that can provide doctors with reasonable prescription suggestions when TCM storage is insufficient, ensuring the continuity and effectiveness of patient treatment.
[0003] This study, drawing on the practicalities of hospital pharmacy operations, utilizes advanced information technology and artificial intelligence algorithms to develop a system that monitors the inventory status of traditional Chinese medicines in real time and intelligently recommends alternatives or adjusts medication regimens. This system aims to improve hospital pharmacy management efficiency, optimize herbal resource allocation, and ensure patient medication safety. Proper inventory control not only helps reduce operating costs and improve herbal material utilization, but also effectively addresses the issue of prescription cancellations due to herbal material shortages.
[0004] The traditional process of generating TCM prescriptions relies heavily on the physician's personal experience and knowledge, a practice that is not only inefficient but also prone to errors. Furthermore, inventory management of TCM materials presents numerous challenges. Both overstocking and understocking can negatively impact hospital operational efficiency. The diversity of TCM materials and the quality of Chinese patent medicines are directly related to drug safety and clinical efficacy, while also impacting social and economic benefits. Excessive inventory not only complicates drug regulation but can also lead to increased storage costs. Summary of the Invention
[0005] In order to solve the problems existing in the above-mentioned prior art, the present invention proposes an intelligent prescription recommendation method for medicinal materials shortage, which includes: obtaining user electronic medical record data and hospital medicinal material inventory data; preprocessing the user electronic medical record data; using a deep learning model to process the user electronic medical record data to generate a preliminary Chinese medicine prescription; comparing the medicinal material information in the preliminary Chinese medicine prescription with the hospital medicinal material inventory data to determine whether the medicinal materials are missing; if the medicinal materials are missing, new medicinal materials are screened from the hospital medicinal material inventory data to replace the missing medicinal materials, generate a new prescription, and determine the effect of the new prescription. If the effect is poor, the hospital medicinal material inventory is supplemented; otherwise, a Chinese medicine prescription is generated; the generated Chinese medicine prescription is reviewed. If the review fails, the doctor adjusts the Chinese medicine prescription, generates correction data based on the adjusted prescription, and uses the correction data to correct the deep learning model; if the review passes, outputs the Chinese medicine prescription.
[0006] An intelligent prescription recommendation system for medicinal material shortages, the system comprising: a data collection module, a data processing module, an artificial intelligence algorithm module, a prescription generation module, an inventory management module, a user interface module, and an optimization algorithm module;
[0007] The data collection module is used to collect and integrate patients' medical records and monitor Chinese herbal medicine inventory data in real time;
[0008] The data processing module cleans, organizes and standardizes the collected data;
[0009] The artificial intelligence algorithm module uses a deep learning model to learn and predict the most suitable traditional Chinese medicine prescription for the patient based on the patient's medical records and historical prescription data;
[0010] The prescription generation module generates a preliminary Chinese medicine prescription based on the prediction results of the artificial intelligence algorithm;
[0011] The inventory management module updates inventory data in real time, predicts future inventory needs, and generates purchase recommendations;
[0012] The user interface module is used to enable doctors to easily input patient data and view and modify intelligently generated prescriptions;
[0013] The optimization algorithm module uses a linear programming algorithm to solve a mathematical model to find the optimal herbal medicine combination.
[0014] Beneficial effects of the present invention:
[0015] The present invention improves the matching degree between prescriptions and patients' conditions through the prediction of machine learning models; the present invention reduces the waste of Chinese medicinal materials, improves inventory turnover, and reduces inventory costs; the present invention's automated prescription generation process reduces the workload of doctors and improves the work efficiency of clinics; the present invention's accurate prescriptions and efficient services enhance patients' medical experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 The intelligent prescription generation system architecture diagram of the present invention;
[0017] Figure 2 This is a flow chart of the intelligent algorithm module of the present invention;
[0018] Figure 3 is a flow chart of the inventory management module of the present invention;
[0019] Figure 4 This is a deep learning model diagram of the multimodal fusion architecture of the present invention.
[0020] Figure 5 This is a relationship diagram of the effective ingredients and targets of the Chinese medicinal materials of the present invention. DETAILED DESCRIPTION
[0021] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0022] An intelligent prescription recommendation method for medicinal material shortages, such as Figures 1 to 3 As shown, the method includes: obtaining user electronic medical record data and hospital medicine inventory data; preprocessing the user electronic medical record data; using a deep learning model to process the user electronic medical record data to generate a preliminary Chinese medicine prescription; comparing the medicine information in the preliminary Chinese medicine prescription with the hospital medicine inventory data to determine whether the medicine is missing; if the medicine is missing, screening new medicines from the hospital medicine inventory data to replace the missing medicines, generating a new prescription, and judging the effect of the new prescription. If the effect is poor, the hospital medicine inventory is supplemented; otherwise, a Chinese medicine prescription is generated; reviewing the generated Chinese medicine prescription, if the review fails, the doctor adjusts the Chinese medicine prescription, generates correction data based on the adjusted prescription, and uses the correction data to correct the deep learning model; if the review passes, outputs the Chinese medicine prescription.
[0023] Example 1
[0024] The algorithm principles of the present invention include:
[0025] Step S1.1, system initialization: When the system starts, the patient's medical records and the inventory data of Chinese medicinal materials are loaded from the database.
[0026] Step S1.2: Patient data input: The doctor inputs the patient's latest medical information through the user interface.
[0027] Step S1.3, prescription generation: The system generates a preliminary prescription through artificial intelligence algorithms based on the input patient data and inventory data.
[0028] Step S1.4, inventory matching and adjustment: The system checks whether there is sufficient inventory of the medicinal materials in the prescription. If not, the system proposes alternative solutions or adjusts the prescription.
[0029] Step S1.5, Prescription Review and Output: The doctor reviews the prescription generated by the system and makes manual adjustments if necessary. After confirmation, the system outputs the final prescription and updates the inventory data.
[0030] Step S1.6, Inventory Management and Optimization: The system automatically updates inventory information and generates purchase recommendations based on prescription usage and inventory consumption.
[0031] Through the above embodiments, the present invention can effectively generate personalized Chinese medicine prescriptions for patients while taking into account the available inventory of Chinese medicinal materials, while optimizing the inventory management of the clinic.
[0032] Example 2
[0033] A major problem that the present invention needs to solve is how to select other herbs to supplement the medicinal ingredients when a certain herb is missing in the clinic.
[0034] Mathematical Modeling: This invention uses mathematical modeling to determine the optimal combination of alternative herbs. In this model, the chemical composition of each herb is quantified and compared with the composition of Poria cocos. By defining a substitution coefficient Tij, the model can calculate the coverage of Poria cocos components by different herbal combinations.
[0035] Mathematical modeling is performed on this problem, and the objective function needs to maximize the coverage of medicinal ingredients that meet the needs.
[0036]
[0037] Among them, T ij is the substitution coefficient between the i-th Chinese medicinal material and the j-th alternative Chinese medicinal material, that is, the similarity of the ingredients.
[0038] Non-negativity constraint: Ensure that the usage of all medicinal materials is non-negative.
[0039]
[0040] Substitution constraint: If the inventory of the i-th medicinal material is insufficient, it is necessary to use alternative medicinal materials to meet the demand.
[0041] The substitution coefficient needs to reflect the similarity of medicinal ingredients.
[0042]
[0043] in, is the usage of the jth alternative Chinese medicinal material. ,D i is the total demand for the i-th type of Chinese medicinal materials. , Q i is the current inventory of the i-th Chinese medicinal material. , m is the total type of medicinal materials in the medicinal material library, and n is the type of medicinal material that needs to be replaced.
[0044] The following is a specific example, considering how to use other herbs to replace 100g of Poria cocos and produce Huanglian Wendan Decoction under the condition that the hospital lacks 100g of Poria cocos.
[0045]
[0046] In the case of Poria cocos missing, other herbs are used as substitutes to ensure that the required components are met. In order to build a mathematical model to solve this problem, it is necessary to consider the content of key components in each herb and find the best combination to replace the effective chemical components of Poria cocos 9g.
[0047] Therefore, it is necessary to compare the contents of components in Poria cocos with those of corresponding components in other herbs.
[0048]
[0049]
[0050] According to the chart, the content of the ingredients in Poria cocos can be compared with the content of the ingredients in other herbs. By calculating these variables, set Job's tears, Polyporus umbellatus, Chinese yam, and Polygonum multiflorum as y1, y2, y3, and y4 respectively; define the content of a certain ingredient as y ij , such as the protein content in coix seed is expressed as y11.
[0051] By maximizing the total content of key ingredients in the alternative herbs, the missing components of Poria cocos can be satisfied. Among them, the missing component constraints of Poria cocos include: protein constraint: 7.35g≤∑y ij ; Polysaccharide constraint: 15.1g≤∑y ij ; Niacin limit: 0.35mg≤∑y ij ; Potassium constraint: 13mg≤∑y ij ; Vitamin B2 limit: 0.36mg≤∑y ij; Fat limit: 0.43g≤∑y ij ; Constraint on the amount of herbal medicine used: 0≤y 薏 ,y 山 ,y 猪 ,y 夜 ≤ Maximum usage of each herb; Herb selection constraint: y 薏 ,y 山 ,y 猪 ,y 夜 ∈{0,1}, which means that if a certain herb is chosen, then y is 1, otherwise it is 0.
[0052] When choosing a single herbal replacement, the following ingredients were obtained: 17.81g coix seed, 12.43g umbellatus, 47.82g yam, and 11.81g polyphylla. This can replace the missing 10.00g of Poria.
[0053] In this example, when selecting a combination of herbs as a replacement, the chemical composition ratios of the combined herbs should be as similar as possible to those of Poria cocos itself. To ensure that the chemical composition ratios of the substitute herbs are similar to those of Poria cocos, a new objective function is introduced that minimizes the deviation of the chemical composition ratios of the substitute herbs from those of Poria cocos. This is achieved by calculating the deviation of the chemical composition ratios of each herbal ingredient from those of Poria cocos and taking a weighted sum of these deviations.
[0054] First, the deviation of each herbal component from the ratio of Poria cocos components was defined. Then, a weight was assigned to each component, which could be the relative importance of the component in Poria cocos or the substitutability of the component in alternative herbs.
[0055]
[0056] Among them, c ij is the content of the jth ingredient in the i-th herb, c j For Poria cocos, f l is the content of the jth component in Poria cocos, y i is the usage of the i-th herbal medicine, ω j is the weight of the jth ingredient, n is the number of herbal species, and CF is the set of ingredients that need to be matched.
[0057] The constraints of the substitutability formula of ingredients in alternative herbs include the total amount constraint of ingredients and the amount constraint of herbs used.
[0058] Constraint on the total amount of ingredients: Ensure that the total amount of each ingredient in the alternative herbal medicine is at least the amount of the ingredient in Poria cocos. Its expression is:
[0059]
[0060] Herb usage constraint: The usage of each herb cannot exceed its maximum available amount. Its expression is:
[0061]
[0062] In the above model, the objective function minimizes the squared deviation of the mean ratio of the surrogate herbs to the Poria cocos component. Weights can be used to adjust the relative importance of different components in the objective function. By solving this optimization problem, the optimal dosage of each herb can be determined, so that their combination has a ratio as close to that of Poria cocos as possible.
[0063] Example 3
[0064] An intelligent prescription recommendation system for medicinal material shortages, comprising: a data collection module, a data processing module, an artificial intelligence algorithm module, a prescription generation module, an inventory management module, a user interface module, and an optimization algorithm module; specifically, the system includes:
[0065] Data Collection Module: Responsible for collecting and integrating patients' medical records, including but not limited to medical history, allergies, current conditions, and past prescription records. Real-time monitoring of Chinese herbal medicine inventory data, including type, quantity, expiration date, and other information.
[0066] Data processing module: cleans, organizes and standardizes the collected data to facilitate subsequent analysis and processing.
[0067] Artificial Intelligence Algorithm Module: Leveraging a deep learning model, the system learns and predicts the most appropriate Traditional Chinese Medicine (TCM) prescription for each patient based on their medical records and historical prescription data. During model training, historical prescription data and inventory data are used to ensure the model understands inventory constraints and generates feasible prescriptions.
[0068] Prescription Generation Module: Generates preliminary Chinese medicine prescriptions based on the predictions of the AI algorithm. The system evaluates the compatibility of the Chinese medicinal materials in the prescription with the clinic's inventory. If certain medicinal materials are insufficient in stock, the system automatically suggests alternatives or adjusts the proportions of the medicinal materials in the prescription.
[0069] Inventory Management Module: Updates inventory data in real time, forecasts future inventory needs, and generates purchasing recommendations. Adjusts inventory management strategies based on actual prescription usage to reduce inventory overstock and stockout risks.
[0070] User Interface Module: This module provides a user-friendly interface that enables doctors to easily input patient data and view and modify intelligently generated prescriptions. It also provides inventory management functionality, enabling doctors and administrators to monitor the inventory status of Chinese herbal medicines.
[0071] Optimization algorithm module: linear programming or other optimization algorithms are used to solve the mathematical model to find the optimal herbal combination.
[0072] In this example, the chemical composition ratio of the alternative herbal medicine is ensured to be similar to that of Poria cocos, while minimizing the amount of the herbal medicine used. Specifically, the following are included:
[0073] Initialization: When the system starts, the data collection module loads the patient's medical records and the inventory data of Chinese herbal medicines.
[0074] Data input: Doctors input the patient's latest medical information through the user interface.
[0075] Prescription generation: The system generates preliminary prescriptions based on the input patient data and inventory data through artificial intelligence algorithms.
[0076] Inventory matching and adjustment: The system checks whether there is sufficient inventory of the medicinal materials in the prescription. If not, the system proposes alternatives or adjusts the prescription.
[0077] Prescription review and output: The doctor reviews the prescription generated by the system and makes manual adjustments if necessary. After confirmation, the system outputs the final prescription and updates the inventory data.
[0078] Inventory management and optimization: The system automatically updates inventory information and generates purchasing recommendations based on prescription usage and inventory consumption.
[0079] Through the implementation of the above system, the present invention can effectively generate personalized Chinese medicine prescriptions for patients while taking into account the available inventory of Chinese medicinal materials, while optimizing the inventory management of the clinic.
[0080] Example 4
[0081] An important aspect of the present invention is the consideration of drug prescription matching, which is further illustrated in this example.
[0082] The prescription matching formula is a key component of the intelligent prescription generation system. It is used to quantify the degree of match between the generated prescription and the patient's needs. This metric helps doctors and the system assess the appropriateness of the prescription and make adjustments when necessary. The following is a detailed description of the prescription matching formula:
[0083] The formula is defined as:
[0084]
[0085] Where n is the amount of herbal medicine replaced, q ij is the jth ingredient of the i-th herb, t j is the amount of the jth ingredient, m is the total amount of all herbs, v j The weight assigned to each component.
[0086] In the above formula, the ratio of the component amount to the target amount is: This section calculates the ratio of the amount of the jth ingredient in the ith herb to the target amount, and then divides it by the total amount of that ingredient in all herbs. This gives the relative importance of the contribution of the ith herb to the jth ingredient.
[0087] Weighted summation: vj is a weighting factor that adjusts the importance of different ingredients in the prescription. For example, ingredients that are crucial for treating a specific disease may be given a higher weight.
[0088] Overall fit: By adding the weighted contributions of all components, we get a fit score for the entire prescription. A higher score indicates a better match between the prescription and the patient's needs.
[0089] In this embodiment, the specific implementation process of the drug prescription matching includes:
[0090] 1. Data collection: Collect the patient's medical records and target quantities of the required ingredients j .
[0091] 2. Component analysis: Analyze each herb j The content of each ingredient.
[0092] 3. Weight allocation: Assign weight v to each component based on medical knowledge and clinical experience j .
[0093] 4. Calculate the matching degree: Use the above formula to calculate the matching score of the prescription.
[0094] 5. Prescription evaluation: Evaluate the suitability of the prescription based on the matching score. If the score is lower than the set threshold, the prescription needs to be adjusted.
[0095] 6. Adjustment and optimization: Based on the matching results, the system or doctor can adjust the type or dosage of herbs to improve the matching.
[0096] The application scenarios of this embodiment are: Personalized medicine: Customizing prescriptions for different patients to ensure that the medicinal ingredients are closely matched to the patient's needs. Herbal medicine substitution: When certain medicinal herbs are in short supply, finding substitutes with similar ingredients to maintain the efficacy of the prescription. Clinical research: Evaluating the effectiveness of different prescriptions and providing data support for clinical decision-making. In this way, the intelligent prescription generation system can ensure the scientific and personalized nature of prescriptions, improve treatment effectiveness, and optimize the use of medicinal herbs.
[0097] Example 5
[0098] A key aspect of the present invention is how to implement inventory monitoring, which is further explained in this embodiment. Specifically, inventory coverage is monitored as a key indicator of the intelligent prescription generation system's ability to meet prescription requirements through the inventory of Chinese medicinal materials. This metric helps clinic or hospital managers understand whether current inventory can meet patient needs and whether procurement strategies need to be adjusted.
[0099] Inventory coverage is a key metric used in intelligent prescription generation systems to measure the ability of Chinese herbal medicine inventory to meet prescription requirements. This metric helps clinic or hospital managers understand whether current inventory can meet patient needs and whether procurement strategies need to be adjusted. The following is a detailed description of inventory coverage.
[0100] Formula definition:
[0101]
[0102] Among them, min(S i ,q i ) represents the smaller of the stock level and the demand level for each herb. This reflects the extent to which inventory can meet prescription demand without considering other factors.
[0103] Total ratio: The total amount of all herbal medicines in stock that could meet prescription demand was calculated. is the total requirement of all herbs in the prescription.
[0104] Coverage: The inventory coverage ratio is calculated by comparing the total amount of inventory that meets demand with the total demand. The closer this ratio is to 1, the more inventory can meet prescription demand.
[0105] In this embodiment, the specific implementation steps include:
[0106] Step 1. Data collection: Collect and update inventory data and prescription demand data of Chinese medicinal materials.
[0107] Step 2: Matching inventory and demand: For each herb, calculate the minimum value of its inventory and prescription demand.
[0108] Step 3. Calculate coverage ratio: Use the coverage ratio calculation formula to calculate the inventory coverage ratio.
[0109] Step 4: Inventory Assessment: Assess the adequacy of inventory based on coverage. If coverage falls below a certain threshold, it may be necessary to consider increasing inventory or finding alternative medicinal materials.
[0110] Step 5. Purchasing Decision: Based on inventory coverage, develop or adjust purchasing plans to ensure that inventory can meet future prescription needs.
[0111] Step 6. Continuous Monitoring: Regularly monitor inventory coverage to respond to changes in medicinal material demand and fluctuations in the supply chain.
[0112] This system helps managers understand inventory status and adjust procurement strategies in a timely manner. It also issues warnings when inventory coverage decreases, preventing herbal medicine shortages from impacting patient care. By optimizing inventory levels, it reduces costs associated with excess inventory while ensuring that inventory can meet clinical needs. In this way, the intelligent prescription generation system not only improves prescription accuracy and personalization, but also optimizes inventory management, reduces costs, and improves the overall efficiency of medical services.
[0113] The above embodiments further illustrate the purpose, technical solutions and advantages of the present invention in detail. It should be understood that the above embodiments are only preferred implementation plans of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made to the present invention within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
[0114] Example 6
[0115] An important part of the present invention is the deep learning model training process and model structure. This model adopts a multimodal fusion architecture, which is divided into an input layer, a cross-modal attention fusion layer, a dynamic decision optimization layer, and an output layer from left to right, realizing an end-to-end computing process from multi-source data input to intelligent prescription generation, such as Figure 4 This embodiment further illustrates this.
[0116] A. The input layer contains three parallel data input channels, covering the multi-dimensional characteristics of Chinese medicinal materials:
[0117] 1. Spectral data input: Input the near-infrared spectrum waveform of Chinese medicinal materials and extract the local characteristics of chemical components (such as the peak characteristics of polysaccharides and alkaloids).
[0118] 2. Ancient book text input: Generate semantic embedding vectors to capture the medicinal properties (four properties and five flavors) and efficacy descriptions. An input example is "Poria cocos, sweet and mild in taste, neutral in nature, mainly promotes diuresis and eliminates dampness..." from the Compendium of Materia Medica.
[0119] 3. Input of medicinal material relationship diagram: medicinal material node diagram (node = medicinal material, edge = traditional compatibility relationship), to model the synergistic / antagonistic effects between medicinal materials.
[0120] Cross-modal attention fusion module: Integrates multi-source features through the gated cross-attention mechanism to connect spectral, text, and image feature vectors through cross arrows, and dynamically calculates cross-modal association weights.
[0121] Gating formula:
[0122] σ(W g [hi ;h j ])
[0123] where h i ,h j are different modal eigenvectors, W g is the learnable parameter matrix,
[0124] σ is the Sigmoid activation function.
[0125] This modality displays the contribution weights (example values: 0.6 for spectra, 0.3 for text, 0.1 for image data), indicating that the chemical composition data dominates the decision.
[0126] B. The dynamic decision optimization layer combines reinforcement learning with knowledge constraints to generate safe and effective alternatives:
[0127] 1. Reinforcement Learning Module: Use the TD3 optimization algorithm to maximize prescription ingredient coverage and efficacy matching, while minimizing inventory costs.
[0128] 2. Knowledge graph constraints: Display the "herb-effect-contraindication" triple (e.g., Poria cocos → diuretic and dampness-removing → incompatible with licorice). When a contraindication is detected, the substitution coefficient of the corresponding herb is forced to be set to zero for dynamic correction.
[0129] C. Output layer dynamic interface such as generating real-time indicators:
[0130] Ingredient coverage: 107% (green progress bar) Taboo detection: red "√" mark (indicating no conflict).
[0131] At the same time, "TD3 algorithm optimization" is carried out to achieve closed-loop learning of prescription effects and clinical feedback.
[0132] The following is a specific embodiment.
[0133] Step 1: Scenario Description
[0134] A Chinese medicine hospital needs to adjust its prescription due to insufficient Poria cocos inventory. The alternative solution must meet the following requirements:
[0135] 1. Coverage of core components (polysaccharides, triterpenes) ≥ 95%.
[0136] 2. Matching medicinal effects (diuresis and dampness removal, spleen and stomach strengthening).
[0137] 3. Avoid the "Eighteen Antidotes" with existing medicinal materials in the prescription (such as licorice).
[0138] Feedback optimization of parameters in the reinforcement learning module includes the following steps:
[0139] Step 1: Construct a multi-objective reward function to guide policy optimization
[0140]
[0141] The specific calculation method is as follows
[0142] Effect Rewards:
[0143]
[0144] Among them, Scf is the chemical composition matching degree, and Sgx is the efficacy similarity.
[0145] Inventory Rewards:
[0146]
[0147] Step 2: Construct a three-dimensional continuous action space to represent the prescription adjustment strategy: dosage adjustment amount (normalized dosage change ratio), herbal substitution probability (possibility of substitution of candidate herbal j), and compatibility strength (compatibility weight coefficient of herbal k).
[0148] Step 3: Spectral data from a public database of traditional Chinese medicine ingredients (TCM-ID), such as near-infrared spectra of Poria cocos and candidate medicinal materials (Coix seed, Polyporus umbellatus, etc.), were subjected to SG filtering, denoising, and normalization (wavelength range 900-1700 nm). A TCM dictionary was used to input the following passage: "Poria cocos, sweet and mild in taste, neutral in nature, enters the heart and spleen meridians, promotes diuresis without harming the body..." (from Compendium of Materia Medica, Volume 37). A medicinal material relationship graph was generated: 582 diuretic and dampness-removing medicinal materials were constructed as nodes, and edges were constructed based on compatibility relationships (edge weight = co-occurrence frequency in historical prescriptions) and property and flavor similarity (calculated based on the property and flavor meridian coding in the Chinese Pharmacopoeia).
[0149] Step 4: Model parameter configuration
[0150]
[0151] Step 5: Multimodal feature extraction results are as follows: 1D-CNN extracts a 128-dimensional feature vector from the Poria cocos spectrum (focusing on the polysaccharide peak at 1720 nm). BERT generates a text semantic vector (cosine similarity calculation shows a correlation of 0.89 with the keyword "spleen-strengthening"). GAT calculates the graph embedding of the candidate medicinal materials (compatibility weight of Poria cocos and Poria cocos = 0.93, and similarity in nature and flavor = 0.85).
[0152] Gated cross attention calculation weights:
[0153] Spectrum = 0.62, Text = 0.28, Image = 0.10
[0154] Step 6, dynamic decision generation: The TD3 algorithm outputs the optimal combination as: coix seed 12g + poria 3g.
[0155] The basis for the adjustment is that Poria makes up for the polysaccharide gap (contribution +8%) and Coix seed enhances the spleen-strengthening effect (drug efficacy similarity 91%).
[0156] Step 7: Knowledge graph verification. It is detected that the original prescription contains licorice, which automatically triggers the "Eighteen Antidotes" rule (Poria cocos should not be used with licorice). Therefore, all licorice-containing herbs are removed from the alternative plan.
[0157] Step 8. Result output
[0158]
[0159] Step 9: Innovation: Multimodal decision-making offers multiple advantages. Spectral data ensures chemical component equivalence (polysaccharide peak matching error <0.3nm), and constraints from ancient texts ensure compliance with the theory of "nature, flavor, and meridians." The TD3 algorithm can learn the "small-dose combination synergy" strategy within 10^5 iterations (for example, 12g + 3g is better than 15g of a single herb). A safety barrier knowledge graph was also designed to intercept six potentially risky combinations in real time (for example, mistakenly selecting kansui).
[0160] Example 7
[0161] An important part of the present invention is to determine the effectiveness of the prescription effect, which is further illustrated in this example.
[0162] Step S7.1, the system automatically performs verification by judging the prescription matching degree of the alternative medicinal materials. Calculate and verify whether the prescription matching degree meets the standard. If it does not meet the standard, trigger an alarm and regenerate an alternative solution. Step S7.2, drug property conflict detection: automatically match TCM taboos (such as "Eighteen Antidotes" and "Nineteen Fears") through the rule library call. And perform dynamic correction. If a conflict is detected, the corresponding Tij will be forced to zero and the alternative solution will be recalculated.
[0163] Step S7.3, Efficacy Label Matching Analysis: Using an NLP model, semantic similarity is calculated to compare the efficacy descriptions of the original and alternative herbs (e.g., "diuresis and dampness removal" vs. "spleen-strengthening and dampness-removing"). A threshold is set to determine if the similarity is <80%, indicating a "potential efficacy deviation" and requiring manual review.
[0164] Step S7.4, multi-source labeling system construction: The data sources are as follows: "Classification Standards for Chinese Medicine Efficacy" of the National Pharmacopoeia Committee; "Classification and Code of Traditional Chinese Medicine Diseases" (GB / T 15657-2021); empirical efficacy annotations in historical hospital prescriptions. Perform dynamic semantic enhancement matching, use the BERT-wwm-ext model to perform context-aware encoding of efficacy descriptions, and then use the TransE algorithm to learn efficacy entity embedding in the knowledge graph. Step S7.5, knowledge graph-driven verification: Check whether the efficacy node of the alternative medicinal material can reach the treatment target node of the original medicinal material for path matching. The specific path demonstration is as follows Figure 5 The weights of the path scores are as follows:
[0165]
[0166] Step S7.6, Small-sample Clinical Pilot Trial: Recruit 30-50 patients with the target indication (divided into an alternative group and an original group). Patients and evaluating physicians are unaware of group assignment. Primary efficacy measures (e.g., improvement in symptom scores) and safety measures (liver and kidney function, allergic reactions) are assessed. If the efficacy rate in the alternative group is ≥ 90% of the efficacy rate in the original group, and there is no significant increase in adverse reaction rates, the prescription is considered effective.
[0167] Step S7.7, Model Adaptive Optimization: If an alternative treatment triggers adverse reactions multiple times in clinical practice, the corresponding Tij weight is automatically reduced. If the ingredient coverage meets the target but the efficacy is insufficient, the "drug efficacy compensation" algorithm is activated to add related herbs (such as adding astragalus to enhance the qi-tonifying effect).
[0168] The technical innovations of this step are as follows:
[0169] 1. Multimodal semantic fusion breaks through the limitations of traditional keyword matching and solves the problem of polysemy in traditional Chinese medicine terms (such as the different connotations of "removing dampness" in different contexts).
[0170] 2. Dynamic reasoning of knowledge graphs: Ensure the consistency of the therapeutic direction of alternative medicinal materials through path analysis, and avoid the risk of "ingredients meet the standards but the efficacy deviates."
[0171] Example 8
[0172] An important part of the present invention is to achieve unified feature representation of cross-modal projection matrices, using an alternating projection algorithm to ensure compliance with pharmacopoeial specifications.
[0173] Step S8.1: Construct a cross-modal projection matrix to achieve unified feature representation:
[0174] a Infrared spectral characteristics (Fir): 256-dimensional spectral bands, reflecting the chemical composition of medicinal materials.
[0175] bSemantic embedding vector (E-text): 768-dimensional text vector describing the efficacy and usage of medicinal materials.
[0176] c Medicinal material relationship diagram (A): The adjacency matrix represents the compatibility relationship of medicinal materials.
[0177] Then, features of different dimensions are mapped to a unified latent space through a learnable matrix. This eliminates the dimensional differences of features of different modalities while retaining the uniqueness of each modality (such as the locality of the spectrum and the global semantics of the text).
[0178] Step S8.2, knowledge-constrained attention calculation, specifically includes:
[0179] Construct a 3D attention cube K∈R mmc (Three dimensions c include: nature, flavor and meridian matching degree, efficacy synergy coefficient, and contraindication level.)
[0180] Generate constraint weights through knowledge embedding network:
[0181]
[0182] Where M(k) is a trainable third-order tensor, k∈{nature, meridian, efficacy}.
[0183] Where vi and vj represent the knowledge graph embedding vectors of medicinal materials i and j, and M(k) represents a trainable third-order tensor to learn the influence of different knowledge dimensions.
[0184] Step S8.3: An alternating projection method is used to ensure compliance with pharmacopoeial specifications. Specifically, the vector vi of herbal ingredient i is transformed using the M(k) matrix to map the original features into a dedicated space for knowledge dimension k. The dot product of the transformed vector and the vector of herbal ingredient j is calculated. A larger dot product indicates a stronger correlation between the two herbs in that knowledge dimension. The dot product result is then converted to a probability distribution using an activation function and normalized.
[0185] When judging the rationality of the combination of "Astragalus" and "Codonopsis", the matrix changes as follows:
[0186] Nature and flavor dimension (k=1)
[0187] Astragalus is warm in nature, Codonopsis is neutral in nature → after M1 matrix transformation, the dot product is 0.92 → activation output is 0.87
[0188] Efficacy dimension (k=2)
[0189] All are Qi-tonifying herbs → Dot product 0.85 → Output 0.82
[0190] Taboo dimension (k=3)
[0191] No incompatibility → dot product -0.1 → output 0.32 (low risk)
[0192] Comprehensive judgment: Both herbs scored higher than 0.8 in key dimensions, and the system recommends them as an alternative combination.
[0193] The following is a complete example using the cross-modal attention module:
[0194] When the stock of "Danggui" is insufficient, the module processing flow is as follows:
[0195] Feature alignment: Project the infrared spectrum (256D) and text description (768D) of Angelica sinensis into a 512D space. Knowledge constraints: Retrieve the information between Angelica sinensis and candidate medicinal materials (such as Chuanxiong and White Peony Root) in the knowledge cube:
[0196] Matching degree of nature, flavor and meridians: Chuanxiong (0.92), White Peony Root (0.85).
[0197] Efficacy synergy coefficient: Chuanxiong (0.88), White Peony Root (0.79).
[0198] Taboo level: No conflict (0)
[0199] Attention calculation: Chuanxiong has a higher matching degree and gets α=0.63, while Baishao has α=0.37
[0200] Gated fusion: Component gate g_chem = 0.7 (spectral features are significant), and finally Chuanxiong is selected as the replacement output effect:
[0201] Feature pyramid captures the long-range synergistic effect of "Danggui-Ligusticum chuanxiong-Rehmanniae"
[0202] Alternate optimization ensures that the replaced prescription complies with the specifications of the Siwu Decoction in the Pharmacopoeia
[0203] Through the above steps, the module can achieve accurate replacement recommendations for short-supply medicinal materials while ensuring prescription safety.
[0204] Example 9
[0205] This embodiment explains in detail how the TD3 algorithm performs feedback optimization on the parameters in the reinforcement learning module.
[0206] The cross-modal attention module processes the fused features by using a cross-modal projection matrix to achieve unified feature representation and an alternating projection algorithm to ensure compliance with pharmacopoeia specifications. The main steps include:
[0207] Step 1: Perform performance-oriented free optimization to maximize the efficacy of the prescription. Use an improved delayed deep deterministic policy gradient algorithm to explore the solution space. This involves calculating continuous values across three dimensions: herbal type, dosage, and compatibility strength. The current prescription combination is derived from these continuous values.
[0208] Step 2: Construct a mandatory projection of the pharmacopoeia constraints, calculate the conflict score between the current prescription combination and the knowledge graph C in real time, and perform taboo detection. The detection mechanism is as follows:
[0209]
[0210] Among them, Pcurrent indicates that the list of medicinal materials included in the current prescription is generated by the system in real time; s,o represent the subject and object of the rule; w is the manually set rule severity weight;
[0211] Step 3: Set the detection score range. If the conflict score exceeds the detection score range, enable gradient projection descent and return to step 2. Otherwise, execute step 4. The gradient projection descent is:
[0212]
[0213] Among them, η represents the learning rate, is the gradient of the violation score with respect to the prescription action a,
[0214] is the sign function of the gradient of the efficacy Q value;
[0215] Step 4: Reconstruct the legal solution space and generate candidate prescriptions that meet the constraints through the adversarial generative network. The expression is:
[0216]
[0217] Among them, λ is the regularization coefficient, z is the latent variable used to generate candidate prescriptions, areal is the historical legal prescription data used to generate candidate prescriptions, G is the generator network, and D is the discriminator network;
[0218] Step 5: The alternating projection mechanism finds the optimal balance between efficacy and compliance within seconds, improving the speed of multi-objective optimization and the adoption rate of candidate solutions. The adversarial generative network retains the diversity of generated prescriptions while ensuring the compliance of the generated prescriptions.
[0219] Specifically include:
[0220] Step S9.1: Create six neural networks divided into online networks and target networks, and then synchronize parameters.
[0221] Actor network (strategy network): Input is a 384-dimensional state vector (features after time series splicing) and output is a 60-dimensional continuous action space (20 medicinal herbs × 3 adjustment dimensions: dosage / replacement probability / compatibility strength).
[0222] Critic network 1: Input state (384 dimensions) and action (60 dimensions) concatenation vector, output single value Q value estimate
[0223] Critic Network 2: The structure is the same as Critic Network 1, with independent initialization parameters.
[0224] Actor'_Network: The structure is exactly the same as the online Actor, and the initial parameters are copied from the Actor
[0225] Critic'_Network1 / 2: correspond to the replicas of online Critic1 / 2 respectively.
[0226] Perform hard copy initialization: Actor'_parameters ← Actor_parameters; Critic1'_parameters ← Critic1_parameters; Critic2'_parameters ← Critic2_parameters
[0227] Step S9.2: Each interaction data point is stored in a buffer pool. 256 samples are randomly sampled from the buffer pool for each training session. High-risk samples, such as those with inventory shortages and compatibility conflicts, are assigned a 2x sampling weight. Sampling helps break data correlation and improve sample utilization.
[0228] After each interaction with the environment, the four-tuple data is stored in the replay pool. (Current state s performs action a, obtains reward r, and the next state is s+1.)
[0229] Step S9.3: Perform batch normalization to stabilize the training process and prevent gradient explosion.
[0230] At the same time, a discount factor is set to balance immediate rewards and long-term benefits.
[0231] Step S9.4 sets the target update interval. The exploration rate should be maintained between 0.25 and 0.3 in the early stages of training to promote early and sufficient exploration. Later, it should be stabilized at 0.1 to 0.15 to achieve dynamic noise regulation and achieve a dynamic balance between exploration and exploitation. Automatically adjust based on stability: When the noise drops below the set value, reset the exploration rate.
[0232] Through the above-mentioned refined step control, the TD3 algorithm achieves efficient training in the medicinal material recommendation scenario, while controlling the probability of strategy error to below 1%.
[0233] The above embodiments further illustrate the purpose, technical solutions and advantages of the present invention in detail. It should be understood that the above embodiments are only preferred implementation plans of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made to the present invention within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. An intelligent prescription recommendation method for medicinal material shortage, characterized by: include: Obtain user electronic medical record data and hospital medicine inventory data; Preprocess user electronic medical record data; Use deep learning models to process user electronic medical record data and generate preliminary Chinese medicine prescriptions; Compare the medicinal material information in the preliminary Chinese medicine prescription with the hospital's medicinal material inventory data to determine whether any medicinal materials are missing; If medicinal materials are missing, new medicinal materials are selected from the hospital's medicinal material inventory data to replace the missing medicinal materials, a new prescription is generated, and the effectiveness of the new prescription is judged. If the effect is poor, the hospital's medicinal material inventory is supplemented; otherwise, a traditional Chinese medicine prescription is generated; the generated traditional Chinese medicine prescription is reviewed. If the review fails, the doctor adjusts the traditional Chinese medicine prescription, generates corrected data based on the adjusted prescription, and uses the corrected data to correct the deep learning model; if the review passes, the traditional Chinese medicine prescription is output.
2. The intelligent prescription recommendation method for medicinal material shortage according to claim 1, characterized in that: Preprocessing of user electronic medical record data includes: cleaning, organizing and standardizing the electronic medical record data.
3. The intelligent prescription recommendation method for medicinal material shortage according to claim 1, characterized in that: The deep learning model is a graph neural network based on the attention mechanism; Training the deep learning model includes: obtaining the original data set, which includes medicinal material data and traditional Chinese medicine text; preprocessing the data in the data set to obtain a training set; inputting the data in the training set into the input layer of the graph neural network, and the infrared spectrum module of the input layer performs infrared spectrum analysis on the medicinal material data to obtain an infrared spectrum graph; the text module of the input layer processes the traditional Chinese medicine text to obtain a semantic embedding vector; the graph attention network of the input layer processes the medicinal material data to obtain a medicinal material relationship graph; using a gated cross-attention mechanism to process the infrared spectrum graph, the semantic embedding vector and the medicinal material relationship graph to obtain a fused feature graph; inputting the fused feature graph into the transmembrane attention module, and constraining the data in the transmembrane attention module through the knowledge graph constraint bar to obtain an optimized feature graph; inputting the optimized feature graph into the reinforcement learning module, and feedback optimizing the parameters in the reinforcement learning module through the TD3 algorithm to obtain the user state; generating a preliminary Chinese medicine prescription based on the user state; calculating the loss function of the model based on the preliminary Chinese medicine prescription, and optimizing the model parameters using the Adam optimizer, and completing the model training when the loss function converges.
4. The intelligent prescription recommendation method for medicinal material shortage according to claim 3 is characterized in that: The text module processes TCM texts by: using a pre-trained TCM language model to perform multi-level semantic analysis on TCM texts in electronic medical records; constructing a knowledge graph of classic TCM prescriptions, with each node in the knowledge graph containing medicinal material compatibility rules; and embedding symptom characteristics, historical treatment rules, and classic compatibility knowledge in the semantic embedding vector based on the knowledge graph combined with a dynamic knowledge enhancement mechanism.
5. The intelligent prescription recommendation method for medicinal material shortage according to claim 3 is characterized in that: Obtaining the medicinal material relationship graph includes: converting the data of each medicinal material into numerical features; calculating the similarity features of each medicinal material based on the numerical features; inputting the similarity features into the graph attention network to obtain the relationship between each edge; and constructing the medicinal material relationship graph by taking each medicinal material as a node and the edge relationship as the edge of the graph.
6. The intelligent prescription recommendation method for medicinal material shortage according to claim 1, characterized in that: The cross-modal attention module processes the fused features by using a cross-modal projection matrix to achieve unified feature representation and an alternating projection algorithm to ensure compliance with pharmacopoeia specifications. The main steps include: Step 1: Perform performance-oriented free optimization to maximize the efficacy of the prescription. Use an improved delayed deep deterministic policy gradient algorithm to explore the solution space. This involves calculating continuous values across three dimensions: herbal type, dosage, and compatibility strength. The current prescription combination is derived from these continuous values. Step 2: Construct a mandatory projection of the pharmacopoeia constraints, calculate the conflict score between the current prescription combination and the knowledge graph C in real time, and perform taboo detection. The detection mechanism is as follows: Among them, Pcurrent indicates that the list of medicinal materials included in the current prescription is generated by the system in real time; s,o represent the subject and object of the rule; w is the manually set rule severity weight; Step 3: Set the detection score range. If the conflict score exceeds the detection score range, enable gradient projection descent and return to step 2. Otherwise, execute step 4. The gradient projection descent is: Among them, η represents the learning rate, is the gradient of the violation score with respect to the prescription action a, is the sign function of the gradient of the efficacy Q value; Step 4: Reconstruct the legal solution space and generate candidate prescriptions that meet the constraints through the adversarial generative network. The expression is: Among them, λ is the regularization coefficient, z is the latent variable used to generate candidate prescriptions, areal is the historical legal prescription data used to generate candidate prescriptions, G is the generator network, and D is the discriminator network; Step 5: The alternating projection mechanism finds the optimal balance between efficacy and compliance within seconds, improving the speed of multi-objective optimization and the adoption rate of candidate solutions. The adversarial generative network retains the diversity of generated prescriptions while ensuring the compliance of the generated prescriptions.
7. The intelligent prescription recommendation method for medicinal material shortage according to claim 1, characterized in that: Screening new medicinal materials to replace missing medicinal materials includes: preliminarily screening out potential alternative medicinal materials through dynamic candidate generation technology; combining the dual-drive mechanism of graph neural network and knowledge graph to conduct multi-objective optimization analysis on candidate medicinal materials, and replacing missing medicinal materials according to the analysis results.
8. The intelligent prescription recommendation method for medicinal material shortage according to claim 1 is characterized in that: Judging the effectiveness of a new prescription includes: conducting a preliminary evaluation of the rationality and scientificity of the prescription through theoretical verification; conducting an efficacy label matching analysis on the prescription that has undergone the preliminary evaluation; verifying the actual effect of the prescription through small-sample clinical pilot trials, and adaptively optimizing the model based on the test data.
9. The intelligent prescription recommendation method for medicinal material shortage according to claim 1, characterized in that: Using corrected data to correct the deep learning model includes: establishing an incremental learning framework, correcting the edge weights through the incremental learning framework, and cross-validating the corrected weights.
10. An intelligent prescription recommendation system for medicinal material shortages, the system being used to execute the intelligent prescription recommendation method for medicinal material shortages according to any one of claims 1 to 9, characterized in that: include: Data collection module, data processing module, artificial intelligence algorithm module, prescription generation module, inventory management module, user interface module and optimization algorithm module; The data collection module is used to collect and integrate patients' medical records and monitor Chinese herbal medicine inventory data in real time; The data processing module cleans, organizes and standardizes the collected data; The artificial intelligence algorithm module uses a deep learning model to learn and predict the most suitable traditional Chinese medicine prescription for the patient based on the patient's medical records and historical prescription data; The prescription generation module generates a preliminary Chinese medicine prescription based on the prediction results of the artificial intelligence algorithm; The inventory management module updates inventory data in real time, predicts future inventory needs, and generates purchase recommendations; The user interface module is used to enable doctors to easily input patient data and view and modify intelligently generated prescriptions; The optimization algorithm module uses a linear programming algorithm to solve a mathematical model to find the optimal herbal medicine combination.
Citation Information
Cited By
Polygonatum odoratum formula medication recommendation method based on ancient literature
CN121237328A
Training method, system and equipment of medical prescription recommendation model and medium
CN122455396A