Upload
abhishek-ur-well-wisher
View
226
Download
0
Embed Size (px)
Citation preview
8/2/2019 Patient Management System
1/86
///////////////////////////////////////////////////////////////////
// Header Files
////////////////////////////////////////////////////////////////////
#include
#include
#include#include
#include
#include#include
#include
#include
////////////////////////////////////////////////////////////////////////
// Global Declaration
///////////////////////////////////////////////////////////////////////
int num=5;
int k=1;char dept;
int cnt1=0;char ans1='y';
int ser_no=1;
unsigned int diff_date=0;
int count=0;
int count1=0;
char ck[900][3];char pai_ck[900][3];
int bed_found(char *bed_no);
////////////////////////////////////////////////////////////////////////////
// MENU Related Function
//////////////////////////////////////////////////////////////////////////
int x,y;
char *str1,*str2,*str3,*str4,*str5,*str6;
char ch;
int one();
int two();int three();
int four();
int five();
int six();
int cnt=1;
//////////////////////////////////////////////////
int one()
{
_setcursortype(_NOCURSOR);
textcolor(0);textbackground(7);
gotoxy(x,y);
cprintf("%s",str1);
textcolor(15);textbackground(0);
gotoxy(x,y+1);
1
8/2/2019 Patient Management System
2/86
cprintf("%s",str2);
gotoxy(x,y+2);
cprintf("%s",str3);
gotoxy(x,y+3);
cprintf("%s",str4);
gotoxy(x,y+4);
cprintf("%s",str5);
gotoxy(x,y+5);
cprintf("%s",str6);
gotoxy(57,19);
cprintf("1");
return 1;
}
///////////////////////////////////////////////////////////
int two(){
_setcursortype(_NOCURSOR);textbackground(0);
gotoxy(x,y);
cprintf("%s",str1);
textcolor(0);
textbackground(7);
gotoxy(x,y+1);
cprintf("%s",str2);
textcolor(15);
textbackground(0);
gotoxy(x,y+2);
cprintf("%s",str3);
gotoxy(x,y+3);
cprintf("%s",str4);
gotoxy(x,y+4);
cprintf("%s",str5);
gotoxy(x,y+5);cprintf("%s",str6);
gotoxy(57,19);
cprintf("2");
return 2;
}
////////////////////////////////////////////////////
int three()
2
8/2/2019 Patient Management System
3/86
{
_setcursortype(_NOCURSOR);
textcolor(15);
textbackground(0);
gotoxy(x,y);
cprintf("%s",str1);
gotoxy(x,y+1);
cprintf("%s",str2);
textcolor(0);
textbackground(7);
gotoxy(x,y+2);
cprintf("%s",str3);
textcolor(15);
textbackground(0);
gotoxy(x,y+3);
cprintf("%s",str4);
gotoxy(x,y+4);cprintf("%s",str5);
gotoxy(x,y+5);
cprintf("%s",str6);
gotoxy(57,19);
cprintf("3");
return 3;
}
/////////////////////////////////////////////////////////int four()
{
_setcursortype(_NOCURSOR);
textcolor(15);
textbackground(0);
gotoxy(x,y);
cprintf("%s",str1);
gotoxy(x,y+1);
cprintf("%s",str2);
gotoxy(x,y+2);cprintf("%s",str3);
textcolor(0);
textbackground(7);
gotoxy(x,y+3);
cprintf("%s",str4);
textcolor(15);
3
8/2/2019 Patient Management System
4/86
textbackground(0);
gotoxy(x,y+4);
cprintf("%s",str5);
gotoxy(x,y+5);
cprintf("%s",str6);
gotoxy(57,19);
cprintf("4");
return 4;
}/////////////////////////////////////////////
int five()
{
_setcursortype(_NOCURSOR);
textcolor(15);
textbackground(0);
gotoxy(x,y);cprintf("%s",str1);
gotoxy(x,y+1);
cprintf("%s",str2);
gotoxy(x,y+2);
cprintf("%s",str3);
gotoxy(x,y+3);
cprintf("%s",str4);
textcolor(0);
textbackground(7);
gotoxy(x,y+4);
cprintf("%s",str5);
textcolor(15);textbackground(0);
gotoxy(x,y+5);
cprintf("%s",str6);
gotoxy(57,19);
cprintf("5");
return 5;
}//////////////////////////////////////////////////
int six()
{
_setcursortype(_NOCURSOR);
textcolor(15);
textbackground(0);
4
8/2/2019 Patient Management System
5/86
gotoxy(57,19);
cprintf("6");
gotoxy(x,y);
cprintf("%s",str1);
gotoxy(x,y+1);cprintf("%s",str2);
gotoxy(x,y+2);
cprintf("%s",str3);
gotoxy(x,y+3);cprintf("%s",str4);
gotoxy(x,y+4);
cprintf("%s",str5);
textcolor(0);
textbackground(7);
gotoxy(x,y+5);cprintf("%s",str6);
textcolor(15);
textbackground(BLACK);
return 6;
}
//////////////////////////////////////////////char menu(int gx,int gy,char *gstr1,char *gstr2,char *gstr3,char *gstr4,char *gstr5,char *gstr6)
{
x=gx;int cnt=1;
y=gy;
str1=gstr1;
str2=gstr2;
str3=gstr3;str4=gstr4;
str5=gstr5;
str6=gstr6;
cnt=one();
top: ch=getch();
if(ch==0)
{
ch=getch();if(ch==72)
{if(cnt==1)
{
cnt=six();
}
else
if(cnt==2)
{
5
8/2/2019 Patient Management System
6/86
cnt=one();
}
else
if(cnt==3)
{cnt=two();
}else
if(cnt==4)
{
cnt=three();
}
elseif(cnt==5)
{
cnt=four();
}
else
if(cnt==6)
{
cnt=five();}
}else
if(ch==80)
{
if(cnt==1)
{
cnt=two();
}
elseif(cnt==2)
{
cnt=three();}
else
if(cnt==3)
{
cnt=four();}
else
if(cnt==4)
{
cnt=five();
}
else
if(cnt==5){
cnt=six();}
else
if(cnt==6)
{
cnt=one();
}
}
6
8/2/2019 Patient Management System
7/86
else
if(ch==68)
{
return '~';
}goto top;
}else
if(ch=='1')
{
cnt=one();
}
elseif(ch=='2')
{
cnt=two();
}
else
if(ch=='3')
{
cnt=three();}
elseif(ch=='4')
{
cnt=four();
}
else
if(ch=='5')
{
cnt=five();}
else
if(ch=='6'){
cnt=six();
}
else
if(ch==13){
if(cnt==1)
{
return '1';
}
else
if(cnt==2)
{return '2';
}else
if(cnt==3)
{
return '3';
}
else
if(cnt==4)
7
8/2/2019 Patient Management System
8/86
{
return '4';
}
else
if(cnt==5){
return '5';}
else
if(cnt==6)
{
return '6';
}}
goto top;
}
///////////////////////////////////////////////////////////////////////
char *str51,*str52,*str53,*str54,*str55;
int one5();
int two5();int three5();
int four5();int five5();
int one5()
{
_setcursortype(_NOCURSOR);
textcolor(0);
textbackground(7);
gotoxy(x,y);cprintf("%s",str51);
textcolor(15);textbackground(0);
gotoxy(x,y+1);
cprintf("%s",str52);
gotoxy(x,y+2);cprintf("%s",str53);
gotoxy(x,y+3);
cprintf("%s",str54);
gotoxy(x,y+4);
cprintf("%s",str55);
gotoxy(57,19);
cprintf("1");
return 1;
}
///////////////////////////////////////////////////////////
int two5()
{
_setcursortype(_NOCURSOR);
8
8/2/2019 Patient Management System
9/86
textbackground(0);
gotoxy(x,y);
cprintf("%s",str51);
textcolor(0);
textbackground(7);gotoxy(x,y+1);
cprintf("%s",str52);
textcolor(15);
textbackground(0);gotoxy(x,y+2);
cprintf("%s",str53);
gotoxy(x,y+3);
cprintf("%s",str54);
gotoxy(x,y+4);
cprintf("%s",str55);
gotoxy(57,19);cprintf("2");
return 2;
}
////////////////////////////////////////////////////
int three5()
{
_setcursortype(_NOCURSOR);textcolor(15);
textbackground(0);
gotoxy(x,y);cprintf("%s",str51);
gotoxy(x,y+1);
cprintf("%s",str52);
textcolor(0);
textbackground(7);
gotoxy(x,y+2);
cprintf("%s",str53);
textcolor(15);
textbackground(0);gotoxy(x,y+3);
cprintf("%s",str54);
gotoxy(x,y+4);
cprintf("%s",str55);
gotoxy(57,19);
cprintf("3");
9
8/2/2019 Patient Management System
10/86
return 3;
}
/////////////////////////////////////////////////////////
int four5()
{_setcursortype(_NOCURSOR);
textcolor(15);textbackground(0);
gotoxy(x,y);
cprintf("%s",str51);
gotoxy(x,y+1);
cprintf("%s",str52);
gotoxy(x,y+2);
cprintf("%s",str53);
textcolor(0);
textbackground(7);
gotoxy(x,y+3);cprintf("%s",str54);
textcolor(15);
textbackground(0);
gotoxy(x,y+4);
cprintf("%s",str55);
gotoxy(57,19);
cprintf("4");
return 4;
}/////////////////////////////////////////////
int five5()
{
_setcursortype(_NOCURSOR);
textcolor(15);textbackground(0);
gotoxy(x,y);
cprintf("%s",str51);
gotoxy(x,y+1);
cprintf("%s",str52);
gotoxy(x,y+2);cprintf("%s",str53);
gotoxy(x,y+3);
cprintf("%s",str54);
textcolor(0);
textbackground(7);
gotoxy(x,y+4);
10
8/2/2019 Patient Management System
11/86
cprintf("%s",str55);
textcolor(15);
textbackground(0);
gotoxy(57,19);
cprintf("5");
return 5;
}
//////////////////////////////////////////////////
char menu(int gx,int gy,char *gstr51,char *gstr52,char *gstr53,char *gstr54,char *gstr55)
{x=gx;
int cnt=1;
y=gy;
str51=gstr51;
str52=gstr52;
str53=gstr53;
str54=gstr54;
str55=gstr55;cnt=one5();
top: ch=getch();if(ch==0)
{
ch=getch();
if(ch==72)
{
if(cnt==1)
cnt=five5();
elseif(cnt==2)
cnt=one5();
elseif(cnt==3)
cnt=two5();
else
if(cnt==4)
cnt=three5();else
if(cnt==5)
cnt=four5();
}
else
if(ch==80)
{
if(cnt==1)cnt=two5();
elseif(cnt==2)
cnt=three5();
else
if(cnt==3)
cnt=four5();
else
if(cnt==4)
11
8/2/2019 Patient Management System
12/86
cnt=five5();
else
if(cnt==5)
cnt=one5();
}else
if(ch==68)return '~';
goto top;
}
else
if(ch=='1')
cnt=one5();else
if(ch=='2')
cnt=two5();
else
if(ch=='3')
cnt=three5();
else
if(ch=='4')cnt=four5();
elseif(ch=='5')
cnt=five5();
else
if(ch==13)
{
if(cnt==1)
return '1';
elseif(cnt==2)
return '2';
elseif(cnt==3)
return '3';
else
if(cnt==4)
return '4';else
if(cnt==5)
return '5';
}
goto top;
}
//////////////////////////////////////////////////////////////////////
// Date Related Function///////////////////////////////////////////////////////////////////////
int check_leap(int yyyy);
int greater_date(int dd,int mm,int yyyy,int dd1,int mm1,int yyyy1);
int check_day(int dd,int mm,int yyyy);
int check_date(int x,int y,int &dd,int &mm,int &yyyy);
int show_date(int x,int y,int dd,int mm, int yyyy);
int get_bedno(int x,int y,char bedno[3]);
12
8/2/2019 Patient Management System
13/86
int show_bedno(int x,int y,char bedno[3]);
int date_diff(int dd,int mm,int yyyy,int dd1,int mm1,int yyyy1);
int get_char(int x,int y,char *stat,char *str,int length);
int check_date(int x,int y,int &dd,int &mm,int &yyyy)
{ int count,jelly=0;
char ch;
int d1=0,d2=0;
int m1=0,m2=0;
int y1=0,y2=0,y3=0,y4=0;
redate:gotoxy(x,y);
cprintf("dd\\mm");
gotoxy(x+5,y);
cprintf("\\yyyy");
date1:
jelly=0;
gotoxy(x,y);
cprintf("d");gotoxy(x,y);
ch=getch();if(ch==0)
{
ch=getch();
if(ch==15)
return 5;
}
else
if(ch==13){
jelly=1;
}if(jelly==1)
{
jelly=0;
return 13;
}else
if (isdigit((int)ch))
{
{
int digit;
if(ch==48)
{
digit=0;}
elseif(ch==49)
{
digit=1;
}
else
if (ch==50)
{
13
8/2/2019 Patient Management System
14/86
digit=2;
}
else
if(ch==51)
{digit=3;
}else
if(ch==52)
{
digit=4;
}
elseif(ch==53)
{
digit=5;
}
else
if(ch==54)
{
digit=6;}
elseif(ch==55)
{
digit=7;
}
else
if(ch==56)
{
digit=8;}
else
if(ch==57){
digit=9;
}
d1= digit;
}gotoxy(x,y);
cprintf("%d",d1);
goto date2;
}
else
{
if(ch==8){
goto date1;//date}
if(ch==27)
{
return 99;
}
goto date1;
}
14
8/2/2019 Patient Management System
15/86
date2:
gotoxy(x+1,y);
cprintf("d");
gotoxy(x+1,y);ch=getch();
if(ch==0){
ch=getch();
if(ch==15)
return 5;
}
elseif (isdigit((int)ch))
{
{
int digit;
if(ch==48)
{
digit=0;
}else
if(ch==49){
digit=1;
}
else
if (ch==50)
{
digit=2;
}else
if(ch==51)
{digit=3;
}
else
if(ch==52)
{digit=4;
}
else
if(ch==53)
{
digit=5;
}
elseif(ch==54)
{digit=6;
}
else
if(ch==55)
{
digit=7;
}
15
8/2/2019 Patient Management System
16/86
else
if(ch==56)
{
digit=8;
}else
if(ch==57){
digit=9;
}
d2= digit;
}
gotoxy(x+1,y);
cprintf("%d",d2);
goto month1;
}
else
{
if(ch==8)
{goto date1;//date
}else
if(ch==27)
{
return 99;
}
goto date2;
}
month1:
gotoxy(x+3,y);
cprintf("m");gotoxy(x+3,y);
ch=getch();
if(ch==0)
{
ch=getch();if(ch==15)
return 5;
}
else
if (isdigit((int)ch))
{
{
int digit;if(ch==48)
{digit=0;
}
else
if(ch==49)
{
digit=1;
}
16
8/2/2019 Patient Management System
17/86
else
if (ch==50)
{
digit=2;
}else
if(ch==51){
digit=3;
}
else
if(ch==52)
{digit=4;
}
else
if(ch==53)
{
digit=5;
}
elseif(ch==54)
{digit=6;
}
else
if(ch==55)
{
digit=7;
}
elseif(ch==56)
{
digit=8;}
else
if(ch==57)
{
digit=9;}
m1= digit;
}
gotoxy(x+3,y);
cprintf("%d",m1);
goto month2;
}else
{if(ch==8)
{
goto date2;//date
}
else
if(ch==27)
{
17
8/2/2019 Patient Management System
18/86
return 99;
}
goto month1;
}
month2:
gotoxy(x+4,y);cprintf("m");
gotoxy(x+4,y);
ch=getch();
if(ch==0)
{
ch=getch();if(ch==15)
return 5;
}
else
if (isdigit((int)ch))
{
{
int digit;if(ch==48)
{digit=0;
}
else
if(ch==49)
{
digit=1;
}
elseif (ch==50)
{
digit=2;}
else
if(ch==51)
{
digit=3;}
else
if(ch==52)
{
digit=4;
}
else
if(ch==53){
digit=5;}
else
if(ch==54)
{
digit=6;
}
else
18
8/2/2019 Patient Management System
19/86
if(ch==55)
{
digit=7;
}
elseif(ch==56)
{ digit=8;
}
else
if(ch==57)
{
digit=9;}
m2= digit;
}
gotoxy(x+4,y);
cprintf("%d",m2);
goto year1;
}
else{
if(ch==8){
goto month1;//date
}
else
if(ch==27)
{
return 99;
}goto month2;
}
year1:gotoxy(x+6,y);
cprintf("y");
gotoxy(x+6,y);
ch=getch();
if(ch==0){
ch=getch();
if(ch==15)
return 5;
}
else
if (isdigit((int)ch))
{{
int digit;if(ch==48)
{
digit=0;
}
else
if(ch==49)
{
19
8/2/2019 Patient Management System
20/86
digit=1;
}
else
if (ch==50)
{digit=2;
}else
if(ch==51)
{
digit=3;
}
elseif(ch==52)
{
digit=4;
}
else
if(ch==53)
{
digit=5;}
elseif(ch==54)
{
digit=6;
}
else
if(ch==55)
{
digit=7;}
else
if(ch==56){
digit=8;
}
else
if(ch==57){
digit=9;
}
y1= digit;
}
gotoxy(x+6,y);
cprintf("%d",y1);
goto year2;}
else{
if(ch==8)
{
goto month2;//date
}
else
if(ch==27)
20
8/2/2019 Patient Management System
21/86
{
return 99;
}
goto year1;
}year2:
gotoxy(x+7,y);cprintf("y");
gotoxy(x+7,y);
ch=getch();
if(ch==0)
{
ch=getch();if(ch==15)
return 5;
}
else
if (isdigit((int)ch))
{
{
int digit;if(ch==48)
{digit=0;
}
else
if(ch==49)
{
digit=1;
}
elseif (ch==50)
{
digit=2;}
else
if(ch==51)
{
digit=3;}
else
if(ch==52)
{
digit=4;
}
else
if(ch==53){
digit=5;}
else
if(ch==54)
{
digit=6;
}
else
21
8/2/2019 Patient Management System
22/86
if(ch==55)
{
digit=7;
}
elseif(ch==56)
{ digit=8;
}
else
if(ch==57)
{
digit=9;}
y2= digit;
}
gotoxy(x+7,y);
cprintf("%d",y2);
goto year3;
}
else{
if(ch==8){
goto year1;//date
}
else
if(ch==27)
{
return 99;
}goto year2;
}
year3:gotoxy(x+8,y);
cprintf("y");
gotoxy(x+8,y);
ch=getch();
if(ch==0){
ch=getch();
if(ch==15)
return 5;
}
else
if (isdigit((int)ch))
{{
int digit;if(ch==48)
{
digit=0;
}
else
if(ch==49)
{
22
8/2/2019 Patient Management System
23/86
digit=1;
}
else
if (ch==50)
{digit=2;
}else
if(ch==51)
{
digit=3;
}
elseif(ch==52)
{
digit=4;
}
else
if(ch==53)
{
digit=5;}
elseif(ch==54)
{
digit=6;
}
else
if(ch==55)
{
digit=7;}
else
if(ch==56){
digit=8;
}
else
if(ch==57){
digit=9;
}
y3= digit;
}
gotoxy(x+8,y);
cprintf("%d",y3);
goto year4;}
else{
if(ch==8)
{
goto year2;//date
}
else
if(ch==27)
23
8/2/2019 Patient Management System
24/86
{
return 99;
}
goto year3;
}year4:
gotoxy(x+9,y);cprintf("y");
gotoxy(x+9,y);
ch=getch();
if(ch==0)
{
ch=getch();if(ch==15)
return 5;
}
else
if (isdigit((int)ch))
{
{
int digit;if(ch==48)
{digit=0;
}
else
if(ch==49)
{
digit=1;
}
elseif (ch==50)
{
digit=2;}
else
if(ch==51)
{
digit=3;}
else
if(ch==52)
{
digit=4;
}
else
if(ch==53){
digit=5;}
else
if(ch==54)
{
digit=6;
}
else
24
8/2/2019 Patient Management System
25/86
if(ch==55)
{
digit=7;
}
elseif(ch==56)
{ digit=8;
}
else
if(ch==57)
{
digit=9;}
y4= digit;
}
gotoxy(x+9,y);
cprintf("%d",y4);
}
else
{if(ch==8)
{goto year3;//date
}
else
if(ch==27)
{
return 99;
}
goto date1;}
int dd1,mm1,yyyy1;
///////////////////////{
dd1=d1*10;
dd1=dd1+d2;
}
////////////////////{
mm1=m1*10;
mm1=mm1+m2;
}
/////////////////////
{
yyyy1=y1*1000;
yyyy1=yyyy1+(y2*100);yyyy1=yyyy1+(y3*10);
yyyy1=yyyy1+y4;}
if(check_day(dd1,mm1,yyyy1))
{
return 1;
}
dd=dd1;
mm=mm1;
25
8/2/2019 Patient Management System
26/86
yyyy=yyyy1;
return 0;
//////////////////////////////////////////////////////////
// END OF THE PROGRAM
//////////////////////////////////////////////////////////}
///////////////////////////////////////////////////
int check_day(int dd,int mm,int yyyy)
{
int l=0,ll=0,l4,l400;l=(yyyy%100);
l4=yyyy%4;
l400=yyyy%400;
if(l==0)
{
if( l400==0 && l4==0)
{
ll=0;}
else{
ll=1;
}
}
else
if(l4==0)
{
ll=0;}
else
{ll=1;
}
if (mm >12 || mm==0)
{
return 1;}
else
if (mm==1||mm==3||mm==5||mm==7||mm==8||mm==10||mm==12)
{
if(dd>31||dd==0)
{
return 1;
}}
elseif(mm==4||mm==6||mm==9||mm==11)
{
if(dd>30||dd==0)
{
return 1;
}
}
26
8/2/2019 Patient Management System
27/86
else
if(mm==2)
{
if(ll==0)
{if(dd>29||dd==0)
{ return 1;
}
}
else
if(ll!=0)
{if(dd>28||dd==0)
{
return 1;
}
}
}
return 0;
}
//////////////////////////////////////////////////////////////////int show_date(int x,int y,int dd1,int mm1,int yyyy1)
{
gotoxy(x,y);
if (dd1==0)
{
cprintf("--/%d/%d",mm1,yyyy1);
}
if(mm1==0){
cprintf("%d/--/%d",dd1,yyyy1);
}if(yyyy1==0)
{
cprintf("%d/%d/----",dd1,mm1);
}
if(dd1!=0&&mm1!=0&&yyyy1!=0){
cprintf("%d/%d/%d",dd1,mm1,yyyy1);
}
return 0;
}
////////////////////////////////////////////////////////////////////////////
#include
////////////////////////////////////////////////////////////////////////////int get_bedno(int x,int y,char bedno[3])
{char c,p;
label1:
gotoxy(x,y);
textbackground(9);
cprintf(" \\ ");
gotoxy(x,y);
27
8/2/2019 Patient Management System
28/86
c=getch();
if((((int)c)>=65)&&((int)c=97)&&((int)c47)&&((int)c
8/2/2019 Patient Management System
29/86
if(c==8)
{
goto label1;
}
elseif(c==0)
{ c=getch();
if(c==68)
return 68;
}
else
{goto label2;
}
label3:
gotoxy(x+3,y);
cprintf(" ");
c=getch();
if((((int)c)>47)&&((int)c
8/2/2019 Patient Management System
30/86
else
if(c==8)
goto label3;
else
if(c==0){
c=getch();if(c==68)
return 68;
}
else
if(c==27)
return 99;else
goto hhh;
return 0;
}
////////////////////////////////////////////////////////////////////////////
int show_bedno(int x,int y,char bedno[2])
{
gotoxy(x,y);cprintf("%c\\%c%c",bedno[0],bedno[1],bedno[2]);
return 0;}
//////////////////////////////////////////////////////////////
int check_leap(int yyyy)
{
int l=0,ll=0,l4,l400;
l=(yyyy%100);
l4=yyyy%4;l400=yyyy%400;
if(l==0)
{if( l400==0 && l4==0)
{
ll=0;
}
else{
ll=1;
}
}
else
if(l4==0)
{
ll=0;}
else{
ll=1;
}
return ll;
}
///////////////////////////////////////////////////////////////////////////
30
8/2/2019 Patient Management System
31/86
int date_diff(int dd,int mm,int yyyy,int dd1,int mm1,int yyyy1)
{
int r1,cal;
{r1=check_day(dd,mm,yyyy);
if(r1!=0)return -100;
r1=check_day(dd1,mm1,yyyy1);
if(r1!=0)
return -100;
}//validity of dateint _dd,_mm,_yyyy,diff=0,l;
if(yyyy1
8/2/2019 Patient Management System
32/86
cal=0;
cal=30-dd;
diff=diff+cal;
mm=mm+1;
}else
if(mm==2){
l=check_leap(yyyy);
if(l==0)
{
cal=0;
cal=29-dd;diff=diff+cal;
mm=mm+1;
}
else
{
cal=0;
cal=28-dd;
diff=diff+cal;mm=mm+1;
}}
while(mm1>mm)
{
if((mm1==1)||(mm1==3)||(mm1==5)||(mm1==7)||(mm1==8)||
(mm1==10)||(mm1==12))
{
diff=diff+31;
mm1=mm1-1;}
else
if((mm1==4)||(mm1==6)||(mm1==9)||(mm1==11)){
diff=diff+30;
mm1=mm1-1;
}
elseif(mm1==2)
{
l=check_leap(yyyy1);
if (l==0)
{
diff=diff+29;
--mm1;
}else
{diff=diff+28;
--mm1;
}
}
}
return diff;
}//close of else month(mm1>mm)
32
8/2/2019 Patient Management System
33/86
}///////end of yyyy1=yyyy
else
{
diff=0;diff=dd1;
if(mm1==1){
mm1=12;
yyyy1=yyyy1-1;
dd1=31;
if (yyyy1==yyyy)
goto home;
}
else
{
mm1=mm1-1;
}
//dd1=0;
while(yyyy1>yyyy){
while(mm1>0){
if((mm1==1)||(mm1==3)||(mm1==5)||(mm1==7)||(mm1==8)||
(mm1==10)||(mm1==12))
{
diff=diff+31;
mm1=mm1-1;
}
elseif((mm1==4)||(mm1==6)||(mm1==9)||(mm1==11))
{
diff=diff+30;mm1=mm1-1;
}
else
if(mm1==2)
{l=check_leap(yyyy1);
if (l==0)
{
diff=diff+29;
--mm1;
}
else
{diff=diff+28;
--mm1;}
}
}
--yyyy1;
mm1=12;
}
if((mm==1)||(mm==3)||(mm==5)||(mm==7)||(mm==8)||(mm==10)||(mm==12))
33
8/2/2019 Patient Management System
34/86
{
cal=0;
cal=31-dd;
diff=diff+cal;
mm=mm+1;}
elseif((mm==4)||(mm==6)||(mm==9)||(mm==11))
{
cal=0;
cal=30-dd;
diff=diff+cal;
mm=mm+1;}
else
if(mm==2)
{
l=check_leap(yyyy);
if(l==0)
{
cal=0;cal=29-dd;
diff=diff+cal;mm=mm+1;
}
else
{
cal=0;
cal=28-dd;
diff=diff+cal;
mm=mm+1;}
}
while(mm
8/2/2019 Patient Management System
35/86
{
diff=diff+28;
mm=mm+1;
}
}}
return diff;
}
}
///////////////////////////////////////////////////////////////////////////
int greater_date(int dd,int mm,int yyyy,int dd1,int mm1,int yyyy1){
int res=date_diff(dd,mm,yyyy,dd1,mm1,yyyy1);
if((res!=-1)&&(res!=-100))
{
return 0;
}
else{
return 1;}
}
/////////////////////////////////////////////////////////////////////////
int get_char(int x,int y,char *arr)
{
_setcursortype(_SOLIDCURSOR);
char ch;// int count=0;
unsigned int i=0;
while(ch!=13){
gotoxy(x+i,y);
ch=getch();
if((ch>=65&&ch96 && ch
8/2/2019 Patient Management System
36/86
if(i==0)
i=0;
else
{
arr[i]='\0';i=i-1;
arr[i]='\0';gotoxy(x+i,y);
cprintf(" ");
}
}
else
if(ch==32){
arr[i]=' ';
gotoxy(x+i,y);
cprintf(" ");
i=i+1;
}
else
if(ch=='.'){
arr[i]=ch;gotoxy(x+i,y);
cprintf(".");
i=i+1;
}
else
if(ch==0)
{
ch=getch();if(ch==15)
{
_setcursortype(_NORMALCURSOR);return 5;
}
else
if(ch==68)
{return 68;
}
}
}
arr[i]='\0';
textbackground(BLACK);
int len=strlen(arr);
if(len==0){
_setcursortype(_NORMALCURSOR);return 1000;
}
else
{
_setcursortype(_NORMALCURSOR);
return 0;
}
36
8/2/2019 Patient Management System
37/86
}
//--------------------------------------------------------------------
int get_char_pass(int x,int y,char *arr)
{
char ch;int col=1;
// int count=0;unsigned int i=0;
while(ch!=13)
{
gotoxy(x+i,y);
ch=getch();
if((ch>=65&&ch96 && ch
8/2/2019 Patient Management System
38/86
textbackground(BLUE);
while(ch!=13)
{
gotoxy(x+i,y);
ch=getch();if(ch==48)
{ cc[i]='0';
gotoxy(x+i,y);
textbackground(BLUE);
cprintf("%c",ch);
i=i+1;
}else
if(ch==49)
{
cc[i]='1';
gotoxy(x+i,y);
cprintf("%c",ch);
i=i+1;
}else
if(ch==50){
cc[i]='2';
gotoxy(x+i,y);
cprintf("%c",ch);
i=i+1;
}
else
if(ch==51){
cc[i]='3';
gotoxy(x+i,y);cprintf("%c",ch);
i=i+1;
}
else
if(ch==52){
cc[i]='4';
gotoxy(x+i,y);
cprintf("%c",ch);
i=i+1;
}
else
if(ch==53){
cc[i]='5';gotoxy(x+i,y);
cprintf("%c",ch);
i=i+1;
}
else
if(ch==54)
{
38
8/2/2019 Patient Management System
39/86
cc[i]='6';
gotoxy(x+i,y);
cprintf("%c",ch);
i=i+1;
}else
if(ch==55){
cc[i]='7';
gotoxy(x+i,y);
cprintf("%c",ch);
i=i+1;
}else
if(ch==56)
{
cc[i]='8';
gotoxy(x+i,y);
cprintf("%c",ch);
i=i+1;
}else
if(ch==57){
cc[i]='9';
gotoxy(x+i,y);
cprintf("%c",ch);
i=i+1;
}
else
if(ch=='.'){
cc[i]='.';
gotoxy(x+i,y);cprintf("%c",ch);
i=i+1;
}
else
if(ch==8){
if(i==0)
{
i=0;
}
else
{
cc[i]='\0';i=i-1;
cc[i]='\0';gotoxy(x+i,y);
cprintf(" ");
}
}
else
if(ch==27)
{
39
8/2/2019 Patient Management System
40/86
return 99;
}
else
if(ch==0)
{ch=getch();
if(ch==15)return 5;
else
if(ch==68)
return 68;
}
if(i>=7)
{
break;
}
}
var=atof(cc);
if(var==0)
{var=0;
return 1000;}
textbackground(BLACK);
return 1;
}
/////////////////////-----------000000-----------------/////////////////////
void showwin(int left,int top,int right,int bottom,int tx_cl,char *str,int str_cl)
{
for(int i=top;i
8/2/2019 Patient Management System
41/86
cprintf("%c",r);
}
for(i=top+1;i
8/2/2019 Patient Management System
42/86
gotoxy(left-1,bottom);
cprintf("%c",lbc);
gotoxy(right+1,bottom);
cprintf("%c",rbc);
textcolor(WHITE);}
void logo()
{
textmode(BW80);
_setcursortype(_NOCURSOR);
char log=230+29;
showwin(75,1,77,3,12);gotoxy(76,2);
textcolor(10);
cprintf("%c",log);
textcolor(WHITE);
}
void quit()
{
clrscr();_setcursortype(_NOCURSOR);
showwin(26,10,54,12,12,"THANKING YOU",10);gotoxy(32,11);
textcolor(YELLOW);
cprintf("SHUTTING DATABASE");
delay(500);
gotoxy(50,11);
textcolor(13);
cprintf(".");
delay(800);textcolor(14);
gotoxy(51,11);
cprintf(".");delay(700);
textcolor(9);
gotoxy(52,11);
cprintf(".");
delay(600);showwin(26,10,54,12,12,"THANKING YOU",10);
gotoxy(32,11);
textcolor(13);
cprintf("DATABASE SHUTDOWN");
delay(1500);
gotoxy(32,11);
cprintf(" ");
gotoxy(36,11);textcolor(YELLOW);
cprintf(" GOOD BYE ");delay(1500);
_setcursortype(_NORMALCURSOR);
textbackground(0);
textcolor(15);
clrscr();
textmode(BW80);
exit(0);
42
8/2/2019 Patient Management System
43/86
}
void about_box()
{
textbackground(0);
clrscr();
showwin(15,5,65,22,12,"ABOUT BOX",10);for(int sr=6;sr
8/2/2019 Patient Management System
44/86
char p_arr[5];
logo();
showwin(20,10,60,14,12,"PASSWORD",10);
_setcursortype(_NORMALCURSOR);
gotoxy(25,12);cprintf("ENTER PASSWORD :");
get_char_pass(41,12,p_arr);flushall();
if(p_arr[0]=='n'&&p_arr[1]=='i'&&p_arr[2]=='c'&&p_arr[3]=='e')
{
gotoxy(25,12);
cout
8/2/2019 Patient Management System
45/86
void error(int i,char *str)
{
_setcursortype(_NOCURSOR);
for(auto int gf=3;gf
8/2/2019 Patient Management System
46/86
else
{
showwin(2,22,79,24,14,"MESSAGE",13);
for(gf=3;gf
8/2/2019 Patient Management System
47/86
{
showwin(5,2,75,24,12,"PATIENT RECORD MAINTENANCE",10);
gotoxy(5,4);
cout
8/2/2019 Patient Management System
48/86
textbackground(BLACK);
gotoxy(10,7);
cout
8/2/2019 Patient Management System
49/86
clrscr();
about_box();
return 99;
}
zed1: error(1,"ONLY CHARACTERS ALLOWED");
textbackground(BLUE);gotoxy(45,11);
cprintf(" ");
hill=get_char(45,11,head_dept);
flushall();
if(hill==99)
return 99;
else
if(hill==11)
{
error(0,"USER SHOULD ENTER SOME VALUES");
goto zed1;
}
elseif(hill==5)
goto zed;else
if(hill==68)
{
clrscr();
about_box();
return 99;
}
zed2: error(1,"MAXIMUM FIVE DIGITS ALLOWED");
textbackground(BLUE);
gotoxy(45,13);cprintf(" ");
hill=get_int(45,13,charge_day);
flushall();
if(hill==99)
{return 99;
}
else
if(charge_day==0)
{
error(0,"CHARGE PER DAY CANNOT BE '0'");
goto zed2;
}else
if(hill==5)goto zed1;
else
if(hill==68)
{
clrscr();
about_box();
return 99;
49
8/2/2019 Patient Management System
50/86
}
return 0;
}
void bed_record_maintenance::display(){
gotoxy(8,num);cout
8/2/2019 Patient Management System
51/86
gotoxy(5,5);
cout
8/2/2019 Patient Management System
52/86
file.close();
if (l!=1)
{
error(0,"THIS BED NO. DOES NOT EXISTS");
goto polo;}
for(int i=0;i
8/2/2019 Patient Management System
53/86
i=get_char(58,9,disease_name);
flushall();
if(i==99)return 99;
elseif(i==5)
goto p2;
else
if(i==68)
{
clrscr();about_box();
return 99;
}
p4: error(1,"ONLY CHARACTERS ALLOWED");
textbackground(BLUE);
gotoxy(58,11);
cprintf(" ");
i=get_char(58,11,doctor_recom);
flushall();if(i==99)
return 99;
else
if(i==5)
goto p3;
else
if(i==68)
{clrscr();
about_box();
return 99;}
int res;
df: error(1,"DATE OF ADMISSION - e.g 01/08/2001");
textbackground(BLUE);
gotoxy(58,13);cprintf(" ");
res=check_date(58,13,dd_ad,mm_ad,yyyy_ad);
if(res==1||res==13)
goto df;
else
if(res==99)
return 99;else
if(res==5)goto p4;
dg: error(1,"IT SHOULD BE GREATER THAN DATE OF ADMISSION [at least 1 day]");
textbackground(BLUE);
gotoxy(58,15);
cprintf(" ");
res=check_date(58,15,dd_ds,mm_ds,yyyy_ds);
53
8/2/2019 Patient Management System
54/86
if(res==1)
goto dg;
else
if(res==5)
goto df;else
if(res==99)return 99;
else
if(res==13)
goto ser55;
ko=greater_date(dd_ad,mm_ad,yyyy_ad,dd_ds,mm_ds,yyyy_ds);if(ko!=0)
goto dg;
ser55: gettext(2,2,75,24,txt);
textbackground(BLACK);
clrscr();
gotoxy(5,5);
cout
8/2/2019 Patient Management System
55/86
goto dg;
}
else
if(rw==68)
{clrscr();
about_box();return 99;
}
flushall();
m2: error(1,"ONLY INTEGERS ALLOWED");
textbackground(BLUE);
gotoxy(58,7);cprintf(" ");
rw=get_int(58,7,patient.operation_exp);
if(rw==99)
return 99;
else
if(rw==5)
goto m1;
elseif(rw==68)
{clrscr();
about_box();
return 99;
}
flushall();
m3: error(1,"ONLY INTEGERS ALLOWED");
textbackground(BLUE);
gotoxy(58,9);cprintf(" ");
rw=get_int(58,9,patient.food_exp);
if(rw==99)return 99;
else
if(rw==5)
goto m2;
elseif(rw==68)
{
clrscr();
about_box();
return 99;
}
flushall();
m4: error(1,"ONLY INTEGERS ALLOWED");textbackground(BLUE);
gotoxy(58,11);cprintf(" ");
rw=get_int(58,11,patient.pathology_exp);
if(rw==5)
goto m3;
else
if(rw==99)
return 99;
55
8/2/2019 Patient Management System
56/86
else
if(rw==68)
{
clrscr();
about_box();return 99;
}flushall();
m5: error(1,"ONLY INTEGERS ALLOWED");
textbackground(BLUE);
gotoxy(58,13);
cprintf(" ");
rw=get_int(58,13,patient.other_exp);if(rw==99)
return 99;
else
if(rw==5)
goto m4;
else
if(rw==68)
{clrscr();
about_box();return 99;
}
flushall();
m6: error(1,"ONLY INTEGERS ALLOWED");
textbackground(BLUE);
gotoxy(58,17);
cprintf(" ");
rw=get_int(58,17,patient.adv_payment);
if(rw==99)
return 99;else
if(rw==5)
goto m5;
else
if(rw==68){
clrscr();
about_box();
return 99;
}
return 0;
}
void patient_register::display(){
gotoxy(6,num);cout
8/2/2019 Patient Management System
57/86
ser_no++;
}
void main()
{/* about_box();
int opera=0;//pwd=0;opera=passw();
if(opera==0)
exit(0);*/
char choice;
man: textbackground(0);
clrscr();flushall();
textmode(BW80);
showwin(15,7,65,20,9,"PATIENT INFORMATION SYSTEM",5);
gotoxy(15,9);
cprintf("---------------------------------------------------");
gotoxy(15,18);
cprintf("---------------------------------------------------");
gotoxy(21,19);cprintf("You selected choice");
gotoxy(45,19);cprintf("------->");
gotoxy(56,19);
cprintf(": :");
error(1,"PRESS `' ARROW KEY OR `' ARROW KEY");
choice=menu(21,10, "BED REGISTER -------> :1:",
"PATIENT REGISTER -------> :2:",
"BILLS -------> :3:",
"BED STATUS LIST -------> :4:","EXIT MENU -------> :5:");
if(choice=='~')
{about_box();
goto man;
}
fstream file1;fstream file2;
error(1,"WAIT ....");
switch(choice)
{
case '1':
textbackground(0);
clrscr();
a:textbackground(0);
clrscr();char am1;
showwin(15,7,65,20,9,"BED RECORD MAINTENANCE",5);
gotoxy(15,9);
cout
8/2/2019 Patient Management System
58/86
cout
8/2/2019 Patient Management System
59/86
delay(2000);
_setcursortype(_NORMALCURSOR);
gy: error(1,"DO YOU WANT TO CONTINUE [Y/N]:");
textbackground(12);
ans=getche();textbackground(0);
if(ans=='y' || ans=='Y'){
delay(1000);
goto p1;
}
else
if(ans=='n' || ans=='N'){
delay(1000);
goto a;
}
else
{
cout
8/2/2019 Patient Management System
60/86
if(get!=13)
goto f67;
num=5;
clrscr();
int x;design_bed();
file1.open("bed_reg",ios::in|ios::out);file1.read((char *)&bed,sizeof(bed));
while(file1)
{
if(dept==bed.bed_no[0])
{
x=wherey();if(x>=20)
{
error(1,"Press any key to
continue");
getch();
clrscr();
design_bed();
num=5;x=5;
}bed.display();
}
file1.read((char *)&bed,sizeof(bed));
}
ser_no=1;
error(1,"Press any key to continue");
getch();
file1.close();num=5;
goto a;
case '3':char bd[4],res=0;
clrscr();
showwin(20,7,60,9,12,"SEARCH",10);
error(1,"FIRST LETTER CHARACTER & NEXT TWO
INTEGERS");gotoxy(22,8);
cout
8/2/2019 Patient Management System
61/86
while(file1)
{
if(bd[0]==bed.bed_no[0]&&bd[1]==bed.bed_no[1]&&bd[2]==bed.bed_no[2])
{textbackground(0);
clrscr();showwin(15,7,65,20,12,"SEARCHED
RECORDS",10);
gotoxy(16,8);
textcolor(11);
cprintf(" FIELD NAME VALUE");
textcolor(YELLOW);gotoxy(15,9);
cprintf("---------------------------------------------------");
gotoxy(15,18);
cprintf("---------------------------------------------------");
textcolor(15);
gotoxy(16,10);cprintf(" BED NO :");
gotoxy(16,12);cprintf("NAME OF DEPARTMENT :");
gotoxy(16,14);
cprintf("HEAD OF DEPARTMENT :");
gotoxy(16,16);
cprintf(" CHARGE PER DAY :");
textcolor(15);
show_bedno(40,10,bed.bed_no);
gotoxy(40,12);cprintf("%s",bed.name_dept);
gotoxy(40,14);
cprintf("%s",bed.head_dept);gotoxy(40,16);
cprintf("%.2f",bed.charge_day);
res=1;
}
file1.read((char *)&bed,sizeof(bed));}
file1.close();
if(res==0)
{
error(0,"NO SUCH RECORD FOUND!");
ser_no=1;
goto a;
}error(1,"PRESS ANY KEY TO CONTINUE");
getch();file1.close();
num=5;
ser_no=1;
goto a;
case '4':
clrscr();
char bd1[4],cnt=0;
61
8/2/2019 Patient Management System
62/86
char cm;
showwin(20,7,60,9,12,"DELETE",10);
error(1,"FIRST LETTER CHARACTER & NEXT TWO
INTEGERS");
gotoxy(23,8);cout
8/2/2019 Patient Management System
63/86
error(0,"NO SUCH RECORD FOUND !");
file1.close();
ff.close();
remove("bh");
goto a;}
elseif(cnt==1)
{
file1.close();
ff.close();
remove("bed_reg");
if(rename("bh","bed_reg")==0)error(1,"RECORD DELETED");
else
{
cout
8/2/2019 Patient Management System
64/86
if(bd1[0]==bed.bed_no[0]&&bd1[1]==bed.bed_no[1]&&bd1[2]==bed.bed_no[2])
{ geek=1;
break;
}else
{ file.write((char *)&bed,sizeof(bed));
file1.read((char *)&bed,sizeof(bed));
}
}
if(geek==0)
{
error(0,"NO SUCH RECORD FOUND");
file1.close();
file.close();
remove("temp");
goto a;
}else
{
textbackground(0);
clrscr();
showwin(10,7,70,20,12,"MODIFY RECORDS",10);
gotoxy(11,8);
textcolor(YELLOW);
cprintf(" FIELD NAME OLD VALUE
NEW VALUE");gotoxy(10,9);
cprintf("-------------------------------------------------------------");gotoxy(10,18);
cprintf("-------------------------------------------------------------");
for(cnt1=10;cnt1
8/2/2019 Patient Management System
65/86
show_bedno(52,10,bed.bed_no);
gotoxy(35,12);
cprintf("%s",bed.name_dept);
gotoxy(35,14);
cprintf("%s",bed.head_dept);gotoxy(35,16);
cprintf("%.2f",bed.charge_day);cnt1=0;
textcolor(11);
for(auto fh=12;fh
8/2/2019 Patient Management System
66/86
{
strcpy(mod.head_dept,bed.head_dept);
gotoxy(51,14);
textbackground(9);
cprintf("%s",bed.head_dept);}
error(1,"INTEGERS ONLY [0-9]");cnt1=get_int(51,16,mod.charge_day);
flushall();
if(cnt1==99)
goto a;
else
if(cnt1==68){
about_box();
goto man;
}
else
if(cnt1==5)
goto popop1;
elseif(mod.charge_day==0)
{textbackground(9);
gotoxy(51,16);
cprintf("%.2f",bed.charge_day);
mod.charge_day=bed.charge_day;
}
if(mod.name_dept[0]==' ')
strcpy(mod.name_dept,bed.name_dept);
if(mod.head_dept[0]==' ')strcpy(mod.head_dept,bed.head_dept);
error(1,"DO YOU WANT TO SAVE IT [Y/N]:");
textbackground(12);ans1=getche();
if((ans1 =='y')||(ans1 =='Y')||(ans1==13))
{
file.write((char *)&mod,sizeof(mod));
file1.read((char *)&bed,sizeof(bed));while(file1)
{
if(bd1[0]==bed.bed_no[0]&&bd1[1]==bed.bed_no[1]&&bd1[2]==bed.bed_no[2])
{
file1.read((char
*)&bed,sizeof(bed));
}file.write((char
*)&bed,sizeof(bed));file1.read((char
*)&bed,sizeof(bed));
}
file1.close();
file.close();
remove("bed_reg");
rename("temp","bed_reg");
66
8/2/2019 Patient Management System
67/86
}
else
{
file.close();
file1.close();remove("temp");
goto a;}
file.close();
file1.close();
}
goto a;
case '6': _setcursortype(_NOCURSOR);goto man;
}
case '2':
char run;
q:textbackground(BLACK);
clrscr();
run=1;
showwin(15,7,65,20,9,"PATIENT REGISTER",5);gotoxy(15,9);
cout
8/2/2019 Patient Management System
68/86
pai_ck[i][1]=patient.bed_no[1];
pai_ck[i][2]=patient.bed_no[2];
count1++;
i=i+1;
file2.read((char *)&patient,sizeof(patient));}
file2.close();file2.open("pai_reg",ios::in|ios::out|ios::app);
char ans='y';
int resd=0;
resd=patient.input();
if(resd==99)
{ file2.close();goto q;
}
else
if(resd==68)
{
about_box();
goto q;
}resd=0;
fl: error(1,"DO YOU SAVE IT [Y/N]:");textbackground(12);
char sav;
sav=getche();
if(sav=='y'|| sav=='Y')
{
delay(500);
file2.write((char *)&patient,sizeof(patient));
file2.close();error(1,"RECORD SAVED");
_setcursortype(_NOCURSOR);
delay(2000);_setcursortype(_NORMALCURSOR);
go: error(1,"DO YOU WANT TO CONTINUE [Y/N]:");
textbackground(12);
ans=getche();
textbackground(0);if(ans=='y' || ans=='Y')
{
delay(1000);
goto kol;
}
else
if(ans=='n' || ans=='N')
{delay(1000);
goto q;}
else
{
cout
8/2/2019 Patient Management System
69/86
else
if(sav=='n' || sav=='N')
{
file1.close();
delay(1000);goto go;
}else
{ cout
8/2/2019 Patient Management System
70/86
textbackground(BLACK);
// clrscr();
file2.open("pai_reg",ios::in|ios::out);
file2.read((char *)&patient,sizeof(patient));
while(file2){
if(bd[0]==patient.bed_no[0]&&bd[1]==patient.bed_no[1]&&bd[2]==patient.bed_no[2])
{
clrscr();
showwin(5,3,75,21,12,"SEARCHED
RECORDS",10);
gotoxy(5,5);
cprintf("-----------------------------------------------------------------------");
gotoxy(5,19);
cprintf("-----------------------------------------------------------------------");
textcolor(13);
gotoxy(7,6);
cprintf(" BED NO. :");gotoxy(7,7);
cprintf(" PATIENT NAME :");gotoxy(7,8);
cprintf(" PATIENT ADDRESS :");
gotoxy(7,9);
cprintf(" THE DISEASE NAME :");
gotoxy(7,10);
cprintf("NAME OF RECOMMENDED
DOCTOR :");
gotoxy(7,11);cprintf(" THE DATE OF
ADDMISSION :");
gotoxy(7,12);cprintf(" THE DATE OF
DISCHARGE :");
gotoxy(7,13);
cprintf(" MEDICINE EXPENSES :");
gotoxy(7,14);cprintf(" OPERATION EXPENSES :");
gotoxy(7,15);
cprintf(" FOOD EXPENSES :");
gotoxy(7,16);
cprintf(" PATHOLOGY
EXPENSES :");
gotoxy(7,17);
cprintf(" OTHERS EXPENSES :");gotoxy(7,18);
cprintf(" ADVANCE PAYMENT :");textcolor(15);
show_bedno(40,6,patient.bed_no);
gotoxy(40,7);
cprintf("%s",patient.patient_name);
gotoxy(40,8);
cprintf("%s",patient.patient_ads);
70
8/2/2019 Patient Management System
71/86
gotoxy(40,9);
cprintf("%s",patient.disease_name);
gotoxy(40,10);
cprintf("%s",patient.doctor_recom);
gotoxy(40,11);cprintf("%d\\%d\\
%d",patient.dd_ad,patient.mm_ad,patient.yyyy_ad); gotoxy(40,12);
cprintf("%d\\%d\\
%d",patient.dd_ds,patient.mm_ds,patient.yyyy_ds);
gotoxy(40,13);
cprintf("%.2f",patient.medicine_exp);
gotoxy(40,14);cprintf("%.2f",patient.operation_exp);
gotoxy(40,15);
cprintf("%.2f",patient.food_exp);
gotoxy(40,16);
cprintf("%.2f",patient.pathology_exp);
gotoxy(40,17);
cprintf("%.2f",patient.other_exp);
gotoxy(40,18);cprintf("%.2f",patient.adv_payment);
res=1;}
file2.read((char *)&patient,sizeof(patient));
}
if(res==0)
{
gotoxy(32,10);
error(3,"NO RECODS FOUND");
getch();}
ser_no=1;
error(1,"Press any key to continue");getch();
file2.close();
num=5;
goto q;
case '4':clrscr();
char bd2[4],cnt=0;
error(1,"FIRST LETTER CHARACTER & NEXT TWO
INTEGERS");
showwin(20,8,60,10,12,"DELETE",10);
gotoxy(23,9);
cout
8/2/2019 Patient Management System
72/86
clrscr();
fstream ff;
ff.open("bh",ios::in|ios::out);
file2.open("pai_reg",ios::in|ios::out);
file2.read((char *)&patient,sizeof(patient));while(file2)
{
if(bd2[0]==patient.bed_no[0]&&bd2[1]==patient.bed_no[1]&&bd2[2]==patient.bed_no[2])
{
cnt=1;
file2.read((char *)&patient,sizeof(patient));
}else
{
ff.write((char *)&patient,sizeof(patient));
file2.read((char *)&patient,sizeof(patient));
}
}
ff.close();
file2.close();if(cnt==0)
{error(0,"NO SUCH RECORD FOUND !");
file2.close();
goto q;
}
ff.close();
ans1='n';
error(1,"ARE YOU SURE TO DELETE THIS RECORD
[Y/N]:");ans1=getche();
if(ans1=='y'||ans1=='Y')
{remove("pai_reg");
if(rename("bh","pai_reg")==0)
{
error(1,"RECORD DELETED");
goto q;}
else
{
cout
8/2/2019 Patient Management System
73/86
bd2[2]='\0';
bd2[3]='\0';
error(1,"FIRST LETTER CHARACTER & NEXT TWO
INTEGERS");
showwin(20,8,60,10,12,"MODIFY",10);gotoxy(23,9);
cout
8/2/2019 Patient Management System
74/86
cprintf("-------------------------------------------------------------");
for(cnt1=6;cnt1
8/2/2019 Patient Management System
75/86
cprintf("%.2f",patient.medicine_exp);
gotoxy(35,14);
cprintf("%.2f",patient.operation_exp);
gotoxy(35,15);
cprintf("%.2f",patient.food_exp);gotoxy(35,16);
cprintf("%.2f",patient.pathology_exp);gotoxy(35,17);
cprintf("%.2f",patient.other_exp);
gotoxy(35,18);
cprintf("%.2f",patient.adv_payment);
cnt1=0;textcolor(11);
for(auto fh=7;fh
8/2/2019 Patient Management System
76/86
else
if(cnt1==68)
{
about_box();
goto man;}
elseif(cnt1==5)
goto lpopop;
else
if(cnt1==1000)
{
strcpy(mod1.patient_ads,patient.patient_ads);
gotoxy(51,8);
textbackground(9);
cprintf("%s",patient.patient_ads);
}
lpopop2: cnt1=get_char(51,9,mod1.disease_name);
flushall();
if(cnt1==99)goto q;
elseif(cnt1==68)
{
about_box();
goto man;
}
else
if(cnt1==5)
goto lpopop1;else
if(cnt1==1000)
{
strcpy(mod1.disease_name,patient.disease_name);
gotoxy(51,9);
textbackground(9);
cprintf("%s",patient.disease_name);}
lpopop3: cnt1=get_char(51,10,mod1.doctor_recom);
flushall();
if(cnt1==99)
goto q;
else
if(cnt1==68)
{about_box();
goto man;}
else
if(cnt1==5)
goto lpopop2;
else
if(cnt1==1000)
{
76
8/2/2019 Patient Management System
77/86
strcpy(mod1.doctor_recom,patient.doctor_recom);
gotoxy(51,10);
textbackground(9);
cprintf("%s",patient.doctor_recom);}
popok: error(1,"INTEGERS ONLY [DD/MM/YYYY]");textbackground(9);
gotoxy(51,11);
cprintf(" ");
cnt1=check_date(51,11,mod1.dd_ad,mod1.mm_ad,mod1.yyyy_ad);
flushall();if(cnt1==99)
goto q;
else
if(cnt1==68)
{
about_box();
goto man;
}else
if(cnt1==5)goto lpopop3;
else
if(cnt1==13)
{
textcolor(15);
mod1.dd_ad=patient.dd_ad;
mod1.mm_ad=patient.mm_ad;
mod1.yyyy_ad=patient.yyyy_ad;gotoxy(51,11);
textbackground(9);
cprintf("%d\\%d\\%d",mod1.dd_ad,mod1.mm_ad,mod1.yyyy_ad);
}
popopp: error(1,"IT SHOULD BE GREATER THAN
DATE_OF_ADMISSION. [at least 1 day]");
textbackground(9);gotoxy(51,12);
cprintf(" ");
cnt1=check_date(51,12,mod1.dd_ds,mod1.mm_ds,mod1.yyyy_ds);
flushall();
if(cnt1==99)
goto q;
elseif(cnt1==68)
{about_box();
goto man;
}
else
if(cnt1==5)
goto popok;
else
77
8/2/2019 Patient Management System
78/86
if(cnt1==13)
{
textcolor(15);
mod1.dd_ds=patient.dd_ds;
mod1.mm_ds=patient.mm_ds;mod1.yyyy_ds=patient.yyyy_ds;
gotoxy(51,12);textbackground(9);
cprintf("%d\\%d\\%d
",mod1.dd_ds,mod1.mm_ds,mod1.yyyy_ds);
}
lpopop4: error(1,"INTEGERS ONLY [0-9]");cnt1=get_int(51,13,mod1.medicine_exp);
flushall();
if(cnt1==99)
goto q;
else
if(cnt1==68)
{
about_box();goto man;
}else
if(cnt1==5)
goto popopp;
else
if(mod1.medicine_exp==0)
{
textcolor(15);
mod1.medicine_exp=patient.medicine_exp;gotoxy(51,13);
textbackground(9);
cprintf("%.2f",patient.medicine_exp);}
lpopop5: error(1,"INTEGERS ONLY [0-9]");
cnt1=get_int(51,14,mod1.operation_exp);flushall();
if(cnt1==99)
goto q;
else
if(cnt1==68)
{
about_box();
goto man;}
elseif(cnt1==5)
goto lpopop4;
else
if(mod1.operation_exp==0)
{
mod1.operation_exp=patient.operation_exp;
gotoxy(51,14);
78
8/2/2019 Patient Management System
79/86
textbackground(9);
cprintf("%.2f",patient.operation_exp);
}
lpopop6: error(1,"INTEGERS ONLY [0-9]");cnt1=get_int(51,15,mod1.food_exp);
flushall();if(cnt1==99)
goto q;
else
if(cnt1==68)
{
about_box();goto man;
}
else
if(cnt1==5)
goto lpopop5;
else
if(mod1.food_exp==0)
{mod1.food_exp=patient.food_exp;
gotoxy(51,15);textbackground(9);
cprintf("%.2f",patient.food_exp);
}
lpopop7: error(1,"INTEGERS ONLY [0-9] ");
cnt1=get_int(51,16,mod1.pathology_exp);
flushall();
if(cnt1==99)goto q;
else
if(cnt1==68){
about_box();
goto man;
}
elseif(cnt1==5)
goto lpopop6;
else
if(mod1.pathology_exp==0)
{
mod1.pathology_exp=patient.pathology_exp;
gotoxy(51,16);textbackground(9);
cprintf("%.2f",patient.pathology_exp);}
lpopop8: error(1,"INTEGERS ONLY [0-9]");
cnt1=get_int(51,17,mod1.other_exp);
flushall();
if(cnt1==99)
goto q;
79
8/2/2019 Patient Management System
80/86
else
if(cnt1==68)
{
about_box();
goto man;}
elseif(cnt1==5)
goto lpopop7;
else
if(mod1.other_exp==0)
{
mod1.other_exp=patient.other_exp;gotoxy(51,17);
textbackground(9);
cprintf("%.2f",patient.other_exp);
}
lpopop9: error(1,"INTEGERS ONLY [0-9]");
cnt1=get_int(51,18,mod1.adv_payment);
flushall();
if(cnt1==99)goto q;
elseif(cnt1==68)
{
about_box();
goto man;
}
else
if(cnt1==5)
goto lpopop8;else
if(mod1.adv_payment==0)
{mod1.adv_payment=patient.adv_payment;
gotoxy(51,18);
textbackground(9);
cprintf("%.2f",patient.adv_payment);
}
error(1,"DO YOU WANT TO SAVE IT [Y/N]:");
textbackground(12);
ans1=getche();
if((ans1 =='y')||(ans1 =='Y')||(ans1==13))
{
file.write((char *)&mod1,sizeof(mod1));
file1.read((char *)&patient,sizeof(patient));while(file1)
{
file.write((char
*)&patient,sizeof(patient));
file1.read((char
*)&patient,sizeof(patient));
}
80
8/2/2019 Patient Management System
81/86
file1.close();
file.close();
remove("pai_reg");
rename("temp","pai_reg");}
else{
file.close();
file1.close();
remove("temp");
goto q;
}file.close();
file1.close();
}
goto q;
case '6':goto man;
}
case '3':clrscr();
char bd[4];file2.open("pai_reg",ios::out|ios::in);
error(1,"FIRST LETTER CHARACTER & NEXT TWO INTEGERS");
showwin(20,8,60,10,12,"BILLS",10);
gotoxy(29,9);
cprintf("ENTER BED_NO.:");
float charg=0,total=0;
int ret=0;
fstream file;ret=get_bedno(45,9,bd);
if(ret==99)
goto man;else
if(ret==68)
{
about_box();
goto man;}
textbackground(BLACK);
file2.read((char *)&patient,sizeof(patient));
while(file2)
{
if((bd[0]==patient.bed_no[0])&&(bd[1]==patient.bed_no[1])&&(bd[2]==patient.bed_no[2]))
{clrscr();
diff_date=greater_date(patient.dd_ad,patient.mm_ad,patient.yyyy_ad,patient.dd_ds,patient.mm_ds,patient.
yyyy_ds);
if(diff_date!=0)
{
error(0,"PLEASE MENTION DATE OF
DISCHARGE OF THIS BED_NO");
81
8/2/2019 Patient Management System
82/86
getch();
goto man;
}
diff_date=date_diff(patient.dd_ad,patient.mm_ad,patient.yyyy_ad,patient.dd_ds,patient.mm_ds,patient.yyy
y_ds); file.open("bed_reg",ios::in|ios::out);
file.read((char *)&bed,sizeof(bed));
while(file)
{
if((bd[0]==bed.bed_no[0])&&(bd[1]==bed.bed_no[1])&&(bd[2]==bed.bed_no[2]))charg=diff_date*bed.charge_day;
file.read((char *)&bed,sizeof(bed));
}
file.close();
showwin(5,2,74,24,12,"BILL",10);
for(int i=3;i
8/2/2019 Patient Management System
83/86
gotoxy(40,10);
cprintf("=======>");
gotoxy(55,10);
cprintf(":%d/%d/
%d",patient.dd_ds,patient.mm_ds,patient.yyyy_ds);
gotoxy(7,11);cprintf("CHARGES OF NURSING HOME");
gotoxy(40,11);
cprintf("=======>");
gotoxy(55,11);
cprintf(":%.2f",charg);
gotoxy(7,12);
cprintf("MEDICAL EXPENSES");
gotoxy(40,12);
cprintf("=======>");
gotoxy(55,12);
cprintf(":%.2f",patient.medicine_exp);
gotoxy(7,13);cprintf("OPERATION EXPENSE");
gotoxy(40,13);cprintf("=======>");
gotoxy(55,13);
cprintf(":%.2f",patient.operation_exp);
gotoxy(7,14);
cprintf("FOOD EXPENSE");
gotoxy(40,14);
cprintf("=======>");gotoxy(55,14);
cprintf(":%.2f",patient.food_exp);
gotoxy(7,15);
cprintf("PATHOLOGY EXPENSES");
gotoxy(40,15);
cprintf("=======>");
gotoxy(55,15);cprintf(":%.2f",patient.pathology_exp);
gotoxy(7,16);
cprintf("OTHER EXPENSES");
gotoxy(40,16);
cprintf("=======>");
gotoxy(55,16);
cprintf(":%.2f",patient.other_exp);
gotoxy(7,17);cprintf("TOTAL AMOUNT DUE");
gotoxy(40,17);
cprintf("=======>");
gotoxy(55,17);
total=charg+patient.medicine_exp+patient.operation_exp+patient.food_exp+patient.pathology_exp+patient
.other_exp;
cprintf(":%.2f",total);
83
8/2/2019 Patient Management System
84/86
gotoxy(7,18);
cprintf("Less: ADVANCE PAYMENT");
gotoxy(40,18);
cprintf("=======>");gotoxy(55,18);
cprintf(":%.2f",patient.adv_payment);
gotoxy(7,19);
cprintf("NET AMOUNT DUE");
gotoxy(40,19);
cprintf("=======>");
gotoxy(55,19);cprintf(":%.2f",total-patient.adv_payment);
gotoxy(7,21);
cprintf("THANKING YOU");
gotoxy(55,23);
cprintf("SIGN. OF DOCTOR");
textbackground(BLACK);gotoxy(25,25);
cprintf("PRESS ANY KEY TO CONTINUE");getch();
textcolor(WHITE);
goto man;
}
else
} file2.read((char *)&patient,sizeof(patient));
error(0,"NO SUCH RECORD FOUND !");
goto man;case '4': clrscr();
ser_no=1;
dept=' ';char get;
f70: showwin(15,7,65,9,12,"DISPLAY",10);
error(1,"FIRST CHARACTER ONLY");
gotoxy(17,8);
cout
8/2/2019 Patient Management System
85/86
else
if(get!=13)
goto f60;
num=5;
textcolor(WHITE);clrscr();
bed_status();int x=0;
int bh=0;
int l=0;
file2.open("pai_reg",ios::in|ios::out);
file2.read((char *)&patient,sizeof(patient));
while(file2){
pai_ck[l][0]=patient.bed_no[0];
pai_ck[l][1]=patient.bed_no[1];
pai_ck[l][2]=patient.bed_no[2];
count1++;
l=l+1;
file2.read((char *)&patient,sizeof(patient));
}file2.close();
file1.open("bed_reg",ios::in|ios::out);file1.read((char *)&bed,sizeof(bed));
while(file1)
{
if(dept==bed.bed_no[0])
{x=wherey();
if(x>=23)
{
gotoxy(25,25);textcolor(CYAN);
cprintf("Press any key to continue");
getch();clrscr();
bed_status();
num=5;
x=5;
}textcolor(WHITE);
gotoxy(5,num);
cprintf("%d",ser_no);
gotoxy(15,num);
cprintf("%s",bed.name_dept);
gotoxy(28,num);
cprintf("%c%c",bed.bed_no[1],bed.bed_no[2]);
for(l=0;l
8/2/2019 Patient Management System
86/86
}
else
{
gotoxy(40,num);
textcolor(10);cprintf("VACANT");
}ser_no++;
num++;
}
file1.read((char *)&bed,sizeof(bed));
bh=0;
textcolor(WHITE);}
file1.close();
gotoxy(25,25);
textcolor(YELLOW);
cprintf("PRESS ANY KEY TO CONTINUE");
getch();
ser_no=1;
num=5;textcolor(WHITE);
goto man;case '5':quit();
delay(1000);
break;
default :goto main;
default :goto man;
}
}