private void FormPatFieldDefs_Load(object sender, System.EventArgs e) { _listPatFieldDefs = PatFieldDefs.GetDeepCopy(); _listPatFieldDefsOld = _listPatFieldDefs.Select(x => x.Copy()).ToList(); checkDisplayRenamed.Checked = PrefC.GetBool(PrefName.DisplayRenamedPatFields); FillGrid(); }
///<summary>Returns true if all of the required patient fields exist which are necessary to run the Arizona Primary Care reports. ///Otherwise, false is returned.</summary> public static bool UsingArizonaPrimaryCare() { PatFieldDefs.RefreshCache(); string[] patientFieldNames=new string[] { "SPID#", "Eligibility Status", "Household Gross Income", "Household % of Poverty", }; int[] fieldCounts=new int[patientFieldNames.Length]; foreach(PatFieldDef pfd in PatFieldDefs.GetDeepCopy(true)) { for(int i=0;i<patientFieldNames.Length;i++) { if(pfd.FieldName.ToLower()==patientFieldNames[i].ToLower()) { fieldCounts[i]++; break; } } } for(int i=0;i<fieldCounts.Length;i++) { //Each field must be defined exactly once. This verifies that each requied field //both exists and is not ambiguous with another field of the same name. if(fieldCounts[i]!=1) { return false; } } return true; }
///<summary>Adds the passed in pat fields to the grid. Adds any fields that have been renamed at the end of the grid if the preference is ///enabled. The tag on the row will be the PatFieldDef or the PatField if the PatFieldDef has been renamed.</summary> public static void AddPatFieldsToGrid(ODGrid grid, List <PatField> listPatFields, FieldLocations fieldLocation, List <FieldDefLink> listFieldDefLinks = null) { List <PatFieldDef> listPatFieldDefs = PatFieldDefs.GetDeepCopy(true); listFieldDefLinks = listFieldDefLinks ?? FieldDefLinks.GetForLocation(fieldLocation) .FindAll(x => x.FieldDefType == FieldDefTypes.Patient); //Add a row for each existing PatFieldDef foreach (PatFieldDef patFieldDef in listPatFieldDefs) { if (listFieldDefLinks.Exists(x => x.FieldDefNum == patFieldDef.PatFieldDefNum)) { continue; } ODGridRow row = new ODGridRow(); PatField field = listPatFields.FirstOrDefault(x => x.FieldName == patFieldDef.FieldName); if (patFieldDef.FieldType.ToString() == "InCaseOfEmergency") { //Deprecated. Should never happen. continue; } row.Cells.Add(patFieldDef.FieldName); if (field == null) { row.Cells.Add(""); } else { if (patFieldDef.FieldType == PatFieldType.Checkbox) { row.Cells.Add("X"); } else if (patFieldDef.FieldType == PatFieldType.Currency) { row.Cells.Add(PIn.Double(field.FieldValue).ToString("c")); } else { row.Cells.Add(field.FieldValue); } } row.Tag = patFieldDef; grid.Rows.Add(row); } if (!PrefC.GetBool(PrefName.DisplayRenamedPatFields)) { return; } //Now loop through the PatFields that do not have a matching PatFieldDef. foreach (PatField patField in listPatFields.Where(x => !listPatFieldDefs.Any(y => y.FieldName == x.FieldName))) { ODGridRow row = new ODGridRow(); row.Cells.Add(patField.FieldName); row.Cells.Add(patField.FieldValue); row.Tag = patField; row.ColorText = Color.DarkSlateGray; grid.Rows.Add(row); } }
private void FormPatFieldDefs_Load(object sender, System.EventArgs e) { _listPatFieldDefs = PatFieldDefs.GetDeepCopy(); checkDisplayRenamed.Checked = PrefC.GetBool(PrefName.DisplayRenamedPatFields); if (_isSelectionMode) { _listPatFieldDefs = _listPatFieldDefs.FindAll(x => !x.IsHidden); butAdd.Visible = false; butUp.Visible = false; butDown.Visible = false; } _listPatFieldDefsOld = _listPatFieldDefs.Select(x => x.Copy()).ToList(); FillGrid(); }
private void FormFieldDefLink_Load(object sender, EventArgs e) { string[] arrayFieldLocations = Enum.GetNames(typeof(FieldLocations)); for (int i = 0; i < arrayFieldLocations.Length; i++) { comboFieldLocation.Items.Add(Lan.g("enumFieldLocations", arrayFieldLocations[i])); if (i == (int)_fieldLocation) { comboFieldLocation.SelectedIndex = i; } } _listFieldDefLinks = FieldDefLinks.GetAll(); _listApptFieldDefs = ApptFieldDefs.GetDeepCopy(); _listPatFieldDefs = PatFieldDefs.GetDeepCopy(true); FillGridDisplayed(); FillGridHidden(); }