コード例 #1
0
        private void FillGridEdu()
        {
            gridEdu.BeginUpdate();
            gridEdu.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Criteria", 300);

            gridEdu.Columns.Add(col);
            col = new ODGridColumn("Link", 100);
            gridEdu.Columns.Add(col);
            eduResourceList = EduResources.GenerateForPatient(patCur.PatNum);
            gridEdu.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < eduResourceList.Count; i++)
            {
                row = new ODGridRow();
                if (eduResourceList[i].DiseaseDefNum != 0)
                {
                    row.Cells.Add("Problem: " + DiseaseDefs.GetItem(eduResourceList[i].DiseaseDefNum).DiseaseName);
                    //row.Cells.Add("ICD9: "+DiseaseDefs.GetItem(eduResourceList[i].DiseaseDefNum).ICD9Code);
                }
                else if (eduResourceList[i].MedicationNum != 0)
                {
                    row.Cells.Add("Medication: " + Medications.GetDescription(eduResourceList[i].MedicationNum));
                }
                else
                {
                    row.Cells.Add("Lab Results: " + eduResourceList[i].LabResultName);
                }
                row.Cells.Add(eduResourceList[i].ResourceUrl);
                gridEdu.Rows.Add(row);
            }
            gridEdu.EndUpdate();
        }
コード例 #2
0
        private void butExportMedications_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.Setup))
            {
                return;
            }
            int    countExportedMeds = 0;
            string fileName;

            if (ODBuild.IsWeb())
            {
                fileName = "ExportedMedications.txt";
            }
            else
            {
                //Prompt for file.
                fileName = GetFilenameFromUser(false);
            }
            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }
            try {
                Cursor            = Cursors.WaitCursor;
                countExportedMeds = MedicationL.ExportMedications(fileName, Medications.GetList());
            }
            catch (Exception ex) {
                Cursor = Cursors.Default;
                string msg = Lans.g(this, "Error: ");
                MessageBox.Show(this, msg + ": " + ex.Message);
            }
            Cursor = Cursors.Default;
            MessageBox.Show(this, POut.Int(countExportedMeds) + " " + Lan.g(this, "medications exported to:") + " " + fileName);
        }
コード例 #3
0
        private void FillGrid()
        {
            Cursor   = Cursors.WaitCursor;
            ListMeds = FormularyMeds.GetMedsForFormulary(FormularyCur.FormularyNum);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Name", 150);

            gridMain.Columns.Add(col);
            //col=new ODGridColumn("Notes",250);
            //gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow  row;
            Medication medication;

            for (int i = 0; i < ListMeds.Count; i++)
            {
                medication = Medications.GetMedication(ListMeds[i].MedicationNum);
                row        = new ODGridRow();
                row.Cells.Add(medication.MedName.ToString());
                //row.Cells.Add(Medications.GetMedication(medication.GenericNum).Notes.ToString());
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            Cursor = Cursors.Default;
        }
コード例 #4
0
ファイル: AutomationL.cs プロジェクト: ChemBrain/OpenDental
        private static bool MedicationComparison(AutomationCondition autoCond, long patNum)
        {
            List <Medication> medList = Medications.GetMedicationsByPat(patNum);

            switch (autoCond.Comparison)
            {
            case AutoCondComparison.Equals:
                for (int i = 0; i < medList.Count; i++)
                {
                    if (medList[i].MedName == autoCond.CompareString)
                    {
                        return(true);
                    }
                }
                break;

            case AutoCondComparison.Contains:
                for (int i = 0; i < medList.Count; i++)
                {
                    if (medList[i].MedName.ToLower().Contains(autoCond.CompareString.ToLower()))
                    {
                        return(true);
                    }
                }
                break;
            }
            return(false);
        }
コード例 #5
0
        private void butAddBrand_Click(object sender, System.EventArgs e)
        {
            if (listMeds.SelectedIndex == -1)
            {
                MessageBox.Show(Lan.g(this, "You must first highlight the generic medication from the list.  If it is not already on the list, then you must add it first."));
                return;
            }
            Medication selected = Medications.List[listMeds.SelectedIndex];

            if (selected.MedicationNum != selected.GenericNum)
            {
                MessageBox.Show(Lan.g(this, "The selected medication is not generic."));
                return;
            }
            Medication MedicationCur = new Medication();

            Medications.Insert(MedicationCur);            //so that we will have the primary key
            MedicationCur.GenericNum = selected.MedicationNum;
            FormMedicationEdit FormME = new FormMedicationEdit();

            FormME.MedicationCur = MedicationCur;
            FormME.IsNew         = true;
            FormME.ShowDialog();
            FillMedList();
        }
コード例 #6
0
ファイル: FormMedPat.cs プロジェクト: luisurbinanet/gnudental
 private void FillForm()
 {
     textMedName.Text     = Medications.GetMedication(MedicationPatCur.MedicationNum).MedName;
     textGenericName.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).MedName;
     textMedNote.Text     = Medications.GetGeneric(MedicationPatCur.MedicationNum).Notes;
     textPatNote.Text     = MedicationPatCur.PatNote;
 }
