Intelligent management method for medical product sales data
Patent Information
- Application Number
- CN202611210750.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-11
- Publication Date
- 2026-10-16
AI Technical Summary
[0005]本发明的目的是提供一种医疗产品销售数据智能管理方法,通过构建药品销售关联超图并利用超图卷积网络提取药品销售态势嵌入,以及引入改进的黑寡妇优化算法对销售策略决策网络参数进行全局寻优,解决现有方法难以有效捕捉药品间高阶关联和策略参数优化易陷入局部最优的问题
通过将同期处方组合和库存联动关系建模为超图结构,能够完整保留药品之间高阶且直接的复杂关联。超图的节点为药品,超边不限于成对关系,而是将同一处方中的药品组合直接连接为一条超边,并将库存连续下降且销售数量上升的药品组合连接为反映库存联动方向的超边。这种表示方式把临床处方行为和库存调配行为产生的药品共现模式原生地映射到图结构上,避免了传统成对关联模型在拆解高阶组合时造成的信息丢失和关联强度稀释。基于该超图结构,采用超图卷积网络进行节点表示学习,超边内所有节点的特征被聚合为超边级特征,再沿超边连接关系传播回节点,并通过残差连接保留原始特征,经多层堆叠后输出每个药品节点的药品销售态势嵌入。该嵌入融合了药品的ATC分类、销售动态、库存状态和医保类型等属性,同时编码了药品在处方组合与库存联动中的高阶交互关系,使药品的表示能够真实反映其在共销和多品规协同变动中的角色,从而为下游策略决策提供信息维度更丰富、结构更贴近业务实际的输入。
Smart Images

