コード例 #1
0
        private void FillProblems()
        {
            DiseaseList = Diseases.Refresh(PatCur.PatNum);
            gridDiseases.BeginUpdate();
            gridDiseases.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableDiseases", "Name"), 140);        //total is about 325

            gridDiseases.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDiseases", "Patient Note"), 145);
            gridDiseases.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDisease", "Status"), 40);
            gridDiseases.Columns.Add(col);
            gridDiseases.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < DiseaseList.Count; i++)
            {
                row = new ODGridRow();
                if (DiseaseList[i].DiseaseDefNum != 0)
                {
                    row.Cells.Add(DiseaseDefs.GetName(DiseaseList[i].DiseaseDefNum));
                }
                else
                {
                    row.Cells.Add(ICD9s.GetDescription(DiseaseList[i].ICD9Num));
                }
                row.Cells.Add(DiseaseList[i].PatNote);
                row.Cells.Add(DiseaseList[i].ProbStatus.ToString());
                gridDiseases.Rows.Add(row);
            }
            gridDiseases.EndUpdate();
        }
コード例 #2
0
        private void menuItemMedical_Click(object sender, EventArgs e)
        {
            if (gridMain.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select a terminal first.");
                return;
            }
            TerminalActive terminal = TerminalList[gridMain.GetSelectedIndex()].Copy();

            if (terminal.TerminalStatus == TerminalStatusEnum.Standby)
            {
                MsgBox.Show(this, "Please load a patient onto this terminal first.");
                return;
            }
            //See if the selected patient already has diseases attached
            Disease[] DiseaseList = Diseases.Refresh(terminal.PatNum);
            if (DiseaseList.Length > 0)
            {
                MsgBox.Show(this, "This patient already has diseases attached.  This function is only intended for new patients.  Patient cannot be loaded.");
                return;
            }
            //See if the selected patient already has questions attached

            /*if(Questions.PatHasQuest(terminal.PatNum)) {
             *      MsgBox.Show(this,"This patient already has questions attached.  This function is only intended for new patients.  Patient cannot be loaded.");
             *      return;
             * }*/
            if (!MsgBox.Show(this, true, "A patient is currently using the terminal.  If you continue, they will lose the information that is on their screen.  Continue anyway?"))
            {
                return;
            }
            terminal.TerminalStatus = TerminalStatusEnum.Medical;
            TerminalActives.Update(terminal);
            FillGrid();
        }
コード例 #3
0
        private void butDelete_Click(object sender, EventArgs e)
        {
            if (IsNew)
            {
                //This code is never hit in current implementation 09/26/2013.
                DialogResult = DialogResult.Cancel;
                return;
            }
            List <Vitalsign> listVitals = Vitalsigns.GetListFromPregDiseaseNum(DiseaseCur.DiseaseNum);

            if (listVitals.Count > 0)           //if attached to vital sign exam, block delete
            {
                string dates = "";
                for (int i = 0; i < listVitals.Count; i++)
                {
                    if (i > 5)
                    {
                        break;
                    }
                    dates += "\r\n" + listVitals[i].DateTaken.ToShortDateString();
                }
                MsgBox.Show(this, "Not allowed to delete this problem.  It is attached to " + listVitals.Count.ToString() + "vital sign exams with dates including:" + dates + ".");
                return;
            }
            else
            {
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete?"))
                {
                    return;
                }
            }
            SecurityLogs.MakeLogEntry(Permissions.PatProblemListEdit, DiseaseCur.PatNum, DiseaseDefs.GetName(DiseaseCur.DiseaseDefNum) + " deleted");
            Diseases.Delete(DiseaseCur);
            DialogResult = DialogResult.OK;
        }
コード例 #4
0
ファイル: AutomationL.cs プロジェクト: ChemBrain/OpenDental
        private static bool ProblemComparison(AutomationCondition autoCond, long patNum)
        {
            List <Disease> problemList = Diseases.Refresh(patNum, true);

            switch (autoCond.Comparison)             //Find out what operand to use.
            {
            case AutoCondComparison.Equals:
                for (int i = 0; i < problemList.Count; i++)                   //Includes hidden
                {
                    if (DiseaseDefs.GetName(problemList[i].DiseaseDefNum) == autoCond.CompareString)
                    {
                        return(true);
                    }
                }
                break;

            case AutoCondComparison.Contains:
                for (int i = 0; i < problemList.Count; i++)
                {
                    if (DiseaseDefs.GetName(problemList[i].DiseaseDefNum).ToLower().Contains(autoCond.CompareString.ToLower()))
                    {
                        return(true);
                    }
                }
                break;
            }
            return(false);
        }
コード例 #5
0
        private void RxSelected()
        {
            if (gridMain.GetSelectedIndex() == -1)
            {
                //this should never happen
                return;
            }
            RxDef RxDefCur = RxDefList[gridMain.GetSelectedIndex()];

            //Alert
            RxAlert[] alertList = RxAlerts.Refresh(RxDefCur.RxDefNum);
            Disease[] diseases  = Diseases.Refresh(PatCur.PatNum);
            ArrayList matchAL   = new ArrayList();

            for (int i = 0; i < alertList.Length; i++)
            {
                for (int j = 0; j < diseases.Length; j++)
                {
                    if (alertList[i].DiseaseDefNum == diseases[j].DiseaseDefNum)
                    {
                        matchAL.Add(DiseaseDefs.GetName(diseases[j].DiseaseDefNum));
                    }
                }
            }
            if (matchAL.Count > 0)
            {
                string alert = Lan.g(this, "This patient has the following medical conditions or allergies:\r\n");
                for (int i = 0; i < matchAL.Count; i++)
                {
                    alert += "\r\n" + matchAL[i];
                }
                alert += "\r\n\r\n" + Lan.g(this, "Continue anyway?");
                if (MessageBox.Show(alert, "Alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK)
                {
                    return;
                }
            }
            //User OK with alert
            RxPat RxPatCur = new RxPat();

            RxPatCur.RxDate  = DateTime.Today;
            RxPatCur.PatNum  = PatCur.PatNum;
            RxPatCur.Drug    = RxDefCur.Drug;
            RxPatCur.Sig     = RxDefCur.Sig;
            RxPatCur.Disp    = RxDefCur.Disp;
            RxPatCur.Refills = RxDefCur.Refills;
            //Notes not copied: we don't want these kinds of notes cluttering things
            FormRxEdit FormE = new FormRxEdit(PatCur, RxPatCur);

            FormE.IsNew = true;
            FormE.ShowDialog();
            if (FormE.DialogResult != DialogResult.OK)
            {
                return;
            }
            DialogResult = DialogResult.OK;
        }
コード例 #6
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     Diseases.Delete(DiseaseCur);
     DialogResult = DialogResult.OK;
 }
コード例 #7
0
ファイル: FormDiseaseEdit.cs プロジェクト: nampn/ODental
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete?"))
     {
         return;
     }
     Diseases.Delete(DiseaseCur);
     DialogResult = DialogResult.OK;
 }
コード例 #8
0
 private void SaveAndClose()
 {
     DiseaseCur.DiseaseDefNum = DiseaseDefs.List[listMain.SelectedIndex].DiseaseDefNum;
     DiseaseCur.PatNote       = textNote.Text;
     if (IsNew)
     {
         Diseases.Insert(DiseaseCur);
     }
     else
     {
         Diseases.Update(DiseaseCur);
     }
     DialogResult = DialogResult.OK;
 }
コード例 #9
0
        private void butAddProblem_Click(object sender, EventArgs e)
        {
            FormDiseaseDefs formDD = new FormDiseaseDefs();

            formDD.IsSelectionMode = true;
            formDD.ShowDialog();
            if (formDD.DialogResult != DialogResult.OK)
            {
                return;
            }
            Disease disease = new Disease();

            disease.PatNum        = PatCur.PatNum;
            disease.DiseaseDefNum = formDD.SelectedDiseaseDefNum;
            Diseases.Insert(disease);
            FillProblems();
        }
コード例 #10
0
        private void butIcd9_Click(object sender, EventArgs e)
        {
            FormIcd9s formI = new FormIcd9s();

            formI.IsSelectionMode = true;
            formI.ShowDialog();
            if (formI.DialogResult != DialogResult.OK)
            {
                return;
            }
            Disease disease = new Disease();

            disease.PatNum  = PatCur.PatNum;
            disease.ICD9Num = formI.SelectedIcd9Num;
            Diseases.Insert(disease);
            FillProblems();
        }
