private static void TryGetEDIPI(PatientPerson person, Entity ent, Logger Logger) { try { if (person.CorrespondingIdList == null || !person.CorrespondingIdList.Any()) { ent.Attributes.Add("crme_edipi", string.Empty); } else { CorrespondingIDs correspondingIDs = person.CorrespondingIdList.FirstOrDefault((CorrespondingIDs v) => v.AssigningAuthority != null && v.AssigningAuthority.Equals("USDOD", StringComparison.InvariantCultureIgnoreCase) && v.AssigningFacility != null && v.AssigningFacility == "200DOD" && v.IdentifierType != null && v.IdentifierType.Equals("NI", StringComparison.InvariantCultureIgnoreCase)) ?? person.CorrespondingIdList.FirstOrDefault((CorrespondingIDs v) => v.AssigningAuthority != null && v.AssigningAuthority.Equals("USDOD", StringComparison.InvariantCultureIgnoreCase) && v.IdentifierType != null && v.IdentifierType.Equals("NI", StringComparison.InvariantCultureIgnoreCase)); ent.Attributes.Add("crme_edipi", ((correspondingIDs != null) ? correspondingIDs.PatientIdentifier : string.Empty)); } } catch (ArgumentNullException ex) { Logger.WriteToFile("ERROR::Unable to Get EDIPI due to: {0}".Replace("{0}", ex.Message)); throw new InvalidPluginExecutionException("Unable to Get EDIPI due to: {0}".Replace("{0}", ex.Message)); } catch (FaultException <OrganizationServiceFault> ex2) { Logger.WriteToFile("ERROR::Unable to Get EDIPI due to: {0}".Replace("{0}", ex2.Message)); throw new InvalidPluginExecutionException("Unable to Get EDIPI due to: {0}".Replace("{0}", ex2.Message)); } catch (NullReferenceException ex3) { Logger.WriteToFile("ERROR::Unable to Get EDIPI due to: {0}".Replace("{0}", ex3.Message)); throw new InvalidPluginExecutionException("Unable to Get EDIPI due to: {0}".Replace("{0}", ex3.Message)); } catch (Exception ex4) { Logger.WriteToFile("ERROR::Unable to Get EDIPI due to: {0}".Replace("{0}", ex4.Message)); throw new InvalidPluginExecutionException("Unable to Get EDIPI due to: {0}".Replace("{0}", ex4.Message)); } }
public static string TryGetICN(PatientPerson person, Logger Logger) { try { if (person.CorrespondingIdList == null || !person.CorrespondingIdList.Any()) { return(string.Empty); } CorrespondingIDs correspondingIDs = person.CorrespondingIdList.FirstOrDefault((CorrespondingIDs v) => v.AssigningAuthority != null && v.AssigningAuthority.Equals("USVHA", StringComparison.InvariantCultureIgnoreCase) && v.AssigningFacility != null && v.AssigningFacility == "200M" && v.IdentifierType != null && v.IdentifierType.Equals("NI", StringComparison.InvariantCultureIgnoreCase)) ?? person.CorrespondingIdList.FirstOrDefault((CorrespondingIDs v) => v.AssigningAuthority != null && v.AssigningAuthority.Equals("USVHA", StringComparison.InvariantCultureIgnoreCase) && v.IdentifierType != null && v.IdentifierType.Equals("PI", StringComparison.InvariantCultureIgnoreCase)); return((correspondingIDs != null) ? correspondingIDs.PatientIdentifier : string.Empty); } catch (ArgumentNullException ex) { Logger.WriteToFile("ERROR::Unable to Get MVI Query Params due to: {0}".Replace("{0}", ex.Message)); throw new InvalidPluginExecutionException("Unable to Get MVI Query Params due to: {0}".Replace("{0}", ex.Message)); } catch (FaultException <OrganizationServiceFault> ex2) { Logger.WriteToFile("ERROR::Unable to Get MVI Query Params due to: {0}".Replace("{0}", ex2.Message)); throw new InvalidPluginExecutionException("Unable to Get MVI Query Params due to: {0}".Replace("{0}", ex2.Message)); } catch (NullReferenceException ex3) { Logger.WriteToFile("ERROR::Unable to Get MVI Query Params due to: {0}".Replace("{0}", ex3.Message)); throw new InvalidPluginExecutionException("Unable to Get MVI Query Params due to: {0}".Replace("{0}", ex3.Message)); } catch (Exception ex4) { Logger.WriteToFile("ERROR::Unable to Get MVI Query Params due to: {0}".Replace("{0}", ex4.Message)); throw new InvalidPluginExecutionException("Unable to Get MVI Query Params due to: {0}".Replace("{0}", ex4.Message)); } }
private static void getMVICorpPidBIRLSFN(this PatientPerson patient, Logger logger, Entity ent, VeisConfig config) { SelectedPersonRequest selectedPersonRequest = new SelectedPersonRequest(); selectedPersonRequest.OrganizationName = config.OrgName; selectedPersonRequest.UserId = config.UserId; selectedPersonRequest.MessageId = Guid.NewGuid().ToString(); //selectedPersonRequest.Debug = false; selectedPersonRequest.LogSoap = config.LogSoap; selectedPersonRequest.LogTiming = config.LogTimer; //selectedPersonRequest.noAddPerson = false; //selectedPersonRequest.ICN = newPerson.crme_ICN; CorrespondingIdsResponse correspondingIdsResponse = WebApiUtility.SendReceiveVeisRequest <CorrespondingIdsResponse>(config, "SelectedPerson", selectedPersonRequest); if (correspondingIdsResponse.ExceptionOccured) { logger.WriteDebugMessage($"ERROR::VBASensitivityCheck: Search Exception Message: {correspondingIdsResponse.RawMviExceptionMessage}"); } try { if (correspondingIdsResponse.CorrespondingIdList == null || !correspondingIdsResponse.CorrespondingIdList.Any()) { logger.WriteDebugMessage("DEBUG::VBASensitivityCheck: No Correlations Returned in getMVICorpPidBIRLSFN()"); } else { CorrespondingIDs correspondingIDs = correspondingIdsResponse.CorrespondingIdList.FirstOrDefault((CorrespondingIDs v) => v.AssigningAuthority != null && v.AssigningAuthority.Equals("USVBA", StringComparison.InvariantCultureIgnoreCase) && v.AssigningFacility != null && v.AssigningFacility == "200CORP" && v.IdentifierType != null && v.IdentifierType.Equals("PI", StringComparison.InvariantCultureIgnoreCase)) ?? correspondingIdsResponse.CorrespondingIdList.FirstOrDefault((CorrespondingIDs v) => v.AssigningAuthority != null && v.AssigningAuthority.Equals("USVBA", StringComparison.InvariantCultureIgnoreCase) && v.IdentifierType != null && v.IdentifierType.Equals("PI", StringComparison.InvariantCultureIgnoreCase)); ent.Attributes.Add("crme_participantid", ((correspondingIDs != null) ? correspondingIDs.PatientIdentifier : string.Empty)); CorrespondingIDs correspondingIDs2 = correspondingIdsResponse.CorrespondingIdList.FirstOrDefault((CorrespondingIDs v) => v.AssigningAuthority != null && v.AssigningAuthority.Equals("USVBA", StringComparison.InvariantCultureIgnoreCase) && v.AssigningFacility != null && v.AssigningFacility == "200BRLS" && v.IdentifierType != null && v.IdentifierType.Equals("PI", StringComparison.InvariantCultureIgnoreCase)) ?? correspondingIdsResponse.CorrespondingIdList.FirstOrDefault((CorrespondingIDs v) => v.AssigningAuthority != null && v.AssigningAuthority.Equals("USVBA", StringComparison.InvariantCultureIgnoreCase) && v.IdentifierType != null && v.IdentifierType.Equals("PI", StringComparison.InvariantCultureIgnoreCase)); ent.Attributes.Add("crme_filenumber", ((correspondingIDs2 != null) ? correspondingIDs2.PatientIdentifier : string.Empty)); CorrespondingIDs correspondingIDs3 = correspondingIdsResponse.CorrespondingIdList.FirstOrDefault((CorrespondingIDs v) => v.AssigningAuthority != null && v.AssigningAuthority.Equals("USDOD", StringComparison.InvariantCultureIgnoreCase) && v.AssigningFacility != null && v.AssigningFacility == "200DOD" && v.IdentifierType != null && v.IdentifierType.Equals("NI", StringComparison.InvariantCultureIgnoreCase)) ?? correspondingIdsResponse.CorrespondingIdList.FirstOrDefault((CorrespondingIDs v) => v.AssigningAuthority != null && v.AssigningAuthority.Equals("USDOD", StringComparison.InvariantCultureIgnoreCase) && v.IdentifierType != null && v.IdentifierType.Equals("NI", StringComparison.InvariantCultureIgnoreCase)); ent.Attributes.Add("crme_edipi", ((correspondingIDs3 != null) ? correspondingIDs3.PatientIdentifier : string.Empty)); logger.WriteDebugMessage($"DEBUG::VBASensitivityCheck: Response Success for PId: {correspondingIDs.PatientIdentifier}, FileNumber: {correspondingIDs2.PatientIdentifier}, EDIPI: {correspondingIDs3.PatientIdentifier} "); } } catch (Exception) { logger.WriteDebugMessage("ERROR::VBASensitivityCheck: Error in getMVICorpPidBIRLSFN()"); } }
public static void HandleSensitivityMasking(VeisConfig config, PatientPerson person, Entity newPerson, string employee) { if (config.GetSensitiveInfo && newPerson.Contains("crme_icn") && newPerson["crme_icn"].ToString() != "" && !config.OrgName.ToUpper().Contains("VRE")) { newPerson["crme_veteransensitivitylevel"] = getSensitivityLevelVHA(config, newPerson, employee); if (config.OrgName.ToUpper().Contains("VCL") && (newPerson["crme_veteransensitivitylevel"].ToString() == "true:false" || newPerson["crme_veteransensitivitylevel"].ToString() == "true:true" || newPerson["crme_veteransensitivitylevel"] == "false:true")) { newPerson["crme_dobstring"] = "XX/XX/XXXX"; newPerson["crme_ssn"] = "XXXXXXXXX"; newPerson["crme_primaryphone"] = "(XXX) XXX-XXXX"; if (person.Address != null && person.Address.StreetAddressLine != "" && person.Address.State != "" && person.Address.City != "" && person.Address.State != "" && person.Address.PostalCode != "" && person.Address.StreetAddressLine != string.Empty) { string a = person.Address.StreetAddressLine + " " + person.Address.City + " " + person.Address.State + " " + person.Address.PostalCode; if (a != " ") { newPerson["crme_fulladdress"] = "XXXXXXXXX XXXX, XX XXXXX"; newPerson["crme_address1"] = "XXXXXXXXX"; newPerson["crme_city"] = "XXXX"; newPerson["crme_addressstate"] = "XX"; newPerson["crme_addresszip"] = "XXXXX"; } else { newPerson["crme_fulladdress"] = ""; } } } else if (newPerson["crme_veteransensitivitylevel"].ToString() == "true:true" || newPerson["crme_veteransensitivitylevel"].ToString() == "false:true") { newPerson["crme_dobstring"] = "XX/XX/XXXX"; newPerson["crme_ssn"] = "XXXXXXXXX"; } } else { newPerson["crme_dobstring"] = person.BirthDate; newPerson["crme_ssn"] = person.SocialSecurityNumber; } }
public static Entity Map(this PatientPerson patient, IOrganizationService organizationService, Logger logger, VeisConfig config) { Entity ent = null; if (patient != null) { ent = new Entity("crme_person"); ent.Id = new Guid(); ent.Attributes.Add("crme_ssn", patient.SocialSecurityNumber); ent.Attributes.Add("crme_primaryphone", patient.PhoneNumber); ent.Attributes.Add("crme_branchofservice", patient.BranchOfService); ent.Attributes.Add("crme_recordsource", patient.RecordSource); ent.Attributes.Add("crme_gender", patient.GenderCode); ent.Attributes.Add("crme_deceaseddate", patient.DeceasedDate); ent.Attributes.Add("crme_identitytheft", patient.IdentifyTheft); ent.Attributes.Add("crme_url", "&select=*&$filter=crme_patientmviidentifier eq '" + patient.Identifier + "' and crme_searchtype eq 'SelectedPersonSearch'"); ent.Attributes.Add("crme_dobstring", patient.BirthDate); if (patient.NameList != null) { var legalName = patient.NameList.GetName("Legal", true); if (legalName != null) { ent.Attributes.AddRange(legalName.Map()); } } if (patient.Address != null) { ent.Attributes.AddRange(patient.Address.Map()); if (!ent.Attributes.Contains("crme_fulladdress")) { ent.Attributes.Add("crme_fulladdress", patient.FullAddress); } } } TryGetMviQueryParams(patient, ent, logger); TryGetCorpInfo(patient, ent, logger); ent.Attributes.Add("crme_veteransensitivitylevel", patient.VeteranSensitivityLevel); ent.Attributes.Add("crme_edipi", patient.EdiPi); string empty = string.Empty; if (config.GetSensitiveInfo) { List <string> strs = new List <string>(); strs.Add(TryGetICN(patient, logger)); string url = getKVPSetting("sensitive_endpoint", organizationService); List <string> list2 = new List <string>(); list2.Add(TryGetICN(patient, logger)); string keys = config.VeisConfiguration.SvcConfigInfo.ApimSubscriptionKey; NonVetResponse nvResponse = getVHAVeteranEmployeeFlags(String.Format("{0}{1}", config.VeisConfiguration.SvcConfigInfo.SvcBaseUrl, config.EmployeeEndpoint), keys, strs, logger); List <VeteranEmployeeFlag> vHAVeteranEmployeeFlags = new List <VeteranEmployeeFlag>(); foreach (NVDatum datum in nvResponse.Data) { if (datum.NationalId == null) { vHAVeteranEmployeeFlags.Add(new VeteranEmployeeFlag() { NationalId = "", Value = "NO" }); } else if (!(datum.Veteran == null || datum.Veteran == "" ? false : !(datum.Veteran.ToUpper() == "YES"))) { vHAVeteranEmployeeFlags.Add(new VeteranEmployeeFlag() { NationalId = datum.NationalId, Value = "NO" }); } else if (!(!(datum.Veteran.ToUpper() == "NO") || datum.NewPersonIndicator == null ? true : !(datum.NewPersonIndicator.ToUpper() == "YES"))) { vHAVeteranEmployeeFlags.Add(new VeteranEmployeeFlag() { NationalId = datum.NationalId, Value = "YES" }); } else if ((!(datum.Veteran.ToUpper() == "NO") || datum.PrimaryEligibilityCode == null ? false : datum.PrimaryEligibilityCode.ToUpper() == "EMPLOYEE")) { vHAVeteranEmployeeFlags.Add(new VeteranEmployeeFlag() { NationalId = datum.NationalId, Value = "YES" }); } } string isEmp = string.Empty; if (vHAVeteranEmployeeFlags.Count > 0) { isEmp = isEmployee(ent["crme_icn"].ToString(), vHAVeteranEmployeeFlags); } HandleSensitivityMasking(config, patient, ent, isEmp); } return(ent); }