Dispensing machine inventory management method and system, medium and terminal

By adopting a distributed service architecture in the inventor inventory management system of the drug dispenser, inventory inventory inventory is automatically recorded at a specified time, solving the problems of inefficient and insufficient stability of traditional inventory, and improving the reliability and scalability of the system.

CN119993412APending Publication Date: 2025-05-13SHENZHEN LACHESIS MOBILE MEDICAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510027839.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-08
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

The inventory of traditional drug dispensing machines has problems such as inefficiency, easy to lead to human errors, stability risks, insufficient data security guarantees and system performance bottlenecks.

Method used

Adopting a distributed service architecture, through the collaborative work of scheduling services, inventory services and cabinet services, automatic inventory inventory is carried out at a specified time and the inventory data is written to the database. The architecture uses a registry to manage multi-node services to ensure system stability and scalability.

Benefits of technology

It realizes an automated inventory inventory process at a specified time, improves inventory efficiency, reduces the risk of human error, enhances the stability and scalability of the system, and ensures the reliability of inventory management of pharmacy drug dispensers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119993412A_ABST
    Figure CN119993412A_ABST
Patent Text Reader

Abstract

The invention discloses a dispensing machine inventory management method and system, a medium and a terminal, and the method comprises the steps: calling a task detection node of a scheduling service, and regularly detecting whether the current moment is within a preset time range or not according to a preset period; if yes, calling an inventory checking service and a cabinet service, executing an inventory checking task, performing inventory statistics on cabinets of the dispensing machine in the execution process of the inventory checking task to obtain inventory checking data, and writing the inventory checking data into a database; wherein the inventory data comprises inventory time and the number of drugs corresponding to one or more to-be-checked drug types placed in one or more to-be-checked drug grooves in a cabinet of the dispensing machine, and the dispatching service, the inventory service and the cabinet service are distributed multi-node services. And the registration center is used for managing a plurality of nodes of each distributed multi-node service. According to the invention, the inventory checking task is executed within the specified time, and the stability and expandability of the inventory checking work are ensured by using the distributed service architecture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of drug inventory management, and in particular to a drug dispensing machine inventory management method, system, medium and terminal. Background Art

[0002] There are many problems in the traditional inventory counting scenario of medicine dispensers. On the one hand, inventory counting mostly relies on manual operation, which requires a lot of human resources. The staff needs to suspend the normal operation of the medicine dispenser and check the drug information one by one. This method is not only inefficient, but also prone to inventory errors due to human negligence. On the other hand, although the traditional single-point system medicine dispenser can realize automatic inventory counting, it faces stability risks during inventory counting. The data is stored in a centralized manner, which is easy to lose or tamper with data due to hardware failure or software problems. In addition, the inventory counting work is completely stagnant when the software fails, and there is a lack of effective response mechanism. At the same time, the data security is insufficient. With the growth of pharmacy business, the types and quantities of drug inventory increase. The medicine dispenser software of the single-point system may become unstable due to performance bottlenecks and cannot meet the inventory counting needs after the business volume increases. For example, when the inventory data volume exceeds the processing capacity of the software design, the operation of querying inventory data may become very slow during the inventory counting process, and may even cause the software to be unresponsive. In this case, to expand the performance of the system, it is often necessary to upgrade the hardware or rewrite the software of the entire system, which is costly and risky. Summary of the invention

[0003] The embodiments of the present invention provide a method, system, medium and terminal for managing the inventory of a medicine dispensing machine, which execute an inventory task within a specified time and utilize a distributed service architecture to ensure the stability and scalability of the inventory work.

[0004] In order to solve the above technical problems, an embodiment of the present invention provides a method for managing inventory of a medicine dispensing machine, comprising:

[0005] Call the task detection node of the scheduling service to regularly detect whether the current time is within the preset time range according to the preset cycle;

[0006] If so, the inventory service and cabinet service are called to execute the inventory task. During the execution of the inventory task, the cabinet of the medicine dispensing machine is counted for inventory, the corresponding inventory data is obtained, and the inventory data is written into the database;

[0007] Among them, the inventory data includes the inventory time, the number of medicines corresponding to one or more types of medicines to be counted placed in one or more medicine slots to be counted in the cabinet of the medicine dispensing machine, the scheduling service, the inventory service and the cabinet service are distributed multi-node services, and a registration center is used to manage multiple nodes of each distributed multi-node service.

[0008] In implementing the embodiment of the present invention, the task detection node of the scheduling service is called to regularly detect whether the current time is within the preset time range according to the preset cycle. If so, the inventory service and the cabinet service are called to execute the inventory task. During the execution of the inventory task, the inventory statistics of the cabinet of the medicine dispensing machine are performed to obtain the corresponding inventory data, and the inventory data is written into the database. Through the above means, the inventory counting process of the cabinet of the medicine dispensing machine is automatically started at the specified time. Furthermore, the scheduling service, inventory service and cabinet service used to implement the scheduled automatic inventory counting function are distributed multi-node services, and the registration center is used to manage the multiple nodes of each distributed multi-node service to distribute the various services of the inventory counting system on multiple nodes. When a node fails, the tasks of the node can be automatically assigned to other healthy nodes to ensure the continuous and stable progress of the inventory counting work, thereby overcoming the stability problems of the traditional single-point system and realizing the scalability of the inventory counting system, so that the management personnel or the system can replenish the corresponding medicines in the cabinet of the medicine dispensing machine in time and accurately place them in the corresponding medicine slots according to the inventory data stored in the database, thereby ensuring that the medicine dispensing machine in the pharmacy can have medicines to dispense and avoiding the occurrence of dispensing errors caused by placing the wrong medicines in the medicine slots.

[0009] As a preferred solution, if yes, then the inventory service and cabinet service are called to perform the inventory task. During the execution of the inventory task, the cabinet of the medicine dispensing machine is counted for inventory, the corresponding inventory data is obtained, and the inventory data is written into the database, specifically:

[0010] If it is detected that the current moment is within the preset time range, a scheduling task notification message is sent to the inventory service through the task scheduling node of the scheduling service, so that the inventory service obtains the medicine information of the medicine slots to be inventoried based on the scheduling task notification message, and sends the medicine information of the medicine slots to be inventoried to the cabinet service; wherein the medicine information of the medicine slots to be inventoried includes relevant information of one or more medicine slots to be inventoried, and medicine information corresponding to one or more types of medicines to be inventoried, and the inventory service and the cabinet service communicate using the MQTT protocol;

[0011] After the cabinet service receives the medicine information of the medicine slot to be counted, the cabinet service performs the inventory task;

[0012] During the execution of the inventory task, inventory statistics are performed on the cabinets of the medicine dispensing machines to obtain corresponding inventory data, and the inventory data is written into the database.

[0013] A preferred solution for implementing the embodiment of the present invention is that if it is detected that the current moment is within a preset time range, a scheduling task notification message is sent to the inventory service through the task scheduling node of the scheduling service, so that the inventory service obtains the medicine information of the medicine slots to be counted based on the scheduling task notification message, and sends the medicine information of the medicine slots to be counted to the cabinet service, so that the cabinet service performs the inventory task, wherein the MQTT protocol is used for communication between the inventory service and the cabinet service, and the QoS characteristics of the MQTT protocol are utilized to effectively ensure that the sent messages can arrive accurately, ensure the reliability of the communication, and thereby ensure the continuous and stable progress of the inventory counting work.

[0014] As a preferred solution, during the execution of the inventory task, the cabinets of the medicine dispensing machines are counted for inventory, the corresponding inventory data are obtained, and the inventory data is written into the database, specifically:

[0015] During the execution of the inventory task, the infrared counter is called through the infrared counting node of the cabinet service, so that the infrared counter performs an infrared scan on one or more medicine slots to be counted of the cabinet of the medicine dispensing machine, and combines the infrared scanning result and the medicine information corresponding to one or more types of medicines to be counted to analyze and obtain the inventory data, and then sends the inventory data to the inventory service; wherein the inventory data includes the number of medicines corresponding to each type of medicine to be counted placed in each of the medicine slots to be counted;

[0016] Through the inventory service, an inventory surplus and shortage analysis is performed based on the received inventory data, and the analysis results and the inventory data are written into a database.

[0017] A preferred scheme for implementing the embodiment of the present invention is to call an infrared counter through the infrared counting node of the cabinet service during the execution of the inventory task, so that the infrared counter performs an infrared scan on one or more medicine slots to be counted of the cabinet of the medicine dispensing machine, and combines the infrared scanning results and the medicine information corresponding to one or more types of medicines to be counted, so as to accurately detect the type and number of medicines in the medicine slots, and then analyze and obtain inventory data including the number of medicines corresponding to each type of medicine to be counted placed in each medicine slot to be counted, and then send the inventory data to the inventory service, so that the inventory service performs surplus and shortage analysis based on the inventory data, so as to accurately grasp the current inventory situation of the medicine dispensing cabinet, and discover the abnormal surplus and shortage of the medicine dispensing machine, avoid excessive storage or shortage of medicines, and improve the efficiency of inventory management.

