Ignore:
Timestamp:
Apr 12, 2011, 2:13:18 AM (14 years ago)
Author:
Sam Habiel
Message:

DRadExamsSelect: New form to let user select exam.
RadiologyExam: Class for a Radiology Exam
DAL: new DB communication methods: GetRadiologyExamsForPatientinHL and ScheduleRadiologyExam
CGView:

  1. New context menus for Radiology; context menu popup has logic for which menus to display;
  2. Helper method IsThisARadiologyResource used by ctxCalendarGrid_Popup to decide which menus to display
  3. Handler ctxCalGridMkRadAppt_Click to make the Radiology Appointment.

CGDocument:

  1. CreateAppointment now saves RadiologyExamIEN to the DB
  2. RefreshAppointments now gets RadiologyExamIEN from the DB

CGAppointment:

  1. Class completely refactored to use auto props rather than old style properties
  2. Added property RadiologyExamIEN

CalendarGrid: Class was wrongly using supposed private members of CGAppointment. Refactored to fix that as private members don't exist anymore.

Last but not least, new exe,dll

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/branches/Radiology-Support/cs/bsdx0200GUISourceCode/CGView.cs

    r1131 r1140  
    11using System;
    22using System.Collections;
     3using System.Collections.Generic;
    34using System.ComponentModel;
    45using System.Windows.Forms;
     
    106107        private MenuItem menuItem12;
    107108        private MenuItem mnuRefresh;
     109        private MenuItem ctxCalGridMkRadAppt;
     110        private MenuItem ctxCalGridCancelRadAppt;
    108111        private IContainer components;
    109112
     
    246249            this.ctxCalendarGrid = new System.Windows.Forms.ContextMenu();
    247250            this.ctxCalGridAdd = new System.Windows.Forms.MenuItem();
     251            this.ctxCalGridMkRadAppt = new System.Windows.Forms.MenuItem();
    248252            this.ctxCalGridEdit = new System.Windows.Forms.MenuItem();
    249253            this.ctxCalGridDelete = new System.Windows.Forms.MenuItem();
     254            this.ctxCalGridCancelRadAppt = new System.Windows.Forms.MenuItem();
    250255            this.ctxCalGridCheckIn = new System.Windows.Forms.MenuItem();
    251256            this.ctxCalGridUndoCheckin = new System.Windows.Forms.MenuItem();
     
    647652            this.tvSchedules.Location = new System.Drawing.Point(0, 0);
    648653            this.tvSchedules.Name = "tvSchedules";
    649             this.tvSchedules.Size = new System.Drawing.Size(128, 359);
     654            this.tvSchedules.Size = new System.Drawing.Size(128, 254);
    650655            this.tvSchedules.Sorted = true;
    651656            this.tvSchedules.TabIndex = 1;
     
    716721            this.panelRight.Location = new System.Drawing.Point(996, 0);
    717722            this.panelRight.Name = "panelRight";
    718             this.panelRight.Size = new System.Drawing.Size(128, 359);
     723            this.panelRight.Size = new System.Drawing.Size(128, 254);
    719724            this.panelRight.TabIndex = 3;
    720725            this.panelRight.Visible = false;
     
    812817            this.panelCenter.Location = new System.Drawing.Point(136, 24);
    813818            this.panelCenter.Name = "panelCenter";
    814             this.panelCenter.Size = new System.Drawing.Size(857, 311);
     819            this.panelCenter.Size = new System.Drawing.Size(857, 206);
    815820            this.panelCenter.TabIndex = 7;
    816821            //
     
    819824            this.ctxCalendarGrid.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
    820825            this.ctxCalGridAdd,
     826            this.ctxCalGridMkRadAppt,
    821827            this.ctxCalGridEdit,
    822828            this.ctxCalGridDelete,
     829            this.ctxCalGridCancelRadAppt,
    823830            this.ctxCalGridCheckIn,
    824831            this.ctxCalGridUndoCheckin,
     
    838845            this.ctxCalGridAdd.Click += new System.EventHandler(this.ctxCalGridAdd_Click);
    839846            //
     847            // ctxCalGridMkRadAppt
     848            //
     849            this.ctxCalGridMkRadAppt.Index = 1;
     850            this.ctxCalGridMkRadAppt.Text = "Make Radiology Appointment";
     851            this.ctxCalGridMkRadAppt.Click += new System.EventHandler(this.ctxCalGridMkRadAppt_Click);
     852            //
    840853            // ctxCalGridEdit
    841854            //
    842             this.ctxCalGridEdit.Index = 1;
     855            this.ctxCalGridEdit.Index = 2;
    843856            this.ctxCalGridEdit.Text = "Edit Appointment";
    844857            this.ctxCalGridEdit.Click += new System.EventHandler(this.ctxCalGridEdit_Click);
     
    846859            // ctxCalGridDelete
    847860            //
    848             this.ctxCalGridDelete.Index = 2;
     861            this.ctxCalGridDelete.Index = 3;
    849862            this.ctxCalGridDelete.Text = "Cancel Appointment";
    850863            this.ctxCalGridDelete.Click += new System.EventHandler(this.ctxCalGridDelete_Click);
    851864            //
     865            // ctxCalGridCancelRadAppt
     866            //
     867            this.ctxCalGridCancelRadAppt.Index = 4;
     868            this.ctxCalGridCancelRadAppt.Text = "Cancel Radiology Appointment";
     869            //
    852870            // ctxCalGridCheckIn
    853871            //
    854             this.ctxCalGridCheckIn.Index = 3;
     872            this.ctxCalGridCheckIn.Index = 5;
    855873            this.ctxCalGridCheckIn.Text = "Check In Patient";
    856874            this.ctxCalGridCheckIn.Click += new System.EventHandler(this.ctxCalGridCheckIn_Click);
     
    858876            // ctxCalGridUndoCheckin
    859877            //
    860             this.ctxCalGridUndoCheckin.Index = 4;
     878            this.ctxCalGridUndoCheckin.Index = 6;
    861879            this.ctxCalGridUndoCheckin.Text = "&Undo Check In";
    862880            this.ctxCalGridUndoCheckin.Click += new System.EventHandler(this.ctxCalGridUndoCheckin_Click);
     
    864882            // menuItem2
    865883            //
    866             this.menuItem2.Index = 5;
     884            this.menuItem2.Index = 7;
    867885            this.menuItem2.Text = "-";
    868886            //
    869887            // ctxCalGridNoShow
    870888            //
    871             this.ctxCalGridNoShow.Index = 6;
     889            this.ctxCalGridNoShow.Index = 8;
    872890            this.ctxCalGridNoShow.Text = "Mark as No Show";
    873891            this.ctxCalGridNoShow.Click += new System.EventHandler(this.ctxCalGridNoShow_Click);
     
    875893            // ctxCalGridNoShowUndo
    876894            //
    877             this.ctxCalGridNoShowUndo.Index = 7;
     895            this.ctxCalGridNoShowUndo.Index = 9;
    878896            this.ctxCalGridNoShowUndo.Text = "Undo NoShow";
    879897            this.ctxCalGridNoShowUndo.Click += new System.EventHandler(this.ctxCalGridNoShowUndo_Click);
     
    881899            // menuItem9
    882900            //
    883             this.menuItem9.Index = 8;
     901            this.menuItem9.Index = 10;
    884902            this.menuItem9.Text = "-";
    885903            //
    886904            // ctxCalGridWalkin
    887905            //
    888             this.ctxCalGridWalkin.Index = 9;
     906            this.ctxCalGridWalkin.Index = 11;
    889907            this.ctxCalGridWalkin.Text = "Create Wal&k-In Appointment";
    890908            this.ctxCalGridWalkin.Click += new System.EventHandler(this.ctxCalGridWalkin_Click);
     
    892910            // menuItem10
    893911            //
    894             this.menuItem10.Index = 10;
     912            this.menuItem10.Index = 12;
    895913            this.menuItem10.Text = "-";
    896914            //
    897915            // ctxCalGridReprintApptSlip
    898916            //
    899             this.ctxCalGridReprintApptSlip.Index = 11;
     917            this.ctxCalGridReprintApptSlip.Index = 13;
    900918            this.ctxCalGridReprintApptSlip.Text = "&Reprint Appointment Slip";
    901919            this.ctxCalGridReprintApptSlip.Click += new System.EventHandler(this.ctxCalGridReprintApptSlip_Click);
     
    905923            this.panelBottom.Controls.Add(this.statusBar1);
    906924            this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
    907             this.panelBottom.Location = new System.Drawing.Point(136, 335);
     925            this.panelBottom.Location = new System.Drawing.Point(136, 230);
    908926            this.panelBottom.Name = "panelBottom";
    909927            this.panelBottom.Size = new System.Drawing.Size(857, 24);
     
    923941            this.splitter1.Location = new System.Drawing.Point(128, 24);
    924942            this.splitter1.Name = "splitter1";
    925             this.splitter1.Size = new System.Drawing.Size(8, 335);
     943            this.splitter1.Size = new System.Drawing.Size(8, 230);
    926944            this.splitter1.TabIndex = 9;
    927945            this.splitter1.TabStop = false;
     
    932950            this.splitter2.Location = new System.Drawing.Point(993, 24);
    933951            this.splitter2.Name = "splitter2";
    934             this.splitter2.Size = new System.Drawing.Size(3, 335);
     952            this.splitter2.Size = new System.Drawing.Size(3, 230);
    935953            this.splitter2.TabIndex = 10;
    936954            this.splitter2.TabStop = false;
     
    955973            this.calendarGrid1.Resources = ((System.Collections.ArrayList)(resources.GetObject("calendarGrid1.Resources")));
    956974            this.calendarGrid1.SelectedAppointment = 0;
    957             this.calendarGrid1.Size = new System.Drawing.Size(857, 311);
     975            this.calendarGrid1.Size = new System.Drawing.Size(857, 206);
    958976            this.calendarGrid1.StartDate = new System.DateTime(2003, 1, 27, 0, 0, 0, 0);
    959977            this.calendarGrid1.TabIndex = 0;
     
    968986            //
    969987            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
    970             this.ClientSize = new System.Drawing.Size(1124, 359);
     988            this.ClientSize = new System.Drawing.Size(1124, 254);
    971989            this.Controls.Add(this.panelCenter);
    972990            this.Controls.Add(this.panelBottom);
     
    12891307                private void ctxCalendarGrid_Popup(object sender, System.EventArgs e)
    12901308                {
     1309            bool bEditAppointments = (EditAppointmentEnabled() && (calendarGrid1.SelectedAppointment > 0)) ;
     1310
     1311            if (IsThisARadiologyResource())//this is a radiology resource
     1312            {
     1313                ctxCalGridAdd.Visible = false;
     1314                ctxCalGridDelete.Visible = false;
     1315                ctxCalGridEdit.Visible = false;
     1316                ctxCalGridCheckIn.Visible = false;
     1317                ctxCalGridNoShow.Visible = false;
     1318                ctxCalGridNoShowUndo.Visible = false;
     1319                ctxCalGridWalkin.Visible = false;
     1320                ctxCalGridUndoCheckin.Visible = false;
     1321
     1322                ctxCalGridMkRadAppt.Visible = true;
     1323                ctxCalGridCancelRadAppt.Visible = true;
     1324
     1325               
     1326            }
     1327
     1328            else // this is a normal resource
     1329            {
     1330                ctxCalGridAdd.Visible = true;
     1331                ctxCalGridDelete.Visible = true;
     1332                ctxCalGridEdit.Visible = true;
     1333                ctxCalGridCheckIn.Visible = true;
     1334                ctxCalGridNoShow.Visible = true;
     1335                ctxCalGridNoShowUndo.Visible = true;
     1336                ctxCalGridWalkin.Visible = true;
     1337                ctxCalGridUndoCheckin.Visible = true;
     1338
     1339                ctxCalGridMkRadAppt.Visible = false;
     1340                ctxCalGridCancelRadAppt.Visible = false;
     1341            }
     1342
    12911343                        //Toggle availability of make, edit, checkin and delete appointments
    12921344                        //based on whether appropriate element is selected.
    12931345                        ctxCalGridAdd.Enabled = AddAppointmentEnabled();
    1294                         bool bEditAppointments = (EditAppointmentEnabled() && (calendarGrid1.SelectedAppointment > 0)) ;
     1346                       
    12951347                        ctxCalGridDelete.Enabled = bEditAppointments;
    12961348                        ctxCalGridEdit.Enabled = bEditAppointments;
     
    12991351            ctxCalGridNoShowUndo.Enabled = !NoShowEnabled() && calendarGrid1.SelectedAppointment > 0;
    13001352                        ctxCalGridWalkin.Enabled = ctxCalGridAdd.Enabled;
    1301             //smh new code
    13021353            ctxCalGridReprintApptSlip.Enabled = bEditAppointments;
    13031354            ctxCalGridUndoCheckin.Enabled = UndoCheckinEnabled();
    1304             //end new code
     1355
     1356            //if the rad ones are visible, then these apply
     1357            ctxCalGridMkRadAppt.Enabled = !bEditAppointments;
     1358            ctxCalGridCancelRadAppt.Enabled = bEditAppointments;
    13051359        }
    13061360
     
    13571411                #region Methods
    13581412
     1413        private bool IsThisARadiologyResource()
     1414        {
     1415            // I don't like this logic!!!
     1416            if (this.calendarGrid1.SelectedRange.Cells.CellCount < 1 && this.calendarGrid1.SelectedAppointment < 1)
     1417                return false;
     1418            if (this.calendarGrid1.SelectedAppointment > 0)
     1419                if ((this.Appointments.AppointmentTable[this.calendarGrid1.SelectedAppointment] as CGAppointment).RadiologyExamIEN > 0)
     1420                    return true;
     1421
     1422            DateTime dStart;
     1423            DateTime dEnd;
     1424            string sResource;
     1425            bool bRet = this.calendarGrid1.GetSelectedTime(out dStart, out dEnd, out sResource);
     1426            if (bRet == false)
     1427            {
     1428                return false;
     1429            }
     1430
     1431            return (from hl in CGDocumentManager.Current.GlobalDataSet.Tables["HospitalLocation"].AsEnumerable()
     1432                       where hl.Field<string>("IS_RADIOLOGY_LOCATION")=="1"
     1433                       join res in CGDocumentManager.Current.GlobalDataSet.Tables["Resources"].AsEnumerable()
     1434                       on hl.Field<int>("HOSPITAL_LOCATION_ID") equals res.Field<int>("HOSPITAL_LOCATION_ID")
     1435                       where res.Field<string>("RESOURCE_NAME") == sResource
     1436                       select hl).Any();
     1437        }
     1438       
    13591439        private bool EditAppointmentEnabled()
    13601440        {
     
    35443624        }
    35453625
     3626        private void ctxCalGridMkRadAppt_Click(object sender, EventArgs e)
     3627        {
     3628            DateTime dStart, dEnd;
     3629            string sResource;
     3630            int nAccessTypeID = 0;
     3631
     3632            this.calendarGrid1.GetSelectedTime(out dStart, out dEnd, out sResource);
     3633            this.calendarGrid1.GetSelectedType(out nAccessTypeID);
     3634            //Display a dialog to collect Patient Name
     3635            DPatientLookup dPat = new DPatientLookup();
     3636            dPat.DocManager = m_DocManager;
     3637
     3638            if (dPat.ShowDialog(this) == DialogResult.Cancel)
     3639            {
     3640                return;
     3641            }
     3642
     3643            int DFN = Int32.Parse(dPat.PatientIEN);
     3644            int hlIEN = (from resource in CGDocumentManager.Current.GlobalDataSet.Tables["Resources"].AsEnumerable()
     3645                        where resource.Field<string>("RESOURCE_NAME") == sResource
     3646                        select resource.Field<int>("HOSPITAL_LOCATION_ID")).FirstOrDefault();
     3647
     3648            List<RadiologyExam> _radExams = CGDocumentManager.Current.DAL.GetRadiologyExamsForPatientinHL(DFN, hlIEN);
     3649
     3650            if (!_radExams.Any())
     3651            {
     3652                MessageBox.Show("Patient does not have any radiology exams to register.");
     3653                return;
     3654            }
     3655
     3656            DRadExamsSelect _radform = new DRadExamsSelect(_radExams);
     3657
     3658            if (_radform.ShowDialog() == DialogResult.Cancel) return;
     3659
     3660            int _examien = _radform.ExamIEN;
     3661            string _procedurename = _radform.ProcedureName;
     3662
     3663            CGDocumentManager.Current.DAL.ScheduleRadiologyExam(DFN, _examien);
     3664
     3665            //Now create and save the appointment
     3666            CGAppointment appt = new CGAppointment();
     3667            string _sNote = "Radiology Exam (" + _examien + "): " + _procedurename;
     3668            appt.CreateAppointment(dStart, dEnd, _sNote, 0, sResource);
     3669            appt.PatientID = Int32.Parse(dPat.PatientIEN);
     3670            appt.PatientName = dPat.PatientName;
     3671            appt.AccessTypeID = nAccessTypeID;
     3672            appt.RadiologyExamIEN = _examien;
     3673            this.Document.CreateAppointment(appt);
     3674
     3675            //Now redraw the grid to display the new appointments
     3676            this.UpdateArrays();
     3677        }
     3678
    35463679
    35473680
Note: See TracChangeset for help on using the changeset viewer.