コード例 #7
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn("Reminder Criterion", 200);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Message", 200);
            gridMain.Columns.Add(col);
            listReminders = ReminderRules.SelectAll();
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < listReminders.Count; i++)
            {
                row = new ODGridRow();
                switch (listReminders[i].ReminderCriterion)
                {
                case EhrCriterion.Problem:
                    DiseaseDef def = DiseaseDefs.GetItem(listReminders[i].CriterionFK);
                    row.Cells.Add("Problem =" + def.ICD9Code + " " + def.DiseaseName);
                    break;

                case EhrCriterion.Medication:
                    Medication tempMed = Medications.GetMedication(listReminders[i].CriterionFK);
                    if (tempMed.MedicationNum == tempMed.GenericNum)                           //handle generic medication names.
                    {
                        row.Cells.Add("Medication = " + tempMed.MedName);
                    }
                    else
                    {
                        row.Cells.Add("Medication = " + tempMed.MedName + " / " + Medications.GetGenericName(tempMed.GenericNum));
                    }
                    break;

                case EhrCriterion.Allergy:
                    row.Cells.Add("Allergy = " + AllergyDefs.GetOne(listReminders[i].CriterionFK).Description);
                    break;

                case EhrCriterion.Age:
                    row.Cells.Add("Age " + listReminders[i].CriterionValue);
                    break;

                case EhrCriterion.Gender:
                    row.Cells.Add("Gender is " + listReminders[i].CriterionValue);
                    break;

                case EhrCriterion.LabResult:
                    row.Cells.Add("LabResult " + listReminders[i].CriterionValue);
                    break;
                    //case EhrCriterion.ICD9:
                    //  row.Cells.Add("ICD9 "+ICD9s.GetDescription(listReminders[i].CriterionFK));
                    //  break;
                }
                row.Cells.Add(listReminders[i].Message);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
コード例 #8
0
        private void butMerge_Click(object sender, EventArgs e)
        {
            string differentFields = "";
            string msgText         = "";

            if (textMedNumInto.Text == textMedNumFrom.Text)
            {
                //do not attempt a merge if the same medication was selected twice, or if one of the fields is blank.
                MsgBox.Show(this, "You must select two different medications to merge.");
                return;
            }
            if (_medFrom.MedicationNum == _medFrom.GenericNum && _medInto.MedicationNum != _medInto.GenericNum)
            {
                msgText = Lan.g(this, "You may not merge a generic medication into a brand") + ".  " +
                          Lan.g(this, "Select the generic version of the medication to merge into instead") + ".";
                MessageBox.Show(msgText);
                return;
            }
            if (textMedNameFrom.Text != textMedNameInto.Text)
            {
                differentFields += "\r\n" + Lan.g(this, "Medication Name");
            }
            if (textGenNumFrom.Text != textGenNumInto.Text)
            {
                differentFields += "\r\n" + Lan.g(this, "GenericNum");
            }
            if (textRxFrom.Text != textRxInto.Text)
            {
                differentFields += "\r\n" + Lan.g(this, "RxCui");
            }
            long numPats = Medications.CountPats(_medFrom.MedicationNum);

            if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "Are you sure?  The results are permanent and cannot be undone."))
            {
                return;
            }
            msgText = "";
            if (differentFields != "")
            {
                msgText = Lan.g(this, "The following medication fields do not match") + ": " + differentFields + "\r\n";
            }
            msgText += Lan.g(this, "This change is irreversible") + ".  " + Lan.g(this, "This medication is assigned to") + " " + numPats + " "
                       + Lan.g(this, "patients") + ".  " + Lan.g(this, "Continue anyways?");
            if (MessageBox.Show(msgText, "", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return;
            }
            long   rowsChanged = Medications.Merge(_medFrom.MedicationNum, _medInto.MedicationNum);
            string logText     = Lan.g(this, "Medications merged") + ": " + _medFrom.MedName + " " + Lan.g(this, "merged into") + " " + _medInto.MedName + ".\r\n"
                                 + Lan.g(this, "Rows changed") + ": " + POut.Long(rowsChanged);

            SecurityLogs.MakeLogEntry(Permissions.MedicationMerge, 0, logText);
            textRxFrom.Clear();
            textMedNumFrom.Clear();
            textMedNameFrom.Clear();
            textGenNumFrom.Clear();
            MsgBox.Show(this, "Done.");
            DataValid.SetInvalid(InvalidType.Medications);
            CheckUIState();
        }
コード例 #9
0
 private void FillAlerts()
 {
     RxAlertList = RxAlerts.Refresh(RxDefCur.RxDefNum);
     listAlerts.Items.Clear();
     for (int i = 0; i < RxAlertList.Count; i++)
     {
         if (RxAlertList[i].DiseaseDefNum > 0)
         {
             listAlerts.Items.Add(DiseaseDefs.GetName(RxAlertList[i].DiseaseDefNum));
         }
         if (RxAlertList[i].AllergyDefNum > 0)
         {
             AllergyDef allergyDef = AllergyDefs.GetOne(RxAlertList[i].AllergyDefNum);
             if (allergyDef != null)
             {
                 listAlerts.Items.Add(allergyDef.Description);
             }
         }
         if (RxAlertList[i].MedicationNum > 0)
         {
             Medications.RefreshCache();
             Medication med = Medications.GetMedication(RxAlertList[i].MedicationNum);
             if (med != null)
             {
                 listAlerts.Items.Add(med.MedName);
             }
         }
     }
 }
コード例 #10
0
ファイル: FormMedications.cs プロジェクト: royedwards/DRDNet
        private void butAddBrand_Click(object sender, System.EventArgs e)
        {
            if (gridAllMedications.GetSelectedIndex() == -1)
            {
                MessageBox.Show(Lan.g(this, "You must first highlight the generic medication from the list.  If it is not already on the list, then you must add it first."));
                return;
            }
            Medication medSelected = (Medication)gridAllMedications.Rows[gridAllMedications.GetSelectedIndex()].Tag;

            if (medSelected.MedicationNum != medSelected.GenericNum)
            {
                MessageBox.Show(Lan.g(this, "The selected medication is not generic."));
                return;
            }
            Medication MedicationCur = new Medication();

            Medications.Insert(MedicationCur);            //so that we will have the primary key
            MedicationCur.GenericNum = medSelected.MedicationNum;
            FormMedicationEdit FormME = new FormMedicationEdit();

            FormME.MedicationCur = MedicationCur;
            FormME.IsNew         = true;
            FormME.ShowDialog();            //This window refreshes the Medication cache if the user clicked OK.
            FillTab();
        }
コード例 #11
0
        private void butMedicationSelect_Click(object sender, EventArgs e)
        {
            FormMedications FormM = new FormMedications();

            FormM.IsSelectionMode = true;
            FormM.ShowDialog();
            if (FormM.DialogResult != DialogResult.OK)
            {
                return;
            }
            EduResourceCur.DiseaseDefNum    = 0;
            EduResourceCur.MedicationNum    = FormM.SelectedMedicationNum;
            EduResourceCur.SmokingSnoMed    = "";
            EduResourceCur.LabResultID      = "";
            EduResourceCur.LabResultName    = "";
            EduResourceCur.LabResultCompare = "";
            textProblem.Text           = "";
            textICD9.Text              = "";
            textSnomed.Text            = "";
            textMedication.Text        = Medications.GetDescription(FormM.SelectedMedicationNum);
            textTobaccoAssessment.Text = "";
            textLabResultsID.Text      = "";
            textLabTestName.Text       = "";
            textCompareValue.Text      = "";
        }
