@@ -1097,6 +1097,44 @@ export const fetchAccessExpirations: (
10971097 return response
10981098}
10991099
1100+ type fetchDiagnosticReportProps = {
1101+ _elements ?: string [ ]
1102+ size ?: number
1103+ offset ?: number
1104+ code ?: string
1105+ date ?: string
1106+ patient ?: string [ ]
1107+ study ?: string [ ]
1108+ encounter ?: string [ ]
1109+ _list ?: string [ ]
1110+ signal ?: AbortSignal
1111+ }
1112+ export const fetchDiagnosticReport = async ( args : fetchDiagnosticReportProps ) => {
1113+ const { _list, _elements, code, date, patient, study, encounter, size, offset, signal } = args
1114+ const config = getConfig ( )
1115+
1116+ let options : string [ ] = [ ]
1117+ if ( size !== undefined ) options = [ ...options , `_count=${ size } ` ]
1118+ if ( offset ) options = [ ...options , `_offset=${ offset } ` ]
1119+ if ( config . features . diagnosticReport . useStudyParam && study )
1120+ options = [ ...options , `study=${ study . reduce ( paramValuesReducer , '' ) } ` ]
1121+ if ( encounter ) options = [ ...options , `encounter=${ encounter . reduce ( paramValuesReducer , '' ) } ` ]
1122+ if ( patient ) options = [ ...options , `patient=${ patient . reduce ( paramValuesReducer , '' ) } ` ]
1123+ if ( date ) options = [ ...options , `date=${ date } ` ]
1124+ if ( code ) options = [ ...options , `code=${ code } ` ]
1125+ if ( _elements && _elements . length > 0 )
1126+ options = [ ...options , `_elements=${ _elements . filter ( uniq ) . reduce ( paramValuesReducer , '' ) } ` ]
1127+
1128+ if ( _list && _list . length > 0 ) options = [ ...options , `_list=${ _list . filter ( uniq ) . reduce ( paramValuesReducer , '' ) } ` ]
1129+
1130+ const queryString = options . length > 0 ? `?${ options . reduce ( paramsReducer , '' ) } ` : ''
1131+ const response = await apiFhir . get < FHIR_Bundle_Response < DiagnosticReport > > ( `/DiagnosticReport${ queryString } ` , {
1132+ signal
1133+ } )
1134+
1135+ return response
1136+ }
1137+
11001138export const fetchPerimeterAccesses = async ( perimeter : string ) : Promise < AxiosResponse < DataRights [ ] > > => {
11011139 const response = await apiBackend . get < DataRights [ ] > ( `accesses/accesses/my-data-rights/?perimeters_ids=${ perimeter } ` )
11021140 return response
0 commit comments