Hi Marcel,
Thanks a mill for that. I ended up with exactly as you said, I'll put the scripts below for anyone else in a similar situation.
Here is WorkListQueryConverter0:
Code
-- Always filter by the calling AETitle
Data["0040,0001"] = Association.Calling;
-- Remove some filters that some modalities ask for, which cause problems
Data.RequestedProcedureID = nil;
if Data.ScheduledProcedureStepSequence then
Data.ScheduledProcedureStepSequence[0].ScheduledProcedureStepLocation = nil;
Data.ScheduledProcedureStepSequence[0].ScheduledStationName = nil
end
-- Next we overwrite the date/time of the results, we filter further in WorkListQueryResultConverter0
-- Note that we can't filter by time here, only date, since we can't use OR in the query we
-- can only filter out by dates outside the desired window in WorkListQueryResultConverter0
-- https://forum.image-systems.biz/forum/index.php?thread/50405-is-an-or-query-condition-possible/
startTimestamp = os.time(os.date('*t')) - (60 * 60 * 12)
endTimestamp = os.time(os.date('*t')) + (60 * 60 * 12)
startDate = os.date("%Y%m%d", startTimestamp)
endDate = os.date("%Y%m%d", endTimestamp)
startTime = os.date("%H%M%S", startTimestamp)
Data.ScheduledProcedureStepStartDate = startDate .. "-" .. endDate
-- This is here just to ensure the time is returned in the response, it doesnt exclude anything
Data.ScheduledProcedureStepStartTime = '000000-235959'
Display More
And here is ModalityWorklistQueryResultConverter0:
Code
startTimestamp = os.time(os.date('*t')) - (60 * 60 * 12)
endTimestamp = os.time(os.date('*t')) + (60 * 60 * 12)
startDate = os.date("%Y%m%d", startTimestamp)
endDate = os.date("%Y%m%d", endTimestamp)
startTime = os.date("%H%M%S", startTimestamp)
endTime = os.date("%H%M%S", endTimestamp)
-- Remove any result that is outside our window
if (Data.ScheduledProcedureStepStartDate and Data.ScheduledProcedureStepStartTime and Data.ScheduledProcedureStepStartDate <= startDate and Data.ScheduledProcedureStepStartTime < startTime) then
print("Skipping worklist result " .. Data.ScheduledProcedureStepStartDate .. " at " .. Data.ScheduledProcedureStepStartTime .. " because it's outside window of ".. startDate .. " " .. startTime .. " to " .. endDate .. " " .. endTime)
destroy()
end
if (Data.ScheduledProcedureStepStartDate and Data.ScheduledProcedureStepStartTime and Data.ScheduledProcedureStepStartDate >= endDate and Data.ScheduledProcedureStepStartTime > endTime) then
print("Skipping worklist result " .. Data.ScheduledProcedureStepStartDate .. " at " .. Data.ScheduledProcedureStepStartTime .. " because it's outside window of ".. startDate .. " " .. startTime .. " to " .. endDate .. " " .. endTime)
destroy()
end
print("Keeping worklist result " .. Data.ScheduledProcedureStepStartDate .. " at " .. Data.ScheduledProcedureStepStartTime .. " because it's within window of ".. startDate .. " " .. startTime .. " to " .. endDate .. " " .. endTime)
Display More
I'm more than happy to hear any improvements to these, so far it looks like it will do the trick quite nicely.
Thanks again marcelvanherk !