Optimising Outpatient Pharmacy Staffing to Minimise Patients Queue Time using Discrete Event Simulation

Background: To remain relevant in the customer-oriented market, hospitals must pay attention to the quality of services and meet customers' expectations from admission to discharge stage. For an outpatient customer, pharmacy is the last unit visited before discharge. It is likely to influence patient satisfaction and reflect the quality of hospital's service. However, at certain hospitals, the waiting time is long. Resources need to be deployed strategically to reduce queue time. Objective: This research aims to arrange the number of staff (pharmacists and workers) in each station in the pharmacy outpatient service to minimise the queue time. Methods: A discrete simulation method is used to observe the waiting time spent at the pharmacy. The simulation run is valid and effective to test the scenario. Results: It is recommended to add more personnel for the non-compounding medicine and packaging to reduce the waiting time by 22.41% Conclusion: By adding personnel to non-compounding and packaging stations, the system performance could be improved. Cost-effectiveness analysis should be done to corroborate the finding.


I. INTRODUCTION
A healthcare facility must be people-centred, effective, efficient, safe and seeks to deliver the best care for its patients [1]. To remain relevant, hospitals must pay attention to the quality of services and meet their customers' expectations. Researchers have examined how improvement of services are influenced by: organisational factors [2], layout design [3], performance [4], clean room [5], hospital bed planning [6], hospital space planning [7], patient flow [8] and the number of staff [9]. Hospital service quality will drive satisfaction [10] and this depend on all stakeholders, including receptionists, doctors, nurses and pharmacists.
The pharmacy, which is usually the last unit visited by patients, may influence customer satisfaction and the hospital reputation in general [11], [12]. This department is responsible for acquiring and dispensing medicines to patients. They need to plan the sequence of processes [12], overcome and prevent an error in the preparation of medicine [13], keep and improve quality control in pharmacy [14], deploy a doctor to supervise the pharmacy department [15], conduct a quality assessment of the outpatient pharmacy services call centre [16], [17], and improve medication safety in general [18].
Research on pharmacy services in hospitals has been carried out previously; for example, the three-archetype heuristic expectations and patients' preference to the pharmacy unit: partners, clients and customers [19]; progressive structuring to improve services efficiency [20]; relationship between pharmacy unit's elements [21]; call centre services improvement [22]; staffing and work scheduling [23]; service quality measurement in a large public regional hospital using lean manufacturing [24]; reducing long waiting time and improving work efficiency [25]. Reducing waiting time is essential to maintain the hospital reputation. Therefore, studies focus on reducing outpatient pharmacy unit's waiting time; for example, by using six-sigma for time assessment and flow assessment [26]- [29].
To understand system behaviour and evaluate the system's performance, simulation is needed in order to form a natural system model for experimentation [30]. The system components are arrival and departure patterns, system capacity, and system resource [31]- [33]. The pharmacy unit consist of two elements-system (customers), resource (pharmacists and officers)-and interaction between these elements. Manual calculations to improve the services will be labour intensive and inefficient. Quantitative study is needed and the calculated number should be proven in a simulation. This is because decision-making in the pharmacy unit will affect the entire hospital system.
To extend the previous research, this study attempt to analyse queue time minimisation by arranging the number of staffs in an outpatient pharmacy service in a hospital using discrete event simulation (DES). DES is commonly used to analyse queuing in a system [9], [23], [34], [35]. In this study, DES is used to analyse the impact of staffing on patients' waiting time in the pharmacy unit. The objective of this study is to use DES to help the hospital minimise queue time through effective staffing arrangement.
We first conducted preliminary observation to 32 patients (customers) queueing in a hospital in Surabaya. We asked two questions: 1) how long they have been queueing; 2) whether or not they are satisfied with hospital services in general. The result stated that on average, they queue for about 60 minutes and 28/32 (87.5%) customers stated that they were not satisfied with the hospital's service due to long processing time. The current research aims to: (a) Calculate the queue time for the customer/patient, (b) Create scenario for system efficiency improvement by arranging the staffing (pharmacists and worker) in each station, and (c) Comparing the improvement scenario and the existing conditions.

