Adding date filtering

This commit is contained in:
maltempi 2019-02-07 22:56:25 -02:00
parent a32a5f3612
commit db6d372dc4
2 changed files with 21 additions and 3 deletions

View File

@ -1 +1 @@
export default '3d1eff07addbc53ced948c42cac8bd351ff083df'; export default 'a32a5f36125c1dbdd1d6ac8b534529e436f983bb';

View File

@ -3,9 +3,13 @@ import PropTypes from 'prop-types';
import OHIF from 'ohif-core'; import OHIF from 'ohif-core';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import { StudyList } from 'react-viewerbase'; import { StudyList } from 'react-viewerbase';
import Header from '../components/Header';
import ConnectedHeader from '../connectedComponents/ConnectedHeader.js'; import ConnectedHeader from '../connectedComponents/ConnectedHeader.js';
const subtractDaysFromDate = (date, days) => {
date.setDate(date.getDate() - days);
return date;
};
class StudyListWithData extends Component { class StudyListWithData extends Component {
state = { state = {
searchData: {}, searchData: {},
@ -23,6 +27,13 @@ class StudyListWithData extends Component {
static rowsPerPage = 25; static rowsPerPage = 25;
static defaultSort = { field: 'patientName', order: 'desc' }; 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() { componentDidMount() {
// TODO: Avoid using timepoints here // TODO: Avoid using timepoints here
//const params = { studyInstanceUids, seriesInstanceUids, timepointId, timepointsFilter={} }; //const params = { studyInstanceUids, seriesInstanceUids, timepointId, timepointsFilter={} };
@ -33,7 +44,9 @@ class StudyListWithData extends Component {
searchForStudies = ( searchForStudies = (
searchData = { searchData = {
currentPage: 0, currentPage: 0,
rowsPerPage: StudyListWithData.rowsPerPage rowsPerPage: StudyListWithData.rowsPerPage,
studyDateFrom: StudyListWithData.defaultStudyDateFrom,
studyDateTo: StudyListWithData.defaultStudyDateTo
} }
) => { ) => {
const { server } = this.props; const { server } = this.props;
@ -43,6 +56,8 @@ class StudyListWithData extends Component {
accessionNumber: searchData.accessionNumber, accessionNumber: searchData.accessionNumber,
studyDescription: searchData.studyDescription, studyDescription: searchData.studyDescription,
modalitiesInStudy: searchData.modalitiesInStudy, modalitiesInStudy: searchData.modalitiesInStudy,
studyDateFrom: searchData.studyDateFrom,
studyDateTo: searchData.studyDateTo,
limit: limit:
searchData.currentPage * searchData.rowsPerPage + searchData.currentPage * searchData.rowsPerPage +
searchData.rowsPerPage, searchData.rowsPerPage,
@ -113,6 +128,9 @@ class StudyListWithData extends Component {
onSelectItem={this.onSelectItem} onSelectItem={this.onSelectItem}
pageSize={this.rowsPerPage} pageSize={this.rowsPerPage}
defaultSort={StudyListWithData.defaultSort} defaultSort={StudyListWithData.defaultSort}
studyListDateFilterNumDays={
StudyListWithData.studyListDateFilterNumDays
}
onSearch={this.onSearch} onSearch={this.onSearch}
/> />
</> </>