Esempio n. 1
0
        private void FormVaccinePatEdit_Load(object sender, EventArgs e)
        {
            Patient pat = Patients.GetLim(VaccinePatCur.PatNum);

            if (pat.Age != 0 && pat.Age < 3)
            {
                labelDocument.Text = "Document reason not given below.  Reason can include a contraindication due to a specific allergy, adverse effect, intollerance, or specific disease.";              //less leeway with reasons for kids.
            }
            _listVaccineDefs = VaccineDefs.GetDeepCopy();
            comboVaccine.Items.Clear();
            for (int i = 0; i < _listVaccineDefs.Count; i++)
            {
                comboVaccine.Items.Add(_listVaccineDefs[i].CVXCode + " - " + _listVaccineDefs[i].VaccineName);
                if (_listVaccineDefs[i].VaccineDefNum == VaccinePatCur.VaccineDefNum)
                {
                    comboVaccine.SelectedIndex = i;
                }
            }
            if (!IsNew && VaccinePatCur.VaccineDefNum != 0)
            {
                VaccineDef       vaccineDef   = VaccineDefs.GetOne(VaccinePatCur.VaccineDefNum);      //Need vaccine to get manufacturer.
                DrugManufacturer manufacturer = DrugManufacturers.GetOne(vaccineDef.DrugManufacturerNum);
                textManufacturer.Text = manufacturer.ManufacturerCode + " - " + manufacturer.ManufacturerName;
            }
            if (VaccinePatCur.DateTimeStart.Year > 1880)
            {
                textDateTimeStart.Text = VaccinePatCur.DateTimeStart.ToString();
            }
            if (VaccinePatCur.DateTimeEnd.Year > 1880)
            {
                textDateTimeStop.Text = VaccinePatCur.DateTimeEnd.ToString();
            }
            if (VaccinePatCur.AdministeredAmt != 0)
            {
                textAmount.Text = VaccinePatCur.AdministeredAmt.ToString();
            }
            _listDrugUnits = DrugUnits.GetDeepCopy();
            comboUnits.Items.Clear();
            comboUnits.Items.Add("none");
            comboUnits.SelectedIndex = 0;
            for (int i = 0; i < _listDrugUnits.Count; i++)
            {
                comboUnits.Items.Add(_listDrugUnits[i].UnitIdentifier);
                if (_listDrugUnits[i].DrugUnitNum == VaccinePatCur.DrugUnitNum)
                {
                    comboUnits.SelectedIndex = i + 1;
                }
            }
            textLotNum.Text = VaccinePatCur.LotNumber;
            if (VaccinePatCur.DateExpire.Year > 1880)
            {
                textDateExpiration.Text = VaccinePatCur.DateExpire.ToShortDateString();
            }
            listRefusalReason.Items.Clear();
            string[] arrayVaccineRefusalReasons = Enum.GetNames(typeof(VaccineRefusalReason));
            for (int i = 0; i < arrayVaccineRefusalReasons.Length; i++)
            {
                listRefusalReason.Items.Add(arrayVaccineRefusalReasons[i]);
                VaccineRefusalReason refusalReason = (VaccineRefusalReason)i;
                if (refusalReason == VaccinePatCur.RefusalReason)
                {
                    listRefusalReason.SelectedIndex = i;
                }
            }
            listCompletionStatus.Items.Clear();
            string[] arrayCompletionStatuses = Enum.GetNames(typeof(VaccineCompletionStatus));
            for (int i = 0; i < arrayCompletionStatuses.Length; i++)
            {
                listCompletionStatus.Items.Add(arrayCompletionStatuses[i]);
                VaccineCompletionStatus completionStatus = (VaccineCompletionStatus)i;
                if (completionStatus == VaccinePatCur.CompletionStatus)
                {
                    listCompletionStatus.SelectedIndex = i;
                }
            }
            textNote.Text = VaccinePatCur.Note;
            if (IsNew)
            {
                if (pat.ClinicNum == 0)
                {
                    VaccinePatCur.FilledCity = PrefC.GetString(PrefName.PracticeCity);
                    VaccinePatCur.FilledST   = PrefC.GetString(PrefName.PracticeST);
                }
                else
                {
                    Clinic clinic = Clinics.GetClinic(pat.ClinicNum);
                    VaccinePatCur.FilledCity = clinic.City;
                    VaccinePatCur.FilledST   = clinic.State;
                }
            }
            textFilledCity.Text = VaccinePatCur.FilledCity;
            textFilledSt.Text   = VaccinePatCur.FilledST;
            if (IsNew)
            {
                VaccinePatCur.UserNum = Security.CurUser.UserNum;
            }
            Userod user = Userods.GetUser(VaccinePatCur.UserNum);

            if (user != null)           //Will be null for vaccines entered in older versions, before the UserNum column was created.
            {
                textUser.Text = user.UserName;
            }
            _provNumSelectedOrdering = VaccinePatCur.ProvNumOrdering;
            comboProvNumOrdering.Items.Clear();
            _listProviders = Providers.GetDeepCopy(true);
            for (int i = 0; i < _listProviders.Count; i++)
            {
                comboProvNumOrdering.Items.Add(_listProviders[i].GetLongDesc());                //Only visible provs added to combobox.
                if (_listProviders[i].ProvNum == VaccinePatCur.ProvNumOrdering)
                {
                    comboProvNumOrdering.SelectedIndex = i;                  //Sets combo text too.
                }
            }
            if (comboProvNumOrdering.SelectedIndex == -1)                                    //The provider exists but is hidden
            {
                comboProvNumOrdering.Text = Providers.GetLongDesc(_provNumSelectedOrdering); //Appends "(hidden)" to the end of the long description.
            }
            _provNumSelectedAdministering = VaccinePatCur.ProvNumAdminister;
            comboProvNumAdministering.Items.Clear();
            for (int i = 0; i < _listProviders.Count; i++)
            {
                comboProvNumAdministering.Items.Add(_listProviders[i].GetLongDesc());                //Only visible provs added to combobox.
                if (_listProviders[i].ProvNum == VaccinePatCur.ProvNumAdminister)
                {
                    comboProvNumAdministering.SelectedIndex = i;                  //Sets combo text too.
                }
            }
            if (comboProvNumAdministering.SelectedIndex == -1)                                         //The provider exists but is hidden
            {
                comboProvNumAdministering.Text = Providers.GetLongDesc(_provNumSelectedAdministering); //Appends "(hidden)" to the end of the long description.
            }
            comboAdministrationRoute.Items.Clear();
            string[] arrayVaccineAdministrationRoutes = Enum.GetNames(typeof(VaccineAdministrationRoute));
            for (int i = 0; i < arrayVaccineAdministrationRoutes.Length; i++)
            {
                comboAdministrationRoute.Items.Add(arrayVaccineAdministrationRoutes[i]);
                VaccineAdministrationRoute administrationRoute = (VaccineAdministrationRoute)i;
                if (administrationRoute == VaccinePatCur.AdministrationRoute)
                {
                    comboAdministrationRoute.SelectedIndex = i;
                }
            }
            comboAdministrationSite.Items.Clear();
            string[] arrayVaccineAdministrationSites = Enum.GetNames(typeof(VaccineAdministrationSite));
            for (int i = 0; i < arrayVaccineAdministrationSites.Length; i++)
            {
                comboAdministrationSite.Items.Add(arrayVaccineAdministrationSites[i]);
                VaccineAdministrationSite administrationSite = (VaccineAdministrationSite)i;
                if (administrationSite == VaccinePatCur.AdministrationSite)
                {
                    comboAdministrationSite.SelectedIndex = i;
                }
            }
            listAdministrationNote.Items.Clear();
            string[] arrayAdministrationNotes = Enum.GetNames(typeof(VaccineAdministrationNote));
            for (int i = 0; i < arrayAdministrationNotes.Length; i++)
            {
                listAdministrationNote.Items.Add(arrayAdministrationNotes[i]);
                VaccineAdministrationNote administrationNote = (VaccineAdministrationNote)i;
                if (administrationNote == VaccinePatCur.AdministrationNoteCode)
                {
                    listAdministrationNote.SelectedIndex = i;
                }
            }
            listAction.Items.Clear();
            string[] arrayVaccineActions = Enum.GetNames(typeof(VaccineAction));
            for (int i = 0; i < arrayVaccineActions.Length; i++)
            {
                listAction.Items.Add(arrayVaccineActions[i]);
                VaccineAction action = (VaccineAction)i;
                if (action == VaccinePatCur.ActionCode)
                {
                    listAction.SelectedIndex = i;
                }
            }
            _listVaccineObservations = VaccineObses.GetForVaccine(VaccinePatCur.VaccinePatNum);
            FillObservations();
        }