Exemplo n.º 1
0
        /// <summary>
        /// Gets the result data.
        /// </summary>
        /// <param name="apcResultsData">The apc results data.</param>
        /// <returns></returns>
        private static MedicareOutPatientResult GetResultData(string apcResultsData)
        {
            MedicareOutPatientResult medicareOutPatientResult = new MedicareOutPatientResult
            {
                IsEditSuccess    = true,
                PricerErrorCodes = null
            };

            string vRecord = apcResultsData.Substring(0, 200);

            medicareOutPatientResult.ClaimId            = vRecord.Substring(1, 17).Trim();
            medicareOutPatientResult.TotalPaymentAmount = Convert.ToDouble(vRecord.Substring(53, 9), CultureInfo.InvariantCulture);

            string        wRecordFull    = apcResultsData.Substring(200, apcResultsData.Length - 200);
            int           lineItemsCount = (apcResultsData.Length - 200) / 200; //This will give the number of W Records
            List <string> wRecords       = SplitW(wRecordFull, 200).ToList();

            medicareOutPatientResult.ReturnCode = 0;
            medicareOutPatientResult.Message    = string.Empty;
            medicareOutPatientResult.LineItemMedicareDetails = new List <WRecordData>();

            if (wRecords.Count == lineItemsCount) //This ensures that the parsing if fine
            {
                foreach (string wRecord in wRecords)
                {
                    WRecordData wRecordData = new WRecordData {
                        LineItemId = Convert.ToInt32(wRecord.Substring(18, 3), CultureInfo.InvariantCulture)
                    };
                    string wholeNumber   = wRecord.Substring(21, 7);
                    string decimalNumber = wRecord.Substring(28, 2);
                    wRecordData.LinePaymentAmount = Convert.ToDouble(wholeNumber + "." + decimalNumber, CultureInfo.InvariantCulture);
                    wRecordData.ReturnCode        = 0;
                    wRecordData.ErrorMessage      = string.Empty;
                    medicareOutPatientResult.LineItemMedicareDetails.Add(wRecordData);
                }
            }
            else
            {
                return(null);
            }

            return(medicareOutPatientResult);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the line level amount.
        /// </summary>
        /// <param name="medicareOutPatientResult">The medicare out patient result.</param>
        /// <param name="lineId">The line identifier.</param>
        /// <returns></returns>
        private static double?GetLineLevelAmount(MedicareOutPatientResult medicareOutPatientResult, int lineId)
        {
            double?resultAmount = null;

            if (medicareOutPatientResult != null && medicareOutPatientResult.IsEditSuccess && medicareOutPatientResult.IsPricerSuccess)
            {
                if (medicareOutPatientResult.LineItemMedicareDetails != null &&
                    medicareOutPatientResult.LineItemMedicareDetails.Count > 0 &&
                    medicareOutPatientResult.LineItemMedicareDetails.Any(q => q.LineItemId == lineId))
                {
                    WRecordData wRecordData =
                        medicareOutPatientResult.LineItemMedicareDetails.First(
                            q => q.LineItemId == lineId);
                    resultAmount = wRecordData.LinePaymentAmount;
                }
                else if (medicareOutPatientResult.ReturnCode == 0 &&
                         medicareOutPatientResult.Message == Constants.MessageMicrodyneOff)
                {
                    resultAmount = 0;
                }
            }

            return(resultAmount);
        }