These features included account creation, searching for disease symptoms and solutions, finding reservations with psychological specialists, and conducting mental health tests.. To addre
Trang 1VIETNAM NATIONAL UNIVERSITY - HO CHI MINH CITY
Course by Assoc Prof Nguyen Thi Thuy Loan
TOPIC: MENTAL HEALTHCARE SYSTEM
BY GROUP 01 – MEMBER LIST
1 NGUYEN HOANG ANH TU ITDSIU20090 Team Leader 2 NGUYEN QUANG DIEU ITDSIU20031 Team Member 3 PHAM MINH VU ITITIU20354 Team Member 4 NGUYEN LUAN CONG BANG ITITIU20163 Team Member 5 HUYNH TRAN KHANH ITCSIU21011 Team Member
Trang 24 The techniques & tools used 7
II TASK TIMELINE & DIVISION 8
1 Contribution 8
2 Project Timeline & Task Division 8
III PROJECT ANALYSIS 11
3.2 Database and Tables Creation 13
3.3 Database Data Insertion 20
Trang 3LIST OF FIGURES
Figure 1 Primary Crow's Foot Format E.R.D Diagram 12
Figure 2 Schema design created by using SQL Server 13
Figure 3 The project structures in IDE 38
Figure 4 UML Diagram of the project 39
Figure 5 Free database hosting website for the project 41
Figure 6 Testing connection with the database 42
Figure 7 Create a new G.U.I Form in IDE 49
Figure 8 G.U.I Designer Form for making a reservation 50
Figure 9 Login interface for the first time running 58
Figure 10 Specialist account registration successfully 59
Figure 11 Patient dashboard with searched result 60
Figure 12 Change user password successfully 60
Figure 13 Making a reservation successfully 61
Figure 14 Test-taking in progress 61
Figure 15 Score announcement 62
Figure 16 Specialist posting reservation successfully 62
Figure 17 Delist reservation successfully 63
Figure 18 Administrator mode for debugging purposes 63
Trang 4LIST OF TABLES
Table 1 Individual responsibility and contribution 8
Table 2 Sprint planning and task division for individuals and teams 8
Table 3 Normal form achievement 13
Table 4 An overview of all database entities and their attributes 14
Trang 5I INTRODUCTION
1 Abstract
The Principles of Database Management course project involved developing a
mental healthcare services system with several features These features included account creation, searching for disease symptoms and solutions, finding reservations with psychological specialists, and conducting mental health tests The project also emphasized creating a perfect database that adhered to the B.C normal form The database design process logically defined data entities, relationships, attributes, and constraints Achieving the B.C normal form ensured data integrity, eliminated anomalies, and optimized data retrieval and storage ("1NF, 2NF, 3NF, and BCNF in Database Normalization | Studytonight," n.d.) The logical design was meticulously crafted to ensure system efficiency, reliability, and scalability The database contained data uploaded by reputable organizations from around the world This ensured that the information stored in the database was credible and dependable The system's user interface was designed to be user-friendly, enabling easy access to various features The search function allowed users to find information about disease symptoms and solutions quickly The reservation system provided a straightforward way to schedule appointments with psychological specialists
The mental health test feature also allowed users to assess their mental health status Overall, the project provided a valuable opportunity to apply database management principles to a real-world problem in the field of mental health It underscored the significance of efficient and reliable data management in this domain The thoughtful approach to system features and design demonstrated a commitment to developing a robust mental healthcare system The project showcased the practical application of database management principles in addressing challenges in mental health
2 System Overview
The global pandemic has profoundly impacted mental health, resulting in increased recognition of the importance of psychological therapy ("Depression," n.d.) In recent years, there has been a significant shift in attitudes towards therapy, with more individuals acknowledging its benefits and seeking professional help for their mental health concerns
Trang 6However, accessing traditional therapy can still be challenging for many people due to factors such as long waitlists, high costs, and the enduring stigma associated with mental health ("Suicide mortality rate (per 100,000 population) | Data," n.d.)
To address these barriers and meet the growing demand for mental health services, online therapy platforms have emerged as a popular and accessible option These platforms offer a wide range of mental health services, including individual and group therapy sessions, online resources, and support from licensed therapists One of the critical advantages of online therapy is its flexibility, allowing individuals to schedule sessions at their convenience and receive therapy from the comfort of their homes Moreover, these platforms often offer more affordable pricing than traditional in-person therapy, making therapy accessible to a broader audience
Among the well-known online therapy platforms are BetterHelp, Talkspace, and Amwell BetterHelp provides various therapy options, including live sessions, messaging, and chat support Talkspace specializes in unlimited messaging therapy with licensed therapists On the other hand, Amwell offers mental health services as part of its broader telehealth platform, including access to medical doctors and specialists
The COVID-19 pandemic has further highlighted the significance of online therapy platforms With social distancing measures in place, many individuals have turned to these platforms to continue receiving mental health support Online therapy offers the added benefits of anonymity and privacy, which can be particularly appealing to those who may feel hesitant about seeking therapy in person due to stigma or other concerns
It is important to note that while online therapy platforms offer numerous advantages, they are not a substitute for traditional therapy, especially for individuals with severe mental health conditions These platforms, however, provide a valuable resource for individuals seeking mental health support, offering a convenient and accessible alternative to in-person therapy While they are not a replacement for all types of therapy, online platforms have become a valuable tool in supporting individuals' mental well-being and addressing the increased demand for psychological support in today's challenging times
3 Goal
Design the database to suit the requirements of Normalization BC Normal Form
Trang 7- Connect the front-end interface (application) to the back-end database using a Java connection driver
- Develop the functions such as login, account creation, and booking; take a test using complex queries
- Evaluate the data and give more precise predictions in the future for the users - Take security measures in the database to ensure robust privacy for the users' data
and prevent any hacking into the system (known as SQL Injection)
4 The techniques & tools used
- SQL Server manages data in a relational database management system (RDBMS) using the SQL Server Management Studio and free hosting from
www.freeasphosting,net, which stores our database remotely
- Java language using JetBrains IntelliJ IDEA GUI design the interface for users from the database and application logic flow
- Figma to design briefly about the interface
- Version Control System from GitHub to easily collaborate on the project - Some other means of contact: are Microsoft Teams and Notion
- SQL additional tool (Ltd, n.d.)
Trang 8II TASK TIMELINE & DIVISION
1 Contribution
Table 1 Individual responsibility and contribution
Nguyen Hoang Anh Tu Database Developer, Data Analyst 20% Nguyen Quang Dieu Interface Developer, Data Analyst 20%
2 Project Timeline & Task Division
Table 2.Sprint planning and task division for individuals and teams
Collect sample data for analyzing Tu
Research for references and technical
Agree on communication, workflow,
Determine scopes, learning objectives,
and goals for the project All
Analyze proper approach and
methodology for project development All
Specify requirements for the project All
2
Establish development timeline All
Determine proper technology stack and
database management system All
Trang 9Propose necessary features and their
Phase 1 review and retrospective All
CONCEPTUAL DESIGN
Identify use cases and actors of the
3
Specify types of information that are
essential to be stored in the database Tu, Dieu
Design user interface for core
Design the relational models Tu
4
Prepare the E.R diagram and Class
Phase 2 review and retrospective All
IMPLEMENTATIONS
Database creation and setup All
5 ~ 12
Setup database tables, their
relationship, and constraints Tu
Implement necessary queries for each
Develop application interface and
client-side functionalities Bang, Vu, Khanh
Work on new user registration Khanh
Work on user login/logout and
Develop searching system among specialists, diseases, symptoms, and solutions through queries
Dieu
Develop a booking system between
Develop mental health test system and give the approach sets based on the tests' results
Bang
Phase 3 review and retrospective All
Trang 10TESTING
Code review and refactoring Bang, Vu, Khanh
12 ~ 14
Bug detection and fixing Bang, Vu, Khanh
Design and implement test cases All
Fix and modify the application until
Phase 4 review and retrospective All
Trang 11III PROJECT ANALYSIS
1 Requirements Analysis
The proposed project aims to develop a comprehensive mental healthcare system with features including secure account login, password reset, and user roles for patients and specialists Users can access and extract data based on their role and request additions to the system's database Patients can take tests to identify psychological disorders and receive recommended solutions The system will provide information on common mental illnesses, symptoms, and potential solutions
2 Approach Analysis 2.1 Reviewed Materials
- Advanced SQL Server language structure ("SQL Tutorial," n.d.).
- Java, JDBC, Swing Worker official usage documents ("Lesson: JDBC Basics (The JavaTM Tutorials > JDBC Database Access)," n.d.), ("SwingWorker (Java Platform S.E 8 )," n.d.).
2.2 Research Approach
a) Methodology
The Scrum framework, a part of the Agile approach, has been adopted for the project Teams can deliver products using Scrum, which emphasizes adaptability and responsiveness to change in iterative and incremental stages It is frequently called an "agile project management framework" and concentrates on controlling circumstances to manage time and expense Traditional project management techniques, on the other hand, focus on set requirements to manage time and costs To support efficient project management, Scrum uses several strategies, including time boxes, group rituals, a prioritized product backlog, and regular feedback loops
b) Process
The product backlog, which serves as a to-do list for the project, contains the features The team sets a sprint backlog with features and activities at the sprint planning meeting by choosing the product backlog items they think can be completed during the sprint period When the team decides on the sprint backlog, they begin working on the assigned tasks with
Trang 12a single, undivided concentration on reaching the sprint goal The product backlog can be altered before the start of the subsequent sprint, while the sprint backlog is left alone during the sprint
The team meets for a 15-minute scrum during the sprint to discuss remaining tasks, offer updates on their progress, and resolve any issues they encounter Each team member presents their work to the other members of the team, who provide insightful feedback that helps them plan the subsequent sprint and make required modifications The three Scrum pillars of transparency, inspection, and adaptability, which stress the value of open communication, ongoing review, and the capacity to adjust to changing conditions, serve as the framework for these meetings
3 System Analysis 3.1 Database Design
Figure 1 Primary Crow's Foot Format E.R.D Diagram
Trang 13Figure 2 Schema design created by using SQL Server
Moreover, our database has achieved the highest B.C normal form because of the following table:
Table 3.Normal form achievement
1 N.F The database does not have any multivalued tuples 2 N.F All the non-key attributes depend on the primary key
3 N.F There are no transitive dependencies between non-key attributes
BC N.F Every non-trivial functional dependency in the database depends on a candidate key
3.2 Database and Tables Creation
This part discusses the database creation, schemas, and tables following the E.R.D the diagram in SQL Server Database:
a.Database Creation
CREATE DATABASE [congbang0711_] USE [congbang0711_]
Trang 14b Schemas and Tables Analysis
The current version of the Entity-Relationship Diagram (E.R.D.) has the following twelve entities:
Table 4.An overview of all database entities and their attributes
IndentifyNumber varchar(50) NOT NULL
GraduationUniversity varchar(50) NOT NULL
HealingInformation_ID int IDENTITY(1, 1)
PRIMARY KEY
SpecialistID int NOT NULL Place varchar(50) NOT NULL Date date NOT NULL
Fee money NOT NULL
Trang 15Description varchar(200) NOT NULL Extra_Information varchar(100)
Answer Set AnswerSet_ID int PRIMARY KEY
No_Answer int NOT NULL
Answer
Answer_ID int PRIMARY KEY Title varchar(100) NOT NULL Weight int NOT NULL
Trang 16From the above table, we can conclude some requirements as follows:
o The Account table has a field of Password that contains the binary result from
the SHA1 hashing result with randomly generated Salt ("Add a Salt with the
SQL Server HASHBYTES Function," n.d.)
o The Patient and Specialists tables have fields that store user information and can be extracted for their actions with the system
o The HealingInformation table is responsible for healing reservations between patients and specialists
o The Disease and Symptom tables store the information users can search using their names
o The Test, Question, AnswerSet, Answer, Result, and
Solution tables serve to conduct tests and solutions given per patient and track their records after taking tests
c Account Schema Account Table:
CREATE TABLE [Account].[Account] [User_ID] [bigint] IDENTITY(, 1)PRIMARY KEY,
[User_name] [varchar](50)NOTNULL,
[Password] [varbinary](20)NOTNULL,
[Salt] [varchar](100)NOTNULL)
Patient Table:
CREATE TABLE [Account].[Patient] [Patient_ID] [int] IDENTITY(, 1)PRIMARY KEY,
[UserID] [bigint] NOTNULL,
[FullName] [varchar](50)NOTNULL,
[DoB] [date] NOTNULL,
[Sex] [varchar](10)NOTNULL,
[Email] [varchar](50)NOTNULL,
FOREIGN KEY(UserID)REFERENCES [Account].[Account](User_ID))
PatientRecord Table:
Trang 17CREATE TABLE [Account].[PatientRecord] [ID] [int] PRIMARY KEY,
[PatientID] [int] NOTNULL,
[ResultID] [int] NOTNULL,
FOREIGN KEY(PatientID)REFERENCES [Account].[Patient](Patient_ID),
FOREIGN KEY(ResultID)REFERENCES [Test].[Result](Result_ID))
Specialist Table:
CREATE TABLE [Account].[Specialist] [Specialist_ID] [int] IDENTITY(, 1)
PRIMARY KEY,
[UserID] [bigint] NOTNULL,
[FullName] [varchar](50)NOTNULL,
[DoB] [date] NOTNULL,
[Sex] [varchar](10)NOTNULL,
[Email] [varchar](50)NOTNULL,
[Phone] [varchar](15)NOTNULL,
[IdentifyNumber] [varchar](50)NOTNULL,
[GraduationUniversity] [varchar](50)NOTNULL,
FOREIGN KEY(UserID)REFERENCES [Account].[Account](User_ID))
d Booking Schema HealingInformation Table:
CREATE TABLE [Booking].[HealingInformation] [HealingInformation_ID] [int] IDENTITY(, 1)PRIMARY KEY,
[SpecialistID] [int] NOTNULL,
[Place] [varchar](50)NOTNULL,
[Date] [date] NOTNULL CHECK(Date>CAST(GetDate() as Date)),
[Fee] [money] NOTNULL,
[Description] [varchar](200)NOTNULL,
Trang 18[HealingInformationID] [int] NOTNULL UNIQUE,
FOREIGN KEY(PatientID)REFERENCES [Account].[Patient](Patient_ID),
FOREIGN KEY(HealingInformationID)REFERENCES
[Booking].[HealingInformation](HealingInformation_ID))
e Disease Schema Disease Table:
CREATE TABLE [Disease].[Disease] [Disease_ID] [int] PRIMARY KEY,
[Name] [varchar](50)NOTNULL,
[Description] [varchar](200)NOTNULL)
Symptom Table:
CREATE TABLE [Disease].[Symptom] [Symptom_ID] [int] PRIMARY KEY,
[Name] [varchar](50)NOTNULL,
[Description] [varchar](100)NOTNULL)
DiseaseSymptom Table:
CREATE TABLE [Disease].[DiseaseSymptom] [ID] [int] PRIMARY KEY,
[DiseaseID] [int] NOTNULL,
[SymptomID] [int] NOTNULL,
FOREIGN KEY(DiseaseID)REFERENCES [Disease].[Disease](Disease_ID),
FOREIGN KEY(SymptomID)REFERENCES [Disease].[Symptom](Symptom_ID))
f Test Schema Test Table:
CREATE TABLE [Test].[Test] [Test_ID] [int] PRIMARY KEY,
[Total] [int],
[No_Question] [int],
[DiseaseID] [int] NOTNULL,
FOREIGN KEY(DiseaseID)REFERENCES [Disease].[Disease](Disease_ID))
Result Table:
CREATE TABLE [Test].[Result] [Result_ID] [int] PRIMARY KEY,
Trang 19[TestID] [int] NOTNULL,
[Weight] [int] NOTNULL,
[Description] [varchar](200),
FOREIGN KEY(TestID)REFERENCES [Test].[Test](Test_ID))
Question Table:
CREATE TABLE [Test].[Question] [Question_ID] [int] PRIMARY KEY,
[TestID] [int] NOTNULL,
[Title] [varchar](500)NOTNULL,
[AnswerSetID] [int] NOTNULL,
FOREIGN KEY(TestID)REFERENCES [Test].[Test](Test_ID),
FOREIGN KEY(AnswerSetID)REFERENCES [Test].[AnswerSet](AnswerSet_ID))
AnswerSet Table:
CREATE TABLE [Test].[AnswerSet] [AnswerSet_ID] [int] PRIMARY KEY,
[No_Answer] [int] NOTNULL)
AnswerSetContent Table:
CREATE TABLE [Test].[AnswerSetContent] [ID] [int] PRIMARY KEY,
[AnswerSetID] [int] NOTNULL,
[AnswerID] [int] NOTNULL,
FOREIGN KEY(AnswerID)REFERENCES [Test].[Answer](Answer_ID),
FOREIGN KEY(AnswerSetID)REFERENCES [Test].[AnswerSet](AnswerSet_ID))
Answer Table:
CREATE TABLE [Test].[Answer] [Answer_ID] [int] PRIMARY KEY,
[Title] [varchar](100)NOTNULL,
[Weight] [int] NOTNULL)
g Solution Schema Solution Table:
CREATE TABLE [Solution].[Solution] [Solution_ID] [int] PRIMARY KEY,
[Name] [varchar](50)NOTNULL,
[Type] [varchar](50)NOTNULL,
Trang 20[Benefit] [varchar](50)NOTNULL,
[Platform] [varchar](30)NOTNULL,
[Description] [varchar](400))
Recommendation Table:
CREATE TABLE [Solution].[Recommendation] [ID] [int] PRIMARY KEY,
[SolutionID] [int] NOTNULL,
[ResultID] [int] NOTNULL,
FOREIGN KEY(SolutionID)REFERENCES [Solution].[Solution](Solution_ID),
FOREIGN KEY(ResultID)REFERENCES [Test].[Result](Result_ID))
CureOneByOne Table:
CREATE TABLE [Solution].[CureOneByOne] [ID] [int] PRIMARY KEY,
[SolutionID] [int],
[SymptomID] [int] NOTNULL,
FOREIGN KEY(SolutionID)REFERENCES [Solution].[Solution](Solution_ID),
FOREIGN KEY(SymptomID)REFERENCES [Disease].[Symptom](Symptom_ID))
3.3 Database Data Insertion a Source of data insertion
In general, the data insert into the database comes from three primary sources: o Self-generated data for testing purposes, as in Account, Patient,
Specialist, HealingInformation
o Look up the web for accurate data such as Disease, Symptom, Test, Question, AnswerSet, Answer, Result, and Solution ("FREE Mental Health Tests, Quizzes, Self-Assessments, & Screening Tools," 2022)
o When the system goes public, the data from real user input is considered and validated before inputting into the database
o We also have some update and removal procedures for users to make changes to suit their needs
Trang 21In this report, the first five rows of each table are demonstrated to preview the data insert only, and the complete data can be found using the backup file attached to this report
b Account Schema Account Table:
INSERT [Account].[Account]([User_ID], [User_name], [Salt], [Password])
INSERT [Account].[Account]([User_ID], [User_name], [Salt], [Password])
INSERT [Account].[Account]([User_ID], [User_name], [Salt], [Password])
VALUES(,N'congbang',N'5Sj%3', 0xC17EDC261652EC7CD357BC6850B8962B9EE9216A)
Trang 22VALUES(, 5,N'Nguyen Luan Cong Bang',CAST(N'2002-11-07' AS Date),N'Male',
INSERT [Account].[Specialist]([Specialist_ID], [UserID], [FullName], [DoB],
[Sex], [Email], [Phone], [GraduationUniversity], [IdentifyNumber])
VALUES(, 2,N'Lam Thanh Luan',CAST(N'1990-06-13' AS Date),N'Male',
N'lamthanhluan@gmail.com',N'0913517039',N'Sai Gon University',
INSERT [Account].[Specialist]([Specialist_ID], [UserID], [FullName], [DoB],
[Sex], [Email], [Phone], [GraduationUniversity], [IdentifyNumber])
VALUES(, 6,N'Pham Minh Vu',CAST(N'1985-06-13' AS Date),N'Male',
N'laimaybay@gmail.com',N'0947513068',N'International University',
INSERT [Account].[Specialist]([Specialist_ID], [UserID], [FullName], [DoB],
[Sex], [Email], [Phone], [GraduationUniversity], [IdentifyNumber])
VALUES(, 28,N'Trinh Duc Bao',CAST(N'2002-09-06' AS Date),N'Male',
N'trducbo@gmail.com',N'0944738291',N'International University',
N'032428934334')
Trang 23c Booking Schema HealingInformation Table:
INSERT [Booking].[Booking]([Book_ID], [PatientID], [HealingInformationID])
INSERT [Booking].[HealingInformation]([HealingInformation_ID],
[SpecialistID], [Place], [Date], [Fee], [Description], [Extra_Information])
VALUES(, 1,N'Quan 3',CAST(N'2023-05-01' AS Date), 300000.0000,N'I will help you to get out of your mental problem within 1 hour',N'Please come in the morning')
INSERT [Booking].[HealingInformation]([HealingInformation_ID],
[SpecialistID], [Place], [Date], [Fee], [Description], [Extra_Information])
VALUES(, 2,N'Quan 1',CAST(N'2023-05-01' AS Date), 400000.0000,N'If you need help, come to me',NULL)
INSERT [Booking].[HealingInformation]([HealingInformation_ID],
[SpecialistID], [Place], [Date], [Fee], [Description], [Extra_Information])
VALUES(, 2,N'Quan 1',CAST(N'2023-05-05' AS Date), 400000.0000,N'If you need help, come to me',N'I am free in the afternoon')
INSERT [Booking].[HealingInformation]([HealingInformation_ID],
[SpecialistID], [Place], [Date], [Fee], [Description], [Extra_Information])
VALUES(, 2,N'Quan 1',CAST(N'2023-05-06' AS Date), 400000.0000,N'If you need help, come to me',NULL)
INSERT [Booking].[HealingInformation]([HealingInformation_ID],
[SpecialistID], [Place], [Date], [Fee], [Description], [Extra_Information])
VALUES(, 2,N'Quan 1',CAST(N'2023-05-13' AS Date), 400000.0000,N'If you need help, come to me',NULL)
d Disease Schema
Trang 24Disease Table:
INSERT [Disease].[Disease]([Disease_ID], [Name], [Description])
VALUES(,N'Depression',N'Depression is a mood disorder that causes a persistent feeling of sadness and loss of interest.')
INSERT [Disease].[Disease]([Disease_ID], [Name], [Description])
VALUES(,N'Stress',N'Stress is a consequence of experiencing pressure or tension.')
INSERT [Disease].[Disease]([Disease_ID], [Name], [Description])
VALUES(,N'Anxiety',N'Anxiety is an emotion caused by a perceived or experienced threat, which often leads to an avoidance or evasion thereof.')
INSERT [Disease].[Disease]([Disease_ID], [Name], [Description])
VALUES(,N'Borderline',N'Borderline is a personality disorder People with borderline have fast-changing feelings toward friendship, love, and so on.')
INSERT [Disease].[Disease]([Disease_ID], [Name], [Description])
VALUES(,N'Migraine',N'Migraine is an illness, where regular intense
attacks of headache occur In the case of migraine, this headache often only takes place at one side of the head, and causes a pounding type of pain')
Symptom Table:
INSERT [Disease].[Symptom]([Symptom_ID], [Name], [Description])
VALUES(,N'Eating disorder',N'Physical')
INSERT [Disease].[Symptom]([Symptom_ID], [Name], [Description])
VALUES(,N'Sleeping disorder',N'Physical')
INSERT [Disease].[Symptom]([Symptom_ID], [Name], [Description])
VALUES(,N'Having fewer feelings',N'Mental')
INSERT [Disease].[Symptom]([Symptom_ID], [Name], [Description])
VALUES(,N'Decrease libido',N'Physical')
INSERT [Disease].[Symptom]([Symptom_ID], [Name], [Description])
VALUES(,N'Tension',N'Mental')
Trang 25INSERT [Test].[Test]([Test_ID], [Total], [No_Question], [DiseaseID])
INSERT [Test].[Test]([Test_ID], [Total], [No_Question], [DiseaseID])
VALUES(,NULL,NULL, 5)
Result Table:
INSERT [Test].[Result]([Result_ID], [TestID], [Weight], [Description])
VALUES(, 1, 80,N'Little Severe')
INSERT [Test].[Result]([Result_ID], [TestID], [Weight], [Description])
VALUES(, 1, 100,N'Severe')
INSERT [Test].[Result]([Result_ID], [TestID], [Weight], [Description])
VALUES(, 2, 80,N'Little Severe')
INSERT [Test].[Result]([Result_ID], [TestID], [Weight], [Description])
VALUES(, 2, 100,N'Severe')
INSERT [Test].[Result]([Result_ID], [TestID], [Weight], [Description])
VALUES(, 3, 80,N'Little Severe')
Question Table:
INSERT [Test].[Question]([Question_ID], [TestID], [Title], [AnswerSetID])
VALUES(, 1,N'Little interest or pleasure in doing things?', 1)
INSERT [Test].[Question]([Question_ID], [TestID], [Title], [AnswerSetID])
Trang 26VALUES(, 1,N'Feeling down, depressed, or hopeless?', 1)
INSERT [Test].[Question]([Question_ID], [TestID], [Title], [AnswerSetID])
VALUES(, 1,N'Trouble falling or staying asleep, or sleeping too much?', 1)
INSERT [Test].[Question]([Question_ID], [TestID], [Title], [AnswerSetID])
VALUES(, 1,N'Feeling tired or having little energy?', 1)
INSERT [Test].[Question]([Question_ID], [TestID], [Title], [AnswerSetID])
VALUES(, 1,N'Poor appetite or overeating?', 1)
AnswerSet Table:
INSERT [Test].[AnswerSet]([AnswerSet_ID], [No_Answer])VALUES(, 4)
INSERT [Test].[AnswerSet]([AnswerSet_ID], [No_Answer])VALUES(, 5)
INSERT [Test].[AnswerSet]([AnswerSet_ID], [No_Answer])VALUES(, 2)
INSERT [Test].[AnswerSet]([AnswerSet_ID], [No_Answer])VALUES(, 3)
INSERT [Test].[AnswerSet]([AnswerSet_ID], [No_Answer])VALUES(, 2)
INSERT [Test].[Answer]([Answer_ID], [Title], [Weight])
VALUES(,N'Not at all', 0)
INSERT [Test].[Answer]([Answer_ID], [Title], [Weight])
VALUES(,N'Several days', 1)
INSERT [Test].[Answer]([Answer_ID], [Title], [Weight])
VALUES(,N'More than half the days', 2)
INSERT [Test].[Answer]([Answer_ID], [Title], [Weight])
Trang 27VALUES(,N'Nearly every day', 3)
INSERT [Test].[Answer]([Answer_ID], [Title], [Weight])
VALUES(,N'Never', 0)
f Solution Schema Solution Table:
INSERT [Solution].[Solution]([Solution_ID], [Name], [Type], [Benefit],
[Platform], [Description])
VALUES(,N'Sheep in Dream',N'Game',N'Sleep',N'Mobile App',N'Sheep in Dream is a game about getting a boy to sleep by making sheep jump over a log The sheep are in the top left corner of the screen on a dream hill and the boy is in his bed at the bottom ')
INSERT [Solution].[Solution]([Solution_ID], [Name], [Type], [Benefit],
VALUES(,N'My Oasis: Relaxing, Satisfying',N'Game',N'Communicate-Calm',
N'Mobile App',N'My Oasis: Anxiety Relief Game is a relaxing game that helps in calming your mind, relieve your stress This anti anxiety game helps in relaxation and calm sleeping.')
INSERT [Solution].[Solution]([Solution_ID], [Name], [Type], [Benefit],
[Platform], [Description])
VALUES(,N'Focus Plant: Pomodoro timer',N'App',N'Focus',N'Mobile App',
N'Focus is a gamified focus study timer app to help people better manage their time and focus on the important things in their life Some times self-discipline is just not enough to keep us away from the phones This is when gamification comes in, the in-game achievements encourage users to stick with the app, better manage their time and get things done.')
INSERT [Solution].[Solution]([Solution_ID], [Name], [Type], [Benefit],
[Platform], [Description])
VALUES(,N'Wokamon - Walking app game',N'Game',N'Exercise',N'Mobile App',N'Wokamons are running out of resources and they need your help! Every
Trang 28step you take is turned into energy Use it to feed, grow and collect Wokamons The more you walk, the more Wokamons you can collect and the further you get to explore the magical Woka-worlds like candy desert, icy realm, mystical forest and more! Lend a helping hand and soon you will find, the more you help, the fitter you get!')
Trang 29Most queries shown below are in the same form of this structure to ensure the user input is sanitized, where each question mark shows it is parameterized to suit the content user data:
o DECLARE AS SET: to declare additional variables used in the query
o INSERTINTO VALUES: to insert data into the tables
o SELECT: to show the columns for return
o FROM: to specify the table use
o INNERJOIN: to join the table for more linked data query
o WHERE: to set a condition for each query
o ORDERBY: to sort the results in ascending order
o GROUPBY: to pack the same data into groups
b.Register account
Our system users can create accounts with two roles: Patient and Specialist In
addition, we provide several features, such as password change and display of the user's name in the welcome message
User login authentication
The following query is used to check if user login credentials are correct and exist in
the database; this query returns the role also for later use in other queries
DECLARE @UserName ASVARCHAR(50)= ?
DECLARE @Pwd ASVARCHAR(30)= ?
SELECTCASEWHEN A.User_ID=.UserID AND P.UserID ISNOTNULLTHEN'Patient'
WHEN A.User_ID=.UserID AND S.UserID ISNOTNULLTHEN'Specialist'ELSENULLENDASRole,CASEWHEN A.User_ID=.UserID AND P.UserID ISNOTNULLTHEN P.Patient_ID
WHEN A.User_ID=.UserID AND S.UserID ISNOTNULLTHEN S.Specialist_ID ELSENULLENDAS
ID
FROM [Account].[Account] A
FULLJOIN [Account].[Patient] P ON A.User_ID=.UserID FULLJOIN [Account].[Specialist] S ON A.User_ID=.UserID
WHERE A.User_name=@UserName AND A.Password=HASHBYTES('SHA1',CONCAT(@Pwd,(SELECT A.Salt
FROM [Account].[Account] A WHERE A.User_name=@UserName)))
Trang 30Patient registration
The following query is used to create an account for a user with the patient role, containing basic information such as account name, password, and personal information The password is secured by adding a salt value after each password input to create a hash,
which cannot be retrieved back to string one
DECLARE @Username VARCHAR(50)= ?
DECLARE @Pwd ASVARCHAR(30)= ?
DECLARE @Salt ASVARCHAR()
SET @Salt=CONCAT(CHAR(FLOOR(RAND()* 10)+48),CHAR(FLOOR(RAND()* 26)+65),
CHAR(FLOOR(RAND()* 26)+97),CHAR(FLOOR(RAND()* 15)+33),CHAR(FLOOR(RAND()* 10)+48))
INSERTINTO [Account].[Account]([User_name], [Password], [Salt])
VALUES(@Username,HASHBYTES('SHA1',CONCAT(@Pwd, @Salt)), @Salt)
INSERTINTO [Account].[Patient]([UserID], [FullName], [DoB], [Sex], [Email])
VALUES((SELECTUser_IDFROM [Account].[Account] A WHERE A.User_name ?), ?, ?, ?, ?)
Specialist registration
The following query is used to create an account for a user with the specialist role, containing basic information such as account name, password, personal information, and identity information The password is secured by adding a salt value after each password to
create a hash that cannot be retrieved back to the string value
DECLARE @Username ASVARCHAR(50)= ?
DECLARE @Pwd ASVARCHAR(30)= ?
DECLARE @Salt ASVARCHAR()
SET @Salt=CONCAT(CHAR(FLOOR(RAND()* 10)+48),CHAR(FLOOR(RAND()* 26)+65),CHAR(FLOOR(RAND()*
26)+97),CHAR(FLOOR(RAND()* 15)+33),CHAR(FLOOR(RAND()* 10)+48))
INSERTINTO [Account].[Account]([User_name], [Password], [Salt])
VALUES(@Username,HASHBYTES('SHA1',CONCAT(@Pwd, @Salt)), @Salt)
INSERTINTO [Account].[Specialist]([UserID], [FullName], [DoB], [Sex], [Email], [Phone],
Trang 31DECLARE @Role ASVARCHAR(30)= ?
SELECT FullName
FROM(SELECTCASEWHEN @UserID=.Patient_ID AND @Role='Patient'THEN P.FullName
WHEN @UserID=.Specialist_ID AND @Role='Specialist'THEN S.FullName ENDAS
FullName
FROM [Account].[Account] A
FULLJOIN [Account].[Patient] P ON A.User_ID=.UserID
FULLJOIN [Account].[Specialist] S ON A.User_ID=.UserID)AS SUBQUERY
WHERE FullName ISNOTNULL
User's password change
The query below changes the password provided; the user must correctly enter their old password The new password will be secured by adding salt to form a hash like when the
user registers into the system
DECLARE @UserName ASVARCHAR(50)= ?
DECLARE @oldPwd ASVARCHAR(30)= ?
DECLARE @newPwd ASVARCHAR(30)= ?
DECLARE @Salt ASVARCHAR()
SET @Salt=CONCAT(CHAR(FLOOR(RAND()* 10)+48),CHAR(FLOOR(RAND()* 26)+65),
CHAR(FLOOR(RAND()* 26)+97),CHAR(FLOOR(RAND()* 15)+33),CHAR(FLOOR(RAND()* 10)+48))
UPDATE [Account].[Account]
SETPassword=HASHBYTES('SHA1',CONCAT(@newPwd, @Salt)), Salt=@Salt
WHEREUser_name=@UserName ANDPassword=HASHBYTES('SHA1',CONCAT(@oldPwd,(SELECT A.Salt
FROM [Account].[Account] A WHERE A.User_name=@UserName)))
c.Search for specific disease
Search for disease's symptoms and solutions
Suppose the user enters the right disease name In that case, the following query is designed to return an interface with information about the symptoms of any disease and
the appropriate solutions for each symptom in string result
SELECT S.NameAS symptom, So.NameAS solution, So.Platform, So.DescriptionFROM [Disease].[Disease] D
INNERJOIN [Disease].[DiseaseSymptom] DS ON D.Disease_ID=DS.DiseaseID INNERJOIN [Disease].[Symptom] S ON DS.SymptomID=.Symptom_ID
INNERJOIN [Solution].[CureOneByOne] C ON S.Symptom_ID=.SymptomID INNERJOIN [Solution].[Solution] So ON C.SolutionID=So.Solution_ID
Trang 32WHERE D.Name= ?
d.Make healing reservations
Regarding the appointment booking feature, users and patients are provided with several useful features such as posting information, booking, deleting, and showing upcoming appointment information
Healing information posted by specialist
The following query adds information to the database whenever the specialist posts details about potential future treatment, provided that the treatment date must be later
than the current date, checked by integrity constraint on the table creation
INSERTINTO [Booking].[HealingInformation][SpecialistID], [Place], [Date], [Fee],
[Description], [Extra_Information])
VALUES (,,,,,)
Check the healing information state of each specialist
To see if any treatment appointments from specialists are scheduled or open, use
the query below
SELECT H.HealingInformation_ID AS ID,CONCAT(DAY(.Date),' / ',MONTH(.Date))ASDATE, H.Place, H.Fee, P.FullName, P.Sex, P.Email,CASEWHEN
HHealingInformation_ID=.HealingInformationID THEN'RESERVED'ELSE'VACANT'ENDASState
FROM [Account].[Specialist] S
FULLJOIN [Booking].[HealingInformation] H ON S.Specialist_ID=.SpecialistID FULLJOIN [Booking].[Booking] B ON H.HealingInformation_ID=.HealingInformationID FULLJOIN [Account].[Patient] P ON B.PatientID=.Patient_ID
WHERE S.[Specialist_ID] =? AND H.Date>=CAST(GETDATE()ASDATE)
ORDERBY H.Date
Delete vacant listed information
If the specialist is busy at that time, use the command below to have the information
about scheduled sessions deleted
DELETEFROM [Booking].[HealingInformation]
WHERE SpecialistID = ? AND HealingInformation_ID = ?
Trang 33Check the vacant healing information
Use the query below to look for available treatment sessions and details on that
treatment; this is returned in a tabular form for easier looking
SELECT H.HealingInformation_ID AS ID, H.Date, H.Place,CAST(.Fee ASINT)AS Fee,
SFullName, S.Sex
FROM [Booking].[HealingInformation] H
INNERJOIN [Account].[Specialist] S ON S.Specialist_ID=.SpecialistID
WHERE H.HealingInformation_ID NOTIN(SELECTDISTINCT B.HealingInformationID FROM
[Booking].[Booking] B)AND H.Date>=CAST(GETDATE()ASDATE)
ORDERBY H.Date
Book the reservation by patient
Whenever a patient wants to book a treatment, use the query below to store the
information
INSERTINTO [Booking].[Booking][PatientID], [HealingInformationID])
VALUES (,)
Cancel the booked reservation by patient
The patient can use the query below to ask the system to cancel the scheduled
treatment sessions
DELETEFROM [Booking].[Booking]
WHERE PatientID = ? AND HealingInformationID = ?
Booked patient's reservation
The system will execute the query below to return the information to the patient
whenever they need to review the details of the scheduled treatment sessions
SELECT H.HealingInformation_ID AS ID,CONCAT(DAY(.Date),' / ',MONTH(.Date))ASDATE, H.Place, S.FullName, S.Phone
FROM [Account].[Specialist] S
INNERJOIN [Booking].[HealingInformation] H ON S.Specialist_ID=.SpecialistID INNERJOIN [Booking].[Booking] B ON
HHealingInformation_ID=.HealingInformationID
INNERJOIN [Account].[Patient] P ON B.PatientID=.Patient_ID
WHERE P.Patient_ID = ? AND H.Date>=CAST(GETDATE()ASDATE)
ORDERBY H.Date