Esempio n. 1
0
        protected void gvDocuments_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int           documentID    = Convert.ToInt32(e.CommandArgument);
            ClaimDocument claimDocument = null;

            if (e.CommandName == "DoDelete")
            {
                try {
                    ClaimDocumentManager.Delete(documentID);

                    bindData(this.claimID);
                }
                catch (Exception ex) {
                    Core.EmailHelper.emailError(ex);
                }
            }
            else if (e.CommandName == "DoEdit")
            {
                ViewState["ClaimDocumentID"] = e.CommandArgument.ToString();

                claimDocument = ClaimDocumentManager.Get(documentID);
                if (claimDocument != null)
                {
                    pnlEditClaimDocument.Visible = true;
                    pnlGridPanel.Visible         = false;

                    txtDcoumentDescription.Text = claimDocument.Description;

                    bindDocumentCategory(ddlDocumentCategoryEdit);

                    ddlDocumentCategoryEdit.SelectedValue = (claimDocument.DocumentCategoryID ?? 0).ToString();
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Returns the value of 'Your Reference', that will contain the concatenated references from each recipient..
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="claimHeader">The claim header.</param>
        /// <returns>Your Reference. Note, returns NULL if there are no recipients for this document.</returns>
        private string  GetYourReference(ClaimDocument document, ClaimHeader claimHeader)
        {
            // Set your Reference
            string yourReference = null;
            if (document.DocumentRecipients != null)
            {
                List<IDocumentRecipient> docuemntRecipients = document.DocumentRecipients.Where(r => r.RecipientType == (short)StaticValues.RecipientType.To || r.RecipientType == (short)StaticValues.RecipientType.Cc).ToList<IDocumentRecipient>();
                // If we have one recipient then 'Your Reference' is only Custom Reference 01 from the Document Recipient Name Involvement.
                // Otherwise, we cycle through each recipient and prefix their reference with their name, putting a new line before each.
                if (docuemntRecipients.Count > 1)
                {
                    foreach (ClaimDocumentRecipient dr in docuemntRecipients)
                    { 
                        ClaimNameInvolvement ni = (ClaimNameInvolvement)claimHeader.NameInvolvements.Where(a => a.DataId == dr.DocumentRecipientNameInvolvementID).FirstOrDefault();

                        if (ni != null)
                        {
                            yourReference = yourReference + System.Environment.NewLine + dr.RecipientName + " " + "Reference: " + ni.CustomReference01;   // UI Label = Reference; Reference common to all named involvements
                        }
                    }
                }
                else if (docuemntRecipients.Count  == 1)
                {
                    ClaimDocumentRecipient dr = docuemntRecipients.First() as ClaimDocumentRecipient;
                    ClaimNameInvolvement ni = (ClaimNameInvolvement)claimHeader.NameInvolvements.Where(a => a.DataId == dr.DocumentRecipientNameInvolvementID).FirstOrDefault();
                    if (ni != null)
                    {
                        yourReference = ni.CustomReference01;   // UI Label = Reference; Reference common to all named involvements
                    }
                }
            }

           return yourReference; 
        }
Esempio n. 3
0
 public async Task <IActionResult> Edit(ClaimDocumentViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         ClaimDocument claimDocument = new ClaimDocument();
         claimDocument = viewModel.ClaimDocument;
         try
         {
             _context.Update(claimDocument);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!ClaimDocumentExists(claimDocument.ID))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction("Index"));
     }
     return(View(viewModel));
 }
        public string TransformClaimDocumentToFoXml(ClaimDocument document)
        {
            FormDocument form = new FormDocument();

            foreach (var claim in document.Claims)
            {
                if (claim.Type == ClaimTypeEnum.Professional)
                {
                    var pages = _professionalTransformation.TransformClaimToClaimFormFoXml(claim);
                    form.Pages.AddRange(pages);
                }
                else if (claim.Type == ClaimTypeEnum.Institutional)
                {
                    var pages = _institutionalTransformation.TransformClaimToClaimFormFoXml(claim);
                    form.Pages.AddRange(pages);
                }
                else
                    form.Pages.AddRange(_dentalTransformation.TransformClaimToClaimFormFoXml(claim));
            }

            var xml = form.Serialize();

            var transformStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("OopFactory.X12.Hipaa.Claims.Services.Xsl.FormDocument-To-FoXml.xslt");

            var transform = new XslCompiledTransform();
            if (transformStream != null) transform.Load(XmlReader.Create(transformStream));

            var outputStream = new MemoryStream();

            transform.Transform(XmlReader.Create(new StringReader(xml)), new XsltArgumentList(), outputStream);
            outputStream.Position = 0;
            return new StreamReader(outputStream).ReadToEnd();
        }
        public async Task <int> Handle(AddClaimCommand request, CancellationToken cancellationToken)
        {
            var claimDocument = new ClaimDocument();

            claimDocument.Name       = request.Name;
            claimDocument.Year       = request.Year;
            claimDocument.DamageCost = request.DamageCost.ToString("F");
            claimDocument.Type       = request.Type.GetDescription();
            claimDocument.CreatedAt  = DateTime.UtcNow;

            _cosmosDbClaimDocumentService.AddItem(claimDocument);
            var claimChangeNotification = new ClaimChangeEventNotification()
            {
                ClaimAudit = new ClaimAudit()
                {
                    Id          = Convert.ToInt32(claimDocument.Id),
                    Name        = request.Name,
                    Year        = request.Year,
                    DamageCost  = request.DamageCost,
                    Type        = request.Type.GetDescription(),
                    CreatedAt   = claimDocument.CreatedAt,
                    RequestName = "Add Claim"
                }
            };
            await _mediator.Publish(claimChangeNotification);

            return(0);
        }