コード例 #12
0
ファイル: FormMedications.cs プロジェクト: royedwards/DRDNet
        private void gridAllMedications_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            Medication med = (Medication)gridAllMedications.Rows[e.Row].Tag;

            med = Medications.GetMedication(med.MedicationNum);
            if (med == null)           //Possible to delete the medication from a separate WS while medication loaded in memory.
            {
                MsgBox.Show(this, "An error occurred loading medication.");
                return;
            }
            if (IsSelectionMode)
            {
                SelectedMedicationNum = med.MedicationNum;
                DialogResult          = DialogResult.OK;
            }
            else                                                                   //normal mode from main menu
            {
                if (!CultureInfo.CurrentCulture.Name.EndsWith("US") || e.Col != 3) //Not United States RxNorm Column
                {
                    FormMedicationEdit FormME = new FormMedicationEdit();
                    FormME.MedicationCur = med;
                    FormME.ShowDialog();                    //This window refreshes the Medication cache if the user clicked OK.
                    FillTab();
                }
            }
        }
コード例 #13
0
ファイル: FormMedications.cs プロジェクト: nampn/ODental
        private void FillGrid()
        {
            medList = Medications.GetList(textSearch.Text);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g(this, "Drug Name"), 120);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Generic Name"), 120);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Notes for Generic"), 250);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < medList.Count; i++)
            {
                row = new ODGridRow();
                if (medList[i].MedicationNum == medList[i].GenericNum)               //isGeneric
                {
                    row.Cells.Add(medList[i].MedName);
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(medList[i].MedName);
                    row.Cells.Add(Medications.GetGenericName(medList[i].GenericNum));
                }
                row.Cells.Add(medList[i].Notes);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
コード例 #14
0
        private void FillMeds()
        {
            Medications.Refresh();
            MedicationPats.Refresh(PatCur.PatNum);
            gridMeds.BeginUpdate();
            gridMeds.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableMedications", "Drug Name"), 100);

            gridMeds.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableMedications", "Generic Name"), 100);
            gridMeds.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableMedications", "Notes"), 370);
            gridMeds.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableMedications", "Notes for Patient"), 370);
            gridMeds.Columns.Add(col);
            gridMeds.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < MedicationPats.List.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(Medications.GetMedication(MedicationPats.List[i].MedicationNum).MedName);
                row.Cells.Add(Medications.GetGeneric(MedicationPats.List[i].MedicationNum).MedName);
                row.Cells.Add(Medications.GetGeneric(MedicationPats.List[i].MedicationNum).Notes);
                row.Cells.Add(MedicationPats.List[i].PatNote);
                gridMeds.Rows.Add(row);
            }
            gridMeds.EndUpdate();
        }
コード例 #15
0
        private void butIntervention_Click(object sender, EventArgs e)
        {
            if (comboInterventionCode.SelectedIndex < 0)
            {
                MsgBox.Show(this, "You must select an intervention code.");
                return;
            }
            EhrCode  iCodeCur = _listInterventionCodes[comboInterventionCode.SelectedIndex];
            DateTime dateCur  = PIn.Date(textDateIntervention.Text);

            if (iCodeCur.CodeSystem == "RXNORM" && !checkPatientDeclined.Checked)           //if patient declines the medication, enter as a declined intervention
            //codeVal will be RxCui of medication, see if it already exists in Medication table
            {
                Medication medCur = Medications.GetMedicationFromDbByRxCui(PIn.Long(iCodeCur.CodeValue));
                if (medCur == null)               //no med with this RxCui, create one
                {
                    medCur = new Medication();
                    Medications.Insert(medCur);                    //so that we will have the primary key
                    medCur.GenericNum = medCur.MedicationNum;
                    medCur.RxCui      = PIn.Long(iCodeCur.CodeValue);
                    medCur.MedName    = RxNorms.GetDescByRxCui(iCodeCur.CodeValue);
                    Medications.Update(medCur);
                    Medications.RefreshCache();                    //refresh cache to include new medication
                }
                MedicationPat medPatCur = new MedicationPat();
                medPatCur.PatNum        = PatCur.PatNum;
                medPatCur.ProvNum       = PatCur.PriProv;
                medPatCur.MedicationNum = medCur.MedicationNum;
                medPatCur.RxCui         = medCur.RxCui;
                medPatCur.DateStart     = dateCur;
                FormMedPat FormMP = new FormMedPat();
                FormMP.MedicationPatCur = medPatCur;
                FormMP.IsNew            = true;
                FormMP.ShowDialog();
                if (FormMP.DialogResult != DialogResult.OK)
                {
                    return;
                }
                if (FormMP.MedicationPatCur.DateStart.Date < dateCur.AddMonths(-6).Date || FormMP.MedicationPatCur.DateStart.Date > dateCur.Date)
                {
                    MsgBox.Show(this, "The medication order just entered is not within the 6 months prior to the date of this intervention.  You can modify the "
                                + "date of the medication order in the patient's medical history section.");
                }
            }
            else
            {
                Intervention iCur = new Intervention();
                iCur.PatNum        = PatCur.PatNum;
                iCur.ProvNum       = PatCur.PriProv;
                iCur.DateEntry     = dateCur;
                iCur.CodeValue     = iCodeCur.CodeValue;
                iCur.CodeSystem    = iCodeCur.CodeSystem;
                iCur.CodeSet       = InterventionCodeSet.TobaccoCessation;
                iCur.IsPatDeclined = checkPatientDeclined.Checked;
                Interventions.Insert(iCur);
            }
            comboInterventionCode.SelectedIndex = -1;
            FillGridInterventions();
        }
