Introduction

Magnetic Resonance Imaging (MRI) examinations were becoming increasingly important in determining treatment plans in contemporary medical institutions. A significant number of patients required MRI results before undergoing diagnostic and therapeutic procedures. In the past few decades, as the medical standard in mainland China gradually improved, there was a significant increase in the number of patients undergoing MRI examinations. The significant increase in the number of MRI examinations led to prolonged queuing phenomena in many large hospitals across the mainland, which not only delayed the diagnosis and treatment of various diseases but also had the potential to adversely affect treatment outcomes. Therefore, there was a need for a set of optimization solutions designed to reduce the waiting time for patients and to coordinate medical resources .

The distribution of demand for Magnetic Resonance Imaging (MRI) examinations was characterized by complexity and was subject to the influence of various factors, including seasonal variations and holiday periods. Scholarly literature pertaining to the prediction of patient demand predominantly concentrated on forecasting the volume of emergency patients1,2,3,4,5,6, with a comparative paucity of research directed towards the prediction of daily MRI examination demand.

Conventional time series analysis models, including the Grey model, the Markov model, and the Autoregressive Integrated Moving Average (ARIMA) model, predominantly hinged on the linear attributes of the data. Wen-Ting Zha introduced an Autoregressive Integrated Moving Average with exogenous variables (ARIMAX) model to investigate the impact and forecast the incidence of mumps in China attributable to meteorological factors7, while Jing Yang applied the ARIMAX model to predict the incidence of tuberculosis in China by utilizing Baidu search index data8. The ARIMA model did not account for the nonline arities present in time series data9. Given the limitations of the ARIMA model, there was a growing interest in the application of neural network models for time series forecasting10,11,12,13, as they were capable of considering the nonlinear relationships within the data. Artificial Neural Networks (ANN) offered an innovative approach to parameter estimation in both linear and nonlinear models. The ANN’s capacity for learning and generalizing behaviors allowed it to adapt to variable and dynamic environments, thereby endowing predictive tools with greater flexibility than traditional statistical models14. The Nonlinear AutoRegressive with eXogenous inputs (NARX) model was recognized as an effective methodology for addressing continuous nonlinear problems15, and unlike other neural network architectures, the NARX model’s output functioned as input for subsequent predictions in a feedback loop16.

Academic articles on the application of integer programming models to MRI examination planning were relatively scarce. A study reported that a Norwegian hospital had employed Integer Programming models to yield optimal solutions for MRI block scheduling issues and had furnished managerial insights for decision-makers17. Nevertheless, Integer Programming models were more frequently applied to the optimization of dietary regimens18,19,20,21,22.

This investigation utilized Integer Programming models to forecast the demand for MRI examinations and to optimize work schedules. Subsequently, an optimization protocol for the allocation of MRI examination resources was developed, which integrated additional process components.

Materials and methods

Materials

The dataset employed in this research was extracted from the daily MRI examination application records of a specific hospital in Chinese Mainland, spanning from July 1, 2017, to November 30, 2022. The institution in question is a prominent public general hospital located in the Chinese Mainland. Owing to the influence of the COVID-19 pandemic and the associated containment measures implemented in mainland China, there was a marked reduction in MRI applications between January 13, 2020, and March 14, 2021. Therefore, data from this time period was excluded from the analysis. Ultimately, it was determined that 1,522 MRI examination data were included in this study. In this study, we observed a significant decrease in MRI examination requests at the hospital on weekends and public holidays. Public holidays in mainland China are not fixed and are determined differently from those in other countries, often aligning with the Chinese lunar calendar, including festivals such as the Spring Festival, Dragon Boat Festival, and Mid-Autumn Festival. On these occasions, the Chinese mainland government adjusts the regular weekend schedule to extend continuous holiday periods by designating certain Saturdays and Sundays as workdays, while conversely designating certain weekdays as holidays. To mitigate the effect of holiday data on predictive accuracy, this study excluded data that were subject to alterations in workday status due to holiday influence. Furthermore, it was observed that the number of MRI examination requests on the first day following a holiday exhibited a significant increase compared to regular weekdays. Hence, the predictive models developed in this study incorporated this variable as a significant influencing factor within the research framework. The Ethics Committee of the Sixth Medical Center of the People’s Liberation Army General Hospital had approved the protocol. Since the study did not intervene in patient medical care, informed consent was not required. The research was conducted in accordance with the principles of the Declaration of Helsinki.