Esempio n. 6
0
        private void addReportToClaimDocument(string reportPath, int claimID)
        {
            string claimDocumentPath   = null;
            string destinationFilePath = null;

            // get application path
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();

            ClaimDocument claimDocument = new ClaimDocument();

            claimDocument.ClaimID      = claimID;
            claimDocument.IsPrint      = true;
            claimDocument.Description  = "Claim Report";
            claimDocument.DocumentDate = DateTime.Now;
            claimDocument.DocumentName = "Claim_Report.pdf";

            // report category
            claimDocument.DocumentCategoryID = 8;

            claimDocument = ClaimDocumentManager.Save(claimDocument);

            claimDocumentPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, claimDocument.ClaimDocumentID);

            if (!Directory.Exists(claimDocumentPath))
            {
                Directory.CreateDirectory(claimDocumentPath);
            }

            destinationFilePath = claimDocumentPath + "/Claim_Report.pdf";

            System.IO.File.Copy(reportPath, destinationFilePath, true);

            // delete temp file
            //File.Delete(reportPath);
        }
Esempio n. 7
0
        public FormDocument TransformClaimDocumentToFormDocument(ClaimDocument document)
        {
            FormDocument form = new FormDocument();

            foreach (var claim in document.Claims)
            {
                if (claim.Type == ClaimTypeEnum.Professional)
                {
                    var pages = _professionalTransformation.TransformClaimToClaimFormFoXml(claim);
                    form.Pages.AddRange(pages);
                }
                else if (claim.Type == ClaimTypeEnum.Institutional)
                {
                    var pages = _institutionalTransformation.TransformClaimToClaimFormFoXml(claim);
                    form.Pages.AddRange(pages);
                }
                else
                {
                    form.Pages.AddRange(_dentalTransformation.TransformClaimToClaimFormFoXml(claim));
                }
            }


            return(form);
        }
        public static void addLetterToDocumentList(int claimID, string documentPath, string documentDescription)
        {
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();
            string directoryPath = null;

            ClaimDocument claimDocument = new ClaimDocument();
            string destinationPath = null;

            if (!File.Exists(documentPath))
                return;

            string ext = System.IO.Path.GetExtension(documentPath);

            claimDocument.ClaimID = claimID;
            claimDocument.Description = documentDescription;
            claimDocument.DocumentName = Core.ReportHelper.sanatizeFileName(documentDescription) + ext;

            claimDocument.DocumentDate = DateTime.Now;

            claimDocument = ClaimDocumentManager.Save(claimDocument);

            if (claimDocument.ClaimDocumentID > 0) {
                directoryPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, claimDocument.ClaimDocumentID);

                if (!Directory.Exists(directoryPath))
                    Directory.CreateDirectory(directoryPath);

                destinationPath = directoryPath + "/" + claimDocument.DocumentName;

                File.Copy(documentPath, destinationPath);
            }
        }
Esempio n. 9
0
        private void updateDocumentLog(string reportPath, int claimID)
        {
            string appPath      = ConfigurationManager.AppSettings["appPath"].ToString();
            string documentPath = null;

            ClaimDocument objLeadDoc = new ClaimDocument();

            string ActualFileName = Path.GetFileName(reportPath);

            string FileNameWithoutExt = Path.GetFileNameWithoutExtension(reportPath);

            objLeadDoc.ClaimID = claimID;

            objLeadDoc.Description = "Invoice";

            objLeadDoc.DocumentName = ActualFileName;
            objLeadDoc.IsPrint      = false;

            objLeadDoc.DocumentDate = DateTime.Now;

            objLeadDoc = ClaimDocumentManager.Save(objLeadDoc);

            if (objLeadDoc.ClaimDocumentID > 0)
            {
                documentPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, objLeadDoc.ClaimDocumentID);
                if (!Directory.Exists(documentPath))
                {
                    Directory.CreateDirectory(documentPath);
                }

                File.Copy(reportPath, documentPath + "/" + ActualFileName, true);
            }
        }
Esempio n. 10
0
        public static void addReportToClaimDocument(string reportPath, int claimID, int invoiceNumber)
        {
            string claimDocumentPath   = null;
            string destinationFilePath = null;

            // get application path
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();

            ClaimDocument claimDocument = new ClaimDocument();

            claimDocument.ClaimID      = claimID;
            claimDocument.IsPrint      = true;
            claimDocument.Description  = "Invoice";
            claimDocument.DocumentDate = DateTime.Now;
            claimDocument.DocumentName = string.Format("Invoice_{0}.pdf", invoiceNumber);

            // report category: service bill
            claimDocument.DocumentCategoryID = 9;

            claimDocument = ClaimDocumentManager.Save(claimDocument);

            claimDocumentPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, claimDocument.ClaimDocumentID);

            if (!Directory.Exists(claimDocumentPath))
            {
                Directory.CreateDirectory(claimDocumentPath);
            }

            destinationFilePath = claimDocumentPath + string.Format("/Invoice_{0}.pdf", invoiceNumber);

            System.IO.File.Copy(reportPath, destinationFilePath, true);

            // delete temp file
            //File.Delete(reportPath);
        }