[0018] As a preferred solution, after the cabinet service receives the medicine information of the medicine slot to be counted, the cabinet service performs the inventory task, specifically:

[0019] When the cabinet service receives the medicine information of the medicine slot to be counted, the cabinet of the medicine dispensing machine is called for iterative control processing through the medicine dispensing detection node of the cabinet service. During each iterative control processing, the camera installed on the cabinet of the medicine dispensing machine is called to take real-time photos of the front of the cabinet of the medicine dispensing machine to obtain one or more cabinet image frames, and then the current one or more cabinet image frames are respectively input into a pre-built face detection model, so that the face detection model performs face detection on the current one or more cabinet image frames and outputs the face detection results corresponding to the current one or more cabinet image frames, until the face detection results corresponding to all the current cabinet image frames are no faces, then the iteration is stopped and it is determined that no one is taking medicine at the current moment, and then the inventory task is performed through the cabinet service.

[0020] According to a preferred scheme for implementing the embodiments of the present invention, before the cabinet service executes the inventory task, a camera and a face detection model installed on the cabinet of the medicine dispensing machine are used to accurately determine whether there is a person in front of the cabinet of the current medicine dispensing machine, so as to indicate whether there is a person taking medicine from the cabinet at the current moment, and the inventory task will only be started or executed when it is determined that no person is taking medicine at the current moment, so as to avoid inaccurate inventory data caused by the entry and exit operations of medicines during the inventory process, and to prevent personnel safety issues caused by the inventory counting process.

[0021] As a preferred solution, the current one or more cabinet image frames are respectively input into a pre-built face detection model, so that the face detection model performs face detection on the current one or more cabinet image frames and outputs the face detection results corresponding to the current one or more cabinet image frames, specifically:

[0022] Input the current one or more cabinet image frames into the pre-built face detection model respectively;

[0023] Through the face detection model, several windows are slid once or multiple times in the cabinet image frame input into the face detection model, and after each sliding is completed, the feature values ​​of each object in the current window are calculated, and then the feature values ​​of each object in the current window are input into the classifier in the face detection model, so that the classifier determines whether the current window contains a face, and obtains a window detection result of the current cabinet image frame, and then combines all the window detection results of the current cabinet image frame to analyze and output the face detection result corresponding to the current cabinet image frame; wherein, the size of each window is different.

[0024] The preferred scheme for implementing the embodiment of the present invention adopts a sliding window mechanism, allowing the system to quickly scan the entire image frame and process multiple windows in parallel, thereby improving the speed and efficiency of face detection. In addition, multiple sliding detections are performed using windows of different sizes, which can cover faces of different sizes and detection of people at different distances from the cabinet, thereby improving the precision, accuracy and applicability of face detection.

[0025] As a preferred solution, the construction of the face detection model is specifically as follows:

[0026] Build an initial detection model based on machine learning;

[0027] Using the sample data set, the initial detection model is trained and verified, and the initial detection model that has completed the training and verification is used as a face detection model;

[0028] The sample data set includes a plurality of positive samples and a plurality of negative samples, the positive samples are images containing human faces, and the negative samples are images not containing human faces.

[0029] A preferred solution for implementing the embodiment of the present invention uses several positive samples containing faces and several negative samples that do not contain faces to train and verify the initial detection model based on machine learning, so that the model can learn a wider range of features and enhance its adaptability to different scenes, light and postures.

[0030] In order to solve the same technical problem, an embodiment of the present invention further provides a medicine dispensing machine inventory management system, comprising:

[0031] A call detection module is used to call the task detection node of the scheduling service, and regularly detect whether the current time is within a preset time range according to a preset cycle; wherein the scheduling service is a distributed multi-node service, and a registration center is used to manage multiple nodes of each distributed multi-node service;

[0032] An inventory counting module is called to call the inventory counting service and the cabinet service to execute the inventory counting task if it is detected that the current moment is within a preset time range. During the execution of the inventory counting task, inventory statistics are performed on the cabinet of the medicine dispensing machine to obtain corresponding inventory counting data, and the inventory counting data is written into a database; wherein the inventory counting data includes the inventory counting time, the number of medicines corresponding to one or more types of medicines to be counted placed in one or more medicine slots to be counted in the cabinet of the medicine dispensing machine, the inventory counting service and the cabinet service are distributed multi-node services, and a registration center is used to manage multiple nodes of each distributed multi-node service.

[0033] As a preferred solution, the calling inventory module specifically includes:

[0034] The interaction unit is used to send a scheduling task notification message to the inventory service through the task scheduling node of the scheduling service if it is detected that the current moment is within a preset time range, so that the inventory service obtains the medicine information of the medicine slots to be inventoried based on the scheduling task notification message, and sends the medicine information of the medicine slots to be inventoried to the cabinet service; wherein the medicine information of the medicine slots to be inventoried includes relevant information of one or more medicine slots to be inventoried, and medicine information corresponding to one or more types of medicines to be inventoried, and the inventory service and the cabinet service communicate using the MQTT protocol;

[0035] The inventory unit is used to execute the inventory task through the cabinet service after the cabinet service receives the medicine information of the medicine slot to be counted; during the execution of the inventory task, the inventory statistics of the cabinet of the medicine dispensing machine are performed to obtain the corresponding inventory data, and the inventory data is written into the database.

[0036] In order to solve the same technical problem, the present invention also provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the method for managing inventory of a medicine dispensing machine.

[0037] In order to solve the same technical problem, the present invention also provides a terminal, including a processor, a memory and a computer program stored in the memory; wherein the computer program can be executed by the processor to implement the inventory management method of a medicine dispensing machine. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 : A schematic diagram of a flow chart of a method for managing inventory of a medicine dispensing machine provided in the first embodiment of the present invention;

[0039] Figure 2 : A structural diagram of an inventory management system for medicine dispensing machines provided in Example 1 of the present invention. DETAILED DESCRIPTION

[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0041] Embodiment one:

[0042] Please refer to Figure 1, is a method for managing the inventory of a medicine dispensing machine provided by an embodiment of the present invention, the method comprising steps S1 to S2, each step being specifically as follows:

[0043] Step S1, calling the task detection node of the scheduling service, and regularly detecting whether the current time is within a preset time range according to a preset cycle.

[0044] In this embodiment, the doctor can set the specific date of the inventory and the preset period (inventory period) on the automatic inventory page of the cabinet to generate a scheduled task. When the specified time is reached, the system will communicate with the software on the cabinet through the network protocol, and start the automatic inventory after detecting that no one is there, and finally complete the inventory. Among them, the preset time range can be the time when the pharmacy has the least customer traffic in the early morning every day. Performing the inventory task during this time period can avoid interfering with the normal dispensing work of the medicine dispensing machine. On the server, at the task detection node of the scheduling service, a scheduled task platform XXL-JOB is used to periodically detect whether the current time has reached the time set by the doctor.

[0045] Step S2, if it is detected that the current time is within the preset time range, the inventory service and cabinet service are called to execute the inventory task. During the execution of the inventory task, the inventory statistics of the cabinet of the medicine dispensing machine are performed to obtain the corresponding inventory data, and the inventory data is written into the database.

[0046] In this embodiment, the database mainly used is MySQL.

[0047] Among them, the inventory data includes the inventory time, the number of medicines corresponding to one or more types of medicines to be counted placed in one or more medicine slots to be counted in the cabinet of the medicine dispensing machine, and the scheduling service, inventory service and cabinet service are distributed multi-node services, and the registration center is used to manage multiple nodes of each distributed multi-node service.

[0048] In this embodiment, a method for managing the inventory of a medicine dispensing machine provided by an embodiment of the present invention introduces a distributed node architecture, which includes a registration center and multiple distributed multi-node services. Each distributed multi-node service can deploy multiple nodes and use the registration center for node management. Each service registers multiple node information with the registration center to achieve the distribution of services on multiple nodes. When any node hardware fails or the software is abnormal, the task of the faulty node can be transferred to other healthy nodes, and the same service can continue to be provided through other healthy nodes, and the use of the faulty node is abolished, so as to solve the problem of single point failure of the system. When functional expansion is required or the business volume surges, new nodes can be added to the architecture to adapt to more business and ensure the stability of the system. Among them, the distributed multi-node service includes but is not limited to: inventory service, Web service, scheduling service, data service, inventory service and cabinet service. It should be noted that the distributed nodes cooperate with each other through reliable communication protocols and coordination mechanisms. This architecture provides strong fault tolerance, so that the system can still stably complete the inventory task when facing various complex network environments and hardware failures, thereby ensuring the continuity of the pharmacy's medicine dispensing business.

