LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-17-2012, 10:41 AM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Rep: Reputation: 83
hapi - is it possible to get information from abstract structures like Message?


Hi!

Does anybody know how to get information from hapi basic structures (when for example receiving a message from an unsupported version protocol).

Say you start with an instance of ca.uhn.hl7v2.model.Message and you want to work with the values of the MSH segment. How is that done?

Thanks in advance.
 
Old 04-24-2012, 02:09 PM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian
Posts: 2,396

Rep: Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814Reputation: 814
ExampleUseTerser looks relevant. Also see HandlingMultipleVersions
 
1 members found this post helpful.
Old 05-24-2012, 09:54 AM   #3
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
I find it quite interesting.... however I don't know the different protocol versions that much to know if they change a lot between them (hell, I don't know any of them too well). What I will end up doing is supporting all protocol versions I need and use instanceof and casting a lot.

Code:
if (message instanceof ca.uhn.hl7v2.model.v21.message.ORU_R01) {
	ca.uhn.hl7v2.model.v21.message.ORU_R01 oru = (ca.uhn.hl7v2.model.v21.message.ORU_R01) message;
	patientID = oru.getPATIENT_RESULT().getPATIENT().getPID().getPid3_PATIENTIDINTERNALINTERNALID().getCk1_IDNumber().getValue();
	// what are the results?
} else if (message instanceof ca.uhn.hl7v2.model.v22.message.ORU_R01) {
	ca.uhn.hl7v2.model.v22.message.ORU_R01 oru = (ca.uhn.hl7v2.model.v22.message.ORU_R01) message;
	patientID = oru.getPATIENT_RESULT().getPATIENT().getPID().getPid3_PatientIDInternalID(0).getCm_pat_id1_IDNumber().getValue();
} else if (message instanceof ca.uhn.hl7v2.model.v23.message.ORU_R01) {
	ca.uhn.hl7v2.model.v23.message.ORU_R01 oru = (ca.uhn.hl7v2.model.v23.message.ORU_R01) message;
	patientID = oru.getRESPONSE().getPATIENT().getPID().getPid3_PatientIDInternalID(0).getCx1_ID().getValue();
} else if (message instanceof ca.uhn.hl7v2.model.v231.message.ORU_R01) {
	ca.uhn.hl7v2.model.v231.message.ORU_R01 oru = (ca.uhn.hl7v2.model.v231.message.ORU_R01) message;
	patientID = oru.getPIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI().getPIDPD1NK1NTEPV1PV2().getPID()
			.getPid3_PatientIdentifierList(0).getCx1_ID().getValue();
} else if (message instanceof ca.uhn.hl7v2.model.v24.message.ORU_R01) {
	ca.uhn.hl7v2.model.v24.message.ORU_R01 oru = (ca.uhn.hl7v2.model.v24.message.ORU_R01) message;
	patientID = oru.getPATIENT_RESULT().getPATIENT().getPID().getPid3_PatientIdentifierList(0).getCx1_ID().getValue();
} else if (message instanceof ca.uhn.hl7v2.model.v25.message.ORU_R01) {
	ca.uhn.hl7v2.model.v25.message.ORU_R01 oru = (ca.uhn.hl7v2.model.v25.message.ORU_R01) message;
	patientID = oru.getPATIENT_RESULT().getPATIENT().getPID().getPid3_PatientIdentifierList(0).getCx1_IDNumber().getValue();
} else if (message instanceof ca.uhn.hl7v2.model.v251.message.ORU_R01) {
	ca.uhn.hl7v2.model.v251.message.ORU_R01 oru = (ca.uhn.hl7v2.model.v251.message.ORU_R01) message;
	patientID = oru.getPATIENT_RESULT().getPATIENT().getPID().getPid3_PatientIdentifierList(0).getCx1_IDNumber().getValue();
} else if (message instanceof ca.uhn.hl7v2.model.v26.message.ORU_R01) {
	ca.uhn.hl7v2.model.v26.message.ORU_R01 oru = (ca.uhn.hl7v2.model.v26.message.ORU_R01) message;
	patientID = oru.getPATIENT_RESULT().getPATIENT().getPID().getPid3_PatientIdentifierList(0).getCx1_IDNumber().getValue();
}

Last edited by eantoranz; 05-24-2012 at 09:55 AM.
 
Old 05-24-2012, 09:59 AM   #4
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
By the way, I took that from a previous revision of my code so I think the way I'm getting the patient ID is not correct... but you get the concept, don't you?
 
  


Reply

Tags
abstract, hapi, hl7, java, message


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Abstract lvm information Linux sandeep_hello Programming 1 03-20-2011 02:48 AM
Why do I get the message "Another app is accessing Software information"? neolithic_psyche Fedora 2 05-24-2007 03:33 PM
c++ Abstract Base Classes exodist Programming 1 06-11-2005 06:05 PM
Abstract Control Model juris Linux - Networking 0 10-26-2004 03:45 AM
interface vs abstract (Java) Mohsen Programming 2 07-24-2004 02:06 PM


All times are GMT -5. The time now is 04:17 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration