Traditional Chinese medicinal material intelligent purchase prediction and early warning model
By combining LSTM neural networks with traditional Chinese medicine knowledge graphs, the problems of low prediction accuracy and inventory management in the procurement management of Chinese medicinal materials were solved, achieving efficient demand forecasting and intelligent replenishment of Chinese medicinal materials, and improving the accuracy and standardization of inventory management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-25
- Publication Date
- 2026-04-17
AI Technical Summary
Existing methods for managing the procurement of Chinese medicinal materials have low forecasting accuracy, cannot effectively handle the influence of multiple factors, do not consider the unique properties of Chinese medicinal materials, lack early warning mechanisms, have low inventory turnover rates, and low standardization, resulting in high rates of stockouts, backlogs, and expired losses, making it difficult to promote on a large scale.
A time-series demand forecasting model based on LSTM neural network is constructed. By combining multi-source data fusion and knowledge graph of traditional Chinese medicine theory, time series, seasonality and correlation features are extracted, a weighted loss function is set, a three-level shortage warning signal and intelligent replenishment suggestions are generated, and dynamic adjustments are made based on actual consumption data.
It improves the accuracy of forecasting the purchase of Chinese medicinal materials, significantly reduces the risk of stockouts, increases inventory turnover, reduces inventory costs, and fully considers the unique properties of Chinese medicinal materials to achieve standardized management.
Smart Images

Figure CN121882877A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of Chinese medicinal herb inventory management and intelligent forecasting technology, specifically to an intelligent procurement forecasting and early warning model for Chinese medicinal herbs. Background Technology
[0002] Currently, the main methods for managing the procurement of Chinese medicinal herbs are as follows: **Experience-based ordering:** This method relies on pharmacy managers in TCM medical institutions to determine the timing and quantity of purchases based on historical usage and personal experience. Managers use their accumulated experience to observe inventory levels and recall historical consumption patterns to decide when and how much to order. **Regular ordering:** This method sets a fixed ordering cycle, such as weekly or monthly, with the order quantity calculated based on current inventory and anticipated demand. **Fixed-quantity ordering:** This method sets fixed reorder points and quantities. When inventory falls below the reorder point, an order is automatically issued, with a fixed quantity ordered each time. **Minimum and maximum inventory method:** This method sets minimum and maximum inventory levels for each herb. When inventory falls below the minimum, purchases are made up to the maximum. **Seasonal adjustment method:** This method adjusts the demand for certain herbs by a simple multiple based on seasonal changes. For example, the usage of cold remedies increases by 1.5 to 2 times during winter.
[0003] Existing technologies suffer from the following problems and drawbacks: Low forecast accuracy, with prominent issues of stockouts and overstocking: Traditional methods rely heavily on manual experience and lack scientific analysis of demand variation patterns, resulting in forecast accuracy typically only 50% to 60%, far from meeting actual demand. Due to inaccurate forecasts, the coexistence of stockouts for popular medicinal herbs and overstocking of slow-moving herbs is frequent, with an average of 2 to 3 stockouts per month. Inability to effectively handle the impact of multiple factors: The demand for Chinese medicinal herbs is influenced by a combination of factors such as seasonal climate, epidemics, and holidays. Existing methods struggle to consider these complex factors simultaneously, only making simple seasonal adjustments and failing to capture the deeper patterns of demand. Failure to consider the unique attributes of Chinese medicinal herbs: Chinese medicinal herbs possess unique attributes such as regional characteristics, processing techniques, and short shelf life. However, traditional inventory management methods largely copy industrial product inventory management models, failing to optimize for the characteristics of Chinese medicinal herbs, leading to an expiration loss rate as high as 7% to 10%. Lack of early warning mechanisms: Traditional methods employ a passive response model, often only identifying problems when stockouts have already occurred or are imminent. The lack of early warning mechanisms prevents sufficient time for procurement decisions, leading to increased emergency procurement costs. Low inventory turnover: Due to concerns about stockouts, managers tend to maintain high safety stock levels, resulting in large capital commitments and low inventory turnover, typically only 4 to 5 times per year, far below reasonable levels. Low standardization and difficulty in scaling: Existing methods heavily rely on the experience of individual managers, lacking standardized processes and objective quantitative indicators. This makes it difficult to promote and replicate across different medical institutions, and management quality significantly declines when experienced managers leave.
[0004] This application provides an intelligent procurement forecasting and early warning model for Chinese medicinal materials to solve the problems existing in the above-mentioned Chinese medicinal material procurement management methods, such as low prediction accuracy, inability to effectively handle the influence of multiple factors, failure to consider the unique attributes of Chinese medicinal materials, lack of early warning mechanism, low inventory turnover rate, and low degree of standardization. Summary of the Invention
[0005] In response to the aforementioned technical problems, this application provides an intelligent procurement prediction and early warning model for Chinese medicinal materials, including:
[0006] Step S1: Collect historical prescription data, regional seasonal climate data, and epidemic monitoring data from medical institutions to construct a raw dataset fused from multiple sources;
[0007] Step S2: Construct a four-layer knowledge graph based on traditional Chinese medicine theory, consisting of disease, syndrome type, prescription, and medicinal materials. Establish the relationships between medicinal materials and the rules for dosage and compatibility. The knowledge graph includes a mapping table of authentic production areas and the transformation relationship of processing techniques.
[0008] Step S3: Preprocess and feature engineering the original dataset, extract time series features, seasonal features and correlation features based on the knowledge graph, and generate a model training dataset;
[0009] Step S4: Construct a time series demand forecasting model based on LSTM neural network, set a weighted loss function, which includes a mean squared error term, a stockout penalty term, and an excess inventory penalty term, input the model training dataset into the demand forecasting model for training, and output the demand forecasting results of Chinese medicinal materials based on the demand forecasting model.
[0010] Step S5: Based on the demand forecast results of Chinese medicinal materials, current inventory data and unique attribute parameters of Chinese medicinal materials, calculate the dynamic early warning threshold, and generate a three-level shortage early warning signal and intelligent replenishment suggestions;
[0011] Step S6: Output the early warning results and replenishment plan, and dynamically adjust and optimize the prediction model based on the actual consumption data.
[0012] Further, step S1 specifically includes:
[0013] Set a time range for collecting historical prescription data; collect historical prescription data from medical institutions based on the time range, including prescription number, prescription date, diagnosis information, name of medicinal materials, dosage of medicinal materials, and compatibility relationships; set a climate data source, collect seasonal climate data of the area where the medical institution is located based on the climate data source, including temperature, humidity, air pressure, and precipitation; set an epidemic monitoring data source, collect epidemic monitoring data of the area where the medical institution is located based on the epidemic monitoring data source, including incidence rate, epidemic trend, and early warning information; align and fuse the historical prescription data, seasonal climate data, and epidemic monitoring data according to time to construct the original dataset.
[0014] Furthermore, based on traditional Chinese medicine theory, a four-layer knowledge graph of disease-syndrome-prescription-medicinal materials is constructed to establish the relationships and dosage compatibility rules among Chinese medicinal materials, specifically:
[0015] The system constructs disease-level nodes, including disease name, ICD code, and peak season; syndrome-level nodes, including syndrome name, main symptoms, pulse, and peak time period, and establishes the association between disease-level nodes and syndrome-level nodes; formula-level nodes, including formula name, efficacy, and constituent medicinal materials, and establishes the association between syndrome-level nodes and formula-level nodes; medicinal material-level nodes, including medicinal material name, properties and meridian tropism, dosage range, authentic producing area, and processing method, and establishes the association between formula-level nodes and medicinal material-level nodes; sets compatibility rules, including principal-assistant-adjuvant-guide relationships, mutual reinforcement and mutual assistance relationships, and mutual restraint and mutual antagonism relationships; constructs an authentic producing area mapping table, including medicinal material name, authentic producing area, quality score, and price factor; and constructs processing technology conversion relationships, including the conversion coefficient between raw and processed products and processing time cost.
[0016] Furthermore, the original dataset is preprocessed and feature-engineered, and time-series features, seasonal features, and correlation features are extracted based on the knowledge graph, specifically as follows:
[0017] The original dataset undergoes missing value processing and outlier detection. Missing value processing employs forward imputation or linear interpolation methods, while outlier detection utilizes the 3σ criterion based on statistical distribution. A time window parameter is set, and time series features are extracted based on this parameter. These features include historical consumption sequences, moving averages, autocorrelation coefficients, and partial autocorrelation coefficients over continuous time periods. Seasonal features are extracted, including seasonal codes, weekday markers, and holiday markers. Relationship features are extracted based on the knowledge graph, including synergistic consumption coefficients and disease impact factors. The synergistic consumption coefficients are calculated by analyzing the historical consumption correlation of the target medicinal material in the prescription, and the disease impact factors are calculated by linking epidemiological data with the disease-syndrome-prescription-medicinal material association path in the knowledge graph. The historical consumption sequences, seasonal features, climate data, and relationship features are combined into a feature vector, generating an input data format where the time window length is multiplied by the feature dimension. The feature vector is then normalized to generate the model training dataset.
[0018] Furthermore, a time series demand forecasting model based on an LSTM neural network is constructed, and a weighted loss function is set as follows:
[0019] The LSTM neural network includes an input layer, a first LSTM hidden layer, a first Dropout layer, a second LSTM hidden layer, a second Dropout layer, and an output layer. The input layer receives a feature vector equal to the length of a time window multiplied by a feature dimension. The time window length is 14, and the feature dimension is 5 or 6, corresponding to historical consumption, seasonal coding, workday markers, temperature, and epidemic index, respectively. The first LSTM hidden layer contains a first preset number of hidden units. The first Dropout layer sets a first dropout ratio. The second LSTM hidden layer contains a second preset number of hidden units, which is less than the first preset number. The second Dropout layer sets a second dropout ratio. The dropout ratio; the output layer outputs the predicted demand; the weighted loss function is calculated in the model training phase as follows: Loss = MSE + λ1·Shortage_penalty + λ2_base·Overage_penalty, where MSE is the mean squared error, Shortage_penalty is the stockout penalty, Overage_penalty is the excess inventory penalty, λ1 is the stockout penalty coefficient, and λ2_base is the base excess inventory penalty coefficient; in the model application phase, the excess inventory penalty coefficient is dynamically adjusted based on the remaining shelf life of the current inventory, and the adjustment formula is: λ2 = λ2_base × (1 - remaining shelf life / total shelf life).
[0020] Further, based on the predicted results of the Chinese medicinal material demand, the current inventory data, and the specific attribute parameters of the Chinese medicinal materials, calculate the dynamic warning threshold, generate a three-level out-of-stock warning signal and an intelligent replenishment suggestion, specifically:
[0021] Set the prediction duration parameter, and calculate the near-term demand D_near and the weekly demand D_week according to the prediction duration parameter and the demand prediction model; obtain the specific attribute parameters of the Chinese medicinal materials, and the specific attribute parameters of the Chinese medicinal materials include the procurement lead time, shelf life, and inventory volatility; calculate the safety stock S_safe according to the weekly demand D_week and the inventory volatility, and the calculation formula is: S_safe = D_week × (1 + inventory volatility); obtain the current inventory quantity S_current; set the warning rules, and the warning rules include: when S_current < D_near, trigger a red warning, and the warning level is urgent; when D_near ≤ S_current < D_week, trigger a yellow warning, and the warning level is attention; when D_week ≤ S_current < S_safe, trigger a green reminder, and the warning level is normal; generate a warning signal according to the warning rules, and the warning signal includes the warning level, the expected out-of-stock time, and the recommended purchase quantity; set the procurement optimization objective function, and the procurement optimization objective function is to minimize the total cost, and the total cost includes the procurement cost, transportation cost, inventory holding cost, and expected out-of-stock loss; set the procurement constraint conditions, and the procurement constraint conditions include safety stock constraint, shelf life constraint, and minimum order quantity constraint; generate an intelligent replenishment suggestion according to the procurement optimization objective function and the procurement constraint conditions, in combination with the genuine producing area mapping table in the knowledge graph, and the intelligent replenishment suggestion includes the recommended purchase quantity, the recommended producing area, and the expected arrival time.
[0022] Further, dynamically adjust and optimize the prediction model according to the actual consumption data, specifically:
[0023] Obtain the actual consumption data of the Chinese medicinal materials; calculate the prediction error, and the prediction error is the difference between the predicted demand and the actual consumption; when the prediction error exceeds the preset threshold, trigger the model parameter adjustment mechanism; adjust the learning rate, the number of hidden units, or the penalty coefficient of the weighted loss function of the LSTM neural network according to the direction and magnitude of the prediction error; add the new sample containing the actual consumption data to the training data set, and perform incremental training on the prediction model; regularly evaluate the performance indicators of the prediction model, and the performance indicators include prediction accuracy, mean absolute error, and root mean square error.
[0024] In summary, the beneficial effects of this application are:
[0025] 1. This application collects historical prescription data from medical institutions, regional seasonal climate data, and epidemiological monitoring data to construct a multi-source data fusion original dataset; it constructs a four-layer knowledge graph based on traditional Chinese medicine theory, including disease, syndrome type, prescription, and medicinal materials, to establish the correlation and dosage compatibility rules among medicinal materials; it extracts correlation features, including synergistic consumption coefficients and disease influencing factors, through the knowledge graph, achieving deep integration of knowledge in the field of traditional Chinese medicine with time series prediction; it preprocesses and performs feature engineering on the original dataset to extract time series features, seasonal features, and correlation features; it constructs a time series demand prediction model based on an LSTM neural network, sets a weighted loss function including a mean squared error term, a shortage penalty term, and an excess inventory penalty term, and adopts different parameter setting strategies in the training and application phases; based on the medicinal material demand prediction results, current inventory data, and unique attribute parameters of medicinal materials, it calculates dynamic early warning thresholds, generates a three-level shortage early warning signal and intelligent replenishment suggestions; and it dynamically adjusts and optimizes the prediction model based on actual consumption data, improving the accuracy of medicinal material procurement prediction and the level of intelligent inventory management.
[0026] 2. Compared with existing technologies, the technical effects of this application also have the following beneficial effects: Significantly improved prediction accuracy: Through LSTM time series prediction algorithm, multi-source data fusion, and knowledge graph feature enhancement, the prediction accuracy of demand for Chinese medicinal materials reaches over 85%, an improvement of approximately 30 percentage points compared to the 50% to 60% accuracy of traditional empirical methods; Significantly reduced stockout risk: Through a three-level early warning mechanism and an early warning time of 3 to 7 days in advance, the average number of stockouts per month is reduced from 2 to 3 times using traditional methods to less than 0.5 times, reducing stockout risk by over 80%; Significantly improved inventory turnover rate: Through accurate prediction and dynamic adjustment, the inventory turnover rate is significantly improved compared to traditional methods. The frequency of the method was increased from 4-5 times per year to 6-7 times per year, and the inventory turnover rate increased by 40%-60%; inventory costs were significantly reduced: by reducing expired and scrapped items and lowering safety stock levels, inventory costs were reduced by 30%-40%, with the expiration loss rate decreasing from 7%-10% to 2%-4%; the unique attributes of Chinese medicinal materials were fully considered: by integrating the knowledge graph of traditional Chinese medicine, the special attributes of Chinese medicinal materials such as authenticity, processing technology, and compatibility were fully considered, making forecasting and procurement decisions more in line with the characteristics of Chinese medicinal material management; the standardization was high: a unified forecasting process and quantitative indicators were established, which did not rely on the experience of individual personnel and was easy to promote and apply in different medical institutions. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 A flowchart illustrating a smart procurement prediction and early warning model for Chinese medicinal materials provided in this application. Detailed Implementation
[0029] It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments of the present invention can be combined with each other. The following will refer to the appendix... Figure 1 The present invention will be described in detail with reference to the embodiments.
[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the present invention or its application or use. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0031] Reference Figure 1 The diagram shown is a flowchart illustrating an intelligent procurement prediction and early warning model for traditional Chinese medicinal materials provided in an embodiment of this application.
[0032] A smart procurement prediction and early warning model for Chinese medicinal materials includes:
[0033] Step S1: Collect historical prescription data, regional seasonal climate data, and epidemic monitoring data from medical institutions to construct a raw dataset fused from multiple sources;
[0034] Step S2: Construct a four-layer knowledge graph based on traditional Chinese medicine theory, consisting of disease, syndrome type, prescription, and medicinal materials. Establish the relationships between medicinal materials and the rules for dosage and compatibility. The knowledge graph includes a mapping table of authentic production areas and the transformation relationship of processing techniques.
[0035] Step S3: Preprocess and feature engineering the original dataset, extract time series features, seasonal features and correlation features based on the knowledge graph, and generate a model training dataset;
[0036] Step S4: Construct a time series demand prediction model based on LSTM neural network, set a weighted loss function, input the model training dataset into the demand prediction model for training, and output the demand prediction results of Chinese medicinal materials based on the demand prediction model.
[0037] Step S5: Based on the demand forecast results of Chinese medicinal materials, current inventory data and unique attribute parameters of Chinese medicinal materials, calculate the dynamic early warning threshold, and generate a three-level shortage early warning signal and intelligent replenishment suggestions;
[0038] Step S6: Output the early warning results and replenishment plan, and dynamically adjust and optimize the prediction model based on the actual consumption data.
[0039] In some embodiments, the intelligent procurement prediction and early warning model for Chinese medicinal materials in this application corresponds to an intelligent procurement prediction and early warning system for Chinese medicinal materials. This system includes: 1. a data acquisition module; 2. a knowledge graph construction module; 3. a feature extraction module; 4. an LSTM prediction module; 5. an early warning module; 6. a replenishment suggestion generation module; and 7. a model optimization module. In this system, the data acquisition module 1 is connected to the feature extraction module 3, the knowledge graph construction module 2 is connected to the feature extraction module 3, the feature extraction module 3 is connected to the LSTM prediction module 4, the LSTM prediction module 4 is connected to the early warning module 5, the early warning module 5 is connected to the replenishment suggestion generation module 6, and the replenishment suggestion generation module 6 is connected to the model optimization module 7.
[0040] This embodiment employs a simulation verification method to illustrate the prediction of the procurement of diaphoretic medicinal materials during the peak winter respiratory disease season in northern China. By establishing a simulation scenario, the technical solution and beneficial effects of this invention are verified.
[0041] Step S1 is as follows:
[0042] Set the collection time range for historical prescription data; the medical institution's data collection system collects the medical institution's historical prescription data according to the collection time range to obtain the historical consumption data of the medicinal materials to be predicted.
[0043] In some embodiments, the historical prescription data acquisition system adopts the standard Medical Information Management System (HMIS) data interface. Specific acquisition parameters are set as follows: the acquisition time range is the past 24 months, the acquisition frequency is daily updates, and the acquired data types include prescription number, prescription date, diagnosis information, patient age, patient gender, herbal name, herbal dosage, and compatibility relationships. Simultaneously, seasonal climate data from climate data sources is acquired: temperature, humidity, air pressure, and precipitation are collected every 6 hours. Epidemiological data from epidemic monitoring data sources is also acquired simultaneously: incidence rate, number of cases, epidemic trend, and early warning information are collected daily. In practical applications, the acquired historical prescription data, seasonal climate data, and epidemic monitoring data are time-aligned. A data fusion process is used to obtain a completeness score for the fused data. If the completeness score is below 80%, data completion processing is performed to finally construct the original dataset.
[0044] Image preprocessing is performed on the sample scan images, specifically as follows:
[0045] Set up methods for handling missing values and detecting outliers;
[0046] Missing values are handled in the original dataset according to the missing value handling method, and outlier detection is performed on the processed original dataset according to the outlier detection method.
[0047] In some embodiments, the obtained raw dataset is input into the data preprocessing module. First, missing value handling is performed: missing data is filled using forward imputation, linear interpolation, or KNN imputation methods. Then, outlier detection is performed: the 3σ criterion based on statistical distribution is used, and data points deviating from the mean by more than three times the standard deviation are identified as outliers and cleaned. Finally, data fusion is performed, aligning historical prescription data, climate data, and epidemiological data by time to generate a fused raw dataset.
[0048] The preprocessed original dataset is then subjected to feature engineering to obtain the model training dataset, specifically:
[0049] The time window parameter is set to 14 days. Time series features are extracted based on the time window parameter, including historical consumption series, 7-day moving average, 30-day moving average, autocorrelation coefficient, and partial autocorrelation coefficient within a continuous time period. Seasonal coding and holiday marking methods are set to extract seasonal features, including seasonal codes (spring = 1, summer = 2, autumn = 3, winter = 4), weekday markings (weekday = 1, non-weekday = 0), and holiday markings (holiday = 1, normal = 0). Based on a four-layer knowledge graph of disease-syndrome-prescription-medicinal material, correlation features are extracted, including synergistic consumption coefficient and disease influence factor. The synergistic consumption coefficient ranges from 0 to 1 and is calculated by analyzing the historical consumption correlation of the target medicinal material in commonly used prescriptions. The six dimensions of historical consumption, seasonal codes, weekday markings, temperature, epidemic index, and synergistic coefficient are combined into a feature vector. The feature vector is Z-score normalized to make the mean of each dimension 0 and the standard deviation 1. The input data format of time window length multiplied by the feature dimension is generated as the model training dataset.
[0050] Step S3 is as follows:
[0051] The algorithm parameters for knowledge graph construction include node types and relationships. Based on the knowledge graph construction algorithm, diseases, syndromes, prescriptions, and medicinal materials in the original dataset are standardized, and the relationship mappings at each level are obtained. The medicinal material knowledge graph contains at least four levels of nodes. If the data completeness of a certain medicinal material is lower than a preset threshold, it is considered abnormal data and subject to special processing. If the data completeness of a certain medicinal material is greater than or equal to the preset threshold, the attribute characteristics of the medicinal material are obtained, and a mapping of the authentic production area and the transformation relationship of processing technology are established based on the attribute characteristics. A medicinal material identification interval is set, and the authenticity score of the medicinal material is compared with the medicinal material identification interval. If the authenticity score of the medicinal material is within the identification interval, it is judged to be a high-quality medicinal material, and a standard feature description of the medicinal material is obtained based on its attribute characteristics. In some embodiments, the knowledge graph employs a multi-source data fusion method to automatically establish the association path between diseases and medicinal materials in the graph construction module. Specifically, a four-layer knowledge graph structure is constructed using the graph database Neo4j. The nodes at each layer are as follows: the disease layer includes the disease name, ICD code, TCM organ affiliation, and peak season; the syndrome layer includes the syndrome name, main symptoms, pulse characteristics, tongue characteristics, and peak time period; the prescription layer includes the prescription name, source, main efficacy, number of constituent medicinal materials, and treatment cycle; and the medicinal material layer includes the medicinal material name, properties and meridian tropism, efficacy classification, recommended dosage range, authentic producing area, harvesting season, and processing method. The relationships between each layer are established, including the mapping between diseases and syndromes, the applicability score between syndromes and prescriptions, and the status and ranking of prescriptions and medicinal materials. A compatibility rule base is set up, including rules for the combination of principal, assistant, adjuvant, and guide herbs, synergistic relationships of mutual reinforcement and mutual assistance, restrictive relationships of mutual restraint and mutual antagonism, and incompatible combinations. A mapping table of authentic production areas is constructed, associating medicinal material names with their authentic production areas, quality scores, and price factors. A transformation relationship for processing techniques is established, recording the conversion coefficient between raw and processed products and the processing time cost. Feature extraction is performed on the original dataset to obtain model training data, specifically including time-series feature parameters, seasonality feature parameters, correlation feature parameters, and medical attribute feature parameters for medicinal materials. In some embodiments, an improved time-series prediction model based on LSTM can be used, constructing a multi-layer neural network to achieve optimized identification and classification of medicinal material demand forecasting. In some embodiments, the time-series feature parameters are: historical consumption sequence; 7-day moving average; 30-day moving average; autocorrelation coefficient; partial autocorrelation coefficient. In some embodiments, the seasonality feature parameters are: seasonal code; weekday marker; holiday marker. In some embodiments, the correlation feature parameters are: synergistic consumption coefficient, calculated by analyzing the historical consumption correlation of the target medicinal material in commonly used prescriptions, ranging from 0 to 1; and disease influence factor, calculated through epidemiological data and the disease-syndrome-prescription-medicinal material association path in a knowledge graph.In some embodiments, the medical attribute characteristic parameters are: the influence of climate factors, using four dimensions: temperature, humidity, air pressure, and precipitation; the epidemic index, calculated through epidemic monitoring data and knowledge graph; and the medicinal material characteristic parameters, including procurement lead time, total shelf life, inventory volatility, and minimum order quantity. A demand forecasting model is set up, using the feature vectors of historical consumption data as input. The model outputs the demand forecast results for the medicinal materials to be predicted. Specifically, the demand forecasting model includes an LSTM neural network layer and an optimization algorithm layer. The LSTM neural network includes an input layer, a first LSTM hidden layer, a first Dropout layer, a second LSTM hidden layer, a second Dropout layer, and an output layer. The input layer receives a feature vector with a time window length multiplied by the feature dimension. The time window length is 14 days, and the feature dimension is 6, corresponding to historical consumption, seasonal coding, workday markers, temperature, epidemic index, and co-consumption coefficient, respectively. The first LSTM hidden layer contains 128 hidden units for learning long-term temporal dependencies. The first Dropout layer has a dropout ratio of 0.2 to prevent overfitting. The second LSTM hidden layer contains 64 hidden units for further extracting high-level temporal features. The second Dropout layer has a dropout ratio of 0. 2. Set a weighted loss function. The formula for calculating the weighted loss function during the model training phase is: Loss = MSE + λ1·Shortage_penalty + λ2_base·Overage_penalty, where MSE is the mean squared error term, used to measure the overall deviation between the predicted and actual values; Shortage_penalty is the shortage penalty term, calculated when the predicted demand is less than the actual demand, with a shortage penalty coefficient λ1 of 2.0; Overage_penalty is the excess inventory penalty term, calculated when the predicted demand is greater than the actual demand, with a base excess inventory penalty coefficient λ2_base of 1.0. During the model application phase, the excess inventory penalty coefficient is dynamically adjusted based on the remaining shelf life of the current inventory. The adjustment formula is: λ2 = λ2_base × (1 - remaining shelf life / total shelf life). When the shelf life is about to expire, the inventory penalty is dynamically increased to promote the timely use of expired medicinal materials. Output the demand forecast results for the medicinal materials to be predicted based on the demand forecast model. In some embodiments, the training parameters of the LSTM neural network are as follows: using the Adam optimizer, setting the learning rate to 0.001, the batch size to 32, and training for 200 epochs.When the prediction error exceeds the preset threshold (MAPE > 15%), trigger the model parameter adjustment mechanism; adjust the learning rate, the number of hidden units of the LSTM neural network, or the penalty coefficient of the weighted loss function according to the direction and magnitude of the prediction error; add new samples containing actual consumption data to the training data set, and perform incremental training once a week, adopting a learning rate decay strategy to avoid catastrophic forgetting; regularly evaluate the performance metrics of the prediction model, including prediction accuracy, mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE); when multiple performance metrics improve continuously, save the optimized model parameters. Obtain the warning signal, replenishment suggestion, and overall inventory management strategy corresponding to the medicinal materials to be predicted based on the demand prediction result. Specifically: set the prediction duration parameters, including the near-term prediction duration and the periodic prediction duration; calculate the near-term demand D_near and weekly demand D_week based on the prediction duration parameters and the demand prediction model, where the near-term demand D_near is the total predicted demand for the next 3 days, and the weekly demand D_week is the total predicted demand for the next 7 days; obtain the specific attribute parameters of Chinese herbal medicines, including procurement lead time, total shelf life, inventory volatility, and minimum order quantity; calculate the safety stock S_safe based on the weekly demand D_week and inventory volatility, and the calculation formula is: S_safe = D_week × (1 + inventory volatility), and the safety stock is used as the bottom line of inventory; obtain the current inventory S_current, and set the warning rules: when S_current < D_near, trigger a red warning, and the warning level is urgent, indicating that the medicinal materials are about to be out of stock; when D_near ≤ S_current < D_week, trigger a yellow warning, and the warning level is attention, indicating that the medicinal materials inventory is low; when D_week ≤ S_current < S_safe, trigger a green reminder, and the warning level is normal, indicating that the inventory is sufficient; generate a warning signal according to the warning rules, and the warning signal includes the warning level, the expected out-of-stock time, the recommended ordering cycle, and the current inventory risk score; set the procurement optimization objective function, and the procurement optimization objective function is to minimize the total cost, and the total cost includes procurement cost, transportation cost, inventory holding cost, and expected out-of-stock loss; set the procurement constraint conditions, and the procurement constraint conditions include safety stock constraint (the inventory after procurement is not lower than the safety stock S_safe), shelf life constraint (the procurement cycle does not exceed 80% of the shelf life), and minimum order quantity constraint (the single purchase quantity is not lower than the minimum order quantity); generate an intelligent replenishment suggestion based on the warning level, the authentic production area mapping table in the knowledge graph, and the processing technology transformation relationship.For red alerts, the recommended purchase quantity is max(D_near, S_safe - S_current), suggesting immediate purchase. For yellow alerts, the recommended purchase quantity is max(D_week, S_safe - S_current), suggesting purchase the next day. Intelligent replenishment suggestions include the recommended purchase quantity, recommended production area (selecting the highest quality-rated production area from the authentic production area mapping table), expected delivery time, and cost estimation. In some embodiments, the wood identification results set for wooden beads includes the wood identification results for all bracelet beads in the sample to be identified, and each wood identification result corresponds to a wood bead number. The wood bead number allows for precise location of the wood identification results for all bracelet beads in the sample. Furthermore, by integrating the wood identification results for the bracelet beads in the sample, the wood identification results for the entire sample can be obtained.
[0052] In some embodiments, the intelligent replenishment recommendations and inventory management strategies include management data such as medicinal herb name, predicted demand, warning level, recommended purchase quantity, recommended production area, expected delivery time, cost estimate, and quality assessment. Through purchase quantity and production area recommendations, precise replenishment management of the medicinal herbs to be replenished can be achieved. Furthermore, based on the predicted demand for the medicinal herbs and the actual inventory consumption, an inventory optimization plan for the entire medical institution can be generated.
[0053] The above are merely preferred embodiments of this application. The scope of protection of this application is not limited to the above embodiments. All technical solutions falling within the scope of this application's concept are within the scope of protection of this application. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of this application should also be considered within the scope of protection of this application.
Claims
1. A traditional Chinese medicine intelligent purchase forecast and early warning model, characterized in that, include: Step S1: Collect historical prescription data, regional seasonal climate data, and epidemic monitoring data from medical institutions to construct a raw dataset fused from multiple sources; Step S2: Construct a four-layer knowledge graph based on traditional Chinese medicine theory, consisting of disease, syndrome type, prescription, and medicinal materials. Establish the relationships between medicinal materials and the rules for dosage and compatibility. The knowledge graph includes a mapping table of authentic production areas and the transformation relationship of processing techniques. Step S3: Preprocess and feature engineering the original dataset, extract time series features, seasonal features and correlation features based on the knowledge graph, and generate a model training dataset; Step S4: Construct a time series demand forecasting model based on LSTM neural network, set a weighted loss function, which includes a mean squared error term, a stockout penalty term, and an excess inventory penalty term, input the model training dataset into the demand forecasting model for training, and output the demand forecasting results of Chinese medicinal materials based on the demand forecasting model. Step S5: Based on the demand forecast results of Chinese medicinal materials, current inventory data and unique attribute parameters of Chinese medicinal materials, calculate the dynamic early warning threshold, and generate a three-level shortage early warning signal and intelligent replenishment suggestions; Step S6: Output the early warning results and replenishment plan, and dynamically adjust and optimize the prediction model based on the actual consumption data.
2. The intelligent procurement forecasting and early warning method for Chinese medicinal materials according to claim 1, characterized in that, Step S1 is as follows: Set the time range for collecting historical prescription data; collect historical prescription data from medical institutions according to the time range, the historical prescription data including prescription number, prescription date, diagnosis information, name of medicinal materials, dosage of medicinal materials and compatibility relationship; Set up a climate data source and collect seasonal climate data of the area where the medical institution is located based on the climate data source. The seasonal climate data includes temperature, humidity, air pressure and precipitation. Establish an epidemic surveillance data source, and collect epidemic surveillance data of the area where the medical institution is located based on the epidemic surveillance data source. The epidemic surveillance data includes incidence rate, epidemic trend and early warning information. The historical prescription data, seasonal climate data, and epidemic monitoring data are acquired, and time alignment and data fusion are performed on the historical prescription data, seasonal climate data, and epidemic monitoring data to construct a multi-source data fusion original dataset.
3. The intelligent procurement forecasting and early warning method for traditional Chinese medicinal materials according to claim 1, characterized in that, The process involves constructing a four-layer knowledge graph—disease-syndrome-prescription-medicinal material—based on the knowledge graph construction rules and traditional Chinese medicine theory, establishing the relationships and dosage compatibility rules among medicinal materials. Specifically: Set disease layer node parameters, and construct disease layer nodes based on the disease layer node parameters. The disease layer nodes include disease name, ICD code and peak season. Set the parameters of the syndrome type layer node, construct the syndrome type layer node based on the parameters, the syndrome type layer node includes the syndrome type name, main symptoms, pulse pattern and high incidence period, and establish the association between the disease layer node and the syndrome type layer node; Set the formula layer node parameters, construct the formula layer node based on the formula layer node parameters, the formula layer node includes the formula name, efficacy and constituent medicinal materials, and establish the association relationship between the syndrome type layer node and the formula layer node; Set the parameters for the medicinal material layer nodes, construct the medicinal material layer nodes based on the parameters, and the medicinal material layer nodes include the name of the medicinal material, its properties and meridians, dosage range, original producing area and processing method, and establish the association between the prescription layer nodes and the medicinal material layer nodes. Set compatibility rule parameters, and establish compatibility rules between Chinese medicinal materials based on the compatibility rule parameters. The compatibility rules include the relationships of principal, assistant, adjuvant, and guide herbs, the relationships of mutual reinforcement and mutual assistance, and the relationships of mutual restraint and mutual antagonism. A mapping table of authentic production areas is constructed, which includes the name of the medicinal material, the authentic production area, the quality score, and the price factor. Construct a transformation relationship for processing techniques, which includes the transformation coefficient between raw and processed products and the processing time cost.
4. The intelligent procurement forecasting and early warning method for Chinese medicinal materials according to claim 1, characterized in that, The preprocessing and feature engineering of the original dataset specifically includes: The original dataset is processed for missing values using forward imputation, linear interpolation, or KNN imputation. Outliers are detected and processed using the 3σ criterion based on statistical distribution; data points that deviate from the mean by more than three times the standard deviation are considered outliers. The time window parameter is set to 14 days. Time series features are extracted based on the time window parameter. The time series features include historical consumption series within a continuous time period, 7-day moving average, 30-day moving average, autocorrelation coefficient, and partial autocorrelation coefficient. Extract seasonal features, which include seasonal codes (spring = 1, summer = 2, autumn = 3, winter = 4), weekday markers (weekday = 1, non-working day = 0), and holiday markers (holiday = 1, regular = 0); The association features are extracted based on the knowledge graph. The association features include synergistic consumption coefficient and disease influencing factor. The synergistic consumption coefficient is calculated by analyzing the historical consumption correlation of the target medicinal material in commonly used prescriptions, and ranges from 0 to 1. The disease influencing factor is calculated by using epidemiological data and the disease-syndrome-prescription-medicinal material association path in the knowledge graph. The historical consumption sequence, moving average, seasonality, climate data, and correlation features are combined into a feature vector, which includes six dimensions: historical consumption, seasonal coding, workday markers, temperature, epidemic index, and synergy coefficient. The feature vector is then Z-score normalized to make the mean of each dimension 0 and the standard deviation 1. Finally, the input data format of time window length multiplied by the feature dimensions is generated as the model training dataset.
5. The intelligent procurement forecasting and early warning method for Chinese medicinal materials according to claim 1, characterized in that, The construction of the time series demand forecasting model based on LSTM neural network is specifically as follows: The LSTM neural network includes an input layer, a first LSTM hidden layer, a first Dropout layer, a second LSTM hidden layer, a second Dropout layer, and an output layer. The input layer receives a feature vector multiplied by the length of the time window and the feature dimension. The length of the time window is 14 days and the feature dimension is 6, which correspond to historical consumption, seasonal code, working day marker, temperature, epidemic index and co-consumption coefficient, respectively. The first LSTM hidden layer contains 128 hidden units and is used to learn long-term temporal dependencies; the first Dropout layer has a dropout ratio of 0.2 to prevent overfitting. The second LSTM hidden layer contains 64 hidden units for further extraction of high-level temporal features; the second Dropout layer has a dropout ratio of 0.
2. The output layer uses a linear activation function to output the predicted demand; the Adam optimizer is used with a learning rate of 0.001 and a batch size of 32 for 200 epochs of training.
6. The intelligent procurement forecasting and early warning method for Chinese medicinal materials according to claim 5, characterized in that, The setting of the weighted loss function is specifically as follows: The weighted loss function is calculated using the following formula during the model training phase: Loss=MSE+λ1·Shortage_penalty+λ2_base·Overage_penalty Where MSE is the mean squared error term, used to measure the overall deviation between the predicted value and the actual value; Shortage_penalty is the stockout penalty term, which calculates the square of the difference between the two when the predicted demand is less than the actual demand and multiplies it by the stockout penalty coefficient λ1; Overage_penalty is the excess inventory penalty term, which calculates the square of the difference between the two when the predicted demand is greater than the actual demand and multiplies it by the excess inventory penalty coefficient λ2_base. The value of the stockout penalty coefficient λ1 is 2.0, and the value of the base excess inventory penalty coefficient λ2_base is 1.0, wherein the stockout penalty coefficient is greater than the inventory penalty coefficient to prioritize the supply of medicinal materials; During the model application phase, the excess inventory penalty coefficient is dynamically adjusted based on the remaining shelf life of the current inventory. The adjustment formula is: λ2 = λ2_base × (1 - remaining shelf life / total shelf life). When the shelf life is about to expire, the inventory penalty is dynamically increased to promote the timely use of expired medicinal materials.
7. The intelligent procurement forecasting and early warning method for Chinese medicinal materials according to claim 1, characterized in that, Based on the prediction results output by the demand forecasting model and the unique attribute parameters of Chinese medicinal materials, a dynamic early warning threshold is calculated to generate a three-level shortage early warning signal, specifically as follows: Set the forecast duration parameters, including the near-term forecast duration and the periodic forecast duration; calculate the near-term demand D_near and the weekly demand D_week based on the forecast duration parameters and the demand forecast model, where the near-term demand D_near is the total forecasted demand for the next 3 days and the weekly demand D_week is the total forecasted demand for the next 7 days. Obtain unique attribute parameters of Chinese medicinal materials, including procurement lead time, total shelf life, inventory volatility, and minimum order quantity; The safety stock S_safe is calculated based on the weekly demand D_week and the inventory volatility. The calculation formula is: S_safe=D_week×(1+inventory volatility). The safety stock serves as the bottom line for inventory. Obtain the current inventory quantity \(S_{current}\), and set the warning rules: when \(S_{current}<D_{near}\), trigger a red warning, and the warning level is urgent, indicating that the medicinal materials are about to be out of stock; when \(D_{near}\leq S_{current}<D_{week}\), trigger a yellow warning, and the warning level is attention, indicating that the inventory of medicinal materials is low; when \(D_{week}\leq S_{current}<S_{safe}\), trigger a green reminder, and the warning level is normal, indicating that the inventory is sufficient. Generate a warning signal according to the above warning rules. The warning signal includes a warning level, an estimated out-of-stock time, a recommended ordering cycle, and a current inventory risk score.
8. The intelligent procurement forecasting and early warning method for Chinese medicinal materials according to claim 7, characterized in that, Generate an intelligent replenishment suggestion, specifically: Set the procurement optimization objective function, which is to minimize the total cost. The total cost includes procurement cost, transportation cost, inventory holding cost, and expected out-of-stock loss. Set the procurement constraint conditions, which include safety inventory constraint (the inventory after procurement is not lower than the safety inventory \(S_{safe}\)), shelf life constraint (the procurement cycle does not exceed 80% of the shelf life), and minimum order quantity constraint (the single procurement quantity is not lower than the minimum order quantity). Generate an intelligent replenishment suggestion based on the warning level, the authentic production area mapping table in the knowledge graph, and the processing technology conversion relationship; for a red warning, the recommended procurement quantity = max(\(D_{near}\), \(S_{safe}-S_{current}\)), and it is recommended to purchase immediately; for a yellow warning, the recommended procurement quantity = max(\(D_{week}\), \(S_{safe}-S_{current}\)), and it is recommended to purchase the next day. The intelligent replenishment suggestion includes the recommended procurement quantity, the recommended production area (select the production area with the highest quality score from the authentic production area mapping table), the expected arrival time, and the cost estimate; for multiple authentic production areas of the same medicinal material, preferentially select the production area with a high quality score and a low procurement cost.
9. The intelligent procurement forecasting and early warning method for Chinese medicinal materials according to claim 1, characterized in that, Dynamically adjust and optimize the prediction model based on the actual consumption data, specifically: Obtain the actual consumption data of Chinese medicinal materials, including the actual dosage, actual usage time, and usage scenario information. Calculate the prediction error, which is the difference between the predicted demand and the actual consumption. Calculate the mean absolute percentage error (MAPE), MAPE = (|predicted value - actual value| / actual value) × 100%. When the prediction error exceeds the preset threshold (MAPE > 15%), trigger the model parameter adjustment mechanism; according to the direction and magnitude of the prediction error, adjust the learning rate of the LSTM neural network (increase or decrease by 10%), the number of hidden units (increase or decrease by 16 units), or the penalty coefficient of the weighted loss function. Add the new sample containing the actual consumption data to the training data set, and perform incremental training once a week, adopting a learning rate decay strategy to avoid catastrophic forgetting. Regularly evaluate the performance indicators of the prediction model. The performance indicators include prediction accuracy, mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE); when multiple performance indicators continuously improve, save the optimized model parameters.