0% found this document useful (0 votes)
16 views19 pages

CODEE

Study

Uploaded by

kalpeshk1407
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views19 pages

CODEE

Study

Uploaded by

kalpeshk1407
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

<!

DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta name="description" content="Healthcare Chatbot: Your 24/7 personal health assistant for
general advice, symptoms, wellness tips, and more.">

<meta name="keywords" content="Healthcare, Chatbot, Wellness, Medical Advice, Health Tips,


Symptoms">

<meta name="author" content="Your Company Name">

<title>Healthcare Chatbot Assistant</title>

<!-- Linking Google Fonts -->

<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap"
rel="stylesheet">

<!-- Linking Font Awesome for icons -->

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-


beta3/css/all.min.css" integrity="sha384-
k6RqeWeci5ZR/Lv4MR0sA0FfDOMP1cgZj4AzGk7DFkZ4yK/uG6w0B+XoCqzWg4K"
crossorigin="anonymous">

<style>

*{

margin: 0;

padding: 0;

box-sizing: border-box;

body {
font-family: 'Roboto', sans-serif;

line-height: 1.6;

background-color: #f0f4f8;

color: #333;

.container {

width: 100%;

max-width: 1200px;

margin: 0 auto;

padding: 20px;

header {

background-color: #2980b9;

color: white;

padding: 20px 0;

text-align: center;

border-radius: 10px;

box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

header h1 {

margin-bottom: 10px;

font-size: 2.5rem;

}
header nav ul {

list-style: none;

padding: 0;

header nav ul li {

display: inline;

margin: 0 20px;

header nav ul li a {

color: white;

text-decoration: none;

font-size: 1.1rem;

header nav ul li a:hover {

text-decoration: underline;

/* Main Section */

main {

padding: 40px 0;

.intro {

text-align: center;
margin-bottom: 40px;

.intro p {

font-size: 1.2rem;

margin-bottom: 20px;

.chat-button {

background-color: #2980b9;

color: white;

padding: 15px 30px;

border-radius: 25px;

font-size: 1.2rem;

transition: background-color 0.3s ease;

cursor: pointer;

.chat-button:hover {

background-color: #1f6ca8;

/* Features Section */

.features {

display: flex;

justify-content: space-around;

margin-bottom: 50px;
}

.feature-item {

text-align: center;

width: 30%;

padding: 20px;

background-color: #fff;

border-radius: 10px;

box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

.feature-item i {

font-size: 3rem;

margin-bottom: 20px;

color: #2980b9;

.feature-item h3 {

font-size: 1.5rem;

margin-bottom: 10px;

.feature-item p {

font-size: 1rem;

/* About Section */
.about {

text-align: center;

margin-bottom: 50px;

.about h2 {

font-size: 2rem;

margin-bottom: 20px;

.about p {

font-size: 1.1rem;

max-width: 800px;

margin: 0 auto;

footer {

text-align: center;

padding: 30px 0;

background-color: #34495e;

color: white;

margin-top: 50px;

footer .social-links {

list-style-type: none;

padding: 0;
}

footer .social-links li {

display: inline;

margin: 0 10px;

footer .social-links li a {

color: white;

font-size: 1.5rem;

footer .social-links li a:hover {

color: #f1c40f;

/* Chat Window Styling */

.chat-container {

display: none;

position: fixed;

bottom: 30px;

right: 30px;

width: 300px;

background-color: white;

border-radius: 10px;

box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);

padding: 20px;
z-index: 1000;

.chat-header {

font-size: 1.2rem;

font-weight: bold;

margin-bottom: 10px;

display: flex;

justify-content: space-between;

.typing-indicator {

display: none;

font-size: 0.9rem;

color: #aaa;

#chat-box {

height: 400px;

width: 100%;

border: 1px solid #ddd;

overflow-y: auto;

padding: 10px;

margin-bottom: 20px;

background-color: #fff;

}
.message {

margin: 10px 0;

padding: 10px;

border-radius: 10px;

max-width: 80%;

.user-message {

background-color: #2980b9;

color: white;

margin-left: auto;

.bot-message {

background-color: #ecf0f1;

color: #333;

margin-right: auto;

#user-input {

padding: 10px;

width: 75%;

border: 1px solid #ddd;

border-radius: 20px;

#send-button {
padding: 10px 15px;

background-color: #2980b9;

color: white;

border: none;

border-radius: 20px;

cursor: pointer;

#send-button:hover {

background-color: #1f6ca8;

</style>

</head>

<body>

<div class="container">

<header>

<h1>Welcome to Your Healthcare Chatbot Assistant</h1>

<nav>

<ul>

<li><a href="#home">Home</a></li>

<li><a href="#features">Features</a></li>

<li><a href="#about">About</a></li>

<li><a href="#" onclick="toggleChat()">Chat Now</a></li>

</ul>

</nav>
</header>

<main id="home">

<section class="intro">

<p>Your personal health assistant is ready to help with general health advice, wellness tips,
symptoms, and more. Ask your questions below!</p>

<button class="chat-button" onclick="toggleChat()">� Start Chat</button>

</section>

<section class="features" id="features">

<h2>Key Features</h2>

<div class="feature-item">

<i class="fas fa-clock"></i>

<h3>24/7 Availability</h3>

<p>Our assistant is available anytime to help you with health-related inquiries.</p>

</div>

<div class="feature-item">

<i class="fas fa-heartbeat"></i>

<h3>Health Guidance</h3>

<p>Get tips on nutrition, wellness, and disease prevention.</p>

</div>

<div class="feature-item">

<i class="fas fa-brain"></i>

<h3>Mental Health Support</h3>

<p>Access advice on managing stress, anxiety, and improving mental well-being.</p>

</div>

</section>
<section class="about" id="about">

<h2>About This Chatbot</h2>

<p>Our chatbot is designed to help you with any healthcare-related questions, providing
fast and accurate responses based on reliable sources.</p>

</section>

</main>

<footer>

<p>&copy; 2025 Your Company Name. All rights reserved.</p>

<ul class="social-links">

<li><a href="#"><i class="fab fa-facebook-f"></i></a></li>

<li><a href="#"><i class="fab fa-twitter"></i></a></li>

<li><a href="#"><i class="fab fa-linkedin-in"></i></a></li>

</ul>

</footer>

</div>

<!-- Chat Window -->

<div id="chat-container" class="chat-container">

<div class="chat-header">

<span>Chat with Assistant</span>

<button onclick="toggleChat()">X</button>

</div>

<div id="chat-box"></div>

<div class="typing-indicator" id="typing-indicator">Bot is typing...</div>

<input type="text" id="user-input" placeholder="Type your message..." autofocus />

<button id="send-button">Send</button>

</div>
<script>

// Function to toggle the chat window

function toggleChat() {

const chatContainer = document.getElementById('chat-container');

chatContainer.style.display = (chatContainer.style.display === 'none' ||


chatContainer.style.display === '') ? 'block' : 'none';

// Get references to DOM elements

const chatBox = document.getElementById('chat-box');

const userInput = document.getElementById('user-input');

const sendButton = document.getElementById('send-button');

const typingIndicator = document.getElementById('typing-indicator');

// Function to add a message to the chat box

function addMessage(message, isBot = false) {

const messageDiv = document.createElement('div');

messageDiv.classList.add('message');

messageDiv.classList.add(isBot ? 'bot-message' : 'user-message');

messageDiv.textContent = message;

chatBox.appendChild(messageDiv);

chatBox.scrollTop = chatBox.scrollHeight; // Always scroll to the bottom

// Function to handle sending the user message

function sendMessage() {

const message = userInput.value.trim();


if (message === "") return;

// Add the user message to the chat box

addMessage(message, false);

userInput.value = ""; // Clear the input field

// Show typing indicator

typingIndicator.style.display = 'block';

// Respond after a slight delay for a smooth user experience

setTimeout(() => {

const botResponse = getBotResponse(message);

addMessage(botResponse, true);

typingIndicator.style.display = 'none'; // Hide typing indicator

}, 1000);

// Bot response logic

function getBotResponse(message) {

const responses = {

"hello": "Hello! How can I assist you with your health today?",

"hi": "Hi there! How can I help you with your health today?",

"how are you": "I'm doing great, thank you! How can I help you?",

"how can I stay healthy": "Drink plenty of water, exercise regularly, eat a balanced diet, and get
enough sleep.",

"what are the symptoms of COVID-19": "The common symptoms of COVID-19 include fever, dry
cough, tiredness, and difficulty breathing.",

"what should I eat to stay healthy": "Eating a balanced diet with fruits, vegetables, whole grains,
lean proteins, and healthy fats is key to staying healthy.",
"how can I improve my mental health": "To improve mental health, practice mindfulness, exercise
regularly, stay socially connected, and seek support if needed.",

"can I get COVID-19 from food": "There is currently no evidence that COVID-19 can be transmitted
through food. However, it is always important to wash hands and practice good hygiene.",

"what is a healthy BMI": "A healthy BMI (Body Mass Index) is between 18.5 and 24.9. It’s a
measure of body fat based on height and weight.",

"how often should I exercise": "The World Health Organization recommends at least 150 minutes
of moderate-intensity aerobic activity each week.",

"what is hypertension": "Hypertension, or high blood pressure, is a condition where the force of
blood against the artery walls is too high, which can lead to health issues.",

"what is the best way to lose weight": "The best way to lose weight is through a combination of a
healthy, balanced diet and regular physical activity.",

"what should I do if I feel depressed": "If you feel depressed, it's important to talk to a healthcare
professional or a mental health specialist for advice and support.",

"how to treat a cold": "Drink plenty of fluids, rest, and use over-the-counter medications to relieve
symptoms. Consult a doctor if symptoms worsen.",

"what is a balanced diet": "A balanced diet includes a variety of foods from all the food groups:
vegetables, fruits, proteins, dairy, and grains.",

"what is the meaning of health": "Health is a state of complete physical, mental, and social well-
being, not just the absence of disease or infirmity.",

"can stress cause physical illness": "Yes, chronic stress can affect the body and contribute to
various physical illnesses such as headaches, heart disease, and digestive issues.",

"how to improve sleep": "To improve sleep, maintain a regular sleep schedule, create a relaxing
bedtime routine, and limit screen time before bed.",

"what is the flu": "The flu (influenza) is a contagious respiratory illness caused by flu viruses.
Symptoms include fever, chills, and body aches.",

"how to treat a headache naturally": "Drinking water, resting in a quiet room, and using cold
compresses can help alleviate headaches naturally.",

"what are the symptoms of diabetes": "Common symptoms of diabetes include excessive thirst,
frequent urination, unexplained weight loss, and blurred vision.",

"how can I boost my immune system": "Eating a nutritious diet, exercising regularly, managing
stress, and getting enough sleep are great ways to boost your immune system.",

"what are the symptoms of a stroke": "Signs of a stroke include sudden numbness or weakness,
especially on one side of the body, confusion, and difficulty speaking or understanding speech.",
"what is heart disease": "Heart disease refers to a range of conditions affecting the heart,
including coronary artery disease, heart attacks, and heart failure.",

"how can I prevent heart disease": "To prevent heart disease, maintain a healthy diet, exercise
regularly, avoid smoking, and manage stress.",

"what is mental health": "Mental health refers to a person's emotional, psychological, and social
well-being, affecting how we think, feel, and act.",

"how to deal with anxiety": "Deep breathing, meditation, exercise, and seeking professional
support can help manage anxiety.",

"what is depression": "Depression is a mood disorder that causes persistent feelings of sadness,
hopelessness, and a lack of interest in daily activities.",

"how to improve your mood": "Exercise, socializing with friends, practicing gratitude, and
engaging in enjoyable hobbies can improve your mood.",

"what is a panic attack": "A panic attack is a sudden surge of intense fear or discomfort that often
comes with physical symptoms like heart palpitations and sweating.",

"what are the benefits of yoga": "Yoga helps improve flexibility, reduce stress, increase strength,
and enhance mental clarity.",

"how to relieve stress": "Engaging in activities like meditation, exercise, and hobbies, as well as
talking to someone, can help relieve stress.",

"what is mindfulness": "Mindfulness is the practice of being fully present and engaged in the
moment, which can help reduce stress and improve well-being.",

"how to improve your self-esteem": "Set realistic goals, practice self-compassion, and surround
yourself with positive influences to improve self-esteem.",

"what are the symptoms of a heart attack": "Chest pain, shortness of breath, nausea, and
discomfort in the upper body are common symptoms of a heart attack.",

"how to manage chronic pain": "Chronic pain can be managed through medication, physical
therapy, relaxation techniques, and regular exercise.",

"how to stay hydrated": "Drink water throughout the day and consume hydrating foods like fruits
and vegetables to stay hydrated.",

"what is the role of fiber in the diet": "Fiber aids digestion, helps regulate blood sugar, and can
lower cholesterol levels, promoting overall health.",

"how much sleep do I need": "Adults typically need between 7-9 hours of sleep per night for
optimal health and cognitive function.",

"what are the benefits of regular exercise": "Regular exercise improves cardiovascular health,
strengthens muscles, boosts mood, and promotes better sleep.",
"how to quit smoking": "Seek support, consider nicotine replacement therapy, and avoid triggers
to quit smoking successfully.",

"what is a healthy weight": "A healthy weight is determined by factors like height, body
composition, and lifestyle. A BMI between 18.5 and 24.9 is considered healthy.",

"what is an allergy": "An allergy is an immune system reaction to a substance that is normally
harmless, such as pollen, pet dander, or certain foods.",

"how to prevent allergies": "Avoid known allergens, keep your home clean, and consider using
antihistamines or other medications for symptom relief.",

"how to stay active while working from home": "Take breaks every hour, use a standing desk, or
engage in short workouts during the day to stay active while working from home.",

"what is high blood pressure": "High blood pressure (hypertension) occurs when the force of
blood against your artery walls is consistently too high, which can lead to serious health problems.",

"how to manage diabetes": "Managing diabetes includes monitoring blood sugar levels, eating a
balanced diet, exercising regularly, and taking prescribed medications.",

"what are the symptoms of depression": "Symptoms of depression include persistent sadness, loss
of interest in activities, fatigue, and feelings of worthlessness.",

"what are the benefits of meditation": "Meditation can reduce stress, improve focus, enhance
emotional well-being, and promote relaxation.",

"what are the signs of dehydration": "Signs of dehydration include dry mouth, dizziness, dark
urine, and fatigue.",

"how to boost mental health": "Practice mindfulness, stay socially connected, exercise regularly,
and seek professional help when needed to boost mental health.",

"what are the symptoms of anxiety": "Symptoms of anxiety include rapid heartbeat, shortness of
breath, sweating, and feelings of unease or worry.",

"how to prevent cancer": "To reduce the risk of cancer, maintain a healthy lifestyle by not
smoking, eating a balanced diet, staying active, and avoiding excessive sun exposure.",

"how to reduce sugar intake": "Choose whole foods, limit sugary drinks, read food labels, and
replace sugary snacks with healthier alternatives to reduce sugar intake.",

"how to reduce cholesterol": "Eating a heart-healthy diet with more fruits, vegetables, and whole
grains, exercising, and avoiding trans fats can help reduce cholesterol.",

"what is an autoimmune disease": "An autoimmune disease occurs when the immune system
mistakenly attacks the body’s own cells and tissues.",

"how to manage stress at work": "Take regular breaks, prioritize tasks, set boundaries, and
practice relaxation techniques to manage work-related stress.",
"what is chronic fatigue syndrome": "Chronic fatigue syndrome is a condition characterized by
persistent, unexplained fatigue that doesn't improve with rest.",

"how to prevent type 2 diabetes": "Maintain a healthy weight, eat a balanced diet, exercise
regularly, and monitor blood sugar levels to prevent type 2 diabetes.",

"what is sleep apnea": "Sleep apnea is a sleep disorder where breathing repeatedly stops and
starts during sleep, leading to poor rest and other health issues.",

"how to treat a sore throat": "Drink warm liquids, gargle with saltwater, and use throat lozenges
to soothe a sore throat.",

"what is a healthy diet for heart health": "A heart-healthy diet includes plenty of fruits, vegetables,
whole grains, lean proteins, and healthy fats like those from fish and olive oil.",

"how to improve digestion": "Eat a fiber-rich diet, drink plenty of water, and exercise regularly to
promote healthy digestion.",

"how to treat a stomach ulcer": "Avoid spicy and acidic foods, eat smaller meals, and consult a
doctor for medications to treat a stomach ulcer.",

"how to reduce stress naturally": "Engage in physical activity, meditate, practice deep breathing,
and take time for hobbies to naturally reduce stress.",

"how to manage back pain": "Practice good posture, avoid lifting heavy objects, exercise regularly,
and seek professional treatment if necessary.",

"what is a concussion": "A concussion is a mild traumatic brain injury caused by a blow to the
head, leading to symptoms like dizziness, confusion, and headaches.",

"what are the symptoms of kidney disease": "Common symptoms include fatigue, swelling in the
legs or ankles, and changes in urination.",

"how to maintain healthy bones": "Get plenty of calcium and vitamin D, exercise regularly, and
avoid smoking to maintain strong, healthy bones.",

"what is a healthy heart rate": "A normal resting heart rate for adults is between 60 and 100 beats
per minute.",

"how to prevent osteoporosis": "Weight-bearing exercises, a diet rich in calcium and vitamin D,
and avoiding smoking can help prevent osteoporosis.",

"what are the signs of a cold": "Common signs of a cold include a runny nose, sore throat, cough,
and mild fever.",

"how to treat insomnia": "Try to maintain a regular sleep schedule, avoid caffeine and electronics
before bed, and practice relaxation techniques.",

"how to lower blood sugar levels": "Eating a balanced diet, exercising regularly, and managing
stress can help lower blood sugar levels.",
"how to improve lung health": "Avoid smoking, exercise regularly, and practice deep breathing
exercises to improve lung health.",

"what is vitamin D deficiency": "Vitamin D deficiency can lead to weakened bones and a higher
risk of fractures. Spend time in sunlight and eat foods rich in vitamin D.",

"what is an ear infection": "An ear infection is an inflammation of the ear caused by bacteria or
viruses, leading to symptoms like ear pain, fever, and difficulty hearing.",

"how to boost energy naturally": "Get enough sleep, stay hydrated, eat a balanced diet, and
exercise regularly to boost your energy levels naturally."

};

return responses[message.toLowerCase()] || "I'm sorry, I didn't understand that. Can you


please clarify?";

// Event listeners

sendButton.addEventListener('click', sendMessage);

userInput.addEventListener('keydown', (event) => {

if (event.key === 'Enter') {

sendMessage();

});

</script>

</body>

</html>

You might also like