A Real-Time, Automatic, and Dynamic Scheduling and Control System for PET Patients Based on Wearable Sensors

Positron emission tomography (PET) is one of the commonly used scanning techniques. Medical staff manually calculate the estimated scan time for each PET device. However, the number of PET scanning devices is small, the number of patients is large, and there are many changes including rescanning requirements, which makes it very error-prone, puts pressure on staff, and causes trouble for patients and their families. Although previous studies proposed algorithms for specific inspections, there is currently no research on improving the PET process. This paper proposes a real-time automatic scheduling and control system for PET patients with wearable sensors. The system can automatically schedule, estimate and instantly update the time of various tasks, and automatically allocate beds and announce schedule information in real time. We implemented this system, collected time data of 200 actual patients, and put these data into the implementation program for simulation and comparison. The average time difference between manual and automatic scheduling was 7.32 min, and it could reduce the average examination time of 82% of patients by 6.14 ± 4.61 min. This convinces us the system is correct and can improve time efficiency, while avoiding human error and staff pressure, and avoiding trouble for patients and their families.


Introduction
Hospital medical equipment resources are often in short supply. Equipment scheduling control is an important issue. This issue is roughly divided into three categories: "reservation scheduling", "real-time scheduling" and "smart device applications".

Reservation Scheduling
There are many different outpatient clinics in the hospital, as well as multiple physical examination devices. However, the patient examination needs exceed the medical resources. The resources provided by the hospital are in short supply; thus, good scheduling is required to resolve the problem. Burdett et al. [1] robustly scheduled appointments by strategically inserting buffer times, and they combined simulated annealing and evolutionary search to improve schedule ability. Jiang et al. [2] found that most studies on appointment systems assume that patients arrive at the appointment time, but the actual situation is not the case. Therefore, they proposed a random planning appointment scheduling system considering late patients, using Benders decomposition combined with the sample average approximation (BD-SAA) technique to find the best appointment time that reaches the least patient waiting time and doctor idle time. Qiu et al. [3] proposed algorithms using NSGA-II (non-dominated sorting genetic algorithm II) and MOEA/D (multiobjective evolutionary algorithm based on decomposition) for a single MRI device to arrange the order of appointment and appointment time for patients of different types Some patients have multiple examinations in the hospital, and some examinations have multiple tasks [16][17][18]. Without proper time control, patients will spend a lot of time waiting. By recording the start and end time of each task, we can analyze the data and reduce patient waiting time.
Frisby et al. [19] proposed a new method for controlling patients in the emergency room. Each doctor wore a medical Bluetooth device and installed a Bluetooth signal receiver in each bed. Within the acceptable range, the treatment time was automatically recorded, which effectively reduced the doctor's work. Ewing et al. [20] and Elnahrawy et al. [21] used an instant positioning system to collect data on the patient's movements in the hospital and the time spent at each station to analyze the data and improve the hospital workflow. Kortbeek et al. [15] developed a frame that combines data collection with electronic medical records for data analysis. This method effectively understands the flow of patients in various areas of the hospital and can be used to control different situations in the future. Naruse et al. [22] set up a Beacon signal receiver made using Raspberry Pi in the room to detect the Beacon signal. When someone enters the room, they identify the Beacon, transmit the Beacon data to the database, and calculate the duration of the Beacon carrier stay. This paper proposes a method for arranging beacon signal receivers (i.e., mobile phones) in various areas of PET, receiving signals from patients wearing Beacon devices, and automatically recording the time of patients during various inspection tasks, saving medical staff time for manual transcription and improving overall automation.

Current Status and Issues of PET Patient Scheduling
Many PET standard tasks are performed during the inspection, and the cycle time of the medicine varies from part to part. Currently, medical staff use manual methods to calculate the estimated scan time for each PET device. However, the number of PET scanning devices is extremely small, while the number of patients is quite large. Moreover, there are many changing conditions such as different arriving times of both scheduled and temporary patients, constant calculations for different examination items and different beds and drug waiting times, and rescanning requirements for some patients who failed to scan.
Manual scheduling is very error-prone and puts pressure on staff. Coupled with this constantly changing schedule, it is difficult to announce the estimated time to patients and their families in real time, causing family members to constantly ask medical staff about various conditions such as waiting time, which not only consumes the medical staff's physical and mental strength, but also results in unsmooth processes.
Previous researches  proposed algorithms for specific examinations to solve the problem of equipment resource allocation, as well as calculate outpatient visit time for outpatient clinics. However, there is currently no research on improving the PET process. Therefore, we propose an automatic scheduling method to improve the current PET patient scheduling problem.

Overview of Results
This paper proposes a real-time, automatic, and dynamic scheduling and control system for PET patients with wearable sensors (Bluetooth Beacon) positioning. This system can automatically schedule, estimate, and update the start and end time of various tasks of PET patients during the examination, and it can automatically allocate beds and realtime announce schedule information, allowing the schedule being automated, instant, and almost optimized. This can greatly reduce the work of medical staff, avoid human error, improve medication safety, and allow medical staff, patients, and family members to instantly check the progress of the inspection and estimated waiting time, reducing the need for patients and family members to ask medical staff. We also implemented the proposed method in the Android system to prove the feasibility of the system.
We also developed an app (i.e., a mobile phone application) that can automatically collect data. This app collected various "manually scheduled" data from 200 actual patients in the Department of Nuclear Medicine of Linkou Chang Gung Hospital as a control group. We also fed the initial situation of the same 200 original data collected by the above-implemented Android system and obtained various "auto-scheduled" data as the experimental group. It was found that the average time difference between the "manually scheduled control group" and the "auto-scheduled experimental group" was 7.32 min, indicating the correctness of this method. Furthermore, the "auto-scheduled experimental group" could reduce the average examination time of 82% of patients by 6.14 ± 4.61 min, which proves the progress of this method.

Our Contribution
This paper is the first to propose a novel and real-time automatic scheduling and control system for PET patients. The system provides the following functions: (1) realtime automatic scheduling, (2) scheduling for different medicines, (3) dynamic update of prediction time, (4) immediate provision of predictive inspection time, (5) automatic allocation of general and specific beds, (6) automatic detection of all patients' tasks periods, (7) automatic detection and prediction of examination room conditions, and (8) instant rescheduling. The major contribution is that the proposed system can greatly reduce the work of medical staff, avoid human error, improve medication safety, and allow medical staff, patients, and family members to instantly check the progress of the inspection and estimated waiting time, reducing the need for patients and family members to ask medical staff. The value-added contribution is that the system can reduce the average examination time of 82% of patients by 6.14 min. Moreover, our method has portability, which means that our detailed methods and implementation content can be easily transplanted to PET patient scheduling in other hospitals or can be suitable for scheduling similar to this situation.

Methods
This section explains the system requirements and the detailed scheme of the proposed system. In the inspection schedule of PET, due to the many conditions and changes to be considered, such as the limitation of the time limit of special drugs, limited medical equipment, and possible rescanning, manual scheduling and time control are quite difficult. This paper proposes a real-time automatic scheduling and control system for PET examination, which can instantly estimate the examination time, allocate medical resources, and respond to possible rescanning in time.

System Requirement
System requirements of the proposed system are described in Definition 1.

Definition 1.
(System requirements). The proposed scheme should meet the following conditions: (1) real-time automatic scheduling: the system performs real-time automatic scheduling according to the patient registration time; (2) scheduling for different medicines: the system schedules the best inspection time according to the cycle time of different medicines; (3) dynamic update of prediction time: when a new patient checks in, or after the end of each examination task of the patient, the system immediately updates the expected prediction task time of each patient; (4) providing predictive inspection time immediately: the system provides the predicted inspection time to the medical staff, patients, and their families in real time; (5) automatic allocation of general and specific beds: the system automatically allocates suitable beds to patients waiting for beds according to all patients' inspection task completion status; (6) automatic detection of all patients' tasks periods: the system automatically detects the start time and end time of each examination task of all patients; (7) automatic detection and prediction of examination room conditions: automatic detection and prediction of the use and idle periods of each examination room; (8) instant rescheduling: the system automatically arranges patients who need to be rescanned.

Details of the Proposed System
The traditional PET examination process is shown in Figure 1. According to Definition 1 and Figure 1, we propose a new scheduling and control system (Figure 2), which contains five roles and eight phases.

System Requirement
System requirements of the proposed system are described in Definition 1.

Definition 1.
(System requirements). The proposed scheme should meet the following conditions: (1) real-time automatic scheduling: the system performs real-time automatic scheduling according to the patient registration time; (2) scheduling for different medicines: the system schedules the best inspection time according to the cycle time of different medicines; (3) dynamic update of prediction time: when a new patient checks in, or after the end of each examination task of the patient, the system immediately updates the expected prediction task time of each patient; (4) providing predictive inspection time immediately: the system provides the predicted inspection time to the medical staff, patients, and their families in real time; (5) automatic allocation of general and specific beds: the system automatically allocates suitable beds to patients waiting for beds according to all patients' inspection task completion status; (6) automatic detection of all patients' tasks periods: the system automatically detects the start time and end time of each examination task of all patients; (7) automatic detection and prediction of examination room conditions: automatic detection and prediction of the use and idle periods of each examination room; (8) instant rescheduling: the system automatically arranges patients who need to be rescanned.

Details of the Proposed System
The traditional PET examination process is shown in Figure 1. According to Definition 1 and Figure 1, we propose a new scheduling and control system (Figure 2), which contains five roles and eight phases.   The five roles are patient P i , medical staff MS, radiographer RD j , server S, and announcement screen, where MS is at the indwelling needle area in the IV indwelling needle room (or called the outer injection room) R IV and at the indwelling needle desk we equipped with a mobile device D MS and a beacon signal receiver RC MS . We also equipped with a radiographer RD j , a mobile device D RD j , and a beacon signal receiver RC j in the j-th examination room and on the injection area in the inner injection room. Both RC MS and RC j have functions to detect the content and strength of Beacon signals. Table 1 defines the symbols and parameters used in the proposed method.
The system is divided into seven phases and two algorithms: initial phase, patient check-in phase, patient indwelling needle phase, bed allocation phase, algorithm for scheduling examination room, estimating injection time and scan time, injection phase, scanning phase, end examination phase, and algorithm to determine Beacon's entry and exit from a certain area.   Table 1 defines the symbols and parameters used in the proposed method.
The system is divided into seven phases and two algorithms: initial phase, patient check-in phase, patient indwelling needle phase, bed allocation phase, algorithm for scheduling examination room, estimating injection time and scan time, injection phase, scanning phase, end examination phase, and algorithm to determine Beacon's entry and exit from a certain area.

P i
The i-th patient MS The medical staff (nurse) in R IV RD j The radiographer in the j-th scan room S Server R IV IV catheter indwelling room R I J Inner injection room R k The k-th examination room Bed j The j-th bed (j = 1, 2, 3, . . . )

Beacon j
The j-th Beacon rssi j The α-th element of the list A A(−α) The last α-th element of the list A b(P i ) Body status of P i (bedridden or non-bedridden) t abs (P i ) Drug absorption time of P i (e.g., 30 min) t The average IV catheter indwelling time until the α-th time t inj (α) The average injection time until the α-th time t ex (α) The average examination time until the α-th time Bed(P i ) The bed of P i Bcn(P i ) The Beacon of P i uuid(P i ) The UUID of P i

Notation Definition
Mrn(P i ) The medical record number for P i R(P i ) The scan/examination room for P i T CO (P i ) The examination check-out time for P i T e IV (P i )/T a IV (P i ) The estimated/actual IV catheter indwelling time for P i T e LIV (P i )/T a LIV (P i ) P i 's estimated/actual time to leave the IV room T e inj (P i )/T a inj (P i ) The estimated/actual injection time for P i (e.g., 10:00 a.m.) T e Linj (P i )/T a Linj (P i ) P i 's estimated/actual time to leave the injection room The estimated/actual time to enter the examination room for P i (e.g., 10:00 a.m.) The estimated/actual time to leave the examination room for P i (e.g., 10:00 a.m.) The bed vacated time of Bed j T BA (P i ) The bed available time for P i T EI (P i ) The earliest injection time for P i T ES (P i ) The earliest scan/examination time for P i T ES (P i |R k ) The earliest scan/examination time at R k for P i T I IF (P i ) Time for doctor to finish P i 's DICOM image interpretation :00, and the average task times t IV (0), t inj (0), and t ex (0) be their average time of the previous week.

Patient Check-In Phase
When P i checks in, MS configures a Beacon for P i , uses D MS to scan P i 's medicalrecord-number barcode Mrn(P i ), enters P i 's body status b(P i ) and Beacon serial number Bcn j , and sends Mrn(P i ), b(P i ), and Bcn j to S. Then, S calculates the estimated IV indwelling time as follows: followed by adding Mrn(P i ) to A IV . Finally, the patient waits in waiting area. The check-in process is shown in Figure 3.
followed by adding Finally, the patient waits in waiting area. The check-in process is shown in Figure 3.

Injection room
Med. record No.

MS Server
Annc. screen

Patient Indwelling Needle Phase
When the P i 's previous patient (i.e., P i−1 or P j ) indwelling needle ends and leaves R IV , S will receive the message that P i−1 (or P j ) has left R IV , and then automatically transfer A IV (1)'s Bcn(P i ) to RC MS , letting RC MS know that the next beacon to be determined whether the signal is to enter or leave is Bcn(P i ) (please refer to Section 2.2.9 for the detailed determine method). When the time is one minute before T e IV (P i ), S sends the indwelling needle notification to D MS (or MS checks D MS and judges that P i can be indwelling), and MS goes to the waiting area to notify P i to go to R IV to indwell needle. Otherwise, the patient can actively enter the room after receiving a notification (by sight (for the patient to see that the time is up), hearing (broadcasting the patient's name), or touching (by making the patient's pager vibrate through the wireless paging system).
When P i enters R IV , RC MS judges that P i has entered R IV indwelling needle and then informs S. S then captures the time of entering R IV as the start time of the indwelling needle T a IV (P i ), adds P i to A BR and deletes it from A IV , and calculates the actual and estimated time difference as follows: S then uses t di f f IV to update the estimated indwelling time for patients in A IV as follows: During P i indwelling, MS transmits t abs (P i ) to S via D MS . Next, S allocates an uptake room for patients in A BR , calculates the estimated injection time T e inj (P i ) and the estimated scan time T e EE (P i ) (for detailed methods, refer to Sections 2.2.4 and 2.2.5), and uses T e EE (P i ) to calculate the T e inj (P i ) back. After the indwelling needle is completed, P i leaves R IV to the waiting area to wait for the injection. At this time, RC MS automatically determines that P i is leaving R IV and sends a "P i has left R IV " message to S. Nest, S extracts the current time T a LIV (P i ), and calculates the length of the P i indwelling needle as follows: Finally, S calculates the average indwelling time from P 1 to P i as follows: The indwelling needle process is shown in Figure 4.

Bed Allocation Phase
After processing a "successful scan" patient P i , RD j uses D RD j to send T I IF (P i ) to S. S then runs Bed(P i ).isOccupied = f alse to vacate P i 's bed, and runs Bed(P j = A BR (1)) = assignBed(P j ) to assign this bed to the next waiting patient P j ( Figure 5). Additionally, when the patient P i indwelling needle ends, S performs the bed allocation algorithm Bed(P i ) = assignBed(P i ) to try to assign an vacated bed to P i .
There are three types of beds in the uptake room, and all three types can be allocated to general patients. However, bedridden patients can only use type-A beds, while patients with short drug absorption times (i.e., t abs = 30) are often allocated to type-B beds, while type-C Beds can be dispensed to short-absorption-time or general patients. We use "weight allocation" to calculate the priority of bed allocation in the uptake room. The allocation method is shown in Table 2, where 0 means not applicable.

Bed Allocation Phase
After processing a "successful scan" patient i P , Bed P A assignBed P = = to assign this bed to the next waiting patient j P ( Figure 5). Additionally, when the patient i P indwelling needle ends, S performs the bed allocation algorithm Bed P assignBed P = to try to assign an vacated bed to i P .
There are three types of beds in the uptake room, and all three types can be allocated to general patients. However, bedridden patients can only use type-A beds, while patients with short drug absorption times (i.e., 30 abs t = ) are often allocated to type-B beds, while type-C Beds can be dispensed to short-absorption-time or general patients. We use "weight allocation" to calculate the priority of bed allocation in the uptake room. The allocation method is shown in Table 2, where 0 means not applicable.     S chooses the unoccupied bed with the highest weight as Bed(P i ). If P i is allocated to a bed, S extracts the current time as T BA (P i ), and adds P i to A inj and removes it from A BR . S then runs the algorithm for estimating scan time: estimateEETime(P i ) ( Figure 6). Otherwise, if P i is not allocated to any bed, P i continues to wait at A BR until there is a vacated bed in the uptake room.  Figure 6). Otherwise, if i P is not allocated to any bed, i P continues to wait at BR A until there is a vacated bed in the uptake room. Figure 6. Algorithm for estimating examination process time. T P ( Figure 6).
If i P is a patient who has not completed the indwelling needle, S lets i P 's fastest in-

Algorithm for Scheduling Examination Room, and Estimating Injection and Examination Time
After executing assignBed(P i ), S then executes the algorithm estimateEETime(P i ) one by one for patients whose injection has not been estimated in A inj , where estimateEETime(P i ) is used for arranging the examination room R(P i ), as well as estimating the injection time T e inj (P i ) and start/end examination time T e EE (P i )/T e LE (P i ) ( Figure 6). If P i is a patient who has not completed the indwelling needle, S lets P i 's fastest injectable time Next, S separately determines which of T ES (P i ) and T e LE (A R k (−1)) is earlier to find out the fastest available scan time T ES (P i |R k ) in each examination room R k , where T e LE (A R k (−1)) is the estimated time to leave the examination room R k for the last patient waiting for R k . For R k , if T ES (P i ) ≥ T e LE (A R k (−1)), it means the fastest scan time T ES (P i |R k ) of P i in R k is T ES (P i ). Otherwise, it means P i has the opportunity to scan before T e LE (A R k (−1)). Therefore, S searches for free time space between T ES (P i ) and T e LE (A R k (−1)). If there is enough time (higher than the average examination time (t ex ) in the time space between T e LE (A R k (α − 1)) and T e EE (A R k (α)) or between T e EE (A R k (α)) and T ES (P i ), it means P i can perform examinations in the free time gap between "patient A R k (α − 1) end scan" and "patient T e EE (A R k (α)) start scan". Because T ES (P i ) may fall before T e LE (A R k (α − 1)), that is, T ES (P i ) is just when A R k (α − 1) is inspecting, this situation is not feasible. Therefore, the fastest time for scan should be T e LE (A R k (α − 1)) to be a reasonable time. T ES (P i ) may also fall behind A R k (α − 1); hence, the fastest available time can be T ES (P i ) directly. Therefore, S chooses T ES (P i |R k ) = max{T ES (P i ), T e LE (A R k (α − 1))}. If there is not enough time between T ES (P i ) and T e LE (A R k (−1)), then let T ES (P i |R k ) be T e LE (A R k (−1)). Finally, S selects the minimum value from T ES (P i R j ) ∀j = 1, 2, . . . as T e EE (P i ), uses it to compute the estimated injection time T e inj (P i ) and estimated end examination time T e LE (P i ), and adds P i to A R k .

Injection Phase
When the P i injection ends and leaves R I J , S will receive the message of "P i is leaving R I J ", and then automatically pass Bcn(P i ) from A inj (1) to RC 0 to let RC 0 know the next beacon determining entry or exit is Bcn(P i ) (please refer to Section 2.2.9 for the detailed Beacon algorithm). When the time is one minute before T e inj (P i ), S sends an injection notification to D RD 0 . After receiving the notice, RD 0 goes to the waiting area and tells P i to go to R I J to inject.
When P i enters R I J , RC 0 judges that Bcn(P i ) enters R I J for injection and informs S. S then extracts the current time as the injection start time T a inj (P i ) and removes P i from A inj . When P i leaves R I J to Bed(P i ) at the end of the injection, RC 0 judges that Bcn(P i ) has left R I J and notifies S. S extracts the current time as the departure time T a Linj (P i ), and calculates P i 's injection length as follows: Finally, S calculates the average injection time from P 1 to P i as follows: The patient injection process is shown in Figure 7.

Scanning Phase
When the P i examination ends and leaves R k , S will receive the message of "P i is leaving R k ", and then automatically pass Bcn(P i ) from A R k (1) to RC j to let RC j know the next beacon determining entry or exit is Bcn(P i ) (please refer to Section 2.2.9 for the detailed Beacon algorithm). When the time is 5 min before T e EE (P i ), S sends an examination notification to D RD j . After receiving the notice (or RD j determines that P i can be scanned via checking D RD j ), RD j goes to the uptake room and tells P i to go to R k to wait for examination.
When P i enters R k , RC j judges that Bcn(P i ) enters R k and informs S. S then extracts the current time as the examination start time T a EE (P i ) and removes P i from A R k . If RD j , which monitors the patient's photographic image in the background, judges that P i 's scan image is successful, they use D RD j to transmit T I IF (P i ) to S. S empties Bed(P i ), and then automatically allocates the bed to a patient in A BR . In addition, P i needs go to R IV to pull the needle and return the Beacon to complete the inspection.
If RD j judges that the scan image of P i fails, then P i needs to be scanned again. RD j uses D RD j to select a patient so that P i should be rescanned after the patient's end examination. S then updates all the estimated examination times of the patients who are injected in A R k , clears the estimated injection and examination times of all patients in A inj , and re-executes estimateEETime(P i ) to calculate the new estimated injection and examination times of all patients.
When P i leaves R(P i ) at the end of examination, RC j judges that Bcn(P i ) has left R(P i ) and notifies S. S extracts the current time as the departure time T a LE (P i ), and calculates P i 's examination length as follows: Finally, S calculates the average scan time from P 1 to P i as follows: The patient examination process is shown in Figure 8.

End Examination Phase
Patient P i , who was successfully examined, would return to the injection room, remove the needle, and return their Beacon. MS then clicks the end button via D MS to inform S, and completes the PET inspection ( Figure 9).

Algorithm to Determine Beacon's Entering or Leaving from a Certain Area
RC MS or RC j can judge whether Bcn(P i ) enters/leaves an area on the basis of whether rssi(Bcn(P i )) is "greater than th H " or "less than th L " (Figure 10). However, when P i approaches the entrance to the area, the value of rssi(Bcn(P i )) will oscillate back and forth between th H and th L , making it impossible to determine whether P i enters or leaves the area. Therefore, we designate that rssi(Bcn(P i )) must be detected greater than th H (or less than th L ) more than five consecutive times before it can be judged as entering (or leaving).   i rssi Bcn P is "greater than H th " or "less than L th " (Figure 10). However, Figure 9. End examination process. i rssi Bcn P is "greater than H th " or "less than L th " (Figure 10). However, when i P approaches the entrance to the area, the value of ( ( )) i rssi Bcn P will oscillate back and forth between H th and L th , making it impossible to determine whether i P enters or leaves the area. Therefore, we designate that ( ( )) i rssi Bcn P must be detected greater than H th (or less than L th ) more than five consecutive times before it can be judged as entering (or leaving).

Materials
We first collected the status and time data of various tasks and examinations of 200 actual patients at the Linkou Chang Gung Hospital as a PET medical database and control group. We also implemented the proposed system in the Android system, and we fed the

Materials
We first collected the status and time data of various tasks and examinations of 200 actual patients at the Linkou Chang Gung Hospital as a PET medical database and control group. We also implemented the proposed system in the Android system, and we fed the patient's physical condition, check-in time, and rescan status of the PET medical database data collected above into our implementation system, using the obtained time data as the experimental group. Lastly, we carried out data analysis to compare and analyze the results of the experimental group and the control group.