II. METHODS
The simulation was discrete because the pattern of the queuing system in this hospital is discrete. The model of the operation is a discrete sequence of events in time. Each event occurs at specific time and this marks a change of state in the system. Between consecutive events, no change is assumed to occur; thus, the simulation can directly jump from one event to the next [34]. Simulations are carried out to imitate the system and make changes, such as adding or reducing the number of officers or pharmacists. Simulation is needed because if the changes are carried out directly, it will be costly and time-consuming. As such, adjustments in actual conditions are not feasible [30]. The current research uses real-life data collected from a pharmacy unit through patient observations from Monday to Thursday from 08.00 to 14.00 (GMT +7); and on Fridays from 8.00 to11:30. This time was of interest because the queue tended to be the longest. The observations were done in twenty days, recording the time between customers' arrival, duration time of prescription reception, duration of customers numbering reception, duration of non-compounding medicine process, duration of compounding medicine process, duration of medicine packing, duration of medicine inspection, and duration of medicine reception and consultation. The observations recorded a total of 2,657 patients visited the outpatients' services. Fig. 1 illustrates the service system at the outpatient pharmacy unit, where the incoming prescriptions have to wait at the prescription reception station. Then an officer will separate the non-compounding medicine prescriptions from the compounding ones. The prescription will be given respective medicine station. After the completion, the medicine will be given to the patient.

B. Existing System
In general, the pharmacy unit system is divided into five main parts: customer reception station, medicine production station, medicine packaging station, medicine inspection station, and medicine reception and consultation station. Fig. 2 shows the prescription flow until it is ready to be given to the patient. The data were taken by direct observations in each station.

Customer Reception
This station is represented by a team of station officers consisting of three workers. Each station officer can only serve one order/customer at a time. The unit of work is carried out alternately (cyclical).

Medicine Production
Two teams of pharmacists handled this station, the compounding medicine team and the non-compounding medicine team. The compounding medicine team consists of three pharmacists, while non-compounding medicine team consists of two pharmacists. The capabilities and rules for sharing the workload in this station are the same as the customer reception.

Medicine Packaging
This station is handled by a medicine packaging team consisting of three workers. The capabilities and rules for sharing the workload in this section are the same as the customer reception.

Medicine Inspection
This station is handled by a medicine inspection team consisting of two pharmacists. The capabilities and rules for sharing the workload in this section are the same as the customer reception.

Medicine Reception and Consultation
The customer will conduct a brief consultation regarding the medicine intake with the officer after they receive the medicine. After that, the customer will leave the system.

C. Conceptual Model
The model is used to illustrate the activities in the system. It is described using a flowchart and an activity cycle diagram. They describe the service process from customer's arrival until leaving the pharmacy unit. Fig. 3 and Fig. 4 show the flowchart and activity cycle diagram of the existing system. Entity activity means the flow from when a customer enters the system to when customer leaves the system. This flow will affect the activities carried out by the resources in every station, who are: i. Customer Reception: three workers ii. Medicine Production: two medicine-making (pharmacists) teams (three making compounding medicine, and two making non-compounding medicine) iii. Medicine Packaging: three workers iv. Medicine Inspection: two pharmacists v. Medicine Reception and Consultation: two workers The queue was form since the first station and would accumulate because the number of customers who came was higher than the resources' capacity. The simulation of the system follows the following steps: i. Collecting data by recording customer arrival in each station ii. Finding out the statistical distribution of each data using the ARENA 14 analyser to provide the main valueadded of the simulation by understanding the system behaviour iii. Inputting the statistical distribution to the conceptual model iv. Verifying and validating data to ensure that the simulation result matches the existing system.
The simulation we conducted is a terminating simulation, which runs for a certain duration of time. Therefore, we needed to do a replication that described the data spread. Replication using half-width is made to ensure that the result of the statistical distribution is robust [30], [36]. Then, we found out that our simulation result is the same as the existing system by using the Welch confidence interval method. This method is used when the variance of the two populations (existing system data and simulation result) are unequal or un-pooled variance, as shown in Table 2 [37], [38]. Because of this condition, this test is more reliable than t-test to test whether two populations have different mean [39]- [41]. The following are the steps and calculations of the Welch confidence interval method for validating the simulation model: a. Stated hypotheses that there is no difference between existing system and simulation output: Calculating Welch confidence interval calculation for the level of significant α: : Mean of the number of customers in the existing system : Mean of the number of customers in the simulation output v. Apply improvement scenario to the model (adding and reducing resource of the pharmacists), and found out the response variable of this system (the average time queue in each station) vi. Select the best scenario, comparing with the existing condition and analyse it.

III. RESULTS
The result of the simulation is divided into two parts: existing condition simulation and improvement scenario simulation. These two are done to illustrate that the proposed scenario can improve existing conditions.

