From adcdf7c77f2ac314c8d415322be2585e040cadcb Mon Sep 17 00:00:00 2001 From: AdityaJ2305 Date: Thu, 30 Jan 2025 14:56:41 +0530 Subject: [PATCH 1/2] allergy add func --- src/components/Questionnaire/QuestionTypes/AllergyQuestion.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Questionnaire/QuestionTypes/AllergyQuestion.tsx b/src/components/Questionnaire/QuestionTypes/AllergyQuestion.tsx index 8270ae98c71..c1266f4d2e6 100644 --- a/src/components/Questionnaire/QuestionTypes/AllergyQuestion.tsx +++ b/src/components/Questionnaire/QuestionTypes/AllergyQuestion.tsx @@ -146,6 +146,7 @@ export function AllergyQuestion({ }, [patientAllergies]); const handleAddAllergy = (code: Code) => { + if (allergies.some((a) => a.code.code === code.code)) return; const newAllergies = [ ...allergies, { ...ALLERGY_INITIAL_VALUE, code }, From e6e99677aad85da89b52399f4712159f49b73bdb Mon Sep 17 00:00:00 2001 From: AdityaJ2305 Date: Thu, 30 Jan 2025 15:12:48 +0530 Subject: [PATCH 2/2] diag and symp add func --- src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx | 1 + src/components/Questionnaire/QuestionTypes/SymptomQuestion.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx b/src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx index b4aab2c07c4..6f92369e59d 100644 --- a/src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx +++ b/src/components/Questionnaire/QuestionTypes/DiagnosisQuestion.tsx @@ -116,6 +116,7 @@ export function DiagnosisQuestion({ }, [patientDiagnoses]); const handleAddDiagnosis = (code: Code) => { + if (diagnoses.some((d) => d.code.code === code.code)) return; const newDiagnoses = [ ...diagnoses, { ...DIAGNOSIS_INITIAL_VALUE, code }, diff --git a/src/components/Questionnaire/QuestionTypes/SymptomQuestion.tsx b/src/components/Questionnaire/QuestionTypes/SymptomQuestion.tsx index 94eba927251..b5bac4280c3 100644 --- a/src/components/Questionnaire/QuestionTypes/SymptomQuestion.tsx +++ b/src/components/Questionnaire/QuestionTypes/SymptomQuestion.tsx @@ -310,6 +310,7 @@ export function SymptomQuestion({ }, [patientSymptoms]); const handleAddSymptom = (code: Code) => { + if (symptoms.some((s) => s.code.code === code.code)) return; const newSymptoms = [ ...symptoms, { ...SYMPTOM_INITIAL_VALUE, code },