LT-291: Fixing location on measurement table and synchronizing the default location for same measurement number
This commit is contained in:
parent
86f511bdf9
commit
9a459e69f8
@ -2,37 +2,6 @@ export const FieldLesionLocation = {
|
|||||||
type: String,
|
type: String,
|
||||||
label: 'Lesion Location',
|
label: 'Lesion Location',
|
||||||
allowedValues: [
|
allowedValues: [
|
||||||
'',
|
|
||||||
'abdominalChestWall',
|
|
||||||
'adrenal',
|
|
||||||
'bladder',
|
|
||||||
'bone',
|
|
||||||
'brain',
|
|
||||||
'breast',
|
|
||||||
'colon',
|
|
||||||
'esophagus',
|
|
||||||
'extremities',
|
|
||||||
'gallbladder',
|
|
||||||
'kidney',
|
|
||||||
'liver',
|
|
||||||
'lung',
|
|
||||||
'lymphNode',
|
|
||||||
'mediastinumHilum',
|
|
||||||
'muscle',
|
|
||||||
'neck',
|
|
||||||
'otherSoftTissue',
|
|
||||||
'ovary',
|
|
||||||
'pancreas',
|
|
||||||
'pelvis',
|
|
||||||
'peritoneumOmentum',
|
|
||||||
'prostate',
|
|
||||||
'retroperitoneum',
|
|
||||||
'smallBowel',
|
|
||||||
'spleen',
|
|
||||||
'stomach',
|
|
||||||
'subcutaneous'
|
|
||||||
],
|
|
||||||
valuesLabels: [
|
|
||||||
'',
|
'',
|
||||||
'Abdominal/Chest Wall',
|
'Abdominal/Chest Wall',
|
||||||
'Adrenal',
|
'Adrenal',
|
||||||
|
|||||||
@ -56,17 +56,38 @@ Template.dialogNonTargetMeasurement.onRendered(() => {
|
|||||||
instance.viewerData = Blaze.getData(viewerMain);
|
instance.viewerData = Blaze.getData(viewerMain);
|
||||||
|
|
||||||
const measurementApi = instance.viewerData.measurementApi;
|
const measurementApi = instance.viewerData.measurementApi;
|
||||||
|
const timepointApi = instance.viewerData.timepointApi;
|
||||||
|
|
||||||
const measurementData = instance.data.measurementData;
|
const measurementData = instance.data.measurementData;
|
||||||
const collection = measurementApi[instance.measurementTypeId];
|
const collection = measurementApi[instance.measurementTypeId];
|
||||||
|
|
||||||
// Get the current inserted measurement from the collection
|
// Get the current inserted measurement from the collection
|
||||||
const currentMeasurement = collection.findOne({
|
const currentMeasurement = collection.findOne({ _id: measurementData._id });
|
||||||
_id: measurementData._id
|
|
||||||
|
// Check if it's a edition or creation
|
||||||
|
if (instance.data.edit) {
|
||||||
|
// Set the data that is already defined for current measurement
|
||||||
|
form.value(currentMeasurement);
|
||||||
|
} else {
|
||||||
|
// LT-112 Non-target response shall default to non-measurable on baseline, present on follow-up
|
||||||
|
const timepoint = timepointApi.study(measurementData.studyInstanceUid)[0];
|
||||||
|
const response = timepoint && timepoint.timepointType === 'baseline' ? 'NE' : 'Present';
|
||||||
|
|
||||||
|
// Get a previously inserted Non-target
|
||||||
|
const previousMeasurement = collection.findOne({
|
||||||
|
_id: { $not: measurementData._id },
|
||||||
|
measurementNumber: currentMeasurement.measurementNumber
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set the data that is already defined
|
// Change the location for current measurement if it's not the first one
|
||||||
form.value(currentMeasurement);
|
const location = previousMeasurement && previousMeasurement.location;
|
||||||
|
|
||||||
|
// Set the default location and response
|
||||||
|
form.value({
|
||||||
|
location,
|
||||||
|
response
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Synchronize the measurement number with the one inserted in the collection
|
// Synchronize the measurement number with the one inserted in the collection
|
||||||
measurementData.measurementNumber = currentMeasurement.measurementNumber;
|
measurementData.measurementNumber = currentMeasurement.measurementNumber;
|
||||||
@ -85,13 +106,18 @@ Template.dialogNonTargetMeasurement.onRendered(() => {
|
|||||||
|
|
||||||
// Update the location and response after confirming the dialog data
|
// Update the location and response after confirming the dialog data
|
||||||
instance.data.promise.then(formData => {
|
instance.data.promise.then(formData => {
|
||||||
|
// Update the response for current measurement
|
||||||
collection.update({
|
collection.update({
|
||||||
_id: measurementData._id,
|
_id: measurementData._id,
|
||||||
}, {
|
}, {
|
||||||
$set: {
|
$set: { response: formData.response }
|
||||||
location: formData.location,
|
});
|
||||||
response: formData.response
|
|
||||||
}
|
// Change the location for all Non-Target measurements with the same measurementNumber
|
||||||
|
collection.update({
|
||||||
|
measurementNumber: currentMeasurement.measurementNumber
|
||||||
|
}, {
|
||||||
|
$set: { location: formData.location }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user