Regulated medicine closed-loop management system and method based on artificial intelligence
By using an AI-based closed-loop management system for controlled drugs, combined with multi-source sensors and a time-series classification model, abnormal medication use behavior can be identified and intercepted, and permissions can be dynamically adjusted. This solves the problems of accurate traceability, real-time perception, and data closure in the management of controlled drugs, and realizes full-process traceability from prescription issuance to empty box recycling.
Patent Information
- Application Number
- CN202611581833.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-13
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies for the management of controlled drugs have several drawbacks, including difficulty in accurately tracing single-dose dosage levels, lack of real-time detection of abnormal medication behavior, static medication access management, disconnect between in-hospital systems and external equipment, inability to prevent patients from obtaining drugs from external sources, and lack of closed-loop recycling and data verification mechanisms.
The system employs an AI-based closed-loop management system for controlled drugs, which includes a hospital management server, smart pillboxes, an AI monitoring module, a dynamic access control module, a prescription compliance monitoring module, and a closed-loop management module. It uses multi-source sensors to detect medication behavior, employs a time-series classification model to identify abnormal medication use, dynamically adjusts permissions, and enables full-process traceability from prescription issuance to empty pillbox recycling.
It enables the identification and interception of cross-institutional drug purchases, real-time monitoring of abnormal drug use, dynamic adjustment of drug use permissions, and ensures the integrity of the management process. It also establishes a complete data traceability chain for drugs from dispensing to administration, breaking down the data barriers between the HIS system and patient terminals.
Smart Images

