From: <gun...@us...> - 2007-12-27 13:23:15
|
Revision: 5621 http://dcm4che.svn.sourceforge.net/dcm4che/?rev=5621&view=rev Author: gunterze Date: 2007-12-27 05:23:11 -0800 (Thu, 27 Dec 2007) Log Message: ----------- [#DCMEE-671] Drop support of extraction of PDF document from received HL7 ORU^R01 messages [#DCMEE-672] Support extraction of PDF document from received HL7 MDM^T02 messages Modified Paths: -------------- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/dcm4chee-hl7/logmsg.xsl dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/xmdesc/dcm4chee-hl7oru-xmbean.xml dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/java/org/dcm4chex/archive/hl7/ORUService.java dcm4chee/dcm4jboss-docs/trunk/umlgraph/src/java/archive/ServiceMBeans.java Added Paths: ----------- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/dcm4chee-hl7/mdm2pdf.xsl dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/xmdesc/dcm4chee-hl7mdm-xmbean.xml dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/deploy/dcm4chee-hl7mdm-service.xml dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/java/org/dcm4chex/archive/hl7/MDMService.java dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/java/org/dcm4chex/archive/hl7/ORU_MDMService.java Removed Paths: ------------- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/dcm4chee-hl7/oru2pdf.xsl Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/dcm4chee-hl7/logmsg.xsl =================================================================== --- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/dcm4chee-hl7/logmsg.xsl 2007-12-20 18:56:26 UTC (rev 5620) +++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/dcm4chee-hl7/logmsg.xsl 2007-12-27 13:23:11 UTC (rev 5621) @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/> + <xsl:param name="maxlen">64</xsl:param> <xsl:template match="/hl7"> <xsl:apply-templates select="*"/> </xsl:template> @@ -25,18 +26,31 @@ </xsl:otherwise> </xsl:choose> <xsl:text>:</xsl:text> - <xsl:value-of select="normalize-space(text())"/> + <xsl:call-template name="prompt"> + <xsl:with-param name="value" select="text()"/> + </xsl:call-template> <xsl:apply-templates select="subcomponent"/> <xsl:apply-templates select="component"/> </xsl:if> </xsl:template> <xsl:template match="component"> <xsl:text>^</xsl:text> - <xsl:value-of select="normalize-space(text())"/> - <xsl:apply-templates select="subcomponent"/> + <xsl:call-template name="prompt"> + <xsl:with-param name="value" select="text()"/> + </xsl:call-template> + <xsl:apply-templates select="subcomponent"/> </xsl:template> <xsl:template match="subcomponent"> <xsl:text>&</xsl:text> - <xsl:value-of select="normalize-space(text())"/> + <xsl:call-template name="prompt"> + <xsl:with-param name="value" select="text()"/> + </xsl:call-template> </xsl:template> + <xsl:template name="prompt"> + <xsl:param name="value"/> + <xsl:value-of select="substring($value,1,$maxlen)"/> + <xsl:if test="string-length($value)>$maxlen"> + <xsl:text>[..]</xsl:text> + </xsl:if> + </xsl:template> </xsl:stylesheet> Added: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/dcm4chee-hl7/mdm2pdf.xsl =================================================================== --- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/dcm4chee-hl7/mdm2pdf.xsl (rev 0) +++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/dcm4chee-hl7/mdm2pdf.xsl 2007-12-27 13:23:11 UTC (rev 5621) @@ -0,0 +1,145 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + <xsl:output indent="yes" method="xml" /> + <xsl:template match="/hl7"> + <dataset> + <xsl:call-template name="common-attrs" /> + <xsl:apply-templates select="PID" /> + <xsl:apply-templates select="OBR" /> + <xsl:apply-templates select="TXA" /> + <xsl:apply-templates select="OBX" /> + </dataset> + </xsl:template> + <xsl:template name="common-attrs"> + <!--Specific Character Set--> + <attr tag="00080005" vr="CS">ISO_IR 100</attr> + <!--SOP Class UID--> + <attr tag="00080016" vr="UI">1.2.840.10008.5.1.4.1.1.104.1</attr> + <!--Study Date--> + <attr tag="00080020" vr="DA" /> + <!--Study Time--> + <attr tag="00080030" vr="TM" /> + <!--Accession Number--> + <attr tag="00080050" vr="SH" /> + <!--Modality--> + <attr tag="00080060" vr="CS">OT</attr> + <!--Conversion Type--> + <attr tag="00080064" vr="CS">SD</attr> + <!--Manufacturer--> + <attr tag="00080070" vr="LO" /> + <!--Referring Physician's Name--> + <attr tag="00080090" vr="PN" /> + <!--Study ID--> + <attr tag="00200010" vr="SH" /> + <!--Series Number--> + <attr tag="00200011" vr="IS">1</attr> + <!--Instance Number--> + <attr tag="00200013" vr="IS">1</attr> + <!--Burned In Annotation--> + <attr tag="00280301" vr="CS">YES</attr> + <!--MIME Type of Encapsulated Document--> + <attr tag="00420012" vr="LO">application/pdf</attr> + </xsl:template> + <xsl:template match="PID"> + <!--Patient's Name--> + <attr tag="00100010" vr="PN"> + <xsl:call-template name="xpn2pn"> + <xsl:with-param name="xpn" select="field[5]" /> + </xsl:call-template> + </attr> + <!--Patient ID--> + <attr tag="00100020" vr="LO"> + <xsl:value-of select="field[3]/text()" /> + </attr> + <!--Issuer of Patient ID--> + <attr tag="00100021" vr="LO"> + <xsl:value-of select="field[3]/component[3]" /> + </attr> + <!--Patient's Birth Date--> + <attr tag="00100030" vr="DA"> + <xsl:value-of select="field[7]/text()" /> + </attr> + <!--Patient's Sex--> + <attr tag="00100040" vr="CS"> + <xsl:value-of select="field[8]/text()" /> + </attr> + </xsl:template> + <xsl:template match="OBR"> + <!--Verification Flag (0040,A493)--> + <attr tag="0040A493" vr="CS"> + <xsl:variable name="status" select="field[25]/text()" /> + <xsl:choose> + <xsl:when test="$status='F'">VERIFIED</xsl:when> + <xsl:when test="$status='C'">VERIFIED</xsl:when> + <xsl:otherwise>UNVERIFIED</xsl:otherwise> + </xsl:choose> + </attr> + </xsl:template> + <xsl:template match="TXA"> + <xsl:variable name="iuid" select="field[12]/text()" /> + <!--SOP Instance UID--> + <attr tag="00080018" vr="UI"> + <xsl:value-of select="$iuid" /> + </attr> + <!--Series Instance UID--> + <attr tag="0020000E" vr="UI"> + <xsl:value-of select="concat($iuid,'.1')" /> + </attr> + </xsl:template> + <xsl:template match="OBX[field[2]='HD']"> + <!--Study Instance UID--> + <attr tag="0020000D" vr="UI"> + <xsl:value-of select="field[5]/text()" /> + </attr> + </xsl:template> + <xsl:template match="OBX[field[2]='ED']"> + <xsl:variable name="obsid" select="field[3]" /> + <xsl:variable name="obsidcode" select="$obsid/text()" /> + <xsl:variable name="obsidmeaning" select="$obsid/component[1]" /> + <xsl:variable name="obsidscheme" select="$obsid/component[2]" /> + <!--Concept Name Code Sequence--> + <attr tag="0040A043" vr="SQ"> + <xsl:if test="$obsidscheme"> + <item> + <!--Code Value--> + <attr tag="00080100" vr="SH"> + <xsl:value-of select="$obsidcode" /> + </attr> + <!--Coding Scheme Designator--> + <attr tag="00080102" vr="SH"> + <xsl:value-of select="$obsidscheme" /> + </attr> + <!--Code Meaning--> + <attr tag="00080104" vr="LO"> + <xsl:value-of select="$obsidmeaning" /> + </attr> + </item> + </xsl:if> + </attr> + <!--Document Title--> + <attr tag="00420010" vr="ST"> + <xsl:choose> + <xsl:when test="$obsidmeaning"> + <xsl:value-of select="$obsidmeaning" /> + </xsl:when> + <xsl:otherwise><!-- missing ^ prefix --> + <xsl:value-of select="$obsidcode" /> + </xsl:otherwise> + </xsl:choose> + </attr> + </xsl:template> + <xsl:template name="xpn2pn"> + <xsl:param name="xpn" /> + <xsl:param name="xpn25" select="$xpn/component" /> + <xsl:value-of select="$xpn/text()" /> + <xsl:text>^</xsl:text> + <xsl:value-of select="$xpn25[1]/text()" /> + <xsl:text>^</xsl:text> + <xsl:value-of select="$xpn25[2]/text()" /> + <xsl:text>^</xsl:text> + <xsl:value-of select="$xpn25[4]/text()" /> + <xsl:text>^</xsl:text> + <xsl:value-of select="$xpn25[3]/text()" /> + </xsl:template> +</xsl:stylesheet> Deleted: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/dcm4chee-hl7/oru2pdf.xsl =================================================================== --- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/dcm4chee-hl7/oru2pdf.xsl 2007-12-20 18:56:26 UTC (rev 5620) +++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/dcm4chee-hl7/oru2pdf.xsl 2007-12-27 13:23:11 UTC (rev 5621) @@ -1,129 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> - <xsl:output indent="yes" method="xml"/> - <xsl:template match="/hl7"> - <dataset> - <xsl:call-template name="common-attrs"/> - <xsl:apply-templates select="PID"/> - <xsl:apply-templates select="OBR"/> - <xsl:apply-templates select="OBX"/> - </dataset> - </xsl:template> - <xsl:template name="common-attrs"> - <!--Specific Character Set--> - <attr tag="00080005" vr="CS">ISO_IR 100</attr> - <!--SOP Class UID--> - <attr tag="00080016" vr="UI">1.2.840.10008.5.1.4.1.1.104.1</attr> - <!--Study Date--> - <attr tag="00080020" vr="DA"/> - <!--Study Time--> - <attr tag="00080030" vr="TM"/> - <!--Accession Number--> - <attr tag="00080050" vr="SH"/> - <!--Modality--> - <attr tag="00080060" vr="CS">OT</attr> - <!--Conversion Type--> - <attr tag="00080064" vr="CS">SD</attr> - <!--Manufacturer--> - <attr tag="00080070" vr="LO"/> - <!--Referring Physician's Name--> - <attr tag="00080090" vr="PN"/> - <!--Study ID--> - <attr tag="00200010" vr="SH"/> - <!--Series Number--> - <attr tag="00200011" vr="IS">1</attr> - <!--Instance Number--> - <attr tag="00200013" vr="IS">1</attr> - <!--Burned In Annotation--> - <attr tag="00280301" vr="CS">YES</attr> - <!--MIME Type of Encapsulated Document--> - <attr tag="00420012" vr="LO">application/pdf</attr> - </xsl:template> - <xsl:template match="PID"> - <!--Patient's Name--> - <attr tag="00100010" vr="PN"> - <xsl:call-template name="xpn2pn"> - <xsl:with-param name="xpn" select="field[5]"/> - </xsl:call-template> - </attr> - <!--Patient ID--> - <attr tag="00100020" vr="LO"> - <xsl:value-of select="field[3]/text()"/> - </attr> - <!--Issuer of Patient ID--> - <attr tag="00100021" vr="LO"> - <xsl:value-of select="field[3]/component[3]"/> - </attr> - <!--Patient's Birth Date--> - <attr tag="00100030" vr="DA"> - <xsl:value-of select="field[7]/text()"/> - </attr> - <!--Patient's Sex--> - <attr tag="00100040" vr="CS"> - <xsl:value-of select="field[8]/text()"/> - </attr> - </xsl:template> - <xsl:template match="OBR"> - <!--Verification Flag (0040,A493)--> - <attr tag="0040A493" vr="CS"> - <xsl:variable name="status" select="field[25]/text()"/> - <xsl:choose> - <xsl:when test="$status='F'">VERIFIED</xsl:when> - <xsl:when test="$status='C'">VERIFIED</xsl:when> - <xsl:otherwise>UNVERIFIED</xsl:otherwise> - </xsl:choose> - </attr> - </xsl:template> - <xsl:template match="OBX[field[2]='HD']"> - <!--Study Instance UID--> - <attr tag="0020000D" vr="UI"> - <xsl:value-of select="field[5]/text()"/> - </attr> - </xsl:template> - <xsl:template match="OBX[field[2]='ED']"> - <xsl:variable name="obsid" select="field[3]"/> - <!--Concept Name Code Sequence--> - <attr tag="0040A043" vr="SQ"> - <item> - <!--Code Value--> - <attr tag="00080100" vr="SH"> - <xsl:value-of select="$obsid/text()"/> - </attr> - <!--Coding Scheme Designator--> - <attr tag="00080102" vr="SH"> - <xsl:value-of select="$obsid/component[2]"/> - </attr> - <!--Code Meaning--> - <attr tag="00080104" vr="LO"> - <xsl:value-of select="$obsid/component[1]"/> - </attr> - </item> - </attr> - <!--Document Title--> - <attr tag="00420010" vr="ST"> - <xsl:value-of select="$obsid/component[1]"/> - </attr> - <xsl:variable name="iuid" select="field[5]/text()"/> - <!--SOP Instance UID--> - <attr tag="00080018" vr="UI"> - <xsl:value-of select="$iuid"/> - </attr> - <!--Series Instance UID--> - <attr tag="0020000E" vr="UI"> - <xsl:value-of select="concat($iuid,'.1')"/> - </attr> - </xsl:template> - <xsl:template name="xpn2pn"> - <xsl:param name="xpn"/> - <xsl:param name="xpn25" select="$xpn/component"/> - <xsl:value-of select="$xpn/text()"/> - <xsl:text>^</xsl:text> - <xsl:value-of select="$xpn25[1]/text()"/> - <xsl:text>^</xsl:text> - <xsl:value-of select="$xpn25[2]/text()"/> - <xsl:text>^</xsl:text> - <xsl:value-of select="$xpn25[4]/text()"/> - <xsl:text>^</xsl:text> - <xsl:value-of select="$xpn25[3]/text()"/> - </xsl:template> -</xsl:stylesheet> Added: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/xmdesc/dcm4chee-hl7mdm-xmbean.xml =================================================================== --- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/xmdesc/dcm4chee-hl7mdm-xmbean.xml (rev 0) +++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/xmdesc/dcm4chee-hl7mdm-xmbean.xml 2007-12-27 13:23:11 UTC (rev 5621) @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mbean PUBLIC + "-//JBoss//DTD JBOSS XMBEAN 1.1//EN" + "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_1.dtd"> + +<mbean> + <description><![CDATA[The <b>MDM HL7 Service</b> converts MDM^T02 messages + conveying a Base64 encoded PDF document according IHE Transaction CARD-7: + Encapsulated Report Submission, into DICOM encapsulated PDF documents, + so they can be retrieved by DICOM Retrieve or IHE RID.]]> + </description> + + <descriptors> + <persistence persistPolicy="OnUpdate"/> + <persistence-manager value="org.jboss.mx.persistence.DelegatingPersistenceManager" /> + </descriptors> + + <class>org.dcm4chex.archive.hl7.MDMService</class> + + <constructor> + <description>The default constructor</description> + <name>MDMService</name> + </constructor> + + <!-- Attributes --> + <attribute access="read-write" + getMethod="getMessageTypes" + setMethod="setMessageTypes"> + <description>Comma separated list of Message Types handled by this Service. + </description> + <name>MessageTypes</name> + <type>java.lang.String</type> + <descriptors> + <value value="MDM^T02" /> + </descriptors> + </attribute> + <attribute access="read-write" + getMethod="getStylesheet" + setMethod="setStylesheet"> + <description><![CDATA[Stylesheet for HL7 MDM^T02 to DICOM Encapsulated + PDF mapping. A relative path name is resolved relative to + <i>archive-install-directory</i>/server/default/.]]> + </description> + <name>Stylesheet</name> + <type>java.lang.String</type> + <descriptors> + <value value="conf/dcm4chee-hl7/mdm2pdf.xsl" /> + </descriptors> + </attribute> + <attribute access="read-write" + getMethod="getStorePriority" + setMethod="setStorePriority"> + <description>Store priority. Enumerated Values: LOW, MEDIUM, HIGH. + </description> + <name>StorePriority</name> + <type>java.lang.String</type> + <descriptors> + <value value="MEDIUM"/> + </descriptors> + </attribute> + <attribute access="read-write" + getMethod="getExportManagerName" + setMethod="setExportManagerName"> + <description>Used internally - do NOT modify. + </description> + <name>ExportManagerName</name> + <type>javax.management.ObjectName</type> + </attribute> + <attribute access="read-write" + getMethod="getHL7ServerName" + setMethod="setHL7ServerName"> + <description>Used internally - do NOT modify. + </description> + <name>HL7ServerName</name> + <type>javax.management.ObjectName</type> + </attribute> + <attribute access="read-write" + getMethod="getTemplatesServiceName" + setMethod="setTemplatesServiceName"> + <description>Used internally. Do NOT modify. + </description> + <name>TemplatesServiceName</name> + <type>javax.management.ObjectName</type> + </attribute> + &defaultAttributes; + + <!-- Operations --> + &defaultOperations; +</mbean> + Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/xmdesc/dcm4chee-hl7oru-xmbean.xml =================================================================== --- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/xmdesc/dcm4chee-hl7oru-xmbean.xml 2007-12-20 18:56:26 UTC (rev 5620) +++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/conf/xmdesc/dcm4chee-hl7oru-xmbean.xml 2007-12-27 13:23:11 UTC (rev 5621) @@ -4,9 +4,9 @@ "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_1.dtd"> <mbean> - <description><![CDATA[The <b>ORU HL7 Service</b> converts ORU^R01 into DICOM - structured reports, so a viewer can just use the PACS system to access - the report.]]> + <description><![CDATA[The <b>ORU HL7 Service</b> converts ORU^R01 messages + into DICOM structured reports, so a viewer can just use the PACS system to + access the report.]]> </description> <descriptors> @@ -34,32 +34,19 @@ </descriptors> </attribute> <attribute access="read-write" - getMethod="getSRStylesheet" - setMethod="setSRStylesheet"> + getMethod="getStylesheet" + setMethod="setStylesheet"> <description><![CDATA[Stylesheet for HL7 ORU^R01 to DICOM SR mapping. A relative path name is resolved relative to <i>archive-install-directory</i>/server/default/.]]> </description> - <name>SRStylesheet</name> + <name>Stylesheet</name> <type>java.lang.String</type> <descriptors> <value value="conf/dcm4chee-hl7/oru2sr.xsl" /> </descriptors> </attribute> <attribute access="read-write" - getMethod="getPDFStylesheet" - setMethod="setPDFStylesheet"> - <description><![CDATA[Stylesheet for HL7 ORU^R01 to DICOM Encapsulated - PDF mapping. A relative path name is resolved relative to - <i>archive-install-directory</i>/server/default/.]]> - </description> - <name>PDFStylesheet</name> - <type>java.lang.String</type> - <descriptors> - <value value="conf/dcm4chee-hl7/oru2pdf.xsl" /> - </descriptors> - </attribute> - <attribute access="read-write" getMethod="getObxIgnoreStati" setMethod="setObxIgnoreStati"> <description><![CDATA[List of OBX Stati that should be ignored by this service. <br/> @@ -90,7 +77,7 @@ <attribute access="read-write" getMethod="getExportManagerName" setMethod="setExportManagerName"> - <description>Used internally - do NOT modify. + <description>Used internally. Do NOT modify. </description> <name>ExportManagerName</name> <type>javax.management.ObjectName</type> @@ -98,7 +85,7 @@ <attribute access="read-write" getMethod="getHL7ServerName" setMethod="setHL7ServerName"> - <description>Used internally - do NOT modify. + <description>Used internally. Do NOT modify. </description> <name>HL7ServerName</name> <type>javax.management.ObjectName</type> Added: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/deploy/dcm4chee-hl7mdm-service.xml =================================================================== --- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/deploy/dcm4chee-hl7mdm-service.xml (rev 0) +++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/etc/deploy/dcm4chee-hl7mdm-service.xml 2007-12-27 13:23:11 UTC (rev 5621) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- $Id: dcm4chee-hl7oru-service.xml 3308 2007-05-06 23:35:51Z gunterze $ --> +<server> + <classpath codebase="lib" archives="dcm4chee-hl7.jar"/> + <mbean code="org.dcm4chex.archive.hl7.MDMService" + name="dcm4chee.archive:service=HL7Service,type=MDM" + xmbean-dd="xmdesc/dcm4chee-hl7mdm-xmbean.xml"> + <depends optional-attribute-name="HL7ServerName" + >dcm4chee.archive:service=HL7Server</depends> + <depends optional-attribute-name="ExportManagerName" + >dcm4chee.archive:service=ExportManager</depends> + <depends optional-attribute-name="TemplatesServiceName" + >dcm4chee.archive:service=Templates</depends> + </mbean> +</server> Added: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/java/org/dcm4chex/archive/hl7/MDMService.java =================================================================== --- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/java/org/dcm4chex/archive/hl7/MDMService.java (rev 0) +++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/java/org/dcm4chex/archive/hl7/MDMService.java 2007-12-27 13:23:11 UTC (rev 5621) @@ -0,0 +1,117 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is part of dcm4che, an implementation of DICOM(TM) in + * Java(TM), available at http://sourceforge.net/projects/dcm4che. + * + * The Initial Developer of the Original Code is + * Agfa-Gevaert Group. + * Portions created by the Initial Developer are Copyright (C) 2003-2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * See @authors listed below. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +package org.dcm4chex.archive.hl7; + +import java.io.File; +import java.util.Iterator; +import java.util.List; + +import javax.xml.transform.Transformer; +import javax.xml.transform.sax.SAXResult; + +import org.dcm4che.data.Dataset; +import org.dcm4che.data.DcmObjectFactory; +import org.dcm4che.dict.Tags; +import org.dcm4che.util.Base64; +import org.dcm4che.util.UIDGenerator; +import org.dcm4chex.archive.util.FileUtils; +import org.dom4j.Document; +import org.dom4j.Element; +import org.dom4j.io.DocumentSource; +import org.xml.sax.ContentHandler; + +/** + * @author Gunter Zeilinger <gun...@gm...> + * @version $Revision$ $Date$ + * @since Dec 27, 2007 + */ +public class MDMService extends ORU_MDMService { + + public boolean process(MSH msh, Document msg, ContentHandler hl7out) + throws HL7Exception { + try + { + byte[] pdf = getPDF(msg); + if (pdf == null) { + log.warn("Ignore received MDM^T02 without encapsulated report"); + return true; + } + Dataset doc = DcmObjectFactory.getInstance().newDataset(); + File xslFile = FileUtils.toExistingFile(xslPath); + Transformer t = templates.getTemplates(xslFile).newTransformer(); + t.transform(new DocumentSource(msg), new SAXResult( + doc.getSAXHandler2(null))); + if (!doc.containsValue(Tags.StudyInstanceUID)) { + log.info("No Study Instance UID in MDM - store report in new Study"); + doc.putUI(Tags.StudyInstanceUID, + UIDGenerator.getInstance().createUID()); + } + doc.putOB(Tags.EncapsulatedDocument, pdf); + storeSR(doc); + } + catch (Exception e) + { + throw new HL7Exception("AE", e.getMessage(), e); + } + return true; + } + + static String toString(Object el) { + return el != null ? ((Element) el).getText() : ""; + } + + private byte[] getPDF(Document msg) { + List obxs = msg.getRootElement().elements("OBX"); + for (Iterator iter = obxs.iterator(); iter.hasNext();) { + Element obx = (Element) iter.next(); + List fds = obx.elements(); + if ("ED".equals(toString(fds.get(1)))) { + List cmps = ((Element) fds.get(4)).elements(); + if ("PDF".equals(toString(cmps.get(1)))) { + String s = toString(cmps.remove(3)); + return Base64.base64ToByteArray(s); + } + } + } + // hl7/OBX[field[2]='ED']/field[5]/component[4] + // TODO Auto-generated method stub + return null; + } + +} Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/java/org/dcm4chex/archive/hl7/ORUService.java =================================================================== --- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/java/org/dcm4chex/archive/hl7/ORUService.java 2007-12-20 18:56:26 UTC (rev 5620) +++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/java/org/dcm4chex/archive/hl7/ORUService.java 2007-12-27 13:23:11 UTC (rev 5621) @@ -45,7 +45,6 @@ import java.util.Iterator; import java.util.List; -import javax.management.ObjectName; import javax.xml.transform.Transformer; import javax.xml.transform.sax.SAXResult; @@ -53,9 +52,7 @@ import org.dcm4che.data.DcmElement; import org.dcm4che.data.DcmObjectFactory; import org.dcm4che.dict.Tags; -import org.dcm4che.util.Base64; import org.dcm4che.util.UIDGenerator; -import org.dcm4chex.archive.config.DicomPriority; import org.dcm4chex.archive.ejb.jdbc.QueryCmd; import org.dcm4chex.archive.util.FileUtils; import org.dom4j.Document; @@ -69,52 +66,14 @@ * @since Jan 29, 2006 * */ -public class ORUService extends AbstractHL7Service +public class ORUService extends ORU_MDMService { private static final int DEFAULT_STATUS_FIELD_NR = 10;//Default: Field 11 is OBSERV RESULT STATUS private static final String NO_RESULT_STATUS = "NO_OBSERV_RESULT_STATUS"; private static final String NO_OBX = "NO_OBX"; - private String oru2srXslPath; - private String oru2pdfXslPath; - private ObjectName exportManagerName; - private int storePriority = 0; private HashSet obxIgnoreStati = new HashSet(); private int obxStatusFieldNr = DEFAULT_STATUS_FIELD_NR; - public String getSRStylesheet() { - return oru2srXslPath; - } - - public void setSRStylesheet(String path) { - this.oru2srXslPath = path; - } - - public final String getPDFStylesheet() { - return oru2pdfXslPath; - } - - public final void setPDFStylesheet(String path) { - this.oru2pdfXslPath = path; - } - - public final ObjectName getExportManagerName() - { - return exportManagerName; - } - - public final void setExportManagerName(ObjectName exportManagerName) - { - this.exportManagerName = exportManagerName; - } - - public final String getStorePriority() { - return DicomPriority.toString(storePriority); - } - - public final void setStorePriority(String storePriority) { - this.storePriority = DicomPriority.toCode(storePriority); - } - public void setObxIgnoreStati(String stati) { obxIgnoreStati.clear(); if ( stati.equalsIgnoreCase("NONE")) return; @@ -157,22 +116,12 @@ try { Dataset doc = DcmObjectFactory.getInstance().newDataset(); - byte[] pdf = getPDF(msg); - if (pdf != null) { - File xslFile = FileUtils.toExistingFile(oru2pdfXslPath); - Transformer t = templates.getTemplates(xslFile).newTransformer(); - t.transform(new DocumentSource(msg), new SAXResult( - doc.getSAXHandler2(null))); - doc.putOB(Tags.EncapsulatedDocument, pdf); - storeSR(doc); - } else { - File xslFile = FileUtils.toExistingFile(oru2srXslPath); - Transformer t = templates.getTemplates(xslFile).newTransformer(); - t.transform(new DocumentSource(msg), new SAXResult( - doc.getSAXHandler2(null))); - addIUIDs(doc); - storeSR(doc); - } + File xslFile = FileUtils.toExistingFile(xslPath); + Transformer t = templates.getTemplates(xslFile).newTransformer(); + t.transform(new DocumentSource(msg), new SAXResult( + doc.getSAXHandler2(null))); + addIUIDs(doc); + storeSR(doc); } catch (Exception e) { @@ -195,28 +144,6 @@ return ((Element) obxFields.get(obxStatusFieldNr)).getText(); } - static String toString(Object el) { - return el != null ? ((Element) el).getText() : ""; - } - - private byte[] getPDF(Document msg) { - List obxs = msg.getRootElement().elements("OBX"); - for (Iterator iter = obxs.iterator(); iter.hasNext();) { - Element obx = (Element) iter.next(); - List fds = obx.elements(); - if ("ED".equals(toString(fds.get(1)))) { - List cmps = ((Element) fds.get(4)).elements(); - if ("PDF".equals(toString(cmps.get(1)))) { - String s = toString(cmps.remove(3)); - return Base64.base64ToByteArray(s); - } - } - } - // hl7/OBX[field[2]='ED']/field[5]/component[4] - // TODO Auto-generated method stub - return null; - } - private void addIUIDs(Dataset sr) { UIDGenerator uidgen = UIDGenerator.getInstance(); if (!sr.containsValue(Tags.StudyInstanceUID)) { @@ -284,10 +211,4 @@ query.getDataset().getString(Tags.StudyInstanceUID)); } - private void storeSR(Dataset sr) throws Exception { - server.invoke(exportManagerName, "storeExportSelection", - new Object[]{sr, new Integer(storePriority)}, - new String[]{Dataset.class.getName(), int.class.getName()}); - } - } Added: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/java/org/dcm4chex/archive/hl7/ORU_MDMService.java =================================================================== --- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/java/org/dcm4chex/archive/hl7/ORU_MDMService.java (rev 0) +++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-hl7/src/java/org/dcm4chex/archive/hl7/ORU_MDMService.java 2007-12-27 13:23:11 UTC (rev 5621) @@ -0,0 +1,88 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is part of dcm4che, an implementation of DICOM(TM) in + * Java(TM), available at http://sourceforge.net/projects/dcm4che. + * + * The Initial Developer of the Original Code is + * Agfa-Gevaert Group. + * Portions created by the Initial Developer are Copyright (C) 2003-2005 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * See @authors listed below. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +package org.dcm4chex.archive.hl7; + +import javax.management.ObjectName; + +import org.dcm4che.data.Dataset; +import org.dcm4chex.archive.config.DicomPriority; + +/** + * @author Gunter Zeilinger <gun...@gm...> + * @version $Revision$ $Date$ + * @since Dec 27, 2007 + */ +public abstract class ORU_MDMService extends AbstractHL7Service { + + protected String xslPath; + protected ObjectName exportManagerName; + protected int storePriority; + + public final String getStylesheet() { + return xslPath; + } + + public final void setStylesheet(String path) { + this.xslPath = path; + } + + public final ObjectName getExportManagerName() + { + return exportManagerName; + } + + public final void setExportManagerName(ObjectName exportManagerName) + { + this.exportManagerName = exportManagerName; + } + + public final String getStorePriority() { + return DicomPriority.toString(storePriority); + } + + public final void setStorePriority(String storePriority) { + this.storePriority = DicomPriority.toCode(storePriority); + } + + protected void storeSR(Dataset sr) throws Exception { + server.invoke(exportManagerName, "storeExportSelection", + new Object[]{sr, new Integer(storePriority)}, + new String[]{Dataset.class.getName(), int.class.getName()}); + } +} Modified: dcm4chee/dcm4jboss-docs/trunk/umlgraph/src/java/archive/ServiceMBeans.java =================================================================== --- dcm4chee/dcm4jboss-docs/trunk/umlgraph/src/java/archive/ServiceMBeans.java 2007-12-20 18:56:26 UTC (rev 5620) +++ dcm4chee/dcm4jboss-docs/trunk/umlgraph/src/java/archive/ServiceMBeans.java 2007-12-27 13:23:11 UTC (rev 5621) @@ -425,6 +425,22 @@ * @depend - - - ExportManager * @depend - - - Templates */ +class MDMService {} + +/** + * @view + * @opt hide + * + * @match context archive.MDMService + * @opt !hide + */ +class mdmService {} + +/** + * @depend - - - HL7Server + * @depend - - - ExportManager + * @depend - - - Templates + */ class ORUService {} /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |