Пример #1
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            //select medication from list.  Additional meds can be added to the list from within that dlg
            FormMedications FormM = new FormMedications();

            FormM.IsSelectionMode = true;
            FormM.ShowDialog();
            if (FormM.DialogResult != DialogResult.OK)
            {
                return;
            }
            MedicationPat MedicationPatCur = new MedicationPat();

            MedicationPatCur.PatNum        = PatCur.PatNum;
            MedicationPatCur.MedicationNum = FormM.SelectedMedicationNum;
            MedicationPatCur.ProvNum       = PatCur.PriProv;
            FormMedPat FormMP = new FormMedPat();

            FormMP.MedicationPatCur = MedicationPatCur;
            FormMP.IsNew            = true;
            FormMP.ShowDialog();
            if (FormMP.DialogResult != DialogResult.OK)
            {
                return;
            }
            FillMeds();
        }
Пример #2
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      = "";
        }
Пример #3
0
        private void butSelectFK_Click(object sender, EventArgs e)
        {
            switch ((EhrCriterion)comboReminderCriterion.SelectedIndex)
            {
            case EhrCriterion.Problem:
                FormDiseaseDefs formD = new FormDiseaseDefs();
                formD.IsSelectionMode = true;
                formD.ShowDialog();
                if (formD.DialogResult != DialogResult.OK)
                {
                    RuleCur.CriterionFK = -1;
                    return;
                }
                RuleCur.CriterionFK = formD.SelectedDiseaseDefNum;
                break;

            case EhrCriterion.Medication:
                FormMedications formM = new FormMedications();
                formM.IsSelectionMode = true;
                formM.ShowDialog();
                if (formM.DialogResult != DialogResult.OK)
                {
                    RuleCur.CriterionFK = -1;
                    return;
                }
                RuleCur.CriterionFK = formM.SelectedMedicationNum;
                break;

            case EhrCriterion.Allergy:
                FormAllergySetup formA = new FormAllergySetup();
                formA.IsSelectionMode = true;
                formA.ShowDialog();
                if (formA.DialogResult != DialogResult.OK)
                {
                    RuleCur.CriterionFK = -1;
                    return;
                }
                RuleCur.CriterionFK = formA.SelectedAllergyDefNum;
                break;

            case EhrCriterion.ICD9:
                FormIcd9s FormICD9Select = new FormIcd9s();
                FormICD9Select.IsSelectionMode = true;
                FormICD9Select.ShowDialog();
                if (FormICD9Select.DialogResult != DialogResult.OK)
                {
                    RuleCur.CriterionFK = -1;
                    return;
                }
                RuleCur.CriterionFK = FormICD9Select.SelectedIcd9Num;
                break;

            default:
                MessageBox.Show("You should never see this error message. Something has stopped working properly.");
                break;
            }
            FillFK();
        }
Пример #4
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);
		}
Пример #5
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);
        }
Пример #6
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();
        }
Пример #7
0
        private void butAddMedication_Click(object sender, EventArgs e)
        {
            FormMedications FormMED = new FormMedications();

            FormMED.IsSelectionMode = true;
            FormMED.ShowDialog();
            if (FormMED.DialogResult != DialogResult.OK)
            {
                return;
            }
            RxAlert alert = new RxAlert();

            alert.MedicationNum = FormMED.SelectedMedicationNum;
            alert.RxDefNum      = RxDefCur.RxDefNum;
            RxAlerts.Insert(alert);
            FillAlerts();
        }
		private void butMedicationSelect_Click(object sender,EventArgs e) {
			FormMedications FormM=new FormMedications();
			FormM.IsSelectionMode=true;
			FormM.ShowDialog();
			if(FormM.DialogResult!=DialogResult.OK) {
				return;
			}
			textProblem.Text="";
			EduResourceCur.DiseaseDefNum=0;
			textICD9.Text="";
			textSnomed.Text="";
			textMedication.Text=Medications.GetDescription(FormM.SelectedMedicationNum);
			EduResourceCur.MedicationNum=FormM.SelectedMedicationNum;
			textLabResultsID.Text="";
			textLabTestName.Text="";
			textCompareValue.Text="";
		}
Пример #9
0
        private void butAddMed_Click(object sender, EventArgs e)
        {
            FormMedications FormM = new FormMedications();

            FormM.IsSelectionMode = true;
            FormM.ShowDialog();
            if (FormM.DialogResult != DialogResult.OK)
            {
                return;
            }
            Medication m = Medications.GetMedication(FormM.SelectedMedicationNum);

            EhrTriggerCur.MedicationNumList += " " + m.MedicationNum + " ";
            if (m.RxCui != 0)
            {
                EhrTriggerCur.RxCuiList += " " + m.RxCui + " ";
            }
            FillGrid();
        }
Пример #10
0
        private void butMedicationSelect_Click(object sender, EventArgs e)
        {
            FormMedications FormM = new FormMedications();

            FormM.IsSelectionMode = true;
            FormM.ShowDialog();
            if (FormM.DialogResult != DialogResult.OK)
            {
                return;
            }
            textProblem.Text             = "";
            EduResourceCur.DiseaseDefNum = 0;
            textICD9.Text                = "";
            EduResourceCur.Icd9Num       = 0;
            textMedication.Text          = Medications.GetDescription(FormM.SelectedMedicationNum);
            EduResourceCur.MedicationNum = FormM.SelectedMedicationNum;
            textLabResultsID.Text        = "";
            textLabTestName.Text         = "";
            textCompareValue.Text        = "";
        }
Пример #11
0
 private void butAdd_Click(object sender,EventArgs e)
 {
     //select medication from list.  Additional meds can be added to the list from within that dlg
     FormMedications FormM=new FormMedications();
     FormM.IsSelectionMode=true;
     FormM.ShowDialog();
     if(FormM.DialogResult!=DialogResult.OK) {
         return;
     }
     MedicationPat MedicationPatCur=new MedicationPat();
     MedicationPatCur.PatNum=PatCur.PatNum;
     MedicationPatCur.MedicationNum=FormM.SelectedMedicationNum;
     MedicationPatCur.ProvNum=PatCur.PriProv;
     FormMedPat FormMP=new FormMedPat();
     FormMP.MedicationPatCur=MedicationPatCur;
     FormMP.IsNew=true;
     FormMP.ShowDialog();
     if(FormMP.DialogResult!=DialogResult.OK) {
         return;
     }
     FillMeds();
 }
Пример #12
0
 private void menuItemMedications_Click(object sender, System.EventArgs e)
 {
     FormMedications FormM=new FormMedications();
     FormM.ShowDialog();
 }
Пример #13
0
		private void butAddMed_Click(object sender,EventArgs e) {
			FormMedications FormM=new FormMedications();
			FormM.IsSelectionMode=true;
			FormM.ShowDialog();
			if(FormM.DialogResult!=DialogResult.OK) {
				return;
			}
			Medication m=Medications.GetMedication(FormM.SelectedMedicationNum);
			EhrTriggerCur.MedicationNumList+=" "+m.MedicationNum+" ";
			if(m.RxCui!=0) {
				EhrTriggerCur.RxCuiList+=" "+m.RxCui+" ";
			}
			FillGrid();
		}
Пример #14
0
		private void butSelectFK_Click(object sender,EventArgs e) {
			switch((EhrCriterion)comboReminderCriterion.SelectedIndex) {
				case EhrCriterion.Problem:
					FormDiseaseDefs formD=new FormDiseaseDefs();
					formD.IsSelectionMode=true;
					formD.ShowDialog();
					if(formD.DialogResult!=DialogResult.OK) {
						RuleCur.CriterionFK=-1;
						return;
					}
					RuleCur.CriterionFK=formD.SelectedDiseaseDefNum;
					break;
				case EhrCriterion.Medication:
					FormMedications formM=new FormMedications();
					formM.IsSelectionMode=true;
					formM.ShowDialog();
					if(formM.DialogResult!=DialogResult.OK) {
						RuleCur.CriterionFK=-1;
						return;
					}
					RuleCur.CriterionFK=formM.SelectedMedicationNum;
					break;
				case EhrCriterion.Allergy:
					FormAllergySetup formA=new FormAllergySetup();
					formA.IsSelectionMode=true;
					formA.ShowDialog();
					if(formA.DialogResult!=DialogResult.OK) {
						RuleCur.CriterionFK=-1;
						return;
					}
					RuleCur.CriterionFK=formA.SelectedAllergyDefNum;
					break;
				//case EhrCriterion.ICD9:
				//  FormIcd9s FormICD9Select = new FormIcd9s();
				//  FormICD9Select.IsSelectionMode=true;
				//  FormICD9Select.ShowDialog();
				//  if(FormICD9Select.DialogResult!=DialogResult.OK){
				//    RuleCur.CriterionFK=-1;
				//    return;
				//  }
				//  RuleCur.CriterionFK=ICD9s.GetByCode(FormICD9Select.SelectedIcd9Code).ICD9Num;
				//  break;
				default:
					MessageBox.Show("You should never see this error message. Something has stopped working properly.");
					break;
			}
			FillFK();
		}
Пример #15
0
		private void butAddMedication_Click(object sender,EventArgs e) {
			FormMedications FormMED=new FormMedications();
			FormMED.IsSelectionMode=true;
			FormMED.ShowDialog();
			if(FormMED.DialogResult!=DialogResult.OK) {
				return;
			}
			RxAlert alert=new RxAlert();
			alert.MedicationNum=FormMED.SelectedMedicationNum;
			alert.RxDefNum=RxDefCur.RxDefNum;
			RxAlerts.Insert(alert);
			FillAlerts();
		}
		private void butPicker_Click(object sender,EventArgs e) {
			switch(listRestriction.SelectedIndex) {
				case 0://Birthdate
					//Not visible
					break;
				case 1://problem
					if(sender.Equals(butPicker)) {
						FormIcd9s FormI9=new FormIcd9s();
						FormI9.IsSelectionMode=true;
						FormI9.ShowDialog();
						if(FormI9.DialogResult!=DialogResult.OK) {
							return;
						}
						textCompareString.Text=FormI9.SelectedIcd9.ICD9Code;
						textSNOMED.Text="";
					}
					else if(sender.Equals(butSNOMED)) {
						FormSnomeds FormS=new FormSnomeds();
						FormS.IsSelectionMode=true;
						FormS.ShowDialog();
						if(FormS.DialogResult!=DialogResult.OK) {
							return;
						}
						textSNOMED.Text=FormS.SelectedSnomed.SnomedCode;
						textCompareString.Text="";
					}
					break;
				case 2://Medication
					FormMedications FormM=new FormMedications();
					FormM.IsSelectionMode=true;
					FormM.ShowDialog();
					if(FormM.DialogResult!=DialogResult.OK) {
						return;
					}
					textCompareString.Text=Medications.GetNameOnly(FormM.SelectedMedicationNum);
					break;
				case 3://LabResult
					FormLoincs FormL=new FormLoincs();
					FormL.IsSelectionMode=true;
					FormL.ShowDialog();
					if(FormL.DialogResult!=DialogResult.OK) {
						return;
					}
					textCompareString.Text=FormL.SelectedLoinc.LoincCode;
					comboUnits.Text=FormL.SelectedLoinc.UnitsUCUM;//may be valued, may be blank.
					break;
				case 4://Gender
					//Not visible
					break;
				case 5://Comm preference
					FormCommPrefPicker FormCPP = new FormCommPrefPicker();
					FormCPP.ShowDialog();
					if(FormCPP.DialogResult!=DialogResult.OK) {
						return;
					}
					textCompareString.Text=Enum.GetName(typeof(ContactMethod),FormCPP.ContMethCur);
					break;
				case 6://Alergy
					FormAllergySetup FormAS=new FormAllergySetup();
					FormAS.IsSelectionMode=true;
					FormAS.ShowDialog();
					if(FormAS.DialogResult!=DialogResult.OK) {
						return;
					}
					textCompareString.Text=AllergyDefs.GetDescription(FormAS.SelectedAllergyDefNum);
					break;
				default://should never happen
					break;
			}
		}
