///<summary>Fills the lists containing all races and all ethnicities from the database and fills the lists containing the races and ethnicities ///for the patient.</summary> private void FillRaceData() { List <Cdcrec> listCdcrecs = Cdcrecs.GetAll(); _listAllRaces = listCdcrecs.FindAll(x => x.HeirarchicalCode.StartsWith("R") && x.HeirarchicalCode != "R") //Race codes start with R. .OrderBy(x => x.HeirarchicalCode).ToList(); _listAllEthnicities = listCdcrecs.FindAll(x => x.HeirarchicalCode.StartsWith("E") && x.HeirarchicalCode != "E") //Ethnicity codes start with E. .OrderBy(x => x.HeirarchicalCode).ToList(); Cdcrec declinedSpecify = new Cdcrec { Description = Lan.g(this, "DECLINED TO SPECIFY"), CdcrecCode = PatientRace.DECLINE_SPECIFY_RACE_CODE, HeirarchicalCode = "" }; _listAllRaces.Add(declinedSpecify); declinedSpecify = new Cdcrec { Description = Lan.g(this, "DECLINED TO SPECIFY"), CdcrecCode = PatientRace.DECLINE_SPECIFY_ETHNICITY_CODE, HeirarchicalCode = "" }; _listAllEthnicities.Add(declinedSpecify); _listPatRaces = new List <Cdcrec>(); _listPatEthnicities = new List <Cdcrec>(); foreach (PatientRace patRace in _listAllPatientRaces) { Cdcrec cdcrec = _listAllRaces.FirstOrDefault(x => x.CdcrecCode == patRace.CdcrecCode); if (cdcrec != null) { _listPatRaces.Add(cdcrec); } cdcrec = _listAllEthnicities.FirstOrDefault(x => x.CdcrecCode == patRace.CdcrecCode); if (cdcrec != null) { _listPatEthnicities.Add(cdcrec); } if (patRace.CdcrecCode == PatientRace.MULTI_RACE_CODE) { cdcrec = new Cdcrec { Description = Lan.g(this, "MULTIRACIAL"), CdcrecCode = PatientRace.MULTI_RACE_CODE, HeirarchicalCode = "" }; _listPatRaces.Add(cdcrec); } } if (_listAllRaces.Count > 1 && _listAllEthnicities.Count > 1) //Greater than 1 because we always add 'Declined to Specify' { labelNeedCodes.Visible = false; butImport.Visible = false; } }
///<summary>Manually adds the few CDCREC codes necessary for the HL7 unit tests.</summary> private static void AddCdcrecCodes() { string command = "SELECT COUNT(*) FROM cdcrec"; if (DataCore.GetScalar(command) == "0") { Cdcrecs.Insert(new Cdcrec() { CdcrecCode = "2106-3", HeirarchicalCode = "R5", Description = "WHITE" }); Cdcrecs.Insert(new Cdcrec() { CdcrecCode = "2135-2", HeirarchicalCode = "E1", Description = "HISPANIC OR LATINO" }); } }