コード例 #1
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textDescription.Text.Trim() == "")
            {
                MsgBox.Show(this, "Description cannot be blank.");
                return;
            }
            if (textUnii.Text != "" && textMedication.Text != "")
            {
                MsgBox.Show(this, "Only one code is allowed per allergy def.");
                return;
            }
            string        validChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            StringBuilder notAllowed = new StringBuilder();

            for (int i = 0; i < textUnii.Text.Length; i++)
            {
                if (validChars.IndexOf(textUnii.Text[i]) == -1)               //Not found.
                {
                    notAllowed.Append(textUnii.Text[i]);
                }
            }
            if (notAllowed.ToString() != "")
            {
                MessageBox.Show(Lan.g(this, "UNII code has invalid characters: ") + notAllowed);
                return;
            }
            if (textUnii.Text != "" && textUnii.Text.Length != 10)
            {
                MsgBox.Show(this, "UNII code must be 10 characters in length.");
                return;
            }
            AllergyDefCur.Description = textDescription.Text;
            AllergyDefCur.IsHidden    = checkHidden.Checked;
            AllergyDefCur.SnomedType  = (SnomedAllergy)comboSnomedAllergyType.SelectedIndex;
            AllergyDefCur.UniiCode    = textUnii.Text;
            //if(snomedAllergicTo!=null) { //TODO: Do UNII check once the table is added
            //	AllergyDefCur.SnomedAllergyTo=snomedAllergicTo.SnomedCode;
            //}
            if (AllergyDefCur.IsNew)
            {
                AllergyDefs.Insert(AllergyDefCur);
            }
            else
            {
                AllergyDefs.Update(AllergyDefCur);
            }
            DialogResult = DialogResult.OK;
        }
コード例 #2
0
ファイル: FormAllergyDefEdit.cs プロジェクト: nampn/ODental
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textDescription.Text.Trim() == "")
     {
         MsgBox.Show(this, "Description cannot be blank.");
         return;
     }
     AllergyDefCur.Description = textDescription.Text;
     AllergyDefCur.IsHidden    = checkHidden.Checked;
     AllergyDefCur.Snomed      = (SnomedAllergy)comboSnomedAllergyType.SelectedIndex;
     if (AllergyDefCur.IsNew)
     {
         AllergyDefs.Insert(AllergyDefCur);
     }
     else
     {
         AllergyDefs.Update(AllergyDefCur);
     }
     DialogResult = DialogResult.OK;
 }
コード例 #3
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (_listAllergyReconcile.Count == 0)
            {
                if (!MsgBox.Show(this, true, "The reconcile list is empty which will cause all existing allergies to be removed.  Continue?"))
                {
                    return;
                }
            }
            Allergy    al;
            AllergyDef alD;
            bool       isActive;

            //Discontinue any current medications that are not present in the reconcile list.
            for (int i = 0; i < _listAllergyCur.Count; i++)       //Start looping through all current allergies
            {
                isActive = false;
                al       = _listAllergyCur[i];
                alD      = AllergyDefs.GetOne(al.AllergyDefNum, _listAllergyDefCur);
                for (int j = 0; j < _listAllergyReconcile.Count; j++)           //Compare each reconcile allergy to the current allergy
                {
                    AllergyDef alDR = AllergyDefs.GetOne(_listAllergyReconcile[j].AllergyDefNum, _listAllergyDefCur);
                    if (_listAllergyReconcile[j].AllergyDefNum == _listAllergyCur[i].AllergyDefNum)                   //Has identical AllergyDefNums
                    {
                        isActive = true;
                        break;
                    }
                    if (alDR == null)
                    {
                        continue;
                    }
                    //if(alDR.SnomedAllergyTo!="" && alDR.SnomedAllergyTo==alD.SnomedAllergyTo) {//TODO: Change to UNII
                    //	isActive=true;
                    //	break;
                    //}
                    if (alDR.MedicationNum != 0 && alDR.MedicationNum == alD.MedicationNum)                 //Has a Snomed code and they are equal
                    {
                        isActive = true;
                        break;
                    }
                }
                if (!isActive)
                {
                    _listAllergyCur[i].StatusIsActive = isActive;
                    Allergies.Update(_listAllergyCur[i]);
                }
            }
            //Always update every current allergy for the patient so that DateTStamp reflects the last reconcile date.
            if (_listAllergyCur.Count > 0)
            {
                Allergies.ResetTimeStamps(_patCur.PatNum, true);
            }
            AllergyDef alDU;
            int        index;

            for (int j = 0; j < _listAllergyReconcile.Count; j++)
            {
                if (!_listAllergyReconcile[j].IsNew)
                {
                    continue;
                }
                index = ListAllergyNew.IndexOf(_listAllergyReconcile[j]);              //Returns -1 if not found.
                if (index < 0)
                {
                    continue;
                }
                //Insert the AllergyDef and Allergy if needed.
                if (ListAllergyDefNew[index].MedicationNum != 0)
                {
                    alDU = AllergyDefs.GetAllergyDefFromMedication(ListAllergyDefNew[index].MedicationNum);
                }
                else
                {
                    alDU = null;                  //remove once UNII is implemented
                    //alDU=AllergyDefs.GetAllergyDefFromCode(ListAllergyDefNew[index].SnomedAllergyTo);//TODO: Change to UNII
                }
                if (alDU == null)               //db is missing the def
                {
                    ListAllergyNew[index].AllergyDefNum = AllergyDefs.Insert(ListAllergyDefNew[index]);
                }
                else
                {
                    ListAllergyNew[index].AllergyDefNum = alDU.AllergyDefNum;                  //Set the allergydefnum on the allergy.
                }
                Allergies.Insert(ListAllergyNew[index]);
            }
            //TODO: Make an allergy measure event if one is needed for MU3.
            //EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();
            //newMeasureEvent.DateTEvent=DateTime.Now;
            //newMeasureEvent.EventType=EhrMeasureEventType.AllergyReconcile;
            //newMeasureEvent.PatNum=PatCur.PatNum;
            //newMeasureEvent.MoreInfo="";
            //EhrMeasureEvents.Insert(newMeasureEvent);
            for (int inter = 0; inter < _listAllergyReconcile.Count; inter++)
            {
                if (CDSPermissions.GetForUser(Security.CurUser.UserNum).ShowCDS&& CDSPermissions.GetForUser(Security.CurUser.UserNum).AllergyCDS)
                {
                    AllergyDef          alDInter = AllergyDefs.GetOne(_listAllergyReconcile[inter].AllergyDefNum);
                    FormCDSIntervention FormCDSI = new FormCDSIntervention();
                    FormCDSI.ListCDSI = EhrTriggers.TriggerMatch(alDInter, _patCur);
                    FormCDSI.ShowIfRequired(false);
                }
            }
            DialogResult = DialogResult.OK;
        }