From b07034c64e286e5d7bdd057c60cfc192d1b0b984 Mon Sep 17 00:00:00 2001 From: Joy A Date: Wed, 10 Apr 2024 12:14:10 +0530 Subject: [PATCH] #171 | Search by subject name (cherry picked from commit 0e0a0e5fb4013060056aa4389e47b50e4e8dc5a0) --- client/components/ImageList.tsx | 13 ++++++++++++- client/model/ImageType.ts | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/client/components/ImageList.tsx b/client/components/ImageList.tsx index 9725c65..4bec0a4 100644 --- a/client/components/ImageList.tsx +++ b/client/components/ImageList.tsx @@ -51,6 +51,7 @@ export default function ImageList() { const [encounter, setEncounterType] = useState([]); const [program, setProgramType] = useState([]); const [subject, setSubjectType] = useState([]); + const [subjectName, setSubjectName] = useState(); const [dataBody, setDataBody] = useState(); const [conceptData, setConceptData] = useState([]); const [mediaConcepts, setMediaConcepts] = useState([]); @@ -697,6 +698,7 @@ export default function ImageList() { } const body = Object.fromEntries( Object.entries({ + subjectName: subjectName, subjectTypeNames: subject, programNames: program, encounterTypeNames: encounter, @@ -717,7 +719,7 @@ export default function ImageList() { } filtersData(); resetSelections(); - }, [date, subject, encounter, program, toDate, fromDate, add, codedConcept, numericConcept, dateTimeConcept, conceptDates, textConcept, noteConcept, selectedMediaConcepts]); + }, [date, subject, subjectName, encounter, program, toDate, fromDate, add, codedConcept, numericConcept, dateTimeConcept, conceptDates, textConcept, noteConcept, selectedMediaConcepts]); const handleApplyFilter = async () => { redirectIfNotValid(); @@ -779,6 +781,15 @@ export default function ImageList() {
+
+ setSubjectName(e.target.value)} + placeholder="Subject Name" + /> +
{locationFilter && ( locationFilter.map( (locationIndex: { name: string; id: number; level: number; parent: any }, index: Key) => { diff --git a/client/model/ImageType.ts b/client/model/ImageType.ts index 741bfab..5b683db 100644 --- a/client/model/ImageType.ts +++ b/client/model/ImageType.ts @@ -14,6 +14,7 @@ export interface imageType { address: string; subjectFirstName: string; subjectLastName: string + subjectMiddleName: string url: string entityId: number; } @@ -28,6 +29,7 @@ export interface imageMetadata { export const getImageName = function(image: imageType, minLevelName: string) { const lowestLevelAddress = getLowestLocation(image.address, minLevelName) return `${image.subjectFirstName ? image.subjectFirstName : ''} + ${image.subjectMiddleName ? '_' + image.subjectMiddleName : ''} ${image.subjectLastName ? '_' + image.subjectLastName : ''} ${image.subjectTypeName ? '_' + image.subjectTypeName : ''} ${image.encounterTypeName ? '_' + image.encounterTypeName : ''}