Write an interactive program in C language to manage the Clinic Information with menu options like Patient’s details, Doctor’s details, Doctor’s and Patient’s visits, Laboratory details, Bills, Payments etc. using the file handling concepts. The application should be designed user-friendly.
#include<stdio.h>
#include<conio.h>
#include<string.h>
#define MAX 25
void inputDoctor(int);
void insertDoctor();
int searchDoctor(int);
void delDoctor();
void displayDoctor();
void inputPatient(int);
void insertPatient();
int searchPatient(int);
void delPatient();
void displayPatient();
void inputDocPatVisit(int);
void insertDocPatVisit();
int searchDocPatVisit(int);
void delDocPatVisit();
void displayDocPatVisit();
struct doctor
{
int docCode;
char name[20];
char address[100];
char splIn[30];
};
struct doctor doc[MAX];
struct patient
{
int patientCode;
char name[20];
char address[100];
char dis[30];
};
struct patient patient[MAX];
struct DocPatVisit
{
int docCode;
int patCode;
char DatOfVisit[10];
char Remark[100];
};
struct DocPatVisit DocPat[MAX];
int nDoc,recSizeDoc; /*Total number of elements in the list of Doctor and Recrd Siz */
int nPat,recSizePat; /*Total number of elements in the list of Patients and Recrd Siz */
int nDocPat,recSizeDocPat; /*Total number of elements in the list of Doctor Patients Visit and Recrd Siz */
FILE *fpDoc , *fpPat , *fpDocPat ;
void main()
{
int i=0,choice,pos,check,iptime=0;
int ldocCode,lpatientCode,lDocPatVisitCode;
int isRun1=1 ,isRun2=1;
fpDoc = fopen("DOC.dat","rb+");
if(fpDoc==NULL)
{
fpDoc = fopen("DOC.dat","wb+");
if(fpDoc == NULL)
{
puts("Can not open Source File");
getch();
exit(1);
}
}
recSizeDoc = sizeof(struct doctor);
////////////////////////////////////////////////////////////////////////
i=0;
rewind(fpDoc);
while(fread(&doc[i],recSizeDoc,1,fpDoc)==1)
{ i++; }
nDoc=i;
//////////////////////////////////
////////////////////////////////////////////////////////////////////////
fpPat = fopen("PAT.dat","rb+");
if(fpPat==NULL)
{
fpPat = fopen("PAT.dat","wb+");
if(fpPat == NULL)
{
puts("Can not open Source File");
getch();
exit(1);
}
}
recSizePat = sizeof(struct patient);
//////////////////////////////////
i=0;
rewind(fpPat);
while(fread(&patient[i],recSizePat,1,fpPat)==1)
{ i++; }
nPat=i;
//////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
fpDocPat = fopen("DOC_PAT.dat","rb+");
if(fpDocPat==NULL)
{
fpDocPat = fopen("DOC_PAT.dat","wb+");
if(fpDocPat == NULL)
{
puts("Can not open Source File");
getch();
exit(1);
}
}
recSizeDocPat = sizeof(struct DocPatVisit);
i=0;
rewind(fpDocPat);
while(fread(&DocPat[i],recSizeDocPat,1,fpDocPat)==1)
{ i++; }
nDocPat=i;
/////////////////////////////////////////////////////////////////////////////////////
while(isRun1)
{
printf("\n\n********************************************************************");
printf("\n Clinic Record Keeping System ");
printf("*******************************************************************************");
printf("\n\n1) Doctors List\n");
printf("\n2) Patients List\n");
printf("\n3) Doctor’s and Patient’s visits \n");
printf("\n4) Exit");
printf("\nEnter your choice : ");
scanf("%d",&choice);
isRun2=1;
///////////////////////////////////////////////////////////////////////////////////
switch(choice)
{
case 1:
while(isRun2)
{
printf("\n\n********************************************************************");
printf("\n DOCTORS LIST HANDLE ");
printf("*******************************************************************************");
printf("\n\n1.Input Record ( Over Write Old Records )\n");
printf("2.Insert Record\n");
printf("3.Search Record\n");
printf("4.Delete Record\n");
printf("5.Display Record\n");
printf("6.Save Record\n");
printf("7.Quit\n");
printf("\nEnter your choice : ");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\nHow Many Records You Want To STORE : ");
scanf("%d",&nDoc);
inputDoctor(nDoc);
break;
case 2:
insertDoctor();
break;
case 3:
printf("Enter the Doctor Code to be searched : ");
scanf("%d", &ldocCode);
pos = searchDoctor(ldocCode);
if(pos >= 1)
{
printf("\n\nDoctor Code \t: %d", doc[pos-1].docCode);
printf("\nName \t\t: %s", doc[pos-1].name);
printf("\nAddress \t: %s", doc[pos-1].address);
printf("\nSpecialized in \t: %s", doc[pos-1].splIn);
}
else
printf("Record not found ...\n");
break;
case 4:
delDoctor();
break;
case 5:
printf("\n\nDoctors Lists ...");
displayDoctor();
break;
case 6:
printf("\nSave is Started\n");
//fseek(fpDoc,0,SEEK_END);
rewind(fpDoc);
for(i = 0; i< nDoc ; i++)
{
fwrite(&doc[i],recSizeDoc,1,fpDoc);
}
printf("\nSave is Completed\n");
break;
case 7:
isRun2=0;
break;
default:
printf("Wrong choice\n");
} /*End of switch */
}/*End of while */
//////////////////////// end of doc
break ; // end of case 1 of outer switch
//////////////////////////////////////////// pat /////////////////////////
case 2:
while(isRun2)
{
printf("\n\n*************************************************************************");
printf("\n PATIENT LIST HANDLE ");
printf("*******************************************************************************");
printf("\n\n1.Input Record ( Over Write Old Records )\n");
printf("2.Insert Record\n");
printf("3.Search Record\n");
printf("4.Delete Record\n");
printf("5.Display
______ ______ ______ __________ __________ ________ _____ __________ __________ ________ _____.
_________ ______ _________ ________ ____ __________.
_________ __________ ______ ____ ________ ________ _____ ____ ________ _____.
________ _________ ______ ________ ________ _________ ___ ________ _________.
____ _____ ________ __________ _____ ______ _________.
________ __________ ____ _______ _________ ________ ________ _____ ________.
______ __________ ____ ___ ____ _______ ______ __________ ___ _____ ___.
____ _______ ___ _________ __________ ______.
____ _______ ____ ____ _____ ____ __________ _________.
__________ _________ _______ _________ _____ ____ ______ ____ _______ __________ __________ ___.
_______ ______ _____ _______ _______.
_____ ______ ______ __________ _______ _____ ___ __________ ___.
__________ __________ _______ __________ ___ ______ _______.
___ _________ _____ _______ ______ ____ _________ _____ ___ __________ ________ ______.
______ ____ ___ _________ _________ __________ _______ ______.
_________ __________ _______ __________ ________ ___ __________ ______.
__________ ____ ____ _________ _________ _______ ______ ___ _______ _________.
___ ____ _____ ____ ______ _________ __________ ___ ___ _____ ________.
_____ ____ ________ _____ _______ ____ __________ ____ ________ _____ ___.
_______ ____ ___ _______ ____ ________ _____ _____.
________ ________ ______ _______ _______ ____ ___ _____ _________ ____ ________ _____.
___ ________ _____ ___ _________ _________ _________ _____ ____ ____ ____.
_____ ________ _____ ___ _________ _______ ______ ________ ______.
___ _________ _________ _______ ________.
____ ________ ______ ___ _______ _______ ___ __________ _________.
_______ ________ ______ __________ _____ ___ _______ _______ _______ _______ ______.
___ ____ ___ _______ ____ ___ ______ _________ ____ ______ __________ ____.
______ _______ ___ ______ ___ _________.
__________ _______ _______ _______ ____ _________ __________ ___ __________ ____.
________ _________ _________ _________ ___ __________ _________ ______ _________ _____.
________ __________ _________ ________ _____ _______ ___ ________ ___ _________ _______.
___ _________ _______ ______ ________ ___ _______ _____ _____ __________ ________.
________ ____ ____ ________ ______ _______.
_____ ___ ________ _______ ___ ___ _____ ____.
______ _________ __________ _______ _________ _______ _________ _________ _________ __________ _____.
____ _____ ________ _________ _________ ___.
_________ ________ _______ ___ _______ _____ ____ ____ ____ ______.
______ ____ ___ ______ ____ ______ ________ ____ _____.
______ _________ ___ ________ _________ __________ _______ __________ ___.
______ ______ __________ ___ _________ ______ ________ ______ ___.
______ ________ ___ __________ ____ ________ ____ ___ _____.
________ ________ ____ _____ ______ __________ ____ ________ ______ _______ _____ ______.
__________ ________ ____ ____ ________ _____ ______ ________.
_____ _______ ________ ______ _____ _____ ___ ________ _________ _______.
___ ______ ________ ________ __________ _________ ___ _________ ____ __________ __________ ____.
____ _______ _____ ________ ____ _______ ________.
___ _________ __________ _____ _________ ___ __________.
________ _________ ____ ____ ______ __________ ________.
____ _____ _______ ___ __________ __________ ___.
________ ________ _________ ______ __________ _____ ____ ____ ____ _______ _____ _____.
_______ ___ __________ ________ ________ _______ __________ _______ ____ ____ ____ __________.
______ _____ __________ ______ _________ _____.
___ _____ _________ ________ _____ _______ ________ _____.
_____ ______ ________ ___ __________ __________.
______ _______ _____ ______ ________.
____ ________ ______ _____ _______ _________ _________ ______ _______ __________ ______ ________.
_________ ___ ______ __________ _________ __________ _________ ___ __________.
___ ________ ______ ________ _______ ___ ________ __________ _____ _________ ___.
________ __________ ____ _________ ________ ________ ______ _______.
_______ ________ ___ ______ ________ ____ _________.
________ _____ ____ _____ ______ _____ ____ ___ _________ _________ _____.
_________ _____ ____ ________ ______.
____ ___ ________ _________ ________ ___ _________ ___ _______ _______ ____.
___ ______ ___ ________ ____ ___ ________ _______ ______ ____ _______ __________.
_____ ________ ______ ____ _________ _____.
_______ ________ __________ _______ _______ _________ ________.
______ ______ _____ ____ ________ _________ ____ ______ _______ _______ ___ ______.
____ __________ ________ __________ _____ ________ ________ ______ ______ ______.
______ ______ ______ _____ ___ _________ ____.
____ __________ ____ _______ _____ __________.
________ __________ _____ ______ ________ ____ ________ __________ __________.
________ ________ _____ __________ ______.
____ ______ ___ __________ ____ __________ ______ ____.
_____ ________ ______ _________ _______ __________ ____.
______ ___ ____ ________ _________.
_________ ______ _________ _____ ______ ______ _____ ______.
____ ___ ______ _______ ____ _______ _____ ____ ______ _______ ____ ______.
__________ ___ _________ ________ _______ _______ ______ ______ __________.
_______ _______ _____ ____ _________ ______ _____ _______.
______ ________ __________ _____ _______ ______ __________ ____ ______.
_____ __________ ____ _______ _______ ___.
______ _________ _______ _______ ________ ______ _____.
___ ________ _________ __________ ________ ___ __________ ___ __________ _________.
____ ___ ____ ______ _________ _____ ____ _________.
______ _______ ______ _____ _____ __________ ___ ____ _______ _______ _______.
_______ _____ _____ ______ _________ __________.
________ ______ ________ _________ _______ ___ _______ ________.
___ _________ _________ _________ __________.
________ ________ ___ _____ _______ ______ _________ ___ ______.
_______ ________ ___ ________ _______ ___ _________ ____ _____ _______.
______ ___ __________ _____ ______.
_________ ____ _________ __________ ________ ___ ___ ________.
___ _________ ________ ______ _____ ___ ________ ______ _______ ________ ________ _____.
__________ _________ _______ _____ ______ ________ ___ ___ ____ ______.
_______ ________ _______ ________ ____ __________.
___ ____ _____ ______ _____ _________ ____ ___ ___ _________ ____ _________.
_________ ___ _________ ______ _____ ________ _____ ___ _____ ____ _________ ___.
_______ ________ ____ ___ ______ _________ __________ ____ ___ ____ ____ ____.
__________ __________ ___ _________ __________ ___ __________ ______.
________ _________ ______ _____ _______.
_______ ______ ____ ___ _______ _________ _______.
__________ _______ _______ _________ ___.
____ _______ ________ _______ ____ _________ ________ ____ ______ __________ _____.
______ _________ ___ _____ _____ ___ __________ _______ ___ ______.
________ ________ __________ _______ _______ ______ __________ ____ ____ __________ ______.
____ ____ _________ ________ _________ ____ ________ __________ __________ ____ ___.
_____ ______ ________ ___ _______ ___ __________ ______ ___ _____ _______.
_______ __________ _________ __________ __________ _______ ______ ______ ____ ____.
___ ___ ______ ______ ___ __________ ____ ____ _______ _________.
_______ ___ _________ ___ _______ __________ ______ ___ ___ ____.
__________ ___ ________ __________ ____ ___ __________ _______ _________ _____ ____.
___ ___ ___ ______ _____ ________.
__________ ___ ___ _______ ____ ____ __________.
__________ _________ __________ _____ ________.
___ _________ __________ ______ _________ _______ ____ __________.
______ __________ _________ _______ ______ _______ _________ _______.
_____ ___ __________ _________ _______.
_________ _____ ________ ___ _____ _____ ______.
______ ____ _________ __________ ___ _______ _______ ________ _____ ______.
________ __________ ________ _____ _______ ___ ______ ____ _________ _____.
________ __________ _________ _______ _________ ______ ____ _________ _____ ___.
_____ _________ ______ ____ ______ ____ ___ ________ __________ ___ ____.
_________ ________ ________ ___ ________ ____ ____.
__________ ______ __________ ____ _______ __________.
_____ _______ ___ _________ ___ ________ _____ ______ _______ ______ ______ _________.
___ ___ ___ _____ ____.
_______ _________ _____ ___ ____ ___ ____ __________ ____ ______.
________ _________ ________ ____ ___ _________ ___ ____ ____ __________.
________ _________ ______ _______ __________ _______ ________ _____ _________ ______ _____.
____ _______ _______ _____ ______ ______ _________.
____ ____ ______ ___ ________ ____ _________ _____.
_____ ____ _____ __________ ______ _______ _______ _________ _________ ___ ________ ______.
____ ______ ____ _______ ____ _________ ___ ____ ______ __________ ________ ____.
___ _______ ___ _____ _____ ___.
______ __________ ____ ______ ___ ________ ___.
___ __________ ____ ______ _________ __________.
______ ________ __________ __________ _________ ______ __________ _________.
__________ ______ ______ ______ ___ ____ ________.
_________ _____ ________ ______ _____ _______ _______ _____ ________ ___ ___ ________.
______ _____ ____ ________ ________ ___ ___ ____.
_________ __________ ________ ________ _____.
___ ____ ____ ______ ________ __________ ________ _________ ____ ______ ____.
_______ _____ ________ ___ __________ _______.
____ ____ _________ ________ ____ ___ __________ _________ _____.
__________ _____ ______ ______ ________ _________ _________ ___.
_________ _____ _________ ________ _______ ____ ____ _____.
____ __________ ________ ________ ___ _____ ______ ____ _________ _____ ________.
_____ ________ ___ ________ ___ ________.
_______ __________ ___ ___ _________ ___ _____ _______ ___ __________ ____.
____ _____ ______ _____ _______ _______ ________ __________ ________ __________.
___ __________ _____ _______ ____ ________ ___ ____ _________ ______.
_________ ___ ____ __________ ________ _______ ______ ________.
________ ___ _______ _______ ___ _______.
___ ________ _________ __________ _______.
_______ _______ ________ __________ __________ ________.
______ __________ _______ _________ _______ _______ ___.
___ ____ _________ __________ ______ _________ ___ ________ ______ __________ _____.
______ _____ ______ ___ __________ _______ ______.
_____ _________ _________ ________ _________ _____ ______ _________ ______ __________.
___ ____ ____ ________ _______.
__________ ___ ___ _____ __________ ____.
__________ ___ ____ ____ ____ _______.
__________ __________ _____ _________ ____ ______ __________.
____ __________ ____ ____ ___ ________ _________ ____ _________ _____.
____ ____ __________ ___ ___ _________ ________ ____.
______ _________ ___ ______ _____ ______.
______ _____ ___ _________ ___ _____ ______ ________ _______.
_______ ____ _________ ________ __________ _______ _______ ________ _____ _________ _______.
________ ____ __________ _________ ___ _________.
_________ ____ _____ ____ _______ ____ _________ _____ ____ ________.
_______ ___ ______ ______ __________.
____ _______ _______ _______ _______ _______.
_________ _____ ___ __________ _________ ______ ___ __________ _________ ____ ___.
________ ________ _________ ______ ___ _________ ______ ___ _________ ____ ______.
___ __________ __________ _________ ________ __________ ________ _____ _______ _______ ______.
_______ _______ ___ _____ _____ _________ _____ ____ ________ ____.
________ ________ _______ ____ ________ ____ __________.
_____ _________ ___ ___ _____ ________ ________ ______.
______ ___ ________ ____ ____ ____ _________ __________ _______ _____.
_______ ______ ____ _______ __________ ______ ________.
_________ _________ __________ _____ _________.
_______ ________ ____ ______ __________ _____ _________ __________ _____ _________ ______ __________.
____ ______ ____ __________ ____ ____ ______ ______ ____ _________.
___ ________ ______ _____ _________ ____ _______ ______.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
✓ Unlock up to 60% of the answer
✓ No payment required