private static bool AllergyComparison(AutomationCondition autoCond, long patNum) { List <Allergy> allergyList = Allergies.GetAll(patNum, false); switch (autoCond.Comparison) { case AutoCondComparison.Equals: for (int i = 0; i < allergyList.Count; i++) { if (AllergyDefs.GetOne(allergyList[i].AllergyDefNum).Description == autoCond.CompareString) { return(true); } } break; case AutoCondComparison.Contains: for (int i = 0; i < allergyList.Count; i++) { if (AllergyDefs.GetOne(allergyList[i].AllergyDefNum).Description.ToLower().Contains(autoCond.CompareString.ToLower())) { return(true); } } break; } return(false); }
private void FillAllergies() { allergyList = Allergies.GetAll(PatCur.PatNum, checkShowInactiveAllergies.Checked); gridAllergies.BeginUpdate(); gridAllergies.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableAllergies", "Allergy"), 100); gridAllergies.Columns.Add(col); col = new ODGridColumn(Lan.g("TableAllergies", "Reaction"), 180); gridAllergies.Columns.Add(col); col = new ODGridColumn(Lan.g("TableAllergies", "Status"), 60, HorizontalAlignment.Center); gridAllergies.Columns.Add(col); gridAllergies.Rows.Clear(); ODGridRow row; for (int i = 0; i < allergyList.Count; i++) { row = new ODGridRow(); AllergyDef allergyDef = AllergyDefs.GetOne(allergyList[i].AllergyDefNum); row.Cells.Add(allergyDef.Description); if (allergyList[i].DateAdverseReaction < DateTime.Parse("1-1-1800")) { row.Cells.Add(allergyList[i].Reaction); } else { row.Cells.Add(allergyList[i].Reaction + " " + allergyList[i].DateAdverseReaction.ToShortDateString()); } if (allergyList[i].StatusIsActive) { row.Cells.Add("Active"); } else { row.Cells.Add("Inactive"); } gridAllergies.Rows.Add(row); } gridAllergies.EndUpdate(); }
private void FillExistingGrid() { gridAllergyExisting.BeginUpdate(); gridAllergyExisting.Columns.Clear(); ODGridColumn col = new ODGridColumn("Last Modified", 90, HorizontalAlignment.Center); gridAllergyExisting.Columns.Add(col); col = new ODGridColumn("Description", 200); gridAllergyExisting.Columns.Add(col); col = new ODGridColumn("Reaction", 100); gridAllergyExisting.Columns.Add(col); col = new ODGridColumn("Inactive", 80, HorizontalAlignment.Center); gridAllergyExisting.Columns.Add(col); gridAllergyExisting.Rows.Clear(); _listAllergyCur = Allergies.GetAll(_patCur.PatNum, false); List <long> allergyDefNums = new List <long>(); for (int h = 0; h < _listAllergyCur.Count; h++) { if (_listAllergyCur[h].AllergyDefNum > 0) { allergyDefNums.Add(_listAllergyCur[h].AllergyDefNum); } } _listAllergyDefCur = AllergyDefs.GetMultAllergyDefs(allergyDefNums); ODGridRow row; AllergyDef ald; for (int i = 0; i < _listAllergyCur.Count; i++) { row = new ODGridRow(); ald = new AllergyDef(); ald = AllergyDefs.GetOne(_listAllergyCur[i].AllergyDefNum, _listAllergyDefCur); row.Cells.Add(_listAllergyCur[i].DateTStamp.ToShortDateString()); if (ald.Description == null) { row.Cells.Add(""); } else { row.Cells.Add(ald.Description); } if (_listAllergyCur[i].Reaction == null) { row.Cells.Add(""); } else { row.Cells.Add(_listAllergyCur[i].Reaction); } if (_listAllergyCur[i].StatusIsActive) { row.Cells.Add(""); } else { row.Cells.Add("X"); } gridAllergyExisting.Rows.Add(row); } gridAllergyExisting.EndUpdate(); }