From 35d6768908531cfe4c66443bfdeb724c4a41323b Mon Sep 17 00:00:00 2001 From: Shriya Reddy <87035616+reddyrose@users.noreply.github.com> Date: Sat, 9 Sep 2023 06:22:18 -0700 Subject: [PATCH] Symptom display added to the ECG tables (#95) --- src/components/ECGList/index.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/components/ECGList/index.js b/src/components/ECGList/index.js index 11f9379..2ac4494 100644 --- a/src/components/ECGList/index.js +++ b/src/components/ECGList/index.js @@ -52,6 +52,27 @@ export default function ECGList() { return humanReadableDate; } + const symptomDisplay = (ecg) => { + let symptom = `N/A` + + if (ecg.component[4].valueString === "present"){ + let n = 5; + while (ecg.component[n].valueString !== undefined){ + const new_symptom = ecg.component[n].code.coding[0].display + console.log(`${new_symptom} exists.`); + + symptom = `${symptom}, ${new_symptom}` + n += 1; + } + } + + if (symptom !== `N/A`){ + symptom = symptom.slice(5); + } + + return symptom; + } + const handleInputChange = (index, value) => { const updatedRows = [...names]; updatedRows[index] = value; @@ -196,10 +217,9 @@ export default function ECGList() {
- +

{firstName} {lastName}


-
@@ -209,6 +229,7 @@ export default function ECGList() { Date Watch Diagnosis Average Heart Rate (bpm) + Reported Symptoms Physician Assigned Diagnosis Tracing Quality Physician Initials @@ -225,6 +246,7 @@ export default function ECGList() { {dateToHumanReadable(ecg.effectivePeriod.start)} {ecg.component[2].valueString} {ecg.component[3].valueQuantity.value} + {symptomDisplay(ecg)}