Figure CN122930438A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical data management technology, specifically to an intelligent management method for medical product sales data. Background Technology
[0002] Medical product sales data involves multi-source, heterogeneous records such as sales flow, inventory changes, and prescription dispensing. Extracting correlation patterns from this data and formulating reasonable sales strategies is a challenge for pharmaceutical distribution management. Existing sales data management solutions typically rely on association rule mining or time series statistics, simplifying the sales relationships between drugs into frequent itemsets or pairwise correlations, constructing linear or low-order association models. In scenarios such as prescription collaboration and inventory linkage, multiple drugs may generate high-order combination relationships due to clinical pathways or inventory dispensing. These high-order relationships cannot be effectively expressed using pairwise associations, leading to a distorted portrayal of co-sales models and inventory dynamics. Consequently, promotional and stocking strategies developed based on this distorted portrayal struggle to meet actual business needs.
[0003] In sales strategy decision-making, existing methods have incorporated neural networks to predict sales trends and generate strategic actions. However, network parameter optimization often relies on standard gradient descent or traditional metaheuristic algorithms. Standard optimization processes are prone to getting stuck in local optima in complex multi-objective strategy spaces and are sensitive to initial parameters, resulting in unstable performance of the generated sales strategies in metrics such as profit and inventory turnover. While the Black Widow optimization algorithm, as an emerging swarm intelligence algorithm, has a relatively fast convergence speed, its direct application to parameter optimization in sales strategy decision-making networks still suffers from population diversity degradation and premature convergence, failing to effectively approximate the global optimum in a broad parameter space and thus limiting the optimization capability of the strategy decision-making network.
[0004] To address the aforementioned issues, a sales trend representation method that can fully preserve the high-order correlation structure between drugs and perform deep learning on it is needed, as well as an optimization mechanism that can stably search for the global optimal solution in the parameter space of the strategy decision network, thereby obtaining more accurate correlation pattern recognition and better sales strategies in medical product sales management. Summary of the Invention
[0005] The purpose of this invention is to provide an intelligent management method for medical product sales data. This method constructs a drug sales association hypergraph and uses a hypergraph convolutional network to extract the drug sales situation embedding. It also introduces an improved black widow optimization algorithm to globally optimize the parameters of the sales strategy decision network, thereby solving the problems of existing methods that are difficult to effectively capture high-order associations between drugs and that strategy parameter optimization is prone to getting trapped in local optima.
[0006] To achieve the above objectives, the present invention provides the following technical solution: The present invention provides an intelligent management method for medical product sales data, which solves the technical problem that existing methods are unable to effectively integrate prescription behavior, inventory dynamics and sales flow information, resulting in delayed sales strategy response and difficulty in capturing complex relationships between drugs.
[0007] This method acquires medical product sales source data within a target region, including drug sales records, inventory change records, and prescription dispensing records. It performs drug normalization coding and timestamp alignment on these three types of heterogeneous data to generate a set of sales behavior events, ensuring that data from different sources express drug sales facts at a unified spatiotemporal granularity and eliminating coding differences and time deviations. Preferably, the drug codes in the drug sales records and inventory change records are normalized and mapped to a preset standard drug code; the timestamps are then uniformly converted to a standard time zone, and the data is binned according to a preset time granularity. Drug combinations with the same prescription number within the same time bin are marked as co-sales events, and drug combinations with continuously decreasing inventory and increasing sales volume within the same time bin are marked as inventory linkage events. These are then merged to obtain a set of sales behavior events, explicitly expressing the co-sales relationship and the inventory coordination relationship.
[0008] A drug sales association hypergraph is constructed based on a set of sales behavior events. Hypergraph nodes represent drugs, and hyperedges represent concurrent prescription combinations and inventory linkages. This hypergraph can simultaneously express multi-drug combination usage patterns at the prescription level and linkage change patterns at the inventory level, overcoming the limitation of traditional graph models that can only represent paired relationships. As a preferred embodiment of this invention, hyperedges corresponding to drug combinations with the same prescription number and hyperedges corresponding to inventory linkages are merged into the same hypergraph. If the same group of drug nodes has both prescription combination hyperedges and inventory linkage hyperedges, both hyperedges are retained, thus preserving high-dimensional association information more completely.
[0009] A hypergraph convolutional network is used to learn node representations in the drug sales association hypergraph, resulting in a drug sales situation embedding. Hyperedge aggregation and node propagation mechanisms are employed to integrate prescription combination and inventory linkage information into the embedding vectors of drug nodes. Preferably, the initial feature vector of each drug node includes ATC classification code, average daily sales, inventory turnover days, and medical insurance type. The hypergraph convolution updates node features through multi-layer aggregation and residual connections, ultimately outputting a situation embedding that characterizes the drug sales status. This embedding comprehensively expresses the drug's market performance, prescription relationships, and inventory pressure.
[0010] The drug sales situation is embedded into a pre-defined sales strategy decision network. This network generates a sales state sequence through a gated recurrent unit network, and then uses a multi-head attention layer for weighted aggregation to obtain a comprehensive sales state vector. This vector then outputs multiple candidate sales strategy actions, including promotional discounts, inventory quantity adjustment ratios, and channel priorities. An improved Black Widow optimization algorithm is used to adjust the parameters of the sales strategy decision network, determining the medical product sales strategy from the candidate actions. The improved Black Widow optimization algorithm continuously searches for better parameters through elite selection, mating operations, and positional perturbations. The fitness value is determined by weighting simulated sales profit and inventory turnover rate, ensuring that the strategy output by the decision network considers both profit and inventory turnover efficiency.
[0011] Furthermore, the parameters corresponding to the individual with the best fitness are loaded into the sales strategy decision network to generate a sales strategy action vector. This vector is then decoded into a medical product sales strategy that includes drug identification, target sales region, promotional discount, and inventory reservation ratio. The strategy is then validated against the current inventory snapshot and a list of drugs nearing their expiration date. If validation fails, the next best parameters are selected in descending order of fitness value for re-decoding and validation until an executable strategy is obtained and output. This ensures that the final sales strategy is operable under inventory and expiration date constraints. Through these steps, this invention achieves the automatic generation of executable strategies from multi-source sales data and utilizes hypergraph modeling and evolutionary optimization to improve the strategy's adaptability to complex relationships and its global optimization capability.
[0012] The technical effects and advantages provided by the present invention in the above technical solution are as follows: By modeling the relationship between concurrent prescription combinations and inventory linkages as a hypergraph structure, the high-order and direct complex relationships between drugs can be fully preserved. The nodes of the hypergraph are drugs, and the hyperedges are not limited to pairwise relationships. Instead, a hyperedge directly connects drug combinations within the same prescription, and connects drug combinations with continuously decreasing inventory and increasing sales volume as hyperedges reflecting the direction of inventory linkage. This representation natively maps the drug co-occurrence patterns generated by clinical prescription behavior and inventory allocation behavior onto the graph structure, avoiding information loss and dilution of association strength caused by traditional pairwise association models when decomposing high-order combinations. Based on this hypergraph structure, a hypergraph convolutional network is used for node representation learning. The features of all nodes within the hyperedge are aggregated into hyperedge-level features, then propagated back to the nodes along the hyperedge connections. The original features are preserved through residual connections, and after multi-layer stacking, the drug sales status embedding for each drug node is output. This embedding integrates attributes such as drug ATC classification, sales dynamics, inventory status, and medical insurance type, while encoding the high-level interaction relationships of drugs in prescription combination and inventory linkage. This enables the representation of drugs to truly reflect their role in co-sales and multi-specification collaborative changes, thereby providing downstream strategic decision-making with inputs that are richer in information dimensions and more closely aligned with actual business operations.
[0013] An improved Black Widow optimization algorithm is used to optimize the parameters of the sales strategy decision network. The network parameters are encoded as position vectors of individual spiders, and population diversity is maintained in each generation through elite retention, mating, and position perturbation operations, preventing the parameter search from getting trapped in local optima. Fitness values are determined by weighting simulated sales profit and inventory turnover rate, ensuring that the parameter optimization process directly addresses the actual implementation effect of the sales strategy. The mating operation involves exchanging fragments of the position vectors of two elite individuals at random intersection points to generate offspring individuals. These offspring are then perturbed at a preset probability before being merged with the current population, and the next generation is reselected. This improved mechanism maintains the fast convergence characteristic of the Black Widow algorithm while suppressing population convergence, enabling the search process to escape locally flat regions and achieve a better global solution in the high-dimensional non-convex parameter space of the sales strategy decision network. Based on the optimized network parameters, a medical product sales strategy is determined from multiple candidate sales strategy actions, including promotional discounts, inventory quantity adjustment ratios, and channel priorities. This strategy is more in line with the actual sales environment and inventory constraints, and can achieve higher simulated sales profits and more reasonable inventory turnover performance. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0015] Figure 1 This is a flowchart of a smart management method for medical product sales data; Figure 2 This is a flowchart of the process for acquiring source data for medical product sales. Figure 3 This is a time series chart showing the changes in source data for medical product sales. Figure 4 This is a graph showing the trend of the number of sales activity events over time. Figure 5 It is the fitness change curve of the sales strategy decision network optimization process. Detailed Implementation
[0016] 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, not all embodiments. 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.
[0017] See Figure 1 This invention provides an intelligent management method for medical product sales data, comprising: acquiring medical product sales source data within a target area, wherein the medical product sales source data includes drug sales records, inventory change records, and prescription dispensing records; performing drug normalization encoding and timestamp alignment on the drug sales records, inventory change records, and prescription dispensing records to generate a set of sales behavior events; constructing a drug sales association hypergraph based on the set of sales behavior events, wherein the nodes of the drug sales association hypergraph are drugs, and the hyperedges are used to represent the concurrent prescription combinations and inventory linkage relationships; using a hypergraph convolutional network to learn node representations of the drug sales association hypergraph to obtain a drug sales situation embedding; inputting the drug sales situation embedding into a preset sales strategy decision network, adjusting the parameters of the sales strategy decision network using an improved black widow optimization algorithm, and outputting a medical product sales strategy.
[0018] See Figure 2 In the specific implementation of acquiring medical product sales source data, original sales records and original inventory records are read from hospital information systems and pharmacy management systems. The hospital information systems and pharmacy management systems are deployed on servers in medical institutions and retail pharmacies, respectively. Data is extracted at predetermined time intervals through database connection interfaces. The extracted objects include outpatient pharmacy dispensing records, inpatient pharmacy stocking records, retail pharmacy terminal sales records, and corresponding real-time inventory snapshot records. During the extraction process, a data source identifier is attached to the original sales records and original inventory records. The data source identifier records the system number and version number of the hospital information system or pharmacy management system to which the extracted records belong.
[0019] Field extraction is performed on the original sales records to obtain the drug code, sales quantity, sales price, sales time, and medical institution identifier. The original sales records are stored in a structured table format, with columns including transaction serial number, in-hospital drug code, product name, sales quantity, sales price, sales timestamp, and institution identifier. During field extraction, the in-hospital drug code is extracted as the drug code, the sales quantity field is extracted as the sales quantity, the sales price field is extracted as the sales price, the sales timestamp field is extracted and parsed into a date and time format as the sales time, and the institution identifier field is extracted as the medical institution identifier. If the sales quantity field in the original sales record is empty or negative, the record is marked as abnormal and filtered.
[0020] Batch association is performed on the original inventory records to obtain detailed inventory change information. The original inventory records are stored as an inventory log, which includes fields for drug code, quantity changed, time of change, batch number, and operation type. Batch association uses the batch number as the primary key, sorting multiple change records under the same batch number in ascending order of change time. The difference between two consecutive changes is calculated, and this difference is used as the inventory change amount. Each record in the inventory change details includes a drug code, quantity changed, time of change, and batch number. Specifically, the drug code uses the hospital's drug code from the inventory log; the quantity changed is the absolute value of the difference between the current inventory quantities of adjacent change records, with a plus or minus sign to indicate increase or decrease; the time of change is the time of the last change record; and the batch number remains unchanged. When there is only one record for the same batch number, the quantity changed is the quantity changed for that record, and the time of change is the time of change for that record.
[0021] The prescription dispensing records are structured and parsed to obtain the prescription dispensing details. These records originate from the electronic prescription module and prescription review system within the hospital information system. The record format is semi-structured text or nested data structures, including a prescription header, a list of drug entries, the prescribing department, and diagnostic information. Structured parsing is performed using regular expression matching and field mapping: the prescription number is extracted from the prescription header; the list of drug entries is traversed to extract the generic name, specifications, and quantity of each drug, combining them into a drug combination list, where each element is a concatenated string of "generic name-specification-quantity"; the code corresponding to the prescribing department name is extracted from the prescription metadata to obtain the prescribing department; and the diagnostic code is extracted from the diagnostic information field to obtain the diagnostic code. Each record in the prescription dispensing details corresponds to a prescription number, and the record content includes the prescription number, drug combination, prescribing department, and diagnostic code.
[0022] The medical product sales source data is obtained by concatenating multiple tables based on drug codes, sales quantities, sales prices, sales times, medical institution identifiers, inventory change details, and prescription dispensing details, using drug codes and timestamps. The concatenation process is as follows: First, a timeline is constructed with a daily granularity, using sales time and change time as the time attributes for sales flow and inventory change, respectively. Using drug codes and dates as concatenation keys, sales flow records and inventory change detail records with the same drug codes are fully externally joined, resulting in multi-field records containing sales quantity, sales price, sales time, medical institution identifier, inventory change, and inventory batch number. Then, the drug combinations in the prescription dispensing details are flattened into multiple rows, each corresponding to one drug in the drug combination. A left join is then performed with the multi-field records obtained in the previous step, using the prescription date and drug code from the prescription dispensing details, to supplement the prescription number, prescribing department, and diagnosis code. For prescription dispensing details where no matching drug code exists across multiple fields, retain the dispensing record and set the sales quantity, unit price, sales time, and inventory change fields to null. For multi-field records where no prescription match exists, set the prescription number, prescribing department, and diagnosis code fields to null. After concatenation, duplicate fields in the medical product sales source data are removed, retaining one complete record for each drug code within each time unit to form the final medical product sales source data.
[0023] See Figure 3 In the graph, the horizontal axis represents the time bucket indicator, in days, ranging from 0 to 365 days, and the vertical axis represents the number of records, in units of entries. The three curves in the graph represent the quantity trends of drug sales records, inventory change records, and prescription dispensing records, respectively. The curve styles correspond to the legend: drug sales records are solid lines with dots, inventory change records are dashed lines with squares, and prescription dispensing records are dotted lines with triangles.
[0024] As shown in the figure, the number of drug sales records fluctuates between approximately 650 and 1000, exhibiting some random fluctuations over time without a clear upward or downward trend, reflecting the stability and daily sales fluctuation characteristics of drug sales within the target area. The number of inventory change records fluctuates between 400 and 650, generally lower than sales records, and the fluctuation range is relatively small, indicating that inventory changes are more stable than sales records. The number of prescription dispensing records is distributed between approximately 200 and 400, significantly lower than sales records and inventory change records, and the fluctuation range is relatively concentrated, consistent with the extraction and structured parsing process of prescription dispensing records in the above embodiment, reflecting the relative sparsity of prescription data.
[0025] The three parts of the curve maintain their respective orders of magnitude, indicating that different data sources can continuously output valid data on the time axis, ensuring data integrity and continuity, and meeting the needs of subsequent multi-table concatenation and the construction of sales behavior event sets. The time span covers daily records within a year, which is beneficial for capturing the periodic and seasonal characteristics of drug sales and inventory changes.
[0026] When normalizing the mapping between drug codes in drug sales records and drug codes in inventory change records, the generic name, dosage form, specifications, and manufacturer information of the drugs are extracted from both records. Each record in the drug sales records carries an in-hospital drug code, and each record in the inventory change records also carries an in-hospital drug code. The extraction process calls the drug master data table, which stores the mapping relationship between in-hospital drug codes and generic names, dosage forms, specifications, and manufacturer information. For each record in the drug sales records, an equality match is performed in the drug master data table using the in-hospital drug code as an index to extract the corresponding generic name, dosage form, specification, and manufacturer information fields. Similarly, for each record in the inventory change records, an equality match is performed in the drug master data table using the in-hospital drug code as an index to extract the corresponding generic name, dosage form, specification, and manufacturer information fields. When there is no record in the drug master data table that matches the hospital's drug code, the generic name, dosage form, specification, and manufacturer information fields are all set to text values parsed from the original record. If the original record does not contain the corresponding information, it is set to an empty string.
[0027] The extracted generic name, dosage form, specification, and manufacturer information are combined into a drug feature description string according to a preset concatenation order. The preset concatenation order is: generic name string, separator "|", dosage form string, separator "|", specification string, separator "|", and manufacturer information string. During concatenation, if the generic name field is empty, the placeholder "UNK_GENERIC" is used; if the dosage form field is empty, the placeholder "UNK_FORM" is used; if the specification field is empty, the placeholder "UNK_SPEC" is used; and if the manufacturer information field is empty, the placeholder "UNK_MFR" is used. The resulting drug feature description string does not contain any special characters except for the separators and placeholders, and all characters are converted to lowercase.
[0028] A hash operation is performed on the drug feature description string, and the hash result is mapped to a preset encoding space to obtain the standard drug code. The hash operation uses the SHA-256 algorithm, which is calculated on the UTF-8 byte sequence of the drug feature description string. Bit hash value. The default encoding space size is set to... The mapping method is to The first bit hash value The bits are interpreted as unsigned integers, and then modulo is taken with the preset encoding space size. The modulo operation formula is:
[0029] in, This represents the standard drug code obtained after mapping. This indicates that the hash value is preceded by... The value after converting bits to an unsigned integer. Indicates the preset encoding space size, with a value of Modulo operator Indicates taking Divide by Add the remainder The operation makes the standard drug coding range include to When different drug characteristic description strings are mapped to the same code, a linear probing method is used to handle conflicts: the current result is incremented... Then it checks again whether it has been occupied, until an unoccupied code is found as the standard code for the drug, and the conflict information is recorded in the normalization log.
[0030] Replace the drug codes in the drug sales logs and inventory change records with their corresponding standard drug codes, and establish a mapping table between the original codes and the standard drug codes. For each record in the drug sales logs, read the original in-hospital drug code and replace the original drug code field with the standard drug code obtained through the above normalization process. For each record in the inventory change records, read the original in-hospital drug code and replace the original drug code field with the standard drug code obtained through the same normalization process. When establishing the mapping table between the original codes and the standard drug codes, record one mapping relationship for each original in-hospital drug code. The mapping table includes the original in-hospital drug code field, generic name field, dosage form field, specification field, manufacturer information field, drug characteristic description string field, and standard drug code field. The mapping table is stored in a relational database for subsequent traceability queries. If the same original in-hospital drug code generates different standard drug codes due to master data updates during the normalization process, the latest normalization result will overwrite the mapping table.
[0031] The timestamps in drug sales records, inventory change records, and prescription dispensing records are uniformly converted to standard timezone times and then binned according to a preset time granularity. During the timestamp conversion, the sales time field from the drug sales record, the change time field from the inventory change record, and the prescription time field from the prescription dispensing record are read. The string representations of these three time fields are set as time objects with timezone information according to the local timezone of each source system, then converted to Coordinated Universal Time (UTC) and stored as UTC timestamps. The preset time granularity is set to 1 day. The binning operation truncates the UTC timestamps to the daily granularity, obtaining time bucket identifiers in the format YYYY-MM-DD. After converting the sales time of each record in the drug sales record to a UTC timestamp, a time bucket identifier is generated based on the date portion of the UTC timestamp and appended as a new field to the record. The change time in the inventory change record is also converted and appended with a time bucket identifier. The prescription time in the prescription dispensing record is also converted and appended with a time bucket identifier.
[0032] Drug combinations with the same prescription number within the same time bucket are marked as co-sell events. Prescription dispensing records with time bucket identifiers are grouped according to the time bucket identifier. Within each time bucket, secondary grouping is performed based on the prescription number field. For all drug combination records under the same prescription number, the drug standard codes in the drug combination list are extracted to form a co-sell drug set. When the number of drug standard codes in the co-sell drug set is not less than two, the co-sell drug set, time bucket identifier, and prescription number are combined into a co-sell event. The co-sell event record contains a co-sell event identifier, time bucket identifier, prescription number, and a list of drug standard codes participating in the co-sell event.
[0033] Drug combinations where inventory decreases continuously and sales volume increases within the same time bucket are marked as inventory linkage events. For each drug standard code, the inventory change and sales volume in the drug sales flow are extracted from the inventory change record in the order of the time bucket identifier. If the inventory change of a drug standard code is negative in two consecutive time buckets, and the difference in sales volume between the two time buckets within the same period is greater than zero, then the drug standard code is determined to be in a state of continuous inventory decrease and sales volume increase. Within the same time bucket, for any two drug standard codes in the above state, it is checked whether they have appeared in a co-sales event with the same prescription number within the same time bucket; if the frequency of their co-occurrence in historical co-sales events exceeds a preset threshold, then these two drug standard codes are combined with the current time bucket identifier into an inventory linkage event. The inventory linkage event record includes an inventory linkage event identifier, a time bucket identifier, a list of drug standard codes, and an inventory linkage direction, marked as from the drug that triggered the state first to the drug that triggered the state later.
[0034] The co-sales events and inventory-linked events are merged according to drug standard codes and time bucket order to obtain a set of sales behavior events. During the merge, the event format is standardized, with each sales behavior event record containing an event type field, a time bucket identifier field, and a drug standard code list field. The event type field can be either type 1 or type 2; type 1 represents co-sales events, and type 2 represents inventory-linked events. The time bucket identifier and drug standard code list from the co-sales event records are transferred to the sales behavior event records, and the event type field is assigned type 1. The time bucket identifier, drug standard code list, and inventory linkage direction from the inventory linkage event records are transferred to the sales behavior event records, and the event type field is assigned type 2. The inventory linkage direction is stored in the event attribute field. All merged sales behavior event records are sorted in ascending order by time bucket identifier, and records with the same time bucket identifier are grouped by event type, forming a set of sales behavior events.
[0035] See Figure 4 The horizontal axis of the graph represents time buckets in days, covering one year (365 days); the vertical axis represents the number of events in units. The curves are divided into two categories: the solid red curve represents co-sales events (Type 1), and the dashed purple curve represents inventory-linked events (Type 2). The number of co-sales events is generally high, fluctuating between approximately 150 and 300; the number of inventory-linked events is lower, fluctuating between approximately 50 and 180. Both types of events exhibit obvious daily fluctuations, showing the dynamic changes of co-sales and inventory-linked events in the time series of the sales event set. The co-sales event curve shows several prominent peaks, indicating a significant increase in the frequency of co-sales of drug combinations within prescriptions in certain time buckets; the inventory-linked event curve is relatively stable, with smaller peak and trough variations, reflecting a relatively stable inventory-linked relationship within the target time range.
[0036] When constructing a drug sales association hypergraph based on a set of sales event activities, each drug code in the sales event set is mapped to a node in the hypergraph. The list field of all drug standard codes in the sales event set is extracted, the nested drug standard code lists are flattened, and the union of all drug standard codes is taken to obtain a unique set of drug standard codes. For each drug standard code in the unique set of drug standard codes, a node is created in the hypergraph, with the node identifier using the string form of the drug standard code. The hypergraph is stored in the form of an adjacency list, and each node maintains a node identifier, a list of hyperedges associated with that node, and a node feature vector storage space.
[0037] For drug combinations with the same prescription number in the sales event set, all drug nodes in the drug combination are connected into a superedge, and the weight of the superedge is set to the frequency of the drug combination in the sales event set. The sales event set is traversed, and records with the event type field of type 1 are filtered. Each type 1 record corresponds to a co-sales event, and the co-sales event record contains a prescription number and a list of drug standard codes. Using the prescription number as the grouping key, the list of drug standard codes in the type 1 records is summarized, and each occurrence is counted. For drug standard code combinations under the same prescription number, a superedge is constructed, with the node set of the superedge being all nodes in the list of drug standard codes. The type of the superedge is labeled as a prescription combination superedge. The weight of the superedge is equal to the number of times drug combinations with the same prescription number appear in the sales event set. The value of the occurrence count is determined by counting the repetitions of the same prescription number and the same drug standard code set in the type 1 records. If the same prescription number appears with the same drug standard code set in different time buckets, the occurrence count is accumulated for each occurrence.
[0038] For a drug combination in the sales event set where inventory continuously decreases and sales volume increases, connect the drug nodes in this combination that are associated with inventory changes to form another hyperedge, and set the hyperedge's attribute to the inventory linkage direction. Iterate through the sales event set, filtering records whose event type field is of type two. Each type two record corresponds to an inventory linkage event, and the inventory linkage event record contains a list of standard drug codes and the inventory linkage direction in the event attribute field. For each type two record, construct a hyperedge whose node set is all nodes in the standard drug code list, and label the hyperedge type as an inventory linkage hyperedge. The hyperedge's attribute records the inventory linkage direction, which points from a source drug node to a target drug node. The inventory linkage direction information is stored in the hyperedge's attribute field as ordered node pairs. The inventory linkage hyperedge does not have a numerical weight; it only retains the inventory linkage direction and the time bucket identifier corresponding to the event in the hyperedge's attribute.
[0039] Hyperedges corresponding to drug combinations with the same prescription number and those corresponding to inventory linkage relationships are merged into the same hypergraph. If a group of drug nodes has both a prescription combination hyperedge and an inventory linkage hyperedge, both hyperedges are retained, generating a drug sales association hypergraph. Within the same hypergraph data structure, all prescription combination hyperedges and all inventory linkage hyperedges are inserted sequentially. When inserting a prescription combination hyperedge, the set of nodes constituting the hyperedge, the hyperedge type, and weight information are written to the hyperedge table, and the hyperedge identifier is added to the association hyperedge list of each participating node. When inserting an inventory linkage hyperedge, the set of nodes constituting the hyperedge, the hyperedge type, and the inventory linkage direction information are written to the hyperedge table, and the hyperedge identifier is added to the association hyperedge list of each participating node. When a prescription combination hyperedge already exists for a group of drug nodes, and an inventory linkage hyperedge is generated for the same group of drug nodes, no merging or overwriting operation is performed. Instead, a new hyperedge identifier is assigned to the inventory linkage hyperedge, and both hyperedges exist simultaneously in the hypergraph, with their respective types and attributes retained independently. After completing the insertion operations of all hyperedges, we obtain the drug sales association hypergraph, which contains a set of nodes and a set of hyperedges. The set of hyperedges contains elements of type prescription combination hyperedges and elements of type inventory linkage hyperedges.
[0040] When using a hypergraph convolutional network to learn node representations for the drug sales association hypergraph, a feature vector is initialized for each drug node. This feature vector includes the drug's ATC classification code, average daily sales, inventory turnover days, and medical insurance type. The drug's ATC classification code adopts the Anatomical Therapeutic and Chemical Classification System published by the World Health Organization, with an alphanumeric hierarchical structure. The top-level anatomical master group code of the ATC classification code is mapped to a 16-dimensional vector using one-hot encoding. The position corresponding to the master group index in the 16-dimensional vector is set to 1, and the remaining positions are set to 0. The average daily sales are calculated from the drug sales data. The total sales amount corresponding to the standard drug code within a preset historical time period is calculated, divided by the number of days in the preset historical time period to obtain the average daily sales value. The average daily sales value is then normalized to its maximum and minimum values and mapped to the [0,1] interval, serving as a component of the feature vector. Inventory turnover days are calculated from inventory change records. The average inventory is obtained by taking the average daily inventory of drug standard codes within a preset historical time period. The total outbound volume of drug standard codes within the same preset historical time period is taken, and the average inventory is divided by the quotient of the total outbound volume and the number of days in the preset historical time period to obtain the inventory turnover days. The natural logarithm of the inventory turnover days is then taken and standardized, mapping it to a value with a mean of 0 and a standard deviation of 1, which serves as a component of the feature vector. The medical insurance type is determined based on the medical insurance identifier field in the drug master data table. Medical insurance category A is coded as [1,0,0], medical insurance category B as [0,1,0], and non-medical insurance as [0,0,1], forming a 3-dimensional vector. The 16-dimensional vector of the ATC classification code, the 1-dimensional scalar of average daily sales, the 1-dimensional scalar of inventory turnover days, and the 3-dimensional vector of the medical insurance type are concatenated to obtain the initial feature vector for each drug node, with a dimension of 21. After initialization, the feature vector of each drug node is stored as a 21-dimensional floating-point array.
[0041] The hypergraph convolutional network consists of two hypergraph convolutional layers. The first hypergraph convolutional layer takes the initial feature vector as input and outputs a 64-dimensional representation of intermediate nodes. The second hypergraph convolutional layer takes the 64-dimensional representation of intermediate nodes as input and outputs a 128-dimensional embedding of drug sales trends. The operations of each hypergraph convolutional layer include hyperedge-level node feature aggregation, hyperedge-level feature generation, node feature update, and residual connections.
[0042] In the first hypergraph convolutional layer, for each hyperedge in the drug sales association hypergraph, the feature vectors of all nodes within the hyperedge are aggregated to generate hyperedge-level features. For a hyperedge, let the set of nodes associated with the hyperedge be denoted as . The feature vector of each node in this set of nodes is ,in Indicates node identifier. Hyperedge-level feature. We obtain it from the following formula:
[0043] in, This represents the hyperedge-level feature vector, with the same dimension as the input node feature vector. The first layer is... dimension; This represents the number of elements in the set of nodes associated with the hyperedge; summation symbol. Represents a set of nodes Feature vectors of all nodes Perform element-wise summation. The division operation divides the sum vector by... The mean vector is obtained as a hyperedge-level feature.
[0044] The hyperedge-level features are propagated back to each node along the hyperedge connections, and the propagated node features are residually joined with the previous node features to obtain the updated node features. For each drug node... Collection nodes Let the set of associated hyperedges be . Propagate back to the node The characteristic is a set of associated hyperedges The mean of the hyperedge-level features of all hyperedges in the array:
[0045] in, Represents a node The received aggregated hyperedge feature vector, summation sign Represents a node The set of associated hyperedges Iterate through all hyperedges and extract the hyperedge-level feature vector of each hyperedge. Perform element-wise summation. Represents a node Associative Hyperedge Set The number of elements in the matrix. The aggregated hyperedge feature vector is then input into a linear transformation layer, which contains a weight matrix. and a bias vector Weight matrix The dimension is Bias vector The dimension is 64, and it is processed by linear transformation and activation function:
[0046] in, Represents a node The transformed feature vector has a dimension of 64; Represents the ReLU activation function, which is to take the activation value for each component of the input vector. ; This represents the weight matrix of the first layer, with dimensions 64×21; Represents a node The received aggregated hyperedge feature vector has a dimension of 21. This represents the bias vector of the first layer, with a dimension of 64; the residual connection connects the transformed feature vector with the node... initial feature vector After dimensional adaptation, the addition is implemented as follows: The dimension is 21. The dimension is 64, using a one-dimensional adaptation matrix. Will Mapping to 64 dimensions, adaptation matrix The dimension is The adapted residual components are added to the transformed feature vector to obtain the updated first-layer node features. :
[0047] in, Represents a node The updated node features after the first hypergraph convolutional layer have a dimension of 64. Represents a node The transformed feature vector has a dimension of 64; This represents the dimension adaptation matrix of the first layer, with dimensions of 64×21; Represents a node The initial feature vector has a dimension of 21.
[0048] The updated node features are then fed into the next hypergraph convolutional layer, and the aggregation and propagation operations are repeated. In the second hypergraph convolutional layer, the input is a 64-dimensional feature vector for each node. For each hyperedge, the same mean aggregation method is used to extract the mean from each node in the set of associated nodes. Calculate hyperedge level features The dimension is 64. For each node... Calculate the mean of the hyperedge-level features in the associated hyperedge set. The dimension is 64. The weight matrix of the linear transformation layer. Dimensions Bias vector The dimension is 128. Calculate the transformed feature vector. The dimension is 128. The residual join uses a dimension adaptation matrix. Input features Mapping to 128 dimensions, adaptation matrix Dimensions The mapping result is compared with Add them together to obtain the updated node features in the second layer. The dimension is 128.
[0049] After stacking two hypergraph convolutional layers, the output is the drug sales situation embedding for each drug node. The drug sales situation embedding is the 128-dimensional vector output by the second hypergraph convolutional layer. The drug sales situation is embedded and stored in a drug sales situation embedding matrix. The matrix rows correspond to drug nodes, and the columns are 128-dimensional embeddings, which are used by the subsequent sales strategy decision-making network.
[0050] In the specific implementation of embedding drug sales trends into a pre-defined sales strategy decision network, the drug sales trend embedding matrix output by the hypergraph convolutional network is obtained. Each row of the drug sales trend embedding matrix corresponds to a drug standard code, and each column is a 128-dimensional drug sales trend embedding vector. The drug standard codes in the drug sales trend embedding matrix are arranged in ascending lexicographical order to form a sequence of length L, where L represents the total number of drug standard codes participating in the calculation within the target region. The element at the p-th position in the sequence is the 128-dimensional drug sales trend embedding vector corresponding to that drug standard code, denoted as . , Take values from 1 to L. Embed the sorted drug sales situation into the sequence and use it as the input to the gated cyclic unit network.
[0051] The gated recurrent unit network consists of a gated recurrent unit layer and a fully connected output layer. The gated recurrent unit layer has 256 hidden units, an input dimension of 128, and L time steps. The gated recurrent unit layer receives the drug sales situation embedding sequence. An update operation is performed at each time step p. The gated recurrent unit layer contains update gates, reset gates, and candidate state calculation modules. (Update gate vector) The calculation method is as follows ,in To update the input weight matrix of the gate, the dimension is... , To update the cyclic weight matrix of the gate, the dimension is... , To update the gate's bias vector, which has a dimension of 256, This is the hidden state vector from the previous time step, with a dimension of 256. This represents the sigmoid activation function. Reset the gate vector. The calculation method is as follows ,in The input weight matrix for the reset gate has dimensions of . , To reset the cyclic weight matrix of the gate, the dimension is... , The bias vector for resetting the gate has a dimension of 256. Candidate hidden state vector. The calculation method is as follows ,in The input weight matrix for the candidate states has dimensions of . , Let be the cyclic weight matrix of the candidate states, with dimension . , Let be the bias vector of the candidate states, with a dimension of 256. This represents element-wise multiplication. The hidden state vector at the current time step. The calculation method is as follows Initial hidden state vector The zero vector represents the hidden state vector at each time step. Sequential collection yields a sales status sequence. , shape .
[0052] A weighted aggregation of the sales state sequence is performed using a multi-head attention layer to obtain a comprehensive sales state vector. The multi-head attention layer has 8 attention heads, each with 32 keys, queries, and values. For the m-th attention head, the sales state sequence... Mapping to the query matrix via linear transformation Key matrix Sum matrix Linear transformations use trainable weight matrices. , dimension ,get Use trainable weight matrices , dimension ,get Use trainable weight matrices , dimension ,get Calculate the attention score matrix. , The size is The head output is obtained by multiplying the attention score matrix by the value matrix. The size is The outputs of the eight attention heads are concatenated along the last dimension to obtain the concatenation matrix. The size is Then, through a linear projection matrix... , dimension Multiplying the result by the concatenation matrix yields the output of the multi-head attention layer. .right Average pooling is performed along the time step dimension to obtain a 256-dimensional comprehensive sales state vector. ,in express The pth line.
[0053] The overall sales state vector is input into a fully connected layer, which outputs multiple candidate sales strategy actions. The fully connected layer consists of one hidden layer and one output layer. The hidden layer has 128 neurons, uses ReLU activation, and takes a 256-dimensional overall sales state vector as input. The output is a 128-dimensional intermediate vector. ,in Here is the hidden layer weight matrix, with dimension 1. , This is the hidden layer bias vector, with a dimension of 128. The output layer contains K output units, where K is the preset number of candidate actions, which is set to 5. Output layer weight matrix. Dimensions Bias vector Dimensions The output vector is The output vector is reorganized into a K-row, 3-column matrix. Each row corresponds to a candidate sales strategy action, and the columns correspond to the promotional discount percentage, inventory quantity adjustment ratio, and channel priority, respectively. The promotional discount percentage is mapped to the [0,1] interval using the sigmoid function, representing the discount percentage. The inventory quantity adjustment ratio is mapped to the [-1,1] interval using the tanh function, with positive values indicating an increase in inventory quantity and negative values indicating a decrease in inventory quantity. The channel priority is normalized using the softmax function to normalize the channel priority values of the K candidate actions, ensuring that the sum of the channel priority values of all candidate actions is 1. A higher channel priority value indicates a higher priority for pushing the strategy to online channels.
[0054] When optimizing the parameters of the sales strategy decision network using the improved Black Widow optimization algorithm, the parameters of the sales strategy decision network are encoded as position vectors of individual Black Widow spiders. The parameters of the sales strategy decision network include all weight matrices and bias vectors of the gated recurrent unit network, the weight matrix and projection matrix of the multi-head attention layer, the weight matrix and bias vector of the fully connected layer, and the scaling factor and offset of the batch normalization layer. All the above parameters are flattened into a one-dimensional floating-point array in a fixed order, with the array length denoted as D, where D is the total number of parameters in the sales strategy decision network. The position vector of each Black Widow spider is a one-dimensional array of length D, representing a set of candidate sales strategy decision network parameter values. Each component takes a value that is the default value of the corresponding parameter plus a random offset within the range of [-0.1, 0.1].
[0055] The population size is set to 50, the maximum number of iterations to 200, and the mutation probability to 0.1. The sales strategy decision network parameters are used as the individual's position vector to randomly generate an initial black widow spider population. For each individual in the initial population, each component of the position vector is initialized to its default parameter value plus a random number sampled from a Gaussian distribution with a mean of 0 and a standard deviation of 0.05, resulting in 50 distinct position vectors.
[0056] For each individual in the initial black widow spider population, the position vector is decoded into parameters for a sales strategy decision network. A simulated sales process is then executed based on these parameters to obtain the simulated sales profit. The simulated sales process uses a pre-set sales simulator, which maintains the drug inventory status, prescription generation models for various medical institutions within the target area, and patient purchasing behavior models. The drug sales situation and the current inventory of drugs within the target area are input into the sales strategy decision network loaded with the individual's corresponding parameters, resulting in K candidate sales strategy actions. The action with the largest promotional discount and the smallest absolute value of the inventory adjustment ratio is selected as the execution action. A sales simulation cycle is then performed according to the promotional discount and inventory adjustment ratio set for the execution action. The simulation cycle is set to 30 days. After the simulation cycle ends, the simulated sales profit is calculated by subtracting the purchase cost, inventory holding cost, and promotional discount cost from the total sales revenue of all drugs within the simulation cycle. The simulated sales profit is expressed in monetary units.
[0057] Get current inventory turnover rate The current inventory turnover rate is calculated based on the actual outbound data of the most recent 30 days, using the following formula: The current inventory turnover rate is dimensionless and represents the number of monthly turnovers.
[0058] The simulated sales profit and current inventory turnover rate are weighted according to preset weights to obtain the fitness value for each individual. Fitness value The calculation formula is:
[0059] in, The fitness value of an individual ind is represented by a dimensionless scalar. The preset weighting coefficient has a value range of (0,1) and is set according to the business's focus on profit and turnover rate. The normalized simulated sales profit is obtained by taking the maximum simulated sales profit in the current population. and minimum simulated sales profit ,calculate ,in To prevent division by zero for tiny positive numbers like 0.0001; The normalized current inventory turnover rate is calculated by taking the maximum inventory turnover rate in the current population. and minimum inventory turnover rate ,calculate Preset weighting coefficients The value is set to 0.6, based on the principle of prioritizing profit contribution over inventory turnover rate while maintaining inventory health.
[0060] The population is sorted according to fitness values, and the top 10 individuals with the highest fitness values are selected as elite individuals. The preset ratio is set to 20%, meaning the top 10 individuals with the highest fitness values are selected from 50 individuals. These elite individuals are then mated, with their position vectors randomly intersecting at a point to generate offspring. For each mating, two distinct elite individuals are randomly selected as the parent and parent, and a random intersection point c is generated, where c is an integer between 1 and D-1. The first c components of the parent's position vector are concatenated with the (c+1)th to (D)th components of the parent's position vector to generate the first offspring; the first c components of the parent's position vector are then concatenated with the (c+1)th to (D)th components of the parent's position vector to generate the second offspring. This mating process is repeated until the number of offspring equals the population size of 50.
[0061] The offspring individuals are perturbed at a preset probability. Each component of each offspring individual is perturbed with a mutation probability of 0.1: if a component triggers a perturbation, a random perturbation value sampled from a Gaussian distribution with a mean of 0 and a standard deviation of 0.02 is added to that component. After perturbation, the numerical range of each component is checked; if it exceeds the reasonable range allowed by the parameters, it is clipped to the boundary of the reasonable range.
[0062] The perturbed offspring are merged with the current population to obtain a merged population of size 100. The fitness value of all individuals in the merged population is calculated, and the top 50 individuals with the highest fitness values are selected to form the next generation population.
[0063] Repeat the above iterations until the preset iteration count of 200 is reached. The parameters corresponding to the individual with the highest fitness value are used as the final sales strategy decision network parameters. These final parameters are then loaded into the sales strategy decision network, embedding the drug sales situation into the network after parameter loading to obtain the sales strategy action vector. The sales strategy action vector is a K×3 matrix, with each row corresponding to a candidate sales strategy action, including promotional discount, inventory quantity adjustment ratio, and channel priority. From the sales strategy action vector, the candidate action with the lowest entropy value during forward propagation for the individual with the highest fitness value is selected as the encoding vector for the final executed medical product sales strategy. This encoding vector is then decoded into a medical product sales strategy containing drug identification, target sales area, promotional discount, and inventory reservation ratio.
[0064] See Figure 5 In the graph, the horizontal axis represents the number of iterations of the Black Widow optimization algorithm, ranging from 1 to 200, and the vertical axis represents the fitness value, expressed in dimensionless form. The graph contains four curves: "optimal fitness" (solid line), "average fitness" (dashed line), "25th quantile fitness" (dotted line), and "75th quantile fitness" (dotted line), corresponding to the fitness distribution of different individuals in each generation of the population.
[0065] As shown in the figure, in the early stages of iteration (approximately generations 1 to 20), all fitness metrics are low, with the optimal fitness ranging from 0.5 to 0.6, and the average and quantile fitness fluctuating between 0.4 and 0.6, reflecting the generally low fitness of initially randomly generated individuals. With increasing iterations, the fitness curves generally show an upward trend, especially the optimal fitness curve, which shows a significant increase. This indicates that through the improved Black Widow optimization algorithm's continuous optimization of the sales strategy decision network parameters, the performance of the optimal individuals in the population is continuously improved.
[0066] Between approximately 50 and 150 generations, the optimal fitness repeatedly reached a peak close to 1.0, indicating that the algorithm had achieved a relatively good solution at this stage. The average fitness, as well as the 25th and 75th quantile fitness, all showed a steady upward trend, with the 75th quantile fitness remaining in the range of 0.7 to 0.9, indicating that the fitness of most individuals improved significantly and the population diversity remained good.
[0067] In the later stages of iteration (generations 150 to 200), the optimal fitness curve fluctuated less, remaining between 0.8 and 1.0, indicating that the algorithm tended to converge. The average fitness and the 25th quartile fitness also tended to stabilize accordingly, with a mean of about 0.7, and the interquartile range narrowed, reflecting that the individual fitness distribution was more concentrated and the convergence was good.
[0068] When outputting the sales strategy for medical products, the parameters corresponding to the individual with the highest fitness value are loaded into the sales strategy decision network. The individual with the highest fitness value is the individual with the largest fitness value in the black widow spider population after completing a preset number of iterations. The position vector of the individual with the highest fitness value is a one-dimensional array of length D, where D is the total number of parameters in the sales strategy decision network. The loading process is performed according to a parameter mapping table, which pre-records the name, shape, and offset range of the parameters in the position vectors of each layer of the sales strategy decision network. The update gate input weight matrix in the gated recurrent unit network is... Its shape is For the 0th to 32767th components in the corresponding position vector, reshape the values of that interval in the position vector in row-major order. The matrix is assigned to the update gate input weight matrix of the gated recurrent unit network. Following the same operation, each segment of the position vector is sequentially assigned to the update gate recurrent weight matrix. Update the gate bias vector Reset gate input weight matrix Reset the gate loop weight matrix Reset gate bias vector Candidate state input weight matrix Candidate state cyclic weight matrix Candidate state bias vector The parameters of the multi-head attention layer include the query weight matrix. A total of 8 groups, key weight matrix A total of 8 groups, value weight matrix A total of 8 groups and linear projection matrices Load them sequentially according to the mapping table. The parameters of the fully connected layer include the hidden layer weight matrix. Hidden layer bias vector Output layer weight matrix and output layer bias vector The parameters are loaded sequentially according to the mapping table. After all parameters are loaded, the sales strategy decision network switches to inference mode. In inference mode, the statistical updates of the batch normalization layer are disabled, and the hidden states of the gated recurrent unit network are initialized to zero vectors.
[0069] The drug sales situation is embedded into the sales strategy decision network after inputting parameters to obtain the sales strategy action vector. The drug sales situation embedding matrix is a 128-dimensional drug sales situation embedding vector of all drug nodes output by the hypergraph convolutional network, arranged in ascending order according to the drug standard coding dictionary. L represents the total number of standard drug codes. The drug sales situation is embedded into a sequence input gated recurrent unit network (GRU). At each time step p, the GRU generates a 256-dimensional hidden state vector. This forms a sales status sequence. The sales status sequence has the following shape: The sales status sequence The input is a multi-head attention layer, where eight attention heads compute attention scores in parallel and then aggregate them with weights to obtain the output of the multi-head attention layer. , shape .right Perform average pooling along the time step dimension to obtain a 256-dimensional comprehensive sales state vector. The overall sales status vector The input is a fully connected layer. The hidden layers of this layer undergo linear transformation and ReLU activation to obtain a 128-dimensional intermediate vector. The output layer undergoes a linear transformation, reorganizing the output into a K-row, 3-column matrix, where K is set to 5. Each row of the matrix corresponds to a candidate sales strategy action. The first column is mapped to the promotional discount rate using the sigmoid function, with values ranging from [0,1]. The second column is mapped to the inventory quantity adjustment ratio using the tanh function, with values ranging from [-1,1]. The third column is normalized across the K rows using the softmax function to represent the channel priority, with the sum of all channel priority values being 1. This K-row, 3-column matrix is the sales strategy action vector.
[0070] The sales strategy action vector is decoded into a medical product sales strategy that includes drug identification, target sales region, promotional discount, and inventory reservation ratio. For each candidate action in the sales strategy action vector, the promotional discount in the first column is multiplied by 100 to obtain the promotional discount value expressed as a percentage. The inventory quantity adjustment ratio in the second column is multiplied by the available inventory in the current drug inventory snapshot to obtain the suggested inventory increase or decrease. The channel priority value in the third column is mapped to a preset channel list, which includes online channels, offline chain channels, and primary healthcare channels in that order. The channel with the highest channel priority value is determined as the target channel in the strategy. During decoding, the target region name and drug standard code are included. The drug identification is the drug standard code, and the target sales region is the target region name. The inventory reservation ratio is calculated based on the inventory quantity adjustment ratio. The calculation formula is:
[0071] in, This indicates the inventory reservation ratio, in days. This indicates the available inventory quantity corresponding to the drug identifier in the current inventory snapshot, in units of the smallest packaging unit; This represents the adjustment ratio of the stock preparation quantity for the candidate action. It is a dimensionless value with a range of [-1, 1]. This indicates the average daily sales volume of the drug over the most recent 30 days, expressed in units of the smallest packaging unit per day.
[0072] The sales strategy for medical products is validated based on the current inventory snapshot and the list of drugs nearing their expiration date. The current inventory snapshot is retrieved in real time from the inventory management system and includes the available inventory, in-transit inventory, and allocated inventory for each drug's standard code. The list of drugs nearing their expiration date is generated by the batch expiration management module. Each record in the list includes the drug's standard code, batch number, expiration date, and remaining inventory. The filtering criteria are batch numbers whose expiration date is after the current date and does not exceed 90 days.
[0073] The verification process, based on the decoded medical product sales strategy, performs the following checks sequentially: Check 1, read the available inventory of the drug identifier in the current inventory snapshot. Available inventory Adjustment ratio of inventory quantity and average daily sales Substitute into the above inventory reserve ratio formula to calculate ;like If the inventory is less than the preset minimum inventory retention days threshold, the verification fails. The minimum inventory retention days threshold is set to 7 days, based on the inventory coverage required to meet the regular weekly sales fluctuations. Verification 2: Check if the drug label appears in the list of drugs nearing their expiration date. If the drug label appears in the list of drugs nearing their expiration date, and the promotional discount in the medical product sales strategy exceeds the maximum allowable discount threshold for drugs nearing their expiration date, the verification fails. The maximum allowable discount threshold for drugs nearing their expiration date is set to 0.5%, or 50%, to prevent the risk of returns or complaints arising from abnormal clearance of expired drugs due to large discounts. Verification 3: Check the promotional discount and available inventory. If the product of the sales figures exceeds three times the highest historical single-day sales volume of the drug in the target sales region, the verification fails. This setting is based on the principle of avoiding inventory shortages caused by short-term promotions. The verification passes when all three of the above criteria are met.
[0074] If the verification fails, the parameters corresponding to the individuals are selected sequentially in descending order of fitness value for re-decoding and verification. In the iterative process of the improved Black Widow optimization algorithm, the position vectors and fitness values of all individuals in each generation are stored in the population history table, which contains a complete copy of the individual ID, fitness value, and position vector. Individuals in the population history table are sorted in descending order of fitness value, forming an ordered list. Starting with the individual with the highest fitness value, the loading, inference, decoding, and verification steps described above are executed. When the medical product sales strategy corresponding to the first individual fails verification, the next individual with the second highest fitness value in the ordered list is selected, its position vector is decoded into sales strategy decision network parameters and loaded, and the drug sales situation embedding input and subsequent decoding and verification operations are re-executed. This process is repeated until a medical product sales strategy corresponding to an individual passes all verification judgments, and this medical product sales strategy is output as an executable medical product sales strategy.
[0075] Optionally, if the position vectors of all individuals in the ordered list are tried and all fail the validation, a conservative strategy is generated. In the conservative strategy, the promotional discount is 0, the inventory quantity adjustment ratio is 0, the channel priority is set to the default average allocation, the drug identifier and target sales region remain unchanged, and the inventory reservation ratio is set to 14 days' coverage of the drug identifier's average daily sales over the past 30 days. The conservative strategy is output as an executable medical product sales strategy.
[0076] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A method for intelligent management of medical product sales data, characterized in that, The method includes: Acquire medical product sales source data within the target area, including drug sales records, inventory change records, and prescription dispensing records; The drug sales records, inventory change records, and prescription dispensing records are normalized with drug codes and aligned with timestamps to generate a set of sales behavior events. A drug sales association hypergraph is constructed based on the set of sales behavior events. The nodes of the drug sales association hypergraph are drugs, and the hyperedges are used to represent the linkage between concurrent prescription combinations and inventory. A hypergraph convolutional network is used to learn node representations of the drug sales association hypergraph to obtain the drug sales situation embedding. The drug sales situation is embedded into a preset sales strategy decision network, and the parameters of the sales strategy decision network are adjusted using an improved Black Widow optimization algorithm to output a medical product sales strategy.
2. The intelligent management method for medical product sales data according to claim 1, characterized in that, The acquisition of medical product sales source data within the target area specifically includes: Retrieves original sales records and original inventory records from hospital information systems and pharmacy management systems; Fields are extracted from the original sales records to obtain the drug code, sales quantity, sales unit price, sales time, and medical institution identifier; Batch association is performed on the original inventory records to obtain inventory change details, which include drug code, inventory change amount, change time, and inventory batch number; The prescription dispensing record is structured and parsed to obtain prescription dispensing details, which include prescription number, drug combination, prescribing department and diagnosis code; The drug code, sales quantity, sales price, sales time, medical institution identification, inventory change details, and prescription dispensing details are concatenated from multiple tables according to drug code and timestamp to obtain the source data of medical product sales.
3. The intelligent management method for medical product sales data according to claim 1, characterized in that, The process of normalizing and aligning the drug sales records, inventory change records, and prescription dispensing records with timestamps to generate a set of sales event events specifically includes: Normalize and map the drug codes in the drug sales records to the drug codes in the inventory change records, and unify them to the preset drug standard codes. The timestamps in drug sales records, inventory change records, and prescription dispensing records are uniformly converted to standard time zone time and then binned according to the preset time granularity. Drug combinations with the same prescription number in the prescription dispensing records within the same time bucket are marked as co-sale events; A combination of drugs whose inventory decreases continuously and whose sales volume increases within the same time period is marked as an inventory linkage event. The co-sales events and the inventory linkage events are merged according to the drug standard code and time bucket order to obtain a set of sales behavior events.
4. The intelligent management method for medical product sales data according to claim 1, characterized in that, The construction of the drug sales association hypergraph based on the set of sales behavior events specifically includes: Map each drug code in the sales event set to a node in the hypergraph; For drug combinations with the same prescription number in the sales event set, all drug nodes in the drug combination are connected into a superedge, and the weight of the superedge is set to the frequency of occurrence of the drug combination in the sales event set. For a drug combination in the sales event set where the inventory continuously decreases and the sales volume increases, connect the drug nodes in the drug combination that are associated with inventory changes to form another hyperedge, and set the attribute of the hyperedge to the inventory linkage direction. The hyperedges corresponding to drug combinations with the same prescription number and the hyperedges corresponding to inventory linkage relationships are merged into the same hypergraph. If the same group of drug nodes has both prescription combination hyperedges and inventory linkage hyperedges, both hyperedges are retained to generate a drug sales association hypergraph.
5. The intelligent management method for medical product sales data according to claim 1, characterized in that, The step of using a hypergraph convolutional network to learn node representations of the drug sales association hypergraph to obtain the drug sales situation embedding specifically includes: Initialize the feature vector for each drug node, which includes the drug's ATC classification code, average daily sales, inventory turnover days, and medical insurance type; For each hyperedge in the drug sales association hypergraph, the feature vectors of all nodes within the hyperedge are aggregated to generate hyperedge-level features; The hyperedge-level features are propagated back to each node along the hyperedge connection relationship, and the propagated node features are residually connected with the previous node features to obtain the updated node features. The updated node features are input into the next hypergraph convolutional layer, and the aggregation and propagation operations are repeated. After multiple stacks, the drug sales status embedding of each drug node is output.
6. The intelligent management method for medical product sales data according to claim 1, characterized in that, The process of embedding the drug sales situation into a preset sales strategy decision network, adjusting the parameters of the sales strategy decision network using an improved Black Widow optimization algorithm, and outputting a medical product sales strategy specifically includes: The drug sales status is embedded into the input gating loop unit network to generate a sales status sequence; The sales state sequence is weighted and aggregated by a multi-head attention layer to obtain a comprehensive sales state vector; The comprehensive sales state vector is input into the fully connected layer, which outputs multiple candidate sales strategy actions. Each candidate sales strategy action includes the promotional discount rate, the inventory quantity adjustment ratio, and the channel priority. An improved Black Widow optimization algorithm is used to optimize the parameters of the sales strategy decision network, and a medical product sales strategy is determined from the multiple candidate sales strategy actions.
7. The intelligent management method for medical product sales data according to claim 6, characterized in that, The step of optimizing the parameters of the sales strategy decision network using an improved Black Widow optimization algorithm to determine the medical product sales strategy from multiple candidate sales strategy actions specifically includes: The parameters of the sales strategy decision network are encoded as position vectors of individual black widow spiders; Initialize the black widow spider population and calculate the fitness value of each individual, which is determined based on simulated sales profit and inventory turnover rate; The population is sorted according to fitness values, and the individuals with the highest fitness values in the top preset proportion are selected as elite individuals. The elite individuals are mated by exchanging fragments of their position vectors at random intersection points to generate offspring individuals. The positions of offspring individuals are perturbed with a preset probability, and the perturbed offspring individuals are merged with the current population. The next generation of the population is then selected based on the fitness value. Repeat the above iterations until the preset number of iterations is reached. The parameters corresponding to the individual with the highest fitness value are used as the final sales strategy decision network parameters, and the medical product sales strategy is output based on the multiple candidate sales strategy actions.
8. The intelligent management method for medical product sales data according to claim 7, characterized in that, The step of outputting a medical product sales strategy based on the multiple candidate sales strategy actions specifically includes: The parameters corresponding to the individual with the highest fitness value are loaded into the sales strategy decision network; The drug sales situation is embedded into the sales strategy decision network after input loading parameters to obtain the sales strategy action vector; The sales strategy action vector is decoded into a medical product sales strategy that includes drug identification, target sales area, promotional discount rate, and inventory reservation ratio; The medical product sales strategy is validated based on the current inventory snapshot and the list of drugs nearing their expiration date. If the validation fails, the parameters corresponding to each individual are selected in descending order of fitness value for re-decoding and validation until an executable medical product sales strategy is obtained and output.
9. The intelligent management method for medical product sales data according to claim 3, characterized in that, The normalization mapping of drug codes in drug sales records and drug codes in inventory change records to a preset standard drug code specifically includes: Extract the generic name, dosage form, specifications, and manufacturer information of drugs from drug sales records and inventory change records; The extracted generic name, dosage form, specifications, and manufacturer information are combined into a drug feature description string according to a preset splicing order; Perform a hash operation on the drug feature description string, and map the hash result to a preset encoding space to obtain the drug standard code; Replace the drug codes in the drug sales records and inventory change records with the corresponding standard drug codes, and establish a mapping table between the original codes and the standard drug codes.
10. The intelligent management method for medical product sales data according to claim 7, characterized in that, The initialization of the black widow spider population involves calculating the fitness value of each individual. This fitness value is determined based on simulated sales profit and inventory turnover rate, specifically including: Set the population size, maximum number of iterations, and mutation probability; Using the sales strategy decision network parameters as the individual's location vector, an initial black widow spider population is randomly generated. For each individual in the initial black widow spider population, the position vector is decoded into sales strategy decision network parameters, and a simulated sales process is executed based on the parameters to obtain simulated sales profit; Obtain the current inventory turnover rate, and perform weighted processing on the simulated sales profit and the current inventory turnover rate according to preset weights to obtain the fitness value of each individual.