Пример #17
0
		private void butAdd_Click(object sender, System.EventArgs e) {
			//select medication from list.  Additional meds can be added to the list from within that dlg
			FormMedications FormM=new FormMedications();
			FormM.IsSelectionMode=true;
			FormM.ShowDialog();
			if(FormM.DialogResult!=DialogResult.OK){
				return;
			} 
			if(CDSPermissions.GetForUser(Security.CurUser.UserNum).ShowCDS && CDSPermissions.GetForUser(Security.CurUser.UserNum).MedicationCDS) {
				FormCDSIntervention FormCDSI=new FormCDSIntervention();
				FormCDSI.ListCDSI=EhrTriggers.TriggerMatch(Medications.GetMedication(FormM.SelectedMedicationNum),PatCur);
				FormCDSI.ShowIfRequired();
				if(FormCDSI.DialogResult==DialogResult.Abort) {
					return;//do not add medication
				}
			}
			MedicationPat MedicationPatCur=new MedicationPat();
			MedicationPatCur.PatNum=PatCur.PatNum;
			MedicationPatCur.MedicationNum=FormM.SelectedMedicationNum;
			MedicationPatCur.RxCui=Medications.GetMedication(FormM.SelectedMedicationNum).RxCui;
			MedicationPatCur.ProvNum=PatCur.PriProv;
			FormMedPat FormMP=new FormMedPat();
			FormMP.MedicationPatCur=MedicationPatCur;
			FormMP.IsNew=true;
			FormMP.ShowDialog();
			if(FormMP.DialogResult!=DialogResult.OK){
				return;
			}
			FillMeds();
		}
        private void butPicker_Click(object sender, EventArgs e)
        {
            switch (listRestriction.SelectedIndex)
            {
            case 0:                    //Birthdate
                //Not visible
                break;

            case 1:                    //problem
                if (sender.Equals(butPicker))
                {
                    FormIcd9s FormI9 = new FormIcd9s();
                    FormI9.IsSelectionMode = true;
                    FormI9.ShowDialog();
                    if (FormI9.DialogResult != DialogResult.OK)
                    {
                        return;
                    }
                    textCompareString.Text = FormI9.SelectedIcd9.ICD9Code;
                    textSNOMED.Text        = "";
                }
                else if (sender.Equals(butSNOMED))
                {
                    FormSnomeds FormS = new FormSnomeds();
                    FormS.IsSelectionMode = true;
                    FormS.ShowDialog();
                    if (FormS.DialogResult != DialogResult.OK)
                    {
                        return;
                    }
                    textSNOMED.Text        = FormS.SelectedSnomed.SnomedCode;
                    textCompareString.Text = "";
                }
                break;

            case 2:                    //Medication
                FormMedications FormM = new FormMedications();
                FormM.IsSelectionMode = true;
                FormM.ShowDialog();
                if (FormM.DialogResult != DialogResult.OK)
                {
                    return;
                }
                textCompareString.Text = Medications.GetNameOnly(FormM.SelectedMedicationNum);
                break;

            case 3:                    //LabResult
                //Not visible
                break;

            case 4:                    //Gender
                //Not visible
                break;

            case 5:                    //Comm preference
                FormCommPrefPicker FormCPP = new FormCommPrefPicker();
                FormCPP.ShowDialog();
                if (FormCPP.DialogResult != DialogResult.OK)
                {
                    return;
                }
                textCompareString.Text = Enum.GetName(typeof(ContactMethod), FormCPP.ContMethCur);
                break;

            case 6:                    //Alergy
                FormAllergySetup FormAS = new FormAllergySetup();
                FormAS.IsSelectionMode = true;
                FormAS.ShowDialog();
                if (FormAS.DialogResult != DialogResult.OK)
                {
                    return;
                }
                textCompareString.Text = AllergyDefs.GetDescription(FormAS.SelectedAllergyDefNum);
                break;

            default:                    //should never happen
                break;
            }
        }
Пример #19
0
		private void butMedicationsIndicateNone_Click(object sender,EventArgs e) {
			FormMedications formM=new FormMedications();
			formM.IsSelectionMode=true;
			formM.ShowDialog();
			if(formM.DialogResult!=DialogResult.OK) {
				return;
			}
			if(Prefs.UpdateLong(PrefName.MedicationsIndicateNone,formM.SelectedMedicationNum)) {
				_changed=true;
			}
			textMedicationsIndicateNone.Text=Medications.GetDescription(formM.SelectedMedicationNum);
		}
