尝试使用OOPFactory使用EligibilityBenefitDocument

时间:2016-07-11 15:12:19

标签: c# xml xslt edi

我正在尝试使用OOPFactory来解析271个文件。 (源代码在这里:https://x12parser.codeplex.com/SourceControl/latest)我现在正在努力的部分是获得福利信息。 (我可以很好地获得订阅者和来源信息。)

我已按照此帖中的说明操作: (Anyone translate a X12 271 Healthcare response)我可以使用订阅者和源信息获取EligibilityBenefitDocument,但文档的权益信息最终为空,空或其他一些无用的值。

我已经查看了原始的271数据并验证了我正在寻找的信息确实在那里。 (作为参考,我从多个付款人那里运行多个文件)

我在运行时跟踪了X12SteamReader和X12Parser,并验证了数据是否一直通过解析器。看起来事情与解析器一起运行良好。我不完全确定如何生成EligiblityBenefitDocument。看起来它使用某种xslt转换似乎不适合我的271文件。我已将此调整应用于我的xslt文件(https://x12parser.codeplex.com/workitem/2765) - 它会清除一些空值,但仍无法正确解析。

接下来我应该看什么?

  • 我可能正在使用不受支持的EDI格式。我不知道如何判断是否是这种情况
  • 我已经编程了很长时间,但我从未使用过.NET的XSLT功能吗?有没有人有什么好的链接可以从哪里开始?
  • 如果有人有一个快速解决方案将是真棒。

THX!

====== 编辑1:

以下是解决问题的代码:

    Dim ediFileString = path_to_my_file
    Dim fstream = New FileStream(ediFileString, FileMode.Open, FileAccess.Read)
    Dim service = New EligibilityTransformationService()
    Dim benefitDoc = service.Transform271ToBenefitResponse(fstream)
    Dim responses = benefitDoc.EligibilityBenefitResponses

我从VB.NET而不是C#调用它,但鉴于它全部编译为MSIL,并且Source,Receiver和Subscriber属性都在工作,我认为这不是BenefitInfos的原因所在失败。

====== 编辑2:包含更多代码以响应对我正在尝试做的更多细节的请求

    Dim ediFileString = path_to_my_file
    Dim fstream = New FileStream(ediFileString, FileMode.Open, FileAccess.Read)
    Dim service = New EligibilityTransformationService()
    Dim benefitDoc = service.Transform271ToBenefitResponse(fstream)
    Dim responses = benefitDoc.EligibilityBenefitResponses

    Dim strClient = ""


    For Each client In benefitDoc.EligibilityBenefitResponses
        Try
            strClient = "MemberID: " + tidyNull(client.Subscriber.MemberId) + " Transaction Control Number: " + tidyNull(client.TransactionControlNumber) + Constants.vbCrLf
        Catch ex As Exception

        End Try
        Try
            strClient += "Member Name: " + tidyNull(client.Subscriber.Name.FirstName) + " " + tidyNull(client.Subscriber.Name.MiddleName) + " " + tidyNull(client.Subscriber.Name.LastName) + Constants.vbCrLf
        Catch ex As Exception

        End Try
        Try
            strClient += "Payer Name: " + tidyNull(client.Source.Name.LastName) + Constants.vbCrLf
        Catch ex As Exception

        End Try
        Try
            strClient += "Date of Birth: " + tidyNull(client.Subscriber.SerializableDateOfBirth) + Constants.vbCrLf
        Catch ex As Exception

        End Try
        Try
            strClient += "Address: " + tidyNull(client.Subscriber.Address.Line1)
            strClient += " " + tidyNull(client.Subscriber.Address.Line2) + " " + Constants.vbCrLf
            strClient += "Address: " + tidyNull(client.Subscriber.Address.City) + ", " + tidyNull(client.Subscriber.Address.StateCode) + ", " + tidyNull(client.Subscriber.Address.PostalCode) + Constants.vbCrLf
        Catch ex As Exception

        End Try

        Dim results As List(Of EligibilityBenefitInformation)


        Try
            results = client.BenefitInfos.FindAll(AddressOf searchPlanActive)
            If results.Count > 0 Then
                strClient += "Active Coverage!" + Constants.vbCrLf

            End If
        Catch ex As Exception
            strClient += "Coverage Type: Couldn't be found"
        End Try

        For Each benefit In client.BenefitInfos
            If benefit.Amount IsNot Nothing Then
                strClient &= " Code: " & benefit.Amount
            End If

            strClient &= " Percentage: " & benefit.Percentage
            Try
                strClient &= " CoverageLevel: " & benefit.CoverageLevel.Description
            Catch ex As Exception

            End Try


            Try
                strClient &= " InPlanNetwork: " & benefit.InPlanNetwork.Description
            Catch
            End Try

            Try
                strClient &= " PlanCoverageDescription: " & benefit.PlanCoverageDescription
            Catch ex As Exception

            End Try

            'strClient &= " Messages: " & benefit.Messages.FindLast()

            Try
                strClient &= " Amount: " & benefit.Amount.Value
            Catch ex As Exception

            End Try


            'strClient &= " Amount: " & benefit.AdditionalInfos
            strClient &= Constants.vbCrLf



        Next
        MsgBox(strClient)
    Next

======= 编辑3:

我正在尝试处理5010文件; OOPFactory说“内置规范包含所有4010标准和一些5010规范”https:// x12parser.codeplex.com/(由于缺乏声誉点,无法发布另一个工作链接)

======= 编辑4:

失败似乎发生在第35行的EligibilityTransformationService.cs中。正确的信息是将其转换为XML,但未正确反序列化。

var response = EligibilityBenefitDocument.Deserialize(responseXml);

我正在调查为什么会这样。

===== 编辑5: 在EligiblityTransformationService.cs中,从第32行开始,转换XML然后反序列化。有问题的数据最后一次出现在responseXml变量的第35行,但它从未进入响应对象。

它看起来像是XSLT文件的问题。

            transform.Transform(XmlReader.Create(new StringReader(xml)), new XsltArgumentList(), outputStream);
            outputStream.Position = 0;
            string responseXml = new StreamReader(outputStream).ReadToEnd();
            var response = EligibilityBenefitDocument.Deserialize(responseXml);

1 个答案:

答案 0 :(得分:0)

我实际上在办公室使用同样的方法来完成自己的工作。我们经常遇到的问题是我们收到的响应是null或随机值。我们要做的是继续搜索患者信息,直到我们找到可能会返回给我们的可能结果。例如,如果我们想查找政策日期信息,我们使用:

var service = new EligibilityTransformationService();
EligibilityBenefitDocument eligibilityBenefitDocument = service.Transform271ToBenefitResponse(response271Stream);
eligibilityBenefitDocument.EligibilityBenefitResponses = eligibilityBenefitDocument.EligibilityBenefitResponses;

foreach (EligibilityBenefitInformation benefitInfo in eligibilityBenefitDocument.EligibilityBenefitResponses[0].BenefitInfos)
       {               
           if (benefitInfo.InfoType.Code == "V")
               return Tuple.Create(false, "Medicare cannot process");

           if (benefitInfo.InfoType.Code == "6")
               return Tuple.Create(false, "Inactive Policy");


           if (benefitInfo.InsuranceType.Code == "HN" || benefitInfo.InsuranceType.Code == "12")
           {
               try
               {
                   return Tuple.Create(false, "MADV " + benefitInfo.Identifications[0].Id + " " + benefitInfo.RelatedEntities[0].Name.LastName);
               }
               catch
               {
                   return Tuple.Create(false, "MADV");
               }
           }
       }

我们仍然继续使用这些响应来尝试让它们尽可能准确,但不幸的是,似乎代码可以针对不同的付款人进行更改,并且花费一些时间来确定每个代码如何工作直到您得到他们可能的反应变化。

编辑:

如果响应中没有benefitInfos,则表示您提交的患者信息不正确。我的程序中有以下检查:

if(eligiblityBenefitDocument.EligiblityBenefitResponses[0].BenefitInfos.Count() < 1)
     return "Subscriber Info Invalid"