Data Collection of Control Group
We set up receivers in five places in Linkou Chang Gung Hospital ( Figure 11). We let actual patients wear the Beacon and perform PET inspection procedures under the current manual scheduling method, and we recorded time data and examination information of 200 patients for two consecutive weeks (12 days).
We used a desktop computer (using the Windows 10 operating system, Intel (R) Xeon (R) central processing unit (CPU) E3-1230 with a 3.3 GHz and 3.7 GHz processor and 8 GB random-access memory (RAM) as the server to collect data, calculate, and process communication matters. We also used four Android 5.0 operating system phones, including three HTC Desire816 (Qualcomm S400 1.6 GHz quad-core processors) as Beacon signal receivers in three scan rooms to determine patients' location in or out of the room, while another HTC One E8 (Qualcomm S801 2.5 GHz quad-core processor) was responsible for inputting and transmitting patient examination information to the server. We chose THLight's B3029 T as the Beacon for each patient.
As for the software, we used Android Studio and JAVA to develop our own programs, adopted the library provided by THLight for Beacon control and signal reading, and chose MySQL database tools as the back-end database collection.
grams, adopted the library provided by THLight for Beacon control and signal reading, and chose MySQL database tools as the back-end database collection.
The system program structure of data collection was divided into six parts according to different tasks: nurse device during check-in phase, nurse device during indwelling needle, radiographer device during injection, radiographer app on the scan room side, server, and receivers in scan rooms. The communication method between the server and the mobile devices of the medical staff was Wi-Fi. The screens of the mobile phone app operated by the medical staff at each inspection stage are described below.   The system program structure of data collection was divided into six parts according to different tasks: nurse device during check-in phase, nurse device during indwelling needle, radiographer device during injection, radiographer app on the scan room side, server, and receivers in scan rooms. The communication method between the server and the mobile devices of the medical staff was Wi-Fi. The screens of the mobile phone app operated by the medical staff at each inspection stage are described below.

Patient Check-In
When the patient checks in, the nurse at the needle indwelling area of the injection room enters the patients' report information screen. Because there are many numbers in the patients' medical record number, it is easy to make mistakes when manually inputting it. Therefore, the scan button "SCAN" was designed to scan the one-dimensional barcode of the medical record number to reduce error ( Figure 12). When the patient checks in, the nurse at the needle indwelling area of the injection room enters the patients' report information screen. Because there are many numbers in the patients' medical record number, it is easy to make mistakes when manually inputting it. Therefore, the scan button "SCAN" was designed to scan the one-dimensional barcod of the medical record number to reduce error ( Figure 12).

Indwelling Needle and Injection Phase
The interfaces of the medical staff during the indwelling phase and during the injec tion phase are the same (Figure 13). The medical staff enters the patient information re

Indwelling Needle and Injection Phase
The interfaces of the medical staff during the indwelling phase and during the injection phase are the same (Figure 13). The medical staff enters the patient information required for the examination. When the needle or injection is started, the start button "STA" is clicked to capture the start time. When the indwelling needle or injection ends, the button is clicked again to grab the end time.

Indwelling Needle and Injection Phase
The interfaces of the medical staff during the indwelling phase and during the injec tion phase are the same (Figure 13). The medical staff enters the patient information re quired for the examination. When the needle or injection is started, the start button "STA is clicked to capture the start time. When the indwelling needle or injection ends, the but ton is clicked again to grab the end time.

Patients' Queue List and Scan Room Waiting List for Each Scan Room
The information of patients who have completed the indwelling needle but have no yet arranged a scan room is shown on the left in Figure 14 for the radiographer RD0 at th injection phase to view and arrange the scan room. The radiographer can click on th MRN number (i.e., "9876543") to go to the interface of Figure 13 to enter scan information For patients who have been assigned a scan room, their information is displayed on each page according to each different scan room (shown on the right of Figure 14).

Patients' Queue List and Scan Room Waiting List for Each Scan Room
The information of patients who have completed the indwelling needle but have not yet arranged a scan room is shown on the left in Figure 14 for the radiographer RD 0 at the injection phase to view and arrange the scan room. The radiographer can click on the MRN number (i.e., "9876543") to go to the interface of Figure 13 to enter scan information. For patients who have been assigned a scan room, their information is displayed on each page according to each different scan room (shown on the right of Figure 14).

Total Queue List
Patients who have already checked in and have not completed the examination wil be displayed in the screen of Figure 15 for medical staff at each stage of the examination Clicking on the MRN number will jump to the interface of Figure 13 for medical staff to enter or view detailed information. When there are a large number of patients, it is not easy to find the medical record number to view detailed information. We can use the "SCAN" button to scan the MRN barcode of a patient, and the system will directly display

Total Queue List
Patients who have already checked in and have not completed the examination will be displayed in the screen of Figure 15 for medical staff at each stage of the examination.
Clicking on the MRN number will jump to the interface of Figure 13 for medical staff to enter or view detailed information. When there are a large number of patients, it is not easy to find the medical record number to view detailed information. We can use the "SCAN" button to scan the MRN barcode of a patient, and the system will directly display the detailed information of the patient.

Total Queue List
Patients who have already checked in and have not completed the examination wil be displayed in the screen of Figure 15 for medical staff at each stage of the examination Clicking on the MRN number will jump to the interface of Figure 13 for medical staff to enter or view detailed information. When there are a large number of patients, it is no easy to find the medical record number to view detailed information. We can use th "SCAN" button to scan the MRN barcode of a patient, and the system will directly display the detailed information of the patient.

Data Collection of Experimental Group
We then fed these 200 PET medical database data on the patients' physical condition report time, and rescan status into our proposed system for the output of experimenta group data ( Figure 16).

Data Collection of Experimental Group
We then fed these 200 PET medical database data on the patients' physical condition, report time, and rescan status into our proposed system for the output of experimental group data ( Figure 16).

Estimate Time to Indwell Time Initially
Initially, the program downloads one day's data from the database, and then calculates the initial estimated indwelling time for all patients.

Update the Estimated Time to Indwell Needle
After the initial estimated indwelling needles for all patients have been calculated, the patients are sequentially entered into the next phase of the loop, i.e., to update the estimated time to indwell needle. The value of i in the first loop indicates the serial number of the patient who started the indwelling needle, and the patient is represented by i P .

Estimate Time to Indwell Time Initially
Initially, the program downloads one day's data from the database, and then calculates the initial estimated indwelling time for all patients. content via executing the second loop, the program will update the estimated indwelling time for all patients after P i . Because not every patient checks in before the P i 's indwelling needle, it is necessary to judge the timing of T CI (P j+1 ) and T a IV (P i ) first. If the patient P j has already checked in before T a IV (P i ), the program will update T e IV (P j ) for the patient. The detailed algorithm is shown as Equation (1) in Section 2.

Update Available Beds
After updating the estimated indwelling time, the program then updates the available beds. The first loop searches for all patients who have been scanned before the P i 's indwelling needle and determines whether there is a T I IF (P j ) between T a IV (P i ) and T a IV (P i−1 ). If there is, it means a patient's bed can be vacated during this time gap, with a bed vacancy at T I IF (P j ).

Schedule Scan Room and Estimate Injection/Scan Time
After updating the available beds, the program executes the fourth procedure to allocate beds for patients P j who have not been allocated a bed before T a IV (P i ). If P j is assigned to a bed, the program then proceeds with their estimated time of scan and injection.

A. Arrange beds
The bed allocation algorithm assignBed P j is shown in Figure 5 of Section 2, and the program flow is shown in Figure 17.  Figure 6 of Section 2, and the program flow is shown in Figure 18.

B. Estimate injection time and scan time
For patient P j assigned to a bed, the program then performs estimateEETime(P i ) to estimate the injection and scan time. The algorithm is shown in Figure 6 of Section 2, and the program flow is shown in Figure 18.  Figure 6 of Section 2, and the program flow is shown in Figure 18.

Discussion
In this section, we compare and analyze the experimental group and the control group, and we discuss the results in four parts.

Discussion
In this section, we compare and analyze the experimental group and the control group, and we discuss the results in four parts.
We first calculated the average time difference between the two groups at three start times (i.e., indwelling needle, injection, and scan) for 12 days to see if there was an error between the time calculated by the experimental group and the actual time of the control group (Table 3.) "Absolute value" and "relative value" respectively represent "with" and "without" positive and negative values, i.e., the average value of the "absolute value" and "relative value" of each experimental group time minus the control group time on a certain day. We also explored whether the estimated time by using the proposed automatic scheduling method can be faster than the original manual scheduling time, and what the proportion of time earlier is (that is, how many patients would benefit from this). The "ahead rate" represents the proportion where the estimated times of the experimental group was earlier than the actual times of the control group. We then analyze and discuss the proposed method in four parts.

Analysis of Indwelling Needle Time
The last update time for each patient was the time the previous patient entered the scan room. Comparing the final data with the actual data collected, the average time difference was about 2.94 min ( Table 3). The maximum value (time early up) and minimum value (time late up) were 17 and −12 min, respectively (Table 4).

Analysis of Injection and Scan Times
At the stage of estimating the injection, the time difference may be caused by the pharmacy cycle time having a buffer time of ±10 min and the radiographer manually calculating the estimated time. According to our observations at the scene, the radiographer only grasped the approximate time during the manual calculation, resulting in extra time between the end of the injection by the previous patient and the time when the next patient started the injection. In addition, when the indwelling needle ends on each occasion, the nurse must call the pharmacy to ask the pharmacist to give the medicine, and the radiographer must wait for the pharmacist to give the medicine before injecting the patient. These actions take up the time of the patient inspection process. However, the method proposed in this article can remove the above problems. If the medical staff performs the inspection process according to the estimated time calculated by the app, the injection process can be advanced 6.14 min on average (Table 3).
During the estimated scanning stage, the radiographer tries to let the patient scan 5-10 min in advance. However, the proposed algorithm was designed according to the standard pharmaceutical cycle time, allowing the radiographer to adjust the scan according to the standard time. This resulted in a high time difference (Table 4) and low ahead rate (Table 3).
Furthermore, the reason for the standard deviation being larger during the injection phase and the photographic phase than during the indwelling needle phase is that some machines were idle for less than the average imaging time of the patient, but some radiographers still arranged the patient in the gap to reduce the idle time of the imaging equipment. In addition to causing a time difference, this also made it very compact for patients who needed to be scanned again in the future.
In addition to the abovementioned causes of time differences in injection and scan phases, unexpected situations can sometimes occur on the scene, and the delay of the process is also one of the reasons for the time differences.

Analysis of Allocating Beds
Because bedridden patients require larger space, some require special equipment, and the types of uptake rooms vary, if the general patients occupy the uptake room of the bedridden patient, this can lead to prolonged waiting time of the bedridden patient. The proposed weight allocation method (Table 2) (i.e., using b() function) could shorten the average waiting time from indwelling needle to injection by 3.29 min (Table 5), save 40.35% of patient waiting time, and effectively solve this problem.

Overall Improvement
After analysis, the proportion of patients with a time difference of less than 10 min reached 68%, indicating that about 70% of the values were close to the actual situation, achieving high accuracy. In addition, 82% of the patients had an average reduction of 6.14 min (according to the estimated injection time), which verified the high efficiency of the proposed system.

Comparison
This section analyzes and compares the properties including the eight requirements in Definition 1 and other features. Table 6 displays the comparisons for the proposed automatic scheduling system and the current manual scheduling system, and Table 7 summarizes the comparison of the properties for the proposed system and those schemes proposed by Xiao et al. [5], Tantitharanukul and Throngjai [9], and Luscombe and Kozan [12].

Comparison with Proposed and Current Scheduling System
We functionally compared the current manual system with the proposed automatic system (Table 6). Our system has four automatic functions to solve the problem of smooth processes. We also compared the two systems in terms of "the time required" for medical staff or patients to process each task. The details are given below.

A.
Scheduling of patient examination order: The system automatically orders the order of patient examinations, eliminating the need for radiographers to manually order. B.
Scheduling of each inspection time: The system calculates the best patient examination time for different drug cycle times, and the radiographer does not need to calculate it manually. C.
Patient interrupts MS workflow by asking questions about examination time: The system calculates the estimated time of each inspection task and announces it to medical staff and patients, reducing the number of times when medical staff are interrupted by patient inquiries. D.
Dispensing reminder: The pharmacist checks the app's patient injection status to dispense medicine, eliminating the need for MS to call and let the pharmacist dispense medicine. E.
Patient estimated time reminder: The system sends a reminder message when the estimated time for each patient task is approaching. F. Patient and family inquiries: Patients and family members can check the examination time by themselves, reducing the number of inquiries.

Comparison of Proposed and Previous Works
According to the system requirements proposed in Definition 1, we compared our method with previous works ( Table 7). The first five functions could only be totally achieved by our method, and the sixth, seventh, and eighth functions could only be provided by our system. In the PET patient scheduling problems, the biggest issue with the scan room and nurse manual scheduling is that the patient's examination fails and these examinations need to be repeated. Therefore, immediate rescheduling is the most important function, and only our method can completely solve this problem.

Conclusions
Due to the limited equipment resources and cycle time of PET, it is not an easy task for medical staff to calculate time and allocate resources on their own. This paper proposes a method for real-time estimation and scheduling of multi-resource allocation and pharmacy limitation, combined with Beacon to automatically detect patient entry and exit, and effectively control the inspection process. The results showed that the time difference between the experimental group and the control group was about 2.94 min, 7.95 min, and 7.32 min in the indwelling needle phase, the injection phase, and the scanning phase, respectively. Moreover, the proportion of patients with a time difference of less than 10 min reached 68%, indicating that most values were close to the actual situation, achieving high accuracy. In addition, 82% of the patients had an average reduction of 6.14 min, verifying the high efficiency of the proposed system. Therefore, the proposed system not only reduces the work of medical staff, but also provides patients and their families with credible estimates of time.
Future research will focus on more detailed data analysis to improve the accuracy of estimated time. In addition, some patients not only have a PET examination but other radiological procedures to be performed on the same day. The radiographer must consider these conditions together to schedule appointments. Future studies can consider combining the scheduling of other radiology departments to make the entire radiological diagnosis process easier and smoother.

Informed Consent Statement: Not applicable.
Data Availability Statement: The statistical data presented in this study are available in Tables 3-5. The datasets used and/or analyzed during the current study are available from the corresponding author upon request.