Пример #20
0
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			if(e.Col!=3) {
				return;
			}
			if(Rows[e.Row].IsSeparator) {
				return;
			}
			if(!IsEditable(Rows[e.Row])){
				return;
			}
			if(Rows[e.Row].FieldName=="referredFrom") {
				FormReferralSelect formRS=new FormReferralSelect();
				formRS.IsSelectionMode=true;
				formRS.ShowDialog();
				if(formRS.DialogResult!=DialogResult.OK) {
					return;
				}
				Referral referralSelected=formRS.SelectedReferral;
				Rows[e.Row].DoImport=true;
				Rows[e.Row].IsFlaggedImp=false;
				Rows[e.Row].ImpValDisplay=referralSelected.GetNameFL();
				Rows[e.Row].ImpValObj=referralSelected;
			}
			#region string
			else if(Rows[e.Row].ObjType==typeof(string)) {
				InputBox inputbox=new InputBox(Rows[e.Row].FieldName);
				inputbox.textResult.Text=Rows[e.Row].ImpValDisplay;
				inputbox.ShowDialog();
				if(inputbox.DialogResult!=DialogResult.OK) {
					return;
				}
				if(Rows[e.Row].FieldName=="addressAndHmPhoneIsSameEntireFamily") {
					if(inputbox.textResult.Text=="") {
						AddressSameForFam=false;
					}
					else if(inputbox.textResult.Text!="X") {
						AddressSameForFam=true;
					}
					else {
						MsgBox.Show(this,"The only allowed values are X or blank.");
						return;
					}
				}
				if(Rows[e.Row].OldValDisplay==inputbox.textResult.Text) {//value is now same as original
					Rows[e.Row].DoImport=false;
				}
				else {
					Rows[e.Row].DoImport=true;
				}
				Rows[e.Row].ImpValDisplay=inputbox.textResult.Text;
				Rows[e.Row].ImpValObj=inputbox.textResult.Text;
			}
			#endregion
			#region Enum
			else if(Rows[e.Row].ObjType.IsEnum) {
				//Note.  This only works for zero-indexed enums.
				FormSheetImportEnumPicker formEnum=new FormSheetImportEnumPicker(Rows[e.Row].FieldName);
				for(int i=0;i<Enum.GetNames(Rows[e.Row].ObjType).Length;i++) {
					formEnum.listResult.Items.Add(Enum.GetNames(Rows[e.Row].ObjType)[i]);
					if(Rows[e.Row].ImpValObj!=null && i==(int)Rows[e.Row].ImpValObj) {
						formEnum.listResult.SelectedIndex=i;
					}
				}
				formEnum.ShowDialog();
				if(formEnum.DialogResult==DialogResult.OK) {
					int selectedI=formEnum.listResult.SelectedIndex;
					if(Rows[e.Row].ImpValObj==null) {//was initially null
						if(selectedI!=-1) {//an item was selected
							Rows[e.Row].ImpValObj=Enum.ToObject(Rows[e.Row].ObjType,selectedI);
							Rows[e.Row].ImpValDisplay=Rows[e.Row].ImpValObj.ToString();
						}
					}
					else {//was not initially null
						if((int)Rows[e.Row].ImpValObj!=selectedI) {//value was changed.
							//There's no way for the user to set it to null, so we do not need to test that
							Rows[e.Row].ImpValObj=Enum.ToObject(Rows[e.Row].ObjType,selectedI);
							Rows[e.Row].ImpValDisplay=Rows[e.Row].ImpValObj.ToString();
						}
					}
					if(selectedI==-1) {
						Rows[e.Row].DoImport=false;//impossible to import a null
					}
					else if(Rows[e.Row].OldValObj!=null && (int)Rows[e.Row].ImpValObj==(int)Rows[e.Row].OldValObj) {//it's the old setting for the patient, whether or not they actually changed it.
						Rows[e.Row].DoImport=false;//so no need to import
					}
					else {
						Rows[e.Row].DoImport=true;
					}
				}
			}
			#endregion
			#region DateTime
			else if(Rows[e.Row].ObjType==typeof(DateTime)) {//this is only for one field so far: Birthdate
				InputBox inputbox=new InputBox(Rows[e.Row].FieldName);
				inputbox.textResult.Text=Rows[e.Row].ImpValDisplay;
				inputbox.ShowDialog();
				if(inputbox.DialogResult!=DialogResult.OK) {
					return;
				}
				DateTime enteredDate;
				if(inputbox.textResult.Text=="") {
					enteredDate=DateTime.MinValue;
					Rows[e.Row].ImpValObj=enteredDate;
					Rows[e.Row].ImpValDisplay="";
				}
				else {
					try {
						enteredDate=DateTime.Parse(inputbox.textResult.Text);
					}
					catch {
						MsgBox.Show(this,"Invalid date");
						return;
					}
					if(enteredDate.Year<1880 || enteredDate.Year>2050) {
						MsgBox.Show(this,"Invalid date");
						return;
					}
					Rows[e.Row].ImpValObj=enteredDate;
					Rows[e.Row].ImpValDisplay=enteredDate.ToShortDateString();
				}
				if(Rows[e.Row].ImpValDisplay==Rows[e.Row].OldValDisplay) {//value is now same as original
					Rows[e.Row].DoImport=false;
				}
				else {
					Rows[e.Row].DoImport=true;
				}
			}
			#endregion
			#region Medication, Allergy or Disease
			else if(Rows[e.Row].ObjType==typeof(MedicationPat)
				|| Rows[e.Row].ObjType==typeof(Allergy)
				|| Rows[e.Row].ObjType==typeof(Disease)) 
			{
				//User entered medications will have a MedicationNum as the ImpValObj.
				if(Rows[e.Row].ImpValObj.GetType()==typeof(long)) {
					FormMedications FormM=new FormMedications();
					FormM.IsSelectionMode=true;
					FormM.textSearch.Text=Rows[e.Row].FieldName;
					FormM.ShowDialog();
					if(FormM.DialogResult!=DialogResult.OK) {
						return;
					}
					Rows[e.Row].ImpValDisplay="Y";
					Rows[e.Row].ImpValObj=FormM.SelectedMedicationNum;
					string descript=Medications.GetDescription(FormM.SelectedMedicationNum);
					Rows[e.Row].FieldDisplay=descript;
					((SheetField)Rows[e.Row].NewValObj).FieldValue=descript;
					Rows[e.Row].NewValDisplay="Y";
					Rows[e.Row].DoImport=true;
					Rows[e.Row].IsFlaggedImp=false;
				}
				else {
					FormSheetImportEnumPicker FormIEP=new FormSheetImportEnumPicker(Rows[e.Row].FieldName);
					for(int i=0;i<Enum.GetNames(typeof(YN)).Length;i++) {
						FormIEP.listResult.Items.Add(Enum.GetNames(typeof(YN))[i]);
					}
					FormIEP.listResult.SelectedIndex=0;//Unknown
					if(Rows[e.Row].ImpValDisplay=="Y") {
						FormIEP.listResult.SelectedIndex=1;
					}
					if(Rows[e.Row].ImpValDisplay=="N") {
						FormIEP.listResult.SelectedIndex=2;
					}
					FormIEP.ShowDialog();
					if(FormIEP.DialogResult!=DialogResult.OK) {
						return;
					}
					int selectedI=FormIEP.listResult.SelectedIndex;
					switch(selectedI) {
						case 0:
							Rows[e.Row].ImpValDisplay="";
							break;
						case 1:
							Rows[e.Row].ImpValDisplay="Y";
							break;
						case 2:
							Rows[e.Row].ImpValDisplay="N";
							break;
					}
					if(Rows[e.Row].OldValDisplay==Rows[e.Row].ImpValDisplay) {//value is now same as original
						Rows[e.Row].DoImport=false;
					}
					else {
						Rows[e.Row].DoImport=true;
					}
					if(selectedI==-1 || selectedI==0) {
						Rows[e.Row].DoImport=false;
					}
				}
			}
			#endregion
			#region Subscriber
			else if(Rows[e.Row].ObjType==typeof(Patient)) {
				Patient subscriber=new Patient();
				FormSubscriberSelect FormSS=new FormSubscriberSelect(Fam);
				FormSS.ShowDialog();
				if(FormSS.DialogResult!=DialogResult.OK) {
					return;
				}
				subscriber=Patients.GetPat(FormSS.SelectedPatNum);
				if(subscriber==null) {
					return;//Should never happen but is a possibility.
				}
				//Use GetNameFirst() because this is how OldValDisplay is displayed.
				string patName=Patients.GetNameFirst(subscriber.FName,subscriber.Preferred);
				if(Rows[e.Row].OldValDisplay==patName) {
					Rows[e.Row].DoImport=false;
				}
				else {
					Rows[e.Row].DoImport=true;
				}
				Rows[e.Row].ImpValDisplay=patName;
				Rows[e.Row].ImpValObj=subscriber;
			}
			#endregion
			#region Carrier
			else if(Rows[e.Row].ObjType==typeof(Carrier)) {
				//Change both carrier rows at the same time.
				string insStr="ins1";
				if(Rows[e.Row].FieldName.StartsWith("ins2")) {
					insStr="ins2";
				}
				SheetImportRow carrierNameRow=GetImportRowByFieldName(insStr+"CarrierName");
				SheetImportRow carrierPhoneRow=GetImportRowByFieldName(insStr+"CarrierPhone");
				Carrier carrier=new Carrier();
				FormCarriers FormC=new FormCarriers();
				FormC.IsSelectMode=true;
				if(carrierNameRow!=null) {
					FormC.textCarrier.Text=carrierNameRow.NewValDisplay;
				}
				if(carrierPhoneRow!=null) {
					FormC.textPhone.Text=carrierPhoneRow.NewValDisplay;
				}
				FormC.ShowDialog();
				if(FormC.DialogResult!=DialogResult.OK) {
					return;
				}
				carrier=FormC.SelectedCarrier;
				//Check for nulls because the name AND phone rows might not both be on the sheet.
				if(carrierNameRow!=null) {
					if(carrierNameRow.OldValDisplay==carrier.CarrierName) {
						carrierNameRow.DoImport=false;
					}
					else {
						carrierNameRow.DoImport=true;
					}
					carrierNameRow.ImpValDisplay=carrier.CarrierName;
					carrierNameRow.ImpValObj=carrier;
				}
				if(carrierPhoneRow!=null) {
					if(carrierPhoneRow.OldValDisplay==carrier.Phone) {
						carrierPhoneRow.DoImport=false;
					}
					else {
						carrierPhoneRow.DoImport=true;
					}
					carrierPhoneRow.ImpValDisplay=carrier.Phone;
					carrierPhoneRow.ImpValObj=carrier;
				}
			}
			#endregion
			FillGrid();
		}