Esempio n. 11
0
        public void X12ToHcfaPdfTest()
        {
            Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("OopFactory.X12.Hipaa.Tests.Unit.Claims.TestData.ProfessionalClaim1.txt");

            // new up a ClaimTransformationService object
            var service = new ClaimFormTransformationService(
                new ProfessionalClaimToHcfa1500FormTransformation(@"..\..\..\tests\OopFactory.X12.Hipaa.Tests.Unit\Claims\TestData\Images\HCFA1500_Red.gif"),
                new InstitutionalClaimToUB04ClaimFormTransformation(@"..\..\..\tests\OopFactory.X12.Hipaa.Tests.Unit\Claims\TestDate\Images\UB04_Red.gif"),
                new ProfessionalClaimToHcfa1500FormTransformation(@"..\..\..\tests\OopFactory.X12.Hipaa.Tests.Unit\Claims\TestDate\Images\HCFA1500_Red.gif")
                );

            ClaimDocument document = service.Transform837ToClaimDocument(stream);

            XmlDocument foDocument = new XmlDocument();
            string      foXml      = service.TransformClaimDocumentToFoXml(document);

            foDocument.LoadXml(foXml);

#if DEBUG
            var driver = Fonet.FonetDriver.Make();

            FileStream outputFile = new FileStream("c:\\Temp\\Pdfs\\ProfessionalClaim1.pdf", FileMode.Create, FileAccess.Write);
            driver.Render(foDocument, outputFile);
#endif
        }
        public static void addReportToClaimDocument(string reportPath, int claimID, int invoiceNumber)
        {
            string claimDocumentPath = null;
            string destinationFilePath = null;

            // get application path
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();

            ClaimDocument claimDocument = new ClaimDocument();
            claimDocument.ClaimID = claimID;
            claimDocument.IsPrint = true;
            claimDocument.Description = "Invoice";
            claimDocument.DocumentDate = DateTime.Now;
            claimDocument.DocumentName = string.Format("Invoice_{0}.pdf", invoiceNumber);

            // report category: service bill
            claimDocument.DocumentCategoryID = 9;

            claimDocument = ClaimDocumentManager.Save(claimDocument);

            claimDocumentPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, claimDocument.ClaimDocumentID);

            if (!Directory.Exists(claimDocumentPath))
                Directory.CreateDirectory(claimDocumentPath);

            destinationFilePath = claimDocumentPath + string.Format("/Invoice_{0}.pdf", invoiceNumber);

            System.IO.File.Copy(reportPath, destinationFilePath, true);

            // delete temp file
            //File.Delete(reportPath);
        }
Esempio n. 13
0
        public void X12ToUbPdfTest()
        {
            Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("OopFactory.X12.Hipaa.Tests.Unit.Claims.TestData.InstitutionalClaim5010.txt");

            var transformation = new InstitutionalClaimToUB04ClaimFormTransformation(@"..\..\..\tests\OopFactory.X12.Hipaa.Tests.Unit\Claims\Images\UB04_Red.gif");


            // new up a ClaimTransformationService object
            var service = new ClaimFormTransformationService(transformation, transformation, transformation);

            ClaimDocument document = service.Transform837ToClaimDocument(stream);

            var ub04 = transformation.TransformClaimToUB04(document.Claims.First());

            Trace.WriteLine(ub04.Serialize());

            XmlDocument foDocument = new XmlDocument();
            string      foXml      = service.TransformClaimDocumentToFoXml(document);

            foDocument.LoadXml(foXml);

#if DEBUG
            var driver = Fonet.FonetDriver.Make();

            FileStream outputFile = new FileStream("c:\\Temp\\Pdfs\\InstitutionalClaim5010.pdf", FileMode.Create, FileAccess.Write);
            driver.Render(foDocument, outputFile);
#endif
        }
Esempio n. 14
0
        protected void btnSaveDocumentEdit_Click(object sender, EventArgs e)
        {
            int           claimDocumentID = Convert.ToInt32(ViewState["ClaimDocumentID"]);
            ClaimDocument claimDocument   = null;

            Page.Validate("document");
            if (!Page.IsValid)
            {
                return;
            }

            claimDocument = ClaimDocumentManager.Get(claimDocumentID);

            if (claimDocument != null)
            {
                claimDocument.Description = txtDcoumentDescription.Text.Trim();

                if (ddlDocumentCategoryEdit.SelectedIndex > 0)
                {
                    claimDocument.DocumentCategoryID = Convert.ToInt32(ddlDocumentCategoryEdit.SelectedValue);
                }

                ClaimDocumentManager.Save(claimDocument);
            }

            pnlEditClaimDocument.Visible = false;
            pnlGridPanel.Visible         = true;

            gvDocuments.DataSource = ClaimDocumentManager.GetAll(this.claimID);
            gvDocuments.DataBind();
        }
Esempio n. 15
0
        protected void cbxPrint_CheckedChanged(object sender, EventArgs e)
        {
            ClaimDocument document = null;

            CheckBox cbx = sender as CheckBox;

            GridViewRow row = cbx.NamingContainer as GridViewRow;

            try {
                int documentID = (int)gvDocuments.DataKeys[row.RowIndex].Value;

                document = ClaimDocumentManager.Get(documentID);
                if (document != null)
                {
                    document.IsPrint = cbx.Checked;

                    document = ClaimDocumentManager.Save(document);

                    bindData(this.claimID);
                }
            }
            catch (Exception ex) {
                Core.EmailHelper.emailError(ex);
            }
        }
Esempio n. 16
0
        public static string saveFile(int claimID, string filePath, string documentDescription, int documentCategory)
        {
            string        claimDocumentPath   = null;
            string        destinationFilePath = null;
            ClaimDocument document            = null;
            string        msg = string.Empty;
            // get application path
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();

            // get file from temp folder
            string tempFilePath = HttpContext.Current.Server.MapPath(String.Format("~\\Temp\\{0}", filePath));

            if (claimID > 0) //&& File.Exists(tempFilePath)
            {
                try
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        document                    = new ClaimDocument();
                        document.ClaimID            = claimID;
                        document.DocumentName       = filePath;
                        document.Description        = documentDescription;
                        document.DocumentDate       = DateTime.Now;
                        document.IsPrint            = true;
                        document.DocumentCategoryID = documentCategory;

                        CRM.Data.Account.ClaimDocumentManager.Save(document);

                        claimDocumentPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, document.ClaimDocumentID);

                        if (!Directory.Exists(claimDocumentPath))
                        {
                            Directory.CreateDirectory(claimDocumentPath);
                        }

                        destinationFilePath = claimDocumentPath + "/" + filePath;

                        System.IO.File.Copy(tempFilePath, destinationFilePath, true);

                        // delete temp file
                        File.Delete(tempFilePath);

                        scope.Complete();
                    }
                    msg = "Uploaded";
                }
                catch (Exception ex)
                {
                    Core.EmailHelper.emailError(ex);
                    msg = "Uploaded Fail";
                }
                finally
                {
                }
            }
            return(msg);
        }
        public static ClaimDocument Save(ClaimDocument document)
        {
            if (document.ClaimDocumentID == 0)
            {
                DbContextHelper.DbContext.Add(document);
            }

            DbContextHelper.DbContext.SaveChanges();

            return(document);
        }
        public static ClaimDocument Get(int id)
        {
            ClaimDocument document = null;

            document = (from x in DbContextHelper.DbContext.ClaimDocument
                        where x.ClaimDocumentID == id
                        select x
                        ).FirstOrDefault <ClaimDocument>();

            return(document);
        }