コード例 #16
0
        private void FillForm()
        {
            textMedName.Text = MedicationCur.MedName;
            if (!IsNew)
            {
                textMedName.ReadOnly = true;
            }
            if (MedicationCur.MedicationNum == MedicationCur.GenericNum)
            {
                textGenericName.Text = MedicationCur.MedName;
                textNotes.Text       = MedicationCur.Notes;
                textNotes.ReadOnly   = false;
                Brands = Medications.GetBrands(MedicationCur.MedicationNum);
                comboBrands.Items.Clear();
                comboBrands.Items.AddRange(Brands);
                if (Brands.Length > 0)
                {
                    comboBrands.SelectedIndex = 0;
                }
            }
            else
            {
                textGenericName.Text = Medications.GetMedication(MedicationCur.GenericNum).MedName;
                textNotes.Text       = Medications.GetMedication(MedicationCur.GenericNum).Notes;
                textNotes.ReadOnly   = true;
                Brands = new string[0];
                comboBrands.Visible = false;
                labelBrands.Visible = false;
            }
            _patNameMeds = Medications.GetPatNamesForMed(MedicationCur.MedicationNum);
            comboPatients.Items.Clear();
            comboPatients.Items.AddRange(_patNameMeds);
            if (_patNameMeds.Length > 0)
            {
                comboPatients.SelectedIndex = 0;
            }
            AllergyDef alD = AllergyDefs.GetAllergyDefFromMedication(MedicationCur.MedicationNum);

            if (alD != null)
            {
                _patNameAllergies = Allergies.GetPatNamesForAllergy(alD.AllergyDefNum);
                comboPatientAllergy.Items.Clear();
                comboPatientAllergy.Items.AddRange(_patNameAllergies);
                if (_patNameAllergies.Length > 0)
                {
                    comboPatientAllergy.SelectedIndex = 0;
                }
            }
            if (CultureInfo.CurrentCulture.Name.EndsWith("US"))             //United States
            {
                textRxNormDesc.Text = RxNorms.GetDescByRxCui(MedicationCur.RxCui.ToString());
            }
            else
            {
                labelRxNorm.Visible     = false;
                textRxNormDesc.Visible  = false;
                butRxNormSelect.Visible = false;
            }
        }
コード例 #17
0
ファイル: FormFormularies.cs プロジェクト: nampn/ODental
 private void FormFormularies_Load(object sender, EventArgs e)
 {
     if (!IsSelectionMode)
     {
         labelSelect.Visible = false;
     }
     Medications.Refresh();
     FillList();
 }
コード例 #18
0
 private void FormMedicationEdit_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (DialogResult == DialogResult.OK)
     {
         return;
     }
     if (IsNew)
     {
         Medications.Delete(MedicationCur);
     }
 }
コード例 #19
0
ファイル: FormMedPat.cs プロジェクト: luisurbinanet/gnudental
        private void butEdit_Click(object sender, System.EventArgs e)
        {
            FormMedicationEdit FormME = new FormMedicationEdit();

            FormME.MedicationCur = Medications.GetMedication(MedicationPatCur.MedicationNum);
            FormME.ShowDialog();
            if (FormME.DialogResult != DialogResult.OK)
            {
                return;
            }
            FillForm();
        }
コード例 #20
0
ファイル: FormMedications.cs プロジェクト: royedwards/DRDNet
        private void butAddGeneric_Click(object sender, System.EventArgs e)
        {
            Medication MedicationCur = new Medication();

            Medications.Insert(MedicationCur);            //so that we will have the primary key
            MedicationCur.GenericNum = MedicationCur.MedicationNum;
            FormMedicationEdit FormME = new FormMedicationEdit();

            FormME.MedicationCur = MedicationCur;
            FormME.IsNew         = true;
            FormME.ShowDialog();            //This window refreshes the Medication cache if the user clicked OK.
            FillTab();
        }
コード例 #21
0
        private void butAddGeneric_Click(object sender, System.EventArgs e)
        {
            Medication MedicationCur = new Medication();

            Medications.Insert(MedicationCur);            //so that we will have the primary key
            MedicationCur.GenericNum = MedicationCur.MedicationNum;
            FormMedicationEdit FormME = new FormMedicationEdit();

            FormME.MedicationCur = MedicationCur;
            FormME.IsNew         = true;
            FormME.ShowDialog();
            FillMedList();
        }
コード例 #22
0
        private void butMedicationSelect_Click(object sender, EventArgs e)
        {
            FormMedications FormM = new FormMedications();

            FormM.IsSelectionMode = true;
            FormM.ShowDialog();
            if (FormM.DialogResult != DialogResult.OK)
            {
                return;
            }
            AllergyDefCur.MedicationNum = FormM.SelectedMedicationNum;
            textMedication.Text         = Medications.GetDescription(AllergyDefCur.MedicationNum);
        }
コード例 #23
0
ファイル: FormMedications.cs プロジェクト: royedwards/DRDNet
        private void butConvertGeneric_Click(object sender, EventArgs e)
        {
            if (gridMissing.SelectedIndices.Length == 0)
            {
                MsgBox.Show(this, "Please select an item from the list before attempting to convert.");
                return;
            }
            List <MedicationPat> listMedPats   = (List <MedicationPat>)gridMissing.Rows[gridMissing.SelectedIndices[0]].Tag;
            List <Medication>    listRxCuiMeds = null;
            Medication           medGeneric    = null;

            if (listMedPats[0].RxCui != 0)
            {
                listRxCuiMeds = Medications.GetAllMedsByRxCui(listMedPats[0].RxCui);
                medGeneric    = listRxCuiMeds.FirstOrDefault(x => x.MedicationNum == x.GenericNum);
                if (medGeneric == null && listRxCuiMeds.FirstOrDefault(x => x.MedicationNum != x.GenericNum) != null)           //A Brand Medication exists with matching RxCui.
                {
                    MsgBox.Show(this, "A brand medication matching the RxNorm of the selected medication already exists in the medication list.  "
                                + "You cannot create a generic for the selected medication.  Use the Convert to Brand button instead.");
                    return;
                }
            }
            if (listRxCuiMeds == null || listRxCuiMeds.Count == 0)         //No medications found matching the RxCui
            {
                medGeneric         = new Medication();
                medGeneric.MedName = listMedPats[0].MedDescript;
                medGeneric.RxCui   = listMedPats[0].RxCui;
                Medications.Insert(medGeneric);                //To get primary key.
                medGeneric.GenericNum = medGeneric.MedicationNum;
                Medications.Update(medGeneric);                //Now that we have primary key, flag the medication as a generic.
                FormMedicationEdit FormME = new FormMedicationEdit();
                FormME.MedicationCur = medGeneric;
                FormME.IsNew         = true;
                FormME.ShowDialog();                //This window refreshes the Medication cache if the user clicked OK.
                if (FormME.DialogResult != DialogResult.OK)
                {
                    return;                    //User canceled.
                }
            }
            else if (medGeneric != null &&
                     !MsgBox.Show(this, true, "A generic medication matching the RxNorm of the selected medication already exists in the medication list.  "
                                  + "Click OK to use the existing medication as the generic for the selected medication, or click Cancel to abort."))
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            MedicationPats.UpdateMedicationNumForMany(medGeneric.MedicationNum, listMedPats.Select(x => x.MedicationPatNum).ToList());
            FillTab();
            Cursor = Cursors.Default;
            MsgBox.Show(this, "Done.");
        }
