Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
patientName: searchData.patientName,
accessionNumber: searchData.accessionNumber,
studyDescription: searchData.studyDescription,
modalitiesInStudy: searchData.modalities,
studyDateFrom: searchData.studyDateFrom,
studyDateTo: searchData.studyDateTo,
limit: searchData.rowsPerPage,
offset: searchData.currentPage * searchData.rowsPerPage,
};
if (server.supportsFuzzyMatching) {
filter.fuzzymatching = true;
}
// TODO: add sorting
const promise = OHIF.studies.searchStudies(server, filter);
this.setState({
searchingStudies: true,
});
promise
.then(studies => {
if (!studies) {
studies = [];
}
const { field, order } = searchData.sortData;
let sortedStudies = studies.map(study => {
if (!moment(study.studyDate, 'MMM DD, YYYY', true).isValid()) {
study.studyDate = moment(study.studyDate, 'YYYYMMDD').format(
'MMM DD, YYYY'
);
queryFiltersArray.forEach(filter => {
const searchStudiesPromise = OHIF.studies.searchStudies(server, filter);
queryPromises.push(searchStudiesPromise);
});