ARIMA and ARIMAX models

The ARIMA model constitutes a linear time-series forecasting approach that employs the linear combination of previously observed stationary series and error terms. Conventionally, the ARIMA model is specified as ARIMA(p, d, q)(P, D, Q), wherein p, q, and d denote the orders of autoregression, moving average, and differencing, respectively, while P, D, and Q represent the respective orders of seasonal autoregression, seasonal moving average, and seasonal differencing. The examination of data autocorrelation and seasonality is conducted through the deployment of autocorrelation function (ACF) and partial autocorrelation function (PACF) plots. Model selection is guided by the Akaike information criterion (AIC) and the Bayesian information criterion (BIC), aiming to strike a balance between model fit and complexity23. The ARIMAX model is an extension of the ARIMA model that incorporates exogenous regression terms. The incorporation of these regression terms enhances the predictive accuracy of the model, with such terms generally comprising variables that exhibit a high degree of correlation with the forecasted variable.

NAR and NARX models

The NAR model represents a nonlinear time series forecasting approach that expands upon the conventional linear autoregressive (AR) model, facilitating a more effective capture of nonlinear dynamics within the time series data and potentially yielding more precise predictive outcomes in specific contexts. The underlying rationale of the NAR model is based on the utilization of historical data across multiple time steps to establish a nonlinear functional relationship with the current time step for the purpose of time series forecasting. The NARX neural network model is an advancement of the NAR neural network model, distinguished by its nonlinear autoregressive properties with exogenous inputs. It operates by predicting a given time series based on the past values of that series, the feedback input, as well as an additional time series, referred to as the external or exogenous time series24,25.

ARIMAX-NARX models

ARIMAX-NARX models were developed by applying the NARX model to capture the nonlinear dynamic information of time series, based on the ARIMAX model’s ability to capture the linear dynamics of time series.

Assessment of predictive performance

We utilized three metrics, namely Mean Squared Error (MSE), Mean Absolute Percentage Error (MAPE), and Mean Absolute Error (MAE), to evaluate the performance of the model. Lower values of these metrics indicate superior model performance. Typically, the MSE is susceptible to the influence of individual large errors, whereas MAPE and MAE provide a reliable measure of the discrepancy between predicted and actual values26,27,28.

$$\:\text{M}\text{S}\text{E}=\frac{{\sum\:}_{i=1}^{n}({{\text{x}}_{\text{i}}-{\widehat{\text{x}}}_{\text{i}})}^{2}}{\text{n}}$$
$$\:\text{M}\text{A}\text{E}=\frac{{\sum\:}_{i=1}^{n}{|\text{x}}_{\text{i}}-{\widehat{\text{x}}}_{\text{i}}|}{\text{n}}$$
$$\:\text{M}\text{A}\text{P}\text{E}=\frac{{\sum\:}_{i=1}^{n}\frac{{|\text{x}}_{\text{i}}-{\widehat{\text{x}}}_{\text{i}}|}{{\text{x}}_{\text{i}}}\times\:100}{\text{n}}$$

Xi is the actual value, \(\:{\widehat{\text{x}}}_{\text{i}}\) is the predicted value, i = 1…n, and n is the number of observation.

Linear programming

Linear programming can address optimization issues in production processes, logistics transportation, and resource allocation, aiding managers in determining solutions to these problems. A linear programming model comprises three elements: the objective function, decision variables, and constraints. The solution to the model involves identifying the values of the decision variables that optimize the objective function (either to a maximum or minimum), while concurrently ensuring that these values satisfy the specified constraints.In the context of linear programming, when all decision variables are required to take on non-negative integer values, such a problem is termed integer linear programming. The traditional approach to solving integer programming problems is the branch-and-bound method. This constitutes a mathematical technique capable of addressing various types of problems. The underlying principle of the branch-and-bound method is that the entire set of feasible solutions can be partitioned into smaller subsets. These subsets can be systematically evaluated until the optimal solution is identified.

Construct a flowchart for the optimization process

The development of an optimized process for the allocation of resources in MRI examinations was the focus of this study. The optimization process was constructed by means of flowcharts, which are graphical representations of processes or systems. Flowcharts employ icons composed of fundamental shapes to depict the various components, steps, and logical relationships inherent in a process or system, thereby enhancing comprehension and analysis. The creation of a flowchart entailed a six-step process: initially, defining the objective of the diagram; secondly, establishing the scope of the process; thirdly, gathering pertinent information; fourthly, constructing the basic framework; fifthly, delineating the elements of the flowchart; and finally, engaging in optimization and refinement.

Statistical analysis

The data analysis was performed with the employment of Microsoft Excel (2007) for purposes of data organization and statistical delineation. The ARIMA model was crafted utilizing SAS version 9.3. Concurrently, the development of the Artificial Neural Network (ANN) model was achieved through the use of MATLAB version R2015b.

Results

The temporal distribution of demand for MRI examinations

Figure 1 presented the daily MRI examination application data from July 1, 2017, to November 30, 2022. Excluding the impact of the COVID-19 pandemic, the data plot revealed a pronounced cyclical pattern in the number of MRI examination applications. Notably, public holidays in mainland China significantly influenced the volume of MRI examination applications.

Fig. 1
figure 1

Temporal distribution chart of magnetic resonance imaging (MRI) examination request volume.

Prediction results of each model

We developed an ARIMA model to predict the demand for MRI examinations. The ARIMA model was divided into two types: one with exogenous influencing factors (ARIMAX) and one without (ARIMA). The occurrence of holidays and the first working day after a holiday were considered as exogenous factors. Model parameters were determined based on the Autocorrelation Function (ACF) plot, Partial Autocorrelation Function (PACF) plot, and Akaike Information Criterion (AIC) and Schwarz Bayesian Criterion (SBC) values. Both ARIMA and ARIMAX predictions utilized the ARIMA(0,2,1)(0,2,7)12 model, which yielded better prediction results. Figures 2 and 3 showed the residual correlation diagnostics for ARIMA model and ARIMAX model, respectively. Figures 4 and 5 showed the residual normality diagnostics for ARIMA model and ARIMAX model, respectively. Figures 6 and 7 showed the forecasts for ARIMA model and ARIMAX model, respectively.

Fig. 2
figure 2

Rdsidual correlation diagnostics for ARIMA model.

Fig. 3
figure 3

Rdsidual correlation diagnostics for ARIMAX model.

Fig. 4
figure 4

Residual normality diagnostics for ARIMA model.

Fig. 5
figure 5

Residual normality diagnostics for ARIMAX model.

Fig. 6
figure 6

Forecasts for ARIMA model.

Fig. 7
figure 7

Forecasts for ARIMAX model.

We also developed a NAR neural network method for predicting the demand for MRI examinations. Among them, the NAR model was also divided into two types: one with external influencing factors (NARX) and the other without (NAR). Similarly, we also included factors such as whether a day was holiday or the first working day after a holiday as external influencers. We conducted grid search of cross-validation experiments to optimize the parameters. The optimal configuration was determined with a Number of Hidden Neurons set to 12 and a Number of delays (d) set to 7. The NAR model achieved the best training performance at Epoch 79, the NARX model reached its optimal training at Epoch 155. During the model training, we employed the Bayesian regularization algorithm to reduce the complexity of the model, thereby enhancing its generalization capability. Figures 8 showed the synoptic schematic of the NAR and NARX prediction model. Figures 9 and 10 showed the Error Histogram with 20 Bins for NAR and NARX prediction model, respectively. Figures 11 and 12 showed the Regression plots of the NAR and NARX model trained with the Bayesian Regularization algorithm, respectively.

Fig. 8
figure 8

Synoptic schematic of the NAR and NARX prediction model.

Fig. 9
figure 9

Error histogram with 20 Bins for NAR prediction model.

Fig. 10
figure 10

Error histogram with 20 bins for NARX prediction model.

Fig. 11
figure 11

Regression plots of the NAR model trained with the Bayesian regularization algorithm.

Fig. 12
figure 12

Regression plots of the NARX model trained with the Bayesian regularization algorithm.

We utilized the residual sequence from the ARIMAX model’s prediction as the training dataset for the NARX model. Similarly, we conducted grid search of cross-validation experiments to optimize the parameters and applied Bayesian regularization to reduce the model’s complexity, thereby enhancing its generalization capability. The ARIMAX-NARX model achieved the best training performance at Epoch 301. Figure 13 showed the synoptic schematic of the ARIMAX-NARX prediction model.

Fig. 13
figure 13

Error histogram with 20 Bins for ARIMAX-NARX prediction model.

Comparison of prediction accuracy

We conducted calculations of the MSE, MAE, MAPE, and the Pearson Correlation Coefficient (R value) to quantify the level of association between the predicted and actual values for the previously mentioned four models. Table 1 shows the prediction accuracy of various methods. This was done to facilitate a comparative analysis of the predictive accuracy across the different models.

Table 1 Prediction accuracy of various methods.

Upon comparison, it was evident that the NARX model exhibited superior prediction performance relative to the other models. Consequently, this study employed the NARX model to forecast the inspection demand from October 24th to October 30th, 2022. Table 2 shows the results predicted by the NARX model.

Table 2 Prediction results.

Programming for daily inspection volume

According to the predictions from the NARX model, the daily actual inspection workload was allocated using Integer Linear Programming to minimize the inspection costs. This hospital had three MRI machines, and through the analysis of historical data, the following parameters were derived for professional assessment. Machine number 1 (MR1) had a daily maximum workload of 72 sessions, machine number 2 (MR2) had a daily maximum workload of 58 sessions, and machine number 3 (MR3) had a daily maximum workload of 41 sessions. The cost per inspection session for MR1 was 280 yuan, for MR2 was 250 yuan, and for MR3 was 220 yuan. An additional labor cost of 30 yuan was incurred for each inspection performed on holidays, and a cost of 60 yuan was added for each day that the patient’s examination was extended.

Model Decision Variables:

x11, x12, x13, x14, x15, x16, x17, x21, x22, x23, x24, x25, x26, x27, x31, x32, x33, x34, x35, x36, x37.

Objective Function:

$$\begin{aligned} {\text{MIN}}({\text{cost}}) &= - {\text{14}}0*{\text{x11}} - {\text{8}}0*{\text{x12}} + {\text{2}}0*{\text{x13}} + {\text{8}}0*{\text{x14}} \\ & \quad + {\text{1}}00*{\text{x15}} + {\text{16}}0*{\text{x16}} + {\text{22}}0*{\text{x17}} \\ & \quad - {\text{17}}0*{\text{x21}} - {\text{11}}0*{\text{x22}} - {\text{2}}0{\text{x23}} \\ & \quad + {\text{4}}0*{\text{x24}} + {\text{7}}0*{\text{x25}} + {\text{13}}0*{\text{x26}} + {\text{19}}0*{\text{x27}} \\ & \quad - {\text{2}}00*{\text{x31}} - {\text{14}}0*{\text{x32}}~ - {\text{5}}0*{\text{x33}} + {\text{1}}0*{\text{x34}} \\ & \quad + {\text{4}}0*{\text{x35}} + {\text{1}}00*{\text{x36}} + {\text{16}}0*{\text{x37}} \end{aligned}$$

X11: Represented the inspection volume on the first day for MA1,

X12: Represents the inspection volume on the second day for MA1,

X21: Represents the inspection volume on the first day for MA2,

X31: Represents the inspection volume on the first day for MA3, ….

Constraints: The daily inspection volume per machine should not exceed the daily maximum workload, the daily inspection volume should not exceed the cumulative applied volume, and all inspection applications must be completed on the last working day.

Table 3 shows the optimal solution for linear programming, which is the daily required inspection volume for each MRI machine from October 24th to October 30th.

Table 3 Daily inspection volume.

We conducted sensitivity analysis of the planning model by examining the impact of constraint conditions on the optimal value of the objective function. Among the constraints, the maximum number of examinations per day for each MRI machine was the most easily altered, as both the operational state of the machine and the working hours of the staff could influence this value. We analyzed the effect of the maximum number of examinations per day for each MRI machine on the minimum examination cost. Within a certain range, the higher the maximum number of examinations per day for each MRI machine, the lower the minimum examination cost. The increase in the minimum examination cost due to a reduction in the maximum number of examinations per day for each MRI machine was more significant than the decrease in the minimum examination cost caused by an increase in this value. Figure 14 illustrates the impact of changes in the maximum number of examinations per day for each MRI machine on the minimum examination cost.

Fig. 14
figure 14

Impact of maximum MRI examination volume variation on minimum cost.

Constructing an optimized flowchart for MRI examination resource allocation

The optimization process for MRI examination resource allocation encompassed several key elements, including the collection and processing of historical data, prediction of examination demands, cost estimation, linear programming, formulation of examination plans, post-examination benefit analysis, scheme evaluation, and information feedback. Each step of the optimization process was vital and should undergo a continuous cycle of improvement. Figure 15 shows the optimization process flowchart of MRI examination resource allocation. In accordance with the flowchart, the initial step involved the collection and processing of recent MRI examination data for analytical purposes. Subsequently, a suitable predictive method was chosen and applied based on the specific context to forecast the demand for examinations during the ensuing cycle. Thereafter, considering the diverse costs associated with examinations, labor expenses, and the operational capabilities of the equipment, daily examination quantities were calculated and determined through linear programming techniques. Ultimately, based on the computed examination quantities, an examination plan for the subsequent cycle was formulated and executed accordingly. In parallel, regular evaluations of the plan’s implementation were conducted, with feedback being generated from these assessments to address any issues identified within the process.

Fig. 15
figure 15

the optimization process flowchart of MRI examination resource allocation.

Discussion

The significance of optimizing the allocation of medical resources

The optimization of resource allocation pertaining to substantial medical apparatus and the mitigation of patient queuing durations represent pivotal challenges that demand immediate attention within the context of major healthcare institutions in China. The present investigation elucidates a set of strategic approaches aimed at facilitating the harmonized scheduling of extensive medical equipment, thereby diminishing the duration of patient wait times.

The prediction methods for the volume of MRI examination application requests

it is essential to analyze the the distribution of data when choosing a pridiction method. The distribution diagram of the MRI examination application data from this study revealed that the number of applications was cyclical, with a pattern of distribution every 7 days, reaching its peak on Mondays, and exhibiting a consistent pattern of change from Monday to Friday. Applications were comparatively fewer on weekends, that is, Saturdays and Sundays. During Chinese public holidays, when days off were observed, regardless of the day of the week, there is a noticeable decrease in the number of applications. Consequently, some patients were postponed their MRI examination, which leads to a sudden increase in the number of applications on the first working day following the holiday period.

it is essential to analyze the applicability of each model When choosing a prediction model.The ARIMA model was characterized by its simplicity of use, broad applicability, and strong interpretability of parameters, enabling it to reflect the inherent characteristics of time series data. However, it was sensitive to noise and was limited to modeling linear trends, resulting in suboptimal performance for non-linear trends. The NAR model, on the other hand, exceled in handling non-linear and non-stationary sequences, offering good adaptability and predictive capabilities. It could automatically learn and capture dynamic features within the sequence, with its structure and parameters adjustable and optimizable according to specific problems. The drawback of the NAR model was that its performance was highly dependent on the selection of network structure and parameters, necessitating extensive tuning and optimization. This increased the risk of overfitting the training data, necessitating the use of regularization and validation techniques to enhance its generalization ability.

This study was based on the time series of MRI examination application numbers, utilizing the ARIMA, ARIMAX, NAR, NARX, and ARIMAX-NARX models to predict future MRI examination demand. By calculating the MSE, MAE, MAPE and R values, we compared the prediction accuracy of various models.The comparison revealed that the NAR model performs better than the ARIMA model, and models with exogenous influencing factors outperformed those without. Consequently, for the data in this study, it was more suitable to introduce exogenous factors such as “holiday status” and to employ nonlinear time series methods for prediction.

The application of integer linear programming in medical resource allocation

This study employed Integer Linear Programming to reasonably plan the actual number of inspections required for each MR per day, in order to achieve the goal of minimizing costs.Managers could effectively allocate resources and optimize inspection processes according to the outcomes of linear programming, thereby enhancing overall efficiency to its maximum potential. The integer linear programming approach is straightforward to implement. Once the daily demand for a week was determinded, the actual number of inspections required for each MRI could be planned.

In practice, the MR system occasionally required maintenance or scheduled downtime and was also subject to unexpected failures. This necessitated the planning staff to adjust the linear programming parameters at any time in accordance with the MR system’s status, in order to formulate a model for the minimum examination cost under the given conditions.

The sensitivity analysis conducted above revealed that the operational status of the machines significantly influenced the examination costs. In the event of a machine malfunction or maintenance, it was necessary to extend the working hours of other machines and increase their utilization rates to reduce examination costs and decrease patient waiting times.

The significance of applying optimized flowcharts

The creation of optimized flowcharts involved the systematic integration of relevant elements, thereby processualizing and institutionalizing the optimization scheme for the allocation of MRI examination resources. The establishment of these flowcharts offered a lucid depiction of the relationships and functions associated with each component, facilitating the identification of bottlenecks or issues. Moreover, they served as a normative and directive mechanism, guiding individuals in executing their tasks in the appropriate sequence and manner, thereby preventing errors and omissions, and enhancing work efficiency and uniformity.

During the implementation of the optimized process, certain difficulties were encountered, primarily related to data accuracy issues. These included historical examination request volumes, the maximum daily workload per machine, and the costs associated with various examinations. If the data were inaccurate, the results of the model’s predictions and the effectiveness of linear programming would not reach their optimal level, thereby diminishing the significance of the process optimization. Collecting and processing the data required a considerable amount of time and technical expertise from the staff, as well as a sense of responsibility. This aspect of the work was often overlooked in practice.

The limitations of the study and directions for future research

This study has several limitations. Due to the incomplete availability of existing data, it was not possible to incorporate potential influencing factors on MRI examination demand into the model, such as weather conditions, temperature, healthcare insurance policies, and infectious disease outbreaks. Furthermore, in the aspect of examination volume planning, the impact of MRI maintenance on overall planning has not been considered.

Moving forward, the next step was to further collect relevant data that could potentially affect the demand for MRI examinations, continuously optimizing the model parameters to improve prediction accuracy. Simultaneously, a precise analysis of the examination costs was conducted, including machine depreciation, consumables, labor, electricity, and patient loss due to extended waiting times, with the aim of enhancing the benefits of linear programming.

In the subsequent step, the research was to be expanded in both horizontal and vertical directions. Horizontally, the primary focus was on collecting data from different types of hospitals, including public, private, and specialized hospitals, to test and validate each step in the optimized flowchart. This process involved continuously improving data prediction, linear programming, cost calculation, and method evaluation to enhance the applicability and scalability of the approach. Vertically, system development was undertaken based on the optimized flowchart to achieve automatic data collection, prediction, planning, and evaluation, thereby reducing the burden of data processing and analysis for staff and improving the accuracy of analyses. Additionally, the analysis results were to be integrated into the hospital management system to provide data support for the overall planning of hospital operations.