Scheduled Station in ORM

1,225 views
Skip to first unread message

Andrea V. F.

unread,
Feb 17, 2014, 8:42:31 AM2/17/14
to dcm...@googlegroups.com
I'm trying to send scheduled station information into ORM messages for MWL, but with no success.
i have read various forum and topics, but can't make it working.

I attach my orm2dcm.xsl file.

The server.log contains these entryies:

2014-02-17 13:02:01,803 INFO  -> (TCPServer-2) [org.dcm4chex.archive.hl7.HL7ServerService] Received HL7 message:
2014-02-17 13:02:01,803 INFO  -> (TCPServer-2) [org.dcm4chex.archive.hl7.HL7ServerService] 
   MSH-3:7edit.com
   MSH-5:7edit.com
   MSH-7:20110121081423
   MSH-9:ORM^O01
   MSH-10:MSG00001
   MSH-11:P
   MSH-12:2.6
   PID-3:ID_PAZ
   PID-5:Cognome^Nome
   PID-7:20110101
   PID-8:M
   PV1-2:I
   PV1-8:Doctor
   PV1-19:1
   PV1-51:I
   ORC-1:NW
   ORC-2:2156286^1^2^3
   ORC-3:32323232^1^2^3
   ORC-4:4
   ORC-9:20060221061809
   OBR-1:1
   OBR-2:2156286
   OBR-18:ACCNumber
   OBR-19:1.2.840.10008.5.1.4.1.1.9.1.1
   OBR-24:ECG
   ZDS-1:1.2.40.0.13.1.1.2589342649.20110117103321927.32779
   ZDS-2:ECG-2550
   ZDS-3:TEST ECG-2550
2014-02-17 13:02:01,803 INFO  -> (TCPServer-2) [org.dcm4chex.archive.mbean.TemplatesService] Style sheet found:C:\apps\dcm4chee-2.17.1-mysql\server\default\conf\dcm4chee-hl7\orm2dcm.xsl
2014-02-17 13:02:01,819 WARN  -> (TCPServer-2) [org.dcm4cheri.data.StringElement] Value: 1.2.840.10008.5.1.4.1.1.9.1.1 exeeds VR length limit: 16
2014-02-17 13:02:01,819 INFO  -> (TCPServer-2) [org.dcm4chex.archive.hl7.ORMService] No Scheduled Station AET - use default: UNKOWN
2014-02-17 13:02:01,819 INFO  -> (TCPServer-2) [org.dcm4chex.archive.hl7.ORMService] No Scheduled Station Name - use default: UNKOWN
2014-02-17 13:02:01,819 INFO  -> (TCPServer-2) [org.dcm4chex.archive.hl7.ORMService] No SPS Start Date - use current date/time
2014-02-17 13:02:01,819 INFO  -> (TCPServer-2) [org.dcm4chex.archive.hl7.ORMService] Schedule Procedure Step[id:null] of Requested Procedure[id:1.2.840.10008.5.1.4.1.1.9.1.1, uid:1.2.40.0.13.1.1.2589342649.20110117103321927.32779] of Order[accNo:ACCNumber] for Patient [name:Cognome^Nome,id:ID_PAZ]
2014-02-17 13:02:01,850 INFO  -> (TCPServer-2) [org.dcm4chex.archive.ejb.entity.MWLItemBean] Created MWLItem[pk=4, spsId=S4, spsStartDateTime=2014-02-17 13:02:01.819, spsStatus=SCHEDULED, stationAET=UNKOWN, rqProcId=1.2.840.10008.5.1.4.1.1.9.1.1, modality=ECG, accessionNo=ACCNumber, patient->ejb/Patient:1]
2014-02-17 13:02:02,131 INFO  -> (TCPServer-2) [org.dcm4cheri.server.ServerImpl] finished - Socket[addr=/127.0.0.1,port=1123,localport=2575]


and this is my HL7 message:

MSH|^~\&|editor||editor||20110121081423||ORM^O01|MSG00001|P|2.6
PID|||ID_PAZ||Cognome^Nome||20110101|M||||||||||
PV1||I||||||Doctor|||||||||||1||||||||||||||||||||||||||||||||I
ORC|NW|2156286^1^2^3|32323232^1^2^3|4|||||20060221061809||||||||
OBR|1|2156286||||||||||||||||ACCNumber|1.2.840.10008.5.1.4.1.1.9.1.1|||||ECG||||||||||||||||||||
ZDS|1.2.40.0.13.1.1.2589342649.20110117103321927.32779|ScheduledAET|Scheduled Station name

I have also entered the "ScheduledAET" and "Scheduled Station name" entry with modality ECG into the Device table of the DB

Thank you for helping.
orm2dcm.xsl

fleetwoodfc

unread,
Feb 18, 2014, 8:02:00 AM2/18/14
to dcm...@googlegroups.com
Scheduled AE and Station Name need to be attributes of the Scheduled Procedure Step Sequence i.e

<dataset>
<attr tag="00080005" vr="CS">ISO_IR 100</attr>
<xsl:apply-templates select="PID"/>
<xsl:apply-templates select="PV1"/>
<xsl:apply-templates select="ORC[1]"/>
<xsl:apply-templates select="OBR[1]"/>
<!--  Scheduled Procedure Step Sequence  -->
<attr tag="00400100" vr="SQ">
<xsl:apply-templates select="ORC" mode="sps"/>
<xsl:apply-templates select="ZDS" mode="sps"/>
</attr>
<xsl:apply-templates select="ZDS"/>
</dataset>
........

<xsl:template match="ZDS" mode="sps">
<!--  Scheduled Station AE Title  -->
<xsl:call-template name="attr">
<xsl:with-param name="tag" select="'00400001'"/>
<xsl:with-param name="vr" select="'AE'"/>
<xsl:with-param name="val" select="string(field[2]/text())"/>
</xsl:call-template>
<!--
Scheduled Station Name (set to the same field as AE title)
-->
<xsl:call-template name="attr">
<xsl:with-param name="tag" select="'00400010'"/>
<xsl:with-param name="vr" select="'AE'"/>
<xsl:with-param name="val" select="string(field[3]/text())"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="ZDS">
<!--  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="string(field[1]/text())"/>
</xsl:call-template>
</xsl:call-template>
</xsl:template>



Andrea V. F.

unread,
Feb 18, 2014, 9:37:08 AM2/18/14
to dcm...@googlegroups.com
Thank you, Now the error has changed as follow:

2014-02-18 15:31:41,812 ERROR -> (TCPServer-2-1) [STDERR] ERROR:  'attr'
2014-02-18 15:31:41,812 WARN  -> (TCPServer-2-1) [org.dcm4chex.archive.hl7.HL7ServerService] Processing HL7 failed:
org.dcm4chex.archive.hl7.HL7Exception: org.xml.sax.SAXException: attr
java.lang.IllegalArgumentException: state:0
at org.dcm4chex.archive.hl7.ORMService.process(ORMService.java:272)
at org.dcm4chex.archive.hl7.ORMService.process(ORMService.java:213)
at org.dcm4chex.archive.hl7.HL7ServerService.handle(HL7ServerService.java:503)
at org.dcm4cheri.server.ServerImpl.run(ServerImpl.java:288)
at org.dcm4cheri.util.LF_ThreadPool.join(LF_ThreadPool.java:174)
at org.dcm4cheri.util.LF_ThreadPool$1.run(LF_ThreadPool.java:221)
at java.lang.Thread.run(Thread.java:724)
Caused by: javax.xml.transform.TransformerException: org.xml.sax.SAXException: attr
java.lang.IllegalArgumentException: state:0
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:752)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:353)
at org.dcm4chex.archive.hl7.AbstractHL7Service.xslt(AbstractHL7Service.java:138)
at org.dcm4chex.archive.hl7.ORMService.process(ORMService.java:224)
... 6 more
Caused by: org.xml.sax.SAXException: attr
java.lang.IllegalArgumentException: state:0
at org.dcm4cheri.data.SAXHandlerAdapter2.endElement(SAXHandlerAdapter2.java:138)
at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:265)
at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:559)
at orm2dcm.template$dot$11()
at orm2dcm.applyTemplates()
at orm2dcm.applyTemplates()
at orm2dcm.transform()
at com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:617)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:742)
... 9 more
Caused by: java.lang.IllegalArgumentException: state:0
at org.dcm4cheri.data.SAXHandlerAdapter2.onEndElement(SAXHandlerAdapter2.java:187)
at org.dcm4cheri.data.SAXHandlerAdapter2.endElement(SAXHandlerAdapter2.java:128)
... 17 more
2014-02-18 15:31:41,890 INFO  -> (TCPServer-2-1) [org.dcm4cheri.server.ServerImpl] finished - Socket[addr=/127.0.0.1,port=1106,localport=2575]

fleetwoodfc

unread,
Feb 18, 2014, 11:19:54 AM2/18/14
to dcm...@googlegroups.com
Possibly an error in the xsl file - need more information  

Alessandro Alla

unread,
Mar 5, 2016, 4:55:26 PM3/5/16
to dcm4che
I had the same problem. After splitting ZDS with SPS mode.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" indent="yes"/>
    <xsl:include href="common.xsl"/>
    <xsl:template match="/hl7">
        <dataset>
<attr tag="00080005" vr="CS">ISO_IR 100</attr>
<xsl:apply-templates select="PID"/>
<xsl:apply-templates select="PV1"/>
<xsl:apply-templates select="ORC[1]"/>
<xsl:apply-templates select="OBR[1]"/>
<!--  Scheduled Procedure Step Sequence  -->
<attr tag="00400100" vr="SQ">
<xsl:apply-templates select="ORC" mode="sps"/>
<xsl:apply-templates select="ZDS" mode="sps"/>
</attr>
<xsl:apply-templates select="ZDS"/>
        </dataset>
    </xsl:template>
    <xsl:template match="PV1">
        <!-- Referring Physican Name -->
        <xsl:call-template name="cn2pnAttr">
            <xsl:with-param name="tag" select="'00080090'"/>
            <xsl:with-param name="cn" select="field[8]"/>
        </xsl:call-template>
        <xsl:call-template name="pregnancyStatus">
            <xsl:with-param name="ambulantStatus" select="string(field[15]/text())"/>
        </xsl:call-template>
        <!-- Admission ID, Issuer -->
        <attr tag="00380010" vr="LO">
            <xsl:value-of select="string(field[19]/text())"/>
        </attr>
        <xsl:variable name="issuerOfAdmissionID"
                      select="string(field[19]/component[3]/text())" />
        <xsl:if test="$issuerOfAdmissionID">
            <!-- Issuer of Admission ID Sequence -->
            <attr tag="00380014" vr="SQ">
                <item>
                    <!-- Local Namespace Entity ID -->
                    <attr tag="00400031" vr="UT">
                        <xsl:value-of select="$issuerOfAdmissionID" />
                    </attr>
                </item>
            </attr>
        </xsl:if>
        <xsl:call-template name="cx2attrs">
            <xsl:with-param name="idtag" select="'00380010'"/>
            <xsl:with-param name="istag" select="'00380011'"/>
            <xsl:with-param name="cx" select="field[19]"/>
        </xsl:call-template>
    </xsl:template>
    <xsl:template name="pregnancyStatus">
        <xsl:param name="ambulantStatus"/>        
        <xsl:if test="normalize-space($ambulantStatus)">
          <attr tag="001021C0" vr="US">
            <xsl:if test="$ambulantStatus = 'B6'">3</xsl:if>
          </attr>
        </xsl:if>
    </xsl:template>
    <xsl:template match="ORC[1]">
        <!-- Placer Order Number -->
        <xsl:call-template name="ei2attr">
            <xsl:with-param name="tag" select="'00402016'"/>
            <xsl:with-param name="ei" select="field[2]"/>
        </xsl:call-template>
        <!-- Filler Order Number -->
        <xsl:call-template name="ei2attr">
            <xsl:with-param name="tag" select="'00402017'"/>
            <xsl:with-param name="ei" select="field[3]"/>
        </xsl:call-template>
        <xsl:call-template name="procedurePriority">
            <xsl:with-param name="priority" select="string(field[7]/component[5]/text())"/>
        </xsl:call-template>
    </xsl:template>
    <xsl:template name="procedurePriority">
        <xsl:param name="priority"/>
        <xsl:if test="normalize-space($priority)">
            <attr tag="00401003" vr="CS">
                <xsl:choose>
                    <xsl:when test="$priority = 'S'">STAT</xsl:when>
                    <xsl:when test="$priority = 'A' or $priority = 'P' or $priority = 'C' ">HIGH</xsl:when>
                    <xsl:when test="$priority = 'R'">ROUTINE</xsl:when>
                    <xsl:when test="$priority = 'T'">MEDIUM</xsl:when>
                </xsl:choose>
            </attr>
        </xsl:if>
    </xsl:template>
    <xsl:template match="OBR[1]">
        <!-- Accession Number -->
        <xsl:call-template name="attr">
            <xsl:with-param name="tag" select="'00080050'"/>
            <xsl:with-param name="vr" select="'SH'"/>
            <xsl:with-param name="val" select="string(field[18]/text())"/>
        </xsl:call-template>
        <!-- Medical Alerts -->
        <xsl:call-template name="attr">
            <xsl:with-param name="tag" select="'00102000'"/>
            <xsl:with-param name="vr" select="'LO'"/>
            <xsl:with-param name="val" select="substring(field[13]/text(),1,64)"/>
        </xsl:call-template>
        <!-- Requesting Physician -->
        <xsl:call-template name="cn2pnAttr">
            <xsl:with-param name="tag" select="'00321032'"/>
            <xsl:with-param name="cn" select="field[16]"/>
        </xsl:call-template>
        <!-- Requested Procedure Description -->
        <xsl:call-template name="attr">
            <xsl:with-param name="tag" select="'00321060'"/>
            <xsl:with-param name="vr" select="'LO'"/>
            <xsl:with-param name="val" select="field[44]/component[1]"/>
        </xsl:call-template>
        <!-- Requested Procedure Code Sequence -->
        <xsl:call-template name="codeItem">
            <xsl:with-param name="sqtag" select="'00321064'"/>
            <xsl:with-param name="code" select="string(field[44]/text())"/>
            <xsl:with-param name="scheme" select="string(field[44]/component[2]/text())"/>
            <xsl:with-param name="meaning" select="substring(field[44]/component[1]/text(),1,64)"/>
        </xsl:call-template>
        <!-- Patient State -->
        <xsl:call-template name="attr">
            <xsl:with-param name="tag" select="'00380500'"/>
            <xsl:with-param name="vr" select="'LO'"/>
            <xsl:with-param name="val" select="substring(field[12]/text(),1,64)"/>
        </xsl:call-template>
        <!-- Requested Procedure ID -->
        <xsl:call-template name="attr">
            <xsl:with-param name="tag" select="'00401001'"/>
            <xsl:with-param name="vr" select="'SH'"/>
            <xsl:with-param name="val" select="string(field[19]/text())"/>
        </xsl:call-template>
        <!-- Patient Transport Arrangements -->
        <xsl:call-template name="attr">
            <xsl:with-param name="tag" select="'00401004'"/>
            <xsl:with-param name="vr" select="'LO'"/>
            <xsl:with-param name="val" select="substring(field[30]/text(),1,64)"/>
        </xsl:call-template>
    </xsl:template>
    <xsl:template match="ORC" mode="sps">
        <item>
            <!-- Scheduled Procedure Step Start Date/Time -->
            <xsl:call-template name="attrDATM">
                <xsl:with-param name="datag" select="'00400002'"/>
                <xsl:with-param name="tmtag" select="'00400003'"/>
                <xsl:with-param name="val" select="string(field[7]/component[3]/text())"/>
            </xsl:call-template>
            <xsl:apply-templates select="following-sibling::OBR[1]" mode="sps"/>
        </item>
    </xsl:template>
    <xsl:template match="OBR" mode="sps">
        <!-- Modality -->
        <xsl:call-template name="attr">
            <xsl:with-param name="tag" select="'00080060'"/>
            <xsl:with-param name="vr" select="'CS'"/>
            <xsl:with-param name="val" select="string(field[24]/text())"/>
        </xsl:call-template>
        <!-- Scheduled Performing Physican Name -->
        <xsl:call-template name="cn2pnAttr">
            <xsl:with-param name="tag" select="'00400006'"/>
            <xsl:with-param name="cn" select="field[34]"/>
            <xsl:with-param name="cn26" select="field[34]/subcomponent"/>
        </xsl:call-template>
        <!-- Scheduled Procedure Step Description -->
        <xsl:call-template name="attr">
            <xsl:with-param name="tag" select="'00400007'"/>
            <xsl:with-param name="vr" select="'LO'"/>
            <xsl:with-param name="val" select="substring(field[4]/component[4]/text(),1,64)"/>
        </xsl:call-template>
        <!-- Scheduled Protocol Code Sequence -->
        <xsl:call-template name="codeItem">
            <xsl:with-param name="sqtag" select="'00400008'"/>
            <xsl:with-param name="code" select="string(field[4]/component[3]/text())"/>
            <xsl:with-param name="scheme" select="string(field[4]/component[5]/text())"/>
            <xsl:with-param name="meaning" select="substring(field[4]/component[4]/text(),1,64)"/>
        </xsl:call-template>
        <!-- Scheduled Procedure Step ID -->
        <xsl:call-template name="attr">
            <xsl:with-param name="tag" select="'00400009'"/>
            <xsl:with-param name="vr" select="'SH'"/>
            <xsl:with-param name="val" select="string(field[20]/text())"/>
        </xsl:call-template>
    </xsl:template>
    <xsl:template match="ZDS" mode="sps">
<!--  Scheduled Station AE Title  -->
   <xsl:call-template name="attr">
   <xsl:with-param name="tag" select="'00400001'"/>
   <xsl:with-param name="vr" select="'AE'"/>
   <xsl:with-param name="val" select="string(field[2]/text())"/>
</xsl:call-template>
<!-- Scheduled Station Name (set to the same field as AE title) -->
   <xsl:call-template name="attr">
   <xsl:with-param name="tag" select="'00400010'"/>
   <xsl:with-param name="vr" select="'AE'"/>
   <xsl:with-param name="val" select="string(field[3]/text())"/>
</xsl:call-template>
</xsl:template>
    <xsl:template match="ZDS">
<!--  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="string(field[1]/text())"/>
</xsl:call-template>
     </xsl:template>
</xsl:stylesheet>

fleetwoodfc

unread,
Mar 7, 2016, 3:03:15 PM3/7/16
to dcm4che
Yes the solution I originally proposed is incorrect because it created attr(s)  outside of an item within a SQ. Try:

<dataset>
<attr tag="00080005" vr="CS">ISO_IR 100</attr>
  <xsl:apply-templates select="PID"/>
  <xsl:apply-templates select="PV1"/>
  <xsl:apply-templates select="ORC[1]"/>
  <xsl:apply-templates select="OBR[1]"/>
  <xsl:apply-templates select="ORC" mode="sps"/>
  <xsl:apply-templates select="ZDS"/>
</dataset>

........

<xsl:template match="ORC" mode="sps">

 
<attr tag="00400100" vr="SQ">

  
<item>
 
<!-- Scheduled Procedure Step Start Date/Time -->
     
<xsl:call-template name="attrDATM">
       
<xsl:with-param name="datag" select="'00400002'"/>
       
<xsl:with-param name="tmtag" select="'00400003'"/>
       
<xsl:with-param name="val" select="string(field[7]/component[3]/text())"/>
     
</xsl:call-template>
     
<xsl:apply-templates select="following-sibling::OBR[1]" mode="sps"/>

     
<xsl:apply-templates select="ZDS" mode="sps"/>

   
</item>
  
</attr>
 
</xsl:template>

David Simic

unread,
Jun 29, 2016, 11:48:28 AM6/29/16
to dcm...@googlegroups.com
Hi folks,

The above didn't actually work for me. I wrote up what did work for me here:


in the hopes of making someone's life easier...

The post includes a link to my version of orm2dcm.xsl.

The key insight was found in this post:


BTW, I only tested the above on version 2.18.x of dcm4chee, so I'm not sure how these instructions would fare on other versions.
Reply all
Reply to author
Forward
0 new messages