コード例 #1
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);
        }
コード例 #2
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();
        }
コード例 #3
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();
        }
コード例 #4
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;
        }
コード例 #5
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();
        }
コード例 #6
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();
        }
コード例 #7
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);
        }
コード例 #8
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);
        }