Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of test_patient_structure by
patients.h@1:060801821b1c, 2017-11-02 (annotated)
- Committer:
- CSTritt
- Date:
- Thu Nov 02 21:22:34 2017 +0000
- Revision:
- 1:060801821b1c
- Parent:
- 0:c435f76658b2
Initial version. Based on demo program by Dr. Sheila Ross.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
CSTritt | 1:060801821b1c | 1 | /* |
CSTritt | 1:060801821b1c | 2 | Project: PatientStructure |
CSTritt | 1:060801821b1c | 3 | File: patients.h (v. 1.0) |
CSTritt | 1:060801821b1c | 4 | |
CSTritt | 1:060801821b1c | 5 | Header file for patient data base using structure example. See main.cpp |
CSTritt | 1:060801821b1c | 6 | for details. |
CSTritt | 1:060801821b1c | 7 | |
CSTritt | 1:060801821b1c | 8 | Modified by Dr. C. S. Tritt |
CSTritt | 1:060801821b1c | 9 | */ |
CSTritt | 1:060801821b1c | 10 | // Defined in main. Used in main & patients.cpp, so declare in header file. |
CSTritt | 1:060801821b1c | 11 | // extern is rerequied to avoid duplicate objects that result in a linker |
CSTritt | 1:060801821b1c | 12 | // error. |
CSTritt | 1:060801821b1c | 13 | extern Serial pc; |
rossatmsoe | 0:c435f76658b2 | 14 | |
rossatmsoe | 0:c435f76658b2 | 15 | // The patient_record structure stores name and vitals for a patient. |
rossatmsoe | 0:c435f76658b2 | 16 | struct patient_record { |
rossatmsoe | 0:c435f76658b2 | 17 | char firstname[30]; |
rossatmsoe | 0:c435f76658b2 | 18 | char lastname[30]; |
rossatmsoe | 0:c435f76658b2 | 19 | int systolic; |
rossatmsoe | 0:c435f76658b2 | 20 | int diastolic; |
rossatmsoe | 0:c435f76658b2 | 21 | float spO2; |
rossatmsoe | 0:c435f76658b2 | 22 | }; |
rossatmsoe | 0:c435f76658b2 | 23 | |
rossatmsoe | 0:c435f76658b2 | 24 | // It is assumed that we will have an array of these patient records. |
rossatmsoe | 0:c435f76658b2 | 25 | // We define the maximum number of patients that we will support. |
rossatmsoe | 0:c435f76658b2 | 26 | #define MAX_PATIENTS 100 |
rossatmsoe | 0:c435f76658b2 | 27 | |
rossatmsoe | 0:c435f76658b2 | 28 | //Print the values in the structure for a particular patient. |
CSTritt | 1:060801821b1c | 29 | void print_patient_record(struct patient_record *first_patient, int N); |
rossatmsoe | 0:c435f76658b2 | 30 | //Put patient into record. |
CSTritt | 1:060801821b1c | 31 | void newPatient(struct patient_record *patient, char *first, char*last); |
rossatmsoe | 0:c435f76658b2 | 32 | //Fill in vital signs directly. Note that we use -> when we have a |
rossatmsoe | 0:c435f76658b2 | 33 | //pointer to a struct and we want to access one of the members. |
CSTritt | 1:060801821b1c | 34 | void recordBP(struct patient_record *patient, int sys, int dias, float o2); |
rossatmsoe | 0:c435f76658b2 | 35 | //Fill in vital signs through the serial monitor (for BP) and the oxygen sensor, |
rossatmsoe | 0:c435f76658b2 | 36 | //assumed to be an analog input giving the SpO2 level as a fraction. |
CSTritt | 1:060801821b1c | 37 | void recordBPinteractive(struct patient_record *first_patient, AnalogIn oxygen); |
rossatmsoe | 0:c435f76658b2 | 38 | //Look up the patient number by searching through the array of patients |
rossatmsoe | 0:c435f76658b2 | 39 | //and matching the first and last name. strcmp returns 0 if two strings |
rossatmsoe | 0:c435f76658b2 | 40 | //are identical. Return the patient's position in the array if name is |
rossatmsoe | 0:c435f76658b2 | 41 | //found, -1 if it is not found. |
CSTritt | 1:060801821b1c | 42 | int lookup_patient_name(struct patient_record *first_patient, char*first, |
CSTritt | 1:060801821b1c | 43 | char*last); |