Multiple PID through an inbound HL7

921 views
Skip to first unread message

Raúl Picado

unread,
Jan 6, 2015, 8:21:18 PM1/6/15
to dcm...@googlegroups.com
Hi Guys.

I'm trying to configure the HL7 Service to accept multiple PID through an inbound HL7 ORM^O01. I would like that these multiple PID were stored in the "other pid" table, as it happens when dcm4chee receives an study with multiple PID in the "Other Patient IDs Sequence"

First question: Is this possible? If the answer is affirmative, I need some help to finish the configuration.

My PID segment looks like:

PID|||999999^^^HOSP1~71123123X^^^DNI~XAC987654321^^^CIP||TEST^PATIENT||19780510|M||WH|STREET 1^^VALLADOLID^VA^47003|||||||20984000|||||||||||||||||||||



I've modified orm2dcm.xsl trying to accept those fields, but I'm new with xsl and probably I'm missing something

...
<xsl:template match="/hl7">
        <dataset>
            <attr tag="00080005" vr="CS">ISO_IR 100</attr>
            <xsl:apply-templates select="PID"/>
    <!-- Other Patient Identification Sequence -->
    <attr tag="00101002" vr="SQ">
 <xsl:apply-templates select="PID[1]" mode="sps"/>
    </attr>
            <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"/>
            </attr>
            <xsl:apply-templates select="ZDS"/>
        </dataset>
    </xsl:template>
    <xsl:template match="PID[1]" mode="sps">
        <!-- Other patient ID -->
        <xsl:call-template name="attr">
            <xsl:with-param name="tag" select="'00100020'"/>
            <xsl:with-param name="vr" select="'LO'"/>
            <xsl:with-param name="val" select="string(field[3]/repeat[1]/component[1]/text())"/>
        </xsl:call-template>
<!-- Issuer of Other Patient ID -->
<xsl:call-template name="attr">
    <xsl:with-param name="tag" select="'00100021'"/>
    <xsl:with-param name="vr" select="'SH'"/>
    <xsl:with-param name="val" select="string(field[3]/repeat[1]/component[2]/text())"/>
</xsl:call-template>
    </xsl:template>


When I send the message, only the first PID and issuer are stored. Nothing is written in the other_pid table

So... second question: what am I doing wrong?

I've tested that sending an study with multiple ID and issuers in the "Other Patient IDs" DICOM Sequence, it stores correctly in the other_pid and rel_pat_other_pid tables, but I'm not able to search in the dcm4chee web interface for these other PID or issuers -> Third question: Should I enable something to be able to do this search?

Thanks in advance and best regards.

Raúl


José Antonio Pérez

unread,
Jan 7, 2015, 4:04:55 AM1/7/15
to dcm...@googlegroups.com
Hi Raúl,

> it stores correctly in the other_pid and rel_pat_other_pid tables, but I'm not able to search in the dcm4chee web interface for these other PID or issuers -> Third question: Should I enable something to be able to do this search?

The web interface filters accordingly to the values in the file "conf/dcm4che-attribute-filter.xml"

You can find additional information about this topic here:

http://forums.dcm4che.org/jiveforums/message.jspa?messageID=13281


Anyway, independently of the configuration of the web interface, you should be able to find your patients under any identity using the Q/R service.

$ dcmqr -L TEST YOUR...@your.pacs:11112 -q00100020=XAC987654321 -q00100021=CIP
$ dcmqr -L TEST YOUR...@your.pacs:11112 -q00100020=71123123X -q00100021=DNI

If you want to use some of the Identity issuers as the default identity, you can specify that in the "QueryRetrieveScp" MBean:

PIXQueryDefaultIssuerOfPatientID -> "Value for Issuer of Patient ID used for PIX Queries, if the query request does not contains a value for the Issuer of Patient ID..."


Hope this helps,

 José Antonio

fleetwoodfc

unread,
Jan 7, 2015, 11:55:32 AM1/7/15
to dcm...@googlegroups.com
SQ should contain items i.e
     <attr tag="00101002" vr="SQ">

       
<item>

       
<xsl:apply-templates select="PID[1]" mode="sps"/>

       
</item>
     
</attr>

Issuer is in component[4]

Raúl Picado

unread,
Jan 7, 2015, 1:06:13 PM1/7/15
to dcm...@googlegroups.com
Thanks fleetwoofc for your suggestions. Yes, I made a mistake with the issuer in the wrong component. I added the item tag and now the MWL contains the sequence, but it's empty, it's like it's not recognizing the PID[1] template. The orm2dcm.xsl it's now:

    <xsl:template match="/hl7">
        <dataset>
            <attr tag="00080005" vr="CS">ISO_IR 100</attr>
            <xsl:apply-templates select="PID"/>