コード例 #11
0
        private void FillDiseases()
        {
            DiseaseList = Diseases.Refresh(PatCur.PatNum);
            gridDiseases.BeginUpdate();
            gridDiseases.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableDiseases", "Name"), 180);        //total is about 385

            gridDiseases.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDiseases", "Patient Note"), 205);
            gridDiseases.Columns.Add(col);
            gridDiseases.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < DiseaseList.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(DiseaseDefs.GetName(DiseaseList[i].DiseaseDefNum));
                row.Cells.Add(DiseaseList[i].PatNote);
                gridDiseases.Rows.Add(row);
            }
            gridDiseases.EndUpdate();
        }
コード例 #12
0
ファイル: FormDiseaseEdit.cs プロジェクト: nampn/ODental
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
         textDateStop.errorProvider1.GetError(textDateStop) != "")
     {
         MsgBox.Show(this, "Please fix date.");
         return;
     }
     DiseaseCur.DateStart  = PIn.Date(textDateStart.Text);
     DiseaseCur.DateStop   = PIn.Date(textDateStop.Text);
     DiseaseCur.ProbStatus = (ProblemStatus)comboStatus.SelectedIndex;
     DiseaseCur.PatNote    = textNote.Text;
     //Todo: Save DateStop and DateStart values.
     if (IsNew)
     {
         Diseases.Insert(DiseaseCur);
     }
     else
     {
         Diseases.Update(DiseaseCur);
     }
     DialogResult = DialogResult.OK;
 }
コード例 #13
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (_listProblemReconcile.Count == 0)
            {
                if (!MsgBox.Show(this, true, "The reconcile list is empty which will cause all existing problems to be removed.  Continue?"))
                {
                    return;
                }
            }
            Disease    dis;
            DiseaseDef disD;
            bool       isActive;

            //Discontinue any current medications that are not present in the reconcile list.
            for (int i = 0; i < _listProblemCur.Count; i++)       //Start looping through all current problems
            {
                isActive = false;
                dis      = _listProblemCur[i];
                disD     = DiseaseDefs.GetItem(dis.DiseaseDefNum);
                for (int j = 0; j < _listProblemReconcile.Count; j++)           //Compare each reconcile problem to the current problem
                {
                    DiseaseDef disDR = DiseaseDefs.GetItem(_listProblemReconcile[j].DiseaseDefNum);
                    if (_listProblemReconcile[j].DiseaseDefNum == _listProblemCur[i].DiseaseDefNum)                   //Has identical DiseaseDefNums
                    {
                        isActive = true;
                        break;
                    }
                    if (disDR == null)
                    {
                        continue;
                    }
                    if (disDR.SnomedCode != "" && disDR.SnomedCode == disD.SnomedCode)                 //Has a Snomed code and they are equal
                    {
                        isActive = true;
                        break;
                    }
                }
                if (!isActive)                 //Update current problems.
                {
                    dis.ProbStatus = ProblemStatus.Inactive;
                    Diseases.Update(_listProblemCur[i]);
                }
            }
            //Always update every current problem for the patient so that DateTStamp reflects the last reconcile date.
            if (_listProblemCur.Count > 0)
            {
                Diseases.ResetTimeStamps(_patCur.PatNum, ProblemStatus.Active);
            }
            DiseaseDef disDU = null;
            int        index;

            for (int j = 0; j < _listProblemReconcile.Count; j++)
            {
                index = ListProblemNew.IndexOf(_listProblemReconcile[j]);
                if (index < 0)
                {
                    continue;
                }
                if (_listProblemReconcile[j] == ListProblemNew[index])
                {
                    disDU = DiseaseDefs.GetItem(DiseaseDefs.GetNumFromCode(ListProblemDefNew[index].SnomedCode));
                    if (disDU == null)
                    {
                        ListProblemNew[index].DiseaseDefNum = DiseaseDefs.Insert(ListProblemDefNew[index]);
                    }
                    else
                    {
                        ListProblemNew[index].DiseaseDefNum = disDU.DiseaseDefNum;
                    }
                    Diseases.Insert(ListProblemNew[index]);
                }
            }
            DataValid.SetInvalid(InvalidType.Diseases);
            //EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();
            //newMeasureEvent.DateTEvent=DateTime.Now;
            //newMeasureEvent.EventType=EhrMeasureEventType.ProblemReconcile;
            //newMeasureEvent.PatNum=PatCur.PatNum;
            //newMeasureEvent.MoreInfo="";
            //EhrMeasureEvents.Insert(newMeasureEvent);
            for (int inter = 0; inter < _listProblemReconcile.Count; inter++)
            {
                if (CDSPermissions.GetForUser(Security.CurUser.UserNum).ShowCDS&& CDSPermissions.GetForUser(Security.CurUser.UserNum).ProblemCDS)
                {
                    DiseaseDef          disDInter = DiseaseDefs.GetItem(_listProblemReconcile[inter].DiseaseDefNum);
                    FormCDSIntervention FormCDSI  = new FormCDSIntervention();
                    FormCDSI.ListCDSI = EhrTriggers.TriggerMatch(disDInter, _patCur);
                    FormCDSI.ShowIfRequired(false);
                }
            }
            DialogResult = DialogResult.OK;
        }
コード例 #14
0
        private void FillExistingGrid()
        {
            gridProbExisting.BeginUpdate();
            gridProbExisting.ListGridColumns.Clear();
            GridColumn col = new GridColumn("Last Modified", 100, HorizontalAlignment.Center);

            gridProbExisting.ListGridColumns.Add(col);
            col = new GridColumn("Date Start", 100, HorizontalAlignment.Center);
            gridProbExisting.ListGridColumns.Add(col);
            col = new GridColumn("Problem Name", 200);
            gridProbExisting.ListGridColumns.Add(col);
            col = new GridColumn("Status", 80, HorizontalAlignment.Center);
            gridProbExisting.ListGridColumns.Add(col);
            gridProbExisting.ListGridRows.Clear();
            _listProblemCur = Diseases.Refresh(_patCur.PatNum, true);
            List <long> problemDefNums = new List <long>();

            for (int h = 0; h < _listProblemCur.Count; h++)
            {
                if (_listProblemCur[h].DiseaseDefNum > 0)
                {
                    problemDefNums.Add(_listProblemCur[h].DiseaseDefNum);
                }
            }
            _listProblemDefCur = DiseaseDefs.GetMultDiseaseDefs(problemDefNums);
            GridRow    row;
            DiseaseDef disD;

            for (int i = 0; i < _listProblemCur.Count; i++)
            {
                row  = new GridRow();
                disD = new DiseaseDef();
                disD = DiseaseDefs.GetItem(_listProblemCur[i].DiseaseDefNum);
                row.Cells.Add(_listProblemCur[i].DateTStamp.ToShortDateString());
                if (_listProblemCur[i].DateStart.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(_listProblemCur[i].DateStart.ToShortDateString());
                }
                if (disD.DiseaseName == null)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(disD.DiseaseName);
                }
                if (_listProblemCur[i].ProbStatus == ProblemStatus.Active)
                {
                    row.Cells.Add("Active");
                }
                else if (_listProblemCur[i].ProbStatus == ProblemStatus.Resolved)
                {
                    row.Cells.Add("Resolved");
                }
                else
                {
                    row.Cells.Add("Inactive");
                }
                gridProbExisting.ListGridRows.Add(row);
            }
            gridProbExisting.EndUpdate();
        }
