Cartridge drug dispensing method, device, electronic device, and storage medium
By setting up M rows and N columns of medicine storage compartments and a conveyor belt in the medicine cabinet, boxed medicines are dispensed in order of column number, which solves the problem of slow dispensing speed caused by obstruction of boxed medicines. This achieves a fast and unobstructed dispensing method and can effectively trace medicine information.
Patent Information
- Application Number
- CN202510728539.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-03
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2045-06-03
AI Technical Summary
In hospital pharmacies, boxed medications tend to block each other during dispensing, resulting in slow dispensing speed. Existing technology makes it difficult to achieve a fast and unobstructed dispensing method.
A method for dispensing boxed medicines is adopted, which involves setting up M rows and N columns of storage cells in a medicine cabinet, using a conveyor belt to move from right to left, sorting the storage cells in ascending order of column number, and controlling the storage cells to dispense boxed medicines. This ensures that the column number difference between adjacent medicines meets a preset threshold condition to avoid obstruction, while acquiring and storing photos of six sides of the boxed medicine and traceability codes.
It enables rapid dispensing of boxed medicines without obstruction, improving dispensing speed and effectively facilitating the traceability of drug information.
Smart Images

Figure CN120646435B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method, apparatus, electronic device, and storage medium for dispensing boxed medicines. Background Technology
[0002] On April 28, 2016, the State Food and Drug Administration issued the "Opinions on Further Improving the Food and Drug Traceability System (Draft for Solicitation of Comments)". The Opinions pointed out that the food and drug traceability system is an important component of the food and drug quality management system. Establishing a food and drug traceability system is the primary responsibility of enterprises.
[0003] In hospital pharmacies, drug traceability is essential. The basic principle is the use of drug traceability codes, which utilize modern information technology to assign a unique identifier (traceability code) to each box of medicine. This code typically contains basic drug information and encrypted data. During drug production, relevant drug information, such as raw material sources and production process parameters, is linked to the traceability code and recorded in a database. After the drug enters the distribution chain, at each node, such as wholesalers and retailers, relevant distribution information (such as entry and exit times, handling companies, etc.) is collected by scanning the code and uploaded to the database, forming a complete traceability chain. When a query is needed, consumers or regulatory personnel read the traceability code using a scanning device, and the system retrieves and displays the corresponding full lifecycle data of the drug from the database based on the information in the code. Boxed medicines are a common type of medicine, and in practice, QR codes or barcodes are usually printed on the outer surface of the medicine box. These QR codes or barcodes store the traceability code. In addition, pharmacies also need to take photos of all the outer surfaces of the medicine boxes.
[0004] When dispensing boxed medications from a hospital pharmacy, different boxes of medications must not obstruct each other, which understandably slows down the dispensing process. Therefore, designing a dispensing method that prevents boxed medications from obstructing each other while maintaining a fast dispensing speed has become an urgent problem to solve. Summary of the Invention
[0005] The purpose of this invention is to provide a method, apparatus, electronic device and storage medium for dispensing boxed medicines.
[0006] To achieve one of the above-mentioned invention purposes, an embodiment of the present invention provides a method for dispensing boxed medicines in a medicine storage cabinet. The medicine storage cabinet includes: a cabinet body, on which there are M rows and N columns of medicine storage cells for storing the same type of boxed medicines, where the rows extend along the left-right direction and the columns extend along the vertical direction; in the direction from left to right, the N columns are respectively marked as the 1st column, the 2nd column,..., the Nth column; in the direction from bottom to top, the M rows are respectively marked as the 1st row, the 2nd row,..., the Mth row; a conveyor belt is provided in front of the cabinet body, and the conveyor belt extends from the 1st column to the Nth column, and any boxed medicine stored in the medicine storage cell can fall onto the conveyor belt; where M and N are both natural numbers; the method includes the following steps: receiving a medicine dispensing message, the medicine dispensing message including: multiple boxed medicine types and the corresponding medicine taking quantities for each boxed medicine type; obtaining the medicine storage cells corresponding to each boxed medicine type, as well as the row numbers and column numbers of each medicine storage cell, and generating a set S that includes all the medicine storage cells corresponding to the boxed medicine types; controlling the conveyor belt to rotate, and the upper surface of the conveyor belt moves from right to left; sorting all the medicine storage cells in the set S in ascending order of the column numbers to obtain a first queue; selecting several first to-be-processed medicine storage cells from the first queue, the several first to-be-processed medicine storage cells including the medicine storage cell at the head of the first queue, and the absolute value of the difference in column numbers between any adjacent first to-be-processed medicine storage cell A and first to-be-processed medicine storage cell B > a preset threshold + (the row number of the first to-be-processed medicine storage cell A - the row number of the first to-be-processed medicine storage cell B) Num>0, where the column number of the first to-be-processed medicine storage cell A > the column number of the first to-be-processed medicine storage cell B, -1<Num≤0, and the preset threshold>0; controlling each first to-be-processed medicine storage cell to send out a boxed medicine, and after that, for all the medicine storage cells that have sent out boxed medicines, the value of the medicine taking quantity corresponding to the boxed medicine type is decreased by one; deleting the boxed medicine types with zero medicine taking quantity from the medicine dispensing message, and deleting the medicine storage cells with zero medicine taking quantity from the set S.
[0007] As a further improvement of an embodiment of the present invention, in the left-to-right direction, the cabinet body is divided into the 1st unit, the 2nd unit,..., the Qth unit, and each unit includes P columns; where Q and P are both natural numbers, and N = Q P; the method further includes the following steps: generating a corresponding empty set for any 1st unit , obtaining the corresponding jth unit for any medicine storage cell in the set S and putting it into the set ; where i, j are natural numbers, 1≤i,j≤Q; let K = Q, and continuously execute the following first operation until K = 1, and when one first operation is completed, the value of K is decreased by 1; the first operation is to continuously execute the following actions until the set Empty: When there are no medicine boxes on the portion of the conveyor belt located in unit K, the set is sorted in ascending order of column number. All drug storage cells are sorted to obtain a second queue; several second drug storage cells to be processed are selected from the second queue, and these several second drug storage cells to be processed include the drug storage cell located at the head of the second queue, and the absolute value of the difference between the column numbers of any adjacent second drug storage cell C and second drug storage cell D is greater than a preset threshold + (the row number corresponding to the second drug storage cell C - the row number of the second drug storage cell D). Num>0, where the column number corresponding to the second drug storage cell C is greater than the column number of the second drug storage cell D; control each second drug storage cell to dispense one boxed medicine, and then, for all drug storage cells that dispensed boxed medicine, decrement the quantity value of the corresponding boxed medicine type by one; delete the boxed medicine type with a quantity of zero from the dispensing information, and remove it from the set. Delete the medicine storage compartment where the number of medicines dispensed is zero.
[0008] As a further improvement of one embodiment of the present invention, the method further includes the following steps: for each box of medicine sent out by the conveyor belt, photos and traceability codes of six sides are obtained and stored in the HIS system.
[0009] As a further improvement of one embodiment of the present invention, the step of "selecting a plurality of first drug storage cells to be processed from the first queue, the plurality of first drug storage cells to be processed including the drug storage cell located at the head of the first queue, and the absolute value of the difference between the column numbers of any adjacent first drug storage cell A and first drug storage cell B to be processed is greater than a preset threshold + (the row number corresponding to the first drug storage cell A - the row number of the first drug storage cell B to be processed)" is 100%. "Num>0" specifically includes: selecting the storage cell at the head of the first queue as a first storage cell to be processed, marking the storage cell at the head of the first queue as the starting storage cell, and continuously performing the following first operation: if the successful selection satisfies "the difference between the column number and the column number of the starting storage cell > a preset threshold + the difference between the row number and the row number of the starting storage cell", then the following operation is performed: When Num>0 and the smallest column number is found in cell E, cell E is designated as a first cell to be processed. Cell E is marked as the starting cell, and the subsequent first operation continues. Otherwise, the subsequent first operation is not performed. The phrase "selecting several second cells to be processed from the second queue, including the cell at the head of the second queue, and the absolute value of the difference between the column numbers of any adjacent second cell C and second cell D > a preset threshold + (row number corresponding to second cell C - row number of second cell D)" is used. "Num > 0" specifically includes: selecting the storage cell at the head of the second queue as a second to-be-processed storage cell, marking the storage cell at the head of the second queue as the starting storage cell, and continuously performing the following second operation: if a successfully selected storage cell satisfies "the difference in column numbers between the column number and the starting storage cell > preset threshold + the difference in row numbers between the row number and the starting storage cell When the storage cell F with "Num > 0" and the smallest column number is selected, the storage cell F is a second to-be-processed storage cell, marking the storage cell F as the starting storage cell, and continuing to perform the subsequent second operation; otherwise, no subsequent second operation is performed.
[0010] An embodiment of the present invention further provides a dispensing device for boxed medicines in a medicine storage cabinet. The medicine storage cabinet includes: a cabinet body, on which there are M rows and N columns of storage cells, each storage cell is used to store the same type of boxed medicine, and the rows extend along the left-right direction, and the columns extend along the vertical direction; in the left-to-right direction, the N columns are respectively marked as the 1st column, the 2nd column,..., the Nth column; in the bottom-to-top direction, the M rows are respectively marked as the 1st row, the 2nd row,..., the Mth row; in front of the cabinet body, there is a conveyor belt that extends from the 1st column to the Nth column, and the boxed medicine stored in any storage cell can fall onto the conveyor belt; where M and N are both natural numbers; it includes the following modules: an information acquisition module, which is used to receive the medicine dispensing information, and the medicine dispensing information includes: multiple boxed medicine types and the corresponding medicine taking quantities for each boxed medicine type; obtaining the storage cell corresponding to each boxed medicine type, as well as the row number and column number of each storage cell, and generating a set S that includes all the storage cells corresponding to the boxed medicine types; controlling the conveyor belt to rotate, and the upper surface of the conveyor belt moves from right to left; a first medicine dispensing module, which is used to sort all the storage cells in the set S in ascending order of column numbers to obtain a first queue; selecting several first to-be-processed storage cells from the first queue, and the several first to-be-processed storage cells include the storage cell at the head of the first queue, and the absolute value of the difference in column numbers between any two adjacent first to-be-processed storage cells A and first to-be-processed storage cell B > preset threshold + (the row number corresponding to the first to-be-processed storage cell A - the row number of the first to-be-processed storage cell B) Num > 0, where the column number corresponding to the first to-be-processed storage cell A > the column number of the first to-be-processed storage cell B, -1 < Num ≤ 0, and the preset threshold > 0; controlling each first to-be-processed storage cell to send out a boxed medicine, and then, for all the storage cells that have sent out boxed medicines, subtracting 1 from the medicine taking quantity value of the corresponding boxed medicine type; deleting the boxed medicine types with zero medicine taking quantity from the medicine dispensing information, and deleting the storage cells with zero medicine taking quantity from the set S.
[0011] As a further improvement to one embodiment of the present invention, the cabinet is divided into Unit 1, Unit 2, ..., Unit Q from left to right, and each unit contains P columns; wherein Q and P are both natural numbers, and N=Q. P; also includes the following module: a second drug dispensing module, used to generate a corresponding empty set for any i-th unit. For any drug storage cell in set S, obtain the corresponding j-th cell and put it into set S. Where i and j are natural numbers, 1 ≤ i, j ≤ Q; let K = Q, and continue to perform the following first operation until K = 1, and after each execution of the first operation, the value of K is decreased by 1; the first operation is to continue to perform the following actions until the set Empty: When there are no medicine boxes on the portion of the conveyor belt located in unit K, the set is sorted in ascending order of column number. All drug storage cells are sorted to obtain a second queue; several second drug storage cells to be processed are selected from the second queue, and these several second drug storage cells to be processed include the drug storage cell located at the head of the second queue, and the absolute value of the difference between the column numbers of any adjacent second drug storage cell C and second drug storage cell D is greater than a preset threshold + (the row number corresponding to the second drug storage cell C - the row number of the second drug storage cell D). Num>0, where the column number corresponding to the second drug storage cell C is greater than the column number of the second drug storage cell D; control each second drug storage cell to dispense one boxed medicine, and then, for all drug storage cells that dispensed boxed medicine, decrement the quantity value of the corresponding boxed medicine type by one; delete the boxed medicine type with a quantity of zero from the dispensing information, and remove it from the set. Delete the medicine storage compartment where the number of medicines dispensed is zero.
[0012] As a further improvement of one embodiment of the present invention, the following module is also included: a traceability module, used to acquire photos and traceability codes of six sides of each boxed medicine sent out by the conveyor belt, and store them in the HIS system.
[0013] As a further improvement of one embodiment of the present invention, the first dispensing module is further configured to: select the storage cell at the head of the first queue as a first storage cell to be processed, mark the storage cell at the head of the first queue as the starting storage cell, and continuously perform the following first operation: if the successful selection satisfies "the difference between the column number and the column number of the starting storage cell > a preset threshold + the difference between the row number and the row number of the starting storage cell", When Num>0 and the smallest column number is found in cell E, cell E is designated as the first cell to be processed. Cell E is marked as the starting cell, and the subsequent first operation continues. Otherwise, the subsequent first operation is not performed. The cell at the head of the second queue is selected as the second cell to be processed, and the cell at the head of the second queue is marked as the starting cell. The following second operation continues: If the successful selection satisfies the condition that "the difference between the column number and the starting cell's column number is greater than a preset threshold + the difference between the row number and the starting cell's row number", the following second operation continues: If Num>0 and the smallest column number is the drug storage cell F, then drug storage cell F is a second drug storage cell to be processed. Drug storage cell F is marked as the starting drug storage cell, and the subsequent second operation is continued; otherwise, the subsequent second operation is not executed.
[0014] This invention also provides an electronic device, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the boxed drug dispensing method described above.
[0015] This invention also provides a storage medium storing a program or instructions, which, when executed by a processor, implement the steps of the boxed drug dispensing method described above.
[0016] Compared to existing technologies, the technical advantages of this invention are as follows: This invention provides a method, apparatus, electronic device, and storage medium for dispensing boxed medications. The method for dispensing boxed medications includes the following steps: receiving medication dispensing information, generating a set containing all medication storage cells, and continuously performing the following operations until the set is empty: sorting all medication storage cells in ascending order of column number to obtain a queue; selecting several unprocessed medication storage cells from the queue that contain a matching medication storage cell, wherein the absolute value of the difference in column number between adjacent unprocessed medication storage cells is greater than a preset threshold plus (the difference in row number between adjacent unprocessed medication storage cells). If Num > 0, control each available storage compartment to dispense one boxed medication. Then, decrement the medication quantity from the dispensed compartment by one. Remove boxed medication types with zero dispensing quantity from the medication information and remove storage compartments with zero dispensing quantity from the set. This boxed medication dispensing method ensures that boxed medications do not obstruct each other and has a fast dispensing speed. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of the structure of the medicine storage cabinet in an embodiment of the present invention;
[0018] Figure 2 This is a flowchart illustrating the method for dispensing boxed medicines in an embodiment of the present invention. Detailed Implementation
[0019] The present invention will now be described in detail with reference to the embodiments shown in the accompanying drawings. However, these embodiments do not limit the present invention, and any structural, methodological, or functional modifications made by those skilled in the art based on these embodiments are included within the scope of protection of the present invention.
[0020] The terms used herein, such as “above,” “over,” “below,” and “under,” indicating spatial relative position, are for illustrative purposes to describe the relationship of one unit or feature relative to another unit or feature as shown in the accompanying drawings. These terms may be intended to include different orientations of the device in use or operation other than those shown in the figures. For example, if the device in the figures is flipped, a unit described as being “below” or “under” another unit or feature would be “above” that unit or feature. Therefore, the exemplary term “below” can encompass both above and below orientations. The device may be oriented in other ways (rotated 90 degrees or otherwise), and the spatially related descriptive terms used herein will be interpreted accordingly.
[0021] Embodiment 1 of the present invention provides a method for dispensing boxed medicines for a medicine storage cabinet, such as... Figure 1 As shown; the medicine storage cabinet includes: a cabinet body with M rows and N columns of medicine storage compartments, each compartment storing boxed medicines of the same type, with rows extending horizontally and columns extending vertically; from left to right, the N columns are labeled as column 1, column 2, ..., column N; from bottom to top, the M rows are labeled as row 1, row 2, ..., row M; a conveyor belt is installed in front of the cabinet body, extending from column 1 to column N, allowing any boxed medicine stored in any compartment to fall onto the conveyor belt; where M and N are natural numbers; vertically, the height of the conveyor belt is lower than the lowest row, and the horizontal distance between it and the cabinet body is sufficiently close, ensuring that any boxed medicine dispensed from any compartment falls onto and is transported by the conveyor belt. Each compartment can store multiple boxed medicines of the same type, and a mechanical device is provided to eject the boxed medicines from it. Figure 2 As shown, it includes the following steps: Step 201: Receive medication dispensing information, which includes: multiple types of boxed medications and the quantity of medication to be dispensed for each type of boxed medication; obtain the storage cell corresponding to each type of boxed medication, as well as the row number and column number of each storage cell, and generate a set S containing all storage cells corresponding to all types of boxed medications; control the conveyor belt to rotate, and the upper surface of the conveyor belt moves from right to left; here, the medication dispensing information can be received from the HIS (Hospital Information System).
[0022] Step 202: Sort all the medicine storage cells in the set S in ascending order of column numbers to obtain a first queue; select a number of first to-be-processed medicine storage cells from the first queue. The number of first to-be-processed medicine storage cells includes the medicine storage cell at the head of the first queue, and the absolute value of the difference in column numbers between any two adjacent first to-be-processed medicine storage cells A and first to-be-processed medicine storage cell B > preset threshold + (row number corresponding to the first to-be-processed medicine storage cell A - row number of the first to-be-processed medicine storage cell B) Num > 0, where the column number corresponding to the first to-be-processed medicine storage cell A > the column number of the first to-be-processed medicine storage cell B, -1 < Num ≤ 0, and the preset threshold > 0; control each first to-be-processed medicine storage cell to send out a boxed medicine. After that, for all the medicine storage cells that have sent out boxed medicines, subtract one from the medicine-taking quantity value of the corresponding boxed medicine type; delete the boxed medicine types with zero medicine-taking quantity from the medicine delivery information, and delete the medicine storage cells with zero medicine-taking quantity from the set S.
[0023] Here, since all the storage cells in the set S are sorted, then a number of first to-be-processed medicine storage cells will be selected from the set S, and these number of first to-be-processed medicine storage cells will also be arranged in order. For example, if the 1st column, the 4th column, and the 7th column are selected, then the 1st column and the 4th column can be considered adjacent, and the 4th column and the 7th column can be considered adjacent.
[0024] Here, in the first medicine delivery, as many medicines as possible need to be sent out, that is, as many boxes of medicines as possible need to be sent out at one time, and the distance between adjacent medicines > preset threshold + F (the difference in row numbers between adjacent to-be-processed medicine storage cells), so that the distance between adjacent medicines is large enough and they do not block each other, in order to facilitate photographing the six faces of the boxed medicine and the traceability code, etc. It can be understood that it takes time for the boxed medicine to fall from the medicine storage cell to the conveyor belt, and the higher the row number, the longer the time required. Therefore, the difference in row numbers between adjacent to-be-processed medicine storage cells can be obtained first. If the difference is larger, the horizontal distance between adjacent to-be-processed medicine storage cells can be adjusted, and two closer medicine storage cells can be selected as adjacent to-be-processed medicine storage cells; conversely, if the difference is smaller, two farther medicine storage cells can be selected as adjacent to-be-processed medicine storage cells.
[0025] Here, if the medicine storage cell A - medicine storage cell B > 0, two closer medicine storage cells can be selected as adjacent to-be-processed medicine storage cells, and the larger the value of the medicine storage cell A - medicine storage cell B, the closer the adjacent to-be-processed medicine storage cells; conversely, if the difference is smaller, two farther medicine storage cells can be selected as adjacent to-be-processed medicine storage cells.
[0026] In this embodiment, in the left-to-right direction, the cabinet body is divided into the 1st unit, the 2nd unit,..., the Qth unit, and each unit contains P columns; where Q and P are both natural numbers, and N = Q P; Here, it can be understood that as the upper surface of the conveyor belt moves from right to left, the rightmost side of the conveyor belt becomes empty first. Therefore, when there are no medicine boxes on the section of the conveyor belt at unit Q, medicine can be dispensed from the storage compartments in unit Q. After the storage compartments in unit Q are empty, medicine can be dispensed from unit Q-1, and so on, until medicine is dispensed from unit Q-2, and so on, until medicine is dispensed from unit 1. Once the storage compartments in unit 1 are empty, the entire medicine dispensing task is complete. The conveyor belt is also divided into Q sections, each section corresponding to one unit.
[0027] It also includes the following steps: For any i-th element, generate a corresponding empty set. For any drug storage cell in set S, obtain the corresponding j-th cell and put it into set S. Where i and j are natural numbers, 1 ≤ i, j ≤ Q; Let K=Q, and continue to perform the first operation until K=1. After each first operation is performed, the value of K is decreased by 1. Here, the operation is performed once for the Q-th unit, the Q-1-th unit, ..., the 1st unit in sequence.
[0028] The first operation is to continuously execute the following actions until the set is complete. Empty: When there are no medicine boxes on the portion of the conveyor belt located in unit K, the set is sorted in ascending order of column number. All drug storage cells are sorted to obtain a second queue; several second drug storage cells to be processed are selected from the second queue, and these several second drug storage cells to be processed include the drug storage cell located at the head of the second queue, and the absolute value of the difference between the column numbers of any adjacent second drug storage cell C and second drug storage cell D is greater than a preset threshold + (the row number corresponding to the second drug storage cell C - the row number of the second drug storage cell D). Num>0, where the column number corresponding to the second drug storage cell C is greater than the column number of the second drug storage cell D; control each second drug storage cell to dispense one boxed medicine, and then, for all drug storage cells that dispensed boxed medicine, decrement the quantity value of the corresponding boxed medicine type by one; delete the boxed medicine type with a quantity of zero from the dispensing information, and remove it from the set. Delete the medicine storage compartment where the number of medicines dispensed is zero.
[0029] In this embodiment, the following steps are also included: for each box of medicine sent out by the conveyor belt, photos and traceability codes of six sides are obtained and stored in the HIS system.
[0030] In this embodiment, the step of "selecting a plurality of first drug storage cells to be processed from the first queue, the plurality of first drug storage cells to be processed including the drug storage cell located at the head of the first queue, and the absolute value of the difference between the column numbers of any adjacent first drug storage cell A and first drug storage cell B to be processed is greater than a preset threshold + (the row number corresponding to the first drug storage cell A - the row number of the first drug storage cell B to be processed)" is defined as follows: "Num>0" specifically includes: selecting the storage cell at the head of the first queue as a first storage cell to be processed, marking the storage cell at the head of the first queue as the starting storage cell, and continuously performing the following first operation: if the successful selection satisfies "the difference between the column number and the column number of the starting storage cell > a preset threshold + the difference between the row number and the row number of the starting storage cell", then the following operation is performed: When Num>0 and the smallest column number is the drug storage cell E, drug storage cell E is the first drug storage cell to be processed. Drug storage cell E is marked as the starting drug storage cell, and the subsequent first operation is continued; otherwise, the subsequent first operation is not executed.
[0031] Here, the first storage cell at the head of the queue is selected as a storage cell to be processed. During the operation, the process can be performed along the direction from the head of the queue to the tail, searching for cells that satisfy the condition: "The difference between the column number and the column number of the starting storage cell is greater than a preset threshold + the difference between the row number and the row number of the starting storage cell". The first storage cell with "Num>0" is storage cell E, which allows for the selection of several storage cells to be processed.
[0032] The phrase "selecting several second drug storage cells to be processed from the second queue, the several second drug storage cells to be processed including the drug storage cell at the head of the second queue, and the absolute value of the difference between the column numbers of any adjacent second drug storage cell C and second drug storage cell D is greater than a preset threshold + (the row number corresponding to the second drug storage cell C - the row number of the second drug storage cell D)" is used. "Num>0" specifically includes: selecting the storage cell at the head of the second queue as a second storage cell to be processed, marking the storage cell at the head of the second queue as the starting storage cell, and continuously performing the following second operation: if the successful selection satisfies "the difference between the column number and the column number of the starting storage cell > a preset threshold + the difference between the row number and the row number of the starting storage cell", If Num>0 and the smallest column number is the drug storage cell F, then drug storage cell F is a second drug storage cell to be processed. Drug storage cell F is marked as the starting drug storage cell, and the subsequent second operation is continued; otherwise, the subsequent second operation is not executed.
[0033] Embodiment 2 of the present invention provides a boxed medicine dispensing device for a medicine storage cabinet. The medicine storage cabinet includes: a cabinet body, on which there are M rows and N columns of medicine storage grids. Each medicine storage grid is used to store the same type of boxed medicine, and the rows extend along the left-right direction, and the columns extend along the vertical direction; in the direction from left to right, the N columns are respectively marked as the 1st column, the 2nd column,..., the Nth column; in the direction from bottom to top, the M rows are respectively marked as the 1st row, the 2nd row,..., the Mth row; a conveyor belt is arranged in front of the cabinet body, and the conveyor belt extends from the 1st column to the Nth column, and the boxed medicine stored in any medicine storage grid can fall onto the conveyor belt; where M and N are both natural numbers; it includes the following modules: An information acquisition module, configured to receive medicine dispensing information, where the medicine dispensing information includes: multiple boxed medicine types and the corresponding medicine taking quantities for each boxed medicine type; obtain the medicine storage grids corresponding to each boxed medicine type, as well as the row numbers and column numbers of each medicine storage grid, and generate a set S that includes all the medicine storage grids corresponding to the boxed medicine types; control the rotation of the conveyor belt, and the upper surface of the conveyor belt moves from right to left; A first medicine dispensing module, configured to sort all the medicine storage grids in the set S in ascending order of column numbers to obtain a first queue; select several first to-be-processed medicine storage grids from the first queue, and the several first to-be-processed medicine storage grids include the medicine storage grid at the head of the first queue, and the absolute value of the difference in column numbers between any adjacent first to-be-processed medicine storage grid A and first to-be-processed medicine storage grid B > preset threshold + (row number of the first to-be-processed medicine storage grid A - row number of the first to-be-processed medicine storage grid B) Num>0, where the column number of the first to-be-processed medicine storage grid A > the column number of the first to-be-processed medicine storage grid B, -1<Num≤0, and the preset threshold>0; control each first to-be-processed medicine storage grid to send out a boxed medicine, and then, for all the medicine storage grids that have sent out boxed medicines, subtract 1 from the corresponding medicine taking quantity value of the boxed medicine type; delete the boxed medicine types with zero medicine taking quantity from the medicine dispensing information, and delete the medicine storage grids with zero medicine taking quantity from the set S.
[0034] In this embodiment, in the direction from left to right, the cabinet body is divided into the 1st unit, the 2nd unit,..., the Qth unit, and each unit includes P columns; where Q and P are both natural numbers, and N = Q P; It further includes the following modules: A second medicine dispensing module, configured to generate a corresponding empty set for any i-th unit , obtain the corresponding j-th unit for any medicine storage grid in the set S, and put it into the set Where i and j are natural numbers, 1 ≤ i, j ≤ Q; let K = Q, and continue to perform the following first operation until K = 1, and after each execution of the first operation, the value of K is decreased by 1; the first operation is to continue to perform the following actions until the set Empty: When there are no medicine boxes on the portion of the conveyor belt located in unit K, the set is sorted in ascending order of column number. All drug storage cells are sorted to obtain a second queue; several second drug storage cells to be processed are selected from the second queue, and these several second drug storage cells to be processed include the drug storage cell located at the head of the second queue, and the absolute value of the difference between the column numbers of any adjacent second drug storage cell C and second drug storage cell D is greater than a preset threshold + (the row number corresponding to the second drug storage cell C - the row number of the second drug storage cell D). Num>0, where the column number corresponding to the second drug storage cell C is greater than the column number of the second drug storage cell D; control each second drug storage cell to dispense one boxed medicine, and then, for all drug storage cells that dispensed boxed medicine, decrement the quantity value of the corresponding boxed medicine type by one; delete the boxed medicine type with a quantity of zero from the dispensing information, and remove it from the set. Delete the medicine storage compartment where the number of medicines dispensed is zero.
[0035] In this embodiment, the following module is also included: a traceability module, which is used to acquire photos and traceability codes of six sides of each box of medicine sent out by the conveyor belt and store them in the HIS system.
[0036] In this embodiment, the first dispensing module is further configured to: select the storage cell at the head of the first queue as a first storage cell to be processed, mark the storage cell at the head of the first queue as the starting storage cell, and continuously perform the following first operation: if the successful selection satisfies "the difference between the column number and the column number of the starting storage cell > a preset threshold + the difference between the row number and the row number of the starting storage cell", When Num>0 and the smallest column number is found in cell E, cell E is designated as the first cell to be processed. Cell E is marked as the starting cell, and the subsequent first operation continues. Otherwise, the subsequent first operation is not performed. The cell at the head of the second queue is selected as the second cell to be processed, and the cell at the head of the second queue is marked as the starting cell. The following second operation continues: If the successful selection satisfies the condition that "the difference between the column number and the starting cell's column number is greater than a preset threshold + the difference between the row number and the starting cell's row number", the following second operation continues: If Num>0 and the smallest column number is the drug storage cell F, then drug storage cell F is a second drug storage cell to be processed. Drug storage cell F is marked as the starting drug storage cell, and the subsequent second operation is continued; otherwise, the subsequent second operation is not executed.
[0037] Embodiment 3 of the present invention provides an electronic device, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the steps of the boxed drug dispensing method in Embodiment 1.
[0038] Embodiment 4 of the present invention provides a storage medium storing a program or instructions, which, when executed by a processor, implement the steps of the boxed drug dispensing method as described in Embodiment 1.
[0039] It should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This way of describing the specification is only for clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
[0040] The detailed descriptions listed above are merely specific descriptions of feasible embodiments of the present invention, and are not intended to limit the scope of protection of the present invention. All equivalent embodiments or modifications made without departing from the spirit of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for dispensing boxed medicines in a medicine cabinet, the medicine cabinet comprising: The cabinet has M rows and N columns of storage compartments for storing boxed medicines of the same type. The rows extend horizontally, and the columns extend vertically. From left to right, the N columns are labeled Column 1, Column 2, ..., Column N. From bottom to top, the M rows are labeled Row 1, Row 2, ..., Row M. A conveyor belt extends from Column 1 to Column N at the front of the cabinet, allowing boxed medicines in any compartment to fall onto the conveyor belt. M and N are both natural numbers. The cabinet is divided into Unit 1, Unit 2, ..., Unit Q from left to right, with each unit containing P columns. Q and P are both natural numbers, and N = Q. P; characterized by comprising the following steps: Upon receiving medication dispensing information, the medication dispensing information includes: multiple types of boxed medications and the quantity of medication dispensed for each type of boxed medication; obtaining the storage cell corresponding to each type of boxed medication, as well as the row number and column number of each storage cell, and generating a set S containing storage cells corresponding to all types of boxed medications; controlling the conveyor belt to rotate, and the upper surface of the conveyor belt to move from right to left; Sort all the medicine storage cells in the set S in ascending order of column numbers to obtain the first queue; select several first to-be-processed medicine storage cells from the first queue. The several first to-be-processed medicine storage cells include the medicine storage cell at the head of the first queue, and the absolute value of the difference in column numbers between any two adjacent first to-be-processed medicine storage cells A and first to-be-processed medicine storage cell B > preset threshold + (row number corresponding to the first to-be-processed medicine storage cell A - row number of the first to-be-processed medicine storage cell B). Num > 0, where the column number corresponding to the first to-be-processed medicine storage cell A > the column number of the first to-be-processed medicine storage cell B, -1 < Num ≤ 0, and the preset threshold > 0; control each first to-be-processed medicine storage cell to send out a boxed medicine. After that, for all the medicine storage cells that have sent out boxed medicines, subtract one from the medicine taking quantity value of the corresponding boxed medicine type; delete the boxed medicine types with a medicine taking quantity of zero from the medicine taking information, and delete the medicine storage cells with a medicine taking quantity of zero from the set S. For any i-th element, generate a corresponding empty set. For any drug storage cell in set S, obtain the corresponding j-th cell and put it into set S. Where i and j are natural numbers, 1 ≤ i, j ≤ Q; let K = Q, and continue to perform the following first operation until K = 1, and after each execution of the first operation, the value of K is decreased by 1; the first operation is to continue to perform the following actions until the set Empty: When there are no medicine boxes on the portion of the conveyor belt located in unit K, the boxes are processed in ascending order of column number. All drug storage cells are sorted to obtain a second queue; several second drug storage cells to be processed are selected from the second queue, and these several second drug storage cells to be processed include the drug storage cell located at the head of the second queue, and the absolute value of the difference between the column numbers of any adjacent second drug storage cell C and second drug storage cell D is greater than a preset threshold + (the row number corresponding to the second drug storage cell C - the row number of the second drug storage cell D). Num>0, where the column number corresponding to the second drug storage cell C is greater than the column number of the second drug storage cell D; control each second drug storage cell to dispense one boxed medicine, and then, for all drug storage cells that dispensed boxed medicine, decrement the quantity value of the corresponding boxed medicine type by one; delete the boxed medicine type with a quantity of zero from the dispensing information, and remove it from the set. Delete the medicine storage compartment where the number of medicines dispensed is zero.
2. The method for dispensing boxed medicine according to claim 1, characterized in that, It also includes the following steps: For each box of medicine delivered by the conveyor belt, photos and traceability codes of all six sides are captured and stored in the HIS system.
3. The method for dispensing boxed medicine according to claim 1, characterized in that, The process involves selecting several first drug storage cells to be processed from the first queue, including the drug storage cell at the head of the first queue, and ensuring that the absolute value of the difference between the column numbers of any adjacent first drug storage cell A and first drug storage cell B is greater than a preset threshold plus (the row number corresponding to the first drug storage cell A minus the row number of the first drug storage cell B). "Num>0" specifically includes: selecting the storage cell at the head of the first queue as a first storage cell to be processed, marking the storage cell at the head of the first queue as the starting storage cell, and continuously performing the following first operation: if the successful selection satisfies "the difference between the column number and the column number of the starting storage cell > a preset threshold + the difference between the row number and the row number of the starting storage cell", When Num>0 and the smallest column number is the drug storage cell E, drug storage cell E is the first drug storage cell to be processed. Drug storage cell E is marked as the starting drug storage cell, and the subsequent first operation is continued; otherwise, the subsequent first operation is not executed. The process involves selecting several second drug storage cells from the second queue, including the drug storage cell at the head of the second queue, and ensuring that the absolute value of the difference between the column numbers of any adjacent second drug storage cell C and second drug storage cell D is greater than a preset threshold plus (the row number corresponding to the second drug storage cell C minus the row number of the second drug storage cell D). "Num>0" specifically includes: selecting the storage cell at the head of the second queue as a second storage cell to be processed, marking the storage cell at the head of the second queue as the starting storage cell, and continuously performing the following second operation: if the successful selection satisfies "the difference between the column number and the column number of the starting storage cell > a preset threshold + the difference between the row number and the row number of the starting storage cell", If Num>0 and the smallest column number is the drug storage cell F, then drug storage cell F is a second drug storage cell to be processed. Drug storage cell F is marked as the starting drug storage cell, and the subsequent second operation is continued; otherwise, the subsequent second operation is not executed.
4. A dispensing device for boxed medicines in a medicine cabinet, the medicine cabinet comprising: The cabinet has M rows and N columns of storage compartments, each compartment storing the same type of boxed medicine. Rows extend horizontally, and columns extend vertically. From left to right, the N columns are labeled Column 1, Column 2, ..., Column N; from bottom to top, the M rows are labeled Row 1, Row 2, ..., Row M. A conveyor belt extends from Column 1 to Column N at the front of the cabinet, allowing boxed medicine in any compartment to fall onto the conveyor belt. M and N are both natural numbers. The cabinet is divided into Unit 1, Unit 2, ..., Unit Q from left to right, each unit containing P columns. Q and P are both natural numbers, and N = Q. P; characterized in that it includes the following modules: The information acquisition module is used to receive dispensing information, which includes: multiple boxed drug types and the dispensing quantity corresponding to each boxed drug type; acquire the storage cell corresponding to each boxed drug type, as well as the row number and column number of each storage cell, and generate a set S containing all the storage cells corresponding to all boxed drug types; control the conveyor belt to rotate, and the upper surface of the conveyor belt moves from right to left. The first medicine dispensing module is used to sort all the medicine storage cells in the set S in ascending order of the column numbers to obtain a first queue; select a number of first to-be-processed medicine storage cells from the first queue, and the number of first to-be-processed medicine storage cells includes the medicine storage cell at the head of the first queue, and the absolute value of the difference in column numbers between any adjacent first to-be-processed medicine storage cell A and first to-be-processed medicine storage cell B > preset threshold + (row number corresponding to the first to-be-processed medicine storage cell A - row number of the first to-be-processed medicine storage cell B) Num > 0, where the column number corresponding to the first to-be-processed medicine storage cell A > the column number of the first to-be-processed medicine storage cell B, -1 < Num ≤ 0, and the preset threshold > 0; control each first to-be-processed medicine storage cell to send out a boxed medicine, and then, for all the medicine storage cells that have sent out the boxed medicine, subtract one from the medicine taking quantity value of the corresponding boxed medicine type; delete the boxed medicine types with a medicine taking quantity of zero from the medicine dispensing information, and delete the medicine storage cells with a medicine taking quantity of zero from the set S; The second dispensing module is used to generate a corresponding empty set for any i-th unit. For any drug storage cell in set S, obtain the corresponding j-th cell and put it into set S. Where i and j are natural numbers, 1 ≤ i, j ≤ Q; let K = Q, and continue to perform the following first operation until K = 1, and after each execution of the first operation, the value of K is decreased by 1; the first operation is to continue to perform the following actions until the set Empty: When there are no medicine boxes on the portion of the conveyor belt located in unit K, the sets are sorted in ascending order of column number. All drug storage cells are sorted to obtain a second queue; several second drug storage cells to be processed are selected from the second queue, and these several second drug storage cells to be processed include the drug storage cell located at the head of the second queue, and the absolute value of the difference between the column numbers of any adjacent second drug storage cell C and second drug storage cell D is greater than a preset threshold + (the row number corresponding to the second drug storage cell C - the row number of the second drug storage cell D). Num>0, where the column number corresponding to the second drug storage cell C is greater than the column number of the second drug storage cell D; control each second drug storage cell to dispense one boxed medicine, and then, for all drug storage cells that dispensed boxed medicine, decrement the quantity value of the corresponding boxed medicine type by one; delete the boxed medicine type with a quantity of zero from the dispensing information, and remove it from the set. Delete the medicine storage compartment where the number of medicines dispensed is zero.
5. The boxed medicine dispensing device according to claim 4, characterized in that, It also includes the following modules: The traceability module is used to acquire photos and traceability codes of six sides of each box of medicine sent out by the conveyor belt and store them in the HIS system.
6. The boxed medicine dispensing device according to claim 4, characterized in that, The first dispensing module is also used to: select the storage cell at the head of the first queue as a first storage cell to be processed, mark the storage cell at the head of the first queue as the starting storage cell, and continuously perform the following first operation: if the successful selection satisfies "the difference between the column number and the column number of the starting storage cell > a preset threshold + the difference between the row number and the row number of the starting storage cell", When Num>0 and the smallest column number is found in cell E, cell E is designated as the first cell to be processed. Cell E is marked as the starting cell, and the subsequent first operation continues. Otherwise, the subsequent first operation is not performed. The cell at the head of the second queue is selected as the second cell to be processed, and the cell at the head of the second queue is marked as the starting cell. The following second operation continues: If the successful selection satisfies the condition that "the difference between the column number and the starting cell's column number is greater than a preset threshold + the difference between the row number and the starting cell's row number", the following second operation continues: If Num>0 and the smallest column number is the drug storage cell F, then drug storage cell F is a second drug storage cell to be processed. Drug storage cell F is marked as the starting drug storage cell, and the subsequent second operation is continued; otherwise, the subsequent second operation is not executed.
7. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the boxed drug dispensing method as described in any one of claims 1-3.
8. A storage medium, characterized in that, The storage medium stores a program or instructions that, when executed by a processor, implement the steps of the boxed drug dispensing method as described in any one of claims 1-3.
Citation Information
Patent Citations
Drug storeroom for storing boxed drugs
CN111439513A
Method and device for taking medicine from medicine storage box, electronic equipment and storage medium
CN119840989A