1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
#include<string>
#include<iostream>
#include<fstream>
#include<windows.h>
#include<cstdio>
#include<iomanip>
#include<process.h>
using namespace std;
struct Patient
{
string pname;
string pid;
string phonenum;
string address;
string fathersname;
string department;
string disease;
string allergies;
string indate;
string outdate;
Patient *next;
}*head;
class HospitalFunctions
{
public:
void GetDetails()
{
Patient *ptr = new Patient;
ptr->next = NULL;
system("cls");
fflush(stdin);
cout << "\nEnter Patient's Name:";
getline(cin,ptr->pname);
fflush(stdin);
cout << "\nEnter Patient ID:";
getline(cin,ptr->pid);
fflush(stdin);
cout << "\nEnter Patient's Phone Number:";
getline(cin,ptr->phonenum);
fflush(stdin);
cout << "\nEnter The Patient's Father|Mother|Person Who Admitted Name:";
getline(cin,ptr->fathersname);
fflush(stdin);
cout << "\nEnter The Admit Date:";
getline(cin,ptr->indate);
fflush(stdin);
cout << "\nEnter The Discharge Date(NULL,If Not Discharged):";
getline(cin,ptr->outdate);
fflush(stdin);
cout << "\nEnter The Department:";
getline(cin,ptr->department);
fflush(stdin);
cout << "\nAllergies(If Any):";
getline(cin,ptr->allergies);
fflush(stdin);
cout << "\nEnter The Disease/Discomfort Being Experienced by the patient:";
getline(cin,ptr->disease);
fflush(stdin);
cout << "\nEnter The Patient's Address:";
getline(cin,ptr->address);
fflush(stdin);
cout << "\nRegistering Patient....";
if (head == NULL)
{
head = ptr;
}
else
if(head!=NULL)
{
ptr->next=head;
head = ptr;
}
Sleep(2000);
cout << "\nPatient Registered!";
}
void ListPatient()
{
string S_ID,S_ID2;
cout << "\nPatient ID:";
fflush(stdin);
getline(cin,S_ID);
Patient *disp = head;
while(disp->next!=NULL)
{
{ system("cls");
cout << setw(30) << "\nName:" << disp->pname;
cout << endl << setw(30) <<"ID:" << disp->pid;
cout << endl << setw(30) << "Admit Date:" << disp->indate;
cout << endl << setw(30) << "Discharge Date:" << disp->outdate;
cout << endl << setw(30) << "Discomfort:" << disp->disease;
cout <<endl << setw(30) << "Department:" << disp->department;
cout << endl << setw(30) << "Contact:" << disp->phonenum;
break;
}
else
disp= disp->next;
}
}
};
int main()
{
HospitalFunctions H;
char ans ='y';
int choice;
do
{
system("color 09");
cout.width(108);
cout << "Hospital Care Software\n";
cout.width(110);
cout << "--------------------------\n";
cout.width(100);
cout << "MENU:\n";
cout << "\n1.Add A Patient\n2.OPD Appointment\n3.Show Charges\n4.View Patient Details\n5.Modify Patient Details\n6.Emergency\n7.Customer Care\n8.List All Patients\n9.Instruction Manual\n10.EXIT";
cout << endl << endl << "Enter Your Choice(1-9):";
cin >> choice;
switch(choice)
{
case 1: H.GetDetails();
cout << "\n\nEnter 'Y' Return TO Main:";
cin >> ans; system("cls");
break;
case 4: H.ListPatient();
cout << "\n\nEnter 'Y' To Return TO Main:";
cin >> ans; system("cls");
break;
case 9: exit(1);
break;
default:cout << "\nInvalid Selection,Try Again!";
Sleep(800);
system("cls");
break;
}
} while(ans=='y');
return 0;
}
| |