The assignment goes like this \"the student should use MFC to design the user in
ID: 3875827 • Letter: T
Question
The assignment goes like this "the student should use MFC to design the user interface for this project", this of course is a C++ assignment. If you are not able to use MFC, just the source code for the assignment would be greatly appreciated.
A hospital has different kinds of patients who require different procedures for billing and approval of procedures. In this project, they want you to design an automatic application which will help patient to register themselves at the automatic cashier. The requirement is that,
3.1 On main window
On the main window, the welcome message to the hospital is displayed with buttons: create account and register (login).
3.2 Create an account
The patient has to press on the button, if and only if it is their first time to arrive in the hospital. After pressing on that button, a window will appear and display a form that will allow a new patient to input personal information such as:
- Names
- Password
- ID
- Address
- Date of birth
- Telephone number
- His occupation (employee, student, retire, etc.)
- The type of insurance (Medicare, HMOs, other health insurance plans, none)
- Telephone number of the insurance if there is one.
- The Patient needs to choose a specific doctor depending on his health problem. The doctor’s specialties are: Internal medicine, pediatric, surgery, neurology, emergency, dermatology, gynecology, dentist, etc.
- Etc.
3.3 Register
Here, the patient needs to input his name and the password to sign in. once he is in, he can select a specific doctor depending on his health problem, and also can update any of his information.
After creating an account or being registered, the cashier automatically will print the receipt, on which will be displayed the patient’s name, ID, age, doctor’s specialty and the patient’s position on the line.
Note:
The patient position on the line depends on the doctor’s specialty chosen. For example you will be the first on the line if you chose dentist as a doctor’s specialty if none of your predecessor has chosen it.
Explanation / Answer
#include<stdio.h>
#include<conio.h>
#include<fstream.h>
#include<stdlib.h>
#include<string.h>
#include<iomanip.h>
//*******************************************************
// CLASS NAME : patient
//*******************************************************
class patient
{
public:
char name[20];
char blood_group[5];
int pat_id;
long int phn;
int a;
void patientdata();
void showdata();
};
//*******************************************************
// FUNCTIONS TO GET AND SHOW DATA
//*******************************************************
void patient::patientdata()
{
cout<<" ******************************************************************************* ";
cout<<" Create New Patient Database ";
cout<<" ******************************************************************************* ";
cout<<" Enter Patient ID : ";
cin>>pat_id;
cout<<" Enter Patient Name : ";
cin>>name;
cout<<" Enter Patient Blood Group : ";
cin>>blood_group;
fflush(stdin);
cout<<" Enter Patient Phone : ";
cin>>phn;
}
void patient::showdata()
{
cout<<" Patient ID : "<<pat_id;
cout<<" Patient Name : "<<name;
cout<<" Blood Group : "<<blood_group;
cout<<" Patient Phone : "<<phn;
cout<<" ";
}
/***************************************************************************
Main Function
*************************************************************************/
void main()
{
clrscr();
gotoxy(20,18);
cout<<" Program Developed by :-";
gotoxy(28,22);
cout<<" Me ";
gotoxy(25,28);
cout<<"Press Any Key to Continue";
getch();
clrscr();
char s;
patient obj;
z:
fstream f;
f.open("patient",ios::in|ios::out|ios::app|ios::ate|ios::binary);
cout<<" ============================================================================= ";
cout<<" Blood Group Automation ";
cout<<" ============================================================================= ";
cout<<" 1 . Enter Patient Database";
cout<<" 2 . View Patient Database";
cout<<" 3 . Modify Patient Database";
cout<<" 4 . Search Patient Database";
cout<<" 5 . Exit ";
int a;
cout<<" Enter your Choice:";
f.seekg(0);
cin>>a;
char x;
switch (a)
{
//*******************************************************
// ADD A PATIENT RECORD
//*******************************************************
case 1:
clrscr();
fstream f;
f.open("patient",ios::in|ios::out|ios::ate|ios::app|ios::binary);
char ans;
obj.patientdata();
f.write((char *)&obj,sizeof(obj));
getch();
cout<<"Do You Want To Continue? y/n :";
ans=getchar();
if(ans=='Y' || ans=='y')
goto z;
else
break;
//*******************************************************
// CASE : 2
// DETAILS : TO SHOW ALL patient RECORDS
//*******************************************************
case 2:
{
cout<<" ";
fstream f;
f.open("patient",ios::in|ios::out|ios::ate|ios::app|ios::binary);
// cout<<" ";
char ans;
f.seekg(0);
int ctr=0;
while(f.read((char *)&obj,sizeof(obj)) )
{
ctr=ctr+1;
if(ctr==8)
{
getchar();
clrscr();
ctr=0;
}
obj.showdata();
if(f.eof()==1)
{
break;
}
}
f.close();
cout<<"Do You Want To Continue? y/n :";
cin>>ans;
if(ans=='y'|| ans=='Y')
goto z;
else
{
exit(1);
}
}
break;
//===========================================================
// Case 3
//============================================================
case 3:
{
clrscr();
// char ans;
fstream f;
patient obj;
char name[20];
char blood_group[5];
long int phn;
int pat_id;
f.open("patient",ios::in|ios::binary);
cout<<" ";
cout<<" ****************************************************************************** ";
cout<<" Modify Patient Database ";
cout<<" ****************************************************************************** ";
cout<<" Enter Patient Name :";
cin>>name;
do
{ f.read((char *)&obj,sizeof(obj));
if(f.eof()==1) {break;}
if(strcmp(obj.name,name)==0)
{
cout<<" Patient Name :"<<obj.name;
cout<<" Patient ID : "<<obj.pat_id;
cout<<" Blood Group :"<<obj.blood_group;
cout<<" Patient Phone :" <<obj.phn;
getchar();
cout<<endl;
cout<<endl;
cout<<" Enter New Database" ;
cout<<" Enter Patient name : ";
cin>>name;
cout<<" Enter Patient ID : ";
cin>>pat_id;
cout<<" Blood Group : ";
cin>>blood_group;
cout<<" Enter Patient Phone :";
cin>>phn;
cout<<" ";
strcpy(obj.name,name);
strcpy(obj.blood_group,blood_group);
obj.a=a;
int l=f.tellg();
f.close();
f.open("patient",ios::out|ios::binary|ios::ate);
f.seekg(l-sizeof(obj));
f.write((char *)&obj,sizeof(obj));
}
}while(f);
f.close();
cout<<"Do You Want To Continue?y/n :";
ans=getchar();
if(ans=='Y'||ans=='y')
{goto z;}
else
break;
}
//******************************************************
// Case 4 Searching The Patient From Database
//******************************************************
case 4:
{
clrscr();
// char ans;
fstream f;
patient obj;
char name[20];
char blood_group[5];
long int phn;
int pat_id;
f.open("patient",ios::in|ios::binary);
cout<<" ";
cout<<" ****************************************************************************** ";
cout<<" Search Patient Database ";
cout<<" ****************************************************************************** ";
cout<<" Enter Patient Name :";
cin>>name;
do
{ f.read((char *)&obj,sizeof(obj));
if(f.eof()==1) {break;}
if(strcmp(obj.name,name)==0)
{
cout<<" Patient Name :"<<obj.name;
cout<<" Patient ID : "<<obj.pat_id;
cout<<" Blood Group :"<<obj.blood_group;
cout<<" Patient Phone :" <<obj.phn;
getchar();
cout<<endl;
strcpy(obj.name,name);
strcpy(obj.blood_group,blood_group);
obj.a=a;
int l=f.tellg();
f.close();
f.open("patient",ios::out|ios::binary|ios::ate);
f.seekg(l-sizeof(obj));
//f.write((char *)&obj,sizeof(obj));
}
else
{
cout<<" Patient Does Not Exist ";
}
}while(f);
f.close();
cout<<" Do You Want To Continue?y/n :";
ans=getchar();
if(ans=='Y'||ans=='y')
{goto z;}
else
break;
}
/* Exit */
case 5:
{
exit(1);
}
default:
{
cout<<" Wrong input ";
}
cout<<" Do You Want To Continue?y/n :";
ans=getchar();
clrscr();
if(ans=='Y'||ans=='y')
{goto z;}
else
break;
}
getch();
}
Similary you can add the details for the doctor too.. I had tried above code using the files in cpp.Just take alook and run it
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.