コード例 #1
0
 /// <summary>
 /// Calculates the stat chart values on the selected message components.
 /// </summary>
 /// <returns>The list of GraphItems to display in the chart.</returns>
 private List <GraphItems> ProcessStatChartItems()
 {
     try
     {
         List <GraphItems> gItems = new List <GraphItems>();
         foreach (string m in Messages)
         {
             HL7Lib.Base.Message          msg  = new HL7Lib.Base.Message(m);
             List <HL7Lib.Base.Component> coms = msg.GetByID(componentID);
             if (coms != null && coms.Count == 1)
             {
                 GraphItems gi = GraphItems.GetGraphItem(gItems, coms[0].Value);
                 if (gi != null)
                 {
                     gItems.Remove(gi);
                     int count = gi.Count + 1;
                     gi = new GraphItems(coms[0].Value, count);
                     gItems.Add(gi);
                 }
                 else
                 {
                     gi = new GraphItems(coms[0].Value, 1);
                     gItems.Add(gi);
                 }
             }
         }
         return(gItems);
     }
     catch (Exception ex)
     {
         Log.Instance.LogException(ex).Report();
         return(new List <GraphItems>());
     }
 }
コード例 #2
0
        /// <summary>
        /// Calculates the stat chart values on the Message Date/Time component of the MSH segment for Daily Traffic Stats.
        /// </summary>
        /// <returns>The list of GraphItems to display in the chart.</returns>
        private List <GraphItems> ProcessDailyStatChartItems()
        {
            try
            {
                int d1 = 0;
                int d2 = 0;
                int d3 = 0;
                int d4 = 0;
                int d5 = 0;
                int d6 = 0;
                int d7 = 0;
                List <GraphItems> gItems = new List <GraphItems>();

                foreach (string m in Messages)
                {
                    HL7Lib.Base.Message          msg  = new HL7Lib.Base.Message(m);
                    List <HL7Lib.Base.Component> coms = msg.GetByID(componentID);
                    if (coms != null && coms.Count == 1)
                    {
                        Nullable <DateTime> d = coms[0].Value.FromHL7Date();
                        if (d != null)
                        {
                            switch (d.Value.DayOfWeek)
                            {
                            case DayOfWeek.Sunday: d1++; break;

                            case DayOfWeek.Monday: d2++; break;

                            case DayOfWeek.Tuesday: d3++; break;

                            case DayOfWeek.Wednesday: d4++; break;

                            case DayOfWeek.Thursday: d5++; break;

                            case DayOfWeek.Friday: d6++; break;

                            case DayOfWeek.Saturday: d7++; break;
                            }
                        }
                    }
                }
                gItems.Add(new GraphItems("Sunday", d1));
                gItems.Add(new GraphItems("Monday", d2));
                gItems.Add(new GraphItems("Tuesday", d3));
                gItems.Add(new GraphItems("Wednesday", d4));
                gItems.Add(new GraphItems("Thursday", d5));
                gItems.Add(new GraphItems("Friday", d6));
                gItems.Add(new GraphItems("Saturday", d7));
                return(gItems);
            }
            catch (Exception ex)
            {
                Log.Instance.LogException(ex).Report();
                return(new List <GraphItems>());
            }
        }
コード例 #3
0
ファイル: Extensions.cs プロジェクト: Tharkis/HL7_Analyst_CCS
        /// <summary>
        /// Edits the message string
        /// </summary>
        /// <param name="m">The message to edit</param>
        /// <param name="items">The items to edit in the message</param>
        /// <returns>The new message after editing</returns>
        public static Message EditValues(this Message m, List <EditItem> items, ILogWriter logger)
        {
            try {
                string          returnMsg = m.InputString;
                List <EditItem> finalList = new List <EditItem>();
                foreach (EditItem item in items)
                {
                    List <HL7Lib.Base.Component> com = m.GetByID(item.ComponentID);
                    foreach (HL7Lib.Base.Component c in com)
                    {
                        //fixme - commented(2/10/17) since this method will not work without a more complex relacement method
                        //if (item.Config != null) {    //fixme - consider updating this pre-processing within the new EditItem itself
                        //    foreach (Replacement pre in item.Config.PreReplace) {
                        //        if (pre.ExactMatch && c.Value.ToLower() == pre.Match) {
                        //            c.Value = c.Value.ToLower().Replace(pre.Match, pre.Replace);
                        //        }
                        //        else {  //fixme - update for regex and upper/lower case
                        //            //
                        //        }
                        //    }
                        //}
                        //fixme - commented(2/10/17) since this method will not work without a more complex relacement method

                        finalList.Add(new EditItem(c.ID, c.Value, item.NewValue));
                    }
                }
                finalList.Sort((x, y) => x.OldValue.Length.CompareTo(y.OldValue.Length)); // Sort so shortest oldvalue comes first - fixme
                for (int j = 0; j < finalList.Count; j++)
                {
                    if (!String.IsNullOrEmpty(finalList[j].OldValue))
                    {
                        //returnMsg = returnMsg.Replace(finalList[j].OldValue, finalList[j].NewValue);
                        returnMsg = Regex.Replace(returnMsg, finalList[j].OldValue, finalList[j].NewValue, RegexOptions.IgnoreCase);

                        // Update each other EditItem as well - fixme
                        for (int i = (j + 1); i < finalList.Count; i++)
                        {
                            //finalList[i].OldValue = finalList[i].OldValue.Replace(finalList[j].OldValue, finalList[j].NewValue);
                            finalList[i].OldValue = Regex.Replace(finalList[i].OldValue, finalList[j].OldValue, finalList[j].NewValue, RegexOptions.IgnoreCase);
                        }
                    }
                }
                return(new Message(returnMsg));
            }
            catch (Exception ex) {
                logger.LogException(ex).Report();
                return(null);
            }
        }
