-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclinic.h
216 lines (157 loc) · 6.03 KB
/
clinic.h
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/*/////////////////////////////////////////////////////////////////////////
Assignment 1 - Milestone 3
Full Name : Jagbir Singh
Student ID#: 144019221
Email : [email protected]
Section : NBB
Authenticity Declaration:
I declare this submission is the result of my own work and has not been
shared with any other student or 3rd party content provider. This submitted
piece of work is entirely of my own creation.
/////////////////////////////////////////////////////////////////////////*/
// SAFE-GUARD:
// It is good practice to apply safe-guards to header files
// Safe-guard's ensures only 1 copy of the header file is used in the project build
// The macro name should be mirroring the file name with _ for spaces, dots, etc.
#ifndef CLINIC_H
#define CLINIC_H
//////////////////////////////////////
// Module macro's (usable by any file that includes this header)
//////////////////////////////////////
// Display formatting options (Provided to student)
// !!! DO NOT MODIFY THESE MACRO'S !!!
#define FMT_FORM 1
#define FMT_TABLE 2
// C Strings: array sizes
#define NAME_LEN 15
#define PHONE_DESC_LEN 4
#define PHONE_LEN 10
// MS#3 Additional macro's:
// ToDo:
#define MIN_INTERVAL 30
#define START_HOUR 10
#define END_HOUR 14
//////////////////////////////////////
// Structures
//////////////////////////////////////
// Data type: Phone
// (Copy your code from MS#2)
struct Phone {
char description[PHONE_DESC_LEN + 1];
char number[PHONE_LEN];
};
// Data type: Patient
// (Copy your code from MS#2)
struct Patient {
int patientNumber;
char name[NAME_LEN];
struct Phone phone;
};
// ------------------- MS#3 -------------------
// Data type: Time
// ToDo:
struct Time {
int hour;
int min;
};
// Data type: Date
// ToDo:
struct Date {
int year;
int month;
int day;
};
// Data type: Appointment
// ToDo:
struct Appointment {
int patientNumber;
struct Date date;
struct Time time;
};
// ClinicData type: Provided to student
// !!! DO NOT MODIFY THIS DATA TYPE !!!
struct ClinicData
{
struct Patient* patients;
int maxPatient;
struct Appointment* appointments;
int maxAppointments;
};
//////////////////////////////////////
// DISPLAY FUNCTIONS
//////////////////////////////////////
// Display's the patient table header (table format)
void displayPatientTableHeader(void);
// Displays a single patient record in FMT_FORM | FMT_TABLE format
void displayPatientData(const struct Patient* patient, int fmt);
// Display's appointment schedule headers (date-specific or all records)
void displayScheduleTableHeader(const struct Date* date, int isAllRecords);
// Display a single appointment record with patient info. in tabular format
void displayScheduleData(const struct Patient* patient,
const struct Appointment* appoint,
int includeDateField);
//////////////////////////////////////
// MENU & ITEM SELECTION FUNCTIONS
//////////////////////////////////////
// Menu: Main
void menuMain(struct ClinicData* data);
// Menu: Patient Management
void menuPatient(struct Patient patient[], int max);
// Menu: Patient edit
void menuPatientEdit(struct Patient* patient);
// Menu: Appointment Management
void menuAppointment(struct ClinicData* data);
// Display's all patient data in the FMT_FORM | FMT_TABLE format
void displayAllPatients(const struct Patient patient[], int max, int fmt);
// Search for a patient record based on patient number or phone number
void searchPatientData(const struct Patient patient[], int max);
// Add a new patient record to the patient array
void addPatient(struct Patient patient[], int max);
// Edit a patient record from the patient array
void editPatient(struct Patient patient[], int max);
// Remove a patient record from the patient array
void removePatient(struct Patient patient[], int max);
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Milestone #3 mandatory functions...
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Sorting appointment by using bubble sort
void bubbleSort(struct Appointment* appoints, int max);
// View ALL scheduled appointments
// Todo:
void viewAllAppointments(struct ClinicData data[]);
// View appointment schedule for the user input date
// Todo:
void viewAppointmentSchedule(struct ClinicData data[]);
// Add an appointment record to the appointment array
// Todo:
void addAppointment(struct Appointment* appointments, int maxAppointments, const struct Patient* patients, int maxPatient);
// Remove an appointment record from the appointment array
// Todo:
void removeAppointment(struct Appointment* appointments, int maxAppointments, struct Patient* patients, int maxPatients);
//////////////////////////////////////
// UTILITY FUNCTIONS
//////////////////////////////////////
// Search and display patient record by patient number (form)
void searchPatientByPatientNumber(const struct Patient patient[], int max);
// Search and display patient records by phone number (tabular)
void searchPatientByPhoneNumber(const struct Patient patient[], int max);
// Get the next highest patient number
int nextPatientNumber(const struct Patient patient[], int max);
// Find the patient array index by patient number (returns -1 if not found)
int findPatientIndexByPatientNum(int patientNumber,
const struct Patient patient[], int max);
//////////////////////////////////////
// USER INPUT FUNCTIONS
//////////////////////////////////////
// Get user input for a new patient record
void inputPatient(struct Patient* patient);
// Get user input for phone contact information
void inputPhoneData(struct Phone* phone);
//////////////////////////////////////
// FILE FUNCTIONS
//////////////////////////////////////
// Import patient data from file into a Patient array (returns # of records read)
int importPatients(const char* datafile, struct Patient patients[], int max);
// Import appointment data from file into an Appointment array (returns # of records read)
int importAppointments(const char* datafile, struct Appointment appoints[], int max);
#endif // !CLINIC_H