コード例 #15
0
ファイル: RxAlertL.cs プロジェクト: nampn/ODental
        ///<summary>Returns false if user does not with to continue after seeing alert.  If called from FormRxSelect, then rxCui will be 0.  If called from CPOE, then rxDefNum will be 0.</summary>
        public static bool DisplayAlerts(long patNum, long rxCui, long rxDefNum)
        {
            List <RxAlert> alertList = null;

            if (rxDefNum == 0)
            {
                alertList = RxAlerts.RefreshByRxCui(rxCui);              //for CPOE
            }
            else
            {
                alertList = RxAlerts.Refresh(rxDefNum);              //for Rx
            }
            List <Disease>    diseases           = Diseases.Refresh(patNum);
            List <Allergy>    allergies          = Allergies.Refresh(patNum);
            List <Medication> medications        = Medications.GetMedicationsByPat(patNum);
            List <string>     diseaseMatches     = new List <string>();
            List <string>     allergiesMatches   = new List <string>();
            List <string>     medicationsMatches = new List <string>();
            List <string>     customMessages     = new List <string>();

            for (int i = 0; i < alertList.Count; i++)
            {
                for (int j = 0; j < diseases.Count; j++)
                {
                    //This does not look for matches with icd9s.
                    //The only reason we support diseases anyway is for allergies that may have been entered as diseases.
                    if (alertList[i].DiseaseDefNum == diseases[j].DiseaseDefNum && diseases[j].ProbStatus == 0)                //ProbStatus is active.
                    {
                        if (alertList[i].NotificationMsg == "")
                        {
                            diseaseMatches.Add(DiseaseDefs.GetName(diseases[j].DiseaseDefNum));
                        }
                        else
                        {
                            customMessages.Add(alertList[i].NotificationMsg);
                        }
                    }
                }
                for (int j = 0; j < allergies.Count; j++)
                {
                    if (alertList[i].AllergyDefNum == allergies[j].AllergyDefNum && allergies[j].StatusIsActive)
                    {
                        if (alertList[i].NotificationMsg == "")
                        {
                            allergiesMatches.Add(AllergyDefs.GetOne(alertList[i].AllergyDefNum).Description);
                        }
                        else
                        {
                            customMessages.Add(alertList[i].NotificationMsg);
                        }
                    }
                }
                for (int j = 0; j < medications.Count; j++)
                {
                    if (alertList[i].MedicationNum == medications[j].MedicationNum)
                    {
                        if (alertList[i].NotificationMsg == "")
                        {
                            Medications.Refresh();
                            medicationsMatches.Add(Medications.GetMedication(alertList[i].MedicationNum).MedName);
                        }
                        else
                        {
                            customMessages.Add(alertList[i].NotificationMsg);
                        }
                    }
                }
            }
            //these matches do not include ones that have custom messages.
            if (diseaseMatches.Count > 0 ||
                allergiesMatches.Count > 0 ||
                medicationsMatches.Count > 0)
            {
                string alert = "";
                for (int i = 0; i < diseaseMatches.Count; i++)
                {
                    if (i == 0)
                    {
                        alert += Lan.g("RxAlertL", "This patient has the following medical problems: ");
                    }
                    alert += diseaseMatches[i];
                    if ((i + 1) == diseaseMatches.Count)
                    {
                        alert += ".\r\n";
                    }
                    else
                    {
                        alert += ", ";
                    }
                }
                for (int i = 0; i < allergiesMatches.Count; i++)
                {
                    if (i == 0 && diseaseMatches.Count > 0)
                    {
                        alert += "and the following allergies: ";
                    }
                    else if (i == 0)
                    {
                        alert = Lan.g("RxAlertL", "This patient has the following allergies: ");
                    }
                    alert += allergiesMatches[i];
                    if ((i + 1) == allergiesMatches.Count)
                    {
                        alert += ".\r\n";
                    }
                    else
                    {
                        alert += ", ";
                    }
                }
                for (int i = 0; i < medicationsMatches.Count; i++)
                {
                    if (i == 0 && (diseaseMatches.Count > 0 || allergiesMatches.Count > 0))
                    {
                        alert += "and is taking the following medications: ";
                    }
                    else if (i == 0)
                    {
                        alert = Lan.g("RxAlertL", "This patient is taking the following medications: ");
                    }
                    alert += medicationsMatches[i];
                    if ((i + 1) == medicationsMatches.Count)
                    {
                        alert += ".\r\n";
                    }
                    else
                    {
                        alert += ", ";
                    }
                }
                alert += "\r\n" + Lan.g("RxAlertL", "Continue anyway?");
                if (MessageBox.Show(alert, "Alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK)
                {
                    return(false);
                }
            }
            for (int i = 0; i < customMessages.Count; i++)
            {
                if (MessageBox.Show(customMessages[i] + "\r\n" + Lan.g("RxAlertL", "Continue anyway?"), "Alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK)
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #16
0
        ///<summary>Returns false if user does not wish to continue after seeing alert.</summary>
        public static bool DisplayAlerts(long patNum, long rxDefNum)
        {
            List <RxAlert> alertList = null;

            //if(rxDefNum==0){
            //	alertList=RxAlerts.RefreshByRxCui(rxCui);//for CPOE
            //}
            //else{
            alertList = RxAlerts.Refresh(rxDefNum);          //for Rx
            //}
            List <Disease>       diseases           = Diseases.Refresh(patNum);
            List <Allergy>       allergies          = Allergies.Refresh(patNum);
            List <MedicationPat> medicationPats     = MedicationPats.Refresh(patNum, false);    //Exclude discontinued, only active meds.
            List <string>        diseaseMatches     = new List <string>();
            List <string>        allergiesMatches   = new List <string>();
            List <string>        medicationsMatches = new List <string>();
            List <string>        customMessages     = new List <string>();
            bool showHighSigOnly = PrefC.GetBool(PrefName.EhrRxAlertHighSeverity);

            for (int i = 0; i < alertList.Count; i++)
            {
                for (int j = 0; j < diseases.Count; j++)
                {
                    //This does not look for matches with icd9s.
                    if (alertList[i].DiseaseDefNum == diseases[j].DiseaseDefNum && diseases[j].ProbStatus == 0)                //ProbStatus is active.
                    {
                        if (alertList[i].NotificationMsg == "")
                        {
                            diseaseMatches.Add(DiseaseDefs.GetName(diseases[j].DiseaseDefNum));
                        }
                        else
                        {
                            customMessages.Add(alertList[i].NotificationMsg);
                        }
                    }
                }
                for (int j = 0; j < allergies.Count; j++)
                {
                    if (alertList[i].AllergyDefNum == allergies[j].AllergyDefNum && allergies[j].StatusIsActive)
                    {
                        if (alertList[i].NotificationMsg == "")
                        {
                            allergiesMatches.Add(AllergyDefs.GetOne(alertList[i].AllergyDefNum).Description);
                        }
                        else
                        {
                            customMessages.Add(alertList[i].NotificationMsg);
                        }
                    }
                }
                for (int j = 0; j < medicationPats.Count; j++)
                {
                    bool       isMedInteraction = false;
                    Medication medForAlert      = Medications.GetMedication(alertList[i].MedicationNum);
                    if (medForAlert == null)
                    {
                        continue;                                                                                              //MedicationNum will be 0 for all other alerts that are not medication alerts.
                    }
                    if (medicationPats[j].MedicationNum != 0 && alertList[i].MedicationNum == medicationPats[j].MedicationNum) //Medication from medication list.
                    {
                        isMedInteraction = true;
                    }
                    else if (medicationPats[j].MedicationNum == 0 && medForAlert.RxCui != 0 && medicationPats[j].RxCui == medForAlert.RxCui)               //Medication from NewCrop. Unfortunately, neither of these RxCuis are required.
                    {
                        isMedInteraction = true;
                    }
                    if (!isMedInteraction)
                    {
                        continue;                        //No known interaction.
                    }
                    //Medication interaction.
                    if (showHighSigOnly && !alertList[i].IsHighSignificance) //if set to only show high significance alerts and this is not a high significance interaction, do not show alert
                    {
                        continue;                                            //Low significance alert.
                    }
                    if (alertList[i].NotificationMsg == "")
                    {
                        Medications.RefreshCache();
                        medicationsMatches.Add(Medications.GetMedication(alertList[i].MedicationNum).MedName);
                    }
                    else
                    {
                        customMessages.Add(alertList[i].NotificationMsg);
                    }
                }
            }
            //these matches do not include ones that have custom messages.
            if (diseaseMatches.Count > 0 ||
                allergiesMatches.Count > 0 ||
                medicationsMatches.Count > 0)
            {
                string alert = "";
                for (int i = 0; i < diseaseMatches.Count; i++)
                {
                    if (i == 0)
                    {
                        alert += Lan.g("RxAlertL", "This patient has the following medical problems: ");
                    }
                    alert += diseaseMatches[i];
                    if ((i + 1) == diseaseMatches.Count)
                    {
                        alert += ".\r\n";
                    }
                    else
                    {
                        alert += ", ";
                    }
                }
                for (int i = 0; i < allergiesMatches.Count; i++)
                {
                    if (i == 0 && diseaseMatches.Count > 0)
                    {
                        alert += "and the following allergies: ";
                    }
                    else if (i == 0)
                    {
                        alert = Lan.g("RxAlertL", "This patient has the following allergies: ");
                    }
                    alert += allergiesMatches[i];
                    if ((i + 1) == allergiesMatches.Count)
                    {
                        alert += ".\r\n";
                    }
                    else
                    {
                        alert += ", ";
                    }
                }
                for (int i = 0; i < medicationsMatches.Count; i++)
                {
                    if (i == 0 && (diseaseMatches.Count > 0 || allergiesMatches.Count > 0))
                    {
                        alert += "and is taking the following medications: ";
                    }
                    else if (i == 0)
                    {
                        alert = Lan.g("RxAlertL", "This patient is taking the following medications: ");
                    }
                    alert += medicationsMatches[i];
                    if ((i + 1) == medicationsMatches.Count)
                    {
                        alert += ".\r\n";
                    }
                    else
                    {
                        alert += ", ";
                    }
                }
                alert += "\r\n" + Lan.g("RxAlertL", "Continue anyway?");
                if (MessageBox.Show(alert, "Alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK)
                {
                    return(false);
                }
            }
            for (int i = 0; i < customMessages.Count; i++)
            {
                if (MessageBox.Show(customMessages[i] + "\r\n" + Lan.g("RxAlertL", "Continue anyway?"), "Alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK)
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #17
0
ファイル: FormEhrOnlineAccess.cs プロジェクト: nampn/ODental
        private void butGiveAccess_Click(object sender, EventArgs e)
        {
            string interval = PrefC.GetStringSilent(PrefName.MobileSyncIntervalMinutes);

            if (interval == "" || interval == "0")         //not a paid customer or chooses not to synch
            {
                MessageBox.Show("Synch must be setup first from the Tools menu, Mobile and Patient Portal Synch.  Interval must not be blank or zero.");
                return;
            }
            //we won't check PrefName.MobileSyncWorkstationName because we are forcing the synch
            if (System.Environment.MachineName.ToUpper() != PrefC.GetStringSilent(PrefName.MobileSyncWorkstationName).ToUpper())
            {
                //Since GetStringSilent returns "" before OD is connected to db, this gracefully loops out
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel,
                                 "Warning.  Workstation is not entered in the Tools menu, Mobile and Patient Portal Synch.  No automatic synch is taking place.  Continue anyway?"))
                {
                    return;
                }
            }
            if (PrefC.GetDate(PrefName.MobileExcludeApptsBeforeDate).Year < 1880)
            {
                MessageBox.Show("Full Synch must be run first first from the Tools menu, Mobile and Patient Portal Synch.");
                return;
            }
            if (butGiveAccess.Text == "Provide Online Access")           //When form open opens with a blank password
            {
                Cursor = Cursors.WaitCursor;
                //1. Fill password.
                textOnlinePassword.Text = GenerateRandomPassword(8, 10);             //won't save until OK or Print
                //2. Fill link.
                textOnlineLink.Text = GetPatientPortalLink();
                //3. Reset timestamps for this patient to trigger all their objects to upload with the next synch
                LabPanels.ResetTimeStamps(PatCur.PatNum);
                Diseases.ResetTimeStamps(PatCur.PatNum);
                Allergies.ResetTimeStamps(PatCur.PatNum);
                MedicationPats.ResetTimeStamps(PatCur.PatNum);
                Statements.ResetTimeStamps(PatCur.PatNum);
                Documents.ResetTimeStamps(PatCur.PatNum);
                //4. Make the password editable in case they want to change it.
                textOnlinePassword.ReadOnly = false;
                //5. Save password to db
                PatCur.OnlinePassword = textOnlinePassword.Text;
                Patients.Update(PatCur, PatOld);
                PatOld.OnlinePassword = textOnlinePassword.Text;              //so that subsequent Updates will work.
                //6. Force a synch
                FormMobile.SynchFromMain(true);
                //7. Insert EhrMeasureEvent
                EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();
                newMeasureEvent.DateTEvent = DateTime.Now;
                newMeasureEvent.EventType  = EhrMeasureEventType.OnlineAccessProvided;
                newMeasureEvent.PatNum     = PatCur.PatNum;
                newMeasureEvent.MoreInfo   = "";
                EhrMeasureEvents.Insert(newMeasureEvent);
                //8. 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;
                //5. Force a synch
                FormMobile.SynchFromMain(true);
                //no event to insert
                //6. Rename button
                butGiveAccess.Text = "Provide Online Access";
                Cursor             = Cursors.Default;
            }
        }
コード例 #18
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
         textDateStop.errorProvider1.GetError(textDateStop) != "")
     {
         MsgBox.Show(this, "Please fix date.");
         return;
     }
     DiseaseCur.DateStart  = PIn.Date(textDateStart.Text);
     DiseaseCur.DateStop   = PIn.Date(textDateStop.Text);
     DiseaseCur.ProbStatus = (ProblemStatus)comboStatus.SelectedIndex;
     DiseaseCur.PatNote    = textNote.Text;
     if (comboSnomedProblemType.SelectedIndex == 1)           //Finding
     {
         DiseaseCur.SnomedProblemType = "404684003";
     }
     else if (comboSnomedProblemType.SelectedIndex == 2)           //Complaint
     {
         DiseaseCur.SnomedProblemType = "409586006";
     }
     else if (comboSnomedProblemType.SelectedIndex == 3)           //Dignosis
     {
         DiseaseCur.SnomedProblemType = "282291009";
     }
     else if (comboSnomedProblemType.SelectedIndex == 4)           //Condition
     {
         DiseaseCur.SnomedProblemType = "64572001";
     }
     else if (comboSnomedProblemType.SelectedIndex == 5)           //FunctionalLimitation
     {
         DiseaseCur.SnomedProblemType = "248536006";
     }
     else if (comboSnomedProblemType.SelectedIndex == 6)           //Symptom
     {
         DiseaseCur.SnomedProblemType = "418799008";
     }
     else              //Problem
     {
         DiseaseCur.SnomedProblemType = "55607006";
     }
     DiseaseCur.FunctionStatus = (FunctionalStatus)comboEhrFunctionalStatus.SelectedIndex;
     if (IsNew)
     {
         //This code is never hit in current implementation 09/26/2013.
         Diseases.Insert(DiseaseCur);
         SecurityLogs.MakeLogEntry(Permissions.PatProblemListEdit, DiseaseCur.PatNum, DiseaseDefs.GetName(DiseaseCur.DiseaseDefNum) + " added");
     }
     else
     {
         //See if this problem is the pregnancy linked to a vitalsign exam
         List <Vitalsign> listVitalsAttached = Vitalsigns.GetListFromPregDiseaseNum(DiseaseCur.DiseaseNum);
         if (listVitalsAttached.Count > 0)
         {
             //See if the vitalsign exam date is now outside of the active dates of the disease (pregnancy)
             string dates = "";
             for (int i = 0; i < listVitalsAttached.Count; i++)
             {
                 if (listVitalsAttached[i].DateTaken < DiseaseCur.DateStart || (DiseaseCur.DateStop.Year > 1880 && listVitalsAttached[i].DateTaken > DiseaseCur.DateStop))
                 {
                     dates += "\r\n" + listVitalsAttached[i].DateTaken.ToShortDateString();
                 }
             }
             //If vitalsign exam is now outside the dates of the problem, tell the user they must fix the dates of the pregnancy dx
             if (dates.Length > 0)
             {
                 MsgBox.Show(this, "This problem is attached to 1 or more vital sign exams as a pregnancy diagnosis with dates:" + dates + "\r\nNot allowed to change the active dates of the diagnosis to be outside the dates of the exam(s).  You must first remove the diagnosis from the vital sign exam(s).");
                 return;
             }
         }
         Diseases.Update(DiseaseCur);
         SecurityLogs.MakeLogEntry(Permissions.PatProblemListEdit, DiseaseCur.PatNum, DiseaseDefs.GetName(DiseaseCur.DiseaseDefNum) + " edited");
     }
     DialogResult = DialogResult.OK;
 }