Advertisement
Guest User

Untitled

a guest
Oct 1st, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. struct Patient
  8. {
  9. int ID;
  10. string firstName;
  11. string lastName;
  12. string address;
  13. int age;
  14. string nationality;
  15.  
  16.  
  17. struct Allergy {
  18. char Allergic;
  19. string typeOfAllergy;
  20. }a;
  21.  
  22.  
  23.  
  24. struct Surgery {
  25. char surgery;
  26. string typeOfSurgery;
  27. struct dateOfSurgery {
  28.  
  29. int day;
  30. int month;
  31. int year;
  32. //write a function to print it out!
  33. }dos;
  34. }s;
  35.  
  36.  
  37. string bloodType;
  38. double weight;
  39. double height;
  40. string physician;
  41. string insurance;
  42. Patient() {};
  43. Patient(int i, string fn, string ln, string a, int ag, string n, string bt, double w, double h, string ph,
  44. string in) {
  45. ID = i;
  46. firstName = fn;
  47. lastName = ln;
  48. address = a;
  49. age = ag;
  50. nationality = n;
  51. bloodType = bt;
  52. weight = w;
  53. height = h;
  54. physician = ph;
  55. insurance = in;
  56. cout << "First Name: " << firstName << endl;
  57.  
  58. };
  59.  
  60. };
  61.  
  62.  
  63.  
  64.  
  65. void DisplayMenu() {
  66.  
  67.  
  68. cout << "---------------------------------------------------------" << endl;
  69. cout << "Patient Management System (CSC301, Fall2016)" << endl;
  70. cout << "---------------------------------------------------------" << endl;
  71. cout << "1- Create a new patient file" << endl;
  72. cout << "2- Delete all patient files having the same nationality" << endl;
  73. cout << "3- Display all patients having the same nationality" << endl;
  74. cout << "4- Check if a particular patient exists based on his blood type and weight" << endl;
  75. cout << "0- Quit" << endl;
  76. cout << "---------------------------------------------------------" << endl;
  77. }
  78.  
  79. int UserMenuChoice() {
  80. int choice = 1000;
  81. while (choice > 4) {
  82. cout << "Your choice (0, 1, 2, 3, 4)?";
  83. cin >> choice;
  84. }
  85. return choice;
  86. }
  87.  
  88. void CreatePatient() {
  89. char moreData;
  90.  
  91. do {
  92. Patient patient1;
  93. cout << "Please enter the patient's ID: " << endl;
  94. cin >> patient1.ID;
  95. cout << "Please enter the patient's first name: " << endl;
  96. cin >> patient1.firstName;
  97. cout << "Please enter the patient's last name:" << endl;
  98. cin >> patient1.lastName;
  99. cout << "Please enter the patient's address: " << endl;
  100. cin >> patient1.address;
  101. cout << "Please enter the patient's age: " << endl;
  102. cin >> patient1.age;
  103. cout << "Please enter the patient's nationality: " << endl;
  104. cin >> patient1.nationality;
  105. cout << "Please enter the patient's blood Type: " << endl;
  106. cin >> patient1.bloodType;
  107. cout << "Please enter the patient's Weight: " << endl;
  108. cin >> patient1.weight;
  109. cout << "Please enter the patient's height: " << endl;
  110. cin >> patient1.height;
  111. cout << "Please enter the patient's physician: " << endl;
  112. cin >> patient1.physician;
  113.  
  114. /*cout << "Does the patient do any surgery ? Enter Y / N" << endl;
  115. cin >> patient1.s.surgery;
  116. if (patient1.s.surgery == ('y') || patient1.s.surgery == ('Y')) {
  117. cout << "When He/She did it ?/n Day ";
  118. cin >> patient1.s.dos.day;
  119. cout << " Month ";
  120. cin >> patient1.s.dos.month;
  121. cout << " Year ";
  122. cin >> patient1.s.dos.year;
  123. }
  124. else
  125. cout << ".................... " << endl;*/
  126.  
  127. cout << "Which Type Of Surgey did He/She do ? " << endl;
  128. cin >> patient1.s.typeOfSurgery;
  129.  
  130.  
  131.  
  132. cout << "Does the patient have Allergy? Enter Y / N" << endl;
  133. cin >> patient1.a.Allergic;
  134. if (patient1.a.Allergic == 'y' || patient1.a.Allergic == 'Y') {
  135. cout << "Which Type of allergy does He/She have ?? " << endl;
  136. cin >> patient1.a.typeOfAllergy;
  137. }
  138. else
  139. cout << ".................... " << endl;
  140.  
  141.  
  142.  
  143. cout << "Does the patient have insurance? Enter Yes / No" << endl;
  144. cin >> patient1.insurance;
  145. cout << "Do you want to input more data? Enter Y/N" << endl;
  146. cin >> moreData;
  147. } while (moreData == ('Y') || moreData == ('y'));
  148. }
  149.  
  150.  
  151.  
  152.  
  153. void DeletePatients() {
  154.  
  155. cout << "This function will delete all patients of the same Nationality. Proceed? Y/N";
  156. char choice;
  157. cin >> choice;
  158. if (choice == 'y' || choice == 'Y') {}
  159.  
  160. }
  161.  
  162. void ListPatients() {
  163. string d;
  164. int PatientArray[10]; //change this~~!
  165. for (int i = 0; i <= sizeof(PatientArray); i++) {
  166. PatientArray[i];
  167. //cout <<i<< d.Pateint(2132435,"fds","gfd") << endl;
  168.  
  169. }
  170.  
  171.  
  172. }
  173.  
  174. void SearchPatient() {
  175. ;// To be completed
  176. }
  177.  
  178. int main(int argc, char* argv[])
  179. {
  180.  
  181.  
  182.  
  183. int userChoice;
  184. do {
  185. Patient PatientArray[1000];
  186. system("cls"); // this clears the screen
  187. DisplayMenu();
  188. userChoice = UserMenuChoice();
  189. switch (userChoice) {
  190. case 1: CreatePatient(); break;
  191. case 2: DeletePatients(); break;
  192. case 3: ListPatients(); break;
  193. case 4: SearchPatient(); break;
  194. default: cout << "Thanks for using my CSC301's Patient Managenment System. Good Bye...";
  195. }
  196. } while (userChoice != 0);
  197. return 0;
  198. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement