|
From: <gun...@us...> - 2007-09-06 11:48:00
|
Revision: 4958
http://dcm4che.svn.sourceforge.net/dcm4che/?rev=4958&view=rev
Author: gunterze
Date: 2007-09-06 04:47:56 -0700 (Thu, 06 Sep 2007)
Log Message:
-----------
[#DCMEE-525] Drop configuration of AcceptPatientID, IgnorePatientID, IgnorePatientIDAETitles for Storage Service
[#DCMEE-524] Drop support of configuration of IssuerOfPatientIDRules of Storage Service
[#DCMEE-522] Supplement Issuer Of Patient ID in received Composite Objects, C-FIND RQs, MPPS N-CREATE and GP-PPS according AE configuration
[#DCMEE-523] Supplement MPPS N-CREATE and GP-PPS N-CREATE messages with generated Patient ID
Modified Paths:
--------------
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-gpwlscp-xmbean.xml
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-mppsscp-xmbean.xml
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-qrscp-xmbean.xml
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-storescp-xmbean.xml
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/AbstractScpService.java
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/gpwlscp/PPSScp.java
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/mppsscp/MPPSScp.java
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/qrscp/FindScp.java
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScp.java
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScpService.java
Removed Paths:
-------------
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/config/IssuerOfPatientIDRules.java
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-gpwlscp-xmbean.xml
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-gpwlscp-xmbean.xml 2007-09-05 13:29:26 UTC (rev 4957)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-gpwlscp-xmbean.xml 2007-09-06 11:47:56 UTC (rev 4958)
@@ -40,6 +40,50 @@
</descriptors>
</attribute>
<attribute access="read-write"
+ getMethod="getGeneratePatientID"
+ setMethod="setGeneratePatientID">
+ <description><![CDATA[Generate a patient ID from a hash of the
+ patient name and birth date and/or study instance uid, if
+ the received GP-PPS N-CREATE message contains no patient ID.
+ <br>Use ### and/or $$$ as a placeholder for the decimal hash value of
+ patient name and/or study instance uid.
+ For example, PACS-##########.
+ <br>NONE = do not generate patient IDs..]]>
+ </description>
+ <name>GeneratePatientID</name>
+ <type>java.lang.String</type>
+ <descriptors>
+ <value value="PACS-##########"/>
+ </descriptors>
+ </attribute>
+ <attribute access="read-write"
+ getMethod="getIssuerOfGeneratedPatientID"
+ setMethod="setIssuerOfGeneratedPatientID">
+ <description><![CDATA[Value for Issuer Of Patient ID if the patient ID is
+ generated according configured <i>GeneratePatientID<i>.
+ <br>NONE = do not set Issuer Of Patient ID for generated patient IDs.]]>
+ </description>
+ <name>IssuerOfPatientIDGeneratedPatientID</name>
+ <type>java.lang.String</type>
+ <descriptors>
+ <value value="DCM4CHEE"/>
+ </descriptors>
+ </attribute>
+ <attribute access="read-write"
+ getMethod="isSupplementIssuerOfPatientID"
+ setMethod="setSupplementIssuerOfPatientID">
+ <description><![CDATA[Supplement received GP-PPS N-CREATE message containing
+ a <i>Patient ID</i>, but no <i>Issuer Of Patient ID</i>, with a value
+ for <i>Issuer Of Patient ID</i>, if such is associated with the
+ MPPS SCU AE by its AE Configuration entry.]]>
+ </description>
+ <name>SupplementIssuerOfPatientID</name>
+ <type>boolean</type>
+ <descriptors>
+ <value value="true"/>
+ </descriptors>
+ </attribute>
+ <attribute access="read-write"
getMethod="getAcceptedSOPClasses"
setMethod="setAcceptedSOPClasses">
<description><![CDATA[
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-mppsscp-xmbean.xml
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-mppsscp-xmbean.xml 2007-09-05 13:29:26 UTC (rev 4957)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-mppsscp-xmbean.xml 2007-09-06 11:47:56 UTC (rev 4958)
@@ -47,6 +47,50 @@
</descriptors>
</attribute>
<attribute access="read-write"
+ getMethod="getGeneratePatientID"
+ setMethod="setGeneratePatientID">
+ <description><![CDATA[Generate a patient ID from a hash of the
+ patient name and birth date and/or study instance uid, if
+ the received MPPS N-CREATE message contains no patient ID.
+ <br>Use ### and/or $$$ as a placeholder for the decimal hash value of
+ patient name and/or study instance uid.
+ For example, PACS-##########.
+ <br>NONE = do not generate patient IDs..]]>
+ </description>
+ <name>GeneratePatientID</name>
+ <type>java.lang.String</type>
+ <descriptors>
+ <value value="PACS-##########"/>
+ </descriptors>
+ </attribute>
+ <attribute access="read-write"
+ getMethod="getIssuerOfGeneratedPatientID"
+ setMethod="setIssuerOfGeneratedPatientID">
+ <description><![CDATA[Value for Issuer Of Patient ID if the patient ID is
+ generated according configured <i>GeneratePatientID<i>.
+ <br>NONE = do not set Issuer Of Patient ID for generated patient IDs.]]>
+ </description>
+ <name>IssuerOfPatientIDGeneratedPatientID</name>
+ <type>java.lang.String</type>
+ <descriptors>
+ <value value="DCM4CHEE"/>
+ </descriptors>
+ </attribute>
+ <attribute access="read-write"
+ getMethod="isSupplementIssuerOfPatientID"
+ setMethod="setSupplementIssuerOfPatientID">
+ <description><![CDATA[Supplement received MPPS N-CREATE message containing
+ a <i>Patient ID</i>, but no <i>Issuer Of Patient ID</i>, with a value
+ for <i>Issuer Of Patient ID</i>, if such is associated with the
+ MPPS SCU AE by its AE Configuration entry.]]>
+ </description>
+ <name>SupplementIssuerOfPatientID</name>
+ <type>boolean</type>
+ <descriptors>
+ <value value="true"/>
+ </descriptors>
+ </attribute>
+ <attribute access="read-write"
getMethod="getAcceptedTransferSyntax"
setMethod="setAcceptedTransferSyntax">
<description><![CDATA[
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-qrscp-xmbean.xml
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-qrscp-xmbean.xml 2007-09-05 13:29:26 UTC (rev 4957)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-qrscp-xmbean.xml 2007-09-06 11:47:56 UTC (rev 4958)
@@ -46,6 +46,20 @@
</descriptors>
</attribute>
<attribute access="read-write"
+ getMethod="isSupplementIssuerOfPatientID"
+ setMethod="setSupplementIssuerOfPatientID">
+ <description><![CDATA[Supplement received C-FIND RQ identifier containing
+ a <i>Patient ID</i>, but no <i>Issuer Of Patient ID</i>, with a value
+ for <i>Issuer Of Patient ID</i>, if such is associated with the
+ C-FIND SCU AE by its AE Configuration entry.]]>
+ </description>
+ <name>SupplementIssuerOfPatientID</name>
+ <type>boolean</type>
+ <descriptors>
+ <value value="false"/>
+ </descriptors>
+ </attribute>
+ <attribute access="read-write"
getMethod="getSendWithDefaultTransferSyntaxToAETitles"
setMethod="setSendWithDefaultTransferSyntaxToAETitles">
<description>Move Destination AE titles to which objects are sent
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-storescp-xmbean.xml
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-storescp-xmbean.xml 2007-09-05 13:29:26 UTC (rev 4957)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-storescp-xmbean.xml 2007-09-06 11:47:56 UTC (rev 4958)
@@ -121,58 +121,13 @@
</descriptors>
</attribute>
<attribute access="read-write"
- getMethod="getAcceptPatientID"
- setMethod="setAcceptPatientID">
- <description>Regular Expression for valid Patient IDs. Patient IDs which
- does not match the specified pattern are ignored and replaced by a
- Patient ID generated according attribute "GeneratePatientID".
- </description>
- <name>AcceptPatientID</name>
- <type>java.lang.String</type>
- <descriptors>
- <value value=".*"/>
- </descriptors>
- </attribute>
- <attribute access="read-write"
- getMethod="getIgnorePatientID"
- setMethod="setIgnorePatientID">
- <description>Regular Expression for invalid Patient IDs. Patient IDs which
- match the specified pattern are ignored and replaced by a
- Patient ID generated according attribute "GeneratePatientID".
- </description>
- <name>IgnorePatientID</name>
- <type>java.lang.String</type>
- <descriptors>
- <value value="UNKOWN"/>
- </descriptors>
- </attribute>
- <attribute access="read-write"
- getMethod="getIgnorePatientIDCallingAETs"
- setMethod="setIgnorePatientIDCallingAETs">
- <description>List of the AE titles for the Storage SCUs for which the
- Patient ID in received objects is ignored. Usually used together with
- attribute "GeneratePatientID" to generate a new Patient ID for such objects.
- Separate multiple values by \(backslash).
- NONE = no calling AE titles.
- </description>
- <name>IgnorePatientIDAETitles</name>
- <type>java.lang.String</type>
- <descriptors>
- <value value="NONE"/>
- </descriptors>
- </attribute>
- <attribute access="read-write"
getMethod="getGeneratePatientID"
setMethod="setGeneratePatientID">
- <description><![CDATA[Generate a patient ID from a hash of the patient name and
- birth date and/or study instance uid, if
- <ol>
- <li>the received object has no patient ID or
- <li>the patient ID does not match the pattern defined in "AcceptPatientID" or
- <li>it match the pattern defined in "IgnorePatientID" or
- <li>the object is received from an AE listed in "IgnorePatientIDAETitles".
- </ol>
- <br>Use ### and/or $$$ as a placeholder for the decimal hash value of patient name and/or study instance uid.
+ <description><![CDATA[Generate a patient ID from a hash of the
+ patient name and birth date and/or study instance uid, if
+ the received object contains no patient ID.
+ <br>Use ### and/or $$$ as a placeholder for the decimal hash value of
+ patient name and/or study instance uid.
For example, PACS-##########.
<br>NONE = do not generate patient IDs. But, this means media creation will fail.]]>
</description>
@@ -183,25 +138,33 @@
</descriptors>
</attribute>
<attribute access="read-write"
- getMethod="getIssuerOfPatientIDRules"
- setMethod="setIssuerOfPatientIDRules">
- <description><![CDATA[List of rules used to add the Issuer Of PatientID
- value if not contained in the received object, if the Patient ID matches
- the specified regular expression. Multiple rules are separated by new lines.
- Format:
- <br><i>regExpression</i>:<i>issuer</i>
- <br>Example:
- <br>^PACS- \d*:DCM4CHEE
- <br>If no regular expression is specified,
- the issuer is added for all patient IDs.]]>
+ getMethod="getIssuerOfGeneratedPatientID"
+ setMethod="setIssuerOfGeneratedPatientID">
+ <description><![CDATA[Value for Issuer Of Patient ID if the patient ID is
+ generated according configured <i>GeneratePatientID<i>.
+ <br>NONE = do not set Issuer Of Patient ID for generated patient IDs.]]>
</description>
- <name>IssuerOfPatientIDRules</name>
+ <name>IssuerOfPatientIDGeneratedPatientID</name>
<type>java.lang.String</type>
<descriptors>
- <value value="^PACS-\d*:DCM4CHEE"/>
+ <value value="DCM4CHEE"/>
</descriptors>
</attribute>
<attribute access="read-write"
+ getMethod="isSupplementIssuerOfPatientID"
+ setMethod="setSupplementIssuerOfPatientID">
+ <description><![CDATA[Supplement received objects containing a
+ <i>Patient ID</i>, but no <i>Issuer Of Patient ID</i>, with a value
+ for <i>Issuer Of Patient ID</i>, if such is associated with the
+ Storage SCU AE by its AE Configuration entry.]]>
+ </description>
+ <name>SupplementIssuerOfPatientID</name>
+ <type>boolean</type>
+ <descriptors>
+ <value value="true"/>
+ </descriptors>
+ </attribute>
+ <attribute access="read-write"
getMethod="isStudyDateInFilePath"
setMethod="setStudyDateInFilePath">
<description><![CDATA[Use Study Date in received objects to structure directories of the storage file system.
Deleted: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/config/IssuerOfPatientIDRules.java
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/config/IssuerOfPatientIDRules.java 2007-09-05 13:29:26 UTC (rev 4957)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/config/IssuerOfPatientIDRules.java 2007-09-06 11:47:56 UTC (rev 4958)
@@ -1,90 +0,0 @@
-/* ***** 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
- * TIANI Medgraph AG.
- * Portions created by the Initial Developer are Copyright (C) 2003-2005
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Gunter Zeilinger <gun...@ti...>
- * Franz Willer <fra...@gw...>
- *
- * 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.config;
-
-import java.util.StringTokenizer;
-import java.util.regex.Pattern;
-
-/**
- * @author gun...@ti...
- * @version $Revision$ $Date$
- * @since Jun 8, 2005
- */
-public class IssuerOfPatientIDRules {
-
- private final Pattern[] patterns;
- private final String[] issuers;
-
- public IssuerOfPatientIDRules(String rules) {
- StringTokenizer stk = new StringTokenizer(rules, " ;\t\r\n");
- patterns = new Pattern[stk.countTokens()];
- issuers = new String[patterns.length];
- for (int i = 0; i < issuers.length; i++) {
- issuers[i] = stk.nextToken();
- final int beginIssuer = issuers[i].indexOf(':') + 1;
- if (beginIssuer > 0) {
- patterns[i] = Pattern.compile(issuers[i].substring(0,
- beginIssuer - 1));
- issuers[i] = issuers[i].substring(beginIssuer);
- }
- }
- }
-
- public String issuerOf(String pid) {
- for (int i = 0; i < patterns.length; i++) {
- if (patterns[i] == null || patterns[i].matcher(pid).matches()) {
- return issuers[i];
- }
- }
- return null;
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < issuers.length; i++) {
- if (patterns[i] != null) {
- sb.append(patterns[i].pattern()).append(':');
- }
- sb.append(issuers[i]).append("\r\n");
- }
- return sb.toString();
- }
-
-}
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/AbstractScpService.java
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/AbstractScpService.java 2007-09-05 13:29:26 UTC (rev 4957)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/AbstractScpService.java 2007-09-06 11:47:56 UTC (rev 4958)
@@ -46,6 +46,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Random;
import java.util.StringTokenizer;
import javax.management.Attribute;
@@ -63,6 +64,7 @@
import org.dcm4che.data.DcmElement;
import org.dcm4che.data.DcmObject;
import org.dcm4che.data.DcmObjectFactory;
+import org.dcm4che.dict.Tags;
import org.dcm4che.dict.UIDs;
import org.dcm4che.dict.VRs;
import org.dcm4che.net.AcceptorPolicy;
@@ -79,8 +81,12 @@
import org.dcm4cheri.util.StringUtils;
import org.dcm4chex.archive.common.DatasetUtils;
import org.dcm4chex.archive.ejb.interfaces.AEDTO;
+import org.dcm4chex.archive.ejb.interfaces.AEManager;
+import org.dcm4chex.archive.ejb.interfaces.AEManagerHome;
+import org.dcm4chex.archive.exceptions.UnknownAETException;
import org.dcm4chex.archive.mbean.AuditLoggerDelegate;
import org.dcm4chex.archive.mbean.TemplatesDelegate;
+import org.dcm4chex.archive.util.EJBHomeFactory;
import org.dcm4chex.archive.util.XSLTUtils;
import org.jboss.logging.Logger;
import org.jboss.system.ServiceMBeanSupport;
@@ -98,6 +104,8 @@
protected static final String NONE = "NONE";
+ private static int sequenceInt = new Random().nextInt();
+
protected ObjectName dcmServerName;
protected ObjectName aeServiceName;
@@ -106,7 +114,7 @@
protected DcmHandler dcmHandler;
protected UserIdentityNegotiator userIdentityNegotiator;
-
+
protected String[] calledAETs;
/**
@@ -117,6 +125,12 @@
*/
protected String[] callingAETs;
+ protected String[] generatePatientID = null;
+
+ protected String issuerOfGeneratedPatientID;
+
+ protected boolean supplementIssuerOfPatientID;
+
/**
* Map containing accepted Transfer Syntax UIDs. key is name (as in config
* string), value is real uid)
@@ -226,7 +240,7 @@
this.aeServiceName = aeServiceName;
}
- public final String getCalledAETs() {
+ public final String getCalledAETs() {
return calledAETs == null ? "" : StringUtils.toString(calledAETs, '\\');
}
@@ -246,6 +260,77 @@
logCallingAETs = StringUtils.split(aets, '\\');
}
+ public final String getGeneratePatientID() {
+ if (generatePatientID == null) {
+ return NONE;
+ }
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < generatePatientID.length; i++) {
+ sb.append(generatePatientID[i]);
+ }
+ return sb.toString();
+ }
+
+ public final void setGeneratePatientID(String pattern) {
+ if (pattern.equalsIgnoreCase(NONE)) {
+ this.generatePatientID = null;
+ return;
+ }
+ int pl = pattern.indexOf('#');
+ int pr = pl != -1 ? pattern.lastIndexOf('#') : -1;
+ int sl = pattern.indexOf('$');
+ int sr = sl != -1 ? pattern.lastIndexOf('$') : -1;
+ if (pl == -1 && sl == -1) {
+ this.generatePatientID = new String[] { pattern };
+ } else if (pl != -1 && sl != -1) {
+ this.generatePatientID = pl < sl
+ ? split(pattern, pl, pr, sl, sr)
+ : split(pattern, sl, sr, pl, pr);
+
+ } else {
+ this.generatePatientID = pl != -1
+ ? split(pattern, pl, pr)
+ : split(pattern, sl, sr);
+ }
+ }
+
+ private static String[] split(String pattern, int l1, int r1) {
+ return new String[] {
+ pattern.substring(0, l1),
+ pattern.substring(l1, r1 + 1),
+ pattern.substring(r1 + 1), };
+ }
+
+ private static String[] split(String pattern, int l1, int r1, int l2, int r2) {
+ if (r1 > l2) {
+ throw new IllegalArgumentException(pattern);
+ }
+ return new String[] {
+ pattern.substring(0, l1),
+ pattern.substring(l1, r1 + 1),
+ pattern.substring(r1 + 1, l2),
+ pattern.substring(l2, r2 + 1),
+ pattern.substring(r2 + 1) };
+ }
+
+ public final String getIssuerOfGeneratedPatientID() {
+ return issuerOfGeneratedPatientID;
+ }
+
+ public final void setIssuerOfGeneratedPatientID(
+ String issuerOfGeneratedPatientID) {
+ this.issuerOfGeneratedPatientID = issuerOfGeneratedPatientID;
+ }
+
+ public final boolean isSupplementIssuerOfPatientID() {
+ return supplementIssuerOfPatientID;
+ }
+
+ public final void setSupplementIssuerOfPatientID(
+ boolean supplementIssuerOfPatientID) {
+ this.supplementIssuerOfPatientID = supplementIssuerOfPatientID;
+ }
+
public final int getMaxPDULength() {
return maxPDULength;
}
@@ -329,8 +414,8 @@
if ( callingAETs.length != 0 ) return callingAETs;
log.debug("Use 'CONFIGURED_AETS' for list of calling AETs");
try {
- List l = (List) server.invoke(aeServiceName, "listAEs", null, null);
- if (l == null || l.size() == 0 ) {
+ List l = aeMgr().findAll();
+ if (l.size() == 0 ) {
log.warn("No AETs configured! No calling AET is allowed!");
return callingAETs;
}
@@ -699,5 +784,80 @@
}
return DcmObjectFactory.getInstance().newPersonName(pname).format();
}
+
+ public void supplementIssuerOfPatientID(Dataset ds, String callingAET) {
+ if (supplementIssuerOfPatientID
+ && !ds.containsValue(Tags.IssuerOfPatientID)) {
+ String pid = ds.getString(Tags.PatientID);
+ if (pid != null) {
+ try {
+ AEDTO ae = aeMgr().findByAET(callingAET);
+ String issuer = ae.getIssuerOfPatientID();
+ ds.putLO(Tags.IssuerOfPatientID, issuer);
+ if (log.isInfoEnabled()) {
+ log.info("Add missing Issuer Of Patient ID " + issuer
+ + " for Patient ID " + pid);
+ }
+ } catch (UnknownAETException e) {
+ } catch (Exception e) {
+ log.warn("Failed to supplement Issuer Of Patient ID: ", e);
+ }
+ }
+ }
+ }
+ public void generatePatientID(Dataset pat, Dataset sty) {
+ String pid = pat.getString(Tags.PatientID);
+ if (pid != null) {
+ return;
+ }
+ String pname = pat.getString(Tags.PatientName);
+ if (generatePatientID.length == 1) {
+ pid = generatePatientID[0];
+ } else {
+ String suid = sty != null ? sty.getString(Tags.StudyInstanceUID) : null;
+ int suidHash = suid != null ? suid.hashCode() : ++sequenceInt;
+ // generate different Patient IDs for different studies
+ // if no Patient Name
+ int pnameHash = pname == null ? suidHash : pname.hashCode() * 37
+ + pat.getString(Tags.PatientBirthDate, "").hashCode();
+
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < generatePatientID.length; i++) {
+ String s = generatePatientID[i];
+ int l = s.length();
+ if (l == 0)
+ continue;
+ char c = s.charAt(0);
+ if (c != '#' && c != '$') {
+ sb.append(s);
+ continue;
+ }
+ String v = Long.toString((c == '#' ? pnameHash : suidHash)
+ & 0xffffffffL);
+ for (int j = v.length() - l; j < 0; j++) {
+ sb.append('0');
+ }
+ sb.append(v);
+ }
+ pid = sb.toString();
+ }
+ pat.putLO(Tags.PatientID, pid);
+ pat.putLO(Tags.IssuerOfPatientID, issuerOfGeneratedPatientID);
+ if (log.isInfoEnabled()) {
+ StringBuffer prompt = new StringBuffer("Generate Patient ID: ");
+ prompt.append(pid);
+ if (issuerOfGeneratedPatientID != null) {
+ prompt.append("^^^").append(issuerOfGeneratedPatientID);
+ }
+ prompt.append(" for Patient: ").append(pname);
+ log.info(prompt.toString());
+ }
+ }
+
+ private AEManager aeMgr() throws Exception {
+ AEManagerHome home = (AEManagerHome) EJBHomeFactory.getFactory()
+ .lookup(AEManagerHome.class, AEManagerHome.JNDI_NAME);
+ return home.create();
+ }
}
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/gpwlscp/PPSScp.java
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/gpwlscp/PPSScp.java 2007-09-05 13:29:26 UTC (rev 4957)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/gpwlscp/PPSScp.java 2007-09-06 11:47:56 UTC (rev 4958)
@@ -50,6 +50,7 @@
import org.dcm4che.dict.Status;
import org.dcm4che.dict.Tags;
import org.dcm4che.net.ActiveAssociation;
+import org.dcm4che.net.Association;
import org.dcm4che.net.DcmServiceBase;
import org.dcm4che.net.DcmServiceException;
import org.dcm4che.net.Dimse;
@@ -104,6 +105,8 @@
protected Dataset doNCreate(ActiveAssociation assoc, Dimse rq,
Command rspCmd) throws IOException, DcmServiceException {
+ Association as = assoc.getAssociation();
+ String callingAET = as.getCallingAET();
final Command cmd = rq.getCommand();
final Dataset gppps = rq.getDataset();
final String cuid = cmd.getAffectedSOPClassUID();
@@ -114,6 +117,8 @@
log.debug("GP-PPS Attributes:");
log.debug(gppps);
checkCreateAttributs(gppps);
+ service.supplementIssuerOfPatientID(gppps, callingAET);
+ service.generatePatientID(gppps, gppps.getItem(Tags.RefRequestSeq));
gppps.putUI(Tags.SOPClassUID, cuid);
gppps.putUI(Tags.SOPInstanceUID, iuid);
createGPPPS(gppps);
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/mppsscp/MPPSScp.java
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/mppsscp/MPPSScp.java 2007-09-05 13:29:26 UTC (rev 4957)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/mppsscp/MPPSScp.java 2007-09-06 11:47:56 UTC (rev 4958)
@@ -50,6 +50,7 @@
import org.dcm4che.dict.Status;
import org.dcm4che.dict.Tags;
import org.dcm4che.net.ActiveAssociation;
+import org.dcm4che.net.Association;
import org.dcm4che.net.DcmServiceBase;
import org.dcm4che.net.DcmServiceException;
import org.dcm4che.net.Dimse;
@@ -92,6 +93,8 @@
protected Dataset doNCreate(ActiveAssociation assoc, Dimse rq,
Command rspCmd) throws IOException, DcmServiceException {
+ Association as = assoc.getAssociation();
+ String callingAET = as.getCallingAET();
final Command cmd = rq.getCommand();
final Dataset mpps = rq.getDataset();
final String cuid = cmd.getAffectedSOPClassUID();
@@ -101,7 +104,9 @@
}
log.debug("Creating MPPS:\n");
log.debug(mpps);
- checkCreateAttributs(mpps);
+ checkCreateAttributs(mpps);
+ service.supplementIssuerOfPatientID(mpps, callingAET);
+ service.generatePatientID(mpps, mpps.getItem(Tags.ScheduledStepAttributesSeq));
mpps.putUI(Tags.SOPClassUID, cuid);
mpps.putUI(Tags.SOPInstanceUID, iuid);
createMPPS(mpps);
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/qrscp/FindScp.java
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/qrscp/FindScp.java 2007-09-05 13:29:26 UTC (rev 4957)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/qrscp/FindScp.java 2007-09-06 11:47:56 UTC (rev 4958)
@@ -106,6 +106,8 @@
protected MultiDimseRsp doCFind(ActiveAssociation assoc, Dimse rq,
Command rspCmd) throws IOException, DcmServiceException {
+ Association as = assoc.getAssociation();
+ String callingAET = as.getCallingAET();
try {
perfMon.start(assoc, rq, PerfCounterEnum.C_FIND_SCP_QUERY_DB);
@@ -126,6 +128,7 @@
if (coerce != null) {
service.coerceAttributes(rqData, coerce);
}
+ service.supplementIssuerOfPatientID(rqData, callingAET);
if (!isUniversalMatching(rqData.getString(Tags.PatientID))
&& service.isPixQueryCallingAET(a.getCallingAET())) {
pixQuery(rqData);
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScp.java
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScp.java 2007-09-05 13:29:26 UTC (rev 4957)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScp.java 2007-09-06 11:47:56 UTC (rev 4958)
@@ -57,7 +57,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
-import java.util.regex.Pattern;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
@@ -90,7 +89,6 @@
import org.dcm4chex.archive.common.PrivateTags;
import org.dcm4chex.archive.common.SeriesStored;
import org.dcm4chex.archive.config.CompressionRules;
-import org.dcm4chex.archive.config.IssuerOfPatientIDRules;
import org.dcm4chex.archive.ejb.interfaces.FileDTO;
import org.dcm4chex.archive.ejb.interfaces.FileSystemDTO;
import org.dcm4chex.archive.ejb.interfaces.FileSystemMgt;
@@ -126,7 +124,7 @@
private static final String RECEIVE_BUFFER = "RECEIVE_BUFFER";
private static final String SERIES_IUID = "SERIES_IUID";
-
+
final StoreScpService service;
private final Logger log;
@@ -145,15 +143,6 @@
private boolean acceptMissingPatientName = true;
- private Pattern acceptPatientID;
-
- private Pattern ignorePatientID;
-
- private String[] generatePatientID = null;
-
- private IssuerOfPatientIDRules issuerOfPatientIDRules = new IssuerOfPatientIDRules(
- "PACS-:DCM4CHEE");
-
private boolean serializeDBUpdate = false;
private int updateDatabaseMaxRetries = 2;
@@ -172,8 +161,6 @@
private String[] acceptMismatchIUIDCallingAETs = {};
- private String[] ignorePatientIDCallingAETs = {};
-
private String[] updateStudyAccessTimeAETs = {};
private boolean checkIncorrectWorklistEntry = true;
@@ -224,85 +211,6 @@
this.serializeDBUpdate = serialize;
}
- public final String getGeneratePatientID() {
- if (generatePatientID == null) {
- return "NONE";
- }
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < generatePatientID.length; i++) {
- sb.append(generatePatientID[i]);
- }
- return sb.toString();
- }
-
- public final void setGeneratePatientID(String pattern) {
- if (pattern.equalsIgnoreCase("NONE")) {
- this.generatePatientID = null;
- return;
- }
- int pl = pattern.indexOf('#');
- int pr = pl != -1 ? pattern.lastIndexOf('#') : -1;
- int sl = pattern.indexOf('$');
- int sr = sl != -1 ? pattern.lastIndexOf('$') : -1;
- if (pl == -1 && sl == -1) {
- this.generatePatientID = new String[] { pattern };
- } else if (pl != -1 && sl != -1) {
- this.generatePatientID = pl < sl ? split(pattern, pl, pr, sl, sr)
- : split(pattern, sl, sr, pl, pr);
-
- } else {
- this.generatePatientID = pl != -1 ? split(pattern, pl, pr) : split(
- pattern, sl, sr);
- }
-
- }
-
- private String[] split(String pattern, int l1, int r1) {
- return new String[] { pattern.substring(0, l1),
- pattern.substring(l1, r1 + 1), pattern.substring(r1 + 1), };
- }
-
- private String[] split(String pattern, int l1, int r1, int l2, int r2) {
- if (r1 > l2) {
- throw new IllegalArgumentException(pattern);
- }
- return new String[] { pattern.substring(0, l1),
- pattern.substring(l1, r1 + 1), pattern.substring(r1 + 1, l2),
- pattern.substring(l2, r2 + 1), pattern.substring(r2 + 1) };
- }
-
- public final String getIssuerOfPatientIDRules() {
- return issuerOfPatientIDRules.toString();
- }
-
- public final void setIssuerOfPatientIDRules(String rules) {
- this.issuerOfPatientIDRules = new IssuerOfPatientIDRules(rules);
- }
-
- public final String getAcceptPatientID() {
- return acceptPatientID.pattern();
- }
-
- public final void setAcceptPatientID(String acceptPatientID) {
- this.acceptPatientID = Pattern.compile(acceptPatientID);
- }
-
- public final String getIgnorePatientID() {
- return ignorePatientID.pattern();
- }
-
- public final void setIgnorePatientID(String ignorePatientID) {
- this.ignorePatientID = Pattern.compile(ignorePatientID);
- }
-
- public final String getIgnorePatientIDCallingAETs() {
- return StringUtils.toString(ignorePatientIDCallingAETs, '\\');
- }
-
- public final void setIgnorePatientIDCallingAETs(String aets) {
- ignorePatientIDCallingAETs = StringUtils.split(aets, '\\');
- }
-
public final String getCoerceWarnCallingAETs() {
return StringUtils.toString(coerceWarnCallingAETs, '\\');
}
@@ -633,13 +541,15 @@
ds.putAE(PrivateTags.CallingAET, callingAET);
ds.putAE(PrivateTags.CalledAET, assoc.getCalledAET());
ds.putAE(Tags.RetrieveAET, fsDTO.getRetrieveAET());
- Dataset coerced = service.getCoercionAttributesFor(assoc,
- STORE_XSL, ds);
+ Dataset coerced =
+ service.getCoercionAttributesFor(assoc, STORE_XSL, ds);
if (coerced != null) {
service.coerceAttributes(ds, coerced);
}
+ checkPatientIdAndName(ds, callingAET);
+ service.supplementIssuerOfPatientID(ds, callingAET);
+ service.generatePatientID(ds, ds);
Storage store = getStorage(assoc);
- checkPatientIdAndName(ds, callingAET, store);
String seriuid = ds.getString(Tags.SeriesInstanceUID);
String prevseriud = (String) assoc.getProperty(SERIES_IUID);
if (!seriuid.equals(prevseriud)) {
@@ -1037,7 +947,7 @@
return val;
}
- private void checkPatientIdAndName(Dataset ds, String aet, Storage store)
+ private void checkPatientIdAndName(Dataset ds, String aet)
throws DcmServiceException, HomeFactoryException, RemoteException, CreateException, FinderException {
String pid = ds.getString(Tags.PatientID);
String pname = ds.getString(Tags.PatientName);
@@ -1051,41 +961,6 @@
Status.DataSetDoesNotMatchSOPClassError,
"Acceptance of objects without Patient Name is disabled");
}
- if (pid != null
- && (contains(ignorePatientIDCallingAETs, aet)
- || !acceptPatientID.matcher(pid).matches() || ignorePatientID
- .matcher(pid).matches())) {
- if (log.isInfoEnabled()) {
- log.info("Ignore Patient ID " + pid + " for Patient Name " + pname
- + " in object received from " + aet);
- }
- pid = null;
- ds.putLO(Tags.PatientID, pid);
- }
- if (pid == null && generatePatientID != null) {
- if (generatePatientID != null) {
- pid = generatePatientID(ds);
- ds.putLO(Tags.PatientID, pid);
- if (log.isInfoEnabled()) {
- log.info("Add generated Patient ID " + pid
- + " for Patient Name " + pname);
- }
- }
- }
- if (pid != null) {
- String issuer = ds.getString(Tags.IssuerOfPatientID);
- if (issuer == null) {
- issuer = issuerOfPatientIDRules.issuerOf(pid);
- if (issuer != null) {
- ds.putLO(Tags.IssuerOfPatientID, issuer);
- if (log.isInfoEnabled()) {
- log.info("Add missing Issuer Of Patient ID " + issuer
- + " for Patient ID " + pid + " and Patient Name "
- + pname);
- }
- }
- }
- }
}
private boolean contains(Object[] a, Object e) {
@@ -1097,42 +972,6 @@
return false;
}
- private String generatePatientID(Dataset ds) {
- if (generatePatientID.length == 1) {
- return generatePatientID[0];
- }
- int suidHash = ds.getString(Tags.StudyInstanceUID).hashCode();
- String pname = ds.getString(Tags.PatientName);
- // generate different Patient IDs for different studies
- // if no Patient Name
- int pnameHash = (pname == null || pname.length() == 0) ? suidHash : 37
- * ds.getString(Tags.PatientName).hashCode()
- + ds.getString(Tags.PatientBirthDate, "").hashCode();
-
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < generatePatientID.length; i++) {
- append(sb, generatePatientID[i], pnameHash, suidHash);
- }
- return sb.toString();
- }
-
- private void append(StringBuffer sb, String s, int pnameHash, int suidHash) {
- final int l = s.length();
- if (l == 0)
- return;
- char c = s.charAt(0);
- if (c != '#' && c != '$') {
- sb.append(s);
- return;
- }
- String v = Long
- .toString((c == '#' ? pnameHash : suidHash) & 0xffffffffL);
- for (int i = v.length() - l; i < 0; i++) {
- sb.append('0');
- }
- sb.append(v);
- }
-
// Implementation of AssociationListener
public void write(Association src, PDU pdu) {
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScpService.java
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScpService.java 2007-09-05 13:29:26 UTC (rev 4957)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScpService.java 2007-09-06 11:47:56 UTC (rev 4958)
@@ -46,13 +46,10 @@
import java.net.UnknownHostException;
import java.rmi.RemoteException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.ejb.CreateException;
import javax.management.JMException;
@@ -314,22 +311,6 @@
scp.setSerializeDBUpdate(serialize);
}
- public final String getGeneratePatientID() {
- return scp.getGeneratePatientID();
- }
-
- public final void setGeneratePatientID(String pattern) {
- scp.setGeneratePatientID(pattern);
- }
-
- public final String getIssuerOfPatientIDRules() {
- return scp.getIssuerOfPatientIDRules();
- }
-
- public final void setIssuerOfPatientIDRules(String rules) {
- scp.setIssuerOfPatientIDRules(rules);
- }
-
public ObjectName getSchedulerServiceName() {
return scheduler.getSchedulerServiceName();
}
@@ -354,30 +335,6 @@
this.mwlScuServiceName = mwlScuServiceName;
}
- public final String getAcceptPatientID() {
- return scp.getAcceptPatientID();
- }
-
- public final void setAcceptPatientID(String acceptPatientID) {
- scp.setAcceptPatientID(acceptPatientID);
- }
-
- public final String getIgnorePatientID() {
- return scp.getIgnorePatientID();
- }
-
- public final void setIgnorePatientID(String ignorePatientID) {
- scp.setIgnorePatientID(ignorePatientID);
- }
-
- public final String getIgnorePatientIDCallingAETs() {
- return scp.getIgnorePatientIDCallingAETs();
- }
-
- public final void setIgnorePatientIDCallingAETs(String aets) {
- scp.setIgnorePatientIDCallingAETs(aets);
- }
-
public String getCoerceWarnCallingAETs() {
return scp.getCoerceWarnCallingAETs();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|