Exemple #1
0
        private ListGroup getListGroup(patientLocationMapping PLM)
        {
            ListGroup lg;

            if (!(glc.Controls).ContainsKey(PLM.ID))
            {
                lg      = new ListGroup();
                lg.Name = PLM.ID;
                lg.Columns.Add(PLM.ID);
                lg.Columns[lg.Columns.Count - 1].Width = 170;


                // Add handling for the columnRightClick Event:
                lg.MouseClick += new MouseEventHandler(lg_MouseClick);

                glc.Controls.Add(lg);

                return(lg);
            }
            else
            {
                return((ListGroup)glc.Controls[PLM.ID]);

                //((ListGroup)glc.Controls[key]).Columns[1].Text = "Results(" + ++patientList[key].messageCount + ")";
                //((ListGroup)glc.Controls[key]).Columns[2].Text = "Latest Received: (" + receiveTimeString + ")";
                //if (patientList[key].messageCount % 2 == 0)
                //    rowColor = Color.SkyBlue;
                //else
                //    rowColor = Color.White;
            }
        }
Exemple #2
0
        private void process(string rawString)
        {
            Patient  pat = new Patient("blank");
            Location loc;
            patientLocationMapping PLM = new patientLocationMapping();
            ListGroup lg = new ListGroup();

            string   MSHTimeString = "";
            DateTime MSHTime;
            string   ParmTimeString = "";
            DateTime ParmTime;

            int parmIndex;

            string receiveTimeString = DateTime.Now.ToString("h:m:s t");

            string[] segments = rawString.Replace("" + (char)11, "").Split(new string[] { "\r" }, StringSplitOptions.None);

            Console.WriteLine(segments.Count() + " Segments:");

            foreach (string segment in segments)
            {
                string[] fields = segment.Split(new string[] { "|" }, StringSplitOptions.None);

                switch (fields[0])
                {
                case "MSH":
                    try
                    {
                        MSHTimeString = fields[6];
                        MSHTime       = DateTime.ParseExact(MSHTimeString, "yyyyMMddHHmmss", CultureInfo.CurrentCulture);
                        MSHTimeString = MSHTime.ToString("h:m:s t");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error parsing msg time: " + ex.Message);
                        MSHTimeString = "no_time";
                    }
                    break;

                case "PID":
                    pat = getPatientFromPIDFields(fields);
                    break;

                case "PV1":
                    loc = getLocationFromPV1Fields(fields);

                    PLM = getPatientLocationMapping(pat, loc);

                    lg = getListGroup(PLM);

                    // Add column for the result
                    lg.Columns.Add(receiveTimeString + " (" + MSHTimeString + ")");

                    lg.Columns[lg.Columns.Count - 1].Width = 135;

                    break;

                case "OBX":

                    ListViewItem parmValueItem;
                    // ListViewItem parmTimeItem;

                    string[] parameter_subfields = fields[3].Split(new string[] { "^" }, StringSplitOptions.None);
                    string   parameter_name      = parameter_subfields[0];

                    parameter_subfields = fields[6].Split(new string[] { "^" }, StringSplitOptions.None);
                    string parameter_uom = parameter_subfields[0];

                    string ParameterID = parameter_name + " in " + parameter_uom;

                    if (!PLM.parameters.ContainsKey(ParameterID))
                    {
                        PLM.parameters.Add(ParameterID, new Parameter(PLM.parameters.Count(), ParameterID, 1));
                        Console.WriteLine("New Parameter = " + ParameterID);

                        parmIndex = PLM.parameters.Count() - 1;
                        // itemIndex = parmIndex * 2;

                        parmValueItem = lg.Items.Insert(parmIndex, ParameterID);
                        // parmTimeItem = lg.Items.Insert(parmIndex + 1, new ListViewItem("Timestamps"));
                    }
                    else
                    {
                        Console.WriteLine("Existing Parameter = " + ParameterID);

                        parmIndex = PLM.parameters[ParameterID].index;
                        // itemIndex = parmIndex * 2;

                        parmValueItem = lg.Items[parmIndex];

                        // parmTimeItem = lg.Items[itemIndex + 1];
                    }


                    string parameter_value = fields[5];



                    try
                    {
                        ParmTimeString = fields[14];
                        ParmTime       = DateTime.ParseExact(ParmTimeString, "yyyyMMddHHmmss", CultureInfo.CurrentCulture);
                        ParmTimeString = ParmTime.ToString("h:m:s t");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error parsing parameter time: " + ex.Message);
                        ParmTimeString = "no_time";
                    }


                    parmValueItem.SubItems.Add(parameter_value + "\t(" + ParmTimeString + ")");

                    // parmTimeItem.SubItems.Add(parameter_time);

                    break;

                default:

                    break;
                }
            }
        }