From f791547756adfb9475b699ee530d2f464b3a74b8 Mon Sep 17 00:00:00 2001 From: Paul Bui-Quang Date: Fri, 26 May 2023 11:03:23 +0200 Subject: [PATCH] fix: add missing type import (#778) --- src/components/DataTable/DataTablePatient.tsx | 6 ++++-- .../Patient/PatientHeader/PatientHeader.tsx | 4 ++-- .../Patient/PatientSidebar/PatientSidebar.tsx | 11 +++++++++-- src/services/aphp/serviceCohorts.ts | 2 +- src/state/patient.ts | 4 +++- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/components/DataTable/DataTablePatient.tsx b/src/components/DataTable/DataTablePatient.tsx index 43a19f3fd..876b7568d 100644 --- a/src/components/DataTable/DataTablePatient.tsx +++ b/src/components/DataTable/DataTablePatient.tsx @@ -115,7 +115,9 @@ const DataTablePatientLine: React.FC<{ } > - {patient.gender && } + {patient.gender && ( + + )} {deidentified ? 'Prénom' : capitalizeFirstLetter(patient.name?.[0].given?.[0])} {deidentified ? 'Nom' : patient.name?.map((e) => e.family).join(' ')} @@ -154,7 +156,7 @@ const DataTablePatientLine: React.FC<{ export default DataTablePatient type PatientGenderProps = { - gender: PatientGenderKind + gender?: PatientGenderKind className?: string } diff --git a/src/components/Patient/PatientHeader/PatientHeader.tsx b/src/components/Patient/PatientHeader/PatientHeader.tsx index b7f2a87c9..cfd6a1e0e 100644 --- a/src/components/Patient/PatientHeader/PatientHeader.tsx +++ b/src/components/Patient/PatientHeader/PatientHeader.tsx @@ -1,6 +1,6 @@ import React from 'react' -import { CohortPatient, IPatientDetails } from 'types' +import { CohortPatient, IPatientDetails, PatientGenderKind } from 'types' import Grid from '@mui/material/Grid' @@ -40,7 +40,7 @@ const PatientHeader: React.FC = ({ - + diff --git a/src/components/Patient/PatientSidebar/PatientSidebar.tsx b/src/components/Patient/PatientSidebar/PatientSidebar.tsx index 5b13a1e22..c2b9176a5 100644 --- a/src/components/Patient/PatientSidebar/PatientSidebar.tsx +++ b/src/components/Patient/PatientSidebar/PatientSidebar.tsx @@ -10,7 +10,14 @@ import ChevronRightIcon from '@mui/icons-material/ChevronRight' import { getAge, substructAgeString } from 'utils/age' import services from 'services/aphp' -import { CohortPatient, PatientFilters as PatientFiltersType, SearchByTypes, Sort, VitalStatus } from 'types' +import { + CohortPatient, + PatientFilters as PatientFiltersType, + PatientGenderKind, + SearchByTypes, + Sort, + VitalStatus +} from 'types' import useStyles from './styles' import moment from 'moment/moment' @@ -168,7 +175,7 @@ const PatientSidebar: React.FC = ({ firstName={deidentifiedBoolean ? 'Prénom' : patient.name?.[0].given?.[0] ?? ''} lastName={deidentifiedBoolean ? 'Nom' : patient.name?.map((e) => e.family).join(' ') ?? ''} age={getAge(patient)} - gender={patient.gender} + gender={patient.gender as PatientGenderKind} deceased={patient.deceasedDateTime ?? patient.deceasedBoolean} ipp={ deidentifiedBoolean diff --git a/src/services/aphp/serviceCohorts.ts b/src/services/aphp/serviceCohorts.ts index d09bb5d7b..2ff7e872e 100644 --- a/src/services/aphp/serviceCohorts.ts +++ b/src/services/aphp/serviceCohorts.ts @@ -34,7 +34,7 @@ import { import { ODD_EXPORT } from '../../constants' import apiBackend from '../apiBackend' -import { DocumentReference, Identifier } from 'fhir/r4' +import { DocumentReference, Identifier, Patient } from 'fhir/r4' export interface IServiceCohorts { /** diff --git a/src/state/patient.ts b/src/state/patient.ts index 7fc267d3e..75ed4966e 100644 --- a/src/state/patient.ts +++ b/src/state/patient.ts @@ -22,8 +22,10 @@ import { Condition, DocumentReference, Encounter, + Identifier, MedicationAdministration, MedicationRequest, + Observation, Patient, Procedure } from 'fhir/r4' @@ -1195,7 +1197,7 @@ function fillElementInformation< newElement.NDA = encounter?.id ?? 'Inconnu' if (!deidentifiedBoolean && encounter?.identifier) { - const nda = encounter.identifier.find((identifier: IIdentifier) => identifier.type?.coding?.[0].code === 'NDA') + const nda = encounter.identifier.find((identifier: Identifier) => identifier.type?.coding?.[0].code === 'NDA') if (nda) { newElement.NDA = nda?.value ?? 'Inconnu' }