0% found this document useful (0 votes)
642 views

Patient Medical Transcript C++ Mini Project

This document contains code for a patient medical transcript program that collects patient information such as name, address, age, gender, height, weight, blood type, blood pressure readings, allergies, and previous illnesses. It includes functions to calculate BMI, body fat percentage, and metabolism rate based on gender. The program allows the user to enter information for multiple patients and provides summaries of their health metrics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
642 views

Patient Medical Transcript C++ Mini Project

This document contains code for a patient medical transcript program that collects patient information such as name, address, age, gender, height, weight, blood type, blood pressure readings, allergies, and previous illnesses. It includes functions to calculate BMI, body fat percentage, and metabolism rate based on gender. The program allows the user to enter information for multiple patients and provides summaries of their health metrics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

/*

*-----------------------------------------------------------------------*
| PROJECT'S NAME :
| LECT :
| YEAR :
|
|
PATIENT MEDICAL TRANSCRIPT (PMLT)
| SOPIAH ISHAK | 2014
|
|-----------------------------------------------------------------------|
| NAME :
| MATRIK NO.:
|
GROUP:
|
|-----------------------------------------------------------------------|
| 1. AFIQ ZUNILLAH BIN SAHARI
|
2012216054 |
EM1104B1
|
| 2. ARMANDO GRANETIN THOMAS
|
2012838174 |
EM1104B1
|
| 3. AZMI BIN A.MATALI
|
2012833672 |
EM1104B1
|
| 4. SAIFUL AZHAR BIN MASRI
|
2012677626 |
EM1104B1
|
*-----------------------------------------------------------------------*
*/
//PREDEFINED FUNCTIONS.
#include<iostream>
#include<string>
#include<iomanip>
#include<cstdlib>
#include<math.h>
using namespace std;
//USER DEFINED FUNCTIONS.
void opening();
void age_class();
void gender_type();
void tableBMI();
void bodyMassIndex();
void bodyFat();
void bodyMetabolismRateMale();
void bodyMetabolismRateFemale();
void blood();
void blood_pressure();
void allergic1();
void previousill();
void display();
// DECLARE OUTPUT AND INPUT DATA (GLOBAL VARIABLE).
//STRING DATA TYPE.
string patient,patient_allergic,illness,gender1,address1,address2;
string blood_type,systolic_status,diastolic_status;
//INT DATA TYPE.
int age,code,systolic,diastolic,code_ill,blood_code;
//CHAR DATA TYPE.
char gender,repeat,allergic,ill,date[50];
//DOUBLE DATA TYPE.
double BMI,height,weight,sex,body_fat_percentage,BMR;
//MAIN FUNCTION.
void main()
{
//REPETITION CONTROL STRUCTURE DO..WHILE LOOP FOR MAIN FUNCTION.
do
{
//CALLING FUNCTION FOR FRONT PAGE.
opening();
//SYSTEM FOR CLOSE THE PAGE.
system("cls");
//GET PATIENT'S DATA.
//NAME
cout<<"\aName of patient : ";
cin>>ws;
getline(cin,patient);
//DATE.
cout<<"Date (DD/MM//YYYY) : ";
cin>>date;
cout<<"\n";
//PATIENT'S ADDRESS LINE 1.
cout<<"Patient's address\n";
cout<<"-----------------\n";
cout<<"Address line 1 : ";
cin>>ws;
getline(cin,address1);
//PATIENT'S ADDRESS LINE 2.
cout<<"Address line 2 : ";
cin>>ws;
getline(cin,address2);

24

//PATIENT'S AGE.
cout<<"Age of Patient (year) : ";
cin>>age;
age_class();
cout<<"\n";
//SYSTEM FOR PAUSE THE PAGE.
system("pause");
//SYSTEM FOR CLOSE THE PAGE.
system("cls");
cout<<"\aEnter Gender. If male(M), female(F) : ";
cin>>gender;
//MULTIPLE SELECTION - GENDER TYPE.
if(gender=='M'||gender=='m')
{
gender1="Male";
cout<<gender1<<endl;
}
else if(gender=='F'||gender=='f')
{
gender1="Female";
cout<<gender1<<endl;
}
else
cout<<"INVALID"<<endl;
cout<<"\n";
gender_type();
system("cls");
blood();
//GENERATING LEFT-JUSTIFIED VALUE.
cout.setf(ios::left);
//GENERATING DECIMAL POINT VALUE.
cout.setf(ios::fixed);
cout.precision(2);
blood_pressure();
system("cls");
allergic1();
system("cls");
previousill();
system("cls");
display();
system("cls");
//ASK THE USER TO REPEAT THE PROGRAM.
cout<<"Another patient?(Y/N) : ";
cin>>repeat;
system("cls");

}
while(repeat=='Y'||repeat=='y');
}
//FRONT PAGE.
void opening()
{
cout<<"\aZZZZOOZZZZZZZZZZZZOOZZZZZZZZZZZZZZZZZZZ.======================================*\n
"
"=ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZO.
|\n"
"+ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ.
|\n"
"7ZZZO7..ZZZZZZZZZZZZZZZZZ$$$?.ZZZZZZZZZ,
|\n"
"ZZZZ$.. .,$$ZZZZZZZZZZI..
.ZZZZZZZ,
|\n"
"ZZZZZ$I.
.+$$ZZZZZZZZ$Z=.
.$ZZZZZZ,
|\n"
"ZZZZZZ$$.. ...$$$$$$$$$$$$~
IZ$ZZZZ$,
|\n"
"?$$$$$$$Z$.
..:$$$$$$$$$$$$.$Z$$$Z$7.
WELCOME!
|\n"
".$$$$$$$$$7.
.,$$$$$$$$$$$$Z$$$$$..
|\n"
".$$$$$$$$$$77.
..7$$$$$$$$$$$$$$$..
PLEASE TYPE IN CAPITAL LETTER
|\n"
" $$$$$$$$$$$$7:..
=7$$$$$$$$$$$$$.
|\n"
".$$$$$$$$$$$$$7+.
.=7$$$$$$$$$$$.
NOT FOR CHILDREN
|\n"

25

"$$$$$$$$$$$$$$$77.
.77$$$$$$$7.
12 YEARS AND
|\n"
"7$$$$$$$$$$$$$$$777.
.?77$$$77:
BELOW
|\n"
"I7$$$$7.$$7$7$7$7777.
.7$$$7,
|\n"
".7$$77....$7777777777I
.7$$7,
|\n"
" 7777I.
.777777777777.
77$77:
|\n"
" 7777,.
.77777777777~
.77$$7,
|\n"
"I7777..
..:7777777777I.
?7$$$7:
|\n"
"77$77$I.
.,?I777777777777:.. ..777$77,
|\n"
"77$$77777777777777777777777777777$$$$$7,
|\n"
"?777$777777777777777777777777777777$$$7:
|\n"
"I777777$7777777777777777777$$777$$$777$,======================================*\n\n
";
system("pause");
}
//FUNCTION TO DETERMINE THE AGE CLASS OF PATIENT.
void age_class()
{
//TWO WAY SELECTION - AGE CLASS OF PATIENT.
if(age>12&&age<=19)
cout<<"Teenager\n";
else if(age>19)
cout<<"Adult\n";
}
//FUNCTION TO GET HEIGHT AND WEIGHT AND CALL OTHER FUNCTION FOR EITHER MALE OR FEMALE.
void gender_type()
{
//TWO SELECTION - GENDER.
//FOR MALE PATIENT.
if(gender=='M'||gender=='m')
{
tableBMI();
//PATIENT'S WEIGHT.
cout<<"\nEnter patient's weight (in kg) : ";
cin>>weight;
//PATIENT'S HEIGHT.
cout<<"\nEnter patient's height(in meter,m) : ";
cin>>height;
bodyMassIndex();
bodyFat();
bodyMetabolismRateMale();
sex=1;
}
//FOR FEMALE PATIENT.
else if(gender=='F'||gender=='f')
{
tableBMI();
//PATIENT WEIGHT.
cout<<"\nPlease enter the patient's weight(in kg) : ";
cin>>weight;
//PATIENT HEIGHT.
cout<<"\nPlease enter the patient's height(in meter,m) : ";
cin>>height;
bodyMassIndex();
bodyFat();
bodyMetabolismRateFemale();
sex=0;
}
else
cout<<"INVALID"<<endl;
}
//BODY MASS INDEX(BMI) TABLE.
void tableBMI()
{
cout<<"\a================================"<<endl;
cout<<"|
BMI
|
STATUS
|"<<endl;
cout<<"================================"<<endl;
cout<<"|
<18.5
| UNDERWEIGHT |"<<endl;
cout<<"|
18.5-24
|
DESIRABLE
|"<<endl;
cout<<"|
25-29
| OVERWEIGHT
|"<<endl;
cout<<"|
30>
|
OBESE
|"<<endl;
cout<<"================================"<<endl;

26

}
//FUNCTION TO CALCULATE BMI.
void bodyMassIndex()
{
//GENERATING DECIMAL VALUE.
cout.setf(ios::fixed);
cout.precision(2);
//FORMULA TO CALCULATE BMI.
BMI=(weight)/(pow(height,2));
cout<<"\a\nBMI= "<<BMI<<endl;
//MULTIPLE SELECTION - BMI STATUS.
if(BMI>=30)
cout<<"\nStatus : Obese\n";
else if(BMI>=25)
cout<<"\nStatus : Overweight\n";
else if(BMI>=18.5)
cout<<"\nStatus : Desirable\n";
else if(BMI<18.5)
cout<<"\nStatus : Underweight\n";
}
//FUNCTION TO CALCULATE BODY FAT PERCENTAGE
void bodyFat()
{
//GENERATING DECIMAL VALUE.
cout.setf(ios::fixed);
cout.precision(2);
//FORMULA TO CALCULATE BODY FAT PERCENTAGE.
body_fat_percentage=(1.20*BMI)+(0.23*age)-(10.8*sex)-5.4;
cout<<"\nBody fat percentage is : "<<body_fat_percentage<<" %"<<endl<<endl;
}
//FUNCTION TO CALCULATE BODY METABOLISM RATE FOR MALE.
void bodyMetabolismRateMale()
{
//FORMULA TO CALCULATE BMR FOR MALE.
BMR=66+(13.8*weight)+(5*(height*100))-(6.8*age);
cout<<"Patient's Body metabolism rate is : "<<BMR<<" kcals/day"<<endl<<endl;
system("pause");
}
//FUNCTION TO CALCULATE BODY METABOLISM RATE FOR FEMALE.
void bodyMetabolismRateFemale()
{
//FORMULA TO CALCULATE BMR FOR FEMALE.
BMR=655+(9.6*weight)+(1.8*(height*100))-(4.7*age);
cout<<"Patient's Body metabolism rate is : "<<BMR<<" kcals/day"<<endl<<endl;
system("pause");
}
//FUNCTION TO GET THE BLOOD TYPE OF PATIENT.
void blood()
{
cout<<"\a========================";
cout<<"\n| CODE | BLOOD TYPE
|";
cout<<"\n========================";
cout<<"\n| 1.
|
A
|";
cout<<"\n| 2.
|
B
|";
cout<<"\n| 3.
|
AB
|";
cout<<"\n| 4.
|
O
|";
cout<<"\n========================";
cout<<"\nEnter code for blood type : ";
cin>>blood_code;
//MULTIPLE SELECTION - BLOOD TYPE.
if(blood_code==1)
{
blood_type="A";
cout<<"Blood type : ";

27

cout<<blood_type<<endl;
}
else if(blood_code==2)
{
blood_type="B";
cout<<"Blood type : ";
cout<<blood_type<<endl;
}
else if(blood_code==3)
{
blood_type="AB";
cout<<"Bloof type : ";
cout<<blood_type<<endl;
}
else if(blood_code==4)
{
blood_type="O";
cout<<"Bloof type : ";
cout<<blood_type<<endl;
}
else
cout<<"INVALID BLOOD TYPE"<<endl;
}
//FUNCTION TO DETERMINE BLOOD PRESSURE CATEGORY.
void blood_pressure()
{
//LOOP - IF THE USER INPUT FALSE INFORMATION FOR BLOOD PRESSURE.
do
{
//TABLE BLOOD PRESSURE CATEGORY.
cout<<"\a\n**This is to measure the patient blood pressure**\n";
cout<<"-------------------------------------------------\n\n";
cout<<"*============================================================================*\
n";
cout<<"| Blood Pressure Category
| Systolic,mmHg(upper) | Diastolic,mmHg(lower) |\
n";
cout<<"*============================================================================*\
n";
cout<<"| Normal
|
<120
|
<80
|\
n";
cout<<"| Prehypertension
|
120-139
|
80-89
|\
n";
cout<<"| High Blood Pressure,Stage 1 |
140-159
|
90-99
|\
n";
cout<<"| High Blood Pressure,Stage 2 |
160-179
|
100-109
|\
n";
cout<<"| Hypertensive Crisis
|
>180
|
>110
|\
n";
cout<<"*============================================================================*\
n\n";
cout<<"Systolic BP of Patient : ";
cin>>systolic;
//MULTIPLE SELECTION - SYSTOLIC STATUS.
if(systolic>179)
systolic_status="Hypertensive Crisis";
else if(systolic>159)
systolic_status="High Blood Pressure,Stage 2";
else if(systolic>139)
systolic_status="High Blood Pressure,Stage 1";
else if(systolic>119)
systolic_status="Prehypertension";
else if(systolic<120)
systolic_status="Normal";
cout<<"\nDiastolic BP of Patient : ";
cin>>diastolic;
//MULTIPLE SELECTION - DIASTOLIC STATUS.
if(diastolic>109)
diastolic_status="Hypertensive Crisis";
else if(diastolic>99)
diastolic_status="High Blood Pressure,Stage 2";
else if(diastolic>89)
diastolic_status="High Blood Pressure,Stage 1";
else if(diastolic>79)
diastolic_status="Prehypertension";
else if(diastolic<80)

28

diastolic_status="Normal";
system("cls");
if(diastolic>=systolic)
{
cout<<"Diastolic cannot be larger or equal to systolic\n";
cout<<"Please re-enter the value\n";
}

}while(diastolic>=systolic);
//TABLE FOR BLOOD PRESSURE CATEGORY.
cout<<"\a*============================================================================*\n"
;
cout<<"| Blood Pressure Category
| Systolic,mmHg(upper) | Diastolic,mmHg(lower) |\n";
cout<<"*============================================================================*\n";
cout<<"| Normal
|
<120
|
<80
|\n";
cout<<"| Prehypertension
|
120-139
|
80-89
|\n";
cout<<"| High Blood Pressure,Stage 1 |
140-159
|
90-99
|\n";
cout<<"| High Blood Pressure,Stage 2 |
160-179
|
100-109
|\n";
cout<<"| Hypertensive Crisis
|
>180
|
>110
|\n";
cout<<"*============================================================================*\n";
//PATIENT'S INFO FOR BLOOD PRESSURE.
cout<<"Systolic BP of Patient
: "<<systolic;
cout<<"\nSystolic status
: "<<systolic_status;
cout<<"\n\nDiastolic BP of Patient
: "<<diastolic;
cout<<"\nDiastolic status
: "<<diastolic_status;
cout<<"\n\nBlood Pressure
: "<<systolic<<"/"<<diastolic<<""<<" mm Hg"<<endl<<
endl;
system("pause");
}
//FUNCTION TO DETERMINE EITHER PATIENT HAVE ALLERGY OR NOT.
void allergic1()
{
//ASK THE USER IF HE/SHE HAVE ALLERGY.
cout<<"\aDoes the patient have allergy?(Y/N) : ";
cin>>allergic;
//MULTIWAY SELECTION - ALLERGIC TYPE.
if(allergic=='Y'||allergic=='y')
{
cout<<"\a************************************\n";
cout<<"| Code
| Allergic
|\n";
cout<<"====================================\n";
cout<<"| 1.
| PEANUT
|\n";
cout<<"| 2.
| FISH
|\n";
cout<<"| 3.
| EGG
|\n";
cout<<"| 4.
| MILK
|\n";
cout<<"| 5.
| SOYA
|\n";
cout<<"| 6.
| WHEAT
|\n";
cout<<"| 7.
| OTHER
|\n";
cout<<"====================================\n";
cout<<"\nPlease enter the code of the alleric : ";
cin>>code;
if(code==1)
{
patient_allergic="PEANUT";
cout<<patient_allergic;
cout<<"\n";
}
else if(code==2)
{
patient_allergic="FISH";
cout<<patient_allergic;
cout<<"\n";
}
else if(code==3)
{
patient_allergic="EGG";
cout<<patient_allergic;
cout<<"\n";
}
else if(code==4)

29

{
patient_allergic="MILK";
cout<<patient_allergic;
cout<<"\n";
}
else if(code==5)
{
patient_allergic="SOYA";
cout<<patient_allergic;
cout<<"\n";
}
else if(code==6)
{
patient_allergic="WHEAT";
cout<<patient_allergic;
cout<<"\n";
}
else if(code==7)
{
cout<<"Please type the patient's allergic : ";
cin>>ws;
getline(cin,patient_allergic);
}
else
cout<<"INVALID CODE"<<endl;
}
cout<<"\n";
system("pause");
}
//FUNCTION TO DETERMINE EITHER PATIENT HAVE PREVIOUS ILLNESS OR NOT.
void previousill()
{
//ASK THE USER IF HE/SHE HAVE PREVIOUS ILLNESS.
cout<<"\aDoes the patient have any previous illness?\n";
cout<<"\nIf yes,Press(Y)---If no,Press(N) : ";
cin>>ill;
//MULTIWAY SELECTION - PREVIOUS ILLNESS.
if(ill=='y'||ill=='Y')
{
cout<<"\a----------------------"<<endl;
cout<<"| PREVIOUS ILLNESS |"<<endl;
cout<<"----------------------"<<endl;
cout<<"| 1. ASTHMA
|"<<endl;
cout<<"| 2. COLD
|"<<endl;
cout<<"| 3. HIGH FEVER
|"<<endl;
cout<<"| 4. MIGRAINE
|"<<endl;
cout<<"| 5. OTHERS
|"<<endl;
cout<<"----------------------"<<endl;
cout<<"\nPlease choose the code for the previous illness : ";
cin>>code_ill;
if(code_ill==1)
{
illness="ASTHMA";
cout<<illness<<endl;
}
else if(code_ill==2)
{
illness="COLD";
cout<<illness<<endl;
}
else if(code_ill==3)
{
illness="HIGH FEVER";
cout<<illness<<endl;
}
else if(code_ill==4)
{
illness="MIGRAINE";
cout<<illness<<endl;
}
else if(code_ill==5)
{
cout<<"Please state the previous illness : ";
cin>>ws;

30

getline(cin,illness);
}
else
cout<<"INVALID CODE"<<endl;
}
cout<<"\n";
system("pause");
}
//DISPLAY ALL PATIENT'S DATA ABOUT THEIR HEALTH.
void display()
{
//GENERATING LEFT-JUSTIFIED VALUE.
cout.setf(ios::left);
//GENERATING DECIMAL POINT VALUE.
cout.setf(ios::fixed);
cout.precision(2);
//I/0 MANIPULATOR - PATIENT'S HEALTH SLIP.
cout<<"\a\n";
cout<<"[=============================================================================]"<<e
ndl;
cout<<"|

PATIENT MEDICAL TRANSCRIPT

|"<<e

ndl;
cout<<"[-----------------------------------------------------------------------------]"<<e
ndl;
cout<<"|

|"<<e

ndl;
cout<<"|

ZZZ7777777ZZ7.

|"<<e

cout<<"|

77.

Z.

|"<<e

cout<<"|

Z7Z.

7.

|"<<e

cout<<"|

7ZZI.

.77ii.

|"<<e

cout<<"|

Z 77T.

.Z77.

|"<<e

cout<<"|

ZZ7....777.

|"<<e

ndl;
1IZ7

ndl;
77.

ndl;
ndl;
ndl;
ndl;
cout<<"| Z777ZZZZZ777..
Date :"<<setw(28)<<date<<setw(1)<<"|"<<
endl;
cout<<"|
|"<<e
ndl;
cout<<"[*****************************************************************************]"<<e
ndl;
cout<<"|
|"<<e
ndl;
cout<<setw(2)<<"|"<<setw(20)<<"Name Patient"<<setw(2)<<":"<<setw(54)<<patient<<setw(1)<<"|
"<<endl;
cout<<setw(2)<<"|"<<setw(20)<<"Address"<<setw(2)<<":"<<setw(54)<<address1<<"|"<<endl;
cout<<setw(2)<<"|"<<setw(20)<<" "<<setw(2)<<" "<<setw(54)<<address2<<"|"<<endl;
cout<<setw(2)<<"|"<<setw(20)<<"Age"<<setw(2)<<":"<<setw(3)<<age<<setw(51)<<" years"<<setw(
1)<<"|"<<endl;
cout<<setw(2)<<"|"<<setw(20)<<"Gender"<<setw(2)<<":"<<setw(54)<<gender1<<"|"<<endl;
cout<<setw(2)<<"|"<<setw(20)<<"Weight"<<setw(2)<<":"<<setw(5)<<weight<<setw(49)<<" kg"<<se
tw(1)<<"|"<<endl;
cout<<setw(2)<<"|"<<setw(20)<<"Height"<<setw(2)<<":"<<setw(5)<<height<<setw(49)<<" m"<<set
w(1)<<"|"<<endl;
cout<<setw(2)<<"|"<<setw(20)<<"BMI"<<setw(2)<<":"<<setw(54)<<BMI<<setw(1)<<"|"<<endl;
cout<<setw(2)<<"|"<<setw(20)<<"Body fat percentage"<<setw(2)<<":"<<setw(5)<<body_fat_perce
ntage<<setw(49)<<" %"<<setw(1)<<"|"<<endl;
cout<<setw(2)<<"|"<<setw(20)<<"Body metabolism rate"<<setw(2)<<":"<<setw(10)<<BMR<<setw(44
)<<" kcals/day"<<setw(1)<<"|"<<endl;
cout<<setw(2)<<"|"<<setw(20)<<"Blood Type"<<setw(2)<<":"<<setw(54)<<blood_type<<"|"<<endl;
cout<<setw(2)<<"|"<<setw(20)<<"Blood Pressure"<<setw(2)<<":"<<setw(3)<<systolic<<"/"<<setw
(3)<<diastolic<<setw(47)<<" mm Hg"<<setw(1)<<"|"<<endl;
cout<<setw(2)<<"|"<<setw(20)<<"Allergy"<<setw(2)<<":"<<setw(54)<<patient_allergic<<"|"<<en
dl;
cout<<setw(2)<<"|"<<setw(20)<<"Previous Illness"<<setw(2)<<":"<<setw(54)<<illness<<"|"<<en
dl;
cout<<"|
|"<<e
ndl;
cout<<"[*****************************************************************************]"<<e
ndl;
cout<<"|
THANK YOU VERY MUCH!
|"<<e
ndl;
cout<<"[=============================================================================]"<<e
ndl;

31

system("pause");
}

32

You might also like