Exemple #1
0
        ///<summary>Called from Eclaims and includes multiple claims.  Returns the string that was sent.
        ///The string needs to be parsed to determine the transaction numbers used for each claim.</summary>
        public static string SendBatch(Clearinghouse clearinghouseClin, List <ClaimSendQueueItem> queueItems, int batchNum, EnumClaimMedType medType,
                                       bool isAutomatic)
        {
            //each batch is already guaranteed to be specific to one clearinghouse, one clinic, and one EnumClaimMedType
            //Clearinghouse clearhouse=ClearinghouseL.GetClearinghouse(queueItems[0].ClearinghouseNum);
            string saveFile = GetFileName(clearinghouseClin, batchNum, isAutomatic);

            if (saveFile == "")
            {
                return("");
            }
            string messageText = "";

            using (MemoryStream ms = new MemoryStream()) {
                using (StreamWriter sw = new StreamWriter(ms)) {
                    if (clearinghouseClin.Eformat == ElectronicClaimFormat.x837D_4010)
                    {
                        X837_4010.GenerateMessageText(sw, clearinghouseClin, batchNum, queueItems);
                    }
                    else                      //Any of the 3 kinds of 5010
                    {
                        X837_5010.GenerateMessageText(sw, clearinghouseClin, batchNum, queueItems, medType);
                    }
                    sw.Flush();                    //Write contents of sw into ms.
                    ms.Position = 0;               //Reset position to 0, or else the StreamReader below will not read anything.
                    using (StreamReader sr = new StreamReader(ms, Encoding.ASCII)) {
                        messageText = sr.ReadToEnd();
                    }
                }
            }
            if (clearinghouseClin.IsClaimExportAllowed)
            {
                if (clearinghouseClin.CommBridge == EclaimsCommBridge.PostnTrack)
                {
                    //need to clear out all CRLF from entire file
                    messageText = messageText.Replace("\r", "");
                    messageText = messageText.Replace("\n", "");
                }
                File.WriteAllText(saveFile, messageText, Encoding.ASCII);
                CopyToArchive(saveFile);
            }
            return(messageText);
        }
Exemple #2
0
        ///<summary>Helper method for SendBatch that generates the X837 messagetext. This method is public as it is used in ClaimConnect.cs</summary>
        public static string GenerateBatch(Clearinghouse clearinghouseClin, List <ClaimSendQueueItem> queueItems, int batchNum, EnumClaimMedType medType)
        {
            string messageText = "";

            using (MemoryStream ms = new MemoryStream()) {
                using (StreamWriter sw = new StreamWriter(ms)) {
                    if (clearinghouseClin.Eformat == ElectronicClaimFormat.x837D_4010)
                    {
                        X837_4010.GenerateMessageText(sw, clearinghouseClin, batchNum, queueItems);
                    }
                    else                      //Any of the 3 kinds of 5010
                    {
                        X837_5010.GenerateMessageText(sw, clearinghouseClin, batchNum, queueItems, medType);
                    }
                    sw.Flush();                    //Write contents of sw into ms.
                    ms.Position = 0;               //Reset position to 0, or else the StreamReader below will not read anything.
                    using (StreamReader sr = new StreamReader(ms, Encoding.ASCII)) {
                        messageText = sr.ReadToEnd();
                    }
                }
            }
            return(messageText);
        }
Exemple #3
0
        ///<summary>Called from Eclaims and includes multiple claims.  Returns the string that was sent.  The string needs to be parsed to determine the transaction numbers used for each claim.</summary>
        public static string SendBatch(List <ClaimSendQueueItem> queueItems, int batchNum, Clearinghouse clearhouse, EnumClaimMedType medType)
        {
            //each batch is already guaranteed to be specific to one clearinghouse, one clinic, and one EnumClaimMedType
            //Clearinghouse clearhouse=ClearinghouseL.GetClearinghouse(queueItems[0].ClearinghouseNum);
            string saveFile = GetFileName(clearhouse, batchNum);

            if (saveFile == "")
            {
                return("");
            }
            using (StreamWriter sw = new StreamWriter(saveFile, false, Encoding.ASCII)){
                if (clearhouse.Eformat == ElectronicClaimFormat.x837D_4010)
                {
                    X837_4010.GenerateMessageText(sw, clearhouse, batchNum, queueItems);
                }
                else                  //Any of the 3 kinds of 5010
                {
                    X837_5010.GenerateMessageText(sw, clearhouse, batchNum, queueItems, medType);
                }
            }
            if (clearhouse.CommBridge == EclaimsCommBridge.PostnTrack)
            {
                //need to clear out all CRLF from entire file
                string strFile = "";
                using (StreamReader sr = new StreamReader(saveFile, Encoding.ASCII)){
                    strFile = sr.ReadToEnd();
                }
                strFile = strFile.Replace("\r", "");
                strFile = strFile.Replace("\n", "");
                using (StreamWriter sw = new StreamWriter(saveFile, false, Encoding.ASCII)){
                    sw.Write(strFile);
                }
            }
            CopyToArchive(saveFile);
            return(File.ReadAllText(saveFile));
        }