An electronic prescription slip auditing method and system of a smart pharmacy
By constructing single-item-level inventory constraint identifiers and global optimization matching, and dynamically calculating pharmaceutical difference risk values, the smart pharmacy achieves accurate compliance and efficient operation of prescription review.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUNAN SPACE FOLDING INTERNET TECH CO LTD
- Filing Date
- 2026-03-06
- Publication Date
- 2026-06-09
AI Technical Summary
The existing electronic prescription review mechanism is unable to intelligently distinguish between reasonable out-of-stock substitutions and illegal substitutions when faced with complex scenarios, resulting in low review efficiency, insufficient accuracy, and crude inventory management.
By constructing single-item-level inventory constraint identifiers, using global optimization matching to eliminate operational sequence interference, dynamically coupling inventory status and pharmaceutical differences to calculate risk values, and implementing hierarchical control.
It significantly improves the accuracy and operational efficiency of prescription review in smart pharmacies, and solves the problems of rigid review rules and inability to adapt to dynamic inventory in existing technologies.
Smart Images

Figure CN122177345A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent pharmacy transaction control technology, specifically to a method and system for reviewing electronic prescriptions in a smart pharmacy. Background Technology
[0002] In the pharmaceutical retail sector, electronic prescription verification is a crucial step in ensuring patient medication safety and improving pharmacy operational efficiency. Currently, retail pharmacies generally use electronic systems to compare prescription drugs with the barcode information of the physical drugs to achieve compliance verification before dispensing.
[0003] However, in practice, due to various factors such as dynamic changes in drug inventory and the potential discrepancy between the order in which pharmacists scan codes and the order of prescription lists, existing review mechanisms perform poorly in handling complex scenarios. Existing technical solutions typically rely on simple linear comparisons or static rule-based judgments, making it difficult to intelligently distinguish between legitimate shortage substitutions and illegal drug replacements. They also cannot effectively handle false alarms caused by the order of operations, resulting in overall low review efficiency, insufficient accuracy, and a lack of robust inventory management. Summary of the Invention
[0004] To address the current technical challenges of developing an electronic prescription review method that can adapt to inventory status, intelligently match prescriptions with physical medications, and accurately manage the risks of substitute dispensing, this invention aims to provide an electronic prescription review method and system for smart pharmacies. The specific technical solution adopted is as follows: In a first aspect, the present invention provides a method for reviewing electronic prescriptions in a smart pharmacy, comprising: acquiring a set of prescription-to-be-dispensed items corresponding to the electronic prescription to be reviewed and a set of actual-scanned items obtained from actual scanning; generating an inventory constraint identifier for each item unit based on the real-time inventory status of the medicine corresponding to each item unit in the prescription-to-be-dispensed item set; wherein the inventory constraint identifier is used to distinguish whether the item unit is required to match the original medicine; determining the optimal mapping relationship between each item unit in the prescription-to-be-dispensed item set and the item units in the actual-scanned item set based on the pharmaceutical attribute differences between the item units in the prescription-to-be-dispensed item set and the item units in the actual-scanned item set; for each item unit in the prescription-to-be-dispensed item set, determining the performance compliance risk value of each item unit based on the corresponding optimal mapping relationship and the inventory constraint identifier; wherein the performance compliance risk value is used to comprehensively characterize the degree of pharmaceutical attribute differences and inventory constraint status corresponding to the item unit; and executing corresponding control instructions for the current transaction based on the performance compliance risk values of all item units in the prescription-to-be-dispensed item set.
[0005] Secondly, this invention provides an electronic prescription review system for smart pharmacies, comprising: a data acquisition module, a constraint identifier generation module, a mapping relationship construction module, a compliance risk assessment module, and a transaction control module; the data acquisition module is used to acquire the set of prescription items to be dispensed corresponding to the electronic prescription to be reviewed and the set of actual scanned items obtained from the actual scanning; the constraint identifier generation module is used to generate an inventory constraint identifier for each item unit according to the real-time inventory status of the medicine corresponding to each item unit in the prescription item set; wherein, the inventory constraint identifier is used to distinguish whether the item unit is required to match the original medicine; the mapping relationship construction module is used to determine the order of prescription items... The system identifies the differences in pharmaceutical attributes between individual units in the prescription-to-be-prepared set and the actual scanned set of individual products, determining the optimal mapping relationship between each individual unit in the prescription-to-be-prepared set and the individual units in the actual scanned set. A compliance risk assessment module is used to determine the compliance risk value for each individual unit in the prescription-to-be-prepared set based on the corresponding optimal mapping relationship and inventory constraint identifier. This compliance risk value comprehensively characterizes the degree of difference in pharmaceutical attributes and the inventory constraint status corresponding to the individual unit. A transaction control module is used to execute corresponding control instructions for the current transaction based on the compliance risk values of all individual units in the prescription-to-be-prepared set.
[0006] Thirdly, the present invention provides an electronic device, comprising: a processor and a memory; wherein the memory is used to store one or more programs, the one or more programs including computer-executable instructions, and when the electronic device is running, the processor executes the computer-executable instructions stored in the memory to cause the electronic device to perform the electronic prescription review method for a smart pharmacy as described in the first aspect and any possible implementation thereof.
[0007] This invention offers the following advantages: by constructing single-item-level inventory constraint identifiers, utilizing global optimization matching to eliminate operational sequence interference, and dynamically coupling inventory status with pharmaceutical differences to calculate risk values, hierarchical control is ultimately implemented based on these risk values. This solution effectively addresses the problems of rigid review rules, inability to adapt to dynamic inventory, susceptibility to misreporting due to operational sequence issues, and asynchronous inventory management in existing technologies, significantly improving the accuracy, compliance, and operational efficiency of prescription review in smart pharmacies. Attached Figure Description
[0008] To more clearly illustrate the technical solutions and advantages 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 only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0009] Figure 1 This is a schematic diagram of the architecture of an electronic prescription review system for a smart pharmacy, provided as an embodiment of the present invention. Figure 2 This is a flowchart illustrating an electronic prescription review method for a smart pharmacy, provided as an embodiment of the present invention. Detailed Implementation
[0010] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the specific implementation methods, structures, features, and effects of the present invention will be described in detail below with reference to the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.
[0011] In all division and logarithmic operations involved in this invention, a smoothing mechanism is employed to prevent computer program crashes or invalid values from being generated due to a zero denominator or zero input. Specifically, a correction factor ε, which is a very small positive number, is superimposed on the denominator term of the division operation or the argument term of the logarithmic function, for example, a value of 10 to the power of negative 5, thereby ensuring the robustness and feasibility of the algorithm under extreme conditions.
[0012] Unless otherwise specified, the normalization function Norm() mentioned in this invention uses maximum and minimum value normalization. The maximum and minimum values are preset empirical extreme values derived from a large amount of historical experimental data. If the calculation result exceeds the [0, 1] interval, it is restricted to the [0, 1] range by a truncation function (i.e., if the result is less than 0, it is taken as 0; if it is greater than 1, it is taken as 1) to eliminate the influence of outliers on the evaluation index.
[0013] The following description, in conjunction with the accompanying drawings, details the specific scheme of the electronic prescription review method and system for smart pharmacies provided by this invention.
[0014] For example, such as Figure 1 The diagram shown is an architectural representation of an electronic prescription review system for a smart pharmacy (hereinafter referred to as the prescription review system 10) according to an embodiment of the present invention. The prescription review system 10 includes: a data acquisition module 11, a constraint identifier generation module 12, a mapping relationship construction module 13, a compliance risk assessment module 14, a transaction control module 15, and an inventory synchronization module 16. The modules are described below in sequence: (1) Data acquisition module 11.
[0015] The data acquisition module 11 is responsible for collecting and constructing the core data set required for subsequent review from the pharmacy's front-end sales terminal and back-end database at the time of transaction settlement, providing consistent and accurate input for the entire review process.
[0016] Optionally, the data acquisition module 11 is used to acquire the set of prescription-to-be-dispensed items and the set of actually scanned items corresponding to the electronic prescription to be reviewed. Specifically, this module first responds to the settlement request initiated by the sales terminal and acquires the detailed data of the electronic prescription and the actual scanned drug transaction data. Then, the data acquisition module 11 decomposes each drug record in the detailed data into a corresponding number of independent logical objects according to the prescription requirement, and these objects constitute the set of prescription-to-be-dispensed items; at the same time, based on each scanned record in the drug transaction data, it generates a single-item logical object carrying the parsed drug information, and these objects constitute the set of actually scanned items.
[0017] The data acquisition module 11 outputs the two generated sets to the constraint identifier generation module 12, which serve as the common starting point for subsequent inventory constraint analysis and matching calculation.
[0018] (2) Constraint Identifier Generation Module 12.
[0019] The constraint identifier generation module 12 is responsible for receiving the set of prescription items output by the data acquisition module 11, and combining it with the real-time inventory status to assign a differentiated compliance constraint level to each item unit in the set, thereby transforming the dynamic business inventory rules into a quantitative identifier that can be recognized by the algorithm.
[0020] Optionally, the constraint identifier generation module 12 is used to generate an inventory constraint identifier for each individual item in the prescription item set based on the real-time inventory status of the corresponding drug. This module is typically deployed on a pharmacy backend server and can access the inventory management system in real time. Specifically, this module first identifies all individual items belonging to the same drug in the prescription item set and obtains the real-time available inventory of that drug. Then, according to a preset allocation order (such as prescription list order or first-in-first-out principle), it assigns a first inventory constraint identifier to the first N individual items and a second inventory constraint identifier to the remaining number of individual items; where N is the smaller of the real-time available inventory of the drug and the prescription demand quantity. The first inventory constraint identifier indicates a mandatory requirement to match the original drug, while the second inventory constraint identifier indicates that matching a substitute drug is allowed.
[0021] The inventory constraint identifier vector output by the constraint identifier generation module 12 is one of the key bases for the subsequent compliance risk assessment module 14 to perform dynamic risk calculation.
[0022] (3) Mapping relationship construction module 13.
[0023] The mapping relationship construction module 13 is responsible for establishing the globally optimal correspondence between prescription items and actual scanned items, thereby eliminating interference from the operation sequence and restoring the true performance intention.
[0024] Optionally, the mapping relationship construction module 13 is used to determine the optimal mapping relationship between the single items in the two sets based on the differences in pharmaceutical attributes between the single items in the prescription set and the single items in the actual scanned set.
[0025] For example, the mapping relationship construction module 13 can be divided into a matrix construction submodule 131 and an optimization solution submodule 132 to complete the difference quantization and global matching respectively, which will be described below: (3.1) Matrix construction submodule 131.
[0026] Optionally, the matrix construction submodule 131 is used to construct a difference scoring matrix that characterizes the degree of difference in pharmaceutical attributes of each pair of individual units between the two sets.
[0027] Specifically, the matrix construction submodule 131 first compares the number of elements in the two sets, adding virtual placeholder units to the set with fewer elements to achieve dimension alignment. Then, the matrix construction submodule 131 calculates the differences between each unit in the prescription-prepared single-item set and each unit in the actual scanned single-item set in key pharmaceutical attributes (such as ingredients, dosage form, and manufacturer), and performs a weighted summation based on preset weighting coefficients to obtain a basic difference score; for any match involving virtual placeholder units, a preset extremely high difference value is directly assigned.
[0028] Finally, the matrix construction submodule 131 forms a square difference score matrix, which is output to the optimization solution submodule 132.
[0029] (3.2) Optimize the solution submodule 132.
[0030] Optionally, the optimization solution submodule 132 is used to solve the difference score matrix according to a preset global optimization algorithm to obtain the matching combination that minimizes the total difference score, which is the optimal mapping relationship.
[0031] Specifically, the optimization solution submodule 132 can be deployed on a server with strong computing power. The optimization solution submodule 132 receives the difference score matrix from the matrix construction submodule 131 and applies a combined optimization algorithm, such as the Kuhn-Munkres algorithm or the Hungarian algorithm, to search for the one-to-one correspondence with the minimum total difference score among all possible row-column pairings of the matrix. This correspondence is the optimal mapping relationship, which explicitly indicates which actual scanned product unit is most likely to fulfill each prescription product unit.
[0032] The optimal mapping relationship output by the mapping relationship construction module 13 is the core logical link upon which the compliance risk assessment module 14 and the subsequent inventory synchronization module 16 rely to perform their respective functions.
[0033] (4) Compliance risk assessment module 14.
[0034] The compliance risk assessment module 14 is responsible for comprehensively considering the differences in pharmaceutical substitution and the necessity of inventory constraints, and quantifying the compliance risks of each specific performance behavior.
[0035] Optionally, the compliance risk assessment module 14 is used to determine the compliance risk value of each individual item in the prescription item set based on the corresponding optimal mapping relationship and inventory constraint identifier.
[0036] Specifically, the compliance risk assessment module 14 first retrieves the basic pharmaceutical attribute difference score corresponding to each prescription unit from the difference scoring matrix based on the optimal mapping relationship provided by the mapping relationship construction module 13. Then, the compliance risk assessment module 14 reads the inventory constraint identifier generated for that unit by the constraint identifier generation module 12. If the inventory constraint identifier is the first inventory constraint identifier, the module amplifies the basic score using a preset penalty coefficient much greater than 1, resulting in a significantly increased risk value; if the inventory constraint identifier is the second inventory constraint identifier, the basic score is directly used as the risk value. Through this coupled calculation, the system achieves severe risk amplification for substitution behavior when stock is available, and objective risk assessment for reasonable substitution when stock is out of stock.
[0037] The compliance risk assessment module 14 ultimately outputs a list containing the risk values of all individual units. This list is directly transmitted to the transaction control module 15 as the sole basis for generating control instructions.
[0038] (5) Transaction control module 15.
[0039] The transaction control module 15 is responsible for automatically making tiered control decisions based on the quantified risk value and sending instructions to the sales terminal at the front end of the pharmacy to implement the review results.
[0040] Optionally, the transaction control module 15 is used to execute corresponding control instructions on the current transaction based on the compliance risk value of all individual items in the prescription item set.
[0041] Specifically, the transaction control module 15 is typically deeply integrated with the pharmacy point-of-sale (POS) system. The execution logic is as follows: First, the transaction control module 15 checks the risk value list. If any risk value exceeds a first preset threshold (e.g., a serious problem such as an incorrect ingredient), a forced interception instruction is immediately generated and executed, locking the POS machine's payment function and displaying the specific reason for the violation. Next, if all risk values do not exceed the first preset threshold, but any risk value exceeds a second preset threshold (the second preset threshold is less than the first preset threshold, and can be set to, for example, 30, typically corresponding to low-risk substitutions requiring confirmation, such as only a difference in manufacturer), a warning instruction requiring manual confirmation is executed, displaying a dialog box on the POS interface requesting secondary confirmation or authorization from the pharmacist. Finally, if all risk values do not exceed the second threshold, an automatic release instruction is executed, allowing the transaction to smoothly proceed to the payment stage.
[0042] The decision made by the transaction control module 15 directly determines whether the current prescription can be dispensed, and is the last automated checkpoint to ensure patient medication safety and pharmacy operation compliance.
[0043] (6) Inventory synchronization module 16.
[0044] The inventory synchronization module 16 is responsible for accurately synchronizing and updating the physical inventory and the pre-occupied inventory based on the optimal mapping relationship after the transaction is approved, thus completing the business loop.
[0045] Optionally, the inventory synchronization module 16 is used to synchronize and update inventory records according to the optimal mapping relationship.
[0046] Specifically, after the transaction control module 15 executes the release or confirmation instruction, the inventory synchronization module 16 is triggered. First, the inventory synchronization module 16 traverses each valid match in the optimal mapping relationship. For each match, the inventory synchronization module 16 sends an instruction to the inventory management system to deduct the physical inventory quantity of the medicine corresponding to the actually scanned item. At the same time, it releases the pre-reserved inventory quota of the original medicine corresponding to the prescription item to be dispensed in that match. Through this two-way synchronization operation, the system ensures that when a substitute dispensing occurs, the physical inventory is accurately reduced, and the inventory resources of the replaced original medicine are also released in a timely manner, avoiding the problem of long-term discrepancies between the book and the actual inventory, and providing reliable data support for accurate inventory management and replenishment planning.
[0047] The above provides an introduction to the prescription review system 10 and its included modules.
[0048] For example, such as Figure 2 The diagram shown is a flowchart illustrating an electronic prescription review method for a smart pharmacy according to an embodiment of the present invention, including the following steps: S201. Obtain the set of prescription items to be dispensed for the electronic prescription to be reviewed and the set of actual scanned items obtained from the actual scan.
[0049] For example, this step can be performed by the data acquisition module 11 in the prescription review system 10 described above, and specifically includes the following steps: (1) Obtain the set of prescription items corresponding to the electronic prescription to be reviewed.
[0050] Specifically, the data acquisition module 11 performs the following operations: First, the data acquisition module 11 responds to the settlement request initiated by the sales terminal and synchronously acquires the detailed data of the electronic prescription to be reviewed, using that moment as a unified time base. This operation ensures that the prescription data, subsequent barcode scanning data, and inventory status data are all based on a snapshot at the same moment, avoiding inconsistencies in the review logic caused by data changes in a high-concurrency environment.
[0051] Next, the data acquisition module 11 discretizes the acquired detailed data. Specifically, it decomposes each drug record in the detailed data (e.g., "Drug A × 5 boxes") into a corresponding number of independent logical objects (i.e., single-item units) according to the prescription demand quantity of that record. Each generated independent logical object fully inherits all pharmaceutical attribute information from its source drug record, such as drug ingredients, dosage form, specifications, and manufacturer, but at the algorithm processing level, they are treated as independent, smallest computational units.
[0052] Finally, all the independent logical objects generated by the above process together constitute the set of prescription items that the algorithm can process. Through this step, the system transforms the business-level aggregation of "drugs × quantity" into an algorithm-level problem of precise matching of "item unit to item unit," laying the foundation for subsequent global optimization matching.
[0053] (2) Obtain the actual scanned item set obtained from the actual scan.
[0054] Specifically, the data acquisition module 11 performs the following operations: First, in sync with prescription data acquisition, the data acquisition module 11 acquires the drug transaction data generated by the actual scanning at the sales terminal at the time the settlement request is triggered. This data records information such as the barcode of each box of medicine actually scanned by pharmacy staff during the dispensing process.
[0055] Next, the data acquisition module 11 generates a corresponding single-item logical object based on each barcode scan record in the drug transaction data. The system identifies the pharmaceutical attributes of the box of medicine (such as generic name, dosage form, and manufacturer) by parsing the barcode in the scan record and assigns these attributes to the generated single-item logical object. Each object represents a box of physical medicine that has been actually scanned and is ready to be shipped.
[0056] Finally, all the logical objects of individual items generated based on the barcode scanning records constitute the actual set of scanned individual items. This set truly reflects the details of all physical medicines in the order to be settled. The number of its elements may be equal to the set of individual items to be dispensed according to the prescription, or it may be inconsistent due to missed or multiple scans.
[0057] Therefore, the data acquisition module 11 synchronously acquires and discretizes prescription and barcode data in response to settlement requests, constructing two sets with consistent granularity (single product level), providing accurate and unified input for subsequent intelligent matching and risk quantification based on inventory constraints.
[0058] S202. Based on the real-time inventory status of the medicine corresponding to each item unit in the prescription item set, generate an inventory constraint identifier for each item unit. The inventory constraint identifier is used to distinguish whether an item unit is required to match the original medicine.
[0059] For example, this step can be performed by the constraint identifier generation module 12 in the prescription review system 10 described above. Specifically, the constraint identifier generation module 12 receives the prescription-to-be-filled item set from the data acquisition module 11 and assigns an inventory constraint identifier to each item unit. The core logic of this identifier generation lies in accurately allocating the real-time available inventory of the medicine to each item unit corresponding to the prescription demand. The constraint identifier generation module 12 first identifies all item units belonging to the same medicine in the prescription-to-be-filled item set and queries the real-time available inventory of the medicine at the time of settlement. Then, the module allocates the limited inventory quota to the preceding item units according to a preset allocation strategy (e.g., a greedy allocation strategy following the order of the prescription list). For item units allocated an inventory quota, their inventory constraint identifier is set to a state indicating "mandatory matching of the original medicine" (such as the first inventory constraint identifier); for the remaining item units that are not allocated an inventory quota, their inventory constraint identifier is set to a state indicating "allowing matching of alternative medicines" (such as the second inventory constraint identifier). It should be noted that the specific procedures for the aforementioned sub-steps are described in S301-S302 below, and will not be repeated here.
[0060] In another possible implementation, the constraint identifier generation module 12 can also adopt an allocation strategy based on the expiration date of the drug batch when generating inventory constraint identifiers for each individual product unit. That is, when the inventory is sufficient, the "forced matching original drug" identifier is assigned to individual product units with closer expiration dates to optimize inventory management, but its core is still to complete the mapping of inventory quotas to specific individual product units.
[0061] Thus, the constraint label generation module 12 labels each prescription unit with whether the original drug must be used, transforming the inventory constraints at the business level into a discretized input that can be directly used by the subsequent risk calculation model.
[0062] S203. Based on the differences in pharmaceutical attributes between the prescription set of individual items and the individual items in the actual scanned set of individual items, determine the optimal mapping relationship between each individual item in the prescription set of individual items and the individual items in the actual scanned set of individual items.
[0063] For example, this step can be performed by the mapping relationship construction module 13 in the prescription review system 10 described above. Specifically, the mapping relationship construction module 13 receives two sets of individual products and constructs a full-scale difference score matrix. This matrix quantifies the degree of difference between any prescription product and any scanned product in key pharmaceutical attributes (such as ingredients, dosage form, and manufacturer). To address the issue of inconsistencies in quantity between the two sets due to missed or overscanned scans, the module adds virtual placeholder units to the set with fewer elements and assigns extremely high difference scores to matches involving virtual units. Then, the mapping relationship construction module 13 uses a preset global optimization algorithm (such as the Kuhn-Munkres algorithm) to find the one-to-one correspondence among all possible matching combinations that minimizes the sum of the difference scores for all matching pairs. This relationship is then determined as the optimal mapping relationship. It should be noted that the specific procedures for the aforementioned sub-steps are described in S401-S402 below and will not be repeated here.
[0064] In another possible implementation, when determining the optimal mapping relationship, the mapping relationship construction module 13 may also use other optimization algorithms that can solve the minimum weight matching problem of bipartite graphs, such as the auction algorithm, whose goal is also to find the matching scheme with the minimum global difference.
[0065] Therefore, the mapping relationship construction module 13 eliminates the uncertainty interference of manual scanning order through global optimization calculation, providing a reliable guarantee for subsequent risk calculation and inventory synchronization based on accurate matching relationship.
[0066] S204. For each individual item in the set of items to be dispensed under a prescription, determine the compliance risk value for each individual item based on the corresponding optimal mapping relationship and inventory constraint identifier. The compliance risk value is used to comprehensively characterize the degree of difference in pharmaceutical attributes and the inventory constraint status corresponding to the individual item.
[0067] For example, this step can be performed by the compliance risk assessment module 14 in the prescription review system 10 described above. Specifically, the compliance risk assessment module 14, for each single item unit in the prescription item set, first obtains the basic score of the pharmaceutical attribute difference between the unit and its matching scanning unit according to the optimal mapping relationship determined in S203. Subsequently, the module reads the inventory constraint identifier generated for the single item unit in S202. Based on the different compliance strictness represented by the inventory constraint identifier, the module performs differentiated processing on the basic score: if the inventory constraint identifier is "mandatory requirement to match the original drug" (first inventory constraint identifier), the basic score is significantly amplified by multiplying it by a penalty coefficient greater than 1; if the inventory constraint identifier is "allowed to match the alternative drug" (second inventory constraint identifier), the basic score remains unchanged. The value obtained after this nonlinear coupling calculation is the compliance risk value of the single item unit. It should be noted that the specific process of the aforementioned sub-steps is described in S501-S502 below, and will not be repeated here.
[0068] In another possible implementation, when determining the compliance risk value of each product unit, the compliance risk assessment module 14 can also introduce a more complex gain function, such as dynamically adjusting the penalty coefficient according to the inventory tightness. However, the core idea is still to use the inventory constraint status as an adjustment factor to dynamically affect the final risk assessment result.
[0069] Therefore, the compliance risk assessment module 14 generates a dynamic and adaptive risk quantification indicator by combining static pharmaceutical differences with dynamic inventory constraints, which can accurately distinguish between "illegal replacement with available stock" (high risk) and "reasonable replacement due to stock shortage" (low risk), thus realizing the intelligentization of risk control standards.
[0070] S205. Based on the compliance risk value of all individual items in the prescription item set, execute the corresponding control instructions for the current transaction.
[0071] For example, this step can be performed by the transaction control module 15 in the prescription review system 10 described above, and specifically includes the following steps: (1) If the compliance risk value of any single product unit is greater than the first preset threshold, a forced interception instruction will be executed to prevent the current transaction.
[0072] Specifically, after receiving all risk values from the compliance risk assessment module 14, the transaction control module 15 first performs a high-priority check. It iterates through all risk values, and if it finds any value that exceeds a first preset threshold (this threshold is usually set to intercept serious pharmaceutical errors, such as incorrect ingredients, or any form of substitution when the original drug is available), it immediately determines it to be a high-risk transaction.
[0073] At this point, the transaction control module 15 sends an instruction to the sales terminal system to forcibly lock the payment interface and prevent the transaction settlement process from continuing. Simultaneously, a clear interception alarm pops up on the operator's screen, indicating the specific violation (e.g., "Drug ingredients do not match" or "Original drug in stock, replacement prohibited"), requiring the pharmacist to verify and correct it. This step constitutes a veto-type hard interception, ensuring the bottom line of medication safety.
[0074] (2) If the compliance risk values of all individual product units are less than or equal to the first preset threshold, and there is any individual product unit whose compliance risk value is greater than the second preset threshold, then a warning instruction requiring manual confirmation will be executed. Wherein, the second preset threshold is less than the first preset threshold.
[0075] Specifically, after passing the first level of interception check, the transaction control module 15 performs a second level of judgment. It confirms that all risk values have not reached the first preset threshold, but finds risk items that exceed the second preset threshold (this threshold usually corresponds to permissible but attention-grabbing substitutions, such as only different manufacturers or slight adjustments in dosage form).
[0076] At this point, the transaction control module 15 determines that the transaction falls under the "low-risk but requires notification" category. It suspends the current automated transaction process and displays a non-blocking alert dialog box on the terminal screen, clearly listing the specific substitution details (e.g., "Drug A, manufacturer changed from X to Y"). The transaction cannot continue until a licensed pharmacist with the appropriate permissions views the prompt and manually confirms it (e.g., by swiping a card or entering a password). This fulfills the system's obligation to provide professional information to pharmacists, returning the final judgment to professionals and balancing efficiency and safety.
[0077] (3) If the compliance risk value of all individual units is less than or equal to the second preset threshold, then execute the automatic release instruction.
[0078] Specifically, if the risk values of all individual product units do not exceed the second preset threshold, it indicates that the current dispensing behavior is fully compliant (e.g., all products are identical to the original prescription) or that a perfect substitute has been made in the event of a stock shortage (e.g., only the manufacturer is different and the risk score is very low). The transaction control module 15 then determines this as "silent approval," without causing any interactive interference to the sales terminal. It only records the review result in the backend log and allows the transaction to seamlessly proceed to the payment stage, thereby ensuring dispensing efficiency during peak periods.
[0079] For example, the first preset threshold involved in the aforementioned steps can be set to 150, and the second preset threshold can be set to 30. The rule for the above values is that they are based on a risk value calculation model composed of pharmaceutical attribute difference weights (e.g., ingredient weight 100, dosage form weight 40, manufacturer weight 10) and a penalty coefficient for substitution when in stock (e.g., λ=9). The second preset threshold (30) is higher than the risk value (10) for "only different manufacturers" to automatically allow minor differences and ensure that any dosage form or ingredient difference triggers manual confirmation; the first preset threshold (150) is set higher than the maximum risk value of common substitution combinations, aiming to forcibly block any substitution or seriously unreasonable substitution when the original drug is in stock, while being compatible with the logic that "different ingredients" and other situations when the original drug is out of stock require manual confirmation. The specific value of the threshold can be adjusted according to management strategies and historical data.
[0080] Therefore, the transaction control module 15 transforms the abstract performance compliance risk value into specific, hierarchical terminal control actions through the preset dual-threshold three-level judgment logic (interception, warning, and release), thereby realizing the automation and intelligence of the review process.
[0081] Based on the above technical solution, this invention constructs single-item-level inventory constraint identifiers, utilizes global optimization matching to eliminate operational sequence interference, and dynamically couples inventory status with pharmaceutical differences to calculate risk values. Finally, it implements tiered control based on these risk values. This solution effectively solves the problems of rigid review rules, inability to adapt to dynamic inventory, susceptibility to false alarms due to operational sequence, and asynchronous inventory management in existing technologies, significantly improving the accuracy, compliance, and operational efficiency of prescription review in smart pharmacies.
[0082] For example, in another method for reviewing electronic prescriptions in a smart pharmacy provided by an embodiment of the present invention, an inventory constraint identifier is generated for each individual item unit based on the real-time inventory status of the medicine corresponding to each individual item unit in the prescription item set. This specifically includes the following steps: S301. Determine all individual units belonging to the same drug in the prescription's set of individual items, and obtain the real-time available inventory of the same drug.
[0083] Specifically, the constraint identifier generation module 12 first needs to identify all individual units belonging to the same drug within the prescription's set of individual items. By comparing the pharmaceutical attribute information (such as the drug's unique code or generic name) carried by each individual unit, the constraint identifier generation module 12 groups units with the same identifier together. Then, for this group of drugs, the constraint identifier generation module 12 queries the pharmacy inventory management system based on the time the sales terminal initiates the settlement request to obtain the real-time available inventory of that drug at that moment (i.e., the quantity in physical inventory that is not locked by other orders and is available for sale). This inventory data forms the basis for subsequent precise quota allocation, ensuring the timeliness and accuracy of the inventory constraint status.
[0084] S302. According to the preset allocation order, assign a first inventory constraint identifier to the first N single-item units, and assign a second inventory constraint identifier to the remaining number of single-item units. Wherein, N is the smaller of the real-time available inventory of the same drug and the prescription demand quantity of the same drug; the first inventory constraint identifier indicates a mandatory requirement to match the original drug, and the second inventory constraint identifier indicates that matching a substitute drug is allowed.
[0085] Furthermore, the constraint identifier generation module 12 executes specific identifier allocation logic. First, it obtains the prescription demand quantity for the drug (i.e., the total number of single-item units of the same drug determined in S301). Then, it applies a greedy allocation strategy to determine the allocatable quantity N of the original drug, calculated as follows: Where q represents the total number of all individual units belonging to the same drug that have been identified in S301, i.e. the prescription demand for that drug. This indicates the real-time available inventory of the same drug that has been obtained in S301. This indicates that the smaller value is taken for the parameter within the parentheses.
[0086] Understandably, the above formula determines the maximum number of boxes of medicine that can be shipped using the original drug under the current inventory conditions. When inventory is sufficient, N equals the prescription demand quantity q. When inventory is insufficient, N equals the real-time available inventory. .
[0087] Following this, the constraint identifier generation module 12 sorts all individual units belonging to the drug according to a preset allocation order (e.g., following the order of drug records in the prescription list, or the order in which individual units are generated). For the first N individual units after sorting, a first inventory constraint identifier (e.g., a value of "1") is assigned to them, which means "mandatory matching of the original drug". For all remaining individual units after sorting, a second inventory constraint identifier (e.g., a value of "0") is assigned to them, which means "matching of alternative drugs is allowed".
[0088] For example, suppose a prescription is issued for "Medication A × 5 boxes", and its real-time available inventory is... =3, prescription demand quantity q=5. Based on the formula, N=3 is calculated. Therefore, constraint identifier generation module 12 assigns the first inventory constraint identifier (value 1) to the first 3 of the 5 individual product units corresponding to this drug, and assigns the second inventory constraint identifier (value 0) to the last 2.
[0089] Based on the above technical solution, this invention accurately matches real-time inventory with prescription demand and uses a greedy strategy to sequentially allocate limited inventory to specific individual product units, generating a differentiated inventory constraint identifier for each unit. This solves the logical flaw in the prior art where "partial stockouts lead to full substitution," achieving refined, product-level management of inventory constraints. It provides an accurate data foundation for subsequently intelligently distinguishing between "if in stock, the original drug must be shipped" and "if out of stock, substitution is allowed."
[0090] For example, in another embodiment of the present invention, a method for reviewing electronic prescriptions in a smart pharmacy is provided. Based on the differences in pharmaceutical attributes between the set of items to be dispensed according to the prescription and the set of items actually scanned, the optimal mapping relationship between each item in the set of items to be dispensed and each item in the set of items actually scanned is determined. This specifically includes the following steps: S401. Construct a difference scoring matrix characterizing the degree of difference in pharmaceutical attributes between each individual item in the prescription item set and each individual item in the actual scanned item set. Specifically, when the number of elements in the prescription item set differs from the number of elements in the actual scanned item set, virtual placeholder units are added to the set with fewer elements, and the difference score involving the virtual placeholder units is set to a preset extremely high difference value.
[0091] For example, this step is performed by the matrix construction submodule 131 in the mapping relationship construction module 13.
[0092] Specifically, the matrix construction sub-module 131 first determines the number of elements in the prescription dispensing item set (denoted as N) and the number of elements in the actual scanned item set (denoted as M). Then, take L = max(N, M) as the dimension for constructing the square matrix.
[0093] To handle the case where the quantities of the two sets are inconsistent (N≠M), the matrix construction sub-module 131 performs a dimension alignment operation: If N < L (i.e., more drugs are actually scanned, which may be over-scanning), then (L - N) virtual placeholder units (denoted as ) are added to the prescription dispensing item set; If M < L (i.e., fewer drugs are scanned than the prescription, which may be under-scanning), then (L - M) virtual placeholder units are added to the actual scanned item set.
[0094] After completing the alignment, the matrix construction sub-module 131 constructs a difference score matrix with L rows and L columns . For the element at the i-th row and j-th column in the matrix , its value represents the pharmaceutical property difference score between the i-th prescription item unit (which may be a real unit or ) and the j-th actual scanned item unit (which may be a real unit or ). Its calculation rule is as follows: Where, represents a preset extremely high difference value, for example, it can be set to 1000. This value is much larger than the difference scores between any actual drugs and is used to represent serious errors such as missing or over-dispensing drugs; represents the i-th unit in the prescription dispensing item set; represents the j-th unit in the actual scanned item set; represents the virtual placeholder unit; K represents the total number of pharmaceutical property dimensions considered, usually 3, that is, covering ingredients, dosage forms, and manufacturers; represents the element in the pharmaceutical property weight coefficient vector W , corresponding to the three dimensions of drug ingredients, dosage forms, and manufacturers respectively. For example, an exemplary configuration is: = 100, = 40, = 10; , respectively represent the values of the prescription unit i and the scanned unit j on the k-th pharmaceutical property; is an indicator function, which takes the value of 1 when the condition in the parentheses is true (i.e., the properties are different), otherwise 0.
[0095] It should be noted that the above calculation rule is divided into two cases: In the first case, as long as either of the matching parties is a virtual placeholder unit ( ), the extremely high difference value is directly assigned This indicates missed or excessive scanning. In the second case, when both matching parties are actual drug units, the process iterates through and sums K (e.g., 3) key pharmaceutical attributes (k ranges from 1 to K). For each attribute k, it determines whether the two units differ on that attribute: if they differ, the indicator function result is 1, multiplied by the corresponding weight coefficient. If they are the same, then the score for that item is 0. Finally, the results of all K attributes are summed to obtain the total difference score. For example, if two units differ only in manufacturer, then... =10; if the ingredients and dosage form are different, then =140. The smaller this value, the closer the pharmaceutical properties of the two units are.
[0096] S402. Solve the difference score matrix according to the preset global optimization algorithm to obtain the matching combination that minimizes the total difference score, which is the optimal mapping relationship.
[0097] For example, this step is performed by the optimization solution submodule 132 in the mapping relationship construction module 13.
[0098] Specifically, the optimization solution submodule 132 receives the L×L difference score matrix constructed by the matrix construction submodule 131. The optimization submodule 132 applies a preset global optimization algorithm to solve the matrix. Its goal is to find a one-to-one matching method (i.e., a permutation) between the prescription unit set and the actual scanning unit set. This minimizes the sum of the difference scores corresponding to all matched pairs. Mathematically, this is expressed as finding a mapping. This makes the following expression reach its minimum value: in, =j, indicating that the i-th unit on the prescription side is matched with the j-th unit on the actual scanning side. It can be understood that, based on the above formula, the optimization solution submodule 132 models this problem as a bipartite graph minimum weight perfect matching problem. The L units on the prescription side and the L units on the scanning side constitute two vertex sets of the bipartite graph, and the matrix... elements in This represents the weight of the edge connecting vertices i and j. The optimization submodule 132 uses a specialized combinatorial optimization algorithm to solve this problem precisely. A typical and efficient specific algorithm is the Hungarian algorithm (Kuhn-Munkres algorithm). This algorithm initializes vertex labels, searches for row and column elements in the difference score matrix that equal the sum of the current vertex labels (equivalent to finding zero elements), attempts to construct augmenting paths using these elements to increase matching, and iteratively adjusts vertex labels and repeats the search for augmenting paths if a perfect match is not achieved. Ultimately, it finds the perfect matching scheme with the minimum total difference score in polynomial time.
[0099] The output of the algorithm is the optimal mapping relationship. This relationship explicitly specifies which actual scanned item (or virtual item) should "fulfill" each prescription item (or supplementary virtual item). For example, the result might show that prescription item 1 matches the item scanned in item 3, while prescription item 2 matches the item scanned in item 1, automatically correcting misalignments caused by inconsistent scanning order.
[0100] Based on the above technical solution, this embodiment of the invention constructs a full-scale difference scoring matrix including virtual placeholder nodes, incorporating scenarios of quantity mismatch into a unified calculation framework, and applying global optimization algorithms such as the Hungarian algorithm to intelligently find the drug matching combination with the minimum total difference. This effectively solves the misjudgment problem that inevitably occurs in traditional "linear comparison" scenarios such as disordered scanning, missed scanning, and multiple scanning. The system can automatically restore the pharmacist's most likely true intention to fulfill the contract, thereby greatly improving the accuracy and robustness of prescription review.
[0101] For example, in another method for reviewing electronic prescriptions in a smart pharmacy provided by an embodiment of the present invention, for each item unit in the set of items to be dispensed under a prescription, the fulfillment compliance risk value of the item unit is determined according to the optimal mapping relationship corresponding to the item unit and the inventory constraint identifier of the item unit. Specifically, this includes the following steps: S501. Obtain the basic score of pharmaceutical attribute differences for each product unit based on the optimal mapping relationship.
[0102] In this step, the compliance risk assessment module 14 performs a basic score acquisition operation for each individual item in the prescription item set. Specifically, this module first reads the optimal mapping relationship calculated and output by the mapping relationship construction module 13 in step S402. Based on this mapping relationship, determine the index j of the actual scanned item unit corresponding to the prescription item unit i to be evaluated, i.e., j = .
[0103] Subsequently, the compliance risk assessment module 14 accesses the difference scoring matrix constructed and stored by the matrix construction submodule 131 in step S401. Query and retrieve the element value in the i-th row and j-th column of the matrix. This value is the basic score of pharmaceutical attribute differences corresponding to the current prescription unit i based on the optimal mapping relationship. It quantifies the degree of objective differences between the matched two parties (prescription drug and physical drug) in core attributes such as ingredients, dosage form, and manufacturer.
[0104] S502. When the inventory constraint identifier of a single product unit is the first inventory constraint identifier, the basic score of pharmaceutical attribute difference is amplified according to the preset penalty coefficient to obtain the performance compliance risk value.
[0105] For example, after obtaining the basic score, the compliance risk assessment module 14 needs to perform risk calculations based on the inventory constraint status of the individual product unit. First, the module reads the inventory constraint identifier generated by the constraint identifier generation module 12 for the individual product unit in step S302. When the identifier is determined to be the first inventory constraint identifier (e.g., an identifier value of "1"), it indicates that the original drug inventory corresponding to this unit is sufficient, and the system requires the use of the original drug for fulfillment. At this time, the module will apply a preset nonlinear gain calculation model to amplify the basic score, significantly increasing the risk value of any alternative behavior. For example, the calculation formula is as follows: in, This represents the compliance risk value of the i-th prescription item unit; This represents the basic score of pharmaceutical attribute differences for this single product unit obtained in S501; This represents the preset penalty coefficient for in-stock violations, which is a constant greater than zero. For example, it can be set to... =9, This is the overall magnification factor.
[0106] It should be noted that the core of the above formula lies in the fact that when the raw material is in stock (the first inventory constraint indicator), a penalty coefficient is applied. The baseline difference score is amplified by multiplication. The larger the value, the stronger the amplification effect, and the lower the system's tolerance for "substitution with available goods" behavior. For example, if =9, then any minor substitution (such as only a different manufacturer, with a base score of 10) will have its risk value increased to 100 after calculation, making it much more likely to trigger interception in subsequent steps.
[0107] S503. When the inventory constraint identifier of a single product unit is the second inventory constraint identifier, the pharmaceutical attribute difference basic score shall be used as the performance compliance risk value.
[0108] For example, after reading the inventory constraint identifier, if the compliance risk assessment module 14 determines that the identifier is a second inventory constraint identifier (e.g., the identifier value is "0"), it indicates that this unit belongs to the "objective shortage" category, allowing substitution under the principle of pharmaceutical equivalence. In this scenario, the module will disable the penalty mechanism and directly use the original pharmaceutical attribute difference base score as the final performance compliance risk value. For example, its calculation formula is expressed as follows: Understandably, the above calculation logic indicates that when a drug is objectively out of stock, the system assesses risk solely based on the objective pharmaceutical attribute differences between matching drugs. If the pharmacist makes a reasonable substitution (e.g., only the manufacturer is different, resulting in a low base score), the risk value is also low, allowing passage; however, if an unreasonable substitution is used (e.g., different ingredients, resulting in an extremely high base score), the risk value will still be high, triggering interception. This achieves automatic exemption for necessary substitutions when out of stock, while retaining a baseline protection against serious pharmaceutical errors.
[0109] Based on the above technical solution, this invention constructs a nonlinear risk calculation model by dynamically coupling inventory constraint status with pharmaceutical attribute differences. This model uses inventory constraint identifiers as "switches" and "gain factors" to intelligently distinguish and quantify high-risk behaviors such as "illegal replacement when in stock" and low-risk behaviors such as "reasonable replacement when out of stock." This upgrades static drug difference comparison to a dynamic compliance risk assessment that adaptively adjusts according to inventory status, providing a core decision-making basis for subsequent precise automated hierarchical management.
[0110] For example, in another method for reviewing electronic prescriptions in a smart pharmacy provided by an embodiment of the present invention, after executing the corresponding control instruction for the current transaction based on the compliance risk value of all individual items in the prescription's set of dispensed items, the method further includes the following steps: S601. Based on the optimal mapping relationship, synchronize and update the inventory records. The synchronization update includes: deducting the physical inventory corresponding to the actually issued drugs in the actual scanned item set, and releasing the inventory quota of the original prescription drugs in the prescription-to-fill item set that was reserved.
[0111] Specifically, when the transaction control module 15 issues a "release" or "confirmation passed" command, the inventory synchronization module 16 is triggered and begins execution. This module receives and iterates through the optimal mapping relationship determined by the mapping relationship construction module 13. For each valid, non-virtual matching pair in the mapping relationship ( , The inventory synchronization module 16 executes the following two core processing operations in parallel to achieve bidirectional inventory synchronization: (1) Deduction of physical inventory (for ): Inventory synchronization module 16 first scans the individual product units. The module extracts the unique identifier of the actual drug issued from the information it carries (such as a drug ID or barcode). Then, it sends an atomic update command to the pharmacy's inventory management database: decrementing the value of the "Current Inventory" field corresponding to the actual drug ID by 1.
[0112] This operation ensures that the quantity of medicines recorded by the system is strictly consistent with the physical reduction of medicines in the pharmacy warehouse, reflecting the actual consumption of goods.
[0113] (2) Pre-release of active ingredient (for) ): At the same time, the inventory synchronization module 16 retrieves prescription-prepared individual items from the inventory synchronization unit. The module extracts the unique identifier of the original prescription drug. Next, it queries the inventory database to check if there is any "reserved" or "locked" inventory quota for that original prescription drug ID under the current order. If such a reservation record exists, the module simultaneously sends another update instruction: decrementing the "reserved inventory" corresponding to the original prescription drug ID by 1 (or directly canceling the reservation record), and restoring this quota to the "available inventory" state.
[0114] This operation addresses the logical flaw in traditional systems that only deducts the physical medication without releasing the pre-reserved amount when dispensing alternative medications. For example, a prescription orders 5 boxes of medication A (5 boxes pre-reserved), but 3 boxes of medication A and 2 boxes of medication B are actually dispensed. If the pre-reserved amount of the 2 boxes of medication A is not released, the system will incorrectly assume that 2 boxes of medication A are still occupied by this order, affecting the availability of other orders. Through this operation, the pre-reserved amount of these 2 boxes of medication A is released and made available for other prescriptions.
[0115] It should be noted that during the aforementioned bidirectional operation, the inventory synchronization module 16 will compare... and The module will add a structured "Drug Substitution Record" to the system's prescription fulfillment log if the two do not match (indicating a substitution of medication). This record must include at least the following information: the original prescription drug ID, the actual drug ID dispensed, the time of this dispensing, and the associated prescription number. This record provides complete traceability for subsequent pharmaceutical management, compliance audits, and data analysis.
[0116] Based on the above technical solution, this invention fundamentally solves the long-term inventory discrepancy problem caused by one-way deductions by simultaneously updating inventory through "deducting physical inventory" and "releasing pre-reserved inventory" after performing alternative dispensing. This method ensures that in any dispensing scenario, the system's inventory data (including available and pre-reserved quantities) accurately reflects the actual business situation, providing a reliable data foundation for pharmacies' refined inventory management, automatic replenishment calculation, and financial accounting.
[0117] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0118] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
Claims
1. A method for reviewing electronic prescriptions in a smart pharmacy, characterized in that, The method includes: Obtain the set of prescription items to be dispensed for the electronic prescription to be reviewed and the set of actual scanned items obtained from the actual scan. Based on the real-time inventory status of the medicine corresponding to each individual item in the prescription item set, an inventory constraint identifier is generated for each individual item; wherein, the inventory constraint identifier is used to distinguish whether the individual item is required to match the original medicine. Based on the differences in pharmaceutical properties between the set of individual items to be dispensed in the prescription and the individual items in the actual scanned set of individual items, determine the optimal mapping relationship between each individual item in the set of individual items to be dispensed in the prescription and the individual items in the actual scanned set of individual items; For each product unit in the set of products to be dispensed in the prescription, the compliance risk value of each product unit is determined according to the corresponding optimal mapping relationship and the inventory constraint identifier; wherein, the compliance risk value is used to comprehensively characterize the degree of difference in pharmaceutical attributes and the inventory constraint status corresponding to the product unit; Based on the compliance risk value of all individual items in the prescription's set of individual items, execute the corresponding control instructions for the current transaction.
2. The method for reviewing electronic prescriptions in a smart pharmacy according to claim 1, characterized in that, Based on the real-time inventory status of the medicine corresponding to each individual item in the prescription item set, an inventory constraint identifier is generated for each individual item, specifically including: Identify all individual units belonging to the same drug in the set of individual items to be dispensed in the prescription, and obtain the real-time available inventory of the same drug; According to the preset allocation order, a first inventory constraint identifier is assigned to the first N single-item units, and a second inventory constraint identifier is assigned to the remaining number of single-item units; wherein, N is the smaller value between the real-time available inventory of the same drug and the prescription demand quantity of the same drug, the first inventory constraint identifier indicates that matching the original drug is mandatory, and the second inventory constraint identifier indicates that matching the alternative drug is allowed.
3. The method for reviewing electronic prescriptions in a smart pharmacy according to claim 1, characterized in that, Based on the differences in pharmaceutical properties between the set of individual items to be dispensed in the prescription and the individual items in the actual scanned set, the optimal mapping relationship between each individual item in the set of individual items to be dispensed in the prescription and the individual items in the actual scanned set is determined, specifically including: Construct a difference scoring matrix that characterizes the degree of difference in pharmaceutical attributes between each individual item in the prescription item set and each individual item in the actual scanned item set; wherein, when the number of elements in the prescription item set is inconsistent with the number of elements in the actual scanned item set, virtual placeholder units are added to the set with fewer elements, and the difference score involving the virtual placeholder units is set to a preset extremely high difference value; The difference score matrix is solved by a preset global optimization algorithm to obtain the matching combination that minimizes the total difference score, which is the optimal mapping relationship.
4. The method for reviewing electronic prescriptions in a smart pharmacy according to claim 1, characterized in that, For each item unit in the set of items to be dispensed under the prescription, the fulfillment compliance risk value of the item unit is determined based on the optimal mapping relationship corresponding to the item unit and the inventory constraint identifier of the item unit, specifically including: Obtain the basic score of pharmaceutical attribute differences corresponding to the single product unit based on the optimal mapping relationship; When the inventory constraint identifier of the single product unit is the first inventory constraint identifier, the basic score of the pharmaceutical attribute difference is amplified according to the preset penalty coefficient to obtain the performance compliance risk value. When the inventory constraint identifier of the single product unit is the second inventory constraint identifier, the pharmaceutical attribute difference basic score is used as the performance compliance risk value.
5. The method for reviewing electronic prescriptions in a smart pharmacy according to claim 1, characterized in that, Based on the compliance risk values of all individual items in the prescription's set of required items, execute corresponding control instructions for the current transaction, specifically including: If the compliance risk value of any of the individual product units exceeds the first preset threshold, a forced interception instruction will be executed to prevent the current transaction. If the compliance risk values of all individual product units are less than or equal to the first preset threshold, and there is any individual product unit whose compliance risk value is greater than the second preset threshold, then a warning instruction requiring manual confirmation will be executed; wherein, the second preset threshold is less than the first preset threshold. If the compliance risk value of all individual product units is less than or equal to the second preset threshold, then an automatic release instruction is executed.
6. The method for reviewing electronic prescriptions in a smart pharmacy according to claim 5, characterized in that, After executing the corresponding control instructions for the current transaction based on the compliance risk values of all individual items in the prescription's set of required items, the process further includes: Based on the optimal mapping relationship, the inventory records are updated synchronously; wherein, the synchronous update includes: deducting the physical inventory corresponding to the actually issued drugs in the actual scanned item set, and releasing the inventory quota of the original prescription drugs in the prescription-to-fill item set that was reserved.
7. The method for reviewing electronic prescriptions in a smart pharmacy according to claim 3, characterized in that, The types of preset global optimization algorithms include the Hungarian algorithm.
8. The method for reviewing electronic prescriptions in a smart pharmacy according to any one of claims 1-7, characterized in that, Obtain the set of prescription items that should be dispensed for the electronic prescription to be reviewed, specifically including: In response to a settlement request initiated by the sales terminal, obtain the detailed data of the electronic prescription to be reviewed; Each drug record in the detailed data is decomposed into a corresponding number of independent logical objects according to the prescription requirements of the drug record; wherein, each independent logical object inherits the pharmaceutical attribute information of the drug record from which it originates, and all the independent logical objects constitute the set of single items to be dispensed under the prescription.
9. The method for reviewing electronic prescriptions in a smart pharmacy according to any one of claims 1-7, characterized in that, Obtain the actual scanned item set, specifically including: In response to a settlement request initiated by the sales terminal, obtain the actual scanned drug transaction data; For each barcode scan record in the drug transaction data, a corresponding single-item logical object is generated; wherein, each single-item logical object carries the pharmaceutical attribute information of the drug parsed from the corresponding barcode scan record, and all the single-item logical objects constitute the actual scanned single-item set.
10. An electronic prescription verification system for a smart pharmacy, characterized in that, The system includes: a data acquisition module, a constraint identifier generation module, a mapping relationship construction module, a compliance risk assessment module, and a transaction control module; The data acquisition module is used to acquire the set of prescription items to be dispensed for the electronic prescription to be reviewed and the set of actual scanned items obtained from the actual scan. The constraint identifier generation module is used to generate an inventory constraint identifier for each item unit based on the real-time inventory status of the medicine corresponding to each item unit in the prescription item set; wherein, the inventory constraint identifier is used to distinguish whether the item unit is required to match the original medicine. The mapping relationship construction module is used to determine the optimal mapping relationship between each unit in the prescription set and each unit in the actual scanned set based on the differences in pharmaceutical attributes between the prescription set of individual items and the individual items in the actual scanned set. The compliance risk assessment module is used to determine the compliance risk value of each product unit in the prescription product set, based on the corresponding optimal mapping relationship and the inventory constraint identifier; wherein, the compliance risk value is used to comprehensively characterize the degree of difference in pharmaceutical attributes and the inventory constraint status corresponding to the product unit. The transaction control module is used to execute corresponding control instructions on the current transaction based on the compliance risk value of all individual items in the prescription item set.