Professional Documents
Culture Documents
HAMS
HAMS
INTRODUCTION:
The primary purpose of a HAMS is to optimize the appointment booking process, ensuring that
patients receive timely access to healthcare services while maximizing the utilization of medical
resources. By automating appointment-related tasks, such as scheduling, rescheduling, and
cancellations, the system reduces administrative workload and minimizes scheduling conflicts.
Functionalities:
Patient Module:
Allows patients to place appointments, cancel appointments, and view their information.
Patients provide their personal details and specify the type of disease they have when placing
an appointment.
The system assigns appointments with available doctors based on patient preferences.
Doctor Module:
Enables doctors to access their appointments, mark appointments as done, and change their
login credentials.
Doctors can view their scheduled appointments and update their login credentials as needed.
Admin Module:
1
Provides administrators with overall system management functionalities.
Admins can change the system's password, view appointments of doctors, and reset all
appointments if required.
Linked lists are utilized to maintain patient records, allowing for efficient insertion and deletion
operations.
Dynamic memory allocation is employed to allocate memory for new patients as needed,
ensuring optimal resource utilization.
User Interface:
The program features a user-friendly interface with menu-driven options for easy navigation
and interaction.
Patients, doctors, and administrators are presented with intuitive menus tailored to their
respective roles, enhancing usability.
Objective:
The primary objective of the Hospital Appointment Management System is to improve the
efficiency of appointment scheduling and management processes within the hospital.
The code begins by including necessary header files like< stdio.h>, <conio.h>,< stdlib.h>, and
<string.h>.
2. Structure Definitions:
Three structures are defined: patient, doctor, and admin. These structures hold information
related to patients, doctors, and administrators, respectively.
2
3. Global Variables Initialization:
Global variables such as first (pointer to the first patient record), res (result of disease
selection), count (array to track appointments for each doctor), and id and pwd (default admin
credentials) are initialized.
4. Function Prototypes:
Prototypes for all the functions used in the code are declared. This includes functions for role
selection (info()), patient actions (patient()), doctor actions (doctor()), admin actions (admin()),
utility functions, and appointment management.
5. Main Function:
It calls the info() function to start the interaction with the user.
This function prompts the user to select their role: Patient, Doctor, Admin, or Exit.
Based on the user's choice, it directs the program flow to the corresponding role-specific
function.
This function handles actions specific to patients, such as placing appointments, canceling
appointments, and viewing their information.
It prompts the user to input their choice and performs the corresponding action.
This function handles actions specific to doctors, such as viewing appointments and marking
them as done.
It prompts the doctor to input their credentials for authentication and then presents a menu for
further actions.
This function handles actions specific to admins, such as changing passwords and viewing
doctor appointments.
3
Similar to the doctor function, it prompts the admin to input credentials for authentication and
then presents a menu for further actions.
Source Code
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#define MAX_NAME_LENGTH 20
void info();
void patient();
void doctor();
void admin();
int disease();
4
void cancelAppointment();
void viewInformation();
void appointment_done();
struct patient
char name[20];
char contact[15];
char gen[10];
char address[50];
char id[20];
int appointment_time;
};
struct doctor
char id[20];
char pwd[20];
};
struct admin
char id[20];
5
char pwd[20];
};
int res=0,time;
char id[20]="admin",pwd[20]="1234";
int main()
char ch;
info();
temp=first;
while(temp != NULL)
temp=temp->next;
printf("\n");
6
}
void info()
int ch1;
printf("\n1. Patient");
printf("\n2. Doctor");
n4. Exit");
if (scanf("%d", &ch1) != 1)
return;
switch(ch1)
7
case 1:
patient();
break;
case 2:
doctor();
break;
case 3:
admin();
break;
case 4:
exit(0);
default:
info();
8
}
void patient()
int ch1;
switch(ch1)
case 1:
scanf("%s",ns->name);
scanf("%s",ns->gen);
scanf("%s", ns->contact);
9
printf("\n Enter address = ");
scanf("%s", ns->address);
ns->next=NULL;
if(first==NULL)
first=ns;
else
temp=first;
while(temp->next!=NULL)
temp=temp->next;
temp->next=ns;
res=disease();
switch (res)
10
case 1:
count[0]++; time=(10+count[0])
%13;
break;
case 2:
count[1]++; time=(10+count[1])
%13;
break;
case 3:
count[2]++; time=(10+count[2])
%13;
break;
case 4:
count[3]++; time=(10+count[3])
%13;
break;
case 5:
count[4]++;
11
time=(10+count[4])%13;
break;
default:
return;
break;
case 2:
cancelAppointment();
break;
case 3:
viewInformation();
break;
default:
break;
12
}
while(temp != NULL)
>next;
info(); // Go back to the main menu after performing the chosen action
void doctor()
// Doctor's functionality
char id[20],pwd[20];
int ch2,count8=3,countt=3,flag=1,ch,counttt=0;
if(counttt==0)
13
strcpy(doc[0].id, "Abhijeet");
strcpy(doc[0].pwd, "1234");
strcpy(doc[1].id, "Viraj");
strcpy(doc[1].pwd, "5678");
strcpy(doc[2].id, "Samrudhi");
strcpy(doc[2].pwd, "abcd");
strcpy(doc[3].id, "Sayli");
strcpy(doc[3].pwd, "efgh");
strcpy(doc[4].id, "Shravni");
strcpy(doc[4].pwd, "ijkl");
counttt++;
(dentist)");
if (scanf("%d", &ch2) != 1)
14
while (getchar() != '\n');
again return;
do
scanf("%s",id);
scanf("%s",pwd);
flag=2;
break;
count8--;
} while(count8>0);
if(flag==2)
15
printf("\n -----Welcome--- -");
scanf("%d",&ch);
switch(ch)
case 1:
break;
case 2:
appointment_done();
break;
default:
break;
else
16
{
info();
void admin()
// Admin's functionality
char id2[20],pwd2[20];
do
scanf("%s",id2);
scanf("%s",pwd2);
break;
17
count6--;
} while(count6>0);
if(count6==0)
else
scanf("%d",&ch);
switch(ch)
case 1:
scanf("%s",id);
18
scanf("%s",pwd);
info();
break;
case 2:
5. Shravni\n (dentist)");
scanf("%d",&ch2);
strcpy(doc[0].id, "Abhijeet");
strcpy(doc[1].id, "Viraj");
strcpy(doc[2].id, "Samrudhi");
strcpy(doc[3].id, "Sayli");
strcpy(doc[4].id, "Shravni");
break;
case 3:
19
// Reset all appointments
count[i] = 0;
break;
default:
int disease()
int ch;
do
20
printf("\n\t 2. Neurological problem");
scanf("%d",&ch);
return ch;
void cancelAppointment()
char name[20];
scanf("%s", name);
if (strcmp(current->name, name) == 0)
if (prev == NULL)
21
{
first = current->next;
else
prev->next = current->next;
free(current);
return;
prev = current;
current = current->next;
void viewInformation()
if (temp == NULL)
22
return;
printf("\nPatients Information:\n");
printf("\n");
temp = temp->next;
void appointment_done()
char name[20];
scanf("%s", name);
23
while (current != NULL)
if (strcmp(current->name, name) == 0)
if (prev == NULL)
first = current->next;
} else
prev->next = current->next;
free(current);
return;
prev = current;
current = current->next;
24
THANK U!!!!
25