Esempio n. 19
0
        // GET: ClaimDocuments/Create
        public IActionResult Create()
        {
            ClaimDocument claimDocument = new ClaimDocument();

            ClaimDocumentViewModel viewModel = new ClaimDocumentViewModel
            {
                ClaimDocument = claimDocument
            };

            return(View(viewModel));
        }
 /// <summary>
 /// Reads a claim that has been st
 /// </summary>
 /// <param name="stream"></param>
 /// <returns></returns>
 public ClaimDocument Transform837ToClaimDocument(Stream stream)
 {
     var parser = new X12Parser();
     var interchanges = parser.ParseMultiple(stream);
     ClaimDocument doc = new ClaimDocument();
     foreach (var interchange in interchanges)
     {
         var thisDoc = Transform837ToClaimDocument(interchange);
         doc.Claims.AddRange(thisDoc.Claims);
     }
     return doc;
 }
        /// <summary>
        /// Transforms document to XML
        /// </summary>
        /// <param name="document">Document to be transformed</param>
        /// <returns>String XML representation of XML document</returns>
        /// <exception cref="ArgumentNullException">Thrown if document passed is null</exception>
        public string TransformClaimDocumentToFoXml(ClaimDocument document)
        {
            if (document == null)
            {
                throw new ArgumentNullException(nameof(document), Resources.InvalidClaimDocumentError);
            }

            var form = new FormDocument();

            foreach (var claim in document.Claims)
            {
                IList <FormPage> pages;

                switch (claim.Type)
                {
                case ClaimType.Professional:
                    pages = this.professionalTransformation.TransformClaimToClaimFormFoXml(claim);
                    form.Pages.AddRange(pages);
                    break;

                case ClaimType.Institutional:
                    pages = this.institutionalTransformation.TransformClaimToClaimFormFoXml(claim);
                    form.Pages.AddRange(pages);
                    break;

                case ClaimType.Dental:
                    pages = this.dentalTransformation.TransformClaimToClaimFormFoXml(claim);
                    form.Pages.AddRange(pages);
                    break;

                default:
                    // If we get here, then something went extremely wrong
                    throw new InvalidOperationException(Resources.InvalidClaimTypeError);
                }
            }

            string xml             = form.Serialize();
            Stream transformStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("X12.Hipaa.Claims.Services.Xsl.FormDocument-To-FoXml.xslt");

            var transform = new XslCompiledTransform();

            if (transformStream != null)
            {
                transform.Load(XmlReader.Create(transformStream));
            }

            var outputStream = new MemoryStream();

            transform.Transform(XmlReader.Create(new StringReader(xml)), new XsltArgumentList(), outputStream);
            outputStream.Position = 0;
            return(new StreamReader(outputStream).ReadToEnd());
        }
        /// <summary>
        /// Reads a claim that has been st
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        public ClaimDocument Transform837ToClaimDocument(Stream stream)
        {
            var           parser       = new X12Parser();
            var           interchanges = parser.ParseMultiple(stream);
            ClaimDocument doc          = new ClaimDocument();

            foreach (var interchange in interchanges)
            {
                var thisDoc = Transform837ToClaimDocument(interchange);
                doc.Claims.AddRange(thisDoc.Claims);
            }
            return(doc);
        }
Esempio n. 23
0
        /// <summary>
        /// Reads a claim that has been st
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        public ClaimDocument Transform837ToClaimDocument(Stream stream)
        {
            var           interchanges = _parser.ParseMultiple(stream);
            ClaimDocument doc          = new ClaimDocument();

            foreach (var interchange in interchanges)
            {
                var thisDoc = Transform837ToClaimDocument(interchange);
                AddRevenueCodeDescription(thisDoc);
                doc.Claims.AddRange(thisDoc.Claims);
            }
            return(doc);
        }
Esempio n. 24
0
        public void SerializationTest1()
        {
            var document = new ClaimDocument();

            var claim = new Claim
            {
                Type = ClaimType.Institutional,
                PatientControlNumber   = "756048Q",
                TotalClaimChargeAmount = 89.93M
            };

            document.Claims.Add(claim);
            string xml = document.Serialize();
        }
Esempio n. 25
0
        public async Task <IActionResult> Create(ClaimDocumentViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                ClaimDocument claimDocument = new ClaimDocument();
                claimDocument    = viewModel.ClaimDocument;
                claimDocument.ID = Guid.NewGuid();
                _context.Add(claimDocument);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(viewModel));
        }
