Example #1
0
        private void butShowXhtml_Click(object sender, EventArgs e)
        {
            string ccd = "";

            try {
                FormEhrExportCCD FormEEC = new FormEhrExportCCD(PatCur);
                FormEEC.ShowDialog();
                if (FormEEC.DialogResult == DialogResult.OK)
                {
                    ccd = FormEEC.CCD;
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            bool didPrint = FormEhrSummaryOfCare.DisplayCCD(ccd);

            if (didPrint)
            {
                //we are printing a ccd so add new measure event.
                EhrMeasureEvent measureEvent = new EhrMeasureEvent();
                measureEvent.DateTEvent = DateTime.Now;
                measureEvent.EventType  = EhrMeasureEventType.ClinicalSummaryProvidedToPt;
                measureEvent.PatNum     = PatCur.PatNum;
                EhrMeasureEvents.Insert(measureEvent);
                FillGridEHRMeasureEvents();
            }
        }
Example #2
0
 private void butOK_Click(object sender, EventArgs e)
 {
     //inserts never happen here.  Only updates.
     MeasCur.MoreInfo = textMoreInfo.Text;
     EhrMeasureEvents.Update(MeasCur);
     DialogResult = DialogResult.OK;
 }
        private void FillGrid()
        {
            if (comboType.SelectedIndex == 0)
            {
                _listEhrMeasureEvents = EhrMeasureEvents.GetAllByTypeFromDB(PIn.DateT(textDateStart.Text), PIn.DateT(textDateEnd.Text), (EhrMeasureEventType)comboType.SelectedIndex, true);
            }
            else
            {
                _listEhrMeasureEvents = EhrMeasureEvents.GetAllByTypeFromDB(PIn.DateT(textDateStart.Text), PIn.DateT(textDateEnd.Text), (EhrMeasureEventType)comboType.SelectedIndex - 1, false);
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableProviders", "Event Type"), 140);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProviders", "Date"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProviders", "PatNum"), 60);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProviders", "More Info"), 160);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < _listEhrMeasureEvents.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_typeNames[(int)_listEhrMeasureEvents[i].EventType]);
                row.Cells.Add(_listEhrMeasureEvents[i].DateTEvent.ToShortDateString());
                row.Cells.Add(_listEhrMeasureEvents[i].PatNum.ToString());
                row.Cells.Add(_listEhrMeasureEvents[i].MoreInfo);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn("DateTime", 140);

            gridMain.Columns.Add(col);
            col = new ODGridColumn("Type", 600);
            gridMain.Columns.Add(col);
            listHistory = EhrMeasureEvents.RefreshByType(PatCur.PatNum, EhrMeasureEventType.ElectronicCopyRequested, EhrMeasureEventType.ElectronicCopyProvidedToPt);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < listHistory.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listHistory[i].DateTEvent.ToString());
                switch (listHistory[i].EventType)
                {
                case EhrMeasureEventType.ElectronicCopyRequested:
                    row.Cells.Add("Requested by patient");
                    break;

                case EhrMeasureEventType.ElectronicCopyProvidedToPt:
                    row.Cells.Add("Provided to patient");
                    break;
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
        private void FillGridAssessments()
        {
            gridAssessments.BeginUpdate();
            gridAssessments.Columns.Clear();
            gridAssessments.Columns.Add(new ODGridColumn("Date", 70));
            gridAssessments.Columns.Add(new ODGridColumn("Type", 170));
            gridAssessments.Columns.Add(new ODGridColumn("Description", 170));
            gridAssessments.Columns.Add(new ODGridColumn("Documentation", 170));
            gridAssessments.Rows.Clear();
            ODGridRow row;
            List <EhrMeasureEvent> listEvents = EhrMeasureEvents.RefreshByType(PatCur.PatNum, EhrMeasureEventType.TobaccoUseAssessed);

            foreach (EhrMeasureEvent eventCur in listEvents)
            {
                row = new ODGridRow();
                row.Cells.Add(eventCur.DateTEvent.ToShortDateString());
                Loinc lCur = Loincs.GetByCode(eventCur.CodeValueEvent);              //TobaccoUseAssessed events can be one of three types, all LOINC codes
                row.Cells.Add(lCur != null?lCur.NameLongCommon:eventCur.EventType.ToString());
                Snomed sCur = Snomeds.GetByCode(eventCur.CodeValueResult);
                row.Cells.Add(sCur != null?sCur.Description:"");
                row.Cells.Add(eventCur.MoreInfo);
                row.Tag = eventCur;
                gridAssessments.Rows.Add(row);
            }
            gridAssessments.EndUpdate();
        }
        private void comboSmokeStatus_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (comboSmokeStatus.SelectedIndex < 1)           //If None or text set to other selected Snomed code so -1, do not create an event
            {
                return;
            }
            //Insert measure event if one does not already exist for this date
            DateTime        dateTEntered = PIn.DateT(textDateAssessed.Text);   //will be set to DateTime.Now when form loads
            EhrMeasureEvent eventCur;

            foreach (ODGridRow row in gridAssessments.Rows)
            {
                eventCur = (EhrMeasureEvent)row.Tag;
                if (eventCur.DateTEvent.Date == dateTEntered.Date)               //one already exists for this date, don't auto insert event
                {
                    return;
                }
            }
            //no entry for the date entered, so insert one
            eventCur                 = new EhrMeasureEvent();
            eventCur.DateTEvent      = dateTEntered;
            eventCur.EventType       = EhrMeasureEventType.TobaccoUseAssessed;
            eventCur.PatNum          = PatCur.PatNum;
            eventCur.CodeValueEvent  = _listAssessmentCodes[comboAssessmentType.SelectedIndex].CodeValue;
            eventCur.CodeSystemEvent = _listAssessmentCodes[comboAssessmentType.SelectedIndex].CodeSystem;
            //SelectedIndex guaranteed to be greater than 0
            eventCur.CodeValueResult  = ((SmokingSnoMed)comboSmokeStatus.SelectedIndex - 1).ToString().Substring(1);
            eventCur.CodeSystemResult = "SNOMEDCT";          //only allow SNOMEDCT codes for now.
            eventCur.MoreInfo         = "";
            EhrMeasureEvents.Insert(eventCur);
            FillGridAssessments();
        }
        private void butAssessed_Click(object sender, EventArgs e)
        {
            if (comboSmokeStatus.SelectedIndex == 0)           //None
            {
                MessageBox.Show("You must select a smoking status.");
                return;
            }
            DateTime dateTEntered = PIn.DateT(textDateAssessed.Text);

            for (int i = 0; i < _ListEvents.Count; i++)
            {
                if (_ListEvents[i].DateTEvent.Date == dateTEntered.Date)
                {
                    MessageBox.Show("A Tobacco Assessment entry already exists with the selected date.");
                    return;
                }
            }
            EhrMeasureEvent meas = new EhrMeasureEvent();

            meas.DateTEvent       = dateTEntered;
            meas.EventType        = EhrMeasureEventType.TobaccoUseAssessed;
            meas.PatNum           = PatCur.PatNum;
            meas.CodeValueEvent   = _ListAssessmentCodes[comboAssessmentType.SelectedIndex].CodeValue;
            meas.CodeSystemEvent  = _ListAssessmentCodes[comboAssessmentType.SelectedIndex].CodeSystem;
            meas.CodeValueResult  = _TobaccoCodeSelected;
            meas.CodeSystemResult = "SNOMEDCT";          //only allow SNOMEDCT codes for now.
            meas.MoreInfo         = "";
            EhrMeasureEvents.Insert(meas);
            FillGrid();
        }
        private void comboSmokeStatus_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (comboSmokeStatus.SelectedIndex <= 0)           //If None or text set to other selected Snomed code so -1, do not create an event
            {
                return;
            }
            //SelectedIndex guaranteed to be greater than 0
            _TobaccoCodeSelected = ((SmokingSnoMed)comboSmokeStatus.SelectedIndex - 1).ToString().Substring(1);
            DateTime dateTEntered = PIn.DateT(textDateAssessed.Text);          //will be set to DateTime.Now when form loads

            //Automatically make an entry
            for (int i = 0; i < _ListEvents.Count; i++)
            {
                if (_ListEvents[i].DateTEvent.Date == dateTEntered.Date)
                {
                    return;                    //if assessment already exists for date set, do not auto insert
                }
            }
            //an entry for the date entered does not yet exist
            EhrMeasureEvent meas = new EhrMeasureEvent();

            meas.DateTEvent       = dateTEntered;
            meas.EventType        = EhrMeasureEventType.TobaccoUseAssessed;
            meas.PatNum           = PatCur.PatNum;
            meas.CodeValueEvent   = _ListAssessmentCodes[comboAssessmentType.SelectedIndex].CodeValue;
            meas.CodeSystemEvent  = _ListAssessmentCodes[comboAssessmentType.SelectedIndex].CodeSystem;
            meas.CodeValueResult  = _TobaccoCodeSelected;
            meas.CodeSystemResult = "SNOMEDCT";          //only allow SNOMEDCT codes for now.
            meas.MoreInfo         = "";
            EhrMeasureEvents.Insert(meas);
            FillGrid();
        }
        private void gridEdu_CellClick(object sender, ODGridClickEventArgs e)
        {
            if (e.Col != 1)
            {
                return;
            }
            bool didPrint = false;

            try {
                FormEhrEduBrowser FormEDUB = new FormEhrEduBrowser(eduResourceList[e.Row].ResourceUrl);
                FormEDUB.ShowDialog();
                didPrint = FormEDUB.DidPrint;
                //System.Diagnostics.Process.Start(eduResourceList[e.Row].ResourceUrl);
            }
            catch {
                MessageBox.Show("Link not found.");
                return;
            }
            if (didPrint)
            {
                EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();
                newMeasureEvent.DateTEvent = DateTime.Now;
                newMeasureEvent.EventType  = EhrMeasureEventType.EducationProvided;
                newMeasureEvent.PatNum     = patCur.PatNum;
                newMeasureEvent.MoreInfo   = eduResourceList[e.Row].ResourceUrl;
                EhrMeasureEvents.Insert(newMeasureEvent);
                FillGridProvided();
            }
        }
Example #10
0
        private void FormEhrTriggers_FormClosing(object sender, FormClosingEventArgs e)
        {
            EhrMeasureEvent measureEvent = new EhrMeasureEvent();

            measureEvent.DateTEvent = DateTime.Now;
            measureEvent.EventType  = EhrMeasureEventType.ClinicalInterventionRules;
            measureEvent.MoreInfo   = Lan.g(this, "Triggers currently enabled") + ": " + ListEhrTriggers.Count;
            EhrMeasureEvents.Insert(measureEvent);
        }
Example #11
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete?"))
     {
         return;
     }
     EhrMeasureEvents.Delete(MeasCur.EhrMeasureEventNum);
     DialogResult = DialogResult.Cancel;
 }
Example #12
0
 private void butGiveAccess_Click(object sender, EventArgs e)
 {
     if (butGiveAccess.Text == "Provide Online Access")           //When form open opens with a blank password
     {
         if (PrefC.GetString(PrefName.PatientPortalURL) == "")
         {
             //User probably hasn't set up the patient portal yet.
             MsgBox.Show(this, "Patient Facing URL is required to be set before granting online access.  Click Setup to set the Patient Facing URL.");
             return;
         }
         string error;
         if (!UserWebs.ValidatePatientAccess(_patCur, out error))
         {
             MessageBox.Show(error);
             return;
         }
         Cursor = Cursors.WaitCursor;
         //1. Fill password.
         string passwordGenerated = UserWebs.GenerateRandomPassword(8);
         textOnlinePassword.Text = passwordGenerated;
         //2. Make the username and password editable in case they want to change it.
         textOnlineUsername.ReadOnly = false;
         textOnlinePassword.ReadOnly = false;
         //3. Save password to db.
         // We only save the hash of the generated password.
         string passwordHashed = Userods.HashPassword(passwordGenerated, false);
         _userWebCur.Password = passwordHashed;
         UserWebs.Update(_userWebCur, _userWebOld);
         _userWebOld.Password = passwordHashed;              //Update _userWebOld in case the user changes password manually.
         //4. Insert EhrMeasureEvent
         EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();
         newMeasureEvent.DateTEvent = DateTime.Now;
         newMeasureEvent.EventType  = EhrMeasureEventType.OnlineAccessProvided;
         newMeasureEvent.PatNum     = _userWebCur.FKey;
         newMeasureEvent.MoreInfo   = "";
         EhrMeasureEvents.Insert(newMeasureEvent);
         //5. Rename button
         butGiveAccess.Text = "Remove Online Access";
         Cursor             = Cursors.Default;
     }
     else              //remove access
     {
         Cursor = Cursors.WaitCursor;
         //1. Clear password
         textOnlinePassword.Text = "";
         //2. Make in uneditable
         textOnlinePassword.ReadOnly = true;
         //3. Save password to db
         _userWebCur.Password = textOnlinePassword.Text;
         UserWebs.Update(_userWebCur, _userWebOld);
         _userWebOld.Password = textOnlinePassword.Text;              //Update PatOld in case the user changes password manually.
         //4. Rename button
         butGiveAccess.Text = "Provide Online Access";
         Cursor             = Cursors.Default;
     }
 }
        private void butRequest_Click(object sender, EventArgs e)
        {
            EhrMeasureEvent measureEvent = new EhrMeasureEvent();

            measureEvent.DateTEvent = DateTime.Now.AddMinutes(-1);
            measureEvent.EventType  = EhrMeasureEventType.ElectronicCopyRequested;
            measureEvent.PatNum     = PatCur.PatNum;
            measureEvent.MoreInfo   = "";
            EhrMeasureEvents.Insert(measureEvent);
            FillGrid();
        }
Example #14
0
        private void butAddEvent_Click(object sender, EventArgs e)
        {
            EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();

            newMeasureEvent.DateTEvent = DateTime.Now;
            newMeasureEvent.EventType  = EhrMeasureEventType.MedicationReconcile;
            newMeasureEvent.PatNum     = PatCur.PatNum;
            newMeasureEvent.MoreInfo   = "";
            EhrMeasureEvents.Insert(newMeasureEvent);
            FillReconcilesGrid();
        }
        private void butOK_Click(object sender, EventArgs e)
        {
            //inserts never happen here.  Only updates.
            DateTime dateTEvent = PIn.DateT(textDateTime.Text);

            if (dateTEvent == DateTime.MinValue)
            {
                MsgBox.Show(this, "Please enter a valid date time.");               //because this must always be valid
                return;
            }
            if (textTobaccoStartDate.Visible &&         //only visible for tobacco use assessments
                textTobaccoStartDate.errorProvider1.GetError(textTobaccoStartDate) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            if (textTobaccoDesireToQuit.Visible &&         //only visible for tobacco use assessments
                textTobaccoDesireToQuit.errorProvider1.GetError(textTobaccoDesireToQuit) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            List <string> listLogEdits = new List <string>();

            if (_measureEventCur.MoreInfo != textMoreInfo.Text)
            {
                listLogEdits.Add(Lan.g(this, "More Info was changed."));
                _measureEventCur.MoreInfo = textMoreInfo.Text;
            }
            if (_measureEventCur.DateTEvent != dateTEvent)
            {
                listLogEdits.Add(Lan.g(this, "Date was changed from") + ": " + _measureEventCur.DateTEvent.ToString() + " " + Lan.g(this, "to") + ": " + dateTEvent.ToString() + ".");
                _measureEventCur.DateTEvent = dateTEvent;
            }
            if (textTobaccoStartDate.Visible && textTobaccoDesireToQuit.Visible)
            {
                _measureEventCur.DateStartTobacco       = PIn.Date(textTobaccoStartDate.Text);
                _measureEventCur.TobaccoCessationDesire = PIn.Byte(textTobaccoDesireToQuit.Text);
            }
            if (listLogEdits.Count > 0)
            {
                listLogEdits.Insert(0, Lan.g(this, "EHR Measure Event was edited."));
                SecurityLogs.MakeLogEntry(Permissions.EhrMeasureEventEdit, _measureEventCur.PatNum, string.Join("  ", listLogEdits));
            }
            if (_measureEventCur.IsNew)             //should never happen, only updates happen here
            {
                EhrMeasureEvents.Insert(_measureEventCur);
            }
            else
            {
                EhrMeasureEvents.Update(_measureEventCur);
            }
            DialogResult = DialogResult.OK;
        }
Example #16
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (gridReconcileEvents.SelectedIndices.Length < 1)
     {
         MessageBox.Show("Please select at least one record to delete.");
         return;
     }
     for (int i = 0; i < gridReconcileEvents.SelectedIndices.Length; i++)
     {
         EhrMeasureEvents.Delete(ehrMeasureEventsList[gridReconcileEvents.SelectedIndices[i]].EhrMeasureEventNum);
     }
     FillReconcilesGrid();
 }
        private void FormPatListResults_Load(object sender, EventArgs e)
        {
            if (PrefC.GetString(PrefName.SoftwareName) != "")
            {
                this.Text += " - " + PrefC.GetString(PrefName.SoftwareName);
            }
            EhrMeasureEvent measureEvent = new EhrMeasureEvent();

            measureEvent.DateTEvent = DateTime.Now;
            measureEvent.EventType  = EhrMeasureEventType.PatientList;
            EhrMeasureEvents.Insert(measureEvent);
            FillGrid();
        }
Example #18
0
 private void butGiveAccess_Click(object sender, EventArgs e)
 {
     if (butGiveAccess.Text == "Provide Online Access")           //When form open opens with a blank password
     {
         string error = ValidatePatientAccess();
         if (error != "")
         {
             MessageBox.Show(error);
             return;
         }
         Cursor = Cursors.WaitCursor;
         //1. Fill password.
         string passwordGenerated = GenerateRandomPassword(8);
         textOnlinePassword.Text = passwordGenerated;
         //2. Make the password editable in case they want to change it.
         textOnlinePassword.ReadOnly = false;
         //3. Save password to db.
         // We only save the hash of the generated password.
         string passwordHashed = Userods.EncryptPassword(passwordGenerated, false);
         PatCur.OnlinePassword = passwordHashed;
         Patients.Update(PatCur, PatOld);
         PatOld.OnlinePassword = passwordHashed;              //Update PatOld in case the user changes password manually.
         //4. Insert EhrMeasureEvent
         EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();
         newMeasureEvent.DateTEvent = DateTime.Now;
         newMeasureEvent.EventType  = EhrMeasureEventType.OnlineAccessProvided;
         newMeasureEvent.PatNum     = PatCur.PatNum;
         newMeasureEvent.MoreInfo   = "";
         EhrMeasureEvents.Insert(newMeasureEvent);
         //5. Rename button
         butGiveAccess.Text = "Remove Online Access";
         Cursor             = Cursors.Default;
     }
     else              //remove access
     {
         Cursor = Cursors.WaitCursor;
         //1. Clear password
         textOnlinePassword.Text = "";
         //2. Make in uneditable
         textOnlinePassword.ReadOnly = true;
         //3. Save password to db
         PatCur.OnlinePassword = textOnlinePassword.Text;
         Patients.Update(PatCur, PatOld);
         PatOld.OnlinePassword = textOnlinePassword.Text;              //Update PatOld in case the user changes password manually.
         //4. Rename button
         butGiveAccess.Text = "Provide Online Access";
         Cursor             = Cursors.Default;
     }
 }
        private void butDelete_Click(object sender, EventArgs e)
        {
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete?"))
            {
                return;
            }
            string logEntry = Lan.g(this, "Ehr Measure Event was deleted.") + "  "
                              + Lan.g(this, "Date") + ": " + PIn.DateT(textDateTime.Text) + "  "
                              + Lan.g(this, "Type") + ": " + _measureEventCur.EventType.ToString() + "  "
                              + Lan.g(this, "Patient") + ": " + textPatient.Text;

            SecurityLogs.MakeLogEntry(Permissions.EhrMeasureEventEdit, _measureEventCur.PatNum, logEntry);
            EhrMeasureEvents.Delete(_measureEventCur.EhrMeasureEventNum);
            DialogResult = DialogResult.Cancel;
        }
Example #20
0
        private void butExport_Click(object sender, EventArgs e)
        {
            string ccd = "";

            try {
                FormEhrExportCCD FormEEC = new FormEhrExportCCD(PatCur);
                FormEEC.ShowDialog();
                if (FormEEC.DialogResult == DialogResult.OK)
                {
                    ccd = FormEEC.CCD;
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            FolderBrowserDialog dlg = new FolderBrowserDialog();

            dlg.SelectedPath = ImageStore.GetPatientFolder(PatCur, ImageStore.GetPreferredAtoZpath());         //Default to patient image folder.
            DialogResult result = dlg.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }
            if (File.Exists(Path.Combine(dlg.SelectedPath, "ccd.xml")))
            {
                if (MessageBox.Show("Overwrite existing ccd.xml?", "", MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    return;
                }
            }
            File.WriteAllText(Path.Combine(dlg.SelectedPath, "ccd.xml"), ccd);
            File.WriteAllText(Path.Combine(dlg.SelectedPath, "ccd.xsl"), FormEHR.GetEhrResource("CCD"));
            EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();

            newMeasureEvent.DateTEvent = DateTime.Now;
            newMeasureEvent.EventType  = EhrMeasureEventType.ClinicalSummaryProvidedToPt;
            newMeasureEvent.PatNum     = PatCur.PatNum;
            EhrMeasureEvents.Insert(newMeasureEvent);
            FillGridEHRMeasureEvents();
            MessageBox.Show("Exported");
        }
Example #21
0
        private void butSend_Click(object sender, EventArgs e)
        {
            EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();

            newMeasureEvent.DateTEvent = DateTime.Now;
            newMeasureEvent.EventType  = EhrMeasureEventType.ReminderSent;
            newMeasureEvent.PatNum     = PatCur.PatNum;
            string moreInfo = "";

            if (gridMain.GetSelectedIndex() > -1)
            {
                moreInfo = gridMain.ListGridRows[gridMain.GetSelectedIndex()].Cells[1].Text;
            }
            newMeasureEvent.MoreInfo = moreInfo;
            EhrMeasureEvents.Insert(newMeasureEvent);
            FillGridProvided();
        }
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textDescription.Text == "")
            {
                MessageBox.Show(this, "Please enter a description.");
                return;
            }
            try {
                MedOrderCur.DateTimeOrder = PIn.DateT(textDateTime.Text);
            }
            catch {
                MessageBox.Show(this, "Please enter a Date Time with format DD/MM/YYYY HH:mm AM/PM");
            }
            MedOrderCur.Description    = textDescription.Text;
            MedOrderCur.IsDiscontinued = checkIsDiscontinued.Checked;
            if (comboProv.SelectedIndex == -1)
            {
                //don't make any changes to provnum.  0 is ok, but should never happen.  ProvNum might also be for a hidden prov.
            }
            else
            {
                MedOrderCur.ProvNum = _listProviders[comboProv.SelectedIndex].ProvNum;
            }
            if (IsNew)
            {
                MedicalOrders.Insert(MedOrderCur);
                EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();
                newMeasureEvent.DateTEvent = DateTime.Now;
                newMeasureEvent.EventType  = EhrMeasureEventType.CPOE_RadOrdered;
                newMeasureEvent.PatNum     = MedOrderCur.PatNum;
                newMeasureEvent.MoreInfo   = "";
                newMeasureEvent.FKey       = MedOrderCur.MedicalOrderNum;
                EhrMeasureEvents.Insert(newMeasureEvent);
            }
            else
            {
                MedicalOrders.Update(MedOrderCur);
            }

            DialogResult = DialogResult.OK;
        }
Example #23
0
        private void FillGridProvided()
        {
            gridProvided.BeginUpdate();
            gridProvided.ListGridColumns.Clear();
            GridColumn col = new GridColumn("DateTime", 130);

            gridProvided.ListGridColumns.Add(col);
            col = new GridColumn("Details", 600);
            gridProvided.ListGridColumns.Add(col);
            reminderSentList = EhrMeasureEvents.RefreshByType(PatCur.PatNum, EhrMeasureEventType.ReminderSent);
            gridProvided.ListGridRows.Clear();
            GridRow row;

            for (int i = 0; i < reminderSentList.Count; i++)
            {
                row = new GridRow();
                row.Cells.Add(reminderSentList[i].DateTEvent.ToString());
                row.Cells.Add(reminderSentList[i].MoreInfo);
                gridProvided.ListGridRows.Add(row);
            }
            gridProvided.EndUpdate();
        }
        private void FillGridProvided()
        {
            gridProvided.BeginUpdate();
            gridProvided.Columns.Clear();
            ODGridColumn col = new ODGridColumn("DateTime", 140);

            gridProvided.Columns.Add(col);
            col = new ODGridColumn("Details", 600);
            gridProvided.Columns.Add(col);
            eduMeasureProvidedList = EhrMeasureEvents.RefreshByType(patCur.PatNum, EhrMeasureEventType.EducationProvided);
            gridProvided.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < eduMeasureProvidedList.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(eduMeasureProvidedList[i].DateTEvent.ToString());
                row.Cells.Add(eduMeasureProvidedList[i].MoreInfo);
                gridProvided.Rows.Add(row);
            }
            gridProvided.EndUpdate();
        }
        private void butAssessed_Click(object sender, EventArgs e)
        {
            if (comboTobaccoStatus.SelectedIndex < 0 || comboTobaccoStatus.SelectedIndex >= _listTobaccoStatuses.Count)
            {
                MsgBox.Show(this, "You must select a tobacco status.");
                return;
            }
            DateTime        dateTEntered = PIn.DateT(textDateAssessed.Text);
            EhrMeasureEvent meas         = new EhrMeasureEvent();

            meas.DateTEvent       = dateTEntered;
            meas.EventType        = EhrMeasureEventType.TobaccoUseAssessed;
            meas.PatNum           = PatCur.PatNum;
            meas.CodeValueEvent   = _listAssessmentCodes[comboAssessmentType.SelectedIndex].CodeValue;
            meas.CodeSystemEvent  = _listAssessmentCodes[comboAssessmentType.SelectedIndex].CodeSystem;
            meas.CodeValueResult  = _listTobaccoStatuses[comboTobaccoStatus.SelectedIndex].CodeValue;
            meas.CodeSystemResult = "SNOMEDCT";          //only allow SNOMEDCT codes for now.
            meas.MoreInfo         = "";
            EhrMeasureEvents.Insert(meas);
            comboTobaccoStatus.SelectedIndex = -1;
            FillGridAssessments();
        }
Example #26
0
        private void FillReconcilesGrid()
        {
            gridReconcileEvents.BeginUpdate();
            gridReconcileEvents.Columns.Clear();
            ODGridColumn col = new ODGridColumn("DateTime", 130);

            gridReconcileEvents.Columns.Add(col);
            col = new ODGridColumn("Details", 600);
            gridReconcileEvents.Columns.Add(col);
            ehrMeasureEventsList = EhrMeasureEvents.RefreshByType(PatCur.PatNum, EhrMeasureEventType.MedicationReconcile);
            gridReconcileEvents.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < ehrMeasureEventsList.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(ehrMeasureEventsList[i].DateTEvent.ToString());
                row.Cells.Add(ehrMeasureEventsList[i].EventType.ToString());
                gridReconcileEvents.Rows.Add(row);
            }
            gridReconcileEvents.EndUpdate();
        }
Example #27
0
        private void FillGridEHRMeasureEvents()
        {
            gridEHRMeasureEvents.BeginUpdate();
            gridEHRMeasureEvents.ListGridColumns.Clear();
            GridColumn col = new GridColumn("DateTime", 140);

            gridEHRMeasureEvents.ListGridColumns.Add(col);
            //col = new ODGridColumn("Details",600);
            //gridEHRMeasureEvents.Columns.Add(col);
            summariesSentList = EhrMeasureEvents.RefreshByType(PatCur.PatNum, EhrMeasureEventType.ClinicalSummaryProvidedToPt);
            gridEHRMeasureEvents.ListGridRows.Clear();
            GridRow row;

            for (int i = 0; i < summariesSentList.Count; i++)
            {
                row = new GridRow();
                row.Cells.Add(summariesSentList[i].DateTEvent.ToString());
                //row.Cells.Add(summariesSentList[i].EventType.ToString());
                gridEHRMeasureEvents.ListGridRows.Add(row);
            }
            gridEHRMeasureEvents.EndUpdate();
        }