コード例 #4
0
        /// <summary>
        /// Searches the message using the search query.
        /// </summary>
        /// <param name="m">The message to search</param>
        /// <returns>Returns true if the message matches the search query</returns>
        private bool SearchMessage(HL7Lib.Base.Message m)
        {
            try
            {
                bool returnValue = false;

                foreach (string item in txtSearchTerms.Text.Split('|'))
                {
                    bool allMatched = false;
                    List <SearchTerm> searchTerms = SearchTerm.GetSearchTerms(item.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries));
                    foreach (SearchTerm st in searchTerms)
                    {
                        HL7Lib.Base.Component c = m.GetByID(st.ID, st.Value.ToUpper());
                        if (!String.IsNullOrEmpty(c.ID))
                        {
                            allMatched = true;
                        }
                        else
                        {
                            allMatched = false;
                            break;
                        }
                    }
                    if (allMatched)
                    {
                        returnValue = true;
                        break;
                    }
                }
                return(returnValue);
            }
            catch (Exception ex)
            {
                Log.LogException(ex).ShowDialog();
                return(false);
            }
        }
コード例 #5
0
        /// <summary>
        /// Calculates the stat chart values on the Message Date/Time component of the MSH segment for Hourly Traffic Stats.
        /// </summary>
        /// <returns>The list of GraphItems to display in the chart.</returns>
        private List <GraphItems> ProcessHourlyStatChartItems()
        {
            try
            {
                int h0  = 0;
                int h1  = 0;
                int h2  = 0;
                int h3  = 0;
                int h4  = 0;
                int h5  = 0;
                int h6  = 0;
                int h7  = 0;
                int h8  = 0;
                int h9  = 0;
                int h10 = 0;
                int h11 = 0;
                int h12 = 0;
                int h13 = 0;
                int h14 = 0;
                int h15 = 0;
                int h16 = 0;
                int h17 = 0;
                int h18 = 0;
                int h19 = 0;
                int h20 = 0;
                int h21 = 0;
                int h22 = 0;
                int h23 = 0;
                List <GraphItems> gItems = new List <GraphItems>();

                foreach (string m in Messages)
                {
                    HL7Lib.Base.Message          msg  = new HL7Lib.Base.Message(m);
                    List <HL7Lib.Base.Component> coms = msg.GetByID(componentID);
                    if (coms != null && coms.Count == 1)
                    {
                        Nullable <DateTime> d = coms[0].Value.FromHL7Date();
                        if (d != null)
                        {
                            switch (d.Value.ToString("HH"))
                            {
                            case "00": h0++; break;

                            case "01": h1++; break;

                            case "02": h2++; break;

                            case "03": h3++; break;

                            case "04": h4++; break;

                            case "05": h5++; break;

                            case "06": h6++; break;

                            case "07": h7++; break;

                            case "08": h8++; break;

                            case "09": h9++; break;

                            case "10": h10++; break;

                            case "11": h11++; break;

                            case "12": h12++; break;

                            case "13": h13++; break;

                            case "14": h14++; break;

                            case "15": h15++; break;

                            case "16": h16++; break;

                            case "17": h17++; break;

                            case "18": h18++; break;

                            case "19": h19++; break;

                            case "20": h20++; break;

                            case "21": h21++; break;

                            case "22": h22++; break;

                            case "23": h23++; break;
                            }
                        }
                    }
                }
                gItems.Add(new GraphItems("01", h1));
                gItems.Add(new GraphItems("02", h2));
                gItems.Add(new GraphItems("03", h3));
                gItems.Add(new GraphItems("04", h4));
                gItems.Add(new GraphItems("05", h5));
                gItems.Add(new GraphItems("06", h6));
                gItems.Add(new GraphItems("07", h7));
                gItems.Add(new GraphItems("08", h8));
                gItems.Add(new GraphItems("09", h9));
                gItems.Add(new GraphItems("10", h10));
                gItems.Add(new GraphItems("11", h11));
                gItems.Add(new GraphItems("12", h12));
                gItems.Add(new GraphItems("13", h13));
                gItems.Add(new GraphItems("14", h14));
                gItems.Add(new GraphItems("15", h15));
                gItems.Add(new GraphItems("16", h16));
                gItems.Add(new GraphItems("17", h17));
                gItems.Add(new GraphItems("18", h18));
                gItems.Add(new GraphItems("19", h19));
                gItems.Add(new GraphItems("20", h20));
                gItems.Add(new GraphItems("21", h21));
                gItems.Add(new GraphItems("22", h22));
                gItems.Add(new GraphItems("23", h23));
                gItems.Add(new GraphItems("00", h0));
                return(gItems);
            }
            catch (Exception ex)
            {
                Log.Instance.LogException(ex).Report();
                return(new List <GraphItems>());
            }
        }