Пример #21
0
 private void Tool_EHR_Click(bool onLoadShowOrders)
 {
     #if EHRTEST
         //so we can step through for debugging.
     /*
         EhrQuarterlyKey keyThisQ=EhrQuarterlyKeys.GetKeyThisQuarter();
         if(keyThisQ==null) {
             MessageBox.Show("No quarterly key entered for this quarter.");
             return;
         }
         if(!((FormEHR)FormOpenDental.FormEHR).QuarterlyKeyIsValid((DateTime.Today.Year-2000).ToString(),EhrQuarterlyKeys.MonthToQuarter(DateTime.Today.Month).ToString(),
             PrefC.GetString(PrefName.PracticeTitle),keyThisQ.KeyValue)) {
             MessageBox.Show("Invalid quarterly key.");
             return;
         }
     */
         ((FormEHR)FormOpenDental.FormEHR).PatNum=PatCur.PatNum;
         ((FormEHR)FormOpenDental.FormEHR).OnShowLaunchOrders=onLoadShowOrders;
         ((FormEHR)FormOpenDental.FormEHR).ShowDialog();
         if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.None) {
             //return;
         }
         if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.RxEdit) {
             FormRxEdit FormRXE=new FormRxEdit(PatCur,RxPats.GetRx(((FormEHR)FormOpenDental.FormEHR).LaunchRxNum));
             FormRXE.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);//recursive.  The only way out of the loop is EhrFormResult.None.
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.RxSelect) {
             FormRxSelect FormRS=new FormRxSelect(PatCur);
             FormRS.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.Medical) {
             FormMedical formM=new FormMedical(PatientNoteCur,PatCur);
             formM.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.PatientEdit) {
             FormPatientEdit formP=new FormPatientEdit(PatCur,FamCur);
             formP.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.Online) {
             FormEhrOnlineAccess formO=new FormEhrOnlineAccess();
             formO.PatCur=PatCur;
             formO.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.MedReconcile) {
             FormMedicationReconcile FormMR=new FormMedicationReconcile();
             FormMR.PatCur=PatCur;
             FormMR.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.Referrals) {
             FormReferralsPatient formRP=new FormReferralsPatient();
             formRP.PatNum=PatCur.PatNum;
             formRP.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.MedicationPatEdit) {
             FormMedPat formMP=new FormMedPat();
             formMP.MedicationPatCur=MedicationPats.GetOne(((FormEHR)FormOpenDental.FormEHR).LaunchMedicationPatNum);
             formMP.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(true);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.MedicationPatNew) {
             //This cannot happen unless a provider is logged in with a valid ehr key
             FormMedications FormM=new FormMedications();
             FormM.IsSelectionMode=true;
             FormM.ShowDialog();
             if(FormM.DialogResult==DialogResult.OK) {
                 Medication med=Medications.GetMedicationFromDb(FormM.SelectedMedicationNum);
                 if(med.RxCui==0 //if the med has no Cui, it won't trigger an alert
                     || RxAlertL.DisplayAlerts(PatCur.PatNum,med.RxCui,0))//user sees alert and wants to continue
                 {
                     MedicationPat medicationPat=new MedicationPat();
                     medicationPat.PatNum=PatCur.PatNum;
                     medicationPat.MedicationNum=FormM.SelectedMedicationNum;
                     medicationPat.ProvNum=Security.CurUser.ProvNum;
                     medicationPat.DateStart=DateTime.Today;
                     FormMedPat FormMP=new FormMedPat();
                     FormMP.MedicationPatCur=medicationPat;
                     FormMP.IsNew=true;
                     FormMP.IsNewMedOrder=true;
                     FormMP.ShowDialog();
                     if(FormMP.DialogResult==DialogResult.OK) {
                         ModuleSelected(PatCur.PatNum);
                     }
                 }
             }
             Tool_EHR_Click(true);
         }
     #else
         Type type=FormOpenDental.AssemblyEHR.GetType("EHR.FormEHR");//namespace.class
         object[] args;
         EhrQuarterlyKey keyThisQ=EhrQuarterlyKeys.GetKeyThisQuarter();
         if(keyThisQ==null) {
             MessageBox.Show("No quarterly key entered for this quarter.");
             return;
         }
         args=new object[] { (DateTime.Today.Year-2000).ToString(),EhrQuarterlyKeys.MonthToQuarter(DateTime.Today.Month).ToString(),
             PrefC.GetString(PrefName.PracticeTitle),keyThisQ.KeyValue };
         if(!(bool)type.InvokeMember("QuarterlyKeyIsValid",System.Reflection.BindingFlags.InvokeMethod,null,FormOpenDental.FormEHR,args)) {
             MessageBox.Show("Invalid quarterly key.");
             return;
         }
         args=new object[] {PatCur.PatNum};
         type.InvokeMember("PatNum",System.Reflection.BindingFlags.SetField,null,FormOpenDental.FormEHR,args);
         type.InvokeMember("ShowDialog",System.Reflection.BindingFlags.InvokeMethod,null,FormOpenDental.FormEHR,null);
         if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.None) {
             return;
         }
         if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.RxEdit) {
             long launchRxNum=(long)type.InvokeMember("LaunchRxNum",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null);
             FormRxEdit FormRXE=new FormRxEdit(PatCur,RxPats.GetRx(launchRxNum));
             FormRXE.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.RxSelect) {
             FormRxSelect FormRS=new FormRxSelect(PatCur);
             FormRS.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.Medical) {
             FormMedical formM=new FormMedical(PatientNoteCur,PatCur);
             formM.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.PatientEdit) {
             FormPatientEdit formP=new FormPatientEdit(PatCur,FamCur);
             formP.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.Online) {
             FormEhrOnlineAccess formO=new FormEhrOnlineAccess();
             formO.PatCur=PatCur;
             formO.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.MedReconcile) {
             FormMedicationReconcile FormMR=new FormMedicationReconcile();
             FormMR.PatCur=PatCur;
             FormMR.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.Referrals) {
             FormReferralsPatient formRP=new FormReferralsPatient();
             formRP.PatNum=PatCur.PatNum;
             formRP.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.MedicationPatEdit) {
             long medicationPatNum=(long)type.InvokeMember("LaunchMedicationPatNum",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null);
             FormMedPat formMP=new FormMedPat();
             formMP.MedicationPatCur=MedicationPats.GetOne(medicationPatNum);
             formMP.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(true);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.MedicationPatNew) {
             //This cannot happen unless a provider is logged in with a valid ehr key
             FormMedications FormM=new FormMedications();
             FormM.IsSelectionMode=true;
             FormM.ShowDialog();
             if(FormM.DialogResult==DialogResult.OK) {
                 Medication med=Medications.GetMedicationFromDb(FormM.SelectedMedicationNum);
                 if(med.RxCui==0 //if the med has no Cui, it won't trigger an alert
                     || RxAlertL.DisplayAlerts(PatCur.PatNum,med.RxCui,0))//user sees alert and wants to continue
                 {
                     MedicationPat medicationPat=new MedicationPat();
                     medicationPat.PatNum=PatCur.PatNum;
                     medicationPat.MedicationNum=FormM.SelectedMedicationNum;
                     medicationPat.ProvNum=Security.CurUser.ProvNum;
                     FormMedPat FormMP=new FormMedPat();
                     FormMP.MedicationPatCur=medicationPat;
                     FormMP.IsNew=true;
                     FormMP.ShowDialog();
                     if(FormMP.DialogResult==DialogResult.OK) {
                         ModuleSelected(PatCur.PatNum);
                     }
                 }
             }
             Tool_EHR_Click(true);
         }
     #endif
 }