コード例 #24
0
ファイル: FormAllergyDefEdit.cs プロジェクト: nampn/ODental
 private void FormAllergyEdit_Load(object sender, EventArgs e)
 {
     if (!AllergyDefCur.IsNew)
     {
         textDescription.Text = AllergyDefCur.Description;
         checkHidden.Checked  = AllergyDefCur.IsHidden;
     }
     for (int i = 0; i < Enum.GetNames(typeof(SnomedAllergy)).Length; i++)
     {
         comboSnomedAllergyType.Items.Add(Enum.GetNames(typeof(SnomedAllergy))[i]);
     }
     comboSnomedAllergyType.SelectedIndex = (int)AllergyDefCur.Snomed;
     textMedication.Text = Medications.GetDescription(AllergyDefCur.MedicationNum);
 }
コード例 #25
0
 private void FormAllergyEdit_Load(object sender, EventArgs e)
 {
     textDescription.Text = AllergyDefCur?.Description ?? "";        //set description if available. New allergies can be added with descriptions.
     if (!AllergyDefCur.IsNew)
     {
         checkHidden.Checked = AllergyDefCur.IsHidden;
     }
     for (int i = 0; i < Enum.GetNames(typeof(SnomedAllergy)).Length; i++)
     {
         comboSnomedAllergyType.Items.Add(Enum.GetNames(typeof(SnomedAllergy))[i]);
     }
     comboSnomedAllergyType.SelectedIndex = (int)AllergyDefCur.SnomedType;
     textMedication.Text = Medications.GetDescription(AllergyDefCur.MedicationNum);
     textUnii.Text       = AllergyDefCur.UniiCode;
 }
コード例 #26
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     //generic num already handled
     MedicationCur.MedName = textMedName.Text;
     if (MedicationCur.MedicationNum == MedicationCur.GenericNum)
     {
         MedicationCur.Notes = textNotes.Text;
     }
     else
     {
         MedicationCur.Notes = "";
     }
     Medications.Update(MedicationCur);
     DialogResult = DialogResult.OK;
 }
コード例 #27
0
ファイル: FormMedPat.cs プロジェクト: nampn/ODental
        private void butEdit_Click(object sender, System.EventArgs e)
        {
            Medications.Refresh();
            FormMedicationEdit FormME = new FormMedicationEdit();

            FormME.MedicationCur = Medications.GetMedication(MedicationPatCur.MedicationNum);
            FormME.ShowDialog();
            if (FormME.DialogResult != DialogResult.OK)
            {
                return;
            }
            textMedName.Text     = Medications.GetMedication(MedicationPatCur.MedicationNum).MedName;
            textGenericName.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).MedName;
            textMedNote.Text     = Medications.GetGeneric(MedicationPatCur.MedicationNum).Notes;
        }
コード例 #28
0
        private void butChangeMedFrom_Click(object sender, EventArgs e)
        {
            FormMedications FormM = new FormMedications();

            FormM.IsSelectionMode = true;
            FormM.ShowDialog();
            if (FormM.DialogResult == DialogResult.OK)
            {
                _medFrom             = Medications.GetMedication(FormM.SelectedMedicationNum);
                textGenNumFrom.Text  = POut.Long(_medFrom.GenericNum);
                textMedNameFrom.Text = _medFrom.MedName;
                textMedNumFrom.Text  = POut.Long(_medFrom.MedicationNum);
                textRxFrom.Text      = POut.Long(_medFrom.RxCui);
            }
            CheckUIState();
        }
コード例 #29
0
ファイル: FormMedicationEdit.cs プロジェクト: nampn/ODental
 private void butOK_Click(object sender, System.EventArgs e)
 {
     //generic num already handled
     MedicationCur.MedName = textMedName.Text;
     if (MedicationCur.MedicationNum == MedicationCur.GenericNum)
     {
         MedicationCur.Notes = textNotes.Text;
     }
     else
     {
         MedicationCur.Notes = "";
     }
     //MedicationCur has its RxCui set when the butRxNormSelect button is pressed.
     Medications.Update(MedicationCur);
     DialogResult = DialogResult.OK;
 }
コード例 #30
0
 private void FormMedicationEdit_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (DialogResult == DialogResult.OK)
     {
         return;
     }
     if (IsNew)
     {
         try {
             Medications.Delete(MedicationCur);
         }
         catch {
             MsgBox.Show(this, "The medication failed to delete due to existing dependencies.");
         }
     }
 }