From db6d372dc41bb7e45086438e33ebd3eefe7415a3 Mon Sep 17 00:00:00 2001 From: maltempi Date: Thu, 7 Feb 2019 22:56:25 -0200 Subject: [PATCH] Adding date filtering --- Packages-react/ohif-viewer/src/sha.js | 2 +- .../src/studylist/StudyListWithData.js | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Packages-react/ohif-viewer/src/sha.js b/Packages-react/ohif-viewer/src/sha.js index 6b6313be3..fd76e9804 100644 --- a/Packages-react/ohif-viewer/src/sha.js +++ b/Packages-react/ohif-viewer/src/sha.js @@ -1 +1 @@ -export default '3d1eff07addbc53ced948c42cac8bd351ff083df'; +export default 'a32a5f36125c1dbdd1d6ac8b534529e436f983bb'; diff --git a/Packages-react/ohif-viewer/src/studylist/StudyListWithData.js b/Packages-react/ohif-viewer/src/studylist/StudyListWithData.js index 5eb375889..b6e78c5cd 100644 --- a/Packages-react/ohif-viewer/src/studylist/StudyListWithData.js +++ b/Packages-react/ohif-viewer/src/studylist/StudyListWithData.js @@ -3,9 +3,13 @@ import PropTypes from 'prop-types'; import OHIF from 'ohif-core'; import { withRouter } from 'react-router-dom'; import { StudyList } from 'react-viewerbase'; -import Header from '../components/Header'; import ConnectedHeader from '../connectedComponents/ConnectedHeader.js'; +const subtractDaysFromDate = (date, days) => { + date.setDate(date.getDate() - days); + return date; +}; + class StudyListWithData extends Component { state = { searchData: {}, @@ -23,6 +27,13 @@ class StudyListWithData extends Component { static rowsPerPage = 25; static defaultSort = { field: 'patientName', order: 'desc' }; + static studyListDateFilterNumDays = 25000; // TODO: put this in the settings + static defaultStudyDateFrom = subtractDaysFromDate( + new Date(), + StudyListWithData.studyListDateFilterNumDays + ); + static defaultStudyDateTo = new Date(); + componentDidMount() { // TODO: Avoid using timepoints here //const params = { studyInstanceUids, seriesInstanceUids, timepointId, timepointsFilter={} }; @@ -33,7 +44,9 @@ class StudyListWithData extends Component { searchForStudies = ( searchData = { currentPage: 0, - rowsPerPage: StudyListWithData.rowsPerPage + rowsPerPage: StudyListWithData.rowsPerPage, + studyDateFrom: StudyListWithData.defaultStudyDateFrom, + studyDateTo: StudyListWithData.defaultStudyDateTo } ) => { const { server } = this.props; @@ -43,6 +56,8 @@ class StudyListWithData extends Component { accessionNumber: searchData.accessionNumber, studyDescription: searchData.studyDescription, modalitiesInStudy: searchData.modalitiesInStudy, + studyDateFrom: searchData.studyDateFrom, + studyDateTo: searchData.studyDateTo, limit: searchData.currentPage * searchData.rowsPerPage + searchData.rowsPerPage, @@ -113,6 +128,9 @@ class StudyListWithData extends Component { onSelectItem={this.onSelectItem} pageSize={this.rowsPerPage} defaultSort={StudyListWithData.defaultSort} + studyListDateFilterNumDays={ + StudyListWithData.studyListDateFilterNumDays + } onSearch={this.onSearch} />