###### Abstract  
As mental health issues become increasingly prominent, we are now facing challenges such as the severe unequal distribution of medical resources and low diagnostic efficiency. This paper integrates finite state machines, retrieval algorithms, semantic-matching models, and medical-knowledge graphs to design an innovative intelligent auxiliary evaluation tool and a personalized medical-advice generation application, aiming to improve the efficiency of mental health assessments and the provision of personalized medical advice. The main contributions include the following: (1) Developing an auxiliary diagnostic tool that combines the Mini-International Neuropysclatric Interview (M.I.N.I) with finite state machines to systematically collect patient information for preliminary assessments; (2) Enhancing data processing by optimizing retrieval algorithms for efficient filtering and employing a fine-tuned RoBERTa model for deep semantic matching and analysis, ensuring accurate and personalized medical-advice generation; (3) Generating intelligent suggestions using NLP techniques; when semantic matching falls below a specific threshold, integrating medical-knowledge graphs to produce general medical advice. Experimental results show that this application achieves a semantic-matching degree of 0.9 and an accuracy of 0.87, significantly improving assessment accuracy and the ability to generate personalized medical advice. This optimizes the allocation of medical resources, enhances diagnostic efficiency, and provides a reference for advancing mental health care through artificial-intelligence technology. mental health; artificial intelligence; natural language processing; medical-knowledge graph; automatic generation +
Footnote †: journal:low-income areas, marked by a lack of professional personnel and medical facilities, complicating access to high-quality medical services. In developed countries, the distribution of mental health services frequently fails to meet population needs, leading to many patients struggling to receive timely and effective treatment. Current medical practice faces multiple challenges in assessing, diagnosing, and treating mental and psychological disorders [4]. Firstly, the uncertainty of symptoms and subjectivity of patient perception make accurate disease state assessment difficult for doctors in clinical practice. Secondly, the lack of objective indicators means these subjective perceptions often compromise the accuracy of assessment, diagnosis, and treatment. Despite abundant online professional medical knowledge, existing knowledge retrieval systems often provide low-quality information and lack precision. Some specialized platforms provide reliable online consultation services with professional psychiatrists, but these services are typically time-consuming and labor-intensive. To tackle these challenges, this paper leverages the latest computer technology and artificial-intelligence algorithms. Specifically, we integrate the RoBERTa model, based on BERT [5] (Bidirectional Encoder Representations from Transformers), for effective processing and analysis of medical literature and patient records. Additionally, we use the M.I.N.I tool [6], a validated, simple, and effective diagnostic tool for psychiatric disorders. The combination of these methods aims to improve the accuracy of assessments and medical-advice generation for mental and psychological disorders. Existing research mainly relies on doctors' clinical experience and traditional diagnostic tools, which are often lacking in flexibility and personalization [7]. The limited understanding of complex and variable mental disorder characteristics constrains the effectiveness and adaptability of medical advice. Therefore, this paper aims to develop a novel auxiliary assessment tool and an application for generating personalized medical advice. The goal is to enhance the accuracy of mental disorder assessments and treatment efficiency through technological innovation.