private void FillGridResultHist()
        {
            MedLab medLabCur = MedLabs.GetOne(ResultCur.MedLabNum);

            if (medLabCur == null)           //should never happen, but we must have a MedLab object to fill the grid
            {
                return;
            }
            gridResultHist.BeginUpdate();
            gridResultHist.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn("Result Description / Value", 425);
            gridResultHist.Columns.Add(col);
            col = new ODGridColumn("Flag", 110);
            gridResultHist.Columns.Add(col);
            col = new ODGridColumn("Units", 65);
            gridResultHist.Columns.Add(col);
            col = new ODGridColumn("Date/Time Reported", 130);         //OBR-22, Date/Time Observations Reported
            col.SortingStrategy = GridSortingStrategy.DateParse;
            gridResultHist.Columns.Add(col);
            col = new ODGridColumn("Date/Time Observed", 130);         //OBX-11, Date/Time of Observation
            col.SortingStrategy = GridSortingStrategy.DateParse;
            gridResultHist.Columns.Add(col);
            col = new ODGridColumn("Status", 70);
            gridResultHist.Columns.Add(col);
            gridResultHist.Rows.Clear();
            ODGridRow row;
            long      patNum = 0;

            if (PatCur != null)
            {
                patNum = PatCur.PatNum;
            }
            List <MedLabResult> listResults = MedLabResults.GetResultHist(ResultCur, patNum, medLabCur.SpecimenID, medLabCur.SpecimenIDFiller);

            for (int i = 0; i < listResults.Count; i++)
            {
                row = new ODGridRow();
                string obsVal = listResults[i].ObsText;
                if (listResults[i].ObsValue != "Test Not Performed")
                {
                    obsVal += "\r\n    " + listResults[i].ObsValue.Replace("\r\n", "\r\n    ");
                }
                if (listResults[i].Note != "")
                {
                    obsVal += "\r\n    " + listResults[i].Note.Replace("\r\n", "\r\n    ");
                }
                row.Cells.Add(obsVal);
                row.Cells.Add(MedLabResults.GetAbnormalFlagDescript(listResults[i].AbnormalFlag));
                row.Cells.Add(listResults[i].ObsUnits);
                medLabCur = MedLabs.GetOne(listResults[i].MedLabNum);
                string dateReported = "";
                if (medLabCur != null)
                {
                    dateReported = medLabCur.DateTimeReported.ToString("MM/dd/yyyy hh:mm tt");                  //DT format matches LabCorp examples (US only company)
                }
                row.Cells.Add(dateReported);
                row.Cells.Add(listResults[i].DateTimeObs.ToString("MM/dd/yyyy hh:mm tt"));                //DT format matches LabCorp examples (US only company)
                row.Cells.Add(MedLabs.GetStatusDescript(listResults[i].ResultStatus));
                gridResultHist.Rows.Add(row);
            }
            gridResultHist.EndUpdate();
        }
Example #2
0
        ///<summary>Formatting for fields in this grid designed to emulate as accurately as possible the sample provided by LabCorp.</summary>
        private void FillGridResults()
        {
            gridResults.BeginUpdate();
            gridResults.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn("Test / Result", 500);
            gridResults.Columns.Add(col);
            col = new ODGridColumn("Flag", 115);
            gridResults.Columns.Add(col);
            col = new ODGridColumn("Units", 110);
            gridResults.Columns.Add(col);
            col = new ODGridColumn("Reference Interval", 145);
            gridResults.Columns.Add(col);
            col = new ODGridColumn("Lab", 60);
            gridResults.Columns.Add(col);
            gridResults.Rows.Clear();
            ODGridRow row;
            string    obsDescriptPrev = "";

            for (int i = 0; i < _listResults.Count; i++)
            {
                //LabCorp requested that these non-performance results not be displayed on the report
                if ((_listResults[i].ResultStatus == ResultStatus.F || _listResults[i].ResultStatus == ResultStatus.X) &&
                    _listResults[i].ObsValue == "" &&
                    _listResults[i].Note == "")
                {
                    continue;
                }
                string obsDescript = "";
                MedLab medLabCur   = MedLabs.GetOne(_listResults[i].MedLabNum);
                //Only dipslay full medLabCur.ObsTestDescript if different than previous Descript.
                if (i == 0 || _listResults[i].MedLabNum != _listResults[i - 1].MedLabNum)
                {
                    if (medLabCur.ActionCode != ResultAction.G)
                    {
                        if (obsDescriptPrev == medLabCur.ObsTestDescript)
                        {
                            obsDescript = ".";
                        }
                        else
                        {
                            obsDescript     = medLabCur.ObsTestDescript;
                            obsDescriptPrev = obsDescript;
                        }
                    }
                }
                //Set tabs using spaces and spaces2, can be changed further down in the code
                string spaces  = "    ";
                string spaces2 = "        ";
                string obsVal  = "";
                int    padR    = 78;
                string newLine = "";
                if (obsDescript != "")
                {
                    if (obsDescript == _listResults[i].ObsText)
                    {
                        spaces  = "";
                        spaces2 = "    ";
                        padR    = 80;
                    }
                    else
                    {
                        obsVal  += obsDescript + "\r\n";
                        newLine += "\r\n";
                    }
                }
                if (_listResults[i].ObsValue == "Test Not Performed")
                {
                    obsVal += spaces + _listResults[i].ObsText;
                }
                else if (_listResults[i].ObsText == "." ||
                         _listResults[i].ObsValue.Contains(":") ||
                         _listResults[i].ObsValue.Length > 20 ||
                         medLabCur.ActionCode == ResultAction.G)
                {
                    obsVal  += spaces + _listResults[i].ObsText + "\r\n" + spaces2 + _listResults[i].ObsValue.Replace("\r\n", "\r\n" + spaces2);
                    newLine += "\r\n";
                }
                else
                {
                    obsVal += spaces + _listResults[i].ObsText.PadRight(padR, ' ') + _listResults[i].ObsValue;
                }
                if (_listResults[i].Note != "")
                {
                    obsVal += "\r\n" + spaces2 + _listResults[i].Note.Replace("\r\n", "\r\n" + spaces2);
                }
                row = new ODGridRow();
                row.Cells.Add(obsVal);
                row.Cells.Add(newLine + MedLabResults.GetAbnormalFlagDescript(_listResults[i].AbnormalFlag));
                row.Cells.Add(newLine + _listResults[i].ObsUnits);
                row.Cells.Add(newLine + _listResults[i].ReferenceRange);
                row.Cells.Add(newLine + _listResults[i].FacilityID);
                row.Tag = _listResults[i];
                gridResults.Rows.Add(row);
            }
            gridResults.EndUpdate();
        }