0% found this document useful (0 votes)
145 views25 pages

CS Project Hospital Management

This document provides details about a C programming project to develop a mini hospital management system. The 12 member group aims to create a system that can record and manage patient information, including name lists, emergency/OPD records, and records by admission date. The system will allow adding new patient records, searching/editing records, listing records in different orders, and deleting records with bills. The document outlines the code structure and functions like adding, viewing, searching and deleting records in the system.

Uploaded by

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

CS Project Hospital Management

This document provides details about a C programming project to develop a mini hospital management system. The 12 member group aims to create a system that can record and manage patient information, including name lists, emergency/OPD records, and records by admission date. The system will allow adding new patient records, searching/editing records, listing records in different orders, and deleting records with bills. The document outlines the code structure and functions like adding, viewing, searching and deleting records in the system.

Uploaded by

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

CS PROJECT

CSE 1C

GROUP – 2
GROUP MEMBERS

NAME ROLL NO.


PAROMITA KHASKEL 127
MADHUMITA GHOSH 132
SOHAM DUTTA 134
ARIJIT PAUL 140
SAPTARSHI ROY 142
SANKET KUMAR LAHA 146
KSHITIJ JAISWAL 150
PRANAY MOHTA 153
RIMASHREE SARKAR 156
SHAYERI PANDA 157
JOYDIP SARKAR 179
SUBID BISWAR 190

OBJECTIVE
To prepare a MINI HOSPITAL MANAGMENT SYSTEM:

The system should be able to find out the detailed record of all patients as follows:

1.Name list of all patients.

2.Records of Emergency patients.

3.Recods of O.P.D patients.

4.Records of patients with admission dates.

5.Include a patient.

6.Delete a a patient (If so , generate a bill) .


INTRODUCTION

C is a procedural programming language. It was initially developed by Dennis Ritchie


as a system programming language to write operating system. The main features of
C language include low-level access to memory, simple set of keywords, and clean
style, these features make C language suitable for system programming like
operating system or compiler development.

We have used this C programming language to develop a “MINI HOSPITAL


MANAGEMENT SYSTEM. “

This system helps us with simple file operations such as,

1.Add new patient records:

User can add a new patient record choosing between O.P.D. service and
Emergency service. In O.P.D. service, name, address, age, sex, disease description
and a room number to be referred are available. The information to be given are
same in Emergency service.

2. Search or edit patient record:

User can search or edit record of the patient using his/her full name.

All the information corresponding to the respective patient are displayed. These
include the ones provided while adding a new patient record

3. List record of patients:

Users can list patient records by choosing any one of the four options listed below:

 Records of patients in alphabetical order


 Records of Emergency patients
 Records of O.P.D. patients
 Records of patients in a particular date
4. Delete patient records:

User can delete added record of any patient. Upon deleting the record the bill is
displayed which needs to be paid by the patient.

CODE

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

struct ad

char name[100];

char gender[100];

char disease[100];

char address[100];

char type[100];

char phone[100];

int age,room,d1,m1,y1;

} x[100];

int n,i,j=0,a=0,sum=0,g,flag,num,kk=1;

void read();

void add();

void viewall();

void search();

int leap(int year);

int td(int a,int b);


void del();

void write();

int main()

int c;

read();

while(c!=6)

printf("\n\n~~~~~~~~~~~~~~~~~~~~WELCOME TO MINI HOSPITAL


MANAGEMENT SYSTEM~~~~~~~~~~~~~~~~~~~~\n\n");

printf("\t\t\t\t1.Add Information\n");

printf("\t\t\t\t2.View Information\n");

printf("\t\t\t\t3.Search for patient\n");

printf("\t\t\t\t4.Delete Information\n");

printf("\t\t\t\t5.Exit\n\n");

printf("\t\t\t\tEnter your option: ");

scanf("%d",&c);

fflush(stdin);

if(c==1)

system("cls");

add();

else if(c==2)

system("cls");

viewall();
}

else if(c==3)

system("cls");

search();

else if(c==4)

system("cls");

del();

else if(c==5)

system("cls");

printf("\n\n~~~~~~~~~~~~~~~~~THANK YOU FOR USING OUR MINI


HOSPITAL MANAGEMENT SYSTEM~~~~~~~~~~~~~~~~~~");

printf("\n\n\n\t\t\t\tGROUP MEMBERS\n\n");

printf("\t\t\t\tPRANAY MOHTA (153)\n");

printf("\t\t\t\tSAPTARSHI ROY (142)\n");

printf("\t\t\t\tSUBID BISWAS (190)\n");

printf("\t\t\t\tSOHAM DUTTA (134)\n");

printf("\t\t\t\tSHAYERI PANDA (157)\n");

printf("\t\t\t\tARIJIT PAUL (140)\n");

printf("\t\t\t\tMADHUMITA GHOSH (132)\n");

printf("\t\t\t\tPAROMITA KHASKEL (127)\n");

printf("\t\t\t\tKSHITIJ JAISWAL (150)\n");

printf("\t\t\t\tSANKET KUMAR LAHA (146)\n");


printf("\t\t\t\tRIMASHREE SARKAR (156)\n");

printf("\t\t\t\tJOYDIP SARKAR (179)\n");

write();

return 0;

else

system("cls");

printf("\n\n\t\t\t\tInvalid input , try again by using valid inputs");

printf("\n\n");

void add()

printf("\n\n");

printf("\t\t\t\tData already present in the database: %d\n\n",num);

printf("\t\t\t\tHow many entry do you want to add: ");

scanf("%d",&n);

sum=n+num;

for(i=num; i<sum; i++)

printf("\n");

fflush(stdin);

printf("\t\t\t\tEnter patient's Name: ");

gets(x[i].name);

while(1)
{

fflush(stdin);

printf("\t\t\t\tEnter patient's gender(male/female): ");

gets(x[i].gender);

if(strcmp("male",x[i].gender)==0 || (strcmp("female",x[i].gender)==0))

break;

else

printf("\t\t\t\tNot a valid gender.Please re-enter with a valid gender\n");

while(1)

fflush(stdin);

printf("\t\t\t\tDate of admission(dd mm yyyy): ");

scanf("%d%d%d",&x[i].d1,&x[i].m1,&x[i].y1);

if(x[i].d1<1 || x[i].d1>31 || x[i].m1<1 || x[i].m1>12 || x[i].y1<1 || x[i].y1>2100)

printf("\t\t\t\tNot a valid date.Please re-enter a valid date\n");

else

break;

fflush(stdin);

printf("\t\t\t\tEnter disease: ");

gets(x[i].disease);

fflush(stdin);

printf("\t\t\t\tAddress: ");

gets(x[i].address);

while(1)

{
fflush(stdin);

printf("\t\t\t\tEnter o for OPD and e for Emergency: ");

gets(x[i].type);

if(strcmp("o",x[i].type)==0 || strcmp("e",x[i].type)==0)

break;

else

printf("\t\t\t\tNot a valid type as per given instruction.Please re-enter your


choice\n");

fflush(stdin);

printf("\t\t\t\tEnter the age: ");

scanf("%d",&x[i].age);

fflush(stdin);

printf("\t\t\t\tEnter room no.: ");

scanf("%d",&x[i].room);

fflush(stdin);

printf("\t\t\t\tEnter phone number.: ");

gets(x[i].phone);

fflush(stdin);

printf("\n");

num++;

void viewall()

for(i=0; i<num; i++)

{
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~DETAILS OF ENTRY
%d~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n",(i+1));

printf("\t\t\t\tSerial Number: %d\n",(i+1));

printf("\t\t\t\tName: ");

puts(x[i].name);

printf("\t\t\t\tGender: ");

puts(x[i].gender);

printf("\t\t\t\tType: ");

puts(x[i].type);

printf("\t\t\t\tDisease: ");

puts(x[i].disease);

printf("\t\t\t\tAddress: ");

puts(x[i].address);

printf("\t\t\t\tPhone no: ");

puts(x[i].phone);

printf("\t\t\t\tDate of admission: ");

printf("%d.%d.%d\n",x[i].d1,x[i].m1,x[i].y1);

printf("\t\t\t\tAge: %d\n",x[i].age);

printf("\t\t\t\tRoom no: %d\n",x[i].room);

printf("\n\n");

void search()

int ss,s,h,f;

char u[100];

printf("\n\n\n\t\t\t\tBy what do you want to search?\n");


printf("\t\t\t\t1.Serial no.\n");

printf("\t\t\t\t2.Name\n");

printf("\t\t\t\t3.Type of the patient(o/e)\n");

printf("\t\t\t\t4.Date of admission\n");

printf("\n\t\t\t\tENTER YOUR CHOICE: ");

scanf("%d",&h);

if(h==1)

printf("\t\t\t\tEnter Serial number of the patient: ");

scanf("%d",&ss);

s=ss-1;

if(s<num)

printf("\n");

printf("\t\t\t\tSerial Number: %d\n",ss);

printf("\t\t\t\tName: ");

puts(x[s].name);

printf("\t\t\t\tGender: ");

puts(x[s].gender);

printf("\t\t\t\tDisease: ");

puts(x[s].disease);

printf("\t\t\t\tAddress: ");

puts(x[s].address);

printf("\t\t\t\tType: ");

puts(x[s].type);

printf("\t\t\t\tPhone no: ");

puts(x[s].phone);
printf("\t\t\t\tDate of admission: ");

printf("%d.%d.%d\n",x[s].d1,x[s].m1,x[s].y1);

printf("\t\t\t\tRoom no: %d\n",x[s].room);

printf("\t\t\t\tAge: %d",x[s].age);

printf("\n\n");

else

printf("\n\t\t\t\t\tNot Found\n\n");

else if(h==2)

f=1;

fflush(stdin);

printf("\t\t\t\tEnter the name: ");

gets(u);

fflush(stdin);

for(g=0; g<num; g++)

if(strcmp(u,x[g].name)==0)

printf("\n");

printf("\t\t\t\tSerial Number: %d\n",(g+1));

printf("\t\t\t\tName: ");

puts(x[g].name);

printf("\t\t\t\tGender: ");

puts(x[g].gender);

printf("\t\t\t\tDisease: ");
puts(x[g].disease);

printf("\t\t\t\tAddress: ");

puts(x[g].address);

printf("\t\t\t\tType: ");

puts(x[g].type);

printf("\t\t\t\tPhone no: ");

puts(x[g].phone);

printf("\t\t\t\tDate of admission: ");

printf("%d.%d.%d\n",x[g].d1,x[g].m1,x[g].y1);

printf("\t\t\t\tRoom no: %d\n",x[g].room);

printf("\t\t\t\tAge: %d",x[g].age);

printf("\n\n");

f=0;

if(f==1)

printf("\n\t\t\t\t\tNot Found\n");

else if(h==3)

char t[100];;

f=1;

fflush(stdin);

printf("\t\t\t\tEnter type 'o' or 'e': ");

gets(t);

for(g=0; g<num; g++)

{
if(strcmp(t,x[g].type)==0)

printf("\n");

printf("\t\t\t\tSerial Number: %d\n",(g+1));

printf("\t\t\t\tName: ");

puts(x[g].name);

printf("\t\t\t\tGender: ");

puts(x[g].gender);

printf("\t\t\t\tDisease: ");

puts(x[g].disease);

printf("\t\t\t\tAddress: ");

puts(x[g].address);

printf("\t\t\t\tType: ");

puts(x[g].type);

printf("\t\t\t\tPhone no: ");

puts(x[g].phone);

printf("\t\t\t\tDate of admission: ");

printf("%d.%d.%d\n",x[g].d1,x[g].m1,x[g].y1);

printf("\t\t\t\tRoom no: %d\n",x[g].room);

printf("\t\t\t\tAge: %d",x[g].age);

printf("\n\n");

f=0;

if(f==1)

printf("\n\t\t\t\t\tNot Found\n\n");

}
else if(h==4)

int d,m,y;

f=1;

fflush(stdin);

printf("\t\t\t\tEnter date of admission(dd mm yyyy): ");

scanf("%d%d%d",&d,&m,&y);

for(g=0; g<num; g++)

if(x[g].d1==d&&x[g].m1==m&&x[g].y1==y)

printf("\n");

printf("\t\t\t\tSerial Number: %d\n",(g+1));

printf("\t\t\t\tName: ");

puts(x[g].name);

printf("\t\t\t\tGender: ");

puts(x[g].gender);

printf("\t\t\t\tDisease: ");

puts(x[g].disease);

printf("\t\t\t\tType: ");

puts(x[g].type);

printf("\t\t\t\tPhone no: ");

puts(x[g].phone);

printf("\t\t\t\tDate of admission: ");

printf("%d.%d.%d\n",x[g].d1,x[g].m1,x[g].y1);

printf("\t\t\t\tRoom no: %d\n",x[g].room);

printf("\t\t\t\tAge: %d",x[g].age);
printf("\n\n");

f=0;

if(f==1)

printf("\n\t\t\t\t\tNot Found\n\n");

else

printf("\n\n\t\t\t\tINVALID CHOICE TO SEARCH FOR DATA.\n\n");

void del()

int z,f,h,d,m,y,d2,m2,y2;

printf("\n\n\n\t\t\t\tEnter the serial number of the patient that you want to delete: ");

scanf("%d",&z);

f=z-1;

if(f<num)

printf("\n\n");

printf("\t\t\t\tDetails of discharged patient\n\n\n");

printf("\t\t\t\tName: ");

puts(x[f].name);

printf("\t\t\t\tGender: ");

puts(x[f].gender);

printf("\t\t\t\tAddress: ");

puts(x[f].address);
printf("\t\t\t\t\tDisease: ");

puts(x[f].disease);

printf("\t\t\t\tType: ");

puts(x[f].type);

printf("\t\t\t\tPhone no: ");

puts(x[f].phone);

printf("\t\t\t\tDate of admission: %d.%d.%d\n",x[f].d1,x[f].m1,x[f].y1);

printf("\t\t\t\tRoom no: %d\n",x[f].room);

printf("\t\t\t\tAge: %d\n\n",x[f].age);

if(strcmp("o",x[f].type)==0)

printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");

printf("\t\t\t\t\t\tBILL\n");

printf("\t\t\t\tREGISTRATION FEES----------------> 200.00\n");

printf("\t\t\t\tDOCTOR FEES----------------------> 800.00\n");

printf("\t\t\t\tNET AMOUNT PAYABLE--------------->1000.00\n");

else

while(1)

fflush(stdin);

printf("\n\n\t\t\t\tEnter the date of discharge(dd mm yyyy): ");

scanf("%d%d%d",&d2,&m2,&y2);

if(d2<1 || d2>31 || m2<1 || m2>12 || y2<1 || y2>2100)

printf("\t\t\t\tNot a valid date.Please re-enter a valid date\n");


else

break;

d=x[f].d1;m=x[f].m1;y=x[f].y1;

int t1=0,t2=0,t=0,i;

if(y==y2)

t1=td(m-1,y)+d;

t2=td(m2-1,y2)+d2;

t=t2-t1;

else

t1=td(m-1,y)+d;

printf("%d\n",t1);

t2=td(m2-1,y2)+d2;

if(leap(y)==0)

t1=366-t1;

else

t1=365-t1;

printf("%d\n",t1);

printf("%d\n",t2);

t=t1+t2;

for(i=y+1;i<=y2-1;i++)

{
t=t+365;

if(leap(i)==0)

t=t+1;

if(t==0)

t=1;

float med=6000.0*t,bed=5000.0*t,food=400.0*t,net=med+bed+food+800.0;

printf("\t\t\t\tDate of discharge: %d.%d.%d\n",d2,m2,y2);

printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");

printf("\t\t\t\t\t\tBILL\n");

printf("\t\t\t\tMEDICINE COST----------> %.2f \n",med);

printf("\t\t\t\tBED COST---------------> %.2f \n",bed);

printf("\t\t\t\tDOCTOR FEES------------> 800.00 \n");

printf("\t\t\t\tFOOD COST--------------> %.2f \n",food);

printf("\t\t\t\tNET AMOUNT PAYABLE-----> %.2f \n",net);

printf("\n\n");

strcpy(x[f].name,x[f+1].name);

strcpy(x[f].gender,x[f+1].gender);

strcpy(x[f].disease,x[f+1].disease);

strcpy(x[f].type,x[f+1].type);

strcpy(x[f].phone,x[f+1].phone);

x[f].d1=x[f+1].d1;

x[f].m1=x[f+1].m1;

x[f].y1=x[f+1].y1;
x[f].age=x[f+1].age;

x[f].room=x[f+1].room;

num=num-1;

else

printf("\n\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Invalid Serial
number~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");

void read()

FILE *fp = fopen("patient.txt","r");

if(fp == NULL)

fp = fopen("patient.txt","w");

fclose(fp);

num = fread(x, sizeof(struct ad),100, fp);

fclose(fp);

void write()

FILE *fp = fopen("patient.txt","w");

if(fp == NULL)

printf("Error");

exit(1);

}
fwrite(x, sizeof(struct ad),num, fp);

fclose(fp);

int leap(int year)

if (year % 4 == 0)

if (year % 100 == 0)

if (year % 400 == 0)

return 0;

else

return 1;

else

return 0;

else

return 1;

int td(int a,int b)

int t=0;

if(leap(b)==0)

t=1;

if(a==1)

t=31;
else if(a==2)

t=t+59;

else if(a==3)

t=t+90;

else if(a==4)

t=t+120;

else if(a==5)

t=t+151;

else if(a==6)

t=t+181;

else if(a==7)

t=t+212;

else if(a==8)

t=t+243;

else if(a==9)

t=t+273;

else if(a==10)

t=t+304;

else if(a==11)

t=t+334;

else if(a==12)

t=t+365;

return t;

}
OUTPUT

CONCLUSION
This system is developed using C Programming Language and different variables,
strings have been used for the development of it.

The system helps the user to manage data of patients admitted in the Hospital and
prepare a bill accordingly once their record is deleted from the system.

You might also like