简体   繁体   English

Nhapi解析问题

[英]Nhapi Parsing Issue

I am new to Nhapi and using it to parse the HL7 message . 我是Nhapi的新手,并用它来解析HL7消息。

The issue i am facing is i am parsing the ADT^A03 message but always i get the PV1 segment as null. 我面临的问题是我正在解析ADT ^ A03消息,但始终将PV1段设为空。

I am attaching the Sample Message and my Code . 我附上示例消息和我的代码。

Sample Message : 样本消息:

MSH|^~\&|MMM|MMM|||201412081017||ADT^A03|2014342370374441||2.3
EVN|A03|201412081017|201412080001||73540
PID|1||000000004449^^^PHS^MR|491662^^^MMM|||19500225|F||1||||||D|CAT|78599180^^M10^MMM^PN|
PD1||1|||||NNN|||||
NK1|0001|NONE AS PER PT^NONE AS PER PT^^^^^L|19||||JUCON||||||||||||||||||||||||||||||
NK1|0002|NONE^^^^^^L|||||PTEMP|||UNEMPLOYED|||||||||||||||||||||||||||
PV1|1|O||R|||001211^RAM SHYAM|001211^RAM SHYAM||SDO||||OU|||001211^RAM SHYAM|U||H^20141208||||||||||||||||AHR|||PNKN|||||201412080625|201412081015
PV2||||||||201412080001|||||||N|||||1||||OD|||||||||||||
GT1|0001||SHYAM^RAM|||||19500225|F|P|01|00000000||||NONE|||||||||||||||||||||||||||||||||||NONE||||
IN1||00000000|^NONE^^^^^^^^L||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||(000)2584-33695|||||||NONE^L||

Code : 代码:

PipeParser parser = new PipeParser();
 IMessage messageParsed = parser.Parse(message);
ADT_A03 a03 = messageParsed as ADT_A03;

PV1Segment pv1Segment = new PV1Segment();
pv1Segment.Set_Id_PV1_1_1 = a03.PV1.SetIDPatientVisit.Value;
pv1Segment.Patient_Class_2_1 = a03.PV1.PatientClass.Value;
pv1Segment.Assigned_Patient_Location_3_1 = a03.PV1.AssignedPatientLocation.PointOfCare.Value;
pv1Segment.Admission_Type_4_1 = a03.PV1.AdmissionType.Value;
pv1Segment.Pre_Admit_Number_5_1 = a03.PV1.PreadmitNumber.ID.Value;
pv1Segment.Prior_Patient_Location_6_1 = a03.PV1.PriorPatientLocation.PointOfCare.Value;
pv1Segment.Attending_Doctor_Id_7_1 = a03.PV1.AttendingDoctor.IDNumber.Value;
pv1Segment.Attending_Doctor_Name_7_2 = a03.PV1.AttendingDoctor.FamilyName.Value;
pv1Segment.Referring_Doctor_Id_8_1 = a03.PV1.ReferringDoctor.IDNumber.Value;
pv1Segment.Referring_Doctor_Name_8_2 = a03.PV1.ReferringDoctor.FamilyName.Value;

Your basic problem here is that you are trying to parse a HL7 2.3 message that doesn't conform to the HL7 2.3 specification for ADT A03 events. 您的基本问题是,您试图解析与ADT A03事件的HL7 2.3规范不符的HL7 2.3消息。

Namely, NK1, GT1 and IN1 segments are not defined in the standard for the ADT A03 event in HL7 version 2.3. 即,在HL7 2.3版的ADT A03事件的标准中未定义NK1,GT1和IN1段。

If you remove the problem segments, the message will parse against the 2.3 specification using your code like so: 如果删除问题片段,则消息将使用您的代码针对2.3规范进行解析,如下所示:

  var parser = new PipeParser();
  var messageParsed = parser.Parse(message);
  var a03 = messageParsed as ADT_A03;

  var setId = a03.PV1.SetIDPatientVisit.Value;
  var patientClass = a03.PV1.PatientClass.Value;
  var AssignedPatientLocation = a03.PV1.AssignedPatientLocation.PointOfCare.Value;
  var Admission_Type = a03.PV1.AdmissionType.Value;
  var Pre_Admit_Number = a03.PV1.PreadmitNumber.ID.Value;
  var Prior_Patient_Location = a03.PV1.PriorPatientLocation.PointOfCare.Value;
  var Attending_Doctor_Id = a03.PV1.AttendingDoctor.IDNumber.Value;
  var Attending_Doctor_Name = a03.PV1.AttendingDoctor.FamilyName.Value;
  var Referring_Doctor_Id = a03.PV1.ReferringDoctor.IDNumber.Value;
  var Referring_Doctor_Name = a03.PV1.ReferringDoctor.FamilyName.Value;

NHapi's model parsing is modelled tightly against the HL7 standards, so you if give it non-standard data like the message you have shown above, it won't handle it gracefully. NHapi的模型解析是严格按照HL7标准建模的,因此,如果给它非标准数据(如上面显示的消息),它将无法正常处理。 (aborting parsing of subsequent segments like in this case). (在这种情况下,中止后续片段的解析)。

You have a couple of options if you want to parse a HL7 message that doesn't quite conform to the standards. 如果要解析不完全符合标准的HL7消息,则有两种选择。

  1. Modify the HL7 standards database and regenerate the code 修改HL7标准数据库并重新生成代码
  2. Extending/replacing the current ADT_A03 class 扩展/替换当前的ADT_A03类

I can tell you from experience that modifying the HL7 standards database (and regenerating) is hard and messy. 我可以从经验中告诉您,修改HL7标准数据库(并重新生成)既困难又麻烦。

I would simply extend the ADT_A03 class in your application and add the definitions of the non-standard segments - that way you will be able to access all of the data. 我只是在您的应用程序中扩展ADT_A03类,并添加非标准段的定义-这样您就可以访问所有数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM