diff --git a/src/components/Patient/PatientForms/MaternityForms/index.tsx b/src/components/Patient/PatientForms/MaternityForms/index.tsx index 4a61673c6..ec94366e2 100644 --- a/src/components/Patient/PatientForms/MaternityForms/index.tsx +++ b/src/components/Patient/PatientForms/MaternityForms/index.tsx @@ -23,12 +23,9 @@ import services from 'services/aphp' import { SourceType } from 'types/scope' import { useSearchParams } from 'react-router-dom' import { getCleanGroupId } from 'utils/paginationUtils' -<<<<<<< HEAD import { getCodeList } from 'services/aphp/serviceValueSets' import { getConfig } from 'config' -======= import MultiSelectInput from 'components/Filters/MultiSelectInput' ->>>>>>> 3de84b27 (ref: 2490-refacto filters - Ref gestion-de-projet#2371) const MaternityForm = () => { const [toggleModal, setToggleModal] = useState(false) diff --git a/src/services/aphp/callApi.ts b/src/services/aphp/callApi.ts index c938cd524..9153fafa5 100644 --- a/src/services/aphp/callApi.ts +++ b/src/services/aphp/callApi.ts @@ -1097,6 +1097,44 @@ export const fetchAccessExpirations: ( return response } +type fetchDiagnosticReportProps = { + _elements?: string[] + size?: number + offset?: number + code?: string + date?: string + patient?: string[] + study?: string[] + encounter?: string[] + _list?: string[] + signal?: AbortSignal +} +export const fetchDiagnosticReport = async (args: fetchDiagnosticReportProps) => { + const { _list, _elements, code, date, patient, study, encounter, size, offset, signal } = args + const config = getConfig() + + let options: string[] = [] + if (size !== undefined) options = [...options, `_count=${size}`] + if (offset) options = [...options, `_offset=${offset}`] + if (config.features.diagnosticReport.useStudyParam && study) + options = [...options, `study=${study.reduce(paramValuesReducer, '')}`] + if (encounter) options = [...options, `encounter=${encounter.reduce(paramValuesReducer, '')}`] + if (patient) options = [...options, `patient=${patient.reduce(paramValuesReducer, '')}`] + if (date) options = [...options, `date=${date}`] + if (code) options = [...options, `code=${code}`] + if (_elements && _elements.length > 0) + options = [...options, `_elements=${_elements.filter(uniq).reduce(paramValuesReducer, '')}`] + + if (_list && _list.length > 0) options = [...options, `_list=${_list.filter(uniq).reduce(paramValuesReducer, '')}`] + + const queryString = options.length > 0 ? `?${options.reduce(paramsReducer, '')}` : '' + const response = await apiFhir.get>(`/DiagnosticReport${queryString}`, { + signal + }) + + return response +} + export const fetchPerimeterAccesses = async (perimeter: string): Promise> => { const response = await apiBackend.get(`accesses/accesses/my-data-rights/?perimeters_ids=${perimeter}`) return response