public static List<FormDictionary> GetDictionaryValues(string FieldNumber, string CodeList) { var connectionString = ConfigurationManager.ConnectionStrings["AvatarDBPM"].ConnectionString; var dictionary = new List<FormDictionary>(); #region commandText var commandText = "SELECT dict.field_number as FieldNumber, " + "dict.dictionary_code as Code, "+ "dict.dictionary_value as Value, "+ "dict.field_description as FieldDescription, "+ "dict.inactive_code as Inactive, "+ "dict.user_defined_row_id as Id "+ "FROM RADplusCWS.RADplus_dict_user_def dict " + "WHERE field_number=? " + "AND dictionary_code in ("+CodeList+") "; #endregion try { using (var connection = new OdbcConnection(connectionString)) { connection.Open(); using (var dbcommand = new OdbcCommand(commandText, connection)) { dbcommand.Parameters.Add(new OdbcParameter("field_number", FieldNumber)); using (var reader = dbcommand.ExecuteReader()) { while (reader.Read()) { #region ReadInValues var dict = new FormDictionary(); dict.Id = reader["Id"].ToString(); dict.FieldNumber = reader["FieldNumber"].ToString(); dict.Code = reader["Code"].ToString(); dict.Value = reader["Value"].ToString(); dict.FieldDescription = reader["FieldDescription"].ToString(); dict.Inactive = reader["Inactive"].ToString(); dictionary.Add(dict); #endregion } } } connection.Close(); } } catch (Exception ex) { } return dictionary; }
private string GetOtherString(FormDictionary dictionary) { if (dictionary.FieldNumber == "153.52")//medication { return GetFieldValue("153.53").Replace("\n", " "); } else if (dictionary.FieldNumber == "153.54")//substance abuse { return GetFieldValue("153.55").Replace("\n", " "); } else if (dictionary.FieldNumber == "153.56")//pregnancy { return GetFieldValue("153.57").Replace("\n", " "); } else { return String.Empty; } }
private string GetHPIString(FormDictionary dictionary) { if (dictionary.FieldNumber == "152.86")//severity { return String.Format("{0} {1}. ", dictionary.Value, dictionary.FieldDescription); } else if (dictionary.FieldNumber == "152.87")//timing { return String.Format("{0} {1}. ", dictionary.Value, dictionary.FieldDescription); } else if (dictionary.FieldNumber == "152.84")//context { return GetHPIComments("152.84").Replace("\n", " "); } else if (dictionary.FieldNumber == "152.85")//modifying factors { return GetHPIComments("152.85").Replace("\n", " "); } else if (dictionary.FieldNumber == "152.4")//associated signs and symptoms { return GetHPIComments("152.83").Replace("\n", " "); } else if (dictionary.FieldNumber == "152.43")//duration { return String.Format("Lasting approximately {0} {1}. ", GetHPIComments("151.89"), dictionary.Value); } else { return String.Empty; } }
private void UpdateMentalStatusSummary(Dictionary<string, StringBuilder> mentalStatus, FormDictionary dictionary) { if (mentalStatus.ContainsKey(dictionary.FieldNumber)) { mentalStatus[dictionary.FieldNumber] = mentalStatus[dictionary.FieldNumber].Insert(0, String.Format("{0}, ", dictionary.Value)); } else { var sb = new StringBuilder(); sb.AppendFormat("{0} {1}", dictionary.Value, dictionary.FieldDescription); mentalStatus.Add(dictionary.FieldNumber, sb); } }
public static List<FormDictionary> GetDictionaryValues(List<FormDictionary> list) { var connectionString = ConfigurationManager.ConnectionStrings["AvatarDBPM"].ConnectionString; var dictionaryList = new List<FormDictionary>(); #region commandText var commandText = "SELECT dict.field_number as FieldNumber, " + "dict.dictionary_code as Code, " + "dict.dictionary_value as Value, " + "dict.field_description as FieldDescription, " + "dict.inactive_code as Inactive, " + "dict.user_defined_row_id as Id " + "FROM RADplusCWS.RADplus_dict_user_def dict "; if (list.Count > 0) { var tempText = String.Format("WHERE (dict.field_number = {0} AND dict.dictionary_code = {1}) ", list.First().FieldNumber, list.First().Code); foreach (var dictionary in list.Skip(1)) { tempText += String.Format("OR (dict.field_number = {0} AND dict.dictionary_code = {1}) ", dictionary.FieldNumber, dictionary.Code); } commandText += tempText; } #endregion try { using (var connection = new OdbcConnection(connectionString)) { connection.Open(); using (var dbcommand = new OdbcCommand(commandText, connection)) { using (var reader = dbcommand.ExecuteReader()) { while (reader.Read()) { #region ReadInValues var dict = new FormDictionary(); dict.Id = reader["Id"].ToString(); dict.FieldNumber = reader["FieldNumber"].ToString(); dict.Code = reader["Code"].ToString(); dict.Value = reader["Value"].ToString(); dict.FieldDescription = reader["FieldDescription"].ToString(); dict.Inactive = reader["Inactive"].ToString(); dictionaryList.Add(dict); #endregion } } } connection.Close(); } } catch (Exception ex) { } return dictionaryList; }