private claim FindClaim(DataRow anImportRow, claim.ClaimTypes claimType) { string importID = anImportRow[dms.claim_id_column].ToString(); string importDB = anImportRow[dms.claim_db_column].ToString(); try { claim c = new claim(); c.claimidnum = importID; c.claimdb = importDB; DataTable matches = c.Search(); if (matches.Rows.Count != 0) { c.Load(matches.Rows[0]); } else { // ****** Finding recreated claims ************* // Above, we checked for the common ID/DB match // Here we try to find if a claim that is not in Tracker has been recreated // We match by all fields minus 1 - if two primary fields have been changed // Tracker can't track it // If we find a possible match, we check to see that the current claim isn't in Dentrix // to avoid false positives bool possibleMatchFound = false; bool claimInDentrix = true; claim workingClaim = new claim(); DateTime?dateOfService = null; try { dateOfService = Convert.ToDateTime(anImportRow["PLDATE"]); } catch { } string lastName = anImportRow["PatLastName"].ToString(); string firstName = anImportRow["PatFirstName"].ToString(); decimal amount = Convert.ToDecimal(anImportRow["TOTAL"]); // stored as cents string doctorFirstName = anImportRow["DoctorFirstName"].ToString(); string doctorLastName = anImportRow["DoctorLastName"].ToString(); string subscriberInsuranceID = anImportRow["ID_NUM_ON_CLAIM"].ToString(); string matchingClaimInfo = matchingClaimInfo = string.Format("Patient: {0}, Doctor: {1}, Total: {2}, DOS: {3}, Ins ID: {4}, ID: {5}, Type: {6}", firstName + " " + lastName, doctorFirstName + " " + doctorLastName, amount, dateOfService, subscriberInsuranceID, importID + " | " + importDB, claimType.ToString()); int?newClaimID = null; // Search for a patient match first. If the patient doesn't match try to match on the other two fields workingClaim.patient_first_name = firstName; workingClaim.patient_last_name = lastName; workingClaim.open = 1; DataTable patientMatches = workingClaim.Search(); if (patientMatches.Rows.Count > 0) { // Iterate through all rows where the patient data matches foreach (DataRow aRow in patientMatches.Rows) { int numMatchesForclaim = 0; workingClaim.Load(aRow); if (workingClaim.amount_of_claim * 100 == amount) { numMatchesForclaim++; } if (workingClaim.doctor_first_name == doctorFirstName && workingClaim.doctor_last_name == doctorLastName) { numMatchesForclaim++; } if (workingClaim.date_of_service == dateOfService) { numMatchesForclaim++; } if (workingClaim.subscriber_alternate_number == subscriberInsuranceID) { numMatchesForclaim++; } if (workingClaim.claim_type == claimType) { numMatchesForclaim++; } if (numMatchesForclaim >= 4) { // Found a claim that appears to match newClaimID = workingClaim.id; possibleMatchFound = true; break; } } } else { // Look for a match on date of service, amount, provider, insurance id, and type workingClaim = new claim(); workingClaim.open = 1; workingClaim.amount_of_claim = amount / 100; workingClaim.doctor_first_name = doctorFirstName; workingClaim.doctor_last_name = doctorLastName; workingClaim.subscriber_alternate_number = subscriberInsuranceID; workingClaim.claim_type = claimType; string searchSQL = workingClaim.SearchSQL + string.Format(" AND DATEDIFF(d, [date_of_service], '{0}') = 0", dateOfService.GetValueOrDefault().ToShortDateString()); DataTable otherMatches = workingClaim.Search(searchSQL); if (otherMatches.Rows.Count > 0) { newClaimID = (int)otherMatches.Rows[0]["id"]; possibleMatchFound = true; } } if (possibleMatchFound) { // Check Dentrix to verify that the current ID/DB can't be found if (newClaimID.HasValue && ClaimTrackerCommon.ClaimExists(new claim(newClaimID.Value))) // No match found { // Log this temporarily for recordkeeping claimInDentrix = true; AddReportMessage("Found a possible claim to merge, but the claim exists in Dentrix. Did not merge claim..." + matchingClaimInfo, true); LoggingHelper.Log("Tried to merge a claim, but it was found in Dentrix. Claim info:\n" + matchingClaimInfo, LogSeverity.Information); } else { claimInDentrix = false; } } if (!claimInDentrix && possibleMatchFound) { // Already loaded claim, should have "correct" data c.Load(newClaimID.GetValueOrDefault(0)); AddReportMessage(string.Format("Merged a claim in Dentrix with an existing claim tracker claim. The claim's old ID/DB is {0}/{1}. The matching claim information is {2}", c.claimidnum, c.claimdb, matchingClaimInfo), true); c.claimidnum = importID; c.claimdb = importDB; LoggingHelper.Log("Successfully merged a claim. \n" + matchingClaimInfo, LogSeverity.Information); } else { AddReportMessage("New claim imported - " + matchingClaimInfo); c.created_by = "Automatic Database Importer"; c.updated_on = null; } } return(c); } catch (Exception err) { // Somewhat dangerous, but it ensures that the import won't crash LoggingHelper.Log("Error in frmImportData.FindClaim", LogSeverity.Critical, err, false); claim c = new claim(); c.claimidnum = importID; c.claimdb = importDB; return(c); } }
/// <summary> /// Searches to see whether a claim should substitute another provider's information based off of the information /// in the passed claim. /// </summary> /// <param name="toSearch">The claim to search for a restriction on</param> /// <returns></returns> public static claim FindEligibilityRestrictions(claim toSearch) { return(FindEligibilityRestrictions(toSearch, GetAllDataAsList())); }
private void ImportThread_DoWork(object sender, DoWorkEventArgs e) { claim workingClaim = new claim(); DataTable importData = new DataTable(); DataTable importDataSecondaries = new DataTable(); DataTable importDataPredeterms = new DataTable(); DataTable importDataSecondaryPredeterms = new DataTable(); system_options.SetImportFlag(true); primaryClaimCount = 0; secondaryClaimCount = 0; predetermClaimCount = 0; secondaryPredetermClaimCount = 0; closedClaimCount = 0; OleDbConnection oConnect; UpdateProgressBar(50, "Initiating Remote Connection..."); #region Initiate Connection, Get Data try { oConnect = new OleDbConnection(dms.GetConnectionString(true)); } catch (Exception err) { CreateLogFile(err.ToString()); Updateimporterror(true); LoggingHelper.Log("An error occurred getting the connection string for a new connection in frmImportData.Import", LogSeverity.Error, err, false); e.Cancel = true; return; } OleDbDataAdapter oAdapter; // Use Connection object for the DataAdapter to retrieve all tables from selected Database try { oConnect.Open(); } catch (Exception err) { CreateLogFile(err.ToString()); Updateimporterror(true); LoggingHelper.Log("Could not connect to the database in frmImportdata.Import", LogSeverity.Error, err, false); e.Cancel = true; return; } try { UpdateProgressBar(50, "Querying remote database (Standard)..."); // ************* Standard Claims oAdapter = new OleDbDataAdapter(PrepareSQL(dms.sqlstatement, changesOnly), oConnect); oAdapter.SelectCommand.CommandTimeout = System.Convert.ToInt32(nmbTimeout.Value); oAdapter.Fill(importData); UpdateProgressBar(10, "Querying remote database (Secondary)..."); // ************** Secondaries if (dms.sqlstatementsecondaries != "") { oAdapter = new OleDbDataAdapter(PrepareSQL(dms.sqlstatementsecondaries, changesOnly), oConnect); oAdapter.SelectCommand.CommandTimeout = System.Convert.ToInt32(nmbTimeout.Value); oAdapter.Fill(importDataSecondaries); } UpdateProgressBar(10, "Querying remote database (Predeterms)..."); // *************** Predeterms if (dms.sqlstatementpredeterms != "") { oAdapter = new OleDbDataAdapter(PrepareSQL(dms.sqlstatementpredeterms, changesOnly), oConnect); oAdapter.SelectCommand.CommandTimeout = System.Convert.ToInt32(nmbTimeout.Value); oAdapter.Fill(importDataPredeterms); } UpdateProgressBar(10, "Querying remote database (Secondary Predeterms)..."); // *************** Predeterms if (dms.sqlstatementsecondarypredeterms != "") { oAdapter = new OleDbDataAdapter(PrepareSQL(dms.sqlstatementsecondarypredeterms, changesOnly), oConnect); oAdapter.SelectCommand.CommandTimeout = System.Convert.ToInt32(nmbTimeout.Value); oAdapter.Fill(importDataSecondaryPredeterms); } } catch (Exception err) { CreateLogFile(err.ToString()); Updateimporterror(true); LoggingHelper.Log("Error with SQL statement or connection in frmImportData.Import", LogSeverity.Error, err); MessageBox.Show(this, "There was an error with your SQL statement or with your connection.\n\n" + err.Message, "Error retrieving data"); CancelImport(); return; } #endregion data_mapping_schema_data dmsd = new data_mapping_schema_data(); dmsd.schema_id = dms.id; DataTable dataForSchema = dmsd.Search(); // Generate our list of objects one time, and then use them for each iteration of rows List <data_mapping_schema_data> allMappedSchemaData = new List <data_mapping_schema_data>(); foreach (DataRow aMapping in dataForSchema.Rows) { // For every row, need to get the data for every field dmsd = new data_mapping_schema_data(); dmsd.Load(aMapping); allMappedSchemaData.Add(dmsd); } UpdateProgressBar(100, "Importing data..."); if (okToZap) { company cmp = new company(); cmp.Zap(); workingClaim.Zap(); call aCall = new call(); aCall.Zap(); company_contact_info info = new company_contact_info(); info.Zap(); procedure p = new procedure(); p.Zap(); choice c = new choice(); c.Zap(); notes n = new notes(); n.Zap(); claim_batch cb = new claim_batch(); cb.Zap(); batch_claim_list bcl = new batch_claim_list(); bcl.Zap(); } else { if (!changesOnly) { workingClaim.MarkAllImportsUpdated(false); } } // Apply incremental updates to progress bar int currentRow = 0; totalRows = importData.Rows.Count + importDataSecondaries.Rows.Count + importDataPredeterms.Rows.Count + importDataSecondaryPredeterms.Rows.Count; decimal exactIncrementAmount; if (totalRows > 0) { exactIncrementAmount = 500m / totalRows; } else { exactIncrementAmount = 500m; } decimal incrementCounter = 0; int increment; if (exactIncrementAmount < 1) { increment = 1; } else { increment = Convert.ToInt32(Math.Truncate(exactIncrementAmount)); } string lastClaimID = ""; claim aClaim = new claim(); company aCompany = new company(); company_contact_info anInfo = new company_contact_info(); procedure aProcedure = new procedure(); for (int p = 0; p < 4; p++) { claim.ClaimTypes ct; DataTable thisImport; switch (p) { case 0: thisImport = importData; ct = claim.ClaimTypes.Primary; UpdateLabels(0); break; case 1: thisImport = importDataSecondaries; ct = claim.ClaimTypes.Secondary; UpdateLabels(1); break; case 2: thisImport = importDataPredeterms; ct = claim.ClaimTypes.Predeterm; UpdateLabels(2); break; default: thisImport = importDataSecondaryPredeterms; UpdateLabels(3); ct = claim.ClaimTypes.SecondaryPredeterm; break; } // Have data at this point, need to tie them to the internal mapping schema data foreach (DataRow anImportRow in thisImport.Rows) { string newID = anImportRow[dms.claim_id_column].ToString(); string newDB = anImportRow[dms.claim_db_column].ToString(); bool isOnlyProcedureData; if (newID == lastClaimID) { // We're only dealing with the import of "some" data isOnlyProcedureData = true; } else { if (ct == claim.ClaimTypes.Primary) { primaryClaimCount++; } else if (ct == claim.ClaimTypes.Secondary) { secondaryClaimCount++; } else if (ct == claim.ClaimTypes.Predeterm) { predetermClaimCount++; } else { secondaryPredetermClaimCount++; } UpdateTypeCount(); aClaim = FindClaim(anImportRow, ct); aCompany = FindCompany(anImportRow[dms.company_namecolumn].ToString()); anInfo = FindContactInfo(anImportRow["Ins_Co_Street1"].ToString(), aCompany.id, anImportRow["Ins_Co_Phone"].ToString()); lastClaimID = newID; aClaim.ClearClaimProcedures(); isOnlyProcedureData = false; // Check for "X" in provider field try { if (aClaim.doctor_provider_id.StartsWith("X")) { AddStatus(string.Format("The claim for patient {0} on {1} uses an X provider ({2})", aClaim.PatientName, aClaim.DatesOfServiceString(), aClaim.doctor_provider_id), true, true); } } catch (Exception err) { CreateLogFile(err.ToString()); Updateimporterror(true); LoggingHelper.Log(err, false); } } aProcedure = FindProcedure(anImportRow["PROC_LOGID"].ToString()); if (CommonFunctions.DBNullToString(anImportRow["DATERECEIVED"]) == "") { aClaim.open = 1; } else if (((DateTime)anImportRow["DATERECEIVED"]).Year == 1753) { aClaim.open = 1; } else { aClaim.open = 0; UpdateStatusHistory(aClaim); } foreach (data_mapping_schema_data aMappedData in allMappedSchemaData) { // We do a check for is only procedure data to speed up processing // It makes the code a little messier. if (isOnlyProcedureData) { // If we're only importing the procedure data, none of the other information is important if ((aMappedData.LinkedField.table_name == "claims") || (aMappedData.LinkedField.table_name == "companies") || (aMappedData.LinkedField.table_name == "company_contact_info")) { // Ignore } else if (aMappedData.LinkedField.table_name == "procedures") { if (aMappedData.LinkedField.field_name == "surf_string") { aProcedure[aMappedData.LinkedField.field_name] = CommonFunctions.RemoveNonPrintableCharacters(anImportRow[aMappedData.mapped_to_text].ToString()); } else if (aMappedData.LinkedField.field_name == "claim_id") { aProcedure["claim_id"] = lastClaimID; } else { aProcedure[aMappedData.LinkedField.field_name] = anImportRow[aMappedData.mapped_to_text]; } } else { LoggingHelper.Log("Uninitialized table name in frmImportData.Import", LogSeverity.Critical, new Exception("Uninitialized table name in import procedure."), true); } } else { // This is a new claim - we need to get the data for every field if (aMappedData.LinkedField.table_name == "claims") { aClaim[aMappedData.LinkedField.field_name] = anImportRow[aMappedData.mapped_to_text]; } else if (aMappedData.LinkedField.table_name == "companies") { if (aMappedData.mapped_to_text != dms.company_namecolumn) { aCompany[aMappedData.LinkedField.field_name] = anImportRow[aMappedData.mapped_to_text]; } } else if (aMappedData.LinkedField.table_name == "company_contact_info") { anInfo[aMappedData.LinkedField.field_name] = anImportRow[aMappedData.mapped_to_text]; } else if (aMappedData.LinkedField.table_name == "procedures") { if (aMappedData.LinkedField.field_name == "surf_string") { aProcedure[aMappedData.LinkedField.field_name] = CommonFunctions.RemoveNonPrintableCharacters(anImportRow[aMappedData.mapped_to_text].ToString()); } else { aProcedure[aMappedData.LinkedField.field_name] = anImportRow[aMappedData.mapped_to_text]; } } else { LoggingHelper.Log("Uninitialized table name in frmImport.Import", LogSeverity.Critical); throw new Exception("Uninitialized table name in import procedure."); } } } aCompany.Save(); anInfo.company_id = aCompany.id; if (CommonFunctions.DBNullToZero(anInfo["order_id"]) == 0) { anInfo.order_id = anInfo.GetNextOrderID(); } anInfo.Save(); aClaim.company_id = aCompany.id; aClaim.company_address_id = anInfo.order_id; aClaim["import_update_flag"] = true; aClaim.Save(); if (p == 0 || p == 2 || p == 3) // Only update the id if this is the primary claim or a predeterm { aProcedure.claim_id = aClaim.id; } aProcedure.Save(); currentRow++; if (Math.Truncate(incrementCounter + exactIncrementAmount) != Math.Truncate(incrementCounter)) { UpdateProgressBar(increment, string.Format("{0} / {1} procedures completed...", currentRow, totalRows), false); } incrementCounter += exactIncrementAmount; } } if (changesOnly) { // Grab all the deleted claims and mark them as closed here // Add a note that they have been deleted, I guess string deletedClaimsSQL = "SELECT CLAIMID, CLAIMDB " + "FROM AUDIT_DDB_CLAIM " + "WHERE N_CLAIMID is null " + "AND CLAIMID is not null AND CLAIMDB is not null " + "AND date_changed >= '" + lastWrite.ToString("G") + "'"; DataTable deletedClaims = new DataTable(); OleDbCommand cmd = new OleDbCommand(deletedClaimsSQL, oConnect); cmd.CommandTimeout = 90; oAdapter = new OleDbDataAdapter(cmd); oAdapter.Fill(deletedClaims); UpdateProgressBar(5, "Updating Local Status for Deleted Claims..."); foreach (DataRow aDeletedClaim in deletedClaims.Rows) { // Close the claims DataTable matches = aClaim.Search("SELECT * FROM claims WHERE claimidnum = '" + aDeletedClaim["claimid"] + "' and claimdb = '" + aDeletedClaim["claimdb"] + "'"); if (matches.Rows.Count > 0) { // This should honestly not load every claim aClaim = new claim(); aClaim.Load(matches.Rows[0]); aClaim.open = 0; aClaim.Save(); UpdateStatusHistory(aClaim); closedClaimCount++; } } } else { closedClaimCount = workingClaim.CloseClaimsWithoutUpdate(); } UpdateLabels(4); workingClaim.FixRevisitDateAfterImport(); }
internal bool Applies(claim toCheck) { bool isValid = true; if (toCheck.claim_type == claim.ClaimTypes.Primary) { isValid = apply_primary; } else if (toCheck.claim_type == claim.ClaimTypes.Secondary) { isValid = apply_secondary; } else if (toCheck.claim_type == claim.ClaimTypes.Predeterm) { isValid = apply_predeterm; } if (isValid) { string procedureWHERE = ""; string insuranceWHERE = ""; List <apex_rules_procedure_codes> allProcs = LinkedProcedureCodes; if (allProcs.Count > 0) { procedureWHERE = "AND ("; foreach (apex_rules_procedure_codes arpc in allProcs) { procedureWHERE += " p.ada_code LIKE '" + arpc.procedure_code + "' OR"; } procedureWHERE = procedureWHERE.Substring(0, procedureWHERE.Length - 2); // Remove final "OR" procedureWHERE += ")"; } List <apex_rules_companies> allCompanies = LinkedInsurance; if (allCompanies.Count > 0) { insuranceWHERE = "AND ("; foreach (apex_rules_companies arc in allCompanies) { insuranceWHERE += " co.name LIKE '" + arc.company_info + "' OR"; } insuranceWHERE = insuranceWHERE.Substring(0, insuranceWHERE.Length - 2); // Remove final "OR" insuranceWHERE += ")"; } string sql = "SELECT * FROM claims c INNER JOIN companies co ON c.company_id = co.id " + "INNER JOIN procedures p ON c.id = p.claim_id " + "WHERE c.id = " + toCheck.id + " " + procedureWHERE + " " + insuranceWHERE; DataTable check = Search(sql); if (check.Rows.Count == 0) { isValid = false; } } return(isValid); }
private void LoadClaim(int Index) { if (RecordChangeOK()) { _loading = true; _editMode = EditModes.Edit; _currentIndex = Index; claim toLoad = new claim(_claimsList[_currentIndex].id); _claimsList[_currentIndex] = toLoad; #region Field assignment // Services nmbClaimAmount.Value = toLoad.amount_of_claim; LoadProcedures(toLoad); // Insurance LoadInsurance(toLoad.LinkedCompany, toLoad.LinkedCompanyAddress); // Patient txtPatientName.Text = toLoad.PatientName; ctlPatientDOB.CurrentDate = toLoad.patient_dob; txtPatientSSN.Text = toLoad.patient_ssn; txtPatientAddress.Text = toLoad.patient_address; txtPatientAddress2.Text = toLoad.patient_address2; txtPatientCity.Text = toLoad.patient_city; txtPatientState.Text = toLoad.patient_state; txtPatientZIP.Text = toLoad.patient_zip; // Doctor txtDoctorName.Text = toLoad.DoctorName; txtDoctorTaxID.Text = toLoad.doctor_tax_number; txtDoctorLicenseID.Text = toLoad.doctor_license_number; txtDoctorBC.Text = toLoad.doctor_bcbs_number; txtDoctorPhone.Text = toLoad.doctor_phone_number_object.FormattedPhone; txtDoctorFax.Text = toLoad.doctor_fax_number_object.FormattedPhone; txtDoctorAddress.Text = toLoad.doctor_address; txtDoctorAddress2.Text = toLoad.doctor_address2; txtDoctorCity.Text = toLoad.doctor_city; txtDoctorState.Text = toLoad.doctor_state; txtDoctorZIP.Text = toLoad.doctor_zip; // Subscriber txtSubscriberName.Text = toLoad.SubscriberName; ctlSubscriberDOB.CurrentDate = toLoad.subscriber_dob; txtSubscriberID.Text = toLoad.subscriber_number; txtSubscriberAltID.Text = toLoad.subscriber_alternate_number; txtSubscriberSSN.Text = toLoad.subscriber_ssn; txtSubscriberGroupName.Text = toLoad.subscriber_group_name; txtSubscriberGroupNum.Text = toLoad.subscriber_group_number; txtSubscriberAddress.Text = toLoad.subscriber_address; txtSubscriberAddress2.Text = toLoad.subscriber_address2; txtSubscriberCity.Text = toLoad.subscriber_city; txtSubscriberState.Text = toLoad.subscriber_state; txtSubscriberZIP.Text = toLoad.subscriber_zip; // General ctlSentDate.CurrentDate = toLoad.sent_date; ctlResentDate.CurrentDate = toLoad.resent_date; ctlTracerDate.CurrentDate = toLoad.tracer_date; ctlOnHoldDate.CurrentDate = toLoad.on_hold_date; chkClosed.Checked = !System.Convert.ToBoolean(toLoad.open); // Notes txtNotes.Text = toLoad.notes; #endregion #region Handling Specific claim_batch cb = toLoad.LinkedBatch(); if (cb != null) { cmbHandling.Enabled = false; chkInBatch.Checked = true; ctlBatchDate.DateValue = cb.batch_date; cmbHandling.SelectedIndex = cmbHandling.FindStringExact(cb.handling); } else { cmbHandling.Enabled = true; chkInBatch.Checked = false; ctlBatchDate.Clear(); cmbHandling.SelectedIndex = cmbHandling.FindStringExact(toLoad.handling); } #endregion if (toLoad.revisit_date.HasValue) { ctlRevisitDate.CurrentDate = toLoad.revisit_date; } else { ctlRevisitDate.CurrentDate = DateTime.Now.AddDays(System.Convert.ToDouble(nmbRevisitInterval.Value)); } if (toLoad.LinkedChanges.Count > 0) { lnkViewClaimChangeHistory.Visible = true; } Text = toLoad.claim_type.ToString() + " claim for " + toLoad.PatientName; callManager.LoadClaim(toLoad); _changed = false; _loading = false; } }
private bool Save() { if (ValidateForm()) { try { claim toSave; if (_editMode == EditModes.Edit) { toSave = _claimsList[_currentIndex]; } else { toSave = new claim(); toSave.created_on = DateTime.Now; toSave.created_by = ActiveUser.UserObject.username; _editMode = EditModes.Edit; _claimsList.Add(toSave); _currentIndex = _claimsList.Count - 1; } #region Field Assignments // Services SaveWithCheckForChange(ref toSave, "amount_of_claim", nmbClaimAmount.Value * 100); // Insurance if (cmbInsuranceCarrier.SelectedIndex >= 0) { int newID = ((company)cmbInsuranceCarrier.SelectedItem).id; int oldID = toSave.company_id; if (toSave.company_id != newID) { AddChange(toSave.id, "company", toSave.LinkedCompany.name, new company(newID).name); toSave.company_id = newID; } if (toSave.company_address_id != _currentContactInfo.order_id) { company_contact_info oldInfo = new company_contact_info(); company_contact_info newInfo = new company_contact_info(); oldInfo.Load(new int[] { oldID, toSave.company_address_id }); newInfo.Load(new int[] { newID, _currentContactInfo.order_id }); AddChange(toSave.id, "company_address", oldInfo.address, newInfo.address); toSave.company_address_id = _currentContactInfo.order_id; } } // Patient // name has to be handled in a special way if (toSave.PatientName != txtPatientName.Text) { AddChange(toSave.id, "patient_name", toSave.PatientName, txtPatientName.Text); toSave.PatientName = txtPatientName.Text; } SaveWithCheckForChangeSpecialDateTime(ref toSave, "patient_dob", ctlPatientDOB.CurrentDate); SaveWithCheckForChange(ref toSave, "patient_ssn", txtPatientSSN.Text.Replace("-", "")); SaveWithCheckForChange(ref toSave, "patient_address", txtPatientAddress.Text); SaveWithCheckForChange(ref toSave, "patient_address2", txtPatientAddress2.Text); SaveWithCheckForChange(ref toSave, "patient_city", txtPatientCity.Text); SaveWithCheckForChange(ref toSave, "patient_state", txtPatientState.Text); SaveWithCheckForChange(ref toSave, "patient_zip", txtPatientZIP.Text); // Doctor // name has to be handled in a special way if (toSave.DoctorName != txtDoctorName.Text) { AddChange(toSave.id, "doctor_name", toSave.DoctorName, txtDoctorName.Text); toSave.DoctorName = txtDoctorName.Text; } SaveWithCheckForChange(ref toSave, "doctor_tax_number", txtDoctorTaxID.Text); SaveWithCheckForChange(ref toSave, "doctor_license_number", txtDoctorLicenseID.Text); SaveWithCheckForChange(ref toSave, "doctor_bcbs_number", txtDoctorBC.Text); // phone has to be handled in a special way PhoneObject newDoctorPhone = new PhoneObject(txtDoctorPhone.Text); if (toSave.doctor_phone_number_object.FormattedPhone != newDoctorPhone.FormattedPhone) { AddChange(toSave.id, "doctor_phone_number", toSave.doctor_phone_number_object.FormattedPhone, newDoctorPhone.FormattedPhone); toSave.doctor_phone_number_object = newDoctorPhone; } // phone has to be handled in a special way PhoneObject newDoctorFax = new PhoneObject(txtDoctorFax.Text); if (toSave.doctor_fax_number_object.FormattedPhone != newDoctorFax.FormattedPhone) { AddChange(toSave.id, "doctor_fax_number", toSave.doctor_fax_number_object.FormattedPhone, newDoctorFax.FormattedPhone); toSave.doctor_fax_number_object = newDoctorFax; } SaveWithCheckForChange(ref toSave, "doctor_address", txtDoctorAddress.Text); SaveWithCheckForChange(ref toSave, "doctor_address2", txtDoctorAddress2.Text); SaveWithCheckForChange(ref toSave, "doctor_city", txtDoctorCity.Text); SaveWithCheckForChange(ref toSave, "doctor_state", txtDoctorState.Text); SaveWithCheckForChange(ref toSave, "doctor_zip", txtDoctorZIP.Text); // Subscriber // Need special code for name if (toSave.SubscriberName != txtSubscriberName.Text) { AddChange(toSave.id, "subscriber_name", toSave.SubscriberName, txtSubscriberName.Text); toSave.SubscriberName = txtSubscriberName.Text; } SaveWithCheckForChangeSpecialDateTime(ref toSave, "subscriber_dob", ctlSubscriberDOB.CurrentDate); SaveWithCheckForChange(ref toSave, "subscriber_number", txtSubscriberID.Text); SaveWithCheckForChange(ref toSave, "subscriber_alternate_number", txtSubscriberAltID.Text); SaveWithCheckForChange(ref toSave, "subscriber_ssn", txtSubscriberSSN.Text.Replace("-", "")); SaveWithCheckForChange(ref toSave, "subscriber_group_name", txtSubscriberGroupName.Text); SaveWithCheckForChange(ref toSave, "subscriber_group_number", txtSubscriberGroupNum.Text); SaveWithCheckForChange(ref toSave, "subscriber_address", txtSubscriberAddress.Text); SaveWithCheckForChange(ref toSave, "subscriber_address2", txtSubscriberAddress2.Text); SaveWithCheckForChange(ref toSave, "subscriber_city", txtSubscriberCity.Text); SaveWithCheckForChange(ref toSave, "subscriber_state", txtSubscriberState.Text); SaveWithCheckForChange(ref toSave, "subscriber_zip", txtSubscriberZIP.Text); // General SaveWithCheckForChangeSpecialDateTime(ref toSave, "sent_date", ctlSentDate.CurrentDate); SaveWithCheckForChangeSpecialDateTime(ref toSave, "resent_date", ctlResentDate.CurrentDate); SaveWithCheckForChangeSpecialDateTime(ref toSave, "on_hold_date", ctlOnHoldDate.CurrentDate); SaveWithCheckForChangeSpecialDateTime(ref toSave, "tracer_date", ctlTracerDate.CurrentDate); // Notes / Open SaveWithCheckForChange(ref toSave, "notes", txtNotes.Text); // Special for boolean if (toSave.open != System.Convert.ToInt32(!chkClosed.Checked)) { AddChange(toSave.id, "open", !chkClosed.Checked, chkClosed.Checked); toSave.open = System.Convert.ToInt32(!chkClosed.Checked); } toSave.handling = cmbHandling.Text; #endregion toSave.Save(); SaveRevisitDate(); _changed = false; if (toSave.LinkedChanges.Count > 0) { lnkViewClaimChangeHistory.Visible = true; } choice choice = new choice(); call call = new call(); return(true); } catch (Exception err) { MessageBox.Show(this, "An unexpected error occurred attempting to save this claim. Please report " + "this error to an administrator:\n\n" + err.Message, "Unexpected Error in Save Routine", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } else { return(false); } }
/// <summary> /// Display the claim information /// </summary> /// <param name="toShow"></param> public void LoadClaim(claim toShow, bool forceReload = false) { bool skipLoad = false; if (LinkedClaim != null && !forceReload) { if (LinkedClaim.id == toShow.id) { skipLoad = true; } } if (!skipLoad) { LinkedClaim = toShow; ngDisplay.LoadNotes(toShow); string patientdob; if (toShow.patient_dob.HasValue) { patientdob = toShow.patient_dob.Value.ToShortDateString(); } else { patientdob = "Unknown DOB"; } lblTitle.Text = toShow.patient_last_name + ", " + toShow.patient_first_name + "; " + patientdob + "; " + toShow.patient_ssn; ctlSentDate.CurrentDate = toShow.sent_date; ctlResentDate.CurrentDate = toShow.resent_date; if (toShow.date_of_service.HasValue) { lblDateOfService.Text = toShow.date_of_service.Value.ToShortDateString(); } else { lblDateOfService.Text = "No DOS"; } txtChartNumber.Text = toShow.subscriber_number; txtInsuranceID.Text = toShow.subscriber_alternate_number; txtDoctorName.Text = toShow.DoctorName; txtNEA.Text = toShow.nea_number; string subscriberdobstring; if (toShow.subscriber_dob.HasValue) { subscriberdobstring = toShow.subscriber_dob.Value.ToShortDateString(); } else { subscriberdobstring = "Unknown DOB"; } txtSubsriberInfo.Text = toShow.SubscriberName + "; " + subscriberdobstring + "; " + toShow.subscriber_ssn; foreach (claim_status aStatus in cmbStatus.Items) { if (aStatus.id == toShow.status_id) { cmbStatus.SelectedItem = aStatus; break; } } ctlRevisitDate.CurrentDate = toShow.revisit_date; LoadProcedures(toShow); SetLastUserText(); } }