Ejemplo n.º 1
0
        /// <summary>
        /// Gets the Medicare in patient.
        /// </summary>
        /// <param name="medicareIpDataTable">The dt.</param>
        /// <param name="claimId">The claim identifier.</param>
        /// <returns></returns>
        private MedicareInPatient GetMedicareInPatient(DataTable medicareIpDataTable, long claimId)
        {
            MedicareInPatient medicareInPatient = new MedicareInPatient();

            if (medicareIpDataTable != null && medicareIpDataTable.Rows.Count != 0)
            {
                medicareInPatient = (from DataRow row in medicareIpDataTable.Rows
                                     where (GetValue <long>(row["ClaimId"], typeof(long)) == claimId)
                                     select new MedicareInPatient
                {
                    ClaimId = GetValue <long>(row["ClaimId"], typeof(long)),
                    Npi = GetStringValue(row["NPI"]),
                    DischargeDate = GetValue <DateTime>(row["StatementThru"], typeof(DateTime)),
                    DischargeStatus = GetStringValue(row["DischargeStatus"]),
                    Drg = GetStringValue(row["DRG"]),
                    LengthOfStay = GetValue <int>(row["Los"], typeof(int)),
                    Charges = GetValue <double>(row["ClaimTotal"], typeof(double))
                }).First();
            }
            return(medicareInPatient);
        }
        private MedicareInPatientResult GetMedicareInPatientResult(IEvaluateableClaim claim)
        {
            MedicareInPatientResult medicareInPatientResult = new MedicareInPatientResult();
            MedicareInPatient       medicarePatient         = claim.MedicareInPatient;

            _pricerDll = new NetPrcM5
            {
                Provider = medicarePatient.Npi,
                DDate    = medicarePatient.DischargeDate.ToString(CultureInfo.InvariantCulture),
                DRG      = medicarePatient.Drg,
                DStat    = medicarePatient.DischargeStatus
            };
            _pricerDll.ReviewCode = _pricerDll.DStat;
            _pricerDll.LOS        = medicarePatient.LengthOfStay;
            _pricerDll.Charges    = medicarePatient.Charges;

            //A string of diagnosis codes formatted as 7-Byte values.
            //Each code is left justified and blank filled to a length of 7 bytes.
            //Any decimal point in the diagnosis code should be removed before passing the code to PRICERActive.
            _pricerDll.DiagnosisCodes = GetDiagnosisCodeString(claim.DiagnosisCodes, claim.StatementThru);

            //A string of procedure codes formatted as 7-Byte values.
            //Each code is left justified and blank filled to a length of 7 bytes.
            //Any decimal point in the procedure code should be removed before passing the code to PRICERActive.
            _pricerDll.ProcedureCodes = GetProcedureCodeString(claim.ProcedureCodes, claim.StatementThru);

            //If statementThru Date is equal to or greater than 10/01/2015, then we pass "0" as ICDVersion10 else "9" as ICDVersion 9
            _pricerDll.ICDVersion              = claim.StatementThru >= DateTime.Parse(Constants.IcdVersionDate, CultureInfo.InvariantCulture) ? Constants.IcdVersion10 : Constants.IcdVersion9;
            _pricerDll.DeviceCreditAmount      = Constants.DeviceCreditAmount;      // 0; // Source unknown.
            _pricerDll.DIFICIDOnClaim          = Constants.DificidOnClaim;          // false;
            _pricerDll.HMOClaim                = Constants.HmoClaim;                // false;
            _pricerDll.IncludePassthru         = Constants.IncludePassthru;         //false;
            _pricerDll.AllowTerminatedProvider = Constants.AllowTerminatedProvider; // false;
            _pricerDll.AdjustmentFactor        = Constants.AdjustmentFactor;        // 1;
            _pricerDll.AdjustmentOption        = Constants.AdjustmentOption;        // 0;

            if (GlobalConfigVariable.IsMicrodynLogEnabled)
            {
                XmlSerializer xsSubmit = new XmlSerializer(typeof(NetPrcM5));
                StringWriter  sww      = new StringWriter();
                XmlWriter     writer   = XmlWriter.Create(sww);
                xsSubmit.Serialize(writer, _pricerDll);
                var xml = sww.ToString();

                Log.LogInfo("MedicareInPatient Input : \n" + xml, "MicrodynPriceInputData");
            }

            if (GlobalConfigVariable.IsMicrodynEnabled)
            {
                _pricerDll.PRICERCalc();
                string message = string.Empty;
                medicareInPatientResult.TotalPaymentAmount = _pricerDll.PRICERSuccess ? GetTotalAmount(_pricerDll) : 0.00;
                medicareInPatientResult.IsSucess           = _pricerDll.PRICERSuccess;
                message = GetPricerReturnValue(_pricerDll.ReturnCode, message, _pricerDll.PRICERSuccess);
                medicareInPatientResult.ClaimId    = claim.ClaimId;
                medicareInPatientResult.ReturnCode = _pricerDll.ReturnCode;
                medicareInPatientResult.Message    = message;

                if (GlobalConfigVariable.IsMicrodynLogEnabled)
                {
                    Log.LogInfo(
                        string.Format(CultureInfo.InvariantCulture, Constants.MedicareIpClaimIdLog, medicareInPatientResult.Message,
                                      medicareInPatientResult.ClaimId), Constants.MicrodynInPatientMessage);
                }
            }
            else
            {
                medicareInPatientResult.ReturnCode         = 0;
                medicareInPatientResult.TotalPaymentAmount = 0;
                medicareInPatientResult.Message            = Constants.MessageMicrodyneOff;
                medicareInPatientResult.IsSucess           = true;
            }
            //After processing, destroy the Reimbursement DLL object
            _pricerDll.Dispose();

            return(medicareInPatientResult);
        }