[0049] Specifically, the inventory service includes inventory management nodes and expiration management nodes, which are mainly used to manage drug inventory and expiration dates. The service can be used to query drug inventory information and assist in inventory services; the Web service includes setting management nodes and report query nodes, which are mainly used to allow users to configure inventory and query report data on the page; the scheduling service includes task scheduling nodes and task detection nodes, which are mainly used to perform scheduled scanning and detection of tasks based on the set inventory configuration and use the distributed scheduling task framework XXL-JOB. After the specified time has arrived, the inventory service is notified to perform inventory. In a distributed environment, XXL-JOB can deploy multiple nodes to ensure the stability of the scheduling service; the data service includes read-write separation nodes and master-slave synchronization nodes, which are mainly used to ensure data stability through master-slave synchronization. The backup is carried out, and the read-write separation method is used to improve the performance of the inventory system; the inventory service, including the inventory data generation node and the cabinet communication interaction node, mainly calculates and counts the inventory when receiving the scheduling task, and then interacts with the cabinet through the network protocol MQTT to realize the analysis and processing of the surplus and shortage of inventory, and writes the data to the database after the interaction is completed; the cabinet service, including the infrared counting node and the medicine delivery detection node, mainly performs the medicine delivery detection when receiving the interaction information, and judges whether there is a person to perform the medicine delivery / receiving operation. When it is detected that there is no one, it jumps to the maintenance page to execute the inventory task, and then performs infrared scanning to count the medicines in the medicine slot. After the counting is completed, it is sent to the inventory service through the network protocol MQTT for surplus and shortage processing and database writing.

[0050] As a preferred solution, step S2 includes step S21 to step S23, and each step is specifically as follows:

[0051] Step S21, if it is detected that the current time is within the preset time range, a scheduling task notification message is sent to the inventory service through the task scheduling node of the scheduling service, so that the inventory service obtains the medicine information of the medicine slot to be counted based on the scheduling task notification message, and sends the medicine information of the medicine slot to be counted to the cabinet service.

[0052] Among them, the drug information of the medicine slots to be counted includes relevant information of one or more medicine slots to be counted, and drug information corresponding to one or more types of drugs to be counted; the inventory service and the cabinet service communicate using the MQTT protocol.

[0053] It should be noted that the QoS feature of the MQTT protocol can effectively ensure that the sent messages can arrive accurately and ensure the reliability of communication. As an example, when the QoS (quality of service) is 2, it is guaranteed that the message is delivered only once, which solves the problem of message transmission loss and duplicate delivery in the network at the protocol level.

[0054] Step S22, after the cabinet service receives the information of the medicines in the medicine slots to be counted, the cabinet service executes the inventory task.

[0055] As a preferred solution, step S22 includes step S221 to step S222, and each step is specifically as follows:

[0056] Step S221, when the cabinet service receives the medicine information of the medicine slot to be counted, the cabinet of the medicine dispensing machine is called for iterative control processing through the medicine dispensing detection node of the cabinet service. During each iterative control processing, the camera installed on the cabinet of the medicine dispensing machine is called to take real-time photos of the front of the cabinet of the medicine dispensing machine to obtain one or more cabinet image frames, and then the current one or more cabinet image frames are respectively input into the pre-built face detection model, so that the face detection model performs face detection on the current one or more cabinet image frames and outputs the face detection results corresponding to the current one or more cabinet image frames, until the face detection results corresponding to all the current cabinet image frames are no faces, then the iteration is stopped and it is determined that no one is taking medicine at the current moment.

[0057] As a preferred solution, the specific process of "inputting the current one or more cabinet image frames into the pre-built face detection model respectively, so that the face detection model performs face detection on the current one or more cabinet image frames respectively and outputs the face detection results corresponding to the current one or more cabinet image frames respectively" mentioned in step S221 includes steps S2211 to S2212, and each step is specifically as follows:

[0058] Step S2211, input the current one or more cabinet image frames into the pre-built face detection model respectively.

[0059] Step S2212, through the face detection model, slide several windows once or multiple times in the cabinet image frame that inputs the face detection model, and after each sliding, calculate the feature values ​​of each object in the current window, and then input the feature values ​​of each object in the current window into the classifier in the face detection model, so that the classifier determines whether the current window contains a face, and obtains a window detection result of the current cabinet image frame, and then combines all the window detection results of the current cabinet image frame to analyze and output the face detection result corresponding to the current cabinet image frame.

[0060] Each window has a different size.

[0061] As a preferred solution, the construction process of the "face detection model" mentioned in step S221 includes steps S01 to S02, and each step is specifically as follows:

[0062] Step S01, constructing an initial detection model based on machine learning.

[0063] In this embodiment, the initial detection model based on machine learning may be a model constructed using an algorithm based on the open source project OpenCV.

[0064] Step S02: using the sample data set to train and verify the initial detection model, and using the initial detection model that has completed the training and verification as the face detection model.

[0065] The sample data set includes several positive samples and several negative samples. The positive samples are images containing faces, and the negative samples are images not containing faces.

[0066] In this embodiment, for the training verification of the initial detection model, several positive samples and several negative samples in the sample data set can be divided into a training set and a test set according to a preset division ratio, and then the initial detection model is trained using the training set, and then the trained model is tested using the test set to verify whether the detection accuracy of the current model reaches the expected effect.

