Skip to content

Commit

Permalink
WADO: Include Study Description, Study Instance UID, Accession Number…
Browse files Browse the repository at this point in the history
… and the Referenced Request Sequence in SR rendered as HTML or TEXT dcm4che#1597
  • Loading branch information
vrindanayak committed Sep 20, 2018
1 parent 59220e2 commit 48f5325
Show file tree
Hide file tree
Showing 4 changed files with 228 additions and 39 deletions.
174 changes: 154 additions & 20 deletions dcm4chee-arc-conf-data/src/main/resources/dsr2html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@
</xsl:apply-templates>
<xsl:apply-templates mode="verifyingObserver" select="DicomAttribute[@tag='0040A073']/Item"/>
<xsl:apply-templates mode="authorObserver" select="DicomAttribute[@tag='0040A078']/Item"/>
<xsl:apply-templates mode="participant" select="DicomAttribute[@tag='0040A07A']/Item"/>
<xsl:call-template name="contentDateTime">
<xsl:with-param name="date" select="DicomAttribute[@tag='00080023']/Value"/>
<xsl:with-param name="time" select="DicomAttribute[@tag='00080033']/Value"/>
</xsl:call-template>
<xsl:call-template name="studyDetails"/>
<xsl:apply-templates mode="refReq" select="DicomAttribute[@tag='0040A370']/Item"/>
</table>
<hr/>
<xsl:call-template name="container">
Expand Down Expand Up @@ -367,24 +370,46 @@
</xsl:if>
</td>
<td>
<xsl:call-template name="formatDT">
<xsl:with-param name="dt" select="DicomAttribute[@tag='0040A030']/Value"/>
</xsl:call-template>
<xsl:text> - </xsl:text>
<xsl:call-template name="spanCode">
<xsl:with-param name="class">under</xsl:with-param>
<xsl:with-param name="code" select="DicomAttribute[@tag='0040A088']/Item"/>
<xsl:with-param name="text">
<xsl:call-template name="formatPN">
<xsl:with-param name="pnc" select="DicomAttribute[@tag='0040A075']/PersonName/Alphabetic"/>
</xsl:call-template>
</xsl:with-param>
<xsl:call-template name="formatDateIdPersonName">
<xsl:with-param name="dtTag" select="'0040A030'"/>
<xsl:with-param name="idTag" select="'0040A088'"/>
<xsl:with-param name="nameTag" select="'0040A075'"/>
</xsl:call-template>
<xsl:value-of select="concat(', ',DicomAttribute[@tag='0040A027']/Value)"/>
</td>
</tr>
</xsl:template>

<xsl:template match="Item" mode="participant">
<tr>
<td>
<xsl:if test="position()=1">
<b>Participant:</b>
</xsl:if>
</td>
<td>
<xsl:call-template name="formatDateIdPersonName">
<xsl:with-param name="dtTag" select="'0040A082'"/>
<xsl:with-param name="idTag" select="'00401101'"/>
<xsl:with-param name="nameTag" select="'0040A123'"/>
</xsl:call-template>
<xsl:variable name="participationType" select="DicomAttribute[@tag='0040A080']/Value"/>
<xsl:variable name="participationTypeLabel">
<xsl:choose>
<xsl:when test="$participationType = 'ENT'">
<xsl:value-of select="'Data Enterer'"/>
</xsl:when>
<xsl:when test="$participationType = 'ATTEST'">
<xsl:value-of select="'Attestor'"/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat(', ', $participationTypeLabel)"/>
</td>
</tr>
</xsl:template>

<xsl:template match="Item" mode="authorObserver">
<tr>
<td>
Expand All @@ -393,19 +418,41 @@
</xsl:if>
</td>
<td>
<xsl:call-template name="spanCode">
<xsl:with-param name="class">under</xsl:with-param>
<xsl:with-param name="code" select="DicomAttribute[@tag='00401101']/Item"/>
<xsl:with-param name="text">
<xsl:call-template name="formatPN">
<xsl:with-param name="pnc" select="DicomAttribute[@tag='0040A123']/PersonName/Alphabetic"/>
</xsl:call-template>
</xsl:with-param>
<xsl:call-template name="formatIdPersonName">
<xsl:with-param name="idTag" select="'00401101'"/>
<xsl:with-param name="nameTag" select="'0040A123'"/>
</xsl:call-template>
</td>
</tr>
</xsl:template>

<xsl:template name="formatDateIdPersonName">
<xsl:param name="dtTag"/>
<xsl:param name="idTag"/>
<xsl:param name="nameTag"/>
<xsl:call-template name="formatDT">
<xsl:with-param name="dt" select="DicomAttribute[@tag=$dtTag]/Value"/>
</xsl:call-template>
<xsl:text> - </xsl:text>
<xsl:call-template name="formatIdPersonName">
<xsl:with-param name="idTag" select="$idTag"/>
<xsl:with-param name="nameTag" select="$nameTag"/>
</xsl:call-template>
</xsl:template>

<xsl:template name="formatIdPersonName">
<xsl:param name="idTag"/>
<xsl:param name="nameTag"/>
<xsl:call-template name="code">
<xsl:with-param name="code" select="DicomAttribute[@tag=$idTag]/Item"/>
<xsl:with-param name="text">
<xsl:call-template name="formatPN">
<xsl:with-param name="pnc" select="DicomAttribute[@tag=$nameTag]/PersonName/Alphabetic"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:template>

<xsl:template name="contentDateTime">
<xsl:param name="date"/>
<xsl:param name="time"/>
Expand All @@ -423,6 +470,79 @@
</tr>
</xsl:template>

<xsl:template name="studyDetails">
<tr>
<td>
<b>Study Description:</b>
</td>
<td>
<xsl:value-of select="DicomAttribute[@tag='00081030']/Value"/>
</td>
</tr>
<tr>
<td>
<b>Referring Physician:</b>
</td>
<td>
<xsl:call-template name="formatPN">
<xsl:with-param name="pnc" select="DicomAttribute[@tag='00080090']/PersonName/Alphabetic"/>
</xsl:call-template>
</td>
</tr>
</xsl:template>

<xsl:template match="Item" mode="refReq">
<xsl:if test="position()=1">
<tr>
<td colspan="2">
<b>Referenced Request</b>
</td>
</tr>
<tr>
<td>
<b>Reason For Study:</b>
</td>
<td>
<xsl:value-of select="DicomAttribute[@tag='00401002']/Value"/>
</td>
</tr>
<tr>
<td>
<b>Study Description:</b>
</td>
<td>
<xsl:value-of select="DicomAttribute[@tag='00321060']/Value"/>
</td>
</tr>
<tr>
<td>
<b>Accession Number:</b>
</td>
<td>
<xsl:value-of select="DicomAttribute[@tag='00080050']/Value"/>
</td>
</tr>
<tr>
<td>
<b>Study Instance UID:</b>
</td>
<td>
<xsl:value-of select="DicomAttribute[@tag='0020000D']/Value"/>
</td>
</tr>
<tr>
<td>
<b>Referring Physician:</b>
</td>
<td>
<xsl:call-template name="formatPN">
<xsl:with-param name="pnc" select="DicomAttribute[@tag='00080090']/PersonName/Alphabetic"/>
</xsl:call-template>
</td>
</tr>
</xsl:if>
</xsl:template>

<xsl:template name="formatPN">
<xsl:param name="pnc"/>
<xsl:variable name="px" select="$pnc/NamePrefix"/>
Expand Down Expand Up @@ -508,6 +628,20 @@
</span>
</xsl:template>

<xsl:template name="code">
<xsl:param name="code"/>
<xsl:param name="text"/>
<xsl:value-of select="$text"/>
<xsl:if test="$code/DicomAttribute[@tag='00080100']/Value != ''">
<xsl:variable name="id">
<xsl:call-template name="formatCode">
<xsl:with-param name="code" select="$code"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat(', ', $id)"/>
</xsl:if>
</xsl:template>

<xsl:template name="spanCodeMeaning">
<xsl:param name="class"></xsl:param>
<xsl:param name="code"/>
Expand Down
31 changes: 31 additions & 0 deletions dcm4chee-arc-conf-data/src/main/resources/dsr2text.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
</xsl:apply-templates>
<xsl:apply-templates mode="verifyingObserver" select="DicomAttribute[@tag='0040A073']/Item"/>
<xsl:apply-templates mode="authorObserver" select="DicomAttribute[@tag='0040A078']/Item"/>
<xsl:apply-templates mode="participant" select="DicomAttribute[@tag='0040A07A']/Item"/>
<xsl:call-template name="contentDateTime">
<xsl:with-param name="date" select="DicomAttribute[@tag='00080023']/Value"/>
<xsl:with-param name="time" select="DicomAttribute[@tag='00080033']/Value"/>
Expand Down Expand Up @@ -288,6 +289,36 @@
<xsl:value-of select="concat(', ',DicomAttribute[@tag='0040A027']/Value,$br)"/>
</xsl:template>

<xsl:template match="Item" mode="participant">
<xsl:choose>
<xsl:when test="position()=1">Participant: </xsl:when>
<xsl:otherwise>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="formatDT">
<xsl:with-param name="dt" select="DicomAttribute[@tag='0040A082']/Value"/>
</xsl:call-template>
<xsl:text> - </xsl:text>
<xsl:call-template name="formatPN">
<xsl:with-param name="pnc" select="DicomAttribute[@tag='0040A123']/PersonName/Alphabetic"/>
</xsl:call-template>
<xsl:variable name="participationType" select="DicomAttribute[@tag='0040A080']/Value"/>
<xsl:variable name="participationTypeLabel">
<xsl:choose>
<xsl:when test="$participationType = 'ENT'">
<xsl:value-of select="'Data Enterer'"/>
</xsl:when>
<xsl:when test="$participationType = 'ATTEST'">
<xsl:value-of select="'Attestor'"/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat(', ', $participationTypeLabel)"/>
<xsl:value-of select="$br"/>
</xsl:template>

<xsl:template match="Item" mode="authorObserver">
<xsl:choose>
<xsl:when test="position()=1">Author Observers: </xsl:when>
Expand Down
61 changes: 42 additions & 19 deletions dcm4chee-arc-conf-data/src/main/resources/impax-report2sr.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<xsl:param name="StudyInstanceUID"/>
<xsl:param name="AccessionNumber"/>
<xsl:param name="StudyDescription"/>
<xsl:param name="ReferringPhysicianName"/>

<xsl:template match="/agfa:DiagnosticRadiologyReport">
<NativeDicomModel>
Expand Down Expand Up @@ -68,22 +69,31 @@
<xsl:template match="OrderDetails">
<xsl:param name="orderDetails"/>
<xsl:variable name="studyDesc" select="$orderDetails/StudyDetails/StudyDescription"/>
<xsl:variable name="referringPhysicianName" select="$orderDetails/ReferringPhysician/Name"/>
<xsl:variable name="studyIUID" select="$orderDetails/StudyDetails/StudyInstanceUID"/>
<!--Study Description-->
<xsl:if test="$StudyDescription = ''">
<xsl:if test="$StudyDescription = '' and $StudyInstanceUID = $studyIUID">
<xsl:call-template name="attr">
<xsl:with-param name="tag" select="'00081030'"/>
<xsl:with-param name="vr" select="'LO'"/>
<xsl:with-param name="val" select="$studyDesc"/>
</xsl:call-template>
</xsl:if>
<!--Referring Physician's Name-->
<xsl:if test="$ReferringPhysicianName = '' and $StudyInstanceUID = $studyIUID">
<xsl:call-template name="pnAttr">
<xsl:with-param name="tag" select="'00080090'"/>
<xsl:with-param name="val" select="$referringPhysicianName"/>
</xsl:call-template>
</xsl:if>
<!--Referenced Request Sequence-->
<DicomAttribute tag="0040A370" vr="SQ">
<Item number="1">
<!-- Study Instance UID -->
<xsl:call-template name="attr">
<xsl:with-param name="tag" select="'0020000D'"/>
<xsl:with-param name="vr" select="'UI'"/>
<xsl:with-param name="val" select="$orderDetails/StudyDetails/StudyInstanceUID"/>
<xsl:with-param name="val" select="$studyIUID"/>
</xsl:call-template>
<!--Accession Number-->
<xsl:call-template name="attr">
Expand Down Expand Up @@ -116,7 +126,7 @@
<!-- Referring Physician's Name -->
<xsl:call-template name="pnAttrs">
<xsl:with-param name="tag" select="'00080090'" />
<xsl:with-param name="val" select="$orderDetails/ReferringPhysician/Name" />
<xsl:with-param name="val" select="$referringPhysicianName" />
</xsl:call-template>
</Item>
</DicomAttribute>
Expand Down Expand Up @@ -154,25 +164,34 @@
<xsl:with-param name="val" select="$verificationFlag"/>
</xsl:call-template>
<!--Content Date/Time-->
<DicomAttribute tag="00080023" vr="DA">
<Value number="1">
<xsl:value-of select="$interpretationRecordDate"/></Value>
</DicomAttribute>
<DicomAttribute tag="00080033" vr="TM">
<Value number="1"><xsl:value-of select="$interpretationRecordTime"/></Value>
</DicomAttribute>
<xsl:call-template name="attr">
<xsl:with-param name="tag" select="'00080023'"/>
<xsl:with-param name="vr" select="'DA'"/>
<xsl:with-param name="val" select="$interpretationRecordDate"/>
</xsl:call-template>
<xsl:call-template name="attr">
<xsl:with-param name="tag" select="'00080033'"/>
<xsl:with-param name="vr" select="'TM'"/>
<xsl:with-param name="val" select="$interpretationRecordTime"/>
</xsl:call-template>
<xsl:if test="$verificationFlag = 'VERIFIED'">
<!-- Verifying Observer Sequence -->
<DicomAttribute tag="0040A073" vr="SQ">
<Item number="1">
<!-- Verifying Organization -->
<DicomAttribute tag="0040A027" vr="LO">
<Value number="1"><xsl:value-of select="$VerifyingOrganization"/></Value>
</DicomAttribute>
<xsl:call-template name="attr">
<xsl:with-param name="tag" select="'0040A027'"/>
<xsl:with-param name="vr" select="'LO'"/>
<xsl:with-param name="val" select="$VerifyingOrganization"/>
</xsl:call-template>
<!-- Verification DateTime -->
<DicomAttribute tag="0040A030" vr="DT">
<Value number="1"><xsl:value-of select="$interpretationApprovedDate"/><xsl:value-of select="$interpretationApprovedTime"/></Value>
</DicomAttribute>
<xsl:call-template name="attr">
<xsl:with-param name="tag" select="'0040A030'"/>
<xsl:with-param name="vr" select="'DT'"/>
<xsl:with-param name="val">
<xsl:value-of select="$interpretationApprovedDate"/><xsl:value-of select="$interpretationApprovedTime"/>
</xsl:with-param>
</xsl:call-template>
<!-- Verifying Observer Name -->
<xsl:call-template name="pnAttrs">
<xsl:with-param name="tag" select="'0040A075'" />
Expand Down Expand Up @@ -236,9 +255,13 @@
<xsl:with-param name="val" select="'ENT'"/>
</xsl:call-template>
<!-- Participation DateTime -->
<DicomAttribute tag="0040A082" vr="DT">
<Value number="1"><xsl:value-of select="$interpretationRecordDate"/><xsl:value-of select="$interpretationRecordTime"/></Value>
</DicomAttribute>
<xsl:call-template name="attr">
<xsl:with-param name="tag" select="'0040A082'"/>
<xsl:with-param name="vr" select="'DT'"/>
<xsl:with-param name="val">
<xsl:value-of select="$interpretationRecordDate"/><xsl:value-of select="$interpretationRecordTime"/>
</xsl:with-param>
</xsl:call-template>
<!-- Observer Type -->
<xsl:call-template name="attr">
<xsl:with-param name="tag" select="'0040A084'"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ private void xslt(String report, Attributes attrs) throws Exception {
setParamIfNotNull(t, "StudyInstanceUID", attrs);
setParamIfNotNull(t, "AccessionNumber", attrs);
setParamIfNotNull(t, "StudyDescription", attrs);
setParamIfNotNull(t, "ReferringPhysicianName", attrs);
t.transform(new StreamSource(new StringReader(report)), new SAXResult(new ContentHandlerAdapter(attrs)));
}

Expand Down

0 comments on commit 48f5325

Please sign in to comment.