From: Waldron, T. <wal...@KG...> - 2003-07-09 14:20:11
|
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= =2E=20 -----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,=20 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(). =20 Come to think of it, maybe HAPI should be overriding toString(), at least i= n datatypes, to produce reasonable values. I'll make that change if nobody objects. =20 Bryan=20 > -----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 >=20 >=20 > Hi, > I'm trying to get information from the PID segment. I'm=20 > obviously doing something wrong, but I'm not sure what. > This is the code snippet I'm using. >=20 > // Get some patient information from=20 > the PID segment > PID pid =3D (PID)in.get("PID"); > String pname =3D pid.getPatientName().toString(); > //Write the patient name to a log file > try { > =09 > Log.getInstance().log("patient name: " + pname); > } catch (LogException le) { > =09 > System.err.println("Warning: can't write outbound message to=20 > log file"); > }=20 > =09 > What shows in the log is: 9-Jul-2003 8:37:21 AM patient=20 > name: [Lca.uhn.hl7v2.model.v24.datatype.XPN;@143c8b3 > This looks like type information and a pointer to an address.=20 > Am I referencing this wrong? If so how should I be doing this? >=20 > Thanks, >=20 > Terry Waldron > wal...@kg... > Systems Development > Kingston General Hospital > (613)548-2364 x3828 >=20 >=20 >=20 >=20 >=20 > ------------------------------------------------------- > 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 >=20 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. |