From: Laurent H. <ld...@36...> - 2013-06-18 20:52:30
|
This is how we do it. I would do it more cleanly if I were to write this again now, but this should point you in the right direction: - We have individual classes to store the data we care about from each segment (see later) - We try to get a segment from the message - If the message is not there, we just throw an exception, ignore and continue protected HL7Record(Message Msg) throws DataTypeException, HL7Exception { try { _PID = new HL7PID((PID)Msg.get("PID")); } catch (HL7Exception E) { } try { Segment segment = (Segment)Msg.get("PV1"); if (segment != null) _PV = new HL7PV((PV1)segment, (PV2)Msg.get("PV2")); } catch (HL7Exception E) { } try { Structure[] Structs = Msg.getAll("DG1"); if (Structs != null && Structs.length > 0) { _DG1 = new HL7DG1[Structs.length]; for (int i = 0; i < Structs.length; ++i) _DG1[i] = new HL7DG1((DG1)Structs[i]); } } catch (HL7Exception E) { } try { Structure[] Structs = Msg.getAll("INSURANCE"); if (Structs != null && Structs.length > 0) _IN1 = new HL7IN1(Structs); } catch (HL7Exception E) { } try { Structure[] Structs = Msg.getAll("AL1"); if (Structs != null && Structs.length > 0) _AL1 = new HL7AL1(Structs); } catch (HL7Exception E) { } try { Segment s = (Segment) Msg.get("MRG"); if (s != null) _MRG = new HL7MRG((MRG)s); } catch (Exception E) { } } And then, for an individual class, for example DG1, we do simple mappings: public class HL7DG1 { public final String _SetId ; public final String _CodingMethod ; public final String _Code ; public final String _Description ; public final HL7DTM _DateTime ; public final String _Type ; public final String _MajorCategory ; public final String _RelatedGroup ; public final HL7XCN _Clinician ; public final String _Classification; public final String _Confidential ; public final String _Identifier ; public HL7DG1(DG1 Diagnosis) throws DataTypeException, HL7Exception { /*DG1-1: Set ID - DG1 (SI) */ _SetId = Diagnosis.getSetIDDG1().getValue(); /*DG1-2: Diagnosis Coding Method (NULLDT) optional */ _CodingMethod = Diagnosis.getDiagnosisCodingMethod().getValue(); /*DG1-3: Diagnosis Code - DG1 (CWE) */ _Code = MakeSureItsAlright(Diagnosis.getDiagnosisCodeDG1().getIdentifier().getValue( ), _CodingMethod); /*DG1-4: Diagnosis Description (NULLDT) optional */ _Description = Diagnosis.getDiagnosisDescription().getValue(); /*DG1-5: Diagnosis Date/Time (DTM) optional */ _DateTime = new HL7DTM(Diagnosis.getDiagnosisDateTime()); /*DG1-6: Diagnosis Type (IS) */ _Type = Diagnosis.getDiagnosisType().getValue(); /*DG1-7: Major Diagnostic Category (CNE) optional */ _MajorCategory = Diagnosis.getMajorDiagnosticCategory().getIdentifier().getValue(); /*DG1-8: Diagnostic Related Group (CNE) optional */ _RelatedGroup = Diagnosis.getDiagnosticRelatedGroup().getIdentifier().getValue(); /*DG1-9: DRG Approval Indicator (ID) optional */ /*DG1-10: DRG Grouper Review Code (IS) optional */ /*DG1-11: Outlier Type (CWE) optional */ /*DG1-12: Outlier Days (NM) optional */ /*DG1-13: Outlier Cost (CP) optional */ /*DG1-14: Grouper Version And Type (NULLDT) optional */ /*DG1-15: Diagnosis Priority (ID) optional */ /*DG1-16: Diagnosing Clinician (XCN) optional repeating */ _Clinician = new HL7XCN(Diagnosis.getDiagnosingClinician(0)); /*DG1-17: Diagnosis Classification (IS) optional */ _Classification = Diagnosis.getDiagnosisClassification().getValue(); /*DG1-18: Confidential Indicator (ID) optional */ _Confidential = Diagnosis.getConfidentialIndicator().getValue(); /*DG1-19: Attestation Date/Time (DTM) optional */ /*DG1-20: Diagnosis Identifier (EI) optional */ _Identifier = Diagnosis.getDiagnosisIdentifier().getEntityIdentifier().getValue(); /*DG1-21: Diagnosis Action Code (ID) optional */ /*DG1-22: Parent Diagnosis (EI) optional */ /*DG1-23: DRG CCL Value Code (CWE) optional */ /*DG1-24: DRG Grouping Usage (ID) optional */ /*DG1-25: DRG Diagnosis Determination Status (IS) optional */ /*DG1-26: Present On Admission (POA) Indicator (IS) optional */ } } What I have found to be the biggest pain is to figure out if the data is in x.getValue(), or x. getIdentifier().getValue() etc. Additionally, again, I would do it a bit differently today and make this a lot more flexible by using the basic parser and access fields with HL7 "paths" J ___________________________________________________________ Laurent Hasson Co-Founder and CTO 360Fresh Inc. Cell: 646.283.2186 Office: 5 Penn Plaza, Suite 1986, NY NY 10001 This e-mail may contain confidential and/or privileged information. This information is intended only for the use of the individual(s) and entity(ies) to whom it is addressed. If you are the intended recipient, further disclosures are prohibited without proper authorization. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden and possibly a violation of federal or state law and regulations. -----Original Message----- From: sagarshah1983 [mailto:sag...@ci...] Sent: Tuesday, June 18, 2013 11:32 To: hl7...@li... Subject: Re: [HAPI-devel] Generic class for ADT message That would be really great for me. Appreciate your reply and time for the same. Regards, Sagar Shah LDH-2 wrote: > > I am not aware of one in 1.x... I don't know 2.x well enough yet. I am > on the road, but I can send out later the type of code I have used to > be adt generic. > > > > ___________________________________________ > Laurent Hasson (via my BlackBerry) > email: <mailto:ld...@36...> ld...@36... > cell: 646-283-2186 > twitter: @ldhasson > > -----Original Message----- > From: sagarshah1983 < <mailto:sag...@ci...> sag...@ci...> > Date: Tue, 18 Jun 2013 08:53:15 > To: < <mailto:hl7...@li...> hl7...@li...> > Subject: [HAPI-devel] Generic class for ADT message > > ---------------------------------------------------------------------- > -------- This SF.net email is sponsored by Windows: > > Build for Windows Store. > > <http://p.sf.net/sfu/windows-dev2dev> http://p.sf.net/sfu/windows-dev2dev > > ---------------------------------------------------------------------- > -------- This SF.net email is sponsored by Windows: > > Build for Windows Store. > > <http://p.sf.net/sfu/windows-dev2dev> http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > Hl7api-devel mailing list > <mailto:Hl7...@li...> Hl7...@li... > <https://lists.sourceforge.net/lists/listinfo/hl7api-devel> https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > -- View this message in context: <http://old.nabble.com/Generic-class-for-ADT-message-tp35639316p35639472.htm l> http://old.nabble.com/Generic-class-for-ADT-message-tp35639316p35639472.html Sent from the hl7api-devel mailing list archive at Nabble.com. ---------------------------------------------------------------------------- -- This SF.net email is sponsored by Windows: Build for Windows Store. <http://p.sf.net/sfu/windows-dev2dev> http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Hl7api-devel mailing list <mailto:Hl7...@li...> Hl7...@li... <https://lists.sourceforge.net/lists/listinfo/hl7api-devel> https://lists.sourceforge.net/lists/listinfo/hl7api-devel |