Generating 999 Acknowledgements – JS

Index

    Generating 999 Acknowledgements

    A 999 Acknowledgement can be generated after calling the validate() method on the EDIValidator component. Ack999Generator uses the Errors property as well as the loaded EDI document from the EDIValidator component to create acknowledgements.

    Example

    const edi = require(‘rdpcrystal-edi-library’);
     
    let validator = new edi.EDIValidator();
     
    validator.EDIRulesFileData = “Set your rules here”;
    validator.LoadValidatedData = true;
    validator.EDIDataString = “Set your EDI data here”;
     
    validator.validate();
     
    //Generate 5010 999 Acknowledgment File
    let ack999Generator = new edi.Ack999Generator();
    let ackDocument = ack999Generator.generate(validator);
     
    console.log(ackDocument.generateEDIData());
     
     
    Typed5010Document doc = newTyped5010Document(ediValidator.EDILightWeightDocument);
     
    DocumentLoop stHeaderLoop = doc.MainSection.GetLoop(“FUNCTIONAL GROUP/ST HEADER”);
     
    //Get the 2000A BILLING/PAY-TO PROVIDER HIERARCHICAL LEVEL. In an 837 file this loop is 2000A
    //Then get all the subscribers and claims information.  This is loop 2000B
    List<DocumentLoop> subscriberAndClaimsSections = stHeaderLoop.GetLoops(“2000A/2000B”);
     
    private void SaveAllClaims(List<DocumentLoop> claims)
            {
                int patientRecordID = 1;
                int claimRecordID = 1;
                int serviceLineRecordID = 1;
     
                foreach (DocumentLoop claimSection in claims)
                {
                    SBR subscriber = claimSection.GetSegment<SBR>();
                    DocumentLoop subscriberInfo = claimSection.GetLoop(“2010BA”);
                    NM1 subName = subscriberInfo.GetSegment<NM1>();
     
                    DMG demographics = subscriberInfo.GetSegment<DMG>();
     
                    DocumentLoop insuranceInfoSection = claimSection.GetLoop(“2010BB”);
                    NM1 insuranceName = insuranceInfoSection.GetSegment<NM1>();
     
                    string insert = String.Format(“INSERT INTO Patients (Id, First, Last, Insurance, Relationship, InsuranceType, DOB, Gender) VALUES ({0},'{1}’,'{2}’,'{3}’,'{4}’,'{5}’,'{6}’,'{7}’)”,
                    patientRecordID, subName.FirstName, subName.NameLastOrOrganizationName, insuranceName.NameLastOrOrganizationName, subscriber.IndividualRelationshipCode, subscriber.ClaimFilingIndicatorCode, demographics.DateTimePeriod, demographics.GenderCode);
     
                    SQLiteCommand command = new SQLiteCommand(insert, dbConnection);
                    command.ExecuteNonQuery();
     
                    List<DocumentLoop> claimLoopSections = claimSection.GetLoops(“2300”);
     
                    foreach (DocumentLoop cl in claimLoopSections)
                    {
                        CLM clm = cl.GetSegment<CLM>();
                        HI hi = cl.GetSegment<HI>();
     
                        string diagnosisCode = hi.HealthCareCodeInformation1.IndustryCode1;
                        string claimTable = String.Format(“INSERT INTO Claims (Id, PatientID, ClaimID, Amount, Diagnosis1) VALUES ({0},{1},'{2}’,{3},'{4}’)”,
                         claimRecordID, patientRecordID, clm.ClaimSubmitterIdentifier, clm.MonetaryAmount, diagnosisCode);
     
                        command = new SQLiteCommand(claimTable, dbConnection);
                        command.ExecuteNonQuery();
     
                        List<DocumentLoop> serviceLineSections = cl.GetLoops(“2400”);
                        foreach (DocumentLoop sl in serviceLineSections)
                        {
                            //Get the service line segment
                            SV1 sv1 = sl.GetSegment<SV1>();
                            DTP serviceDate = sl.GetSegment<DTP>();
     
                            string serviceLine = String.Format(“INSERT INTO ServiceLines (Id, ClaimID, Procedure, Charge, ServiceDate) VALUES ({0},{1},'{2}’,{3},'{4}’)”,
                                serviceLineRecordID++, claimRecordID, sv1.CompositeMedicalProcedureIdentifier.ProductServiceID1, sv1.MonetaryAmount1, serviceDate.DateTimePeriod);
     
                            command = new SQLiteCommand(serviceLine, dbConnection);
                            command.ExecuteNonQuery();
                        }
     
                        claimRecordID++;
                    }
     
                    patientRecordID++;
                }
            }
    in 999 Acknowledgement Generator – JS
    Did this article answer your question?