Esempio n. 26
0
        public static void saveFile(int claimID, string filePath, string documentDescription, int documentCategory)
        {
            string claimDocumentPath = null;
            string destinationFilePath = null;
            ClaimDocument document = null;

            // get application path
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();

            // get file from temp folder
            string tempFilePath = HttpContext.Current.Server.MapPath(String.Format("~\\Temp\\{0}", filePath));

            if (claimID > 0 && File.Exists(tempFilePath)) {
                try {
                    using (TransactionScope scope = new TransactionScope()) {
                        document = new ClaimDocument();
                        document.ClaimID = claimID;
                        document.DocumentName = filePath;
                        document.Description = documentDescription;
                        document.DocumentDate = DateTime.Now;
                        document.IsPrint = true;
                        document.DocumentCategoryID = documentCategory;

                        ClaimDocumentManager.Save(document);

                        claimDocumentPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, document.ClaimDocumentID);

                        if (!Directory.Exists(claimDocumentPath))
                            Directory.CreateDirectory(claimDocumentPath);

                        destinationFilePath = claimDocumentPath + "/" + filePath;

                        System.IO.File.Copy(tempFilePath, destinationFilePath, true);

                        // delete temp file
                        File.Delete(tempFilePath);

                        scope.Complete();
                    }
                }
                catch (Exception ex) {
                    Core.EmailHelper.emailError(ex);
                }
                finally {

                }
            }
        }
        public void SerializationTest1()
        {
            var document = new ClaimDocument();

            var claim = new Claim
            {
                Type = ClaimTypeEnum.Institutional,
                PatientControlNumber = "756048Q",
                TotalClaimChargeAmount = 89.93M
            };

            document.Claims.Add(claim);
            string xml = document.Serialize();

            Trace.Write(xml);
        }
        public async Task Test_AddItemAsync_ShouldAddClaim()
        {
            var service = await TestHelper.GetCosmosDbClaimDocumentService();

            var claimDocument = new ClaimDocument();

            claimDocument.Name       = "Unit Test 2";
            claimDocument.Year       = 2017;
            claimDocument.DamageCost = (12.3M).ToString("#.##");;
            claimDocument.Type       = ClaimType.BadWeather.GetDescription();
            claimDocument.CreatedAt  = DateTime.UtcNow;

            service.AddItem(claimDocument);

            Assert.AreEqual(claimDocument.Year, 2017);
        }
Esempio n. 29
0
        public void X12ToUbPdfLayoutTest()
        {
            Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("X12.Hipaa.Tests.Unit.Claims.TestData.InstitutionalClaim5010.txt");

            var transformation = new InstitutionalClaimToUb04ClaimFormTransformation($"{TestImageDirectory}\\UB04_Red.gif");

            // new up a ClaimTransformationService object
            var service = new ClaimFormTransformationService(transformation, transformation, transformation);

            ClaimDocument document = service.Transform837ToClaimDocument(stream);

            var    fonetDocument = new XmlDocument();
            string fonetXml      = service.TransformClaimDocumentToFoXml(document);

            fonetDocument.LoadXml(fonetXml);
        }
Esempio n. 30
0
        protected void gvDocuments_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            string appUrl = ConfigurationManager.AppSettings["appURL"].ToString();

            int leadId = Core.SessionHelper.getLeadId();

            ClaimDocument document = e.Row.DataItem as ClaimDocument;

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                HyperLink hlnkDocument = e.Row.FindControl("hlnkDocument") as HyperLink;

                hlnkDocument.NavigateUrl = string.Format("{0}/ClaimDocuments/{1}/{2}/{3}", appUrl, document.ClaimID, document.ClaimDocumentID, document.DocumentName);
                hlnkDocument.Text        = document.DocumentName;
            }
        }
        public void AddItem(ClaimDocument claimDocument)
        {
            var id = 1;

            lock (nextIdLock)
            {
                var query  = "SELECT  * FROM Claims c order by c._ts desc";
                var claims = GetItemsAsync(query).GetAwaiter().GetResult();

                if (claims.Count() > 0)
                {
                    id = Convert.ToInt32(claims.FirstOrDefault().Id) + 1;
                }

                claimDocument.Id = id.ToString();
                this._container.CreateItemAsync <ClaimDocument>(claimDocument, new PartitionKey(claimDocument.Id)).GetAwaiter().GetResult();
            }
        }
Esempio n. 32
0
        private async Task <List <ClaimDocument> > ReplaceHtmlTags(List <ClaimDocument> claimDocuments, Claim claim)
        {
            if (claimDocuments == null)
            {
                throw new ArgumentException(nameof(ClaimDocument), "null");
            }

            List <ClaimDocument> result = new List <ClaimDocument>();

            claimDocuments.ForEach(async document =>
            {
                ClaimDocument doc = new ClaimDocument();
                doc.HtmlTemplate  = await ReemplaceTags(document.HtmlTemplate, claim);
                doc.Id            = document.Id;
                result.Add(doc);
            });

            return(result);
        }
Esempio n. 33
0
        public async Task <TResult> CreateOrUpdateAsync <TResult>(Guid actorId, Guid claimId, string type, string value,
                                                                  Func <TResult> onSuccess,
                                                                  Func <TResult> onFailure,
                                                                  Func <TResult> onActorNotFound)
        {
            return(await await repository.FindLinkedDocumentsAsync <ActorMappingsDocument, ClaimDocument, Task <TResult> >(actorId,
                                                                                                                           (ActorMappingsDocument actorMappingsDocument) => actorMappingsDocument.Claims.ToGuidsFromByteArray(),
                                                                                                                           async (ActorMappingsDocument actorMappingsDocument, ClaimDocument[] claimDocuments) =>
            {
                var claimDocs =
                    claimDocuments.Where(
                        doc => string.Compare(doc.Type, type, StringComparison.OrdinalIgnoreCase) == 0)
                    .ToArray();
                if (claimDocs.Length >= 1)
                {
                    var claimDoc = claimDocs[0];
                    return await repository.UpdateAsync <ClaimDocument, TResult>(claimDoc.ClaimId,
                                                                                 async(currentDoc, saveAsync) =>
                    {
                        currentDoc.Value = value;
                        await saveAsync(currentDoc);
                        return onSuccess();
                    },
                                                                                 () => onFailure());
                }

                var rollback = new RollbackAsync <TResult>();
                var newClaimDoc = new ClaimDocument()
                {
                    ClaimId = claimId,
                    Issuer = actorId.ToString("N"),     //TODO - Is this is the correct issuer data???
                    Type = type,
                    Value = value
                };
                rollback.AddTaskCreate(claimId, newClaimDoc, onFailure, repository);
                rollback.AddTaskUpdate(actorId,
                                       (ActorMappingsDocument actorMapDocument) => actorMapDocument.AddClaim(claimId),
                                       (actorMapDocument) => actorMapDocument.RemoveClaim(claimId),
                                       onActorNotFound, repository);
                return await rollback.ExecuteAsync(onSuccess);
            },
                                                                                                                           () => onActorNotFound().ToTask()));
        }
Esempio n. 34
0
        async public void saveFile(object o)
        {
            if (ClaimDocument.DocumentID == 0) // If the ClaimDocument does not already exist.
            {
                if ((ErrorMessage = await new ServiceLayer().AddClaimDocument(ClaimDocument.toDTO())) != null)
                {
                    return;
                }

                ClaimDocument = new ClaimDocument(ServiceLayer.ClaimDocument);
            }
            else // If the ClaimDocument already exists.
            {
                if ((ErrorMessage = await new ServiceLayer().UpdateClaimDocument(ClaimDocument.toDTO())) != null)
                {
                    return;
                }
            }
        }
Esempio n. 35
0
        private void AddRevenueCodeDescription(ClaimDocument claimdoc)
        {
            if (_revenueCodeToDescriptionMapping == null)
            {
                return;
            }

            foreach (Claim claim in claimdoc.Claims)
            {
                foreach (ServiceLine serviceLine in claim.ServiceLines)
                {
                    if (serviceLine.RevenueCode != null)
                    {
                        if (_revenueCodeToDescriptionMapping.ContainsKey(serviceLine.RevenueCode))
                        {
                            serviceLine.RevenueCodeDescription = _revenueCodeToDescriptionMapping[serviceLine.RevenueCode];
                        }
                    }
                }
            }
        }
        public ClaimDocument Transform837ToClaimDocument(Interchange interchange)
        {
            var xml = interchange.Serialize();

            var transformStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("OopFactory.X12.Hipaa.Claims.Services.Xsl.X12-837-To-ClaimDocument.xslt");

            var transform = new XslCompiledTransform();

            if (transformStream != null)
            {
                transform.Load(XmlReader.Create(transformStream));
            }

            var outputStream = new MemoryStream();

            transform.Transform(XmlReader.Create(new StringReader(xml)), new XsltArgumentList(), outputStream);
            outputStream.Position = 0;
            xml = new StreamReader(outputStream).ReadToEnd();

            return(ClaimDocument.Deserialize(xml));
        }
Esempio n. 37
0
        public string TransformClaimDocumentToFoXml(ClaimDocument document)
        {
            FormDocument form = TransformClaimDocumentToFormDocument(document);

            var xml = form.Serialize();

            var transformStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("OopFactory.X12.Hipaa.Claims.Services.Xsl.FormDocument-To-FoXml.xslt");

            var transform = new XslCompiledTransform();

            if (transformStream != null)
            {
                transform.Load(XmlReader.Create(transformStream));
            }

            var outputStream = new MemoryStream();

            transform.Transform(XmlReader.Create(new StringReader(xml)), new XsltArgumentList(), outputStream);
            outputStream.Position = 0;
            return(new StreamReader(outputStream).ReadToEnd());
        }