A. Existing Condition Simulation
The simulation of the existing model is carried out using the Discrete Event Simulation (DES) model. The simulation model is built from the conceptual model logic and observational data that has been obtained. Observation data in the form of processing time need to be processed. It is obtaining the distribution of data and its parameters that can mimic the actual performance of each process in the system. The processing of the observational data was carried out using the input analyser on the ARENA 14. In the data distribution fitting process, the type of data distribution chosen is a distribution capable of producing low squared errors and is following the distribution of data for similar processes or properties. This process will obtain the time data distribution for each system process using the ARENA 14 analyser. The fitting data of all stations passed by customers, mentioned in the previous section, is presented in Table 1. Verification is done to test the suitability of the simulation model with the conceptual model that has been created. Practically, verification is done to make sure that the model is running correctly and according to the logic of the model arrangement. In this study, verification was carried out by checking for errors in the simulation model (error) using the check model feature in the ARENA 14.
Validation is done to test whether the conceptual model built is following the actual observation system conditions. It is measured from the accuracy of a verified simulation model in producing output that matches the observational data (black box validation). The model is valid if the comparison results show that the simulation model output and the observed data are not significantly different from a statistical point of view. The output data used in the model validation must have a relatively small error rate (less than the 0.05 significance level).
The minimum number of replications of the simulation model was calculated through the following steps. The first step is calculating the input data's degree of freedom (df) as follows. .

= 28.35 
Furthermore, the half-width (hw) is calculated, which describes the data distribution as follows.

= 2.689 ≈ 3 
From the above calculations, it can be concluded that the minimum replication in the model simulation is three times. After knowing the minimum number of replication simulations, the next step is model validation. Table 2 shows the number of customers both in existing system (in 20 days of observation) in the hospital and the simulation model output by three-time replication. The number of customers in the existing system and simulation output is slightly different. The statistic distribution from Table 1 was inputted to the model, while the existing system was from observation. Then, we tested the significance of this difference with a 95% confidence interval. The method used in this test is the Welch confidence interval method. The model is said to be valid when the confidence interval has a value of 0, meaning that there is no difference between the existing system and simulation result [30], [36], [37]. Using the input data in Table 2, the Welch confidence interval value using a significance level of 0.05 is as follows.
( Because the value of 0 is in the Welch confidence interval of 95%, H 0 cannot be rejected. The conclusion is that the average number of customers from the simulation model output and the observational data is insignificant. Therefore, the simulation model can be said to be valid.

B. Improvement Scenario Simulation
This study attempts to find the best scenario for the outpatient pharmacy unit in a hospital in Surabaya. The improvement scenario that will be carried out is to optimise the available number of pharmacists within the system, whether the number of available pharmacists in each section is reduced or increased or whether they need to be assigned to other stations. We conducted 20 improvement scenarios, while the first scenario in Table 3 is the existing condition. For example, Scenario 2 is written as 'Non-Compounding Medicine (+1)', meaning that for station Non-Compounding Medicine, there is one additional pharmacist. Table 3 shows the average waiting time of customers in each station. The results show that some scenarios improve the existing condition, while others deteriorates the existing system. In Scenario 19: Non-Compounding (-1) Packaging (-1) scenario, the additional pharmacist and staff member in the compounding medicine team and in the packaging station increases the average waiting time. In this case, the system performance becomes worse. This performance is mainly influenced by the high variability of the time distribution for the medicine production process. However, in general, adding a pharmacist in the compounding medicine team did not improve the value of the response variable. The combination that produces better response variable value is shown by Scenario 16 (non-compounding medicine (+1) packaging (+1); Scenario 17 (non-compounding medicine (+1) compounding medicine (+1); and Scenario 3 (the non-compounding medicine (+2)).
The non-compounding medicine (+1) packaging (+1) scenario obtained the most significant improvement response variable, 22.41%. The non-compounding medicine (+1) and compounding medicine (+1) scenario uses an additional pharmacist in the non-compounding medicine making section and an additional pharmacist in the compounding medicine making section. The non-compounding medicine (+1) compounding medicine (+1) scenario resulted in an improvement of 20.03%, which is the queue time can be minimised. In the noncompounding medicine (+2) scenario, two additional pharmacists were assigned to make non-compounding medicine. They improved 20.03%, equivalent to the non-compounding (+1) compounding medicine (+1) scenario.
The scenario of reducing the number of pharmacists and officers which had the worst effect on system performance is the non-compounding medicine (-1) packaging (-1) scenario; then non-compounding medicine (-1) compounding medicine (-1) scenario; and non-compounding medicine (-1) scenario in the following position. In a non-compounding medicine (-1) packaging (-1) scenario, a non-compounding medicine pharmacist, and a medicine packing officer do not serve the system. Therefore, the system performance worsens 474.93% from the initial condition. In the non-compounding medicine (-1) compounding medicine (-1) scenario, when a noncompounding medicine pharmacist and a compounding medicine pharmacist who does not serve the system, the system's performance worsens by 449.47% from the existing condition.

IV. DISCUSSION
The results of data processing and analysis using the ARENA 14 Simulation have been described in the previous section. It was found that the average time required for officers to prepare the medicine was 15.8 minutes in the existing conditions. After several experimental scenarios using the analyser process were carried out, three best scenarios were produced are as follows: Scenario 16, which is non-compounding medicine (+1), and packaging (+1) scenario, by adding 1 (one) officer in packaging position from three to four and one non-compounding medicine preparation pharmacist position from two to three, the average time for customers to queue in the station is 11.7 minutes (22.41 %). Then scenario 17 of non-compounding medicine (+1) and compounding medicine (+1), by adding 2 (two) pharmacists: one in the non-compounding medicine preparation position (change from two to three pharmacists) and one in the position of making the compounding medicine (from three to four), the average time for customers to queue is 12.06 minutes (20.03 %). Scenario 3, which added two pharmacists in a Noncompounding medicine station, added two medicine pharmacists in a non-compounding medicine preparation position from two to four. The average time for customers to queue in the station is 12.06 minutes (20.03 %).
The three best scenario shows better performance when compared to existing conditions. However, the observations were only carried out in 20 days which did not necessarily represent the busyness of the pharmacy unit at the hospital throughout the year. Staff scheduling during peak or off-peak hours can also be considered. Also, the data observation is only on the pharmacy unit. Another consideration is that the three scenarios stated that there must be additional personnel at a particular station. This result, of course, will affect the salary costs that the hospital must incur. The simulation results in this study are only discussed in terms of time to optimise queuing time. The discussion about cost-effectiveness analysis should be done to describe a better understanding of the staffing. A further cost-effectiveness analysis is needed, whether this person should be added or whether officers from stations with fewer customers should be relocated to more crowded stations.
This study shows that there is a better scenario result; there is also a worse result than the existing condition, which is why simulation is needed. Because to look for improvement, we have to try until we find the best scenario, which dramatically affects the hospital's overall decision-making.
Studies have discussed improvement in system efficiency in the pharmacy unit without delay and availability of all required resources [11], [35], [42], [43]. This research discusses the same topic about waiting time in the 110 outpatient pharmacy unit as discussed in the previous research [11], [42], [43]. This research found that changes in elements or activities in the simulation system will reduce waiting time. It is found that imbalance of prescriptions assigned to different windows caused by the queuing pattern will affect the waiting time of customers [42]. This finding is in line with the previous research. There is a different time in the production of compounding and non-compounding medicine. Adding one more pharmacist in non-compounding stations makes the system run more efficiently than before. Another research studies additional automated waiting systems with automated prescriptions, patient categorisation, reducing the unclaimed prescriptions and modifying the pharmacy's layout better perform the outpatient pharmacy system [11]. This research uses statistical distribution from data collection as input in the model. In contrast, others use the same interval of arrival in each station [43].
Additional discussions with stakeholders from this hospital are considering adding facilities such as wi-fi, providing comfortable seating and free drinks. This consideration is intended to compensate visitors who wait for too long. Research on the impact of providing compensation can be the future research and add integration between cost-effectivity analysis and simulation results.

V. CONCLUSIONS
This study was conducted to gain insight into the setting of the staffing at a hospital pharmacy unit. The simulation run in this research is valid and effective to run the improvement scenario. We calculate the queue time of customers and create a scenario for system efficiency. We found s 22.41 % waiting time improvement compared to the existing system by adding two more workers (one pharmacist and one packaging worker). Therefore, we can provide some suggestions that might be used the hospital under study in terms of determining policies both in existing condition and in the future. However, adjustment to comprehensive cost-effectiveness analysis of the hospital financial analysis is needed. Funding: This research received no specific grant from any funding agency.
Conflicts of Interest: The authors declare no conflict of interest.