Example #28
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormEhrLabOrderEdit2014 FormLOE = new FormEhrLabOrderEdit2014();

            FormLOE.EhrLabCur        = new EhrLab();
            FormLOE.EhrLabCur.PatNum = PatCur.PatNum;
            FormLOE.IsNew            = true;
            FormLOE.ShowDialog();
            if (FormLOE.DialogResult != DialogResult.OK)
            {
                return;
            }
            EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();

            newMeasureEvent.DateTEvent = DateTime.Now;
            newMeasureEvent.EventType  = EhrMeasureEventType.CPOE_LabOrdered;         //default
            Loinc loinc = Loincs.GetByCode(FormLOE.EhrLabCur.UsiID);

            if (loinc != null && loinc.ClassType == "RAD")         //short circuit logic
            {
                newMeasureEvent.EventType = EhrMeasureEventType.CPOE_RadOrdered;
            }
            newMeasureEvent.PatNum   = FormLOE.EhrLabCur.PatNum;
            newMeasureEvent.MoreInfo = "";
            newMeasureEvent.FKey     = FormLOE.EhrLabCur.EhrLabNum;
            EhrMeasureEvents.Insert(newMeasureEvent);
            EhrLabs.SaveToDB(FormLOE.EhrLabCur);
            for (int i = 0; i < FormLOE.EhrLabCur.ListEhrLabResults.Count; i++)
            {
                if (CDSPermissions.GetForUser(Security.CurUser.UserNum).ShowCDS&& CDSPermissions.GetForUser(Security.CurUser.UserNum).LabTestCDS)
                {
                    FormCDSIntervention FormCDSI = new FormCDSIntervention();
                    FormCDSI.ListCDSI = EhrTriggers.TriggerMatch(FormLOE.EhrLabCur.ListEhrLabResults[i], PatCur);
                    FormCDSI.ShowIfRequired(false);
                }
            }
            FillGrid();
        }
        ///<summary>When sent by email or exported, this records the event.  It also recordes a request if needed.</summary>
        private void RecordRequestAndProvide()
        {
            //If there's not an event for a request within the last 5 days, automatically add one.
            bool requestExists = false;

            for (int i = 0; i < listHistory.Count; i++)
            {
                if (listHistory[i].EventType != EhrMeasureEventType.ElectronicCopyRequested)
                {
                    continue;
                }
                if (listHistory[i].DateTEvent.Date >= DateTime.Today.AddDays(-5))
                {
                    requestExists = true;
                    break;
                }
            }
            EhrMeasureEvent measureEvent;

            if (!requestExists)
            {
                measureEvent            = new EhrMeasureEvent();
                measureEvent.DateTEvent = DateTime.Now.AddMinutes(-1);
                measureEvent.EventType  = EhrMeasureEventType.ElectronicCopyRequested;
                measureEvent.PatNum     = PatCur.PatNum;
                measureEvent.MoreInfo   = "";
                EhrMeasureEvents.Insert(measureEvent);
            }
            //Always add an event for providing the electronic copy
            measureEvent            = new EhrMeasureEvent();
            measureEvent.DateTEvent = DateTime.Now;
            measureEvent.EventType  = EhrMeasureEventType.ElectronicCopyProvidedToPt;
            measureEvent.PatNum     = PatCur.PatNum;
            measureEvent.MoreInfo   = "";
            EhrMeasureEvents.Insert(measureEvent);
            FillGrid();
        }
        private void butOK_Click(object sender, EventArgs e)
        {
            if (_listMedicationPatReconcile.Count == 0)
            {
                if (!MsgBox.Show(this, true, "The reconcile list is empty which will cause all existing medications to be removed.  Continue?"))
                {
                    return;
                }
            }
            MedicationPat medP;
            bool          isActive;

            //Discontinue any current medications that are not present in the reconcile list.
            for (int i = 0; i < _listMedicationPatCur.Count; i++)       //Start looping through all current medications
            {
                isActive = false;
                medP     = _listMedicationPatCur[i];
                for (int j = 0; j < _listMedicationPatReconcile.Count; j++)                                                                                                             //Compare each reconcile medication to the current medication
                {
                    if (medP.RxCui > 0 && medP.RxCui == _listMedicationPatReconcile[j].RxCui && _listMedicationPatReconcile[j].MedicationNum == _listMedicationPatCur[i].MedicationNum) //Has an RxNorm code and they are equal
                    {
                        isActive = true;
                        break;
                    }
                }
                if (!isActive)                                        //Update current medications.
                {
                    _listMedicationPatCur[i].DateStop = DateTime.Now; //Set the current DateStop to today (to set the medication as discontinued)
                    MedicationPats.Update(_listMedicationPatCur[i]);
                }
            }
            //Always update every current medication for the patient so that DateTStamp reflects the last reconcile date.
            if (_listMedicationPatCur.Count > 0)
            {
                MedicationPats.ResetTimeStamps(_patCur.PatNum, true);
            }
            Medication med;
            int        index;

            for (int j = 0; j < _listMedicationPatReconcile.Count; j++)
            {
                index = ListMedicationPatNew.IndexOf(_listMedicationPatReconcile[j]);
                if (index < 0)
                {
                    continue;
                }
                if (_listMedicationPatReconcile[j] == ListMedicationPatNew[index])
                {
                    med = Medications.GetMedicationFromDbByRxCui(_listMedicationPatReconcile[j].RxCui);
                    if (med == null)
                    {
                        med         = new Medication();
                        med.MedName = ListMedicationPatNew[index].MedDescript;
                        med.RxCui   = ListMedicationPatNew[index].RxCui;
                        ListMedicationPatNew[index].MedicationNum = Medications.Insert(med);
                        med.GenericNum = med.MedicationNum;
                        Medications.Update(med);
                    }
                    else
                    {
                        ListMedicationPatNew[index].MedicationNum = med.MedicationNum;
                    }
                    ListMedicationPatNew[index].ProvNum = 0;                  //Since imported, set provnum to 0 so it does not affect CPOE.
                    MedicationPats.Insert(ListMedicationPatNew[index]);
                }
            }
            EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();

            newMeasureEvent.DateTEvent = DateTime.Now;
            newMeasureEvent.EventType  = EhrMeasureEventType.MedicationReconcile;
            newMeasureEvent.PatNum     = _patCur.PatNum;
            newMeasureEvent.MoreInfo   = "";
            EhrMeasureEvents.Insert(newMeasureEvent);
            for (int inter = 0; inter < _listMedicationPatReconcile.Count; inter++)
            {
                if (CDSPermissions.GetForUser(Security.CurUser.UserNum).ShowCDS&& CDSPermissions.GetForUser(Security.CurUser.UserNum).MedicationCDS)
                {
                    Medication          medInter = Medications.GetMedicationFromDbByRxCui(_listMedicationPatReconcile[inter].RxCui);
                    FormCDSIntervention FormCDSI = new FormCDSIntervention();
                    FormCDSI.ListCDSI = EhrTriggers.TriggerMatch(medInter, _patCur);
                    FormCDSI.ShowIfRequired(false);
                }
            }
            DialogResult = DialogResult.OK;
        }