public static string BuildLRecordString(LRecord lRecordRaw) { StringBuilder lRecordString = new StringBuilder(Constants.Stringlength); if (lRecordRaw != null) { try { //Build L string lRecordString.Length = 0; lRecordString = lRecordString.Append(LRecordInitial); lRecordString = lRecordString.Append(BuildClaimId(lRecordRaw.ClaimId)); lRecordString = lRecordString.Append(BuildLineItemId(lRecordRaw.LineItemId)); lRecordString = lRecordString.Append(BuildHcpcsProcedureCode(lRecordRaw.HcpcsProcedureCode)); lRecordString = lRecordString.Append(BuildHcpcsModifiers(lRecordRaw.HcpcsModifiers)); lRecordString = lRecordString.Append(BuildServiceDate(lRecordRaw.ServiceDate)); lRecordString = lRecordString.Append(BuildRevenueCode(lRecordRaw.RevenueCode)); lRecordString = lRecordString.Append(BuildUnitsofService(lRecordRaw.UnitsofService)); lRecordString = lRecordString.Append(BuildlineItemCharge(lRecordRaw.LineItemCharge)); lRecordString = lRecordString.Append(BuildLineItemFlag(lRecordRaw.LineItemFlag)); lRecordString = lRecordString.Append(BuildUnUsed()); if (lRecordString.Length == Constants.Stringlength) { return(lRecordString.ToString()); } return(string.Format(CultureInfo.InvariantCulture, "{0,-200}", lRecordString)); } catch (Exception ex) { return(ex.Message); } } return(string.Empty); }
public void ValidateLRecord() { //Arrange _target = new LRecordLogic(); LRecord lRecord = new LRecord { ClaimId = "1111", LineItemId = 1, HcpcsProcedureCode = "1", HcpcsModifiers = "GO86", ServiceDate = DateTime.Parse("10/20/2019"), RevenueCode = "1", UnitsofService = 1, LineItemCharge = 100, LineItemFlag = 1 }; List <LRecord> listLRecords = new List <LRecord> { lRecord }; //Act string actual = _target.GetLRecordLine(listLRecords); //Assert Assert.IsTrue(actual.Contains("L" + lRecord.ClaimId)); }
public void ValidatelRecordIfLineChargeIsInvalid() { //Arrange _target = new LRecordLogic(); LRecord lRecord = new LRecord { ClaimId = "111", LineItemId = 1, HcpcsProcedureCode = "1", HcpcsModifiers = "GO86", ServiceDate = DateTime.Parse("10/20/2019"), RevenueCode = "1", UnitsofService = 1, LineItemCharge = 1000000000, LineItemFlag = 0 }; List <LRecord> listLRecords = new List <LRecord> { lRecord }; //Act string actual = _target.GetLRecordLine(listLRecords); //Assert Assert.AreEqual(actual, ""); }
public void btnFavfileOutput(bool fType81 = true, bool SolSet = false, bool SolSet2 = false) { string LRecord; string fNameFav = "SDK_Favorite.txt"; var tokSrc = new CancellationTokenSource(); //procedures for suspension GNPXApp000.SlvMtdCList[0] = true; //use all methods UPuzzle pGP = GNPX_Eng.pGP; GNPX_Eng.AnMan.Set_CellFreeB(); GNPX_Eng.sudokAnalyzerAuto(tokSrc.Token); string prbMessage; int difLvl = GNPX_Eng.GetDifficultyLevel(out prbMessage); using (var fpW = new StreamWriter(fNameFav, true, Encoding.UTF8)){ if (fType81) { LRecord = ""; pGP.BDL.ForEach(q => { LRecord += Max(q.No, 0).ToString(); }); LRecord = LRecord.Replace("0", "."); LRecord += $" {(pGP.ID+1)} {pGP.DifLevel} \"{pGP.Name}\""; if (SolSet && SolSet2) { LRecord += $" \"{SetSolution(pGP,SolSet2:true,SolAll:true)}\""; //解を出力 } if (pGP.TimeStamp != null) { LRecord += $" \"{pGP.TimeStamp}\""; } } else { LRecord = $"{pGP.ID+1}, {GNPX_Eng.pGP.DifLevel} \"{pGP.Name}\", \"{prbMessage}\""; fpW.WriteLine(LRecord); for (int r = 0; r < 9; r++) { int n = pGP.BDL[r * 9 + 0].No; LRecord = n.ToString(); for (int c = 1; c < 9; c++) { n = pGP.BDL[r * 9 + c].No; LRecord += $", {n}"; } LRecord += "\r"; } } fpW.WriteLine(LRecord); } GNPXApp000.SlvMtdCList[0] = false;//use selected methods }
private static string ValidateLRecord(LRecord lRaw) { try { return(string.Format(CultureInfo.InvariantCulture, "{0} {1} {2} {3} {4} {5} {6} {7}", ValidateClaimId(lRaw.ClaimId), ValidateHcpcsModifiers(lRaw.HcpcsModifiers), ValidateLineItemFlag(lRaw.LineItemFlag), ValidateLineItemId(lRaw.LineItemId), ValidateHcpcsCode(lRaw.HcpcsProcedureCode), ValidateRevCode(lRaw.RevenueCode), ValidateUnitOfService(lRaw.UnitsofService), ValidateLineCharge(lRaw.LineItemCharge))); } catch (Exception ex) { Log.LogError(string.Empty, string.Empty, ex); return("Exception occurred"); } }
/// <summary> /// Gets the l record. /// </summary> /// <param name="evaluateableClaim">The evaluateable claim.</param> private static void GetLRecord(EvaluateableClaim evaluateableClaim) { evaluateableClaim.MicrodynApcEditInput.LRecords = new List <LRecord>(); foreach (ClaimCharge claimcharge in evaluateableClaim.ClaimCharges) { LRecord lRecord = new LRecord { ClaimId = Convert.ToString(evaluateableClaim.ClaimId, CultureInfo.InvariantCulture), LineItemId = claimcharge.Line, HcpcsProcedureCode = claimcharge.HcpcsCode, ServiceDate = Convert.ToDateTime(claimcharge.ServiceFromDate), RevenueCode = Convert.ToString(claimcharge.RevCode, CultureInfo.InvariantCulture), UnitsofService = claimcharge.Units == null ? (int?)null : Convert.ToInt32(claimcharge.Units, CultureInfo.InvariantCulture), LineItemCharge = claimcharge.Amount == null ? (double?)null : Convert.ToDouble(claimcharge.Amount, CultureInfo.InvariantCulture), LineItemFlag = LineItemFlag, // Hardcoded 0 HcpcsModifiers = claimcharge.HcpcsModifiers }; evaluateableClaim.MicrodynApcEditInput.LRecords.Add(lRecord); } }
public void BuildLRecordStringTest() { LRecord lRecordRaw = new LRecord { ClaimId = "1.04.2", LineItemId = 1, HcpcsProcedureCode = "00164", HcpcsModifiers = "4455667788", ServiceDate = DateTime.Parse("09/30/2019"), RevenueCode = "0929", UnitsofService = 1, LineItemCharge = 0000000.00, LineItemFlag = 4 }; const string expected = "L1.04.2 001001644455667788201909300929000000100000000004 "; string actual = LRecordLogic.BuildLRecordString(lRecordRaw); Assert.AreEqual(expected, actual); }
public void BuildLRecordStringTestForLength() { //Arrange LRecord lRecord = new LRecord { ClaimId = "1111125566644155656664", LineItemId = 1, HcpcsProcedureCode = "1", HcpcsModifiers = "GO86", ServiceDate = DateTime.Parse("10/20/2019"), RevenueCode = "1", UnitsofService = 1, LineItemCharge = 100, LineItemFlag = 1 }; //Act string actual = LRecordLogic.BuildLRecordString(lRecord); //Assert Assert.IsTrue(actual.Contains("L" + lRecord.ClaimId)); }
public void SDK_FileOutput(string fName, bool append, bool fType81, bool SolSort, bool SolSet, bool SolSet2) { if (SDKProbLst.Count == 0) { return; } SDK_Ctrl.MltProblem = 1; SDK_Ctrl.lvlLow = 0; SDK_Ctrl.lvlHgh = 999; string LRecord, solMessage = ""; GNPXApp000.SlvMtdCList[0] = true; //use all methods var tokSrc = new CancellationTokenSource(); //for suspension int m = 0; SDKProbLst.ForEach(p => p.ID = (m++)); //▼▼▼ToDo Make problem management class IEnumerable <UPuzzle> qry; if (SolSort) { qry = from p in SDKProbLst orderby p.DifLevel ascending select p; } else { qry = from p in SDKProbLst select p; } using (StreamWriter fpW = new StreamWriter(fName, append, Encoding.UTF8)){ foreach (var P in qry) { //===== Preparation ===== solMessage = ""; if (SolSet) { solMessage = SetSolution(GP: P, SolSet2: SolSet2, SolAll: SolSet); //output Solution UPuzzle GP, bool SolSet2, bool SolAll=false } if (fType81) { //Solution(tytpe:line) LRecord = ""; P.BDL.ForEach(q => { LRecord += Max(q.No, 0).ToString(); }); LRecord = LRecord.Replace("0", "."); LRecord += $" {(P.ID+1)} {P.DifLevel} \"{P.Name}\""; if (SolSet && SolSet2) { LRecord += $" \"{SetSolution(P,SolSet2:true,SolAll:true)}\""; //解出力 } if (pGP.TimeStamp != null) { LRecord += $" \"{pGP.TimeStamp}\""; } fpW.WriteLine(LRecord); } else //problem_name and Solution(tytpe:matrix) { LRecord = $"{(P.ID+1)}, {P.DifLevel}, \"{P.Name}\", {solMessage}"; fpW.WriteLine(LRecord); for (int r = 0; r < 9; r++) { int n = P.BDL[r * 9 + 0].No; if (!SolSet && n < 0) { n = 0; } LRecord = n.ToString(); for (int c = 1; c < 9; c++) { n = P.BDL[r * 9 + c].No; if (!SolSet && n < 0) { n = 0; } LRecord += ", " + n.ToString(); } fpW.WriteLine(LRecord); } } } } GNPXApp000.SlvMtdCList[0] = false; //restore method selection }
public int SDK_FileInput(string fName, bool prbIniFlag) { char[] sep = new Char[] { ' ', ',', '\t' }; string LRecord, pName = ""; using (StreamReader SDKfile = new StreamReader(fName)){ SDKProbLst.Clear(); while ((LRecord = SDKfile.ReadLine()) != null) { if (LRecord == "") { continue; } string[] eLst = LRecord.SplitEx(sep); if (LRecord[0] == '#') { pName = LRecord.Substring(1); continue; } int nc = eLst.Length; if (eLst[0] == "sPos") { continue; } string name = ""; int difLvl = 1; string TimeStamp = ""; if (eLst[0].Length >= 81) { try{ if (nc >= 4 && eLst[3] != "") { difLvl = eLst[2].ToInt(); name = eLst[3]; } else if (nc >= 3) { difLvl = 1; name = eLst[2]; } string st = eLst[0].Replace(".", "0").Replace(" ", ""); List <UCell> BDLa = _stringToBDL(st); int ID = SDKProbLst.Count; TimeStamp = ""; foreach (var e in eLst) { if (e.Contains("/") && e.Contains(":")) { TimeStamp = e; break; } } SDKProbLst.Add(new UPuzzle(ID, BDLa, name, difLvl, TimeStamp)); } catch { continue; } } else if (nc >= 2) { try{ name = (eLst.Length >= 2)? eLst[1]: ""; difLvl = (eLst.Length >= 3)? eLst[2].ToInt(): 0; List <UCell> BDLa = new List <UCell>(); for (int r = 0; r < 9; r++) { LRecord = SDKfile.ReadLine(); eLst = LRecord.SplitEx(sep); for (int c = 0; c < 9; c++) { int n = Convert.ToInt32(eLst[c]); n = (n < 0 && prbIniFlag)? 0: n; BDLa.Add(new UCell(r * 9 + c, n)); } } int ID = SDKProbLst.Count; SDKProbLst.Add(new UPuzzle(ID, BDLa, name, difLvl)); } catch { continue; } } } CurrentPrbNo = 0; return(CurrentPrbNo); } }
public void UpdateEvaluateableClaimsTest() { // Arrange _target = new EvaluateableClaimLogic(); ConditionCode conditionCode = new ConditionCode { ClaimId = 123, Code = "0300" }; List <ConditionCode> conditionCodes = new List <ConditionCode> { conditionCode }; PatientData patientData = new PatientData { FirstName = "Jim" }; DiagnosisCode diagnosisCode = new DiagnosisCode { Instance = "P", ClaimId = 123, IcddCode = "0800" }; List <DiagnosisCode> diagnosisCodes = new List <DiagnosisCode> { diagnosisCode }; ClaimCharge claimCharge = new ClaimCharge { Line = 1, RevCode = "0123", Amount = 5556.2, }; // Act List <ClaimCharge> claimCharges = new List <ClaimCharge> { claimCharge }; EvaluateableClaim evaluateableClaim = new EvaluateableClaim { ClaimId = 123, StatementThru = Convert.ToDateTime("2012-01-12 00:00:00.000"), StatementFrom = Convert.ToDateTime("2012-01-12 00:00:00.000"), ConditionCodes = conditionCodes, PatientData = patientData, DiagnosisCodes = diagnosisCodes, ClaimCharges = claimCharges }; List <EvaluateableClaim> evaluateableClaimLists = new List <EvaluateableClaim> { evaluateableClaim }; List <EvaluateableClaim> actual = _target.UpdateEvaluateableClaims(evaluateableClaimLists); // Assert EvaluateableClaim updatedEvaluateableClaim = actual.FirstOrDefault(); if (updatedEvaluateableClaim != null) { CRecord cRecord = updatedEvaluateableClaim.MicrodynApcEditInput.CRecord; if (cRecord != null) { Assert.AreEqual(cRecord.PatientData, evaluateableClaim.PatientData); Assert.AreNotEqual(cRecord.ClaimId, evaluateableClaim.ClaimId); } DRecord dRecord = updatedEvaluateableClaim.MicrodynApcEditInput.DRecord; if (dRecord != null) { Assert.AreEqual(dRecord.PrincipalDiagnosisCode, evaluateableClaim.DiagnosisCodes.First().IcddCode); } LRecord lRecord = updatedEvaluateableClaim.MicrodynApcEditInput.LRecords.FirstOrDefault(); if (lRecord != null) { Assert.AreEqual(lRecord.RevenueCode, evaluateableClaim.ClaimCharges.First().RevCode); Assert.AreEqual(lRecord.LineItemId, evaluateableClaim.ClaimCharges.First().Line); } MedicareOutPatient medicareOutPatient = updatedEvaluateableClaim.MicrodynApcEditInput.MedicareOutPatientRecord; if (medicareOutPatient != null) { Assert.AreEqual(medicareOutPatient.ClaimId, evaluateableClaim.ClaimId); Assert.AreEqual(medicareOutPatient.BeneDeductible, 0); } } }