Пример #1
0
        public DataSet GetPatientHPIProstateGU(int PatientId, System.Byte ShowEFormValues)
        {
            SqlCommand com = DataAccessHelper.CreateCommand("spGetPatientHPIProstateGU");

            DataAccessHelper.AddIntInputParam(com, "PatientId", PatientId);
            DataAccessHelper.AddBitInputParam(com, "EForm", ShowEFormValues);
            DataSet ds = DataAccessHelper.GetList(com);

            return(ds);
        }
Пример #2
0
        public DataSet GetPatientHPI(int PatientId, System.Byte NomogramResults, System.Byte NomogramValues)
        {
            SqlCommand com = DataAccessHelper.CreateCommand("spGetPatientHPI");

            DataAccessHelper.AddIntInputParam(com, "PatientId", PatientId);
            DataAccessHelper.AddBitInputParam(com, "NomogramResults", NomogramResults);
            DataAccessHelper.AddBitInputParam(com, "NomogramValues", NomogramResults);
            DataSet ds = DataAccessHelper.GetList(com);

            return(ds);
        }
Пример #3
0
        /// <summary>
        /// Allows choice of list type and hiding/showing lab values
        /// </summary>
        /// <param name="patientId"></param>
        /// <param name="listType"></param>
        /// <param name="userName"></param>
        /// <param name="excludeLabs"></param>
        /// <returns></returns>
        public DataSet GetChronoList(int patientId, string listType, string userName, bool excludeLabs)
        {
            SqlCommand com = DataAccessHelper.CreateCommand("spChronologicalList");

            DataAccessHelper.AddIntInputParam(com, "patientId", patientId);
            DataAccessHelper.AddBitInputParam(com, listType, 1);
            DataAccessHelper.AddStringInputParam(com, "ExcludeLabs", (excludeLabs? 1:0).ToString());
            DataAccessHelper.AddStringInputParam(com, "UserName", userName);

            return(DataAccessHelper.GetList(com));
        }
Пример #4
0
        /// <summary>
        /// Gets validity of user and password
        /// </summary>
        /// <param name="userName">username</param>
        /// <param name="password">password</param>
        /// <returns>status code of Valid, InvalidUsername, InvalidPassword, or InvalidDeactivated</returns>
        public string ValidateUser(string userName, string password, byte requirePasswordUpdateOnFirstLogin, int elapsedDays)
        {
            SqlCommand com = DataAccessHelper.CreateCommand("spValidateLogin");

            DataAccessHelper.AddStringInputParam(com, "UserName", userName);
            DataAccessHelper.AddStringInputParam(com, "UserPassword", password);
            DataAccessHelper.AddBitInputParam(com, "RequirePasswordUpdateOnFirstLogin", requirePasswordUpdateOnFirstLogin);
            DataAccessHelper.AddIntInputParam(com, "ElapsedDays", elapsedDays);
            DataAccessHelper.AddStringOutputParam(com, "LoginStatus");
            Hashtable ht = DataAccessHelper.ExecuteScalar(com);

            // a status code of Valid, InvalidUsername, InvalidPassword, or InvalidDeactivated
            return(ht["LoginStatus"].ToString());
        }
Пример #5
0
        /// <summary>
        /// Visit each item in the Prostate GU HPI and process the results to the consumer callback.
        /// </summary>
        /// <param name="PatientId"></param>
        /// <param name="ShowEFormValues"></param>
        /// <param name="consumer"></param>
        private static void ConsumePatientHPIProstateGU(int PatientId, System.Byte ShowEFormValues, Action <Dictionary <string, object> > consumer)
        {
            SqlCommand com = DataAccessHelper.CreateCommand("spGetPatientHPIProstateGU");

            DataAccessHelper.AddIntInputParam(com, "PatientId", PatientId);
            DataAccessHelper.AddBitInputParam(com, "EForm", ShowEFormValues);

            char[] sep1 = { '|' };

            char[] sep2 = { ',' };

            int groupIndex = 0;

            // while row data returned, cleanup and notify consumer with clean data
            Connectivity.ConsumeRecord(com, (record) =>
            {
                // maybe move this into a RowFilter for a DataView later - jf
                string filter = record["Filters"].ToString();

                string[] tableNames = record["TableNames"].ToString().Split(sep2);

                string[] primaryKeys = record["PrimaryKeys"].ToString().Split(sep2);

                string[] hpiItems = record["patientHPIDelimited"].ToString().Split(sep1, StringSplitOptions.RemoveEmptyEntries);

                string hpiString = record["patientHPIDelimited"].ToString();

                string sortDate = record["SortDate"].ToString();

                int numberOfHpiItems = tableNames.Length; //primaryKeys.Length;

                string hpi;
                if (numberOfHpiItems > 0)
                {
                    DateTime hpiDate;
                    string hpiDateString = "";
                    // group like items into grouping
                    for (int i = 0; i < hpiItems.Length; i++)
                    {
                        int groupRowIndex = i;

                        var hpiItem  = hpiItems[i];
                        string table = "";
                        // this if statement is here to catch the special case of there being a mismatch in the lengths of patientHPIDelimited, tablenames, and primarykeys
                        if (i < tableNames.Length)
                        {
                            table = tableNames[i];
                        }


                        int priKey;
                        string priKeyStr = "";
                        // this extra if statement is here to catch the special case of there being a mismatch in the lengths of patientHPIDelimited, tablenames, and primarykeys
                        if (i < primaryKeys.Length)
                        {
                            priKeyStr = primaryKeys[i];
                        }
                        bool priKeyIsInt = Int32.TryParse(priKeyStr, out priKey);
                        string endDate   = "";
                        string item      = "";


                        if (table.Length > 0)
                        {
                            hpi       = hpiItem.Replace("__", "");
                            var pairs = hpi.Split(' ');
                            // extract dates
                            // get End Date
                            if (pairs.First().Contains("-"))
                            {
                                var dateField = pairs.First().Split('-');
                                hpiDateString = dateField.ElementAt(0);
                                endDate       = dateField.ElementAt(1);

                                item = string.Join(" ", pairs.Skip(1).Take(pairs.Count()).ToArray());
                            }
                            else
                            {
                                if (pairs.Count() > 0)
                                {
                                    if (i == 0)
                                    {
                                        if (DateTime.TryParse(pairs.First(), out hpiDate))
                                        {
                                            hpiDateString = pairs.First();
                                            item          = string.Join(" ", pairs.Skip(1).Take(pairs.Count()).ToArray());
                                        }
                                        else
                                        {
                                            item = string.Join(" ", pairs.ToArray());
                                        }
                                    }
                                    else
                                    {
                                        item = string.Join(" ", pairs.ToArray());
                                    }
                                }
                            }
                            // create callback data source
                            Dictionary <string, object> consumerData = new Dictionary <string, object>();

                            // set field values
                            consumerData["Table"]  = table;
                            consumerData["PriKey"] = priKey;
                            DateTime sDateParse    = DateTime.Now;
                            DateTime eDateParse    = DateTime.Now;
                            if (!string.IsNullOrEmpty(sortDate) && DateTime.TryParse(sortDate, out sDateParse))
                            {
                                consumerData["StartDate"] = sDateParse;
                            }
                            else if (!string.IsNullOrEmpty(hpiDateString) && DateTime.TryParse(hpiDateString, out sDateParse))
                            {
                                consumerData["StartDate"] = sDateParse;
                            }
                            else
                            {
                                consumerData["StartDate"] = DBNull.Value;
                            }
                            if (!string.IsNullOrEmpty(endDate) && DateTime.TryParse(endDate, out eDateParse))
                            {
                                consumerData["EndDate"] = eDateParse;
                            }
                            else
                            {
                                consumerData["EndDate"] = DBNull.Value;
                            }
                            // date text fields
                            consumerData["StartDateText"] = hpiDateString;
                            consumerData["EndDateText"]   = endDate;

                            consumerData["Item"]    = item;
                            consumerData["Filters"] = filter;

                            // set lookup indexes
                            consumerData["GroupIndex"]    = groupIndex;
                            consumerData["GroupRowIndex"] = groupRowIndex;

                            // call consumer with current data
                            consumer(consumerData);
                        }
                        else
                        {
                        }
                    }
                }
                else
                {
                }

                // increment
                groupIndex++;
                // continue
                return(true);
            });
        }