[0067] Step S222, performing inventory task through cabinet service.

[0068] Step S23, during the execution of the inventory task, the inventory statistics of the cabinets of the medicine dispensing machines are performed to obtain the corresponding inventory data, and the inventory data is written into the database.

[0069] As a preferred solution, step S23 includes step S231 to step S232, and each step is specifically as follows:

[0070] Step S231, during the execution of the inventory task, the infrared counter is called through the infrared counting node of the cabinet service, so that the infrared counter performs an infrared scan on one or more medicine slots to be counted in the cabinet of the medicine dispensing machine, and combines the infrared scanning results and the drug information corresponding to one or more types of drugs to be counted to analyze and obtain the inventory data, and then send the inventory data to the inventory service.

[0071] The inventory data includes the number of medicines corresponding to each type of medicine to be counted placed in each medicine slot to be counted.

[0072] Step S232: Through the inventory service, based on the received inventory data, perform inventory surplus and shortage analysis and write the analysis results and inventory data into the database.

[0073] It should be noted that the database adopts a master-slave synchronization database architecture. The master database is responsible for processing all write operations and synchronizing data changes to the slave database, while the slave database is mainly used for read operations. In this way, when the master database fails, the slave database can quickly take over to ensure data availability. At the same time, a strict data consistency algorithm is used in the master-slave synchronization process to ensure the integrity and accuracy of the inventory data and effectively protect the security of the data. In addition, the software realizes the read-write separation of the database. Read operations and write operations are handled by different database instances or servers respectively. This design can improve the concurrent performance of the system and reduce the risk of data conflicts. During the inventory counting process, a large number of query operations (read operations) can be performed efficiently without affecting data writing (such as drug entry and exit records), ensuring the response speed of the system.

[0074] Please refer to Figure 2 , is a structural diagram of a medicine dispensing machine inventory management system provided by an embodiment of the present invention, the system includes a call detection module M1 and a call inventory module M2, and the specific modules are as follows:

[0075] The calling detection module M1 is used to call the task detection node of the scheduling service, and regularly detect whether the current time is within the preset time range according to the preset cycle; wherein the scheduling service is a distributed multi-node service, and a registration center is used to manage multiple nodes of each distributed multi-node service;

[0076] The inventory module M2 is called to call the inventory service and the cabinet service to execute the inventory task if it is detected that the current moment is within the preset time range. During the execution of the inventory task, the inventory statistics of the cabinet of the medicine dispensing machine are performed to obtain the corresponding inventory data, and the inventory data is written into the database; wherein the inventory data includes the inventory time, the number of medicines corresponding to one or more types of medicines to be counted placed in one or more medicine slots to be counted in the cabinet of the medicine dispensing machine, the inventory service and the cabinet service are distributed multi-node services, and a registration center is used to manage multiple nodes of each distributed multi-node service.

[0077] As a preferred solution, the inventory module M2 is called, which specifically includes an interaction unit 21 and an inventory unit 22. The specific details of each unit are as follows:

[0078] The interaction unit 21 is used to send a scheduling task notification message to the inventory service through the task scheduling node of the scheduling service if it is detected that the current time is within the preset time range, so that the inventory service obtains the medicine information of the medicine slots to be counted based on the scheduling task notification message, and sends the medicine information of the medicine slots to be counted to the cabinet service; wherein the medicine information of the medicine slots to be counted includes relevant information of one or more medicine slots to be counted, and medicine information corresponding to one or more types of medicines to be counted, and the inventory service and the cabinet service communicate using the MQTT protocol;

[0079] The inventory unit 22 is used to execute the inventory task through the cabinet service after the cabinet service receives the medicine information of the medicine slot to be counted; during the execution of the inventory task, the cabinet of the medicine dispensing machine is counted for inventory, the corresponding inventory data is obtained, and the inventory data is written into the database.

[0080] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0081] An embodiment of the present invention further provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute a method for managing inventory of medicine dispensing machines as described in embodiment 1.

[0082] An embodiment of the present invention further provides a terminal, comprising a processor, a memory, and a computer program stored in the memory; wherein the computer program can be executed by the processor to implement a drug dispensing machine inventory management method described in the first embodiment.

[0083] Preferably, the computer program can be divided into one or more modules / units (such as computer program, computer program), one or more modules / units are stored in the memory and executed by the processor to complete the present invention. One or more modules / units can be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program in the terminal.

[0084] The processor can be a central processing unit (CPU), or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor, or the processor can also be any conventional processor. The processor is the control center of the terminal, and various parts of the terminal are connected using various interfaces and lines.

[0085] The memory mainly includes a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, etc., and the data storage area can store related data, etc. In addition, the memory can be a high-speed random access memory, or a non-volatile memory, such as a plug-in hard disk, a smart memory card (Smart Med i aCard, SMC), a secure digital (Secure Digital, SD) card, and a flash card (Flash Card), etc., or the memory can also be other volatile solid-state storage devices.

[0086] It should be noted that the above-mentioned terminal may include, but is not limited to, a processor and a memory. Those skilled in the art will understand that the above-mentioned terminal is merely an example and does not constitute a limitation on the terminal. It may include more or fewer components, or a combination of certain components, or different components.

[0087] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0088] The present invention provides an inventory management method, system, medium and terminal for medicine dispensing machines. The task detection node of the scheduling service is called to regularly detect whether the current time is within a preset time range according to a preset cycle. If so, the inventory service and cabinet service are called to execute the inventory task. During the execution of the inventory task, the inventory statistics of the cabinet of the medicine dispensing machine are performed to obtain the corresponding inventory data, and the inventory data is written into a database. Through the above means, the inventory counting process of the cabinet of the medicine dispensing machine is automatically started at a specified time. Furthermore, the scheduling service, inventory service and cabinet service used to implement the scheduled automatic inventory counting function are distributed multi-node services, and the registration center is used to manage the multiple nodes of each distributed multi-node service to distribute the various services of the inventory counting system on multiple nodes. When a node fails, the tasks of the node can be automatically assigned to other healthy nodes to ensure the continuous and stable progress of the inventory counting work, thereby overcoming the stability problems of the traditional single-point system and realizing the scalability of the inventory counting system, so that the management personnel or the system can replenish the corresponding medicines in the cabinet of the medicine dispensing machine in time and accurately place them in the corresponding medicine slots according to the inventory data stored in the database, thereby ensuring that the medicine dispensing machine in the pharmacy can have medicines to dispense and avoiding the occurrence of dispensing errors caused by placing the wrong medicines in the medicine slots.

[0089] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for managing inventory of a medicine dispensing machine, characterized in that: include: Call the task detection node of the scheduling service to regularly detect whether the current time is within the preset time range according to the preset cycle; If so, the inventory service and cabinet service are called to execute the inventory task. During the execution of the inventory task, the cabinet of the medicine dispensing machine is counted for inventory, the corresponding inventory data is obtained, and the inventory data is written into the database; Among them, the inventory data includes the inventory time, the number of medicines corresponding to one or more types of medicines to be counted placed in one or more medicine slots to be counted in the cabinet of the medicine dispensing machine, the scheduling service, the inventory service and the cabinet service are distributed multi-node services, and a registration center is used to manage multiple nodes of each distributed multi-node service.

2. A method for managing inventory of medicine dispensing machines as claimed in claim 1, characterized in that: If so, the inventory service and cabinet service are called to perform the inventory task. During the execution of the inventory task, the cabinet of the medicine dispensing machine is counted for inventory, the corresponding inventory data is obtained, and the inventory data is written into the database, specifically: If it is detected that the current moment is within the preset time range, a scheduling task notification message is sent to the inventory service through the task scheduling node of the scheduling service, so that the inventory service obtains the medicine information of the medicine slots to be inventoried based on the scheduling task notification message, and sends the medicine information of the medicine slots to be inventoried to the cabinet service; wherein the medicine information of the medicine slots to be inventoried includes relevant information of one or more medicine slots to be inventoried, and medicine information corresponding to one or more types of medicines to be inventoried, and the inventory service and the cabinet service communicate using the MQTT protocol; After the cabinet service receives the medicine information of the medicine slot to be counted, the cabinet service performs the inventory task; During the execution of the inventory task, inventory statistics are performed on the cabinets of the medicine dispensing machines to obtain corresponding inventory data, and the inventory data is written into the database.

3. A method for managing inventory of medicine dispensing machines as claimed in claim 2, characterized in that: During the execution of the inventory task, the cabinet of the medicine dispensing machine is counted for inventory, the corresponding inventory data is obtained, and the inventory data is written into the database, specifically: During the execution of the inventory task, the infrared counter is called through the infrared counting node of the cabinet service, so that the infrared counter performs an infrared scan on one or more medicine slots to be counted of the cabinet of the medicine dispensing machine, and combines the infrared scanning result and the medicine information corresponding to one or more types of medicines to be counted to analyze and obtain the inventory data, and then sends the inventory data to the inventory service; wherein the inventory data includes the number of medicines corresponding to each type of medicine to be counted placed in each of the medicine slots to be counted; Through the inventory service, an inventory surplus and shortage analysis is performed based on the received inventory data, and the analysis results and the inventory data are written into a database.

4. A method for managing inventory of medicine dispensing machines as claimed in claim 2, characterized in that: After the cabinet service receives the medicine information of the medicine slot to be counted, the cabinet service performs the inventory task, specifically: When the cabinet service receives the medicine information of the medicine slot to be counted, the cabinet of the medicine dispensing machine is called for iterative control processing through the medicine dispensing detection node of the cabinet service. During each iterative control processing, the camera installed on the cabinet of the medicine dispensing machine is called to take real-time photos of the front of the cabinet of the medicine dispensing machine to obtain one or more cabinet image frames, and then the current one or more cabinet image frames are respectively input into a pre-built face detection model, so that the face detection model performs face detection on the current one or more cabinet image frames and outputs the face detection results corresponding to the current one or more cabinet image frames, until the face detection results corresponding to all the current cabinet image frames are no faces, then the iteration is stopped and it is determined that no one is taking medicine at the current moment, and then the inventory task is performed through the cabinet service.

5. A method for managing inventory of medicine dispensing machines as claimed in claim 4, characterized in that: The current one or more cabinet image frames are respectively input into the pre-built face detection model, so that the face detection model performs face detection on the current one or more cabinet image frames and outputs the face detection results corresponding to the current one or more cabinet image frames respectively, specifically: Input the current one or more cabinet image frames into the pre-built face detection model respectively; Through the face detection model, several windows are slid once or multiple times in the cabinet image frame input into the face detection model, and after each sliding is completed, the feature values ​​of each object in the current window are calculated, and then the feature values ​​of each object in the current window are input into the classifier in the face detection model, so that the classifier determines whether the current window contains a face, and obtains a window detection result of the current cabinet image frame, and then combines all the window detection results of the current cabinet image frame to analyze and output the face detection result corresponding to the current cabinet image frame; wherein, the size of each window is different.

6. A method for managing inventory of medicine dispensing machines as claimed in claim 4, characterized in that: The construction of the face detection model is specifically as follows: Build an initial detection model based on machine learning; Using the sample data set, the initial detection model is trained and verified, and the initial detection model that has completed the training and verification is used as a face detection model; The sample data set includes a plurality of positive samples and a plurality of negative samples, the positive samples are images containing human faces, and the negative samples are images not containing human faces.

7. A medicine dispensing machine inventory management system, characterized in that: include: A call detection module is used to call the task detection node of the scheduling service, and regularly detect whether the current time is within a preset time range according to a preset cycle; wherein the scheduling service is a distributed multi-node service, and a registration center is used to manage multiple nodes of each distributed multi-node service; An inventory counting module is called to call the inventory counting service and the cabinet service to execute the inventory counting task if it is detected that the current moment is within a preset time range. During the execution of the inventory counting task, inventory statistics are performed on the cabinet of the medicine dispensing machine to obtain corresponding inventory counting data, and the inventory counting data is written into a database; wherein the inventory counting data includes the inventory counting time, the number of medicines corresponding to one or more types of medicines to be counted placed in one or more medicine slots to be counted in the cabinet of the medicine dispensing machine, the inventory counting service and the cabinet service are distributed multi-node services, and a registration center is used to manage multiple nodes of each distributed multi-node service.

8. The medicine dispensing machine inventory management system according to claim 7, characterized in that: The calling inventory module specifically includes: The interaction unit is used to send a scheduling task notification message to the inventory service through the task scheduling node of the scheduling service if it is detected that the current moment is within a preset time range, so that the inventory service obtains the medicine information of the medicine slots to be inventoried based on the scheduling task notification message, and sends the medicine information of the medicine slots to be inventoried to the cabinet service; wherein the medicine information of the medicine slots to be inventoried includes relevant information of one or more medicine slots to be inventoried, and medicine information corresponding to one or more types of medicines to be inventoried, and the inventory service and the cabinet service communicate using the MQTT protocol; The inventory unit is used to execute the inventory task through the cabinet service after the cabinet service receives the medicine information of the medicine slot to be counted; during the execution of the inventory task, the inventory statistics of the cabinet of the medicine dispensing machine are performed to obtain the corresponding inventory data, and the inventory data is written into the database.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program; wherein, when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute a method for managing inventory of a medicine dispensing machine as described in any one of claims 1 to 6.

10. A terminal, characterized in that: It comprises a processor, a memory and a computer program stored in the memory; wherein the computer program can be executed by the processor to implement a drug dispensing machine inventory management method as described in any one of claims 1 to 6.