Пример #1
0
        private void FillGrid()
        {
            if (IsDisposed)             //This can happen if an auto logoff happens with FormMedLabEdit open
            {
                return;
            }
            if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                textDateEnd.errorProvider1.GetError(textDateEnd) != "")
            {
                return;
            }
            textPatient.Text = "";
            if (_selectedPat != null)
            {
                textPatient.Text       = _selectedPat.GetNameLF();
                checkOnlyNoPat.Checked = false;
            }
            Application.DoEvents();
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            gridMain.Columns.Add(new ODGridColumn("Date & Time Reported", 135, GridSortingStrategy.DateParse));          //most recent date and time a result came in
            gridMain.Columns.Add(new ODGridColumn("Date & Time Entered", 135, GridSortingStrategy.DateParse));
            gridMain.Columns.Add(new ODGridColumn("Status", 75));
            gridMain.Columns.Add(new ODGridColumn("Patient", 180));
            gridMain.Columns.Add(new ODGridColumn("Provider", 70));
            gridMain.Columns.Add(new ODGridColumn("Specimen ID", 100));           //should be the ID sent on the specimen container to lab
            gridMain.Columns.Add(new ODGridColumn("Test(s) Description", 235));   //description of the test ordered
            if (PrefC.HasClinicsEnabled)
            {
                gridMain.Columns.Add(new ODGridColumn("Clinic", 150));
            }
            gridMain.Rows.Clear();
            ODGridRow row;
            DateTime  dateEnd = PIn.Date(textDateEnd.Text);

            if (dateEnd == DateTime.MinValue)
            {
                dateEnd = DateTime.MaxValue;
            }
            Cursor = Cursors.WaitCursor;
            Clinic clinCur = new Clinic();

            if (PrefC.HasClinicsEnabled)
            {
                clinCur = _listUserClinics[comboClinic.SelectedIndex];
            }
            List <Clinic> listClinicsSelected = new List <Clinic>();

            if (clinCur.ClinicNum == -1)                                               //"All" clinic
            {
                listClinicsSelected = _listUserClinics.FindAll(x => x.ClinicNum > -1); //will include ClinicNum 0 ("Unassigned" clinic) if user is unrestricted
            }
            else                                                                       //a single clinic was selected, either the "Unassigned" clinic or a regular clinic
            {
                listClinicsSelected.Add(clinCur);
            }
            List <MedLab> listMedLabs = MedLabs.GetOrdersForPatient(_selectedPat, checkIncludeNoPat.Checked, checkOnlyNoPat.Checked, PIn.Date(textDateStart.Text),
                                                                    dateEnd, listClinicsSelected);
            Dictionary <long, Patient> dictPats = Patients.GetLimForPats(listMedLabs.Select(x => x.PatNum).Where(x => x > 0).Distinct().ToList())
                                                  .ToDictionary(x => x.PatNum);

            foreach (MedLab medLabCur in listMedLabs)
            {
                row = new ODGridRow();
                row.Cells.Add(medLabCur.DateTimeReported.ToString("MM/dd/yyyy hh:mm tt"));
                row.Cells.Add(medLabCur.DateTimeEntered.ToString("MM/dd/yyyy hh:mm tt"));
                if (medLabCur.IsPreliminaryResult)                 //check whether the test or any of the most recent results for the test is marked as preliminary
                {
                    row.Cells.Add(MedLabs.GetStatusDescript(ResultStatus.P));
                }
                else
                {
                    row.Cells.Add(MedLabs.GetStatusDescript(medLabCur.ResultStatus));
                }
                string nameFL = "";
                if (dictPats.ContainsKey(medLabCur.PatNum))
                {
                    nameFL = dictPats[medLabCur.PatNum].GetNameFLnoPref();
                }
                row.Cells.Add(nameFL);
                row.Cells.Add(Providers.GetAbbr(medLabCur.ProvNum));                //will be blank if ProvNum=0
                row.Cells.Add(medLabCur.SpecimenID);
                row.Cells.Add(medLabCur.ObsTestDescript);
                if (PrefC.HasClinicsEnabled)
                {
                    string clinicDesc = "";
                    if (_dictLabAcctClinic.ContainsKey(medLabCur.PatAccountNum))
                    {
                        clinicDesc = _dictLabAcctClinic[medLabCur.PatAccountNum];
                    }
                    row.Cells.Add(clinicDesc);
                }
                row.Tag = medLabCur.PatNum.ToString() + "," + medLabCur.SpecimenID + "," + medLabCur.SpecimenIDFiller;
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            Cursor = Cursors.Default;
        }
Пример #2
0
        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();
        }