Abstract
The current application of intelligent algorithms has achieved certain applications in smart medical, but its application in the automatic grading of admitted patients is in a blank, which makes it difficult to allocate hospital resources effectively. In order to improve the efficiency and accuracy of automatic classification of patients admitted to hospital, this study builds the corresponding genetic algorithm operator based on genetic algorithm. At the same time, this paper uses the random method to generate the initial population and uses the inversion mutation operator to perform the mutation operation. In addition, this article combines image processing to automatically classify patient types and patient levels. Finally, this paper uses the data collection method to verify the model and input the data into the research model. The research shows that the model proposed in this paper has certain effects, which can realize the automatic grading of patients admitted, and can provide theoretical reference for subsequent related research.
Introduction
As the number of elderly populations grows, the variability and increased epidemics and hospital medical services upgrade, how to allocate medical resources effectively and efficiently will be a problem that needs to be solved in the future. Due to the particularity of biomedical data, in the early, middle and late stages of data analysis, the processing of missing values, the processing of categorical variables, the processing of missing values, the processing of categorical variables, the processing of unbalanced data, and the analysis of isolated points play a key role and are also the basis and common technology for technological development or competitive technology in the field of mobile medical. Moreover, the rapid development of the mobile healthcare industry will generate a large amount of specific mobile medical data. Biomedical data, especially mobile medical data, is diverse (including data sources, diversity of data formats), imbalances, incompleteness, randomness, and categorical variables. The solution of these problems requires different methods from other fields [1]. Automatic grading of admitted patients is an intelligent medical method proposed in this context.
Nurses are an indispensable group in hospitals, as performers of patient treatment and care, as guardians of the health of communities and grassroots people, and as communicators of health knowledge among the public, they play an important role in promoting human life safety and physical health Roles. In order to further implement the standard for the allocation of hospital nurses and strengthen the reasonable matching of the number of hospital nurses with the actual workload, the Health and Family Planning Commission compiled the “Outline of National Health Service System Planning (2015–2020)” in 2014. The ratio of nurses to beds is not less than 0.6:1. Prior to this, the former Ministry of Health issued the “Outline of China’s Nursing Career Development Plan (2011–2015)” (the “Outline”) in December 2011. The outline states that by 2015, national tertiary general hospitals, some Level specialist hospitals (oncology, children, obstetrics and gynecology hospitals), the ratio of the total number of nurses in the hospital to the actual open beds is not less than 0.8:1, and the ratio of the total number of nurses in the ward to the actual open beds is not less than 0.6:1; The ratio of the total number of nurses to the actual open beds in secondary general hospitals and some secondary specialized hospitals (oncology, children, obstetrics and gynecology hospitals) is not less than 0.6:1, and the ratio of the total number of nurses in the ward to the actual open beds is not low. In 0.4:1. However, according to the Ministry of Health’s survey of more than 400 hospitals across the country, the average ratio of ward nurses to beds is 0.33:1, and more than 95% of the inpatients in hospitals rely on family members or caregivers to undertake the care. The irrational configuration of nurses leads to poor quality of care, overload of nurses, and low patient satisfaction, which seriously affects medical safety. Scholars at home and abroad have done some research on the allocation of nursing human resources. It starts with the calculation of nursing hours, patient scoring and nurse grading. Domestic nursing experts divide nursing work into direct care and indirect care. Nursing man-hour measurement methods include self-recording method, observation method, simple counting statistics method, patient classification system measurement method, and nursing workload load weight method. The basic steps include: (1) summarizing and defining nursing items; (2) measuring the time of each nursing item; (3) collating, counting and calculating the nursing workload of the nursing unit; (4) calculating the ideal number of nursing human resources. At present, the content of China’s patient scoring system is tedious and complicated, lacks clinical operability, and there is no standardized and scientific pediatric patient scoring system. Most hospitals are still deploying nursing human resources according to the level of care and beds under the doctor’s orders. At the national level, no nurse hierarchy has been established. Some hospitals realized the need to implement nurse hierarchical management, and carried out some explorations and researches, such as star nurse selection, nurse-level scoring, hierarchical management by job title, implementation of the responsible team leader, etc., which helped some improvement and improvement of nursing quality., But did not address the fundamental issue of the current state of care. These explorations are only a rough evaluation of nurses one-sidedly. They do not play a role in planning the careers of nursing staff. At the same time, they lack systematicness, scientificity and sustainability.
Related work
As the number of elderly populations grows, the variability and increased epidemics and hospital medical services upgrade, how to allocate medical resources effectively and efficiently will be a problem that needs to be solved in the future. The application of a large number of modern statistical methods in this field has led to many breakthroughs in statistical methods for adjusting missing data, and methods have been continuously improved [2].
The problems in practical application are often unbalanced classification problems. It is difficult to obtain satisfactory classification results by using the traditional classification method based on ideal conditions. To this end, people have proposed various solutions for many years, which can be roughly divided into two types: One is to reduce the imbalance of the original data by changing the distribution of the training set samples; the second is to adapt to the unbalanced classification problem by modifying the algorithm defects [3]. The training set re-sampling method and the training set partitioning method are two main methods for changing the sample distribution of the training set. Methods such as classifier integration, cost-sensitive learning, and feature selection are strategies for correcting algorithmic flaws. However, since redundant and noisy sample data are only a small part of the situation, it is very common for resampling methods to achieve a balanced effect. Some people have found through experiments that the imbalance of the training set is better than the cost-sensitive learning and resampling methods [4]. Longchao Z et al. [5] found that if the sub-classifier is obtained by the method of training set partitioning, then the method of classifier integration can be used to obtain better results. Since the distribution balance of features is related to the balance of the sample size distribution, the solution of the imbalance classification problem needs to be concerned with the method of feature selection. Therefore, starting from the characteristics of the unbalanced classification problem, selecting the most distinguishing features and applying methods such as machine learning, and statistical learning is beneficial to improve the recognition rate of rare classes [6]. Naz S et al. [7] proposed a new method for unbalanced medical data, which was considered for local density and local class structure and achieved good results. Hasanipanah M et al. [8] used Bayesian networks to classify unbalanced medical document data and achieved better results.
Classification variables are very common in medical data, such as gender, occupation, number of illnesses, presence or absence of lesions at specific sites, treatments, ability to live, etc. Even for some continuous variables such as age, level of education, etc., it is often necessary to deal with classification in actual research [9]. The types of the two classifications (0, 1) are frequently encountered. The classical methods used are the logit model and the probit model, and the complementary double logarithmic model is also used. There are two common types of multi-level data in binary data: clustering data and repeated measurement data. Gong W et al. [10] discussed the application of generalized linear mixed models based on generalized linear models and competitive estimation methods. For clustered two-category data, the random effects model is generally identified by Husien S [11]. If the logit model is used to model the response pattern of the two-class dependent variable, there will be a logistic-normal mixture model that has a good effect on some epidemiological stratified attributes. This model is extended to a class of repeated measures of data for a sample of individuals, and the model is a growth curve model. Chen Z et al. refer to [12] as the multilevel models for change, and the model estimates have marginal maximum likelihood method, expansion of multivariate random effects, approximation method, Markov chain Monte Carlo, etc. It has also been proposed [13] to use Bayesian modeling for model estimation. There are event-history analysis, duration analysis, and hazard rate models for changes or transitions from one qualitative state to another over time [14]. Wu G [15] and others used the EM algorithm to use the maximum likelihood method on histopathological data and anesthesia data and achieved good results. Peng X et al. [16] found useful information in 2008 using the TANAGRA data mining tool to monitor the isolated points in a Wisconsin Breast Cancer Database containing 10 attributes of 699 examples.
Through the above research, it can be known that the current intelligent algorithm application has achieved certain applications in smart medical treatment, but the application of the automatic classification of patients admitted to hospital is in a blank, which makes it difficult to effectively allocate hospital resources and it difficult to effectively improve the operational efficiency of hospitals. Based on this, based on the genetic algorithm, this study constructs an automatic grading model for admission patients to solve the problem of patient allocation in hospital admission.
Algorithm design for automatic grading of admitted patients
The automatic grading problem of admission patients with time window and random service time is a combinatorial optimization problem. The automatic grading problem model of admission patients established in this paper is more complicated, and the genetic algorithm can be used to solve complex optimization problems. At the same time, the access order of patients admitted to hospital and the expression of chromosome coding in genetic algorithm have certain compatibility, and the genetic algorithm designed to retain the best individual strategy can greatly improve the convergence speed and avoid falling into local optimum.
According to the characteristics of the soft time window model constructed in this paper, the genetic algorithm for solving the model is designed according to the principle of genetic algorithm and the basic implementation steps. The algorithm design mainly includes chromosome coding design, initial population generation, fitness function design, genetic operation, termination rules and so on.
The genetic algorithm is characterized by not directly acting on the variables of the actual problem, so it is necessary to convert the solution into the genotype string structure of the genetic space by means of coding.
The coding methods used to solve different problems are different, and the commonly used coding methods are binary coding, alphabetic coding, natural number coding, etc. Among them, binary coding is the most commonly used coding method, but it is not suiTab. for solving the order combination optimization problem. The solution space can be well expressed by natural number coding.
In the case where the number of admitted patients has been determined to be k, the service center is represented by a natural number “0”, the number of customer points is n, i is a customer point, and a sub-path is represented between two adjacent 0 s, such that a chromosome code string of length k + n + 1 is formed.
Although service center 0 can distinguish different paths, it is easy to generate a large number of invalid solutions in the subsequent intersection stage, which is easy to narrow the search space of the genetic algorithm. Therefore, it is not appropriate for the path optimization problem of the number of patients admitted to the hospital.
In order to avoid the above problems, the path optimization problem of the admitted patients in this paper does not add the hospital center to the chromosome structure, but directly encodes the customer points to be encoded in one chromosome (x1, x2, x3, ⋯ , xn-1, x n ). This coding method ensures that each customer point is accessed once and only once, and is beneficial for cross-variation operations, and does not need to consider the location of the service center, which reduces a large number of infeasible solutions.
Decoding is the process of transforming a chromosomal gene string into a feasible solution, in which all constraints need to be considered. First, the customer point represented by the first gene of a chromosome gene string a is used as the starting point of the kth path, and the time when the admitted patient reaches the initial customer point is calculated. Then, from left to right, all customers satisfying the time window constraint are sequentially added to the current path, that is, all the customer points accessed by the current path k are obtained. Then, all the customer points of the kth path are deleted from the gene string a to form a new gene string. Finally, a new round of operations is repeated to obtain the k + 1-th path, and the above steps are repeated until all clients in the chromosome are accessed, that is, the access path for all admitted patients is obtained.
Genetic algorithm is a group search algorithm that searches individuals in a population at the same time. Therefore, the first-generation initial population is the object of genetic manipulation and is the starting point of evolution. Although the optimal solution of the genetic algorithm does not depend on the initial population, a better initial population can accelerate the convergence speed of the genetic algorithm and improve the efficiency of the algorithm. Therefore, in order to distribute the initial population as evenly as possible in the solution space, the initial population is generated in a random manner.
First, all customer points are arranged in the order of the lower bounds of the accepTab. time window. If the lower bounds of the accepTab. time window are the same, they are arranged according to the upper bound of the accepTab. time window so that the first chromosome of the initial population is obtained. Secondly, the natural numbers from 1 to n are randomly arranged to obtain different gene strings as M–1 chromosomes. The size of the population size affects the final result of the genetic algorithm and the efficiency of the operation. Therefore, for a solution with a small chromosome length, the population size is appropriate. However, for large-scale operations, the size of the population can be appropriately increased according to the length of the chromosome.
The fitness function is the basis used in genetic algorithms to evaluate the pros and cons of an individual and to perform genetic operations. The greater the individual’s fitness function value, the greater the probability that the individual will be selected into the next generation. The fitness function is generally determined according to the objective function, the fitness function is non-negative, and the objective function may have positive and negative values. The random service time studied in this paper and the admission patient path problem with soft time window are optimization problems that minimize the total cost. However, in genetic algorithms, the larger the fitness function value of an individual is, the better the result is. Therefore, the objective function needs to be converted into a fitness function. The algorithm in this paper uses the following method to transform the objective function into a fitness function:
In the above formula, z i is the objective function value corresponding to the i-th chromosome in the population, f i is the fitness function corresponding to the i-th chromosome, and m is the population size.
The role of selecting operators in genetic algorithms is to screen out individuals with high fitness from the current population, so that these individuals have the opportunity to proproduce the next generation as a parent. Because the roulette selection operator is simple to operate, it is the most commonly used selection operator in genetic algorithms. After roulette selection, a randomly selected individual is obtained. Although the selection process is random, the probability that each individual is selected is proportional to the individual’s fitness, that is, the greater the fitness, the greater the probability of being selected. In this way of selecting individuals, the population is seen as a round of gambling. Moreover, the individuals in the population are allocated to the various regions of the wheel, and the area of each region is proportional to the fitness value of the corresponding individual, and the rotating wheel can be regarded as the beginning of the selection operation. When the roulette is stopped, the individual corresponding to the area indicated by the pointer is the randomly selected individual. A schematic diagram of operator selection through roulette is shown.
As mentioned above, the greater the fitness, the greater the probability that an individual is selected, but it does not mean that these individuals must be selected. This article combines the best individual retention strategy with the choice of roulette to take the design of the selection operator. We assume that the fitness of chromosome i is f
i
and the population size is M. The specific steps are as follows: The fitness value f
i
of each chromosome is found, and the individual with the greatest fitness h, f
h
= max(f1, f2, ⋯ , f
M
) is found. The probability Chromosome accumulation probability is calculated.
Within interval [0, 1], a uniformly distributed random number r is generated. If r ≤ q1, the first chromosome in the parent population is copied. If qk-1 < r < q
k
(k = 2, 3, ⋯ , M), the k-th chromosome is copied. This is repeated until the number of chromosomes copied reaches the population size M. Among the selected M chromosomes, the lowest fitness individual m is found, f
m
= max(f1, f2, ⋯ , f
M
). The individual h with the highest fitness in the father replaces the individual m with the lowest fitness, so that the new generation group includes the individual h with the highest fitness.
The roulette selection operator combined with the optimal individual retention strategy not only ensures the randomness of selection, reduces the probability of precocity, but also enables the optimal individual to be copied to the next generation for genetic manipulation, which accelerates the convergence of the population and improves the computational efficiency of the algorithm.
An example of a class PMX operation is as follows:
(1) Two intersection locations are randomly selected on the two parent chromosomes to determine the intersection area, such as two parents and the intersection area selected as:
A = “389|2764|51”,
B = “842|6135|79”,
Among them, the area between “||” represents the intersection area;
(2) The gene sequence of the crossover region on the two chromosomes of the parent is added to the front of the first gene of the other chromosome, namely:
A1 = “6135|3892 76451”
B1 = “2764|8426 13579”
(3) The gene in the crossover region that is duplicated with the pre-gene is deleted, that is:
A2 = “613589274”
B2 = “276481359”
A2 and B2 are new individuals. The schematic diagram of the cross process is shown in Fig. 2.

Schematic diagram of roulette.

Cross-sectional schematic of partial matching.
The mutation operation is to mimic the mutation of certain genes in the chromosomes in nature. Since the probability of gene mutation is small, the mutation operation is also performed with a small mutation rate. This determines that the mutation operator plays a major role in assisting evolution in genetic algorithms, but it is also an indispensable link. In this paper, the invariant mutation operator is used to perform the mutation operation. The specific operation is to randomly select two mutation points on the chromosome and reverse the gene sequence between the mutation points to obtain a new individual. An example of the inversion variation process is as follows:
(1) Two mutated points are randomly generated in the gene sequence of the chromosome
C = “49101385627”
Two mutation points are randomly generated, such as 3 and 7, that is
C = “49|101385|627”
Among them, “||” represents the variation area.
(2) The gene sequence between the mutation points is inverted. That is,
C1 = “49583110627”
The mutation operation is shown in Fig. 3.

Schematic diagram of the mutation operation.
The inversion mutation operation can adjust the individual, increase the diversity of the population, reduce the premature probability, and enhance the local search ability of the algorithm. The genetic algorithm is a random search algorithm. In order to end the loop operation of the genetic algorithm, the termination rule must be preset. Common termination rules are as follows:
(1) The pre-set goals have been reached. (2) The optimal individuals among successive generations of populations did not significantly improve compared to the previous ones. (3) The preset maximum number of iterations is reached.
In this paper, the number of iterations is set in advance as the termination rule of the algorithm. If the number of evolutions of the algorithm reaches the set value, the operation is stopped, and the access path corresponding to the chromosome with the highest fitness is selected as the optimal solution of the problem, otherwise the operation is continued. According to the design of each key step of the above genetic algorithm, this paper applies it to the automatic grading optimization problem of hospitalized patients. The algorithm implementation flow chart is shown in Fig. 4.