Esempio n. 38
0
        private Dictionary<string, object> GetMetadata(ClaimDocument claimDocument, ClaimDocumentControlLog claimDocumentControlLog, string reference)
        {
            Dictionary<string, object> metadata = new Dictionary<string, object>();
            string documentType = claimDocument.DocumentTypeCode;
            if (documentType != null)
            {
                //// Add Long description of DocumentType field.
                string documentTypeLongDesc = claimDocument.DocumentTypeCodeField.AllowedValues(Xiap.Framework.Metadata.Enumerations.DescriptionType.LongDescription).FirstOrDefault(a => a.Code == documentType).Description;
                metadata.Add(DOCUMENT_TYPE_FIELDNAME, documentTypeLongDesc);
            }

            string customCode01 = claimDocument.CustomCode01;
            if (customCode01 != null)
            {
                //// Add Long description of CustomCode01 field.
                string customCode01LongDesc = claimDocument.CustomCode01Field.AllowedValues(Xiap.Framework.Metadata.Enumerations.DescriptionType.LongDescription).FirstOrDefault(a => a.Code == customCode01).Description;
                metadata.Add(CATEGORY_FIELDNAME, customCode01LongDesc);
            }

            string customCode02 = claimDocument.CustomCode02;
            if (customCode02 != null)
            {
                //// Add Long description of CustomCode02 field.
                string customCode02LongDesc = claimDocument.CustomCode02Field.AllowedValues(Xiap.Framework.Metadata.Enumerations.DescriptionType.LongDescription).FirstOrDefault(a => a.Code == customCode02).Description;
                metadata.Add(PRIORITY_FIELDNAME, customCode02LongDesc);
            }

            string description = claimDocument.Description;
            if (description != null)
            {
                metadata.Add(DESCRIPTION_FIELDNAME, description);
            }

            string customDescription = claimDocument.CustomDescription01;
            if (customDescription!=null)
            {
                metadata.Add(SENDER_FIELDNAME, customDescription);
            }

            string customCode03 = claimDocument.CustomCode03;
            if (customCode03 != null)
            {
                //// Add Long description of CustomCode03 field.
                string customCode03LongDesc = claimDocument.CustomCode03Field.AllowedValues(Xiap.Framework.Metadata.Enumerations.DescriptionType.LongDescription).FirstOrDefault(a => a.Code == customCode03).Description;
                metadata.Add(ORIGINAL_DOCUMENT_FIELDNAME, customCode03LongDesc);
            }

            string customCode04 = claimDocument.CustomCode04;
            if (customCode04 != null)
            {
                //// Add Long description of CustomCode04 field.
                string customCode04LongDesc = claimDocument.CustomCode04Field.AllowedValues(Xiap.Framework.Metadata.Enumerations.DescriptionType.LongDescription).FirstOrDefault(a => a.Code == customCode04).Description;
                metadata.Add(INCOMING_OUTGOING_FIELDNAME, customCode04LongDesc);
            }

            string customCode05 = claimDocument.CustomCode05;
            if (customCode05 != null)
            {
                //// Add Long description of CustomCode05 field.
                string customCode05LongDesc = claimDocument.CustomCode05Field.AllowedValues(Xiap.Framework.Metadata.Enumerations.DescriptionType.LongDescription).FirstOrDefault(a => a.Code == customCode05).Description;
                metadata.Add(CONFIDENTIAL_FIELDNAME, customCode05LongDesc);
            }

            string customCode06 = claimDocument.CustomCode06;
            if (customCode06 != null)
            {
                //// Add Long description of CustomCode06 field.
                string customCode06LongDesc = claimDocument.CustomCode06Field.AllowedValues(Xiap.Framework.Metadata.Enumerations.DescriptionType.LongDescription).FirstOrDefault(a => a.Code == customCode06).Description;
                metadata.Add(ACTIVE_FIELDNAME, customCode06LongDesc);
            }

            string customReference01 = claimDocument.CustomReference01;
            if (customReference01!=null)
            {
                metadata.Add(EXTERNAL_REFERENCE_FIELDNAME, customReference01);
            }

            string customCode07 = claimDocument.CustomCode07;
            if (customCode07 != null)
            {
                //// Add Long description of CustomCode07 field.
                string customCode07LongDesc = claimDocument.CustomCode07Field.AllowedValues(Xiap.Framework.Metadata.Enumerations.DescriptionType.LongDescription).FirstOrDefault(a => a.Code == customCode07).Description;
                if (customCode07LongDesc!= null)
                {
                    metadata.Add(ACQUISITION_CHANNEL_FIELDNAME, customCode07LongDesc);
                }
            }

            //// Claim Reference
            if (reference!=null)
            {
                metadata.Add(CLAIM_REFERENCE_FIELDNAME, reference);
            }

            string customReference02 = claimDocument.CustomReference02;
            if (customReference02!=null)
            {
                metadata.Add(DIGITALIZATION_ID_FIELDNAME, customReference02);
            }

            DateTime? customDate02 = claimDocument.CustomDate02;
            if (customDate02 != null)
            {
                metadata.Add(PROCESSING_DATE_FIELDNAME, customDate02);
            }


            string lob = null;
            ClaimHeader claimHeader = null;

            claimHeader = claimDocument.ClaimHeader;
            if (claimDocument.ClaimHeader != null)
            {
                lob = claimDocument.ClaimHeader.ClaimHeaderAnalysisCode01;

                if (lob != null)
                {
                    //// Add Long description of ClaimHeader.ClaimHeaderAnalysisCode01 field.
                    string claimHeaderAnalysisCode01LongDesc = claimHeader.ClaimHeaderAnalysisCode01Field.AllowedValues(Xiap.Framework.Metadata.Enumerations.DescriptionType.LongDescription).FirstOrDefault(a => a.Code == lob).Description;
                    if (claimHeaderAnalysisCode01LongDesc!=null)
                    {
                        metadata.Add(LOB_FIELDNAME, claimHeaderAnalysisCode01LongDesc);
                    }
                }

                string company = this.GetCompanyName(claimHeader);
                if (company != null)
                {
                    metadata.Add(ENTITY_FIELDNAME, company);
                }
            }


            DateTime? customDate01 = claimDocument.CustomDate01;
            if (customDate01 != null)
            {
                metadata.Add(RECEPTION_DATE_FIELDNAME, customDate01);
            }

            string documentName = claimDocumentControlLog.DocumentName;
            if (documentName!=null)
            {
                metadata.Add(FILE_NAME_FIELDNAME, documentName);
            }

            DateTime createdTime = claimDocumentControlLog.CreatedTime;
            metadata.Add(UPLOAD_DATE_FIELDNAME, createdTime);

            if (claimDocumentControlLog.CreatedByUserID != null)
            {
                //// Fetch User description
                FrameworkSecurity.User userDetail = FrameworkSecurity.UserCacheService.GetUserById(claimDocumentControlLog.CreatedByUserID.GetValueOrDefault(0));
                if (userDetail != null)
                {
                    string createdByUser = userDetail.UserDescription;
                    if (createdByUser != null)
                    {
                        metadata.Add(UPLOADED_BY_FIELDNAME, createdByUser);
                    }
                }
            }

            string relatedName = claimDocument.RelatedName;
            if (relatedName!=null)
            {
                metadata.Add(RELATED_TO_FIELDNAME, relatedName);
            }

            if (claimDocument!=null)
            {
                string documentTemplateCode = claimDocument.DocumentTemplateCode;
                if (documentTemplateCode != null)
                {
                    //// Add Long description of DocumentTemplateCode.
                    string documentTemplateCodeLongDesc = SystemValueSetCache.GetCodeDescription(claimDocument.DocumentTemplateCode, SystemValueSetCodeEnum.DocumentTemplate, true);
                    if (documentTemplateCodeLongDesc != null)
                    {
                        metadata.Add(DOCUMENT_TEMPLATE_FIELDNAME, documentTemplateCodeLongDesc);
                    }
                }
            }
            
            string documentGroupReference = claimDocument.DocumentGroupReference;
            if (documentGroupReference != null)
            {
                metadata.Add(DOCUMENT_GROUP_REFERENCE_FIELDNAME, documentGroupReference);
            }

            string customCode08 = claimDocument.CustomCode08;
            if (customCode08 != null)
            {
                //// Add Long description of customCode08 field.
                string customCode08LongDesc = claimDocument.CustomCode08Field.AllowedValues(Xiap.Framework.Metadata.Enumerations.DescriptionType.LongDescription).FirstOrDefault(a => a.Code == customCode08).Description;
                metadata.Add(GENERATE_TASK_FIELDNAME, customCode08LongDesc);
            }

            //// Need to add Productcode to the metadata as it is being used in AXASharepointHandler
            string productCode =claimHeader.ProductCode;
            if (productCode!=null)
            {
                metadata.Add("ProductCode", productCode);
            }

            return metadata;
        }
Esempio n. 39
0
        private void addReportToClaimDocument(string reportPath, int claimID)
        {
            string claimDocumentPath = null;
            string destinationFilePath = null;

            // get application path
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();

            ClaimDocument claimDocument = new ClaimDocument();
            claimDocument.ClaimID = claimID;
            claimDocument.IsPrint = true;
            claimDocument.Description = "Claim Report";
            claimDocument.DocumentDate = DateTime.Now;
            claimDocument.DocumentName = "Claim_Report.pdf";

            // report category
            claimDocument.DocumentCategoryID = 8;

            claimDocument = ClaimDocumentManager.Save(claimDocument);

            claimDocumentPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, claimDocument.ClaimDocumentID);

            if (!Directory.Exists(claimDocumentPath))
                Directory.CreateDirectory(claimDocumentPath);

            destinationFilePath = claimDocumentPath + "/Claim_Report.pdf";

            System.IO.File.Copy(reportPath, destinationFilePath, true);

            // delete temp file
            //File.Delete(reportPath);
        }
        private void updateDocumentLog(string reportPath, int claimID)
        {
            string appPath = ConfigurationManager.AppSettings["appPath"].ToString();
            string documentPath = null;

            ClaimDocument objLeadDoc = new ClaimDocument();

            string ActualFileName = Path.GetFileName(reportPath);

            string FileNameWithoutExt = Path.GetFileNameWithoutExtension(reportPath);

            objLeadDoc.ClaimID = claimID;

            objLeadDoc.Description = "Invoice";

            objLeadDoc.DocumentName = ActualFileName;
            objLeadDoc.IsPrint = false;

            objLeadDoc.DocumentDate = DateTime.Now;

            objLeadDoc = ClaimDocumentManager.Save(objLeadDoc);

            if (objLeadDoc.ClaimDocumentID > 0) {

                documentPath = string.Format("{0}/ClaimDocuments/{1}/{2}", appPath, claimID, objLeadDoc.ClaimDocumentID);
                if (!Directory.Exists(documentPath)) {
                    Directory.CreateDirectory(documentPath);
                }

                File.Copy(reportPath, documentPath + "/" + ActualFileName, true);
            }
        }
Esempio n. 41
0
        /// <summary>
        /// Gets Third Party's vehicle reg number(s).
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="claimHeader">The claim header.</param>
        /// <returns>Third Party's registration number(s), or blank if none found.</returns>
        private string GetYourVehicalRegNumber(ClaimDocument document, ClaimHeader claimHeader)
        {
            string yourVehicalRegNumber = string.Empty;
            // Cycle through all the Claim Involvements for the claim.
            foreach (ClaimInvolvement cl in claimHeader.ClaimInvolvements)
            {
                bool  cnexists = cl.ClaimNameInvolvements.Any(c => c.DataId.Equals(document.RelatedNameInvolvementID));
                if (cnexists)
                {
                    // If a claim involvement exists of Related Name Involvment Type then get a list of any over Claim Involvements it links to.
                    List<ClaimInvolvementLink> claimInvolvementLinks = claimHeader.ClaimInvolvementLinks.Where(c => c.ClaimInvolvementFrom.ClaimInvolvementID == cl.ClaimInvolvementID && c.ClaimInvolvementFrom.DataId == cl.DataId).ToList<ClaimInvolvementLink>();

                    if (claimInvolvementLinks != null)
                    {
                        // Cycle through any links to this Related Name Involvement
                        foreach (ClaimInvolvementLink clink in claimInvolvementLinks)
                        {
                            // Only look at linking Claim Involvments that are Insured Objects
                            ClaimInvolvement lst = claimHeader.ClaimInvolvements.Where(ni => ni.ClaimInvolvementType == (short)StaticValues.LinkableComponentType.InsuredObject && ni.DataId == clink.ClaimInvolvementTo.DataId  && ni.ClaimInvolvementID == clink.ClaimInvolvementTo.ClaimInvolvementID).FirstOrDefault();
                            if (lst != null)
                            {
                                // Only accept a Vehicle type Insured Object.
                                ClaimIOVehicle vehical = lst.ClaimInsuredObjects.First(x=>x.InternalIOType == (short)StaticValues.InternalIOType.Vehicle).ClaimIOVehicles.FirstOrDefault();
                                if (vehical != null)
                                {
                                    // Concatenate this Vehicle Registration number with any others already retrieved.
                                    if (yourVehicalRegNumber == string.Empty)
                                    {
                                        yourVehicalRegNumber = vehical.RegistrationNumber;
                                    }
                                    else
                                    {
                                        yourVehicalRegNumber = yourVehicalRegNumber + ", " + vehical.RegistrationNumber;
                                    }
                                }
                            }
                        }
                    }

                    break;
                }
            }

            return yourVehicalRegNumber;
        }
Esempio n. 42
0
        /// <summary>
        /// Determines whether data entry is allowed on the specified document.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <returns>True if data entry is allowed, false otherwise.</returns>
        private bool IsDataEntryAllowedOnDocument(ClaimDocument document)
        {
            bool result = false;

            // Checks if the document isn't at status 'final', it has DocumentTextSegments and any segments have been updated (are 'dirty')
            if (document.DocumentDraftStatus != (short)StaticValues.DocumentDraftStatus.Final 
                && document.DocumentTextSegments != null && document.DocumentTextSegments.Any(a => ((ClaimDocumentTextSegment)a).DirtyPropertyList.Count > 0))
            {
                IDocumentControlLog dcl = document.LatestDocumentControlLog;
                if (dcl == null)
                {
                    // There is no latest document control log in existence so data entry is allowed.
                    result = true;
                }
                else if ((document.IsDocumentResubmitted && dcl.DocumentStatus != (short)StaticValues.DocumentStatus.Uploaded)
                            || dcl.DocumentStatus == (short)StaticValues.DocumentStatus.DataEntryPending
                            || dcl.DocumentStatus == (short)StaticValues.DocumentStatus.Unprocessed)
                {
                    // Allow editing if document has been resubmitted, uploaded, is awaiting Data Entry or is unprocessed.
                    result = true;
                }
            }            

            return result;
        }