From: Tripp, B. <Bry...@uh...> - 2003-07-09 14:57:30
|
Hi Terry, Whoops, I meant getGivenName(). If you have an XPN you should be able to call getGivenName() on it. Does that not work? Can you send your code? Thanks, Bryan > -----Original Message----- > From: Waldron, Terry [mailto:wal...@KG...] > Sent: July 9, 2003 10:20 AM > To: Tripp, Bryan; hl7...@li... > Subject: RE: [HAPI-devel] Getting information from a message > > > That makes sense but where do I find these methods: > getFirstName().getValue() > The class ca.uhn.hl7v2.model.v24.segment.PID does not contain > these methods not are they inherited from the XPN class. > The XPN class has getFamilyName() and getGivenName() but I > don't seem to be able to access them. Not sure what I doing wrong. > Even though the XPN object is returned, the other methods are > not available. > > -----Original Message----- > From: Tripp, Bryan [mailto:Bry...@uh...] > Sent: July 9, 2003 9:14 AM > To: Waldron, Terry; 'hl7...@li...' > Subject: RE: [HAPI-devel] Getting information from a message > > > Hi Terry, > > The call to getPatientName() just returns an XPN object, so to get a > particular field (e.g. first name) you would do something like this: > pid.getPatientName().getFirstName().getValue() Note also the > getValue() at > the end -- this extracts the data String from the ST that is > returned by > getFirstName(). > > Come to think of it, maybe HAPI should be overriding > toString(), at least in > datatypes, to produce reasonable values. I'll make that > change if nobody > objects. > > Bryan > > > -----Original Message----- > > From: Waldron, Terry [mailto:wal...@KG...] > > Sent: July 9, 2003 8:55 AM > > To: hl7...@li... > > Subject: [HAPI-devel] Getting information from a message > > > > > > Hi, > > I'm trying to get information from the PID segment. I'm > > obviously doing something wrong, but I'm not sure what. > > This is the code snippet I'm using. > > > > // Get some patient information from > > the PID segment > > PID pid = (PID)in.get("PID"); > > String pname = pid.getPatientName().toString(); > > //Write the patient name to a log file > > try { > > > > Log.getInstance().log("patient name: " + pname); > > } catch (LogException le) { > > > > System.err.println("Warning: can't write outbound message to > > log file"); > > } > > > > What shows in the log is: 9-Jul-2003 8:37:21 AM patient > > name: [Lca.uhn.hl7v2.model.v24.datatype.XPN;@143c8b3 > > This looks like type information and a pointer to an address. > > Am I referencing this wrong? If so how should I be doing this? > > > > Thanks, > > > > Terry Waldron > > wal...@kg... > > Systems Development > > Kingston General Hospital > > (613)548-2364 x3828 > > > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email sponsored by: Parasoft > > Error proof Web apps, automate testing & more. > > Download & eval WebKing and get a free book. > > www.parasoft.com/bulletproofapps > > _______________________________________________ > > Hl7api-devel mailing list > > Hl7...@li... > > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > > > > This e-mail may contain confidential and/or privileged information > for the sole use of the intended recipient. Any review or distribution > by anyone other than the person for whom it was originally intended is > strictly > prohibited. If you have received this e-mail in error, please > contact the > sender and > delete all copies. Opinions, conclusions or other information > contained in > this e-mail may not be that of the organization. > > > This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Opinions, conclusions or other information contained in this e-mail may not be that of the organization. |