Algorithm implementation process.
Patients with chronic heart failure who were examined and treated between January 2017 and December 1818 were enrolled and given an echocardiogram. The clinical results obtained are reported below. Heart function classification Level 1: Cardiac patients’ physical activity is not limited, and general physical activity does not cause excessive or unsatisfactory fatigue, palpitations, shortness of breath or angina. Level 2: Mild physical activity is limited, patients have no discomfort at rest, and daily physical activity can cause fatigue, shortness of breath or angina. Level 3: Physical activity is significantly limited, and the patient has no discomfort at rest, and when the activity is below the daily activity, the patient is weak, palpitations, shortness of breath or angina. Level 4: The patient cannot perform any physical activity asymptomatically and may have heart failure or angina symptoms at rest, and any physical activity may aggravate discomfort.
The results show: The difference between the incidence of left ventricular and left atrial enlargement in the three groups was statistically significant (P < 0.05). Moreover, left ventricular enlargement and left atrial enlargement were positively correlated with the grade of cardiac function in patients, as shown in Table 1.
Comparison of left heart structure anomalies
Comparison of left heart structure anomalies
The results of left heart function in patients with chronic heart failure and healthy physical examination showed that the E/A of patients with chronic heart failure was significantly lower than that of the control group, and the difference was statistically significant (P > 0.05). The difference of LVEF between patients with grade 4 chronic heart failure and those with healthy examination was statistically significant (P < 0.05). Compared with the control group, the LVEF of patients with grade 2 and grade 3 chronic heart failure was not statistically significant (P > 0.05). There was no significant difference between the two groups in the Fs of the patients with chronic heart failure and the healthy physical examination group (P > 0.05), as shown in Table 2.
Comparison of left heart function index values in three groups of patients in the control group and the treatment group
The original image of the detected ultrasound image is shown in Fig. 5.