Figure SMS_1 
Figure SMS_2
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent medical and pharmaceutical management technology, and in particular to a closed-loop management system and method for controlled drugs based on artificial intelligence. Background Technology
[0003] Currently, medical institutions mainly manage controlled drugs in the following ways:
[0004] (1) Traditional manual management model
[0005] Hospital pharmacies dispense medications based on doctors' prescriptions, and patients are responsible for their safekeeping and consumption after receiving the medication. Doctors monitor patients' medication use through regular follow-up visits, but cannot obtain real-time daily medication data. Once medications leave the hospital, their distribution and usage fall outside the medical institution's oversight.
[0006] (2) Simple electronic pillbox
[0007] Electronic pillboxes with timed reminder functions are already available on the market. Their basic structure includes a box body, a clock module, and a buzzer or voice reminder module. These pillboxes emit a reminder signal at a preset time, but there is no closed-loop feedback relationship between the issuance of the reminder signal and whether the pillbox has been opened or the medication has been removed. Patients can open the pillbox at will, and the data is stored locally and cannot be integrated with the hospital system.
[0008] (3) Lockable medicine box
[0009] Adding an electronic or mechanical lock to the electronic pillbox locks it in place outside of medication administration times. The electronic lock and control module control the opening of the lid, preventing patients from forcibly opening it to retrieve the medication. Its limitations include: simple locking logic, unlocking only according to a preset time, lacking intelligent analysis capabilities; inability to integrate with hospital management systems; and inability to detect and warn of vandalism or external medication purchases.
[0010] (4) Drug management module of hospital information system
[0011] Mainstream HIS systems all include drug management functions, but their management scope is limited to the pharmacy dispensing process and cannot extend to the actual medication use behavior of patients outside the hospital.
[0012] (5) Remote access control system
[0013] For example, CN122417277A discloses a remote medication access management system and method for controlled drugs, which realizes the transformation from "one-time authorization" to "periodic dynamic authorization" through a basic pool management module, a periodic evaluation module, and a dynamic authorization module. However, its technical solution does not involve physical-level sensor perception and real-time behavior recognition, and the permission adjustment relies on periodic evaluation rather than real-time triggering.
[0014] (6) Medication-taking behavior perception system
[0015] For example, CN121726066A discloses a chronic disease health monitoring system based on a smart medicine box, which uses millimeter-wave radar and wearable devices for synchronous monitoring and data fusion judgment through machine learning; CN121774808A discloses a medication monitoring method based on a smart portable medicine box, which monitors medication retrieval behavior through gesture sensors and strain pressure sensors; CN121622460A discloses a smart medicine box and reminder method for psychiatric medication adherence management. The above technical solutions focus on "sensing whether the patient is taking medication," but do not involve physical obstruction or prescription source interception.
[0016] (7) Multimodal sensing smart pillbox
[0017] For example, CN120199411A discloses an intelligent medicine box management system based on multimodal perception and adaptive learning; CN122598929A discloses an AI-based intelligent medicine box that captures the flip-top trigger signal through a multimodal perception array. These technical solutions focus on drug identification and medication reminders, and do not involve the prevention and control of abuse of controlled drugs.
[0018] (8) Anesthetic drug traceability system
[0019] CN122415120A discloses a method and system for tracing narcotic drugs based on intelligent combination pillboxes. Each pillbox is equipped with a unique electronic tag, and combined with biometric verification and multimodal sensor monitoring, real-time traceability and anomaly detection are achieved. This solution focuses on the traceability of narcotic and psychotropic drugs within hospitals (the entire process management of drugs from procurement, storage, dispensing to use), addressing the problems of "drug loss and mismatch".
[0020] (9) Drug Recycling Management System
[0021] CN114732723B discloses a drug management and recycling box that uses RFID detection devices, electronic locks, facial recognition, and card swiping to complete the issuance and return of drugs.
[0022] Based on the aforementioned existing technologies, the current management of controlled substances presents a "divide and conquer" approach. Consequently, the following technical shortcomings exist:
[0023] 1. Relying on manual registration and barcode scanning makes it difficult to achieve accurate traceability of single-dose dosage levels.
[0024] 2. Lack of real-time detection of abnormal medication behavior: There is a lack of automatic identification methods for abnormal behaviors such as repeated medication collection, collection outside the prescribed time, and forced opening of the box, resulting in a delayed response.
[0025] 3. Static medication access control: Access is mostly granted on a one-time basis and cannot be dynamically adjusted according to the patient's real-time behavior.
[0026] 4. Disconnect between in-hospital systems and out-of-hospital equipment: There is a lack of two-way data interaction between the HIS system and the smart medicine box.
[0027] 5. Inability to prevent patients from obtaining medications from external sources: Current technologies focus on managing already distributed medications and lack the ability to detect and block additional medications obtained from other hospitals or pharmacies.
[0028] 6. Lack of closed-loop recycling and data verification mechanism: Focusing only on the dispensing and reminder process, there is a lack of standardized procedures for empty box recycling and verification. Summary of the Invention
[0029] In view of the aforementioned deficiencies in the prior art, this invention provides a closed-loop management system and method for controlled drugs based on artificial intelligence. It identifies, warns against, and intercepts cross-institutional drug purchases during the prescription process, identifies and triggers warnings when patients exhibit abnormal behavior, and ensures the integrity of the management process through empty box recycling and data verification. This constructs a complete data traceability chain for drugs from dispensing to consumption, realizing a closed-loop management system for controlled drugs with full traceability from prescription issuance to empty box recycling. Furthermore, it has the ability to dynamically adjust permissions according to the patient's status, breaking down data barriers between the HIS system and the patient's terminal.
[0030] To achieve the above objectives, the present invention provides an artificial intelligence-based closed-loop management system for controlled drugs, including a hospital management server, a smart pillbox, an AI monitoring module, a dynamic access control module, a prescription compliance monitoring module, and a closed-loop management module;
[0031] The hospital management server is deployed inside the medical institution and is connected to the HIS system through a standardized interface. It is used to receive and store prescription information and generate medication plans.
[0032] The smart pillbox has a unique electronic tag that is linked to the medication plan, and includes several independent medication storage units and collects the status data of the smart pillbox in real time;
[0033] The AI monitoring module is deployed on the hospital management server or cloud to receive and analyze the status data uploaded by the smart medicine box, and uses a trained time series classification model to identify abnormal medication behavior from sensor data.
[0034] The dynamic permission management module is deployed on the hospital management server and dynamically adjusts the permissions of medicine boxes based on AI risk scores and remote assessment results.
[0035] The prescription compliance monitoring module is deployed on the hospital management server to monitor patients’ behavior of obtaining controlled drugs in various medical institutions, thus blocking external drug purchases at the source of prescriptions.
[0036] The closed-loop management module is used to monitor the entire closed-loop process of medication dispensing records, medication monitoring, empty box recycling, and data verification.
[0037] Furthermore, the smart pillbox includes a pressure sensor, a Hall sensor, an accelerometer / gyroscope, and an environmental sensor. All sensors are synchronized with the same system clock source to form a multi-source heterogeneous sensor array, which is used to sense the drug dispensing behavior on the pillbox.
[0038] Furthermore, the smart pillbox includes a communication module that supports cellular networks and a mechanism for resuming data transmission even after network outages.
[0039] Furthermore, the AI monitoring module adopts a temporal classification model based on a long short-term memory network. It extracts feature vectors from the raw sensor data collected by each sensor. The input of the temporal classification model is set as the sequence of feature vectors over continuous time steps. The model structure is from the input layer to the long short-term memory network layer to the fully connected layer to the output layer. The output includes the probability distribution of five types of behavior.
[0040] Furthermore, the AI risk score uses the probability of abnormal behavior as one of the input features and is calculated through a weighted summation.
[0041] Furthermore, the dynamic permission management module compares the calculated AI risk score with a preset threshold and uses a three-level early warning system to automatically trigger permission status switching.
[0042] Furthermore, the permission status includes full authorization, limited authorization, and suspended authorization.
[0043] In a preferred embodiment of the present invention, an artificial intelligence-based closed-loop management method for controlled substances is provided. The artificial intelligence-based closed-loop management system for controlled substances includes three trigger chains. The first trigger chain includes monitoring medication administration based on dispensing records; the second trigger chain includes generating a medication plan and detecting dispensing records; and the third trigger chain includes empty box recycling and data verification.
[0044] The three trigger chains work together to complete the closed-loop management of controlled drugs.
[0045] Furthermore, the first trigger chain specifically includes the following steps:
[0046] Step S0: After the hospital management server starts up, it establishes a connection with the HIS system and the regional health information platform. When the smart medicine box is activated for the first time, it sends a registration request to the server.
[0047] Step S1: The doctor issues a prescription for controlled drugs through the HIS system, which is then reviewed by the pharmacist and entered into the system.
[0048] Step S2: The prescription compliance monitoring module queries the patient's prescription acquisition records, including cross-institutional prescription acquisition records, and conducts risk screening.
[0049] Step S3: When a risk condition is triggered, send an interception command to the HIS system;
[0050] Step S4: After the screening is passed, the medication plan generation module automatically generates a medication plan, and the medicine box binding module binds the patient information and medication plan.
[0051] Step S5: Pharmacy staff load the medicines into each storage unit according to the medication plan;
[0052] Step S6: The control module of the smart pillbox unlocks and triggers a reminder at a preset time;
[0053] Step S7: The status acquisition module of the smart medicine box acquires and uploads the status data from the sensors;
[0054] Step S8: The AI monitoring module analyzes the status data, and the dynamic permission management module adjusts permissions based on the analysis results.
[0055] Furthermore, the status data is analyzed using an AI monitoring module, including the following steps:
[0056] Step S8-1: Preprocess the state data, including removing outliers, filling in missing data, aligning multi-source events, and extracting features.
[0057] Step S8-2: Input the extracted feature vector into the trained LSTM time-series classification model to obtain the distribution probability of the five types of behavior;
[0058] Step S8-3: Calculate the risk score based on the distribution probability of the five types of behaviors.
[0059] Technical effect
[0060] This invention provides a closed-loop management system and method for controlled drugs based on artificial intelligence. This system and method, through the integration and synergistic effects of various modules, enables the identification, early warning, and interception of cross-institutional drug purchases at the prescription stage, blocking the source of external drug purchases. It identifies and triggers early warnings when patients exhibit abnormal behavior, utilizing a smart pillbox and AI monitoring module to monitor and intelligently identify abnormal medication use in real time. Furthermore, a dynamic permission management module dynamically adjusts medication permissions based on the patient's real-time status, providing the ability to dynamically adjust permissions according to the patient's condition. Finally, empty box recycling and data verification ensure the integrity of the management process, thus constructing a complete data traceability chain for drugs from dispensing to consumption. This achieves a closed-loop management system for controlled drugs with full traceability from prescription issuance to empty box recycling. The system and method of this invention utilize a two-way interactive architecture that breaks down data barriers between the hospital HIS system and the smart pillbox, and also breaks down data barriers between the HIS system and the patient's terminal.
[0061] The following will further explain the concept, specific structure, and technical effects of the present invention in order to fully understand the purpose, features, and effects of the present invention. Detailed Implementation
[0062] To make the technical problems, solutions, and beneficial effects of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0063] In the following description, specific details, such as particular internal procedures and techniques, are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will appreciate that the invention may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of the invention with unnecessary detail.
[0064] This invention provides an artificial intelligence-based closed-loop management system for controlled drugs, including a hospital management server, a smart pillbox, an AI monitoring module, a dynamic access control module, a prescription compliance monitoring module, and a closed-loop management module.
[0065] From an application layer perspective, each module is actually divided into the physical layer, transmission layer, platform layer, application layer, and user layer. For example, the hardware of the smart pillbox is the physical layer, the communication module in the smart pillbox is the transmission layer, the hospital management server is the platform layer, the AI monitoring module, dynamic permission management module, prescription compliance monitoring module, and closed-loop management module are the application layer, and the doctor terminal and guardian terminal of the system are the user layer.
[0066] Specifically, the hospital management server is deployed within the medical institution and connects to the HIS system through a standardized interface. It receives and stores prescription information and generates medication plans (including patient identification, drug name, specifications, single dose, administration time, medication cycle, and total treatment duration). The hospital management server includes:
[0067] Prescription parsing module: Retrieves prescription data from the HIS system, parses drug name, specifications, quantity, usage and dosage, and performs format validation and exception handling.
[0068] Medication plan generation module: Automatically generates a structured medication plan based on the prescription information parsed by the prescription parsing module.
[0069] Pillbox binding module: Assign a unique electronic tag to each smart pillbox to bind patient information and medication plan.
[0070] Data storage module: Uses a relational database or time-series database to store the entire process data, configured with master-slave backup, automatically switches to slave node when master node fails, and performs a full backup every morning.
[0071] The smart pillbox has a unique electronic tag linked to the medication plan and includes several independent medication storage units that collect real-time status data. The smart pillbox contains N independent medication storage units (N≥7), where the value of N is limited by national regulations on the maximum safe dosage per prescription for this type of controlled drug. Each storage unit has an independent lid and holds a single dose. The units are arranged in order of medication administration time.
[0072] The smart pillbox also includes an electronic lock system, a control module, a status acquisition module, a communication module, a power module, a biometric identification module, and a tamper detection module. In this embodiment, the electronic lock system is a miniature electronic lock (e.g., an electromagnetic lock or a miniature servo motor driven). Each pill storage unit cover is equipped with a miniature electronic lock, each lock is independently controlled, and the control module unlocks them one by one according to the medication plan. The miniature electronic locks in this embodiment can be configured to automatically maintain a locked state (normally closed electromagnetic lock) when the system is powered off, and automatically detect the status of each electronic lock after the system power is restored. The control module specifically uses a low-power microcontroller as the core processor, including: an RTC submodule, a high-precision clock chip, periodically calibrated via NTP; a storage submodule, a Flash memory, storing the encrypted medication plan; an execution submodule, sending an unlock signal to the corresponding electronic lock at a preset time, and simultaneously triggering an audio-visual reminder after unlocking; an overtime locking submodule, automatically relocking if no medication retrieval action is detected within a preset time window after unlocking; and an OTA upgrade submodule, supporting over-the-air upgrades. The status acquisition module collects data from various sensors in real time, including pressure sensors (e.g., thin-film type, located at the bottom of each drug storage unit): detecting pressure changes caused by drug removal; Hall effect sensors (located at each electronic lock): detecting the opening and closing of the cover; accelerometers / gyroscopes (e.g., six-axis MEMS type, located inside the box): detecting attitude changes; temperature and humidity sensors: monitoring the storage environment; and photoelectric pairs (located at the bottom of the drug storage unit or the drug dispensing port): confirming whether the drug has been actually removed. All sensors can be configured to use the same system clock source for time synchronization. The sampling frequency can be adjusted according to actual power consumption and accuracy requirements.
[0073] The smart pillbox is configured to support at least one of cellular networks (e.g., 4G / 5G / NB-IoT), Wi-Fi, and Bluetooth (BLE). It also features a network interruption recovery mechanism, meaning that when the network is interrupted, data is temporarily stored in local storage and automatically retransmitted after network recovery. Data integrity is verified using a validation mechanism. The smart pillbox's power module is a rechargeable lithium polymer battery with overcharge / over-discharge / short circuit protection and tiered power management. The biometric recognition module of the smart pillbox uses one of a fingerprint sensor, a facial recognition camera, or a voiceprint recognition module to verify the identity of the person taking the medication, and can be set to automatically switch to an alternative verification method if consecutive recognition attempts fail. Microswitches or flexible circuit board breakage detection lines can be installed at key structural points such as the pillbox lid hinge and the medication storage unit partition.
[0074] The AI monitoring module is deployed on the hospital's management server or in the cloud. It receives and analyzes status data uploaded by the smart pillbox and uses a trained time-series classification model to identify abnormal medication use from sensor data. The specific modeling process includes the following steps:
[0075] (1) Data preparation and labeling
[0076] Training data may come from one or a combination of the following sources:
[0077] First, there are publicly available behavior recognition datasets, such as the MHEALTH dataset (containing data from 10 volunteers wearing various sensors during daily activities), the WISDM dataset (containing acceleration data collected by 51 users using smart devices), and the UCI-HAR dataset (containing acceleration and gyroscope data collected by 30 volunteers using smartphones). These datasets are all publicly available labeled data in this field, containing multi-channel sensor signals from accelerometers, gyroscopes, and other sensors, along with their corresponding behavior category labels.
[0078] Secondly, data was collected by volunteers in a controlled environment simulating various scenarios of taking medicine from a medicine box, including normal medicine taking, taking medicine outside of the prescribed time, repeated medicine taking, attempts to forcefully open the box, and abnormal displacement of the box.
[0079] Third, transfer learning is performed using publicly available pre-trained models, such as the HART model (a lightweight human activity recognition pre-trained model based on the TSPulse architecture), the LIMU-BERT-X model (a sensor-based model pre-trained on large-scale IMU data), or the IGN-HAR model (a CNN model pre-trained on public datasets). These pre-trained models have been pre-trained on large-scale public sensor data and can be directly used for the initialization of the system's behavior recognition task. Further fine-tuning with a small amount of labeled data is sufficient to adapt them to the medicine box dispensing scenario.
[0080] Data annotation was completed independently by at least two professionals. Annotation categories included normal medication dispensing, dispensing medication outside of the prescribed time, repeated dispensing, attempts to forcibly open the box, and abnormal box displacement. Data was included in the training set after the annotation consistency met preset requirements (e.g., a Kappa coefficient of no less than 0.85). The training, validation, and test sets were divided in a 6:2:2 ratio.
[0081] (2) Feature extraction
[0082] Extract the following 7-dimensional feature vector from the raw sensor data:
[0083] Medication dispensing time deviation, which is the difference between the actual medication dispensing time and the planned medication dosing time, is measured in minutes and is used to determine whether the patient has taken their medication on time.
[0084] The duration of the medication retrieval action, which is the time difference between the opening and closing of the cover, is measured in seconds and is used to determine whether the medication retrieval action is abnormally slow or rushed.
[0085] Peak acceleration, or the maximum value of the triaxial composite acceleration, is used to determine whether the medicine box has been impacted.
[0086] Pressure change, measured in grams, is the difference between the weight before and after medication removal. It is used to confirm whether the medication has actually been removed.
[0087] The opening frequency, i.e. the number of times the lid has been opened in the past hour, is used to identify repeated opening behavior in a short period of time.
[0088] The continuous medication interval, which is the time difference between the current medication collection and the previous medication collection, is measured in minutes and is used to determine whether the medication collection time interval is abnormal.
[0089] The degree of urgency, or the time derivative of acceleration, is used to distinguish between normal medication-taking actions and violent impacts.
[0090] Before feature extraction, the raw data was filtered using a sliding window with a width of 5 sampling points to remove outliers exceeding 3 standard deviations. Missing data was processed using linear interpolation or forward imputation. All sensor data were aligned to a unified time axis based on the Hall sensor trigger time.
[0091] (3) Model structure design
[0092] A temporal classification model based on a Long Short-Term Memory (LSTM) network is employed. The input to this model is a sequence of the aforementioned 7-dimensional feature vectors over continuous time steps. The time step can be set according to the required recognition accuracy, for example, it can be set to 24. The output is the probability distribution of five types of behavior, specifically including normal medication retrieval, medication retrieval outside the prescribed time, repeated medication retrieval, forced opening attempts, and abnormal displacement of the box.
[0093] The model structure is: input layer → Long Short-Term Memory (LSTM) network layer → fully connected layer → output layer. The number of hidden units in the LSM layer can be determined based on validation set performance, for example, 64 to 256 units, and the dropout rate can be set to 0.2 to 0.5 to prevent overfitting. The fully connected layer contains 64 units and uses the ReLU activation function. The output layer contains 5 units and uses the Softmax activation function.
[0094] Long Short-Term Memory (LSTM) networks control the long-term memory of information through gating mechanisms. The forget gate determines which information is discarded from the previous cell state, the input gate determines which new information is stored in the current cell state, the cell state update completes the information transfer, and the output gate determines the output at the current time. These gating mechanisms employ standard calculation formulas, and their weight matrices and bias terms are optimized through backpropagation during training. These formulas are standard mathematical expressions for LTM networks, and those skilled in the art can implement them based on the above descriptions.
[0095] The hidden states output by the Long Short-Term Memory (LSTM) network are mapped through a fully connected layer, and the Softmax function outputs the probability distributions of five behavior categories. The category with the highest probability is taken as the recognition result, and this probability value is denoted as P_abnormal. It serves as the input to the subsequent risk scoring unit. Random forest, gradient boosting tree, or Transformer architectures can also be used.
[0096] (4) Model training
[0097] Training employs supervised learning, using the cross-entropy loss function as the optimization objective. True labels are one-hot encoded, and predicted values are the probabilities of each class output by the model. The Adam optimizer is used for parameter updates, with the learning rate set to its default value (e.g., 0.001). The number of training epochs is determined based on validation set performance (e.g., 100 to 200 epochs), and an early stopping strategy is implemented (training stops when the validation set loss fails to decrease for several consecutive epochs) to prevent overfitting. Model evaluation is performed on an independent test set, using a comprehensive evaluation based on metrics such as accuracy, precision, recall, and F1-score.
[0098] (5) Model Deployment and Updates
[0099] The trained model weights are deployed to the inference environment of the hospital management server. Model updates can employ one or a combination of the following strategies:
[0100] Regular incremental training, that is, fine-tuning the model every quarter using newly accumulated labeled data.
[0101] Triggered retraining means that retraining is triggered when the model's evaluation metric on the validation set drops below a preset threshold.
[0102] Online learning involves continuously collecting feedback data during system operation to progressively update the model.
[0103] When the Long Short-Term Memory network model fails to infer (e.g., the output probability distribution is too flat or the confidence level is too low), the system automatically switches to the backup rule engine (a simple judgment based on feature thresholds) to ensure the continuity of the AI monitoring function.
[0104] The extracted feature vectors are input into the previously deployed LSTM temporal classification model. The model outputs the probability distributions for five types of behavior: normal medication retrieval, medication retrieval outside the prescribed time, repeated medication retrieval, forced opening attempt, and abnormal box displacement. The system's decision logic is as follows:
[0105] If the category corresponding to the highest probability is normal medication pickup, and the probability value is greater than the preset threshold (the preset threshold can be determined by maximizing the Youden exponent of the ROC curve, for example, it can be set between 0.6 and 0.8), then it is judged as normal behavior, the medication pickup log is recorded, and subsequent warnings and permission adjustment processes are not triggered.
[0106] If the probability of any abnormal category exceeds the anomaly determination threshold, it is determined to be abnormal behavior. The anomaly category and probability value are recorded as P_abnormal, and the process proceeds to the risk scoring calculation. The anomaly determination threshold can be set to 0.60 to 0.70. In this embodiment of the invention, the specific value can be determined by maximizing the Youden exponent of the ROC curve.
[0107] The risk score R is calculated using the following formula:
[0108] R = α × P_abnormal + β × F_frequency + γ × H_severity + δ × C_compliance
[0109] Wherein, P_abnormal is the probability of current abnormal behavior, which comes from the output of the LSTM model; F_frequency is the incidence rate of abnormal behavior in the past 7 days, which is the ratio of the number of abnormal behaviors to the number of times medication should be taken; H_severity is the patient's historical risk level, which can be preset to three levels: low risk, medium risk, or high risk based on past records, with corresponding values such as 0.2, 0.5, and 0.8; and C_compliance is the medication adherence in the past 30 days, which is the ratio of the number of times medication was actually taken to the number of times medication was planned to be taken.
[0110] Each weight satisfies α+β+γ+δ=1. The following are some exemplary values for each weight: α=0.35, β=0.25, γ=0.20, δ=0.20. These values can be calibrated using analytic hierarchy process (AHP) or logistic regression fitting based on clinical data.
[0111] After the calculation is completed, the system will weight and update the current R value with the patient's historical risk score to form an updated patient risk profile, which will be stored in the data storage module.
[0112] The system compares the calculated R value with a preset threshold. In this embodiment of the invention, a three-level early warning system is adopted, and the early warning classification rules are as follows:
[0113] Level 3 Warning (Low Risk): Triggered when R reaches or exceeds the medium-risk threshold but is below the high-risk threshold, and is a single abnormality. The system records the warning log and updates the patient's risk profile, but does not actively push notifications. The default range for the medium-risk threshold is 0.65 to 0.75, which can be set based on the 75th percentile of risk scores in historical data.
[0114] Level 2 Warning (Medium Risk): Triggered when R reaches or exceeds the medium risk threshold but falls below the high risk threshold, and two consecutive abnormalities occur. The system pushes a warning notification via the guardian's terminal app, and simultaneously triggers a brief alert sound from the smart pillbox. The warning information includes patient identification, warning level, type of abnormal behavior, risk score, time of occurrence, and recommended treatment measures.
[0115] Level 1 Warning (High Risk): Triggered when R reaches or exceeds the high-risk threshold. The system sends a notification to the attending physician and emergency contact via SMS and the app, while simultaneously triggering a continuous alarm sound from the smart pillbox until manually confirmed and deactivated. The default range for the high-risk threshold is 0.80 to 0.90, which can be set based on clinical experts' assessment criteria for high-risk behaviors.
[0116] Each threshold can be dynamically calibrated based on the actual data distribution during system operation. The warning information includes patient identification, warning level, type of abnormal behavior, risk score, time of occurrence, and recommended treatment.
[0117] The dynamic access control module is deployed on the hospital management server and dynamically adjusts medication box permissions based on AI risk scores and remote assessment results. The dynamic access control module includes a basic pool management submodule, a periodic assessment submodule, and a dynamic authorization submodule. The basic pool management submodule stores patient medication access data approved upon initial diagnosis and treatment. The periodic assessment submodule triggers a remote assessment process for patients before the start of each period. The dynamic authorization submodule dynamically adjusts medication box permissions, and its permission status includes…
[0118] Status A (Fully Authorized): Automatically unlocked, allowing patients to collect their medication independently.
[0119] Status B (Restricted Authorization): Two authentications required.
[0120] Status C (Suspended Authorization): Completely locked down, sending an emergency notification to the hospital.
[0121] The rules for dynamically adjusting pillbox permissions are as follows:
[0122] When the current status is A (fully authorized): if R reaches or exceeds the high-risk threshold or the periodic assessment result is "poor", then switch to status C (suspended authorization); if R is between the medium-risk threshold and the high-risk threshold or the periodic assessment result is "average", then switch to status B (restricted authorization); otherwise, maintain status A.
[0123] When the current status is B (Restricted Authorization): If R is below the anomaly detection threshold and the periodic evaluation result is "Good", then revert to status A (Full Authorization); if R reaches or exceeds the high-risk threshold or the periodic evaluation result is "Poor", then switch to status C (Suspended Authorization); otherwise, maintain status B. The default range for the anomaly detection threshold is 0.60 to 0.70.
[0124] When the current status is C (authorization suspended): there is no automatic exit, the status remains C, and it will be manually lifted after the doctor's follow-up visit.
[0125] To prevent frequent fluctuations in risk scores around the threshold from causing repeated permission switching, the system introduces a hysteresis mechanism: when R crosses the medium-risk threshold from low to high, a state switch is triggered immediately; when R falls back from high to low, it must fall below the medium-risk threshold minus a preset hysteresis value (for example, the hysteresis value can be set to 0.05) before a reverse switch can be made.
[0126] The prescription compliance monitoring module is deployed on the hospital management server to monitor patients' access to controlled drugs at various medical institutions, thus blocking external drug purchases at the source of prescriptions. The prescription compliance monitoring module includes:
[0127] (1) Prescription frequency detection submodule, which is used to maintain a prescription acquisition record table indexed by patient identity and to detect the number of prescriptions within a preset time window.
[0128] (2) Cross-institutional prescription comparison submodule, used to obtain patients' prescription history records in other medical institutions through the regional health information platform or medical insurance system interface. The interface protocol may include RESTful API over HTTPS, OAuth 2.0+ digital certificate two-way authentication, etc. The data format may be JSON.
[0129] Data privacy protection mechanisms include patient identifier desensitization (e.g., hashing), the principle of least data, transmission encryption, and operation auditing. When external interfaces are unavailable, the system automatically switches to a degraded mode.
[0130] (3) Prescription interception and linkage submodule, used to send an interception command to the HIS system when a risk condition is triggered.
[0131] (4) Prescription limit linkage submodule, used to link with the medical insurance reimbursement system.
[0132] The closed-loop management module monitors the entire process of medication dispensing records, medication monitoring, empty box recycling, and data verification. Specifically, it includes the following modules:
[0133] The medication dispensing record submodule is used to record the process of pharmacy staff putting medicines into smart pillboxes.
[0134] The medication monitoring submodule is used to receive and record data on each medication dispensing behavior uploaded by the smart pillbox.
[0135] The empty box recycling submodule is used for patients to return empty boxes during follow-up visits. The system automatically verifies the corresponding medication record against the actual medication collection record. If discrepancies are found, a discrepancy report can be automatically generated.
[0136] The data verification submodule is used to archive data and close the medication cycle after verification.
[0137] In a preferred embodiment of the present invention, an artificial intelligence-based closed-loop management method for controlled substances is provided. The artificial intelligence-based closed-loop management system for controlled substances includes three trigger chains. The first trigger chain includes monitoring medication administration based on dispensing records; the second trigger chain includes generating a medication plan and detecting dispensing records; and the third trigger chain includes empty box recycling and data verification.
[0138] The three trigger chains work together to complete the closed-loop management of controlled drugs.
[0139] Furthermore, the first trigger chain specifically includes the following steps:
[0140] Step S0: After the hospital management server starts up, it establishes a connection with the HIS system and the regional health information platform. When the smart medicine box is activated for the first time, it sends a registration request to the server.
[0141] Step S1: The doctor issues a prescription for controlled drugs through the HIS system, which is then reviewed by the pharmacist and entered into the system.
[0142] Step S2: The prescription compliance monitoring module queries the patient's prescription acquisition records, including cross-institutional prescription acquisition records, and conducts risk screening.
[0143] Step S3: When a risk condition is triggered, send an interception command to the HIS system;
[0144] Step S4: After the screening is passed, the medication plan generation module automatically generates a medication plan, and the medicine box binding module binds the patient information and medication plan.
[0145] Step S5: Pharmacy staff load the medicines into each storage unit according to the medication plan;
[0146] Step S6: The control module of the smart pillbox unlocks and triggers a reminder at a preset time;
[0147] Step S7: The status acquisition module of the smart medicine box acquires and uploads the status data from the sensors;
[0148] Step S8 involves using the AI monitoring module to analyze status data, and the dynamic permission management module adjusting permissions based on the analysis results. Step S8 specifically includes the following steps:
[0149] Step S8-1 involves preprocessing the status data uploaded in step S7, including removing outliers, filling in missing data, aligning multi-source events, and extracting features. More specifically, after the data packet uploaded in step S7 arrives at the AI monitoring module, it first undergoes data integrity verification. The system verifies whether the data packet contains complete fields (including device identifier, patient identifier, timestamp, and readings of each sensor), checks whether the timestamp is within a reasonable range (the deviation from the current time does not exceed a preset threshold, such as 5 minutes), and confirms the integrity of the data packet. Data packets that fail verification are discarded and an anomaly log is recorded, while data packets that pass verification enter the preprocessing queue.
[0150] Data preprocessing includes the following four steps:
[0151] (1) Outlier removal: A sliding window mean filtering is used with a window width of 5 sampling points to remove outliers that exceed 3 times the standard deviation.
[0152] (2) Missing data imputation: For missing intervals of no more than 10 seconds, linear interpolation is used for imputation; for missing intervals of more than 10 seconds, forward imputation is used to replace the previous valid value.
[0153] (3) Multi-source data time alignment: Based on the trigger time of the Hall sensor (the instant the cover is opened), all sensor data are aligned to a unified time axis through linear interpolation, and the time deviation of each channel is controlled within ±10ms.
[0154] Then, feature extraction is performed on the preprocessed data, and the following 7 features are calculated from the aligned data: ΔT (drug dispensing time deviation, i.e., the difference between the actual drug dispensing time and the planned drug administration time, in minutes), T_duration (drug dispensing action duration, i.e., the time difference from when the Hall sensor is turned on to when it is turned off, in seconds), A_peak (peak acceleration, i.e., the maximum value of √(ax²+ay²+az²)), ΔP (pressure change, i.e., the weight before dispensing minus the weight after dispensing, in grams), F_open (opening frequency, i.e., the number of times the lid has been opened in the past hour), T_interval (continuous drug dispensing interval, i.e., the time difference between the current drug dispensing and the previous drug dispensing, in minutes), and S_jerk (jerkness, i.e., the time derivative of acceleration dA / dt).
[0155] Step S8-2: Input the extracted feature vector into the trained LSTM temporal classification model to obtain the distribution probability of the five types of behavior; specifically,
[0156] The aforementioned 7-dimensional feature vector (corresponding to 24 time steps) is input into a trained LSTM temporal classification model. The model structure is: Input layer (7 dimensions × 24 steps) → LSTM layer (128 hidden units, dropout=0.3) → Fully connected layer (64 units, ReLU activation) → Output layer (5 units, Softmax activation). The model output is the probability distribution of five behavior classes:
[0157] (1) Normal medication collection: medication collection is completed within the planned medication time window. Typical characteristics are that ΔT is in the range of 0.7 to 1.3 times the planned interval, T_duration is between 3 and 15 seconds, and A_peak is less than 1.5g.
[0158] (2) Taking medicine outside the prescribed time: The medicine taking time exceeds the planned window. The typical characteristics are that ΔT is greater than 2.0 times the planned interval or less than 0.5 times, and there are no violent destruction characteristics.
[0159] (3) Repeated drug dispensing: The same drug storage unit is opened 2 or more times within 24 hours, with the typical characteristic being that the interval between the last drug dispensing and the last dispensing is less than 24 hours.
[0160] (4) Forced opening attempt: an attempt to forcibly open the medicine box, characterized by an A_peak of more than 2.5g and a duration of less than 200ms.
[0161] (5) Abnormal displacement of the box: The medicine box moves abnormally continuously, with the typical feature being that the acceleration is abnormal for more than 5 seconds.
[0162] The category with the highest probability is taken as the recognition result, and this probability value is P_abnormal.
[0163] Step S8-3: Calculate the risk score based on the distribution probability of the five types of behaviors.
[0164] The specific process of calculating the risk score based on the distribution probability of the five types of behavior is as described above and will not be repeated here.
[0165] Step S8-4: Compare the calculated risk score with the set threshold to determine the risk level and issue an early warning.
[0166] In this embodiment, the anomaly detection threshold θ1 has a default range of 0.60 to 0.70. When P_abnormal reaches or exceeds θ1, it is determined to be an abnormal event, an anomaly log is recorded, and the process enters the R calculation flow. θ1 is determined by maximizing the Youden exponent of the ROC curve.
[0167] The medium-risk threshold θ2 has a default range of 0.65 to 0.75. A level 2 or 3 warning is triggered when R reaches or exceeds θ2. θ2 is set based on the 75th percentile of R values in historical data.
[0168] The high-risk threshold θ3 has a default range of 0.80 to 0.90. A Level 1 warning is triggered when R reaches or exceeds θ3. θ3 is set based on the assessment criteria for high-risk behaviors by clinical experts.
[0169] Each threshold can be dynamically calibrated based on the actual data distribution during system operation.
[0170] The tiered warning rules are as follows: Level 3 warning (low risk) is triggered when θ2≤R<θ3 and it is a single abnormality, recording the system log and updating the patient's risk profile; Level 2 warning (medium risk) is triggered when θ2≤R<θ3 and there are two consecutive abnormalities, pushing the notification to the guardian via the App and triggering a brief alarm sound on the medicine box; Level 1 warning (high risk) is triggered when R≥θ3, pushing the notification to the attending physician and emergency contact via SMS and the App, and the medicine box will continue to alarm until manual confirmation.
[0171] Then, the dynamic permission management module automatically triggers state transitions according to the R value and the current permission status, following specific rules described above. To prevent frequent fluctuations in risk scores around the threshold from causing repeated permission switching, the system introduces a hysteresis mechanism: when R crosses θ2 from low to high, a state transition is triggered immediately; when R falls back from high to low, it must fall below θ2-0.05 before switching back to the original state. The state transition command is sent from the hospital management server to the smart medicine box via the communication module, and takes effect at the moment the command arrives.
[0172] After the permission status change decision is completed, the hospital management server generates a permission instruction, which includes the following fields: patient identifier, medicine box identifier, target permission status (A / B / C), effective time, and decision basis (trigger condition). The instruction is sent to the smart medicine box via encrypted transmission.
[0173] After receiving the instruction, the smart pillbox performs the following operations: verifies the source and integrity of the instruction; updates the local permission status; executes the corresponding permission control when the effective time arrives (state A: normal unlock; state B: dual authentication enabled; state C: all unlocking actions disabled); and returns an execution confirmation signal (including an update completion timestamp) to the server.
[0174] If the instruction arrives later than the preset effective time due to network communication delay, it will take effect immediately based on the actual arrival time, and the delay will be recorded in the system log. If the medicine box does not return an execution confirmation signal within the preset time (e.g., no confirmation is received within 30 seconds), the server will automatically resend the instruction, retrying a maximum of 3 times. If a retry fails, an exception log will be recorded and an operation and maintenance alarm will be pushed. At this point, the first trigger chain is complete.
[0175] The second trigger chain includes generating a medication plan and monitoring medication dispensing records. After a prescription is issued by the HIS system, the prescription compliance monitoring module intercepts the prescription information and triggers a cross-institutional comparison process. This module queries the patient's prescription acquisition records within a preset time window (e.g., 30 days) through the regional health information platform or medical insurance system interface and compares them with prescriptions from this hospital. If the screening passes (no risk of duplicate drug purchase), the prescription information flows into the medication plan generation module and enters the medication box binding process. If the screening triggers a risk (e.g., the same controlled drug has been obtained from another institution within 30 days), the prescription interception and linkage submodule sends an interception command to the HIS system, popping up a risk warning window at the prescription issuance or review stage, preventing the prescription from entering the subsequent medication plan generation and medication box binding stages. The interception record is automatically archived to the data storage module as part of the patient risk profile.
[0176] The third trigger chain includes empty box recycling and data verification. When a patient returns the empty box during a follow-up visit, the system verifies the data and closes the medication cycle. Empty box recycling includes the empty box recycling trigger and data reading, as well as a comparison of the three items. Data verification includes normal verification procedures and abnormal verification procedures.
[0177] When empty box recycling is triggered, the smart medicine box is returned to the pharmacy when the patient returns it for a follow-up visit. Pharmacy staff scan the electronic tag (RFID or QR code) on the medicine box, and the system reads the unique identifier of the medicine box and starts the recycling process.
[0178] Data reading and three-item comparison: The system retrieves complete data records for the medicine box throughout the entire medication cycle.
[0179]
[0180] The system performs the following three comparisons:
[0181]
[0182] When all three comparisons pass, the system executes the following normal verification process: (1) close the medication cycle and record the completion status; (2) archive all data to the historical database; (3) generate a medication cycle report and push it to the attending physician; (4) release the electronic tag binding relationship of the medicine box and the medicine box enters the waiting-to-distribute state; (5) after cleaning and disinfection, the medicine box is reassigned to the next patient.
[0183] Any of the following conditions will trigger abnormal write-off: E001 (total deviation rate > 5% and ≤ 10%), E002 (frequency deviation rate > 5% and ≤ 10%), E003 (total or frequency deviation rate > 10%), E004 (existing Level 1 warning record), E005 (medicine box status is marked as abnormal).
[0184] E001 and E002 are minor deviations. The system automatically generates a deviation report and sends it to the pharmacist for review. The pharmacist fills in the deviation explanation in the system and then manually confirms the verification. E003 to E005 are serious deviations. The system automatically locks the electronic tag of the medicine box to prevent reassignment. The deviation report is sent to the attending physician and the head of the pharmacy department. It can only be manually released after the three parties have signed off.
[0185] The discrepancy report includes: patient basic information (after desensitization), start and end dates of the medication cycle, planned data (Q_plan, N_plan), actual data (Q_actual, N_actual), deviation amount and deviation rate, details of abnormal behavior events (time, type, risk level, and handling status), medicine box status record, and pharmacist review comments area.
[0186] The above three trigger chains constitute a complete closed loop of "front-end blocking - mid-end perception and control - back-end verification".
[0187] The following specific embodiments will illustrate the artificial intelligence-based closed-loop management system and method for controlled drugs provided by the present invention.
[0188] Taking a general hospital as an example, a hospital management server and an AI monitoring module are deployed on the hospital's intranet server. The smart pillboxes are custom-made by professional medical device manufacturers and distributed to patients who require treatment with controlled drugs.
[0189] Taking a patient requiring long-term antipsychotic medication as an example, after the prescription parsing module retrieves the prescription from the HIS system, the medication plan generation module automatically generates a medication plan. The pillbox binding module allocates smart pillboxes and sends the medication plan to the control module. Pharmacy staff then load the medications into the appropriate storage units according to the plan.
[0190] When the preset medication time arrives, the control module sends an unlock signal to the electronic lock of the corresponding medication storage unit. The patient opens the cover and retrieves the medication, and the status acquisition module records the medication retrieval behavior data.
[0191] When a patient attempts to retrieve medication outside of their scheduled medication time, the control module refuses to unlock, and the status acquisition module records the abnormal data. This data is uploaded to the AI monitoring module for analysis, and appropriate actions are triggered when abnormal behavior is detected.
[0192] Before the end of the medication cycle, the periodic assessment submodule automatically triggers a remote assessment, and the comprehensive assessment results are used to adjust the permission status for the next cycle.
[0193] When a patient attempts to obtain the same medication again from another hospital, the prescription compliance monitoring module triggers an alert through cross-institutional prescription comparison and sends an interception command to the HIS system.
[0194] When patients return their empty medication boxes for follow-up visits, the empty box recycling submodule verifies the corresponding medication record against the actual medication collection record. After successful verification, the data cancellation submodule archives the data and closes the medication cycle.
[0195] In this invention, the control parameters of each module (such as various thresholds, sampling frequencies, etc.) are range values that can be determined by those skilled in the art using conventional technical means. For example, the classification threshold can be selected through ROC curve analysis, the weight coefficients can be determined by pairwise comparisons and scoring by experts in the relevant field using the analytic hierarchy process, and the model hyperparameters can be selected using conventional methods such as grid search.
[0196] The system can be configured with various exception handling mechanisms, including data caching and network interruption resumption when communication is abnormal, degradation mode switching when external interface times out, backup solution switching when model inference fails, and automatic upgrade when review times out.
[0197] The control parameters of each module in this invention (including but not limited to various thresholds, sampling frequencies, sensor ranges, number of hidden units in the model, etc.) are all exemplary preferred ranges or conventional parameters that can be determined by those skilled in the art based on common knowledge. The specific values of the parameters can be optimized and determined through conventional experiments in specific application scenarios, and do not constitute a limitation on the scope of protection of this invention.
[0198] The following example illustrates the specific implementation of the system of the present invention by taking the process of a patient with depression, A, using the system of the present invention to complete a full medication cycle.
[0199] Patient A, a 35-year-old male, was diagnosed with depression and was required to take sertraline hydrochloride tablets (50mg / tablet) for a long period of time. The doctor prescribed one tablet once a day before bedtime (21:00) for a course of 28 days.
[0200] Before the start of the medication cycle (Day 0), the doctor issues a prescription through the HIS system. The prescription information (including patient A's identification, drug name sertraline tablets, specification 50mg / tablet, total quantity 28 tablets, once daily, one tablet each time, and time of administration 21:00) is reviewed by the pharmacist and then entered into the system of this invention. The system assigns a smart pillbox (number MB202609001) to the patient. The pillbox contains 28 independent storage units, numbered A1 to A28. The pillbox binding module binds the unique electronic tag of the pillbox to the patient's identification and medication plan. The medication plan generation module generates a structured medication plan based on the prescription information, stipulating that the corresponding storage units are unlocked at 21:00 each day from Day 1 to Day 28. Pharmacy staff then fill the 28 sertraline tablets into storage units A1 to A28 and distribute the pillbox to patient A.
[0201] (1) Days 1 to 14: Normal medication period
[0202] Patient A takes the medication on time according to the medication plan. Every night at 21:00, the RTC submodule of the pillbox control module is triggered, sending unlock signals to the storage units A1 to A14 one by one according to the corresponding date. The buzzer sounds and the LED indicator flashes. Patient A opens the cover, takes out the medication, and closes the cover.
[0203] Taking day 1 (September 1st) as an example, the sensor recorded the following data:
[0204] Pressure sensor reading: 5.2g before dispensing, 0.3g after dispensing, pressure change 4.9g, indicating the tablet has been removed. Hall effect sensor recorded the lid opening time as 21:00:15, the lid closing time as 21:00:20, and the duration of the dispensing action as 5 seconds. Accelerometer recorded a triaxial composite acceleration peak of 0.8g, within the normal range for dispensing (normal range is below 1.5g).
[0205] The above data, packaged by the status acquisition module, is uploaded to the hospital management server via the communication module. The AI monitoring module preprocesses the data and extracts feature vectors. The feature parameters for this medication retrieval are: retrieval time deviation ΔT = 0 minutes (actual retrieval time matches the planned time), retrieval action duration T_duration = 5 seconds, peak acceleration A_peak = 0.8g, pressure change ΔP = 4.9g, cap opening frequency F_open = 1 time / hour (only for this retrieval), continuous retrieval interval T_interval = 1440 minutes (24 hours after the last retrieval), and jerk S_jerk is within the normal range.
[0206] The LSTM model outputs the following probabilities for each category: normal medication retrieval 0.92, medication retrieval outside the designated time 0.04, repeated medication retrieval 0.02, forced opening attempt 0.01, and abnormal box displacement 0.01. The category with the highest probability is normal medication retrieval, and since the probability value of 0.92 is greater than the preset threshold of 0.70, it is judged as normal behavior. Medication retrieval logs are recorded, no alerts are triggered, and the permission status remains at state A (fully authorized).
[0207] From day 2 to day 14, patient A's medication-collecting behavior pattern was basically the same as on day 1. The AI monitoring module analyzed the data daily, and the risk score R remained between 0.21 and 0.28 (below the medium-risk threshold of 0.65). The system continued to record normal behavioral data and did not trigger any warnings.
[0208] (2) Day 15: Occurrence and identification of abnormal behavior
[0209] On day 15 (September 15th) at 14:30 (outside of the scheduled medication time), Patient A, in a state of emotional distress, attempted to open the pillbox to retrieve medication ahead of schedule. The control module detected an unauthorized unlocking request (current time is 14:30, and the scheduled unlocking time for this medication storage unit A15 is 21:00) and refused to send an unlocking signal. Patient A attempted to forcefully pry open the lid; the Hall sensor recorded that the lid was pried open (a brief high-level signal was followed by a return to normal), and the accelerometer recorded a triaxial composite acceleration peak of 4.2g, lasting 120ms.
[0210] The status acquisition module packages and uploads abnormal data. After processing by the AI monitoring module, the characteristic parameters are calculated as follows: A_peak = 4.2g, duration 120ms (the typical characteristics of a forced opening attempt are A_peak reaching more than 2.5g and duration less than 200ms), ΔT = -6.5 hours.
[0211] The LSTM model outputs the following probabilities for each category: normal medication retrieval 0.05, medication retrieval outside the specified time 0.30, repeated medication retrieval 0.02, forced opening attempt 0.92, and abnormal box displacement 0.10. The category with the highest probability of 0.92 is forced opening attempt, which is greater than the anomaly detection threshold of 0.60, and is therefore classified as an abnormal event, with P_abnormal=0.92 recorded.
[0212] Risk score R calculation: α=0.35, β=0.25, γ=0.20, δ=0.20, F_frequency=0.14 (one abnormal behavior in the past 7 days, 7 medications required), H_severity=0.5 (patient A is at medium risk), C_compliance=1.0 (good compliance in the past 30 days). R=0.35×0.92+0.25×0.14+0.20×0.5+0.20×1.0=0.322+0.035+0.10+0.20=0.677.
[0213] R=0.677 exceeds the medium-risk threshold of 0.65, and since it is a single abnormality, a level 3 warning (low risk) is triggered. The system records the warning log and updates the patient's risk profile (risk score increases from 0.25 to 0.45, cumulative number of abnormal behaviors changes from 0 to 1, and the abnormality type is "forced box opening attempt").
[0214] Since R did not exceed the high-risk threshold of 0.80 and this was a single event, the permission status remains at state A. However, the system has automatically updated the risk level marker for patient A, suggesting a moderate increase in the sensitivity of subsequent monitoring.
[0215] (3) Day 16: Abnormal behavior reoccurs and permissions are switched
[0216] On day 16 (September 16) at 03:00 (night), patient A attempted to retrieve medication again, exhibiting a similar pattern to day 15, but with increased intensity. The accelerometer recorded a peak triaxial synthetic acceleration of 5.1g, lasting 95ms.
[0217] The LSTM model outputs a probability of 0.93 for a brute-force open-box attempt. The R-squared values are: F_frequency = 0.25 (2 instances of abnormal behavior in the past 7 days, totaling 8 instances requiring medication), H_severity = 0.5, C_compliance = 1.0. The R-squared values are: R = 0.35 × 0.93 + 0.25 × 0.25 + 0.20 × 0.5 + 0.20 × 1.0 = 0.3255 + 0.0625 + 0.10 + 0.20 = 0.688.
[0218] The risk score (R) of 0.688 reached the medium-risk threshold of 0.65, and there were two consecutive abnormalities (on days 15 and 16), triggering a level-two warning. The system pushed a warning notification through the patient's guardian's terminal app: "Patient A engaged in violent box-opening behavior at 03:00 on September 16, with a risk score of 0.688. It is recommended to pay attention to the patient's emotional state."
[0219] At the same time, the dynamic permission management module automatically switches the permission status from status A (full authorization) to status B (restricted authorization) according to the rules (current status A, R is between the medium risk threshold and the high risk threshold).
[0220] Once the permission switching command is issued to the smart pillbox and takes effect, Patient A must meet the following conditions to retrieve medication daily: fingerprint recognition verification is successful, and the guardian can unlock the current unit only after confirming the dynamic authorization code through the App.
[0221] (4) Days 17 to 27: Restricted Authorization Phase
[0222] After the permissions are switched to state B, Patient A continues to take medication with the cooperation of the guardian. Taking 21:00 on the 17th day (September 17th) as an example, Patient A needs to perform double verification to complete the medication collection: First, the identity is verified by fingerprint recognition. After the verification is successful, the system sends an authorization request to the guardian's terminal. After the guardian confirms in the App, a dynamic authorization code is generated. Patient A enters the authorization code on the medicine box, and the medicine box unlocks unit A17.
[0223] From day 17 to day 27 (11 days in total), patient A successfully obtained medication through double verification and did not attempt to obtain medication again during this period. The daily risk score gradually decreased from 0.62 to 0.35.
[0224] (5) Day 28: Empty box recycling and data verification
[0225] At the end of the medication cycle (day 28), Patient A returned for a follow-up visit and returned the empty medication box. Pharmacy staff scanned the electronic tag on the medication box (MB202609001), and the system automatically retrieved the data records for the entire medication box cycle.
[0226] Planned data: Q_plan = 28 pieces, N_plan = 28 times.
[0227] Actual data: Q_actual=27 tablets, N_actual=27 times (the attempt to forcefully open the box on day 15 failed to obtain the medication, so no actual medication was obtained and therefore not included in the actual medication record).
[0228] Abnormal behavior record: 2 attempts to forcibly open the box (days 15 and 16).
[0229] Medicine box status: Normal (the anti-vandalism detection module did not trigger the breakage detection line during the two forced opening attempts, and the medicine box structure is intact).
[0230] The system performs three comparisons: total deviation rate = (28-27) / 28 = 3.6% (≤5%), frequency deviation rate = (28-27) / 28 = 3.6% (≤5%), and the first-level warning record check passes (no first-level warning). With all three comparisons passed, the system performs normal verification: the medication cycle is closed, data is archived, and a medication cycle report is generated.
[0231] The medication cycle report includes: Patient A's medication collection records over 28 days (time and method of 27 medication collections), details of abnormal behavior events (one attempt to forcibly open the box on day 15 and day 16, risk level and handling result), records of changes in access status (status A from day 1 to day 16, status B from day 17 to day 28), and medication adherence of 96.4% (27 / 28).
[0232] Based on the report and the patient's clinical follow-up assessment, the attending physician decided to continue using Status B (restricted authorization) for the next cycle until the patient's emotions stabilize, at which point a reassessment would be made regarding whether to revert to Status A. The electronic tag binding on the medicine box was released, and after cleaning and disinfection, it entered the distribution pending state.
[0233] The above embodiments fully demonstrate the entire process of the system of the present invention during a 28-day medication cycle: from prescription issuance, medication plan generation, and pillbox distribution, to daily medication process status collection, normal behavior identification, triggering of three-level and two-level early warnings for abnormal behavior, automatic switching of permission status from A to B, and finally, empty pillbox collection, data comparison and verification, and generation of medication reports at the end of the cycle. Through the collaborative work of sensor data collection, LSTM model inference, risk score calculation, threshold comparison, and the permission state machine, the system successfully identified and intervened in patients' subjective malicious overdose behavior, maintaining medication adherence at a level of 96.4%, while ensuring that the pillbox was not actually damaged, guaranteeing the traceability and closed-loop management of the entire process data. The above data are merely illustrative examples of the working principle of the system of the present invention; specific values can be adjusted according to actual application scenarios and individual patient differences, and do not constitute any limitation on the present invention.
[0234] The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make numerous modifications and variations based on the concept of the present invention without creative effort. Therefore, all technical solutions that can be obtained by those skilled in the art based on the concept of the present invention through logical analysis, reasoning, or limited experimentation on the basis of existing technology should be within the scope of protection defined by the claims.
Claims
1. A closed-loop management system for controlled drugs based on artificial intelligence, characterized in that, This includes a hospital management server, a smart pillbox, an AI monitoring module, a dynamic access control module, a prescription compliance monitoring module, and a closed-loop management module. The hospital management server is deployed inside the medical institution and is connected to the HIS system through a standardized interface. It is used to receive and store prescription information and generate medication plans. The smart pillbox has a unique electronic tag that is bound to the medication plan, and includes several independent drug storage units and collects the status data of the smart pillbox in real time. The AI monitoring module is deployed on the hospital management server or cloud and is used to receive and analyze the status data uploaded by the smart medicine box, and to use a trained time series classification model to identify abnormal medication behavior from sensor data. The dynamic permission management module is deployed on the hospital management server and dynamically adjusts the permissions of medicine boxes based on AI risk scores and remote assessment results. The prescription compliance monitoring module is deployed on the hospital management server to monitor patients’ behavior of obtaining controlled drugs in various medical institutions, thereby blocking external drug purchases from the source of prescriptions. The closed-loop management module is used to monitor the entire closed-loop process of medication dispensing records, medication monitoring, empty box recycling, and data verification.
2. The artificial intelligence-based closed-loop management system for controlled drugs as described in claim 1, characterized in that, The smart pillbox includes a pressure sensor, a Hall sensor, an accelerometer / gyroscope, and an environmental sensor. All sensors are synchronized with the same system clock source to form a multi-source heterogeneous sensor array, which is used to sense the drug dispensing behavior on the pillbox.
3. The artificial intelligence-based closed-loop management system for controlled drugs as described in claim 2, characterized in that, The smart pillbox includes a communication module that supports cellular networks and a mechanism for resuming data transmission after network outages.
4. The artificial intelligence-based closed-loop management system for controlled drugs as described in claim 1, characterized in that, The AI monitoring module adopts a time-series classification model based on a long short-term memory network. It extracts feature vectors from the raw sensor data collected by each sensor. The input of the time-series classification model is set as the sequence of the feature vectors over continuous time steps. The model structure is from the input layer to the long short-term memory network layer to the fully connected layer to the output layer. The output includes the probability distribution of five types of behavior.
5. The artificial intelligence-based closed-loop management system for controlled drugs as described in claim 4, characterized in that, The AI risk score uses the probability of abnormal behavior as one of the input features and is calculated by weighted summation.
6. The artificial intelligence-based closed-loop management system for controlled drugs as described in claim 5, characterized in that, The dynamic permission management module compares the calculated AI risk score with a preset threshold and uses a three-level early warning system to automatically trigger permission status switching.
7. The artificial intelligence-based closed-loop management system for controlled drugs as described in claim 6, characterized in that, The permission status includes full authorization, restricted authorization, and suspended authorization.
8. A closed-loop management method for controlled drugs based on artificial intelligence, characterized in that, The AI-based closed-loop management system for controlled drugs includes three trigger chains: the first trigger chain includes monitoring medication administration based on dispensing records; the second trigger chain includes generating a medication plan and checking dispensing records; and the third trigger chain includes empty box recycling and data verification. The three trigger chains work together to complete the closed-loop management of controlled drugs.
9. The closed-loop management method for controlled drugs based on artificial intelligence as described in claim 8, characterized in that, The first trigger chain specifically includes the following steps: Step S0: After the hospital management server starts up, it establishes a connection with the HIS system and the regional health information platform. When the smart medicine box is activated for the first time, it sends a registration request to the server. Step S1: The doctor issues a prescription for controlled drugs through the HIS system, which is then reviewed by the pharmacist and entered into the system. Step S2: The prescription compliance monitoring module queries the patient's prescription acquisition records, including cross-institutional prescription acquisition records, and conducts risk screening. Step S3: When a risk condition is triggered, send an interception command to the HIS system; Step S4: After the screening is passed, the medication plan generation module automatically generates a medication plan, and the medicine box binding module binds the patient information and medication plan. Step S5: Pharmacy staff load the medicines into each storage unit according to the medication plan; Step S6: The control module of the smart pillbox unlocks and triggers a reminder at a preset time; Step S7: The status acquisition module of the smart medicine box acquires and uploads the status data from the sensors; Step S8: The AI monitoring module analyzes the status data, and the dynamic permission management module adjusts permissions based on the analysis results.
10. The closed-loop management method for controlled drugs based on artificial intelligence as described in claim 9, characterized in that, The analysis of the status data using the AI monitoring module includes the following steps: Step S8-1: Preprocess the state data, including removing outliers, filling in missing data, aligning multi-source events, and extracting features. Step S8-2: Input the extracted feature vector into the trained LSTM time-series classification model to obtain the distribution probability of the five types of behavior; Step S8-3: Calculate the risk score based on the distribution probability of the five types of behaviors.
Citation Information
Patent Citations
Medication management recycling box
CN114732723B
Intelligent medicine chest management system based on multi-modal perception and adaptive learning
CN120199411A
Psychiatric medication compliance management intelligent medicine box and reminding method
CN121622460A
Medicine use monitoring and reminding method based on intelligent portable medicine box and intelligent portable medicine box
CN121774808A
Poison and anesthesia medicine tracing method and system based on intelligent combined medicine box
CN122415120A
