diff --git a/snprc_ehr/resources/queries/study/demographicsArrival.query.xml b/snprc_ehr/resources/queries/study/demographicsArrival.query.xml index fb3b12d5d..6ed09cba9 100644 --- a/snprc_ehr/resources/queries/study/demographicsArrival.query.xml +++ b/snprc_ehr/resources/queries/study/demographicsArrival.query.xml @@ -26,6 +26,12 @@ query.description~eq=${MostRecentAcqDesc}& + + /query/executeQuery.view?schemaName=ehr_lookups& + query.queryName=acquisitionType& + query.description~eq=${MostRecentAcqCategory}& + + /query/executeQuery.view?schemaName=study& query.queryName=arrival& @@ -45,6 +51,12 @@ query.description~eq=${MostRecentAcqDesc}& + + /query/executeQuery.view?schemaName=ehr_lookups& + query.queryName=acquisitionType& + query.value~eq=${EarliestAcqCategory}& + + /query/executeQuery.view?schemaName=study& query.queryName=arrival& diff --git a/snprc_ehr/resources/queries/study/demographicsArrival.sql b/snprc_ehr/resources/queries/study/demographicsArrival.sql index bbe9739cc..de60786ba 100644 --- a/snprc_ehr/resources/queries/study/demographicsArrival.sql +++ b/snprc_ehr/resources/queries/study/demographicsArrival.sql @@ -9,12 +9,14 @@ SELECT T1.date as MostRecentAcq, T1.acquisitionType.value as MostRecentAcqType, T1.acquisitionType.Description as MostRecentAcqDesc, + T1.acquisitionType.category as MostRecentAcqCategory, T2.date as EarliestAcq, T2.acquisitionType.value as EarliestAcqType, T2.acquisitionType.Description as EarliestAcqDesc, + T2.acquisitionType.category as EarliestAcqCategory, - coalesce(T2.date, d.birth) as Center_Arrival, + coalesce(T2.date, d.birth) as Center_Arrival FROM study.demographics d @@ -29,4 +31,4 @@ LEFT JOIN study.arrival as t1 on t1.id = d.id and T1.qcstate.publicdata = true --date of first arrival LEFT JOIN study.arrival as t2 on t2.id = d.id and T2.qcstate.publicdata = true and t2.date = (select min(c1.date) from study.arrival as c1 - where t2.id = c1.id) \ No newline at end of file + where t2.id = c1.id) diff --git a/snprc_ehr/resources/queries/study/demographicsMostRecentDeparture.query.xml b/snprc_ehr/resources/queries/study/demographicsMostRecentDeparture.query.xml index c349d5285..963bd484d 100644 --- a/snprc_ehr/resources/queries/study/demographicsMostRecentDeparture.query.xml +++ b/snprc_ehr/resources/queries/study/demographicsMostRecentDeparture.query.xml @@ -26,6 +26,12 @@ query.description~eq=${MostRecentDispDesc}& + + /query/executeQuery.view?schemaName=ehr_lookups& + query.queryName=dispositionType& + query.description~eq=${MostRecentDispCategory}& + + /query/executeQuery.view?schemaName=study& query.queryName=departure& @@ -45,6 +51,12 @@ query.description~eq=${MostRecentDispDesc}& + + /query/executeQuery.view?schemaName=ehr_lookups& + query.queryName=dispositionType& + query.description~eq=${EarliestDispCategory}& + + Dispositions diff --git a/snprc_ehr/resources/queries/study/demographicsMostRecentDeparture.sql b/snprc_ehr/resources/queries/study/demographicsMostRecentDeparture.sql index db49a7c27..38907816b 100644 --- a/snprc_ehr/resources/queries/study/demographicsMostRecentDeparture.sql +++ b/snprc_ehr/resources/queries/study/demographicsMostRecentDeparture.sql @@ -9,10 +9,12 @@ SELECT T1.date as MostRecentDisp, T1.dispositionType.value as MostRecentDispType, T1.dispositionType.Description as MostRecentDispDesc, + T1.dispositionType.category as MostRecentDispCategory, T2.date as EarliestDisp, T2.dispositionType.value as EarliestDispType, - T2.dispositionType.Description as EarliestDispDesc + T2.dispositionType.Description as EarliestDispDesc, + T2.dispositionType.category as EarliestDispCategory FROM study.demographics d @@ -27,4 +29,4 @@ LEFT JOIN study.departure as t1 on t1.id = d.id and T1.qcstate.publicdata = true --date of first disposition LEFT JOIN study.departure as t2 on t2.id = d.id and T2.qcstate.publicdata = true and t2.date = (select min(c1.date) from study.departure as c1 - where t2.id = c1.id) \ No newline at end of file + where t2.id = c1.id)