Original image of ultrasonic testing.
Figure 6 is difficult to perform effective grading, and thus the image is subjected to gradation division processing. The results obtained on this basis are shown in Fig. 5.

Ultrasonic detection image after grayscale processing.
The detected enlarged image of the left atrium is shown in Fig. 6. It is difficult to see the effective features from the Fig., so it is difficult to achieve automatic grading. Based on this, the image is subjected to gradation division processing, and the results obtained on the basis of this are as shown in Fig. 7.

Left atrial enlargement image of ultrasound detection.
Based on the above research, the mixed kernel function is selected, and a global polynomial kernel function and a local radial basis kernel function are selected. Therefore, this parameter combination optimization method is used for these two kernel functions. For a SVM with a polynomial kernel function, its performance depends on the parameter group (C, d). The performance of the SVM obtained from different parameter groups will also be different. Similarly, for the SVM with a radial basis kernel function, its performance is determined by the parameter group C, σ) determines that the classifier model finally trained by choosing different C and σ will also be different. In experiments, the maximum number of iterations of the genetic algorithm is usually set to [100,500], here we set it to 200, the population number is generally [20,100], here we set it to 80, the cross probability is 0.6, and the mutation probability is 0.05. After using the genetic algorithm to determine bestc and bestg, the search range of the parameter C in the grid search method is set to [0.5 * bes tc, 2 * bes tc], and the range of g is set to [0.5 * bes tg, 2 * bes tg] to perform secondary precise optimization in the grid. The final parameter optimization results are shown in Figs. 9 and 10, where Fig. 9 is the radial basis kernel function parameter optimization results, and Fig. 10 is the polynomial kernel function parameter optimization results. The optimal parameters of the polynomial kernel function are best t c = 0.57435, best t g = 0.1086, and the optimal parameters of the radial basis kernel function are best t c = 0.87055, best t g = 0.0625.

Ultrasonic detection image after grayscale processing.

Parameter optimization results of polynomial kernel function.

Radial basis function parameter optimization results.
Based on the genetic algorithm, this study constructs an automatic grading model for admission patients to solve the problem of patient allocation in hospital admission. In order to study the validity of the model, this study used echocardiography to conduct patient grading studies.
In this study, a crossover operator is used as a genetic algorithm operator. The crossover operator is a method that mimics the intersection of two chromosomes in the evolution process of natural organisms. The crossover operator randomly pairs the selected individuals and exchanges part of the gene segments in a certain way to form new individuals. Moreover, the crossover operation is performed with a certain crossover probability, which enables the algorithm to search for new gene spaces, thereby making the individuals in the new population diverse. At present, the most common crossover method for solving path optimization problems using genetic algorithms is Partially Matched Exchange (PMX). The principle of PMX crossover is to randomly generate two intersections on the chromosomes of two parents. Then, the regions between the two intersections are interchanged to find the genes that overlap between the regions outside the intersection and the intersection and replace them with the genes on the chromosomes of the region between the intersections. In this way, two new children are obtained. The automatic grading problem of hospitalized patients studied in this paper adopts the integer coding method arranged by the customer, so the cross method adopts a PMX-like operator. The principle of PMX-like crossover is to add a gene sequence between two intersections on a chromosome to the first gene of the other chromosome, and then remove the gene that overlaps with the pre-gene between the intersections, thereby obtaining a new individual.
In the current clinical diagnosis, the use of echocardiography to evaluate the patient’s systolic and diastolic function is the most important means of examination of left ventricular function, which can accurately diagnose and treat the patient’s disease. Moreover, the use of echocardiography to evaluate the overall condition of patients with chronic heart failure can provide a more comprehensive understanding of the internal conditions of the patient’s heart, which is the most direct method for the assessment of changes in ventricular structure. Heart failure is caused by abnormal heart function in patients with resting or heart failure symptoms. The use of echocardiography to diagnose left ventricular function in patients with chronic heart failure does not cause any harm to the patient, and this diagnostic method is widely used in clinical diagnosis. Through observation and analysis of patients, it is found that there is a very close relationship between the level of cardiac function and the structural changes of the heart in patients with chronic heart failure. However, the left ventricular function of patients with left ventricular function and energy failure was statistically significant compared with the control group, and the left ventricular enlargement and left atrial enlargement were positively correlated with the grade of cardiac function. In addition, the peak of diastolic blood flow was significantly lower in patients with chronic heart failure than in normal subjects, and the difference between the control group and the control group was statistically significant. It was observed that the short axis shortening rate did not differ between chronic heart failure and the control group. This indicates that the patient’s myocardium is damaged, the contractility is reduced, the overall function of the heart is reduced, the peak blood flow index of diastole is decreased, and the blood of the vein is restricted when it is discharged. These conditions indicate that the use of echocardiography to observe the diagnosis of left ventricular function in patients with chronic heart failure has very important clinical value. Moreover, the use of echocardiography to evaluate the left ventricular function of patients with chronic heart failure, it is found that its clinical value is very high, and the diagnostic technique is also widely used clinically. According to the summary of the research results, the model constructed in this study can effectively sort out the information of patients admitted to the hospital and can be automatically graded on the basis of this, so as to achieve effective patient allocation.
Conclusion
Based on the genetic algorithm, this study constructs an automatic grading model for admission patients to solve the problem of patient allocation in hospital admission. Aiming at the characteristics of the soft time window model and the principle and basic implementation steps of the genetic algorithm, the genetic algorithm for solving the model is designed. The algorithm design mainly includes chromosome coding design, initial population generation, fitness function design, genetic operation, termination rules and so on. In this paper, the invariant mutation operator is used to perform the mutation operation. The specific operation is to randomly select two mutation points on the chromosome and reverse the gene sequence between the mutation points to obtain a new individual. In addition, this paper uses the number of iterations set in advance as the termination rule of the algorithm. If the number of evolutions of the algorithm reaches the set value, the operation is stopped, and the access path corresponding to the chromosome with the highest fitness is selected as the optimal solution of the problem, otherwise the operation is continued. Through the summary of the research results, it can be seen that the model constructed in this study can effectively sort out the information of patients admitted to the hospital and can be automatically graded on the basis of this, so as to achieve effective patient allocation.