<!-- Other Patient Identification Sequence -->
<attr tag="00101002" vr="SQ">
<item>
<xsl:apply-templates select="PID[1]" mode="sps"/>
</item>
</attr>
            <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"/>
            </attr>
            <xsl:apply-templates select="ZDS"/>
        </dataset>
    </xsl:template>
    <xsl:template match="PID[1]" mode="sps">
        <!-- Other patient ID -->
        <xsl:call-template name="attr">
            <xsl:with-param name="tag" select="'00100020'"/>
            <xsl:with-param name="vr" select="'LO'"/>
            <xsl:with-param name="val" select="string(field[3]/repeat[1]/component[1]/text())"/>
        </xsl:call-template>
<!-- Issuer of Other Patient ID -->
<xsl:call-template name="attr">
<xsl:with-param name="tag" select="'00100021'"/>
<xsl:with-param name="vr" select="'SH'"/>
<xsl:with-param name="val" select="string(field[3]/repeat[1]/component[4]/text())"/>
</xsl:call-template>
    </xsl:template>

And the MWL item now has the sequence, but it's empty:

Raúl Picado

unread,
Jan 7, 2015, 1:30:34 PM1/7/15
to dcm...@googlegroups.com
Hi José Antonio.

  I've made some changes to the "dcm4che-attribute-filter.xml" but without success. Last one is, as you suggested, this:

<patient>
        <attr tag="00080005"/> <!-- Specific Character Set -->
        <attr tag="00100010" case-sensitive="false"/> <!-- Patient's Name -->
        <attr tag="00100020"/> <!-- Patient ID -->
        <attr tag="00100021"/> <!-- Issuer of Patient ID -->
        <attr tag="00100030"/> <!-- Patient's Birth Date -->
        <attr tag="00100040"/> <!-- Patient's Sex -->
        <attr tag="00101002"/> <!-- Other Patient IDs Sequence -->
<attr seq="00101002" tag="00100020"/> <!-- Patient ID -->
        <attr seq="00101002" tag="00100021"/> <!-- Issuer of Patient ID -->
        <attr tag="00104000"/> <!-- Patient Comments -->
    </patient>


Eventhough I'm able to find the patient by other IDs with the dcmqr tool (when an study arrives with multiple IDs, still not by the ORM message), i'm still not able to find it by the dcm4chee web interface

fleetwoodfc

unread,
Jan 8, 2015, 8:14:02 AM1/8/15
to dcm...@googlegroups.com
This works for me:

<xsl:template match="PID[1]" mode="sps">
<xsl:call-template name="otherpid2attrs">
<xsl:with-param name="idtag" select="'00100020'"/>
<xsl:with-param name="istag" select="'00100021'"/>
<xsl:with-param name="cx" select="field[3]/repeat[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="otherpid2attrs">
<xsl:param name="idtag"/>
<xsl:param name="istag"/>
<xsl:param name="cx"/>
<attr tag="{$idtag}" vr="LO">
<xsl:value-of select="string($cx/component[1]/text())"/>
</attr>
<attr tag="{$istag}" vr="LO">
<xsl:value-of select="string($cx/component[4]/text())"/>
<xsl:if test="$cx/component[4]/subcomponent[1]">
<xsl:text>&amp;</xsl:text>
<xsl:value-of select="$cx/component[4]/subcomponent[1]"/>
<xsl:text>&amp;</xsl:text>
<xsl:value-of select="$cx/component[4]/subcomponent[2]"/>
</xsl:if>
</attr>
</xsl:template>

Raúl Picado

unread,
Jan 8, 2015, 12:52:09 PM1/8/15
to dcm...@googlegroups.com
Hi fleetwoodfc

Thanks for your efforts. This is a significant big change since now it's trying to write in the other_pid table, but unfortunately I'm having some Java exceptions. It seems that it tries to create a new entry in other_pid table with (null,null) values. I think that your code it's correct, even though with my little experience in this field I couldn't have achieve it, but it looks like it's not taking the correct components.

This is part of the java exception sumarized (I've translated some sentences that are in spanish, so the error may not be literal):

2015-01-08 18:10:26,390 ERROR -> (TCPServer-2-1) [org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCPostgreSQLCreateCommand.OtherPatientID] Could not create entity
org.postgresql.util.PSQLException: ERROR: null value for the "pat_id" column violates the constraint not null
  Detail: The row that fails contains (9, null, null).
[...]
2015-01-08 18:10:26,426 ERROR -> (TCPServer-2-1) [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.OtherPatientID#findByPatientIdAndIssuer] Find failed
org.postgresql.util.PSQLException: ERROR: aborted transaction, the commands are ignored until the end of transaction block
[...]
2015-01-08 18:10:26,455 ERROR -> (TCPServer-2-1) [org.dcm4chex.archive.ejb.entity.OtherPatientIDBean] Fail to find or to create other-patient-id: null^^^null
2015-01-08 18:10:26,457 ERROR -> (TCPServer-2-1) [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackLocalException in method: public abstract org.dcm4chex.archive.ejb.interfaces.OtherPatientIDLocal org.dcm4chex.archive.ejb.interfaces.OtherPatientIDLocalHome.valueOf(java.lang.String,java.lang.String), causedBy:
javax.ejb.FinderException: Find failed: org.postgresql.util.PSQLException: ERROR: aborted transaction, the commands are ignored until the end of transaction block
[...]
2015-01-08 18:10:26,604 ERROR -> (TCPServer-2-1) [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException in method: public abstract org.dcm4che.data.Dataset org.dcm4chex.archive.ejb.interfaces.MWLManager.addWorklistItem(org.dcm4che.data.Dataset,org.dcm4chex.archive.common.PatientMatching) throws javax.ejb.CreateException,javax.ejb.FinderException,java.rmi.RemoteException, causedBy:
javax.ejb.FinderException: Find failed: org.postgresql.util.PSQLException: ERROR: aborted transaction, the commands are ignored until the end of transaction block
[...]

My PID segment is this:

PID|||999999^^^HOSP1~11123123X^^^DNI||PARA PRUEBAS^PACIENTE||19780510|M||WH|PASEO DE ZORRILLA 1^^VALLADOLID^VA^47003|||||||20984000|||||||||||||||||||||

And I've enabled the "FileReceivedHL7AsXML" parameter, and the PID components seems to be correct:

<PID>
<field/>
<field/>
<field>999999<component/>
<component/>
<component>HOSP1</component>
<repeat>11123123X<component/>
<component/>
<component>DNI</component>
</repeat>
</field>
<field/>
<field>PARA PRUEBAS<component>PACIENTE</component>
</field>
<field/>
<field>19780510</field>
<field>M</field>
<field/>
<field>WH</field>
<field>PASEO DE ZORRILLA 1<component/>
<component>VALLADOLID</component>
<component>VA</component>
<component>47003</component>
</field>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field>20984000</field>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
<field/>
</PID>



Any idea about what is happening to finally try to insert null values in other_pid table?

Thanks and best regards.

fleetwoodfc

unread,
Jan 8, 2015, 2:31:12 PM1/8/15
to dcm...@googlegroups.com
I remember now that the dcm4chee parser doesn't parse components correctly so try this:

<xsl:template match="PID[1]" mode="sps"><!-- Other patient ID -->
<xsl:call-template name="otherpid2attrs">
<xsl:with-param name="idtag" select="'00100020'"/>
<xsl:with-param name="istag" select="'00100021'"/>
<xsl:with-param name="cx" select="field[3]/repeat[1]"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="otherpid2attrs">
<xsl:param name="idtag"/>
<xsl:param name="istag"/>
<xsl:param name="cx"/>
<attr tag="{$idtag}" vr="LO">
<xsl:value-of select="string($cx/text())"/>
</attr>
<attr tag="{$istag}" vr="LO">
<xsl:value-of select="string($cx/component[3]/text())"/>
<xsl:if test="$cx/component[3]/subcomponent[1]">
<xsl:text>&amp;</xsl:text>
<xsl:value-of select="$cx/component[3]/subcomponent[1]"/>
<xsl:text>&amp;</xsl:text>
<xsl:value-of select="$cx/component[3]/subcomponent[2]"/>
</xsl:if>
</attr>
</xsl:template>

Raúl Picado

unread,
Jan 8, 2015, 6:46:39 PM1/8/15
to dcm...@googlegroups.com
Hi fleetwoodfc.

Working perfectly now! thank you very much!

I've attached here the orm2dcm.xsl working file, in order to help if someone wants to implement this in the future. The file has also another modification to parse the scheduled station name and aetitle to the MWL in the ZDS segment

Best regards.
orm2dcm.xsl

A Hidalgo

unread,
Jan 27, 2020, 10:58:01 AM1/27/20
to dcm4che
good morning, I need help with the dcm4chee software, I try to send images from a computer and the PACS bounces the image I throw the following error I have no idea what it can be.
please help


2020-01-23 15:21:27,935 INFO  CNSSCRE->SUCRE (TCPServer-1-2) [org.dcm4chex.archive.ejb.entity.PatientBean] Created Patient[pk=62, pid=DR000014, issuer=null, name=ARIEL^^^^]
2020-01-23 15:21:27,940 INFO  CNSSCRE->SUCRE (TCPServer-1-2) [org.dcm4chex.archive.ejb.entity.StudyBean] Created Study[pk=62, uid=1.2.276.0.7230010.3.0.3.5.1.11246489.2580628240, patient->ejb/Patient:62]
2020-01-23 15:21:27,949 ERROR CNSSCRE->SUCRE (TCPServer-1-2) [org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCPostgreSQLCreateCommand.Code] Could not create entity
org.postgresql.util.PSQLException: ERROR: el valor null para la columna «code_value» viola la restricción not null
  Detail: La fila que falla contiene (40, null, null, null, null).
Reply all
Reply to author
Forward
0 new messages