# Realization of Mental Health Counseling Service Platform Using Wireless Communication Network and Genetic Algorithm

Authors: Zhiming Chen; Youtao Duan; Yan Chen
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

Healthy life has always been the goal pursued by human beings. Physical health is not just about physical health but also mental health. Although mental health has become more and more important in people’s minds, there are still a large number of people who do not understand psychological counseling or do not enjoy psychological counseling. Based on this, this paper was aimed at designing a mental health counseling service platform, so that most people can solve their own psychological problems through the modern high-speed developed network. For the design of the platform, this paper focuses on the design of three functions: instant messaging, psychological testing, and expert consultation. The optimization of the platform uses the genetic algorithm to optimize the wireless communication technology, so that the communication efficiency of the platform is higher and the energy consumption is less. The experimental results of this paper show that compared with the other three algorithms, the algorithm in this paper is in the leading position, and the overall power consumption is reduced by 10%. And after testing, the platform of this paper can operate effectively and can provide a solution platform for mental health counseling users.


---

## Body

## 1. Introduction

Western countries are relatively developed in terms of culture, technology, and medical care, and their exploration of mental health issues will start from the essence. For mental health issues, research on mental illness requires the sharing and combination of multiple sources of information. Different research teams may focus on different aspects of mental illness. Therefore, an ontology study needs to be established between the research teams. Especially in today’s rapid development of web technology, the importance of research on web service community ontology is to provide a semantic framework and share knowledge for all parties to use. At the same time, ontology technology combined with network technology has been verified to help create a cooperative environment and improve the operability of the system. Most mental health exists in the form of electronic information, including blogs and multimedia channels. The application of advanced information technology in the field of mental health has great potential to increase the value of the information available. Specifically, the ontology form is the basis for the research team to combine data mining technologies such as building semantic web services and intelligent multiagent systems such as intelligent information retrieval and automatic data analysis. This research model of mental health ontology can actively consolidate various automatic tasks and use and manage constantly changing psychological information, creating a new research idea for the field of mental health.The main innovations of this paper are as follows: (1) according to the platform design requirements of this paper, the overall design of the platform is completed. Then, it introduces the overall architecture design of the mental health service platform and divides the platform into three subsystems. It mainly introduces the functional modules of the mental health management subsystem and the mental health consultation service subsystem, including functions such as heartbeat measurement, message, personal center, psychological test, expert consultation, psychological information, and psychological community. Based on cloud computing, it provides users with personalized psychological services. Finally, the database design is carried out for the two subsystems. (2) The system in this paper uses JavaEE technology from the server backend, and the database uses MySQL. Based on the MVC idea, the SSH framework is constructed, and the static page of the front-end server is realized through HTML/CSS, and the dynamic interaction with the back-end is realized by Ajax. It also deploys the cloud computing environment on the Hadoop platform to analyze and process large amounts of data.


## 2. Related Work

Mental health problems are often inseparable from physical health. Many foreign scholars have discussed the relationship between physical health and mental health from the perspective of physical health. In view of the complementary relationship between the two, the shadow of foreign scholars’ research can be seen in all aspects of physiological health, which has nothing to do with the severity of physiological diseases and has nothing to do with the perspective of physiological health. Kiima attempted to address the challenges of mental health with the aim of introducing sustainable mental health policy and implementation across the country when resources are extremely scarce [1]. Silove et al. considered issues in the field of contemporary refugee mental health, including research development, conceptual models, social and psychological interventions, and policy [2]. Hoy-Ellis et al. examined the relationship between previous military service, identity stigma, and mental health in transgender older adults. They believed that by identifying the role of military service in the mental health of transgender older adults, it can provide insights into how previous military service can contribute to recovery and positive mental health outcomes [3]. Sonuga-Barke et al. used data from UK and Romanian adoptee studies to assess whether deprivation-related adverse neurodevelopmental and mental health outcomes persist into young adulthood [4]. Although there are earlier studies on mental health problems abroad, the research on its mechanism is not in-depth.As the physiological health service platform is more and more focused by people, there are new changes not only in consciousness but also in technology. People’s research focus began to focus on wireless communication networks. Wong et al. aimed to understand the attitudes and behaviors of postsecondary students when using the codesigned mental health app and online platform think Spot to understand the factors associated with engagement and user experience [5]. The purpose of Mowafa is to present the conceptual framework of the Mental Health Assistant (MeHA) digital platform being developed for the Arab world. The purpose of the platform is to provide mental health information and educational resources through the use of conversational agents and multimedia messaging and to digitally connect patients with mental health providers [6]. The purpose of Gibbs et al. was to describe the development and experience of the Mental Health Professionals Network (MHPN) in establishing and supporting a national interdisciplinary professional development platform for community mental health to enhance practitioner responsiveness to consumer needs [7]. Using a simple driver diagram, Sachar developed a model of an improved approach to implement system-wide interventions. MH is fully embedded in the entire product suite at NWL, including 10-year service specification, clinical guidelines, staff training and PWD, and digital platform [8]. To sum up, the relationship between physical health and mental illness is the focus of research by foreign scholars. They are closer to health itself, closer to reality. From the diseases that may accompany everyday life to deadly cancer, from the pregnancy of mentally ill patients to the growth of children, there are meticulous studies. However, they lack humanistic care, lack of perceptual understanding, and the comprehensive popularization of education, which may lead to the problem of treating the symptoms rather than the root cause.


## 3. Mental Health Platforms and Technologies

### 3.1. Mental Health Counseling

Psychological counseling is an important profession in modern society, and the norms and development levels of its professional behavior are closely related to people’s physical and mental health and vital interests. But for a long time, counseling in China was a less popular “cold” industry. They are mostly concentrated in areas such as hospitals and schools. There are few socially oriented services and there is a serious shortage of psychosocial counseling institutions. Among the only psychological counseling institutions, the scale is also dominated by small and micro psychological studios. They are mainly engaged in psychological case counseling and struggle to make ends meet. At present, taking Shenzhen as an example, there are more than 200 such psychological counseling institutions of different sizes. They’re still building up fast, but they are also going out of business fast at the same time. The reason for this is that the entry threshold for the entire psychological counseling industry is low, and in principle, as long as you obtain a psychological counseling certificate issued by the state, you can work. A company can be registered with a capital of tens of thousands of yuan, and consulting activities can be carried out without too much investment. There is not much market-oriented operation in the entire industry, and no good institutional brand has been formed. Consumers’ selection of psychological counselors also completely depends on the industry reputation and industry status of the counselors [9].With the rapid development of China’s economy, people’s demand for mental health is increasing day by day, and their pursuit of the spiritual world is increasing day by day. This means that people will pay more attention to the enrichment of their inner world after satisfying their material needs. In China, the number of corporate legal persons has almost doubled since 2010. With the hot promotion of “mass entrepreneurship and innovation,” the number of Chinese enterprises will continue to increase. The increase of enterprise employees will also lead to many psychological problems, such as low work efficiency, high work intensity, coordination between work and life, and death from overwork. Especially for small- and medium-sized enterprises, the rules are not perfect, and more psychological care for employees is needed. A huge psychological “subhealth” group is emerging. At the same time, this also means the rise of a huge “market” or “potential market” for psychological counseling services. However, these demands have not been transformed into “effective market demands” in the true sense. The supply of traditional psychological counseling institutions cannot meet the current market demand for psychological counseling. A large amount of potential demand for psychological counseling has not been stimulated, and there is a serious mismatch between supply and demand, as shown in Figure1.Figure 1
Current status of psychological counseling.
(a)
Psychological adjustment(b)
Psychological counseling marketMental health is an external manifestation of a mental state in which an individual can adapt to the developmental environment and has perfect personality characteristics. At the same time, the individual’s cognition, emotional movements, and mental awareness are in a positive state, and they have the ability to maintain normal regulation. The basic characteristics of mental health are manifested in daily life; that is, individuals can clearly understand themselves, consciously control themselves, adapt to the outside world, and correctly deal with external influences, so as to maintain a balanced and coordinated state of mind. Mental health is a kind of health state that is different from human physical health and can be measured by standard specific and objective scales. It starts from the subjective will of the individual and comprehensively and objectively judges the health of the individual from various states such as cognition, emotion, will, behavior, personality integrity, and coordination, so as to help the individual to grow up positively and healthily.Mental health is undoubtedly the absence of any mental illness. Mental illness has become one of the major problems in today’s society. The World Health Organization predicts that depression will be the leading cause of disability in the world by 2020. Mental illness has also been shown to be a causative factor in many chronic diseases such as diabetes, high blood pressure, and AIDS, resulting in higher costs to the health system. However, the various sources of information on mental illness are often fragmented, making it difficult to connect this information, share it, or even find it when needed. Therefore, at home and abroad, high attention is paid to mental health problems from both the physical and psychological levels. The physical level includes the collection of heartbeat signals and the analysis of the state of physiological health. The psychological level includes the causes, development, and solutions of psychological problems that have been improved to varying degrees [10, 11].


### 3.2. Mental Health Consultation Platform

The mental health service platform uses the heterogeneous data sources obtained from the collection end, analyzes and processes the heterogeneous data sources through the cloud computing platform middleware technology, and provides specific interface services to the platform users. Some scholars believe that mental health problems should be regarded as a long-term research object. As with chronic diseases, the user’s psychological characteristic data is collected in real time, and the user-specific psychological characteristic data is stored and subsequently classified, so that the mental health service platform can be used as a long-term monitoring service [12, 13]. Of course, this is a time-consuming and labor-intensive job.The health database is the foundation of the mental health database, involving three types of databases: clinical examination databases, which are used to store and manage multilevel brain and psychological data obtained from diverse clinical examinations; wearable database to store and manage raw data from diverse wearable medical devices; and the medical information database which is used to store and manage patient-related medical information obtained from various medical information systems such as digital medical record systems.There are integrated information bases and integrated knowledge bases in these health databases. The integrated information base includes semantic medical comprehensive information and brain information origin, health index database, and case database. Semantic medical information is obtained by importing external semantic medical information sources or transforming patient-related medical information from a medical information database. Brain informatics provenance is metadata of brain and mental data stored in clinical examination databases or wearable databases. This integrated knowledge base includes a variety of domain ontology and model libraries. All domain ontologies here are based on multidimensional data brain integration.The realization of mental health big data center requires a lot of IT resources, including computing resources, storage resources, and communication resources. Therefore, it is necessary to build such a mental health system architecture on a cloud computing platform to obtain IT resources of IaaS services, PaaS services, and SaaS services. PaaS services are the most important part of building a mental health system architecture. Most of the IT resources required by the mental health big data center and the data of the smart service platform are obtained by calling the corresponding PaaS service cloud computing platform. Although the idea of this platform architecture is good, its complexity is also obvious, and it is not suitable for dissemination and expansion in the pervasive mobile Internet environment [14].


### 3.3. Node Optimization of Hybrid Wireless Communication Network

With the rapid development of science and technology, people have higher and higher requirements for data transmission. The scale of smart psychological counseling platforms is also increasing day by day. What follows is the construction and optimization of wireless communication networks that consult users on a large scale. After solving the problem of communication network construction, then solve the communication network optimization problem. This is the only way to increase the data transmission rate and reduce the communication energy consumption. For communication network optimization, it mainly focuses on routing protocols, hardware resource upgrades, and optimized deployment of network nodes.Compared with the former two, the optimal deployment method of network nodes optimizes the existing and limited hardware resource configuration by adjusting the deployment positions of communication network nodes. It can improve the efficiency of data transmission, reduce the energy consumption of the communication network, and reduce the cost of hardware investment on the basis of ensuring the full connectivity of the information transmission network. However, traditional communication network node deployment mostly adopts relatively rough schemes such as random deployment, postdeployment adjustment, simple measurement method, or composition-based technology. While increasing the number of communication nodes, it is also very easy to cause problems such as disconnection of basic nodes (data acquisition nodes and action nodes), packet loss in data transmission, and high transmission energy consumption.In this regard, this paper proposes a wireless network communication algorithm based on genetic algorithm for the deployment of intelligent psychological counseling communication network nodes. Specifically, it is a layered communication network node scheme. Under this scheme, the following definitions are made for the deployment of communication network nodes. According to actual needs, after completing the installation and deployment of data acquisition nodes and action node equipment, by adjusting the deployment positions of relay nodes and aggregation nodes, wireless networking is performed for all basic nodes.


#### 3.3.1. Establishment of Node Deployment Model of Communication Network

First, the units and meanings of some relevant formula symbols appearing in this section are explained, as shown in Table1.Table 1
Formula symbol description table.
Formula symbolUnitMeansDijkmDistance between two nodesCijkmConnectivity between nodesERnA∙tbit−1Data reception energy consumptionETnA∙tbit−1Data transmission energy consumptionEKnA∙tbit−1Energy consumption of relay node data forwardingdkmDistance between sending node and target nodekBitAmount of dataWhen all devices and related communication nodes are under the coverage of a communication network, the network can be called a fully connected network (FCN). Based on this theory, the FCN model of smart agriculture is established, and the process is as follows:In a 3D environment, the distanceDij between two devices or communication nodes Sixi,yi,zi and Sjxj,yj,zj is
(1)Dij=xi−xj2+yi−yj2+zi−zj2.If the sum of the coverage radii of two devices or communication nodes is less than the distance between them, it is said to establish a connection. The specific formula is expressed as follows:(2)Dij<ri+rj.The communication connection relationship between all devices or communication nodes can be expressed by the following formula:(3)Cij1,i≠j,0,else.The connectivity relationship between all data acquisition nodes (DataAcquisitionNode, DN) and the corresponding relay node (RelayNode, RN), and the connectivity relationship between all action nodes (ActionNode, AN) to the corresponding RN can be further deduced. The connectivity between all RNs and sink nodes (SinkNode, SN) and the connectivity of all network nodes are as follows:(4)Cac=∏i=1na∏j=1ncCij=1,(5)Cbc=∏i=1nb∏j=1ncCij=1,(6)Ccd=∏i=1nc∏j=1ndCij=1,(7)Call=CacCbcCcd=1.For the calculation of communication energy consumption, it can be divided into two parts: ET (transmitting energy consumption) and ER (receiving energy consumption):(8)ET=kEelec+kEampd2=kEelec+Eampd2,(9)ER=kEelec.When the RN node performs data relay, the energy consumption isEk:
(10)Ek=ER+ET.The energy consumption calculation process during data transmission between RN and AN nodes is as follows:Step 1.
It can be inferred from formula (10) that the energy consumption Eji of RN node Cj to an AN node ai to complete a single transmission of data packet information kj∙bit is
(11)Eji=kjEelec+EampDij2.Step 2.
It obtains the total energy consumptionEcj of RN node Cj to the n AN node na connected to it to complete a single transmission of kj∙bit’s data packet information:
(12)Ecj=∑i=1nakiEelec+EampDij2.Step 3.
The total energy consumptionE1 of all RNs sending data to all AN nodes connected to them is
(13)E1=∑i=1na∑j=1nckjEamp+EelecDij2.Step 4.
The total energy consumptionE2 corresponding to the reception of all AN nodes is
(14)E2=∑i=1naERi=∑i=1nakiEelec.According to the above derivation process, the communication energy consumption of other nodes in the network is calculated as follows:The total energy consumptionE3 for all BN nodes to send a single data packet to the RN node is
(15)E3=∑i=1nb∑j=1nckiEamp+EelecDij2.The receiving energy consumptionE4 of all RNs is
(16)E4=∑i=1nbERi=∑i=1nbkiEelec.The total energy consumptionE5 for all RN nodes to complete a single data upload to the SN node is
(17)E5=∑i=1nckiEamp+EelecDij2.And the receiving energy consumptionE6 of SN is
(18)E6=∑i=1ncERi=∑i=1nckiEelec.The total energy consumptionE7 for the SN node to complete a single data delivery to all RN nodes is
(19)E7=∑j=1nckjEamp+EelecDij2.The receive energyE8 of all RNs is
(20)E8=∑j=1ncERi=∑j=1nckjEelec.


#### 3.3.2. Genetic Algorithm Optimization Solution Design

Genetic algorithm is a fast and fault-tolerant algorithm that performs global optimization search on a set of encoded feasible solution spaces. It is a class of algorithms that can be used for complex system optimization calculations. Compared with other search methods, it adopts many unique techniques and methods and has many advantages. The basic flow of the genetic algorithm is shown in Figure2:Figure 2
Flowchart of genetic algorithm.On the basis of the theory in this paper, the information amount of each BN node is used as the weight to guide the M population at the vertex of the TP to move to the direction with higher weight until the weight balance is achieved. The weight balance condition is(21)∂idm,i=∂i+1dm,i+1.The meaning of formula (21) is that the product of the weights of the three BN nodes and the respective distances d of the corresponding TP vertices is equal to the product of the weights and distances of the other two nodes. Figure 3(a) shows the process of directed search weight balancing:Figure 3
Algorithm optimization diagram.
(a)
Population generation and directed search(b)
Initial optimizationIn Figure3(a), A, B, and C are BN nodes, and 1 is the TP vertex corresponding to the BN node. The figure on the left shows the case where a population is generated at 1, and the weight values of A, B, and C are, respectively, α,β,γ in the right part (α<β<γ) and the case of directed search.On the premise of the completion of the TP construction, according to the above-mentioned strategies of population generation and directed search, the five TP vertices numbered 1, 2, 3, 4, and 5 in the graph are further weight-balanced. After the balance movement is completed, the TP vertices are connected in sequence to realize the initial optimization. The results are shown in Figure3(b).In Figure3(b), through the movement of TP vertices (1-5), the optimal position of RN deployment has been bound in the space enclosed by 5 TP vertices. In the next step, the Moth population is generated at positions 1, 2, 3, 4, and 5 in the graph, and the optimization can be performed in the space enclosed by the TP vertices. According to the above steps, the deployment of all RNs is completed, and then, the deployment position of the SN node is determined again by taking the deployment position of the RN as a known quantity.


## 3.1. Mental Health Counseling

Psychological counseling is an important profession in modern society, and the norms and development levels of its professional behavior are closely related to people’s physical and mental health and vital interests. But for a long time, counseling in China was a less popular “cold” industry. They are mostly concentrated in areas such as hospitals and schools. There are few socially oriented services and there is a serious shortage of psychosocial counseling institutions. Among the only psychological counseling institutions, the scale is also dominated by small and micro psychological studios. They are mainly engaged in psychological case counseling and struggle to make ends meet. At present, taking Shenzhen as an example, there are more than 200 such psychological counseling institutions of different sizes. They’re still building up fast, but they are also going out of business fast at the same time. The reason for this is that the entry threshold for the entire psychological counseling industry is low, and in principle, as long as you obtain a psychological counseling certificate issued by the state, you can work. A company can be registered with a capital of tens of thousands of yuan, and consulting activities can be carried out without too much investment. There is not much market-oriented operation in the entire industry, and no good institutional brand has been formed. Consumers’ selection of psychological counselors also completely depends on the industry reputation and industry status of the counselors [9].With the rapid development of China’s economy, people’s demand for mental health is increasing day by day, and their pursuit of the spiritual world is increasing day by day. This means that people will pay more attention to the enrichment of their inner world after satisfying their material needs. In China, the number of corporate legal persons has almost doubled since 2010. With the hot promotion of “mass entrepreneurship and innovation,” the number of Chinese enterprises will continue to increase. The increase of enterprise employees will also lead to many psychological problems, such as low work efficiency, high work intensity, coordination between work and life, and death from overwork. Especially for small- and medium-sized enterprises, the rules are not perfect, and more psychological care for employees is needed. A huge psychological “subhealth” group is emerging. At the same time, this also means the rise of a huge “market” or “potential market” for psychological counseling services. However, these demands have not been transformed into “effective market demands” in the true sense. The supply of traditional psychological counseling institutions cannot meet the current market demand for psychological counseling. A large amount of potential demand for psychological counseling has not been stimulated, and there is a serious mismatch between supply and demand, as shown in Figure1.Figure 1
Current status of psychological counseling.
(a)
Psychological adjustment(b)
Psychological counseling marketMental health is an external manifestation of a mental state in which an individual can adapt to the developmental environment and has perfect personality characteristics. At the same time, the individual’s cognition, emotional movements, and mental awareness are in a positive state, and they have the ability to maintain normal regulation. The basic characteristics of mental health are manifested in daily life; that is, individuals can clearly understand themselves, consciously control themselves, adapt to the outside world, and correctly deal with external influences, so as to maintain a balanced and coordinated state of mind. Mental health is a kind of health state that is different from human physical health and can be measured by standard specific and objective scales. It starts from the subjective will of the individual and comprehensively and objectively judges the health of the individual from various states such as cognition, emotion, will, behavior, personality integrity, and coordination, so as to help the individual to grow up positively and healthily.Mental health is undoubtedly the absence of any mental illness. Mental illness has become one of the major problems in today’s society. The World Health Organization predicts that depression will be the leading cause of disability in the world by 2020. Mental illness has also been shown to be a causative factor in many chronic diseases such as diabetes, high blood pressure, and AIDS, resulting in higher costs to the health system. However, the various sources of information on mental illness are often fragmented, making it difficult to connect this information, share it, or even find it when needed. Therefore, at home and abroad, high attention is paid to mental health problems from both the physical and psychological levels. The physical level includes the collection of heartbeat signals and the analysis of the state of physiological health. The psychological level includes the causes, development, and solutions of psychological problems that have been improved to varying degrees [10, 11].


## 3.2. Mental Health Consultation Platform

The mental health service platform uses the heterogeneous data sources obtained from the collection end, analyzes and processes the heterogeneous data sources through the cloud computing platform middleware technology, and provides specific interface services to the platform users. Some scholars believe that mental health problems should be regarded as a long-term research object. As with chronic diseases, the user’s psychological characteristic data is collected in real time, and the user-specific psychological characteristic data is stored and subsequently classified, so that the mental health service platform can be used as a long-term monitoring service [12, 13]. Of course, this is a time-consuming and labor-intensive job.The health database is the foundation of the mental health database, involving three types of databases: clinical examination databases, which are used to store and manage multilevel brain and psychological data obtained from diverse clinical examinations; wearable database to store and manage raw data from diverse wearable medical devices; and the medical information database which is used to store and manage patient-related medical information obtained from various medical information systems such as digital medical record systems.There are integrated information bases and integrated knowledge bases in these health databases. The integrated information base includes semantic medical comprehensive information and brain information origin, health index database, and case database. Semantic medical information is obtained by importing external semantic medical information sources or transforming patient-related medical information from a medical information database. Brain informatics provenance is metadata of brain and mental data stored in clinical examination databases or wearable databases. This integrated knowledge base includes a variety of domain ontology and model libraries. All domain ontologies here are based on multidimensional data brain integration.The realization of mental health big data center requires a lot of IT resources, including computing resources, storage resources, and communication resources. Therefore, it is necessary to build such a mental health system architecture on a cloud computing platform to obtain IT resources of IaaS services, PaaS services, and SaaS services. PaaS services are the most important part of building a mental health system architecture. Most of the IT resources required by the mental health big data center and the data of the smart service platform are obtained by calling the corresponding PaaS service cloud computing platform. Although the idea of this platform architecture is good, its complexity is also obvious, and it is not suitable for dissemination and expansion in the pervasive mobile Internet environment [14].


## 3.3. Node Optimization of Hybrid Wireless Communication Network

With the rapid development of science and technology, people have higher and higher requirements for data transmission. The scale of smart psychological counseling platforms is also increasing day by day. What follows is the construction and optimization of wireless communication networks that consult users on a large scale. After solving the problem of communication network construction, then solve the communication network optimization problem. This is the only way to increase the data transmission rate and reduce the communication energy consumption. For communication network optimization, it mainly focuses on routing protocols, hardware resource upgrades, and optimized deployment of network nodes.Compared with the former two, the optimal deployment method of network nodes optimizes the existing and limited hardware resource configuration by adjusting the deployment positions of communication network nodes. It can improve the efficiency of data transmission, reduce the energy consumption of the communication network, and reduce the cost of hardware investment on the basis of ensuring the full connectivity of the information transmission network. However, traditional communication network node deployment mostly adopts relatively rough schemes such as random deployment, postdeployment adjustment, simple measurement method, or composition-based technology. While increasing the number of communication nodes, it is also very easy to cause problems such as disconnection of basic nodes (data acquisition nodes and action nodes), packet loss in data transmission, and high transmission energy consumption.In this regard, this paper proposes a wireless network communication algorithm based on genetic algorithm for the deployment of intelligent psychological counseling communication network nodes. Specifically, it is a layered communication network node scheme. Under this scheme, the following definitions are made for the deployment of communication network nodes. According to actual needs, after completing the installation and deployment of data acquisition nodes and action node equipment, by adjusting the deployment positions of relay nodes and aggregation nodes, wireless networking is performed for all basic nodes.


### 3.3.1. Establishment of Node Deployment Model of Communication Network

First, the units and meanings of some relevant formula symbols appearing in this section are explained, as shown in Table1.Table 1
Formula symbol description table.
Formula symbolUnitMeansDijkmDistance between two nodesCijkmConnectivity between nodesERnA∙tbit−1Data reception energy consumptionETnA∙tbit−1Data transmission energy consumptionEKnA∙tbit−1Energy consumption of relay node data forwardingdkmDistance between sending node and target nodekBitAmount of dataWhen all devices and related communication nodes are under the coverage of a communication network, the network can be called a fully connected network (FCN). Based on this theory, the FCN model of smart agriculture is established, and the process is as follows:In a 3D environment, the distanceDij between two devices or communication nodes Sixi,yi,zi and Sjxj,yj,zj is
(1)Dij=xi−xj2+yi−yj2+zi−zj2.If the sum of the coverage radii of two devices or communication nodes is less than the distance between them, it is said to establish a connection. The specific formula is expressed as follows:(2)Dij<ri+rj.The communication connection relationship between all devices or communication nodes can be expressed by the following formula:(3)Cij1,i≠j,0,else.The connectivity relationship between all data acquisition nodes (DataAcquisitionNode, DN) and the corresponding relay node (RelayNode, RN), and the connectivity relationship between all action nodes (ActionNode, AN) to the corresponding RN can be further deduced. The connectivity between all RNs and sink nodes (SinkNode, SN) and the connectivity of all network nodes are as follows:(4)Cac=∏i=1na∏j=1ncCij=1,(5)Cbc=∏i=1nb∏j=1ncCij=1,(6)Ccd=∏i=1nc∏j=1ndCij=1,(7)Call=CacCbcCcd=1.For the calculation of communication energy consumption, it can be divided into two parts: ET (transmitting energy consumption) and ER (receiving energy consumption):(8)ET=kEelec+kEampd2=kEelec+Eampd2,(9)ER=kEelec.When the RN node performs data relay, the energy consumption isEk:
(10)Ek=ER+ET.The energy consumption calculation process during data transmission between RN and AN nodes is as follows:Step 1.
It can be inferred from formula (10) that the energy consumption Eji of RN node Cj to an AN node ai to complete a single transmission of data packet information kj∙bit is
(11)Eji=kjEelec+EampDij2.Step 2.
It obtains the total energy consumptionEcj of RN node Cj to the n AN node na connected to it to complete a single transmission of kj∙bit’s data packet information:
(12)Ecj=∑i=1nakiEelec+EampDij2.Step 3.
The total energy consumptionE1 of all RNs sending data to all AN nodes connected to them is
(13)E1=∑i=1na∑j=1nckjEamp+EelecDij2.Step 4.
The total energy consumptionE2 corresponding to the reception of all AN nodes is
(14)E2=∑i=1naERi=∑i=1nakiEelec.According to the above derivation process, the communication energy consumption of other nodes in the network is calculated as follows:The total energy consumptionE3 for all BN nodes to send a single data packet to the RN node is
(15)E3=∑i=1nb∑j=1nckiEamp+EelecDij2.The receiving energy consumptionE4 of all RNs is
(16)E4=∑i=1nbERi=∑i=1nbkiEelec.The total energy consumptionE5 for all RN nodes to complete a single data upload to the SN node is
(17)E5=∑i=1nckiEamp+EelecDij2.And the receiving energy consumptionE6 of SN is
(18)E6=∑i=1ncERi=∑i=1nckiEelec.The total energy consumptionE7 for the SN node to complete a single data delivery to all RN nodes is
(19)E7=∑j=1nckjEamp+EelecDij2.The receive energyE8 of all RNs is
(20)E8=∑j=1ncERi=∑j=1nckjEelec.


### 3.3.2. Genetic Algorithm Optimization Solution Design

Genetic algorithm is a fast and fault-tolerant algorithm that performs global optimization search on a set of encoded feasible solution spaces. It is a class of algorithms that can be used for complex system optimization calculations. Compared with other search methods, it adopts many unique techniques and methods and has many advantages. The basic flow of the genetic algorithm is shown in Figure2:Figure 2
Flowchart of genetic algorithm.On the basis of the theory in this paper, the information amount of each BN node is used as the weight to guide the M population at the vertex of the TP to move to the direction with higher weight until the weight balance is achieved. The weight balance condition is(21)∂idm,i=∂i+1dm,i+1.The meaning of formula (21) is that the product of the weights of the three BN nodes and the respective distances d of the corresponding TP vertices is equal to the product of the weights and distances of the other two nodes. Figure 3(a) shows the process of directed search weight balancing:Figure 3
Algorithm optimization diagram.
(a)
Population generation and directed search(b)
Initial optimizationIn Figure3(a), A, B, and C are BN nodes, and 1 is the TP vertex corresponding to the BN node. The figure on the left shows the case where a population is generated at 1, and the weight values of A, B, and C are, respectively, α,β,γ in the right part (α<β<γ) and the case of directed search.On the premise of the completion of the TP construction, according to the above-mentioned strategies of population generation and directed search, the five TP vertices numbered 1, 2, 3, 4, and 5 in the graph are further weight-balanced. After the balance movement is completed, the TP vertices are connected in sequence to realize the initial optimization. The results are shown in Figure3(b).In Figure3(b), through the movement of TP vertices (1-5), the optimal position of RN deployment has been bound in the space enclosed by 5 TP vertices. In the next step, the Moth population is generated at positions 1, 2, 3, 4, and 5 in the graph, and the optimization can be performed in the space enclosed by the TP vertices. According to the above steps, the deployment of all RNs is completed, and then, the deployment position of the SN node is determined again by taking the deployment position of the RN as a known quantity.


## 3.3.1. Establishment of Node Deployment Model of Communication Network

First, the units and meanings of some relevant formula symbols appearing in this section are explained, as shown in Table1.Table 1
Formula symbol description table.
Formula symbolUnitMeansDijkmDistance between two nodesCijkmConnectivity between nodesERnA∙tbit−1Data reception energy consumptionETnA∙tbit−1Data transmission energy consumptionEKnA∙tbit−1Energy consumption of relay node data forwardingdkmDistance between sending node and target nodekBitAmount of dataWhen all devices and related communication nodes are under the coverage of a communication network, the network can be called a fully connected network (FCN). Based on this theory, the FCN model of smart agriculture is established, and the process is as follows:In a 3D environment, the distanceDij between two devices or communication nodes Sixi,yi,zi and Sjxj,yj,zj is
(1)Dij=xi−xj2+yi−yj2+zi−zj2.If the sum of the coverage radii of two devices or communication nodes is less than the distance between them, it is said to establish a connection. The specific formula is expressed as follows:(2)Dij<ri+rj.The communication connection relationship between all devices or communication nodes can be expressed by the following formula:(3)Cij1,i≠j,0,else.The connectivity relationship between all data acquisition nodes (DataAcquisitionNode, DN) and the corresponding relay node (RelayNode, RN), and the connectivity relationship between all action nodes (ActionNode, AN) to the corresponding RN can be further deduced. The connectivity between all RNs and sink nodes (SinkNode, SN) and the connectivity of all network nodes are as follows:(4)Cac=∏i=1na∏j=1ncCij=1,(5)Cbc=∏i=1nb∏j=1ncCij=1,(6)Ccd=∏i=1nc∏j=1ndCij=1,(7)Call=CacCbcCcd=1.For the calculation of communication energy consumption, it can be divided into two parts: ET (transmitting energy consumption) and ER (receiving energy consumption):(8)ET=kEelec+kEampd2=kEelec+Eampd2,(9)ER=kEelec.When the RN node performs data relay, the energy consumption isEk:
(10)Ek=ER+ET.The energy consumption calculation process during data transmission between RN and AN nodes is as follows:Step 1.
It can be inferred from formula (10) that the energy consumption Eji of RN node Cj to an AN node ai to complete a single transmission of data packet information kj∙bit is
(11)Eji=kjEelec+EampDij2.Step 2.
It obtains the total energy consumptionEcj of RN node Cj to the n AN node na connected to it to complete a single transmission of kj∙bit’s data packet information:
(12)Ecj=∑i=1nakiEelec+EampDij2.Step 3.
The total energy consumptionE1 of all RNs sending data to all AN nodes connected to them is
(13)E1=∑i=1na∑j=1nckjEamp+EelecDij2.Step 4.
The total energy consumptionE2 corresponding to the reception of all AN nodes is
(14)E2=∑i=1naERi=∑i=1nakiEelec.According to the above derivation process, the communication energy consumption of other nodes in the network is calculated as follows:The total energy consumptionE3 for all BN nodes to send a single data packet to the RN node is
(15)E3=∑i=1nb∑j=1nckiEamp+EelecDij2.The receiving energy consumptionE4 of all RNs is
(16)E4=∑i=1nbERi=∑i=1nbkiEelec.The total energy consumptionE5 for all RN nodes to complete a single data upload to the SN node is
(17)E5=∑i=1nckiEamp+EelecDij2.And the receiving energy consumptionE6 of SN is
(18)E6=∑i=1ncERi=∑i=1nckiEelec.The total energy consumptionE7 for the SN node to complete a single data delivery to all RN nodes is
(19)E7=∑j=1nckjEamp+EelecDij2.The receive energyE8 of all RNs is
(20)E8=∑j=1ncERi=∑j=1nckjEelec.


## 3.3.2. Genetic Algorithm Optimization Solution Design

Genetic algorithm is a fast and fault-tolerant algorithm that performs global optimization search on a set of encoded feasible solution spaces. It is a class of algorithms that can be used for complex system optimization calculations. Compared with other search methods, it adopts many unique techniques and methods and has many advantages. The basic flow of the genetic algorithm is shown in Figure2:Figure 2
Flowchart of genetic algorithm.On the basis of the theory in this paper, the information amount of each BN node is used as the weight to guide the M population at the vertex of the TP to move to the direction with higher weight until the weight balance is achieved. The weight balance condition is(21)∂idm,i=∂i+1dm,i+1.The meaning of formula (21) is that the product of the weights of the three BN nodes and the respective distances d of the corresponding TP vertices is equal to the product of the weights and distances of the other two nodes. Figure 3(a) shows the process of directed search weight balancing:Figure 3
Algorithm optimization diagram.
(a)
Population generation and directed search(b)
Initial optimizationIn Figure3(a), A, B, and C are BN nodes, and 1 is the TP vertex corresponding to the BN node. The figure on the left shows the case where a population is generated at 1, and the weight values of A, B, and C are, respectively, α,β,γ in the right part (α<β<γ) and the case of directed search.On the premise of the completion of the TP construction, according to the above-mentioned strategies of population generation and directed search, the five TP vertices numbered 1, 2, 3, 4, and 5 in the graph are further weight-balanced. After the balance movement is completed, the TP vertices are connected in sequence to realize the initial optimization. The results are shown in Figure3(b).In Figure3(b), through the movement of TP vertices (1-5), the optimal position of RN deployment has been bound in the space enclosed by 5 TP vertices. In the next step, the Moth population is generated at positions 1, 2, 3, 4, and 5 in the graph, and the optimization can be performed in the space enclosed by the TP vertices. According to the above steps, the deployment of all RNs is completed, and then, the deployment position of the SN node is determined again by taking the deployment position of the RN as a known quantity.


## 4. Overall Scheme Design of Mental Health Counseling Service Platform

### 4.1. Requirements

The platform of this article is based on wireless communication technology and cloud computing technology. It realizes unified access to various health applications through intelligent information analysis and processing and service aggregation. It also serves the general public through a unified information standard system. The platform collects the user’s physiological information widely through widely deployed sensing equipment, radio frequency equipment, and some mobile terminal equipment and stores the real-time information in the data processing center. In the application layer of the system, it is divided into ordinary users and psychological consultants according to different roles. Ordinary users can measure the heartbeat according to the collection of physiological information provided by the platform. Then, it matches other users for real-time communication based on heartbeats, and it can also vent its thoughts in the psychological community. The platform recommends different psychological tests and psychological counselors according to user characteristics. Psychologists can find users in their professional fields on the platform and provide one-on-one counseling services and counseling therapy. The platform uses the mobile client and the web to achieve multiterminal integration to meet the seamless connection between different systems.The system functional requirements are divided into heartbeat detection, real-time communication, psychological testing, psychological consultation, and other functions, as shown in Figure4:Figure 4
System function.As shown in Figure4, the specific functions are divided into the following four parts. (1) Heartbeat detection: users can detect their own heartbeats by using the system to use the sensor device or the sensor that comes with the mobile device. Using these heartbeat signals, the platform can perform user feature analysis, feature matching, and a certain degree of data integration to recommend personalized psychological testing and counseling services, thus forming an intelligent closed-loop mental health service. (2) Real-time communication: after the user detects the heartbeat, the platform will perform a feature matching between users according to the user’s heartbeat value according to certain rules, and the matched users can communicate in real time. Real-time communication includes voice communication as well as text communication. The two methods utilize different technical characteristics and platform modes, and both ensure the immediacy, stability, and effectiveness of communication without exception. Users who have communicated can add friends after the end of the communication to ensure the smooth progress of the next communication. (3) Psychological test: after the user detects the heartbeat, the platform will randomly assign the user a type of psychological test according to the user’s heartbeat characteristics. The psychological test adopts a new dual mode of jump and selection and provides users with psychological test results through a scoring mechanism. It guarantees the validity of the test results and also provides professional suggestions to solve certain psychological confusions of users. (4) Psychological counseling: psychological counseling also provides voice and text. Users can provide psychological counseling services according to the psychological counselors recommended by the platform through the results of psychological tests. They can also find their own satisfactory psychological consultants on the platform according to their qualifications, types, regions, etc. Thereby, it can truly solve the psychological confusion of users and provide professional psychological consultation, so as to realize the real mental health service.


### 4.2. Overall Architecture

According to the previous requirement analysis, the overall architecture design of the system is shown in Figure5. The mental health service platform based on cloud computing is mainly divided into four layers: perception layer, network layer, cloud computing platform layer, and application layer.
(1)
Perception Layer. The perception layer is a collection of hardware that provides the underlying functionality for the entire platform. It utilizes various IoT sensing devices, RFID, sensors built into mobile devices, etc. It is mainly used for accurate perception of user information. Sensing devices refer to some wearable devices that can be used for medical data collection to detect physiological characteristics such as blood pressure, heart rate, and body temperature. Sensors such as pressure sensors and cameras in mobile devices can also be used to detect red pigment in blood. The perception layer is at the bottom, providing the basic data source for the upper layer(2)
Network Layer. As the network infrastructure of the cloud computing platform layer, the network layer utilizes network resources such as urban optical networks, wireless communication networks, and community private networks to achieve interconnection between sensor networks and traditional core networks such as Ethernet and mobile communication networks. The network environment is mainly composed of three parts: data acquisition terminal, gateway, and platform interface. The data collection end is divided into two parts: physiological sensors and data gathering nodes. The physiological sensor consists of two modules: a signal acquisition module and a wireless transmission module. The gateway is responsible for analyzing and processing the data transmitted by the data sink node. The platform interface is the interconnection channel between the network layer and the cloud computing platform layer. It ensures the stability and integrity of data upload through a unified interface(3)
Cloud Computing Platform Layer. The cloud computing platform layer utilizes the powerful data storage and analysis capabilities of cloud computing to store, process, and integrate the obtained massive data. Therefore, the cloud computing platform layer can be divided into data layer, intelligent processing layer, and capability integration layer. The data layer deals with user information, physiological data, and user psychological characteristic data, and this paper introduces the database design of the mental health management system and the mental health consulting service system. The intelligent processing layer refers to the characteristic data obtained by comprehensive analysis and processing of the data stored in the data layer by using data mining, information retrieval, information sharing, and other technologies. It can be used for services such as user matching and personalized recommendation in the application layer. The capability processing layer is an integration of various “special” capabilities that the application layer can provide to users. It includes message capability, voice capability, and web capability and can provide more diversified services for the application layer(4)
Application Layer. The application layer is divided into three subsystems according to the function: the physiological health service system, the mental health management system, and the mental health consultation service system. The physiological health service system conducts unified management of the collected physiological data for users to use. It can also intelligently mine and analyze the collected physiological data according to the needs of users’ physiological data, generate corresponding forms, and push them to usersFigure 5
Mental health service platform based on wireless communication network.The data processing center includes an application server, a database server, a file server, and a data processing server. The database server mainly stores basic information of users, basic information of psychological consultants, various business data, and addresses of files stored in the file server. The file server is used to store the heartbeat signal generated by the user, personal health files, various pictures, videos, audio files, etc. The data processing server processes and analyzes the data stored in the database server, so as to provide data support to the application server. The application server provides corresponding application layer services for users, psychological consultants, and psychological service managers. At the same time, there are two software in the application layer, which are available for users to use on the browser on the PC side and on the mobile phone platform on the mobile side. Users can access the software of these two different platforms through the web version of the PC and the Android and IOS mobile phones of the mobile terminal.


### 4.3. Technical Architecture

The following are shown in Figure6.Figure 6
Technical framework.


#### 4.3.1. Back-End Development Technology

SpringBoot is a new framework extended on the basis of Spring. The framework was developed for the following design purposes: to simplify Spring application development. SpringBoot will help to automatically configure the relevant environment in the system, which greatly simplifies the construction of the initial environment. Users can quickly start development and enter the hall of enterprise-level development [15].Mybatis is different from traditional jdbc. For users, the framework does not need to care about some tedious processes, such as registering drivers and creating connections, and only needs to pay attention to sql. All traditional jdbc operations are encapsulated. The framework realizes the conversion between sql and java classes through the principle of reflection. The design purpose of this fast implementation of sql input and output is the advantage of Mybatis. There are two ways when Mybatis interacts with the database. The first is to use the traditional API interface. The second is to use the Mapper interface, which provides the possibility for interface-oriented programming [16]. The framework has many advantages, such as reducing the amount of code, very convenient to use, quick to use, sql and code are separated, and also supports writing dynamic sql. But for some complex queries, the writing of sql is more complicated for developers.


#### 4.3.2. Front-End Development Technology

Vue is a progressive lightweight front-end framework designed to separate the front-end and the back-end from the bottom up, focusing only on the view layer. The framework is easy to use and can be easily combined with third-party libraries. Since it only focuses on the view layer, it only needs a simple application programming interface to implement a convenient component system and data binding. Compared with React, another framework, there are many similarities between the two frameworks. Even so, there are differences between the two frameworks. React implements one-way data binding and needs to rerender the entire component tree, while the framework implements two-way, and it has its own tracking for any component without rerendering. The two frameworks are also different in the way components are written. Compared to Angular, another framework, Vue is more flexible and faster in some ways. However, as a relatively new framework, Vue is not as mature as Angular and does not support IE8P [17].Echarts is a commercial-grade pure JS chart library that can be used on personal computers, mobile phones, tablets, and other mobile terminals and can achieve good compatibility. It can provide developers with rich data visualization charts, such as line charts and pie charts. Not only that, but it also provides data area zoom components, timeline components, visual mapping components, and more. In addition, it supports the way components and diagrams are used together to achieve the desired functionality. Edmrts supports different access methods, including modular packages, modular single files, and labeled single files. People developing with Echarts can choose the appropriate way according to their needs. It can convert data to graphics by setting the encode property, which saves many intermediate steps. Echarts can simply implement dynamic data. It only needs to find the difference between the two sets of data and then achieve dynamic effects through animation. Three-dimensional effects can also be achieved using EchartsGL [18].


#### 4.3.3. Data Storage Technology

MySQL is an open source free relational database widely used in java development. Compared with other large databases, its setup and management are very simple, and it is very simple to configure and use for beginners. Compared with other databases that need to be charged, MySQL is free and open source for individual users, which makes many people favor it. It is also a very small database, and the installation takes up very little space. For MySQL, it has a great performance advantage, allowing multiple users to connect to the server together, and it has no limit on the number of users. In addition to that, MySQL can be accessed through an interactive interface. MySQL-side can share data with others and can also set access rights to it. Not only can it run on various systems, it is also very fast [19].RedisKV is a very powerful key-value pair nonrelational database. Its keys can only be of type string, and its values support five types. An appropriate data structure can be selected to store the value according to actual needs [20]. String type: do simple key-value pair caching. List: can store some type of data like a list of fans. Set: stores the data that needs to be unique and can perform operations such as union, intersection, and difference on the data. Hash: an unordered hash table that stores key-value pairs. Zset: on the basis of set, the ordering of data is guaranteed. Because it is completely based on memory, the time complexity of various operations is very low, the data operation is simple, and it does not switch back and forth between threads like multithreading. This is the fastest database out there.


## 4.1. Requirements

The platform of this article is based on wireless communication technology and cloud computing technology. It realizes unified access to various health applications through intelligent information analysis and processing and service aggregation. It also serves the general public through a unified information standard system. The platform collects the user’s physiological information widely through widely deployed sensing equipment, radio frequency equipment, and some mobile terminal equipment and stores the real-time information in the data processing center. In the application layer of the system, it is divided into ordinary users and psychological consultants according to different roles. Ordinary users can measure the heartbeat according to the collection of physiological information provided by the platform. Then, it matches other users for real-time communication based on heartbeats, and it can also vent its thoughts in the psychological community. The platform recommends different psychological tests and psychological counselors according to user characteristics. Psychologists can find users in their professional fields on the platform and provide one-on-one counseling services and counseling therapy. The platform uses the mobile client and the web to achieve multiterminal integration to meet the seamless connection between different systems.The system functional requirements are divided into heartbeat detection, real-time communication, psychological testing, psychological consultation, and other functions, as shown in Figure4:Figure 4
System function.As shown in Figure4, the specific functions are divided into the following four parts. (1) Heartbeat detection: users can detect their own heartbeats by using the system to use the sensor device or the sensor that comes with the mobile device. Using these heartbeat signals, the platform can perform user feature analysis, feature matching, and a certain degree of data integration to recommend personalized psychological testing and counseling services, thus forming an intelligent closed-loop mental health service. (2) Real-time communication: after the user detects the heartbeat, the platform will perform a feature matching between users according to the user’s heartbeat value according to certain rules, and the matched users can communicate in real time. Real-time communication includes voice communication as well as text communication. The two methods utilize different technical characteristics and platform modes, and both ensure the immediacy, stability, and effectiveness of communication without exception. Users who have communicated can add friends after the end of the communication to ensure the smooth progress of the next communication. (3) Psychological test: after the user detects the heartbeat, the platform will randomly assign the user a type of psychological test according to the user’s heartbeat characteristics. The psychological test adopts a new dual mode of jump and selection and provides users with psychological test results through a scoring mechanism. It guarantees the validity of the test results and also provides professional suggestions to solve certain psychological confusions of users. (4) Psychological counseling: psychological counseling also provides voice and text. Users can provide psychological counseling services according to the psychological counselors recommended by the platform through the results of psychological tests. They can also find their own satisfactory psychological consultants on the platform according to their qualifications, types, regions, etc. Thereby, it can truly solve the psychological confusion of users and provide professional psychological consultation, so as to realize the real mental health service.


## 4.2. Overall Architecture

According to the previous requirement analysis, the overall architecture design of the system is shown in Figure5. The mental health service platform based on cloud computing is mainly divided into four layers: perception layer, network layer, cloud computing platform layer, and application layer.
(1)
Perception Layer. The perception layer is a collection of hardware that provides the underlying functionality for the entire platform. It utilizes various IoT sensing devices, RFID, sensors built into mobile devices, etc. It is mainly used for accurate perception of user information. Sensing devices refer to some wearable devices that can be used for medical data collection to detect physiological characteristics such as blood pressure, heart rate, and body temperature. Sensors such as pressure sensors and cameras in mobile devices can also be used to detect red pigment in blood. The perception layer is at the bottom, providing the basic data source for the upper layer(2)
Network Layer. As the network infrastructure of the cloud computing platform layer, the network layer utilizes network resources such as urban optical networks, wireless communication networks, and community private networks to achieve interconnection between sensor networks and traditional core networks such as Ethernet and mobile communication networks. The network environment is mainly composed of three parts: data acquisition terminal, gateway, and platform interface. The data collection end is divided into two parts: physiological sensors and data gathering nodes. The physiological sensor consists of two modules: a signal acquisition module and a wireless transmission module. The gateway is responsible for analyzing and processing the data transmitted by the data sink node. The platform interface is the interconnection channel between the network layer and the cloud computing platform layer. It ensures the stability and integrity of data upload through a unified interface(3)
Cloud Computing Platform Layer. The cloud computing platform layer utilizes the powerful data storage and analysis capabilities of cloud computing to store, process, and integrate the obtained massive data. Therefore, the cloud computing platform layer can be divided into data layer, intelligent processing layer, and capability integration layer. The data layer deals with user information, physiological data, and user psychological characteristic data, and this paper introduces the database design of the mental health management system and the mental health consulting service system. The intelligent processing layer refers to the characteristic data obtained by comprehensive analysis and processing of the data stored in the data layer by using data mining, information retrieval, information sharing, and other technologies. It can be used for services such as user matching and personalized recommendation in the application layer. The capability processing layer is an integration of various “special” capabilities that the application layer can provide to users. It includes message capability, voice capability, and web capability and can provide more diversified services for the application layer(4)
Application Layer. The application layer is divided into three subsystems according to the function: the physiological health service system, the mental health management system, and the mental health consultation service system. The physiological health service system conducts unified management of the collected physiological data for users to use. It can also intelligently mine and analyze the collected physiological data according to the needs of users’ physiological data, generate corresponding forms, and push them to usersFigure 5
Mental health service platform based on wireless communication network.The data processing center includes an application server, a database server, a file server, and a data processing server. The database server mainly stores basic information of users, basic information of psychological consultants, various business data, and addresses of files stored in the file server. The file server is used to store the heartbeat signal generated by the user, personal health files, various pictures, videos, audio files, etc. The data processing server processes and analyzes the data stored in the database server, so as to provide data support to the application server. The application server provides corresponding application layer services for users, psychological consultants, and psychological service managers. At the same time, there are two software in the application layer, which are available for users to use on the browser on the PC side and on the mobile phone platform on the mobile side. Users can access the software of these two different platforms through the web version of the PC and the Android and IOS mobile phones of the mobile terminal.


## 4.3. Technical Architecture

The following are shown in Figure6.Figure 6
Technical framework.


### 4.3.1. Back-End Development Technology

SpringBoot is a new framework extended on the basis of Spring. The framework was developed for the following design purposes: to simplify Spring application development. SpringBoot will help to automatically configure the relevant environment in the system, which greatly simplifies the construction of the initial environment. Users can quickly start development and enter the hall of enterprise-level development [15].Mybatis is different from traditional jdbc. For users, the framework does not need to care about some tedious processes, such as registering drivers and creating connections, and only needs to pay attention to sql. All traditional jdbc operations are encapsulated. The framework realizes the conversion between sql and java classes through the principle of reflection. The design purpose of this fast implementation of sql input and output is the advantage of Mybatis. There are two ways when Mybatis interacts with the database. The first is to use the traditional API interface. The second is to use the Mapper interface, which provides the possibility for interface-oriented programming [16]. The framework has many advantages, such as reducing the amount of code, very convenient to use, quick to use, sql and code are separated, and also supports writing dynamic sql. But for some complex queries, the writing of sql is more complicated for developers.


### 4.3.2. Front-End Development Technology

Vue is a progressive lightweight front-end framework designed to separate the front-end and the back-end from the bottom up, focusing only on the view layer. The framework is easy to use and can be easily combined with third-party libraries. Since it only focuses on the view layer, it only needs a simple application programming interface to implement a convenient component system and data binding. Compared with React, another framework, there are many similarities between the two frameworks. Even so, there are differences between the two frameworks. React implements one-way data binding and needs to rerender the entire component tree, while the framework implements two-way, and it has its own tracking for any component without rerendering. The two frameworks are also different in the way components are written. Compared to Angular, another framework, Vue is more flexible and faster in some ways. However, as a relatively new framework, Vue is not as mature as Angular and does not support IE8P [17].Echarts is a commercial-grade pure JS chart library that can be used on personal computers, mobile phones, tablets, and other mobile terminals and can achieve good compatibility. It can provide developers with rich data visualization charts, such as line charts and pie charts. Not only that, but it also provides data area zoom components, timeline components, visual mapping components, and more. In addition, it supports the way components and diagrams are used together to achieve the desired functionality. Edmrts supports different access methods, including modular packages, modular single files, and labeled single files. People developing with Echarts can choose the appropriate way according to their needs. It can convert data to graphics by setting the encode property, which saves many intermediate steps. Echarts can simply implement dynamic data. It only needs to find the difference between the two sets of data and then achieve dynamic effects through animation. Three-dimensional effects can also be achieved using EchartsGL [18].


### 4.3.3. Data Storage Technology

MySQL is an open source free relational database widely used in java development. Compared with other large databases, its setup and management are very simple, and it is very simple to configure and use for beginners. Compared with other databases that need to be charged, MySQL is free and open source for individual users, which makes many people favor it. It is also a very small database, and the installation takes up very little space. For MySQL, it has a great performance advantage, allowing multiple users to connect to the server together, and it has no limit on the number of users. In addition to that, MySQL can be accessed through an interactive interface. MySQL-side can share data with others and can also set access rights to it. Not only can it run on various systems, it is also very fast [19].RedisKV is a very powerful key-value pair nonrelational database. Its keys can only be of type string, and its values support five types. An appropriate data structure can be selected to store the value according to actual needs [20]. String type: do simple key-value pair caching. List: can store some type of data like a list of fans. Set: stores the data that needs to be unique and can perform operations such as union, intersection, and difference on the data. Hash: an unordered hash table that stores key-value pairs. Zset: on the basis of set, the ordering of data is guaranteed. Because it is completely based on memory, the time complexity of various operations is very low, the data operation is simple, and it does not switch back and forth between threads like multithreading. This is the fastest database out there.


## 4.3.1. Back-End Development Technology

SpringBoot is a new framework extended on the basis of Spring. The framework was developed for the following design purposes: to simplify Spring application development. SpringBoot will help to automatically configure the relevant environment in the system, which greatly simplifies the construction of the initial environment. Users can quickly start development and enter the hall of enterprise-level development [15].Mybatis is different from traditional jdbc. For users, the framework does not need to care about some tedious processes, such as registering drivers and creating connections, and only needs to pay attention to sql. All traditional jdbc operations are encapsulated. The framework realizes the conversion between sql and java classes through the principle of reflection. The design purpose of this fast implementation of sql input and output is the advantage of Mybatis. There are two ways when Mybatis interacts with the database. The first is to use the traditional API interface. The second is to use the Mapper interface, which provides the possibility for interface-oriented programming [16]. The framework has many advantages, such as reducing the amount of code, very convenient to use, quick to use, sql and code are separated, and also supports writing dynamic sql. But for some complex queries, the writing of sql is more complicated for developers.


## 4.3.2. Front-End Development Technology

Vue is a progressive lightweight front-end framework designed to separate the front-end and the back-end from the bottom up, focusing only on the view layer. The framework is easy to use and can be easily combined with third-party libraries. Since it only focuses on the view layer, it only needs a simple application programming interface to implement a convenient component system and data binding. Compared with React, another framework, there are many similarities between the two frameworks. Even so, there are differences between the two frameworks. React implements one-way data binding and needs to rerender the entire component tree, while the framework implements two-way, and it has its own tracking for any component without rerendering. The two frameworks are also different in the way components are written. Compared to Angular, another framework, Vue is more flexible and faster in some ways. However, as a relatively new framework, Vue is not as mature as Angular and does not support IE8P [17].Echarts is a commercial-grade pure JS chart library that can be used on personal computers, mobile phones, tablets, and other mobile terminals and can achieve good compatibility. It can provide developers with rich data visualization charts, such as line charts and pie charts. Not only that, but it also provides data area zoom components, timeline components, visual mapping components, and more. In addition, it supports the way components and diagrams are used together to achieve the desired functionality. Edmrts supports different access methods, including modular packages, modular single files, and labeled single files. People developing with Echarts can choose the appropriate way according to their needs. It can convert data to graphics by setting the encode property, which saves many intermediate steps. Echarts can simply implement dynamic data. It only needs to find the difference between the two sets of data and then achieve dynamic effects through animation. Three-dimensional effects can also be achieved using EchartsGL [18].


## 4.3.3. Data Storage Technology

MySQL is an open source free relational database widely used in java development. Compared with other large databases, its setup and management are very simple, and it is very simple to configure and use for beginners. Compared with other databases that need to be charged, MySQL is free and open source for individual users, which makes many people favor it. It is also a very small database, and the installation takes up very little space. For MySQL, it has a great performance advantage, allowing multiple users to connect to the server together, and it has no limit on the number of users. In addition to that, MySQL can be accessed through an interactive interface. MySQL-side can share data with others and can also set access rights to it. Not only can it run on various systems, it is also very fast [19].RedisKV is a very powerful key-value pair nonrelational database. Its keys can only be of type string, and its values support five types. An appropriate data structure can be selected to store the value according to actual needs [20]. String type: do simple key-value pair caching. List: can store some type of data like a list of fans. Set: stores the data that needs to be unique and can perform operations such as union, intersection, and difference on the data. Hash: an unordered hash table that stores key-value pairs. Zset: on the basis of set, the ordering of data is guaranteed. Because it is completely based on memory, the time complexity of various operations is very low, the data operation is simple, and it does not switch back and forth between threads like multithreading. This is the fastest database out there.


## 5. Detailed Design and Testing of Mental Health Counseling Service Platform

### 5.1. Implementation of the Message Function

The message function is a communication channel that can be displayed to users at any time when there is a record of voice or text instant message exchanges between users. This facilitates users to get to know each other, exchange feelings, and increase the user stickiness of the mental health platform. The personal center function hides the user’s real personal information in an anonymous way. At the same time, the user can change the personal avatar, mobile phone number, change password, etc. in the editing data. The status of Psychocommunity postings can also be viewed in my postings. Users can also find favorite experts from the experts they follow for expert consultation. This also ensures the link between the mental health management system and the mental health service consultation system. The message chat function is convenient for instant communication between users. In order to ensure a clean and beautiful interface, the message chat is divided into two parts: the message list and the chat content according to the functionality. The message list mainly includes Message Model, Message Adapter, and Message Activity. The chat content mainly includes ChatMsgModel, Chat Adapter, and Chat Activity. Among them, the IM Helper class is the functional core class of the message, including functions such as wrapping the message content, adding a message, deleting a message, updating a message, and judging whether a message has been read or not.


### 5.2. Psychological Test Function

The function of measuring the heartbeat is that after the user logs in the mental health management system, the heartbeat test can be performed under the “heartbeat” module. If the user is testing for the first time, there will be text prompts on the interface, and then, the user will start the test according to the prompts. If the user has already tested, they can start the test directly. After testing the heartbeat, check the heartbeat result and upload it to the cloud server. Then, the user can select a certain topic according to the chat content recommended by the test result. After analyzing and matching the current user in the cloud Hadoop platform, select another user for text chat, or directly for voice chat. The heartbeat value of other users at this time is obtained through the cloud computing platform layer, and through data analysis and processing on the cloud computing platform, a user is found that matches the user whose heartbeat is currently being tested, so as to conduct voice chat with strangers.The heartbeat function utilizes the built-in sensor and flash of the mobile Smartphone. When the finger is placed on the camera and the flash is covered, a certain heartbeat detection algorithm can detect the heartbeat of the test user at this moment. Then, the database server of the cloud computing data center records the heartbeat value at this time and uses the feature matching algorithm to find another user who is also testing the heartbeat to match it.The psychological test function provides a powerful and complete psychological test. There are a wide range of categories including emotion, personality, ability, interest, and professional five aspects. Users can choose the psychological test that suits them according to their preferences. And according to the test results to judge the severity of their own psychological problems, if necessary, users can consult a psychological consultant. The professional type of psychological test is the test questions selected by the psychological consultant from the professional psychological test question bank, for example, Harvard Professional Aptitude Test Scale. These questions require a certain fee and can obtain advice from a psychological counselor based on the test questions.The psychological test function is composed of a series of psychological test questions. These test questions can be viewed by professional system administrators or psychological consultants, and the types of psychological tests in the system and the psychological tests themselves are edited and saved in the psychological test section of the Hadoop platform in the cloud computing center. After the server has processed the data in the background, it is transmitted to the corresponding front-end, and the front-end is embedded in the client after rendering and displaying. Users can complete the psychological test on the corresponding Android phone, as shown in Figure7.Figure 7
Psychological test function interaction diagram.


### 5.3. Expert Consultation Function

The expert consultation function, as the name suggests, provides expert consultation services including consultation centers and psychological clinics across the country. These experts can address anxiety, obsessive-compulsive disorder, depression, hypochondriasis, and schizophrenia from mild to severe professional counseling advice. In order to facilitate users to seek medical treatment nearby, it also provides a positioning function to locate a nearby psychological counselor. It provides a reputation classification based on the user satisfaction of psychological counselors. Qualification rankings are provided according to the professional level of psychological counselors. For example, the national second-level psychological counselor is higher than the national third-level psychological counselor.


### 5.4. System Function Test

The hardware configuration of Android smartphone is shown in Table2.Table 2
Test mobile phone hardware parameters.
NameParameterDevice modelLGL24G3Operating systemAndroid: 4.4.2CPUQuad-core ARMv7 processor (VFPv4, NEON)RAM32GB ROM 2GB RAMGraphics cardAdreno(TM)330In order to further verify the performance and reliability of the algorithm described in this paper, this paper adopts the traditional ant colony algorithm (ACO), using VD graph. It performs algorithm optimization according to the designed scheme. It is set with the parameters in Table3, and the GA, ACO, and GA-CW algorithms are compared and tested. The experiment comprehensively considers the performance of the algorithm by comprehensively considering the energy consumption, connectivity rate, solution speed, and other indicators obtained under the solution of each algorithm.Table 3
Experimental parameter settings.
ParameterValueEelec (nA.bit-1)0.07Eamp (nA.bit-l)0.04Cmin (MB)2.344Cmax (MB)3.711Dmax (km)2.5First, compare them from the perspective of energy consumption. Under the solution results of different algorithms, the comparison of the number of basic nodes (data acquisition nodes and action nodes) corresponding to each relay node is shown in Figure8(a). The comparison diagram of the communication data volume between the relay node and the corresponding basic node is shown in Figure 8(b).Figure 8
Comparison of energy consumption angles.According to the operating voltage and other parameters of the basic node, the communication power consumption between the basic node and the corresponding relay node is obtained by conversion. It further obtains the power consumption fluctuation comparison chart, as shown in Figure9. (This graph can reflect the uniformity of node coverage. The smaller the fluctuation, the smaller the energy consumption gap between nodes, which is conducive to later maintenance.)Figure 9
Power consumption fluctuation curve.Combining Figures8 and 9, it can be seen that each GA-CW algorithm has 12 relay nodes, and the power consumption fluctuation curves of the two algorithms are relatively similar. But the fluctuation of GA-CW algorithm is slightly larger than that of GA-CW algorithm. The GA algorithm sets 10 relay nodes. However, from the fluctuation curve, the fluctuation range is the largest, resulting in uneven power consumption among nodes. Being in this situation for a long time will cause a node to be paralyzed prematurely, causing a burden for later maintenance. The power consumption fluctuation of the ACO algorithm is relatively small, but this algorithm needs to set up 14 relay nodes, which reduces the economic index.In Figures10(a)–10(c), the power consumption from the base node to the relay node, the power consumption from the relay node to the sink node, and the total power consumption are compared. It can be seen that the three types of power consumption of GA-CW are 63.57 Wh, 1360 Wh, and 1423.3 Wh. Compared with the other three algorithms, it is in the lead. Compared with the unimproved GA algorithm, the power consumption of the GA-CW algorithm is improved by 10%.Figure 10
Power consumption comparison.According to the function of the statistical analysis system, the core functional modules of the system are tested. Platform operation data analysis, institutional evaluation data analysis, and psychological problem correlation analysis modules were selected for testing. The results are shown in Table4:Table 4
System function test table.
Use case nameStepsExpected outcomeTest resultsMessage function implementation(1) Click friends(2) Generate text, expression, voice(3) Follow friendsCan enter dialog boxes, send and receive messages, and interact with friends normallyFunctioning normallyPsychological test function(1) Click the psychological test icon(2) Click heart rate detection(3) Click psychological testYou can enter the heart rate detection and psychological test pages normally, and the psychological test can answer the questions normally and get the results normallyFunctioning normallyExpert consultation function(1) Click the expert consultation icon(2) Click on the category of psychological problems(3) Click on expert list(4) Go to the expert page(5) Talk to an expertIf you can enter the page, the system can push the expert list normally, the expert and the user can communicate normally, and the expert consultation function is displayedFunctioning normally


## 5.1. Implementation of the Message Function

The message function is a communication channel that can be displayed to users at any time when there is a record of voice or text instant message exchanges between users. This facilitates users to get to know each other, exchange feelings, and increase the user stickiness of the mental health platform. The personal center function hides the user’s real personal information in an anonymous way. At the same time, the user can change the personal avatar, mobile phone number, change password, etc. in the editing data. The status of Psychocommunity postings can also be viewed in my postings. Users can also find favorite experts from the experts they follow for expert consultation. This also ensures the link between the mental health management system and the mental health service consultation system. The message chat function is convenient for instant communication between users. In order to ensure a clean and beautiful interface, the message chat is divided into two parts: the message list and the chat content according to the functionality. The message list mainly includes Message Model, Message Adapter, and Message Activity. The chat content mainly includes ChatMsgModel, Chat Adapter, and Chat Activity. Among them, the IM Helper class is the functional core class of the message, including functions such as wrapping the message content, adding a message, deleting a message, updating a message, and judging whether a message has been read or not.


## 5.2. Psychological Test Function

The function of measuring the heartbeat is that after the user logs in the mental health management system, the heartbeat test can be performed under the “heartbeat” module. If the user is testing for the first time, there will be text prompts on the interface, and then, the user will start the test according to the prompts. If the user has already tested, they can start the test directly. After testing the heartbeat, check the heartbeat result and upload it to the cloud server. Then, the user can select a certain topic according to the chat content recommended by the test result. After analyzing and matching the current user in the cloud Hadoop platform, select another user for text chat, or directly for voice chat. The heartbeat value of other users at this time is obtained through the cloud computing platform layer, and through data analysis and processing on the cloud computing platform, a user is found that matches the user whose heartbeat is currently being tested, so as to conduct voice chat with strangers.The heartbeat function utilizes the built-in sensor and flash of the mobile Smartphone. When the finger is placed on the camera and the flash is covered, a certain heartbeat detection algorithm can detect the heartbeat of the test user at this moment. Then, the database server of the cloud computing data center records the heartbeat value at this time and uses the feature matching algorithm to find another user who is also testing the heartbeat to match it.The psychological test function provides a powerful and complete psychological test. There are a wide range of categories including emotion, personality, ability, interest, and professional five aspects. Users can choose the psychological test that suits them according to their preferences. And according to the test results to judge the severity of their own psychological problems, if necessary, users can consult a psychological consultant. The professional type of psychological test is the test questions selected by the psychological consultant from the professional psychological test question bank, for example, Harvard Professional Aptitude Test Scale. These questions require a certain fee and can obtain advice from a psychological counselor based on the test questions.The psychological test function is composed of a series of psychological test questions. These test questions can be viewed by professional system administrators or psychological consultants, and the types of psychological tests in the system and the psychological tests themselves are edited and saved in the psychological test section of the Hadoop platform in the cloud computing center. After the server has processed the data in the background, it is transmitted to the corresponding front-end, and the front-end is embedded in the client after rendering and displaying. Users can complete the psychological test on the corresponding Android phone, as shown in Figure7.Figure 7
Psychological test function interaction diagram.


## 5.3. Expert Consultation Function

The expert consultation function, as the name suggests, provides expert consultation services including consultation centers and psychological clinics across the country. These experts can address anxiety, obsessive-compulsive disorder, depression, hypochondriasis, and schizophrenia from mild to severe professional counseling advice. In order to facilitate users to seek medical treatment nearby, it also provides a positioning function to locate a nearby psychological counselor. It provides a reputation classification based on the user satisfaction of psychological counselors. Qualification rankings are provided according to the professional level of psychological counselors. For example, the national second-level psychological counselor is higher than the national third-level psychological counselor.


## 5.4. System Function Test

The hardware configuration of Android smartphone is shown in Table2.Table 2
Test mobile phone hardware parameters.
NameParameterDevice modelLGL24G3Operating systemAndroid: 4.4.2CPUQuad-core ARMv7 processor (VFPv4, NEON)RAM32GB ROM 2GB RAMGraphics cardAdreno(TM)330In order to further verify the performance and reliability of the algorithm described in this paper, this paper adopts the traditional ant colony algorithm (ACO), using VD graph. It performs algorithm optimization according to the designed scheme. It is set with the parameters in Table3, and the GA, ACO, and GA-CW algorithms are compared and tested. The experiment comprehensively considers the performance of the algorithm by comprehensively considering the energy consumption, connectivity rate, solution speed, and other indicators obtained under the solution of each algorithm.Table 3
Experimental parameter settings.
ParameterValueEelec (nA.bit-1)0.07Eamp (nA.bit-l)0.04Cmin (MB)2.344Cmax (MB)3.711Dmax (km)2.5First, compare them from the perspective of energy consumption. Under the solution results of different algorithms, the comparison of the number of basic nodes (data acquisition nodes and action nodes) corresponding to each relay node is shown in Figure8(a). The comparison diagram of the communication data volume between the relay node and the corresponding basic node is shown in Figure 8(b).Figure 8
Comparison of energy consumption angles.According to the operating voltage and other parameters of the basic node, the communication power consumption between the basic node and the corresponding relay node is obtained by conversion. It further obtains the power consumption fluctuation comparison chart, as shown in Figure9. (This graph can reflect the uniformity of node coverage. The smaller the fluctuation, the smaller the energy consumption gap between nodes, which is conducive to later maintenance.)Figure 9
Power consumption fluctuation curve.Combining Figures8 and 9, it can be seen that each GA-CW algorithm has 12 relay nodes, and the power consumption fluctuation curves of the two algorithms are relatively similar. But the fluctuation of GA-CW algorithm is slightly larger than that of GA-CW algorithm. The GA algorithm sets 10 relay nodes. However, from the fluctuation curve, the fluctuation range is the largest, resulting in uneven power consumption among nodes. Being in this situation for a long time will cause a node to be paralyzed prematurely, causing a burden for later maintenance. The power consumption fluctuation of the ACO algorithm is relatively small, but this algorithm needs to set up 14 relay nodes, which reduces the economic index.In Figures10(a)–10(c), the power consumption from the base node to the relay node, the power consumption from the relay node to the sink node, and the total power consumption are compared. It can be seen that the three types of power consumption of GA-CW are 63.57 Wh, 1360 Wh, and 1423.3 Wh. Compared with the other three algorithms, it is in the lead. Compared with the unimproved GA algorithm, the power consumption of the GA-CW algorithm is improved by 10%.Figure 10
Power consumption comparison.According to the function of the statistical analysis system, the core functional modules of the system are tested. Platform operation data analysis, institutional evaluation data analysis, and psychological problem correlation analysis modules were selected for testing. The results are shown in Table4:Table 4
System function test table.
Use case nameStepsExpected outcomeTest resultsMessage function implementation(1) Click friends(2) Generate text, expression, voice(3) Follow friendsCan enter dialog boxes, send and receive messages, and interact with friends normallyFunctioning normallyPsychological test function(1) Click the psychological test icon(2) Click heart rate detection(3) Click psychological testYou can enter the heart rate detection and psychological test pages normally, and the psychological test can answer the questions normally and get the results normallyFunctioning normallyExpert consultation function(1) Click the expert consultation icon(2) Click on the category of psychological problems(3) Click on expert list(4) Go to the expert page(5) Talk to an expertIf you can enter the page, the system can push the expert list normally, the expert and the user can communicate normally, and the expert consultation function is displayedFunctioning normally


## 6. Conclusions

Mental health issues will be a hot issue in the future of society. This paper designs a cloud computing-based mental health service platform based on cloud computing technology architecture. The platform is based on cloud computing and builds a system to collect data through sensors, smartphone, and other devices. It transmits data from the Internet to the cloud Hadoop platform for data analysis and processing and finally provides users with a platform for physical and mental health services. The powerful vitality brought by the cloud computing platform makes the Internet develop in a smaller and faster direction. Mental health issues are getting more and more attention. The establishment of a mental health platform is undoubtedly an indispensable part of human life in the future. This paper builds a new mental health service platform based on cloud computing. It also completes the design of platform architecture, platform function design, platform interface design, platform database design, and code implementation. Then, perform functional testing to basically realize the functions of the platform. But there are still the following shortcomings. Due to insufficient understanding of physical and psychological medical knowledge, the collection of physical data and psychological characteristic data is not professional enough. The equipment and related interfaces for collecting data can still be designed more perfect. Therefore, in the future, research will be more in-depth research on psychology.



---

*Source: 6960015-2022-06-29.xml*