Exemple #1
0
 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;
     }
 }
Exemple #2
0
        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()");
            }
        }
Exemple #3
0
        public static string getSensitivityLevelVHA(VeisConfig config, Entity person, string employee)
        {
            string str = string.Empty;

            if (person != null && person.Contains("crme_icn"))
            {
                string url = String.Format("{0}{1}{2}", config.VeisConfiguration.SvcConfigInfo.SvcBaseUrl, config.SensitiveEndpoint, person["crme_icn"].ToString());
                //return url;
                bool flag = false;

                HttpWebRequest apiRequest = (HttpWebRequest)WebRequest.Create(url);
                string         subKeys    = config.VeisConfiguration.SvcConfigInfo.ApimSubscriptionKey;
                if (subKeys.Length > 0)
                {
                    string[] headers = subKeys.Split('|');
                    for (int i = 0; i < headers.Length; i = i + 2)
                    {
                        apiRequest.Headers.Add(headers[i], headers[i + 1]);
                    }
                }
                apiRequest.Method = "GET";

                WebResponse  webResponse    = apiRequest.GetResponse();
                Stream       webStream      = webResponse.GetResponseStream();
                StreamReader responseReader = new StreamReader(webStream);
                string       str1           = responseReader.ReadToEnd();
                responseReader.Close();
                //return str1;
                person["crme_veteransensitivitylevel"] = str1;

                ESRSensitiveObject eSRSensitiveObject = JsonHelper.Deserialize <ESRSensitiveObject>(str1);
                if (eSRSensitiveObject.ErrorOccurred)
                {
                    person["crme_exceptionoccured"] = true;
                    person["crme_exceptionmessage"] = eSRSensitiveObject.ErrorMessage;
                    return(str);
                }
                else
                {
                    //TODO Create contact person.PreferredFacility = (eSRSensitiveObject.Data.Demographics != null ? eSRSensitiveObject.Data.Demographics.PreferredFacility : "");
                    if (!(employee == string.Empty))
                    {
                        str = (!(employee == "YES" && eSRSensitiveObject.Data != null && eSRSensitiveObject.Data.SensitivityInfo != null && eSRSensitiveObject.Data.SensitivityInfo.SensityFlag != null) ? string.Concat(eSRSensitiveObject.Data.SensitivityInfo.SensityFlag.ToLower(), ":false") : "true:true");
                    }
                    else if (!config.OrgName.Contains("VCL"))
                    {
                        str = ((eSRSensitiveObject.Data == null || eSRSensitiveObject.Data.EnrollmentDeterminationInfo == null || eSRSensitiveObject.Data.EnrollmentDeterminationInfo.PrimaryEligibility == null || eSRSensitiveObject.Data.EnrollmentDeterminationInfo.PrimaryEligibility.Type == null ? true : !(eSRSensitiveObject.Data.EnrollmentDeterminationInfo.PrimaryEligibility.Type.ToUpper() == "EMPLOYEE")) ? string.Concat(eSRSensitiveObject.Data.SensitivityInfo.SensityFlag.ToLower(), ":false") : string.Concat(eSRSensitiveObject.Data.SensitivityInfo.SensityFlag.ToLower(), ":true"));
                    }
                    else
                    {
                        if (eSRSensitiveObject.Data == null || eSRSensitiveObject.Data.EnrollmentDeterminationInfo == null || eSRSensitiveObject.Data.EnrollmentDeterminationInfo.PrimaryEligibility == null || eSRSensitiveObject.Data.EnrollmentDeterminationInfo.PrimaryEligibility.Type == null)
                        {
                            flag = true;
                        }
                        else if (eSRSensitiveObject.Data != null && eSRSensitiveObject.Data.EnrollmentDeterminationInfo != null && eSRSensitiveObject.Data.EnrollmentDeterminationInfo.PrimaryEligibility != null)
                        {
                            flag = (eSRSensitiveObject.Data.EnrollmentDeterminationInfo.PrimaryEligibility.Type.ToUpper() == "EMPLOYEE" ? false : !(eSRSensitiveObject.Data.EnrollmentDeterminationInfo.Veteran.ToUpper() == "FALSE"));
                        }
                        if (eSRSensitiveObject.Data != null && eSRSensitiveObject.Data.SensitivityInfo != null && eSRSensitiveObject.Data.SensitivityInfo.SensityFlag != null)
                        {
                            str = (flag ? string.Concat(eSRSensitiveObject.Data.SensitivityInfo.SensityFlag.ToLower(), ":false") : string.Concat(eSRSensitiveObject.Data.SensitivityInfo.SensityFlag.ToLower(), ":true"));
                        }
                    }
                }
            }

            return(str);
        }
Exemple #4
0
        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);
        }