apply start/end dates to qido search
This commit is contained in:
parent
2b8f527d8c
commit
8f284aafac
@ -126,11 +126,13 @@ function mapParams(params) {
|
|||||||
].join(',');
|
].join(',');
|
||||||
|
|
||||||
const parameters = {
|
const parameters = {
|
||||||
|
// Named
|
||||||
PatientName: params.patientName,
|
PatientName: params.patientName,
|
||||||
PatientID: params.patientId,
|
PatientID: params.patientId,
|
||||||
AccessionNumber: params.accessionNumber,
|
AccessionNumber: params.accessionNumber,
|
||||||
StudyDescription: params.studyDescription,
|
StudyDescription: params.studyDescription,
|
||||||
ModalitiesInStudy: params.modalitiesInStudy,
|
ModalitiesInStudy: params.modalitiesInStudy,
|
||||||
|
// Other
|
||||||
limit: params.limit || 101,
|
limit: params.limit || 101,
|
||||||
offset: params.offset || 0,
|
offset: params.offset || 0,
|
||||||
fuzzymatching: params.fuzzymatching === undefined ? false : true,
|
fuzzymatching: params.fuzzymatching === undefined ? false : true,
|
||||||
@ -138,10 +140,20 @@ function mapParams(params) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// build the StudyDate range parameter
|
// build the StudyDate range parameter
|
||||||
if (params.studyDateFrom || params.studyDateTo) {
|
if (params.startDate && params.endDate) {
|
||||||
const dateFrom = _dateToString(new Date(params.studyDateFrom));
|
parameters.StudyDate = `${params.startDate}-${params.endDate}`;
|
||||||
const dateTo = _dateToString(new Date(params.studyDateTo));
|
} else if (params.startDate) {
|
||||||
parameters.StudyDate = `${dateFrom}-${dateTo}`;
|
const today = new Date();
|
||||||
|
const DD = String(today.getDate()).padStart(2, '0');
|
||||||
|
const MM = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
|
||||||
|
const YYYY = today.getFullYear();
|
||||||
|
const todayStr = `${YYYY}${MM}${DD}`;
|
||||||
|
|
||||||
|
parameters.StudyDate = `${params.startDate}-${todayStr}`;
|
||||||
|
} else if (params.endDate) {
|
||||||
|
const oldDateStr = `19700102`;
|
||||||
|
|
||||||
|
parameters.StudyDate = `${oldDateStr}-${params.endDate}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the StudyInstanceUID parameter
|
// Build the StudyInstanceUID parameter
|
||||||
@ -163,22 +175,4 @@ function mapParams(params) {
|
|||||||
return final;
|
return final;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a QIDO date string for a date range query
|
|
||||||
* Assumes the year is positive, at most 4 digits long.
|
|
||||||
*
|
|
||||||
* @param date The Date object to be formatted
|
|
||||||
* @returns {string} The formatted date string
|
|
||||||
*/
|
|
||||||
function _dateToString(date) {
|
|
||||||
if (!date) return '';
|
|
||||||
let year = date.getFullYear().toString();
|
|
||||||
let month = (date.getMonth() + 1).toString();
|
|
||||||
let day = date.getDate().toString();
|
|
||||||
year = '0'.repeat(4 - year.length).concat(year);
|
|
||||||
month = '0'.repeat(2 - month.length).concat(month);
|
|
||||||
day = '0'.repeat(2 - day.length).concat(day);
|
|
||||||
return ''.concat(year, month, day);
|
|
||||||
}
|
|
||||||
|
|
||||||
export { mapParams, search, processResults };
|
export { mapParams, search, processResults };
|
||||||
|
|||||||
@ -77,10 +77,12 @@ const StudyListTableRow = props => {
|
|||||||
|
|
||||||
StudyListTableRow.propTypes = {
|
StudyListTableRow.propTypes = {
|
||||||
tableData: PropTypes.shape({
|
tableData: PropTypes.shape({
|
||||||
|
/** A table row represented by an array of "cell" objects */
|
||||||
row: PropTypes.arrayOf(
|
row: PropTypes.arrayOf(
|
||||||
PropTypes.shape({
|
PropTypes.shape({
|
||||||
key: PropTypes.string.isRequired,
|
key: PropTypes.string.isRequired,
|
||||||
content: PropTypes.node.isRequired,
|
/** Optional content to render in row's cell */
|
||||||
|
content: PropTypes.node,
|
||||||
/** Title attribute to use for provided content */
|
/** Title attribute to use for provided content */
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
gridCol: PropTypes.number.isRequired,
|
gridCol: PropTypes.number.isRequired,
|
||||||
|
|||||||
@ -93,10 +93,8 @@ function _getQueryFilterValues(query) {
|
|||||||
const queryFilterValues = {
|
const queryFilterValues = {
|
||||||
patientName: query.get('patientName'),
|
patientName: query.get('patientName'),
|
||||||
// mrn: query.get('mrn'), patientId?
|
// mrn: query.get('mrn'), patientId?
|
||||||
studyDate: {
|
startDate: query.get('startDate'),
|
||||||
startDate: query.get('startDate'),
|
endDate: query.get('endDate'),
|
||||||
endDate: query.get('endDate'),
|
|
||||||
},
|
|
||||||
studyDescription: query.get('description'),
|
studyDescription: query.get('description'),
|
||||||
//modalitiesInStudy: _tryParseJson(query.get('modality'), undefined),
|
//modalitiesInStudy: _tryParseJson(query.get('modality'), undefined),
|
||||||
accessionNumber: query.get('accession'),
|
accessionNumber: query.get('accession'),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user