コード例 #1
0
        private void FillCarePlans()
        {
            gridCarePlans.BeginUpdate();
            gridCarePlans.Columns.Clear();
            int colDatePixCount         = 66;
            int variablePixCount        = gridCarePlans.Width - 10 - colDatePixCount;
            int colGoalPixCount         = variablePixCount / 2;
            int colInstructionsPixCount = variablePixCount - colGoalPixCount;

            gridCarePlans.Columns.Add(new UI.ODGridColumn("Date", colDatePixCount));
            gridCarePlans.Columns.Add(new UI.ODGridColumn("Goal", colGoalPixCount));
            gridCarePlans.Columns.Add(new UI.ODGridColumn("Instructions", colInstructionsPixCount));
            gridCarePlans.EndUpdate();
            gridCarePlans.BeginUpdate();
            gridCarePlans.Rows.Clear();
            _listCarePlans = EhrCarePlans.Refresh(_patCur.PatNum);
            for (int i = 0; i < _listCarePlans.Count; i++)
            {
                UI.ODGridRow row = new UI.ODGridRow();
                row.Cells.Add(_listCarePlans[i].DatePlanned.ToShortDateString());                //Date
                Snomed snomedEducation = Snomeds.GetByCode(_listCarePlans[i].SnomedEducation);
                if (snomedEducation == null)
                {
                    row.Cells.Add("");                    //We allow blank or "NullFlavor" SNOMEDCT codes when exporting CCDAs, so we allow them to be blank when displaying here as well.
                }
                else
                {
                    row.Cells.Add(snomedEducation.Description);               //GoalDescript
                }
                row.Cells.Add(_listCarePlans[i].Instructions);                //Instructions
                gridCarePlans.Rows.Add(row);
            }
            gridCarePlans.EndUpdate();
        }
コード例 #2
0
        private void butMapToSnomed_Click(object sender, EventArgs e)
        {
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Will add SNOMED CT code to existing problems list only if the ICD9 code correlates to exactly one SNOMED CT code. If there is any ambiguity at all the code will not be added."))
            {
                return;
            }
            int changeCount = 0;
            Dictionary <string, string> dictionaryIcd9ToSnomed = Snomeds.GetICD9toSNOMEDDictionary();

            DiseaseDefs.RefreshCache();
            for (int i = 0; i < DiseaseDefs.ListLong.Length; i++)
            {
                if (!dictionaryIcd9ToSnomed.ContainsKey(DiseaseDefs.ListLong[i].ICD9Code))
                {
                    continue;
                }
                DiseaseDef def = DiseaseDefs.ListLong[i];
                if (def.SnomedCode != "")
                {
                    continue;
                }
                def.SnomedCode = dictionaryIcd9ToSnomed[def.ICD9Code];
                DiseaseDefs.Update(def);
                changeCount++;
            }
            MessageBox.Show(Lan.g(this, "SNOMED CT codes added: ") + changeCount);
        }
コード例 #3
0
        ///<summary>Called after file is downloaded.  Throws exceptions.  It is assumed that this is called from a worker thread.  Progress delegate will be called every 100th iteration to inform thread of current progress. Quit flag can be set at any time in order to quit importing prematurely.</summary>
        public static void ImportSnomed(string tempFileName, ProgressArgs progress, ref bool quit)
        {
            if (tempFileName == null)
            {
                return;
            }
            HashSet <string> codeHash = new HashSet <string>(Snomeds.GetAllCodes());

            string[] lines = File.ReadAllLines(tempFileName);
            string[] arraySnomed;
            Snomed   snomed = new Snomed();

            for (int i = 0; i < lines.Length; i++)       //each loop should read exactly one line of code. and each line of code should be a unique code
            {
                if (quit)
                {
                    return;
                }
                if (i % 100 == 0)
                {
                    progress(i + 1, lines.Length);
                }
                arraySnomed = lines[i].Split('\t');
                if (codeHash.Contains(arraySnomed[0]))                 //code already exists
                {
                    continue;
                }
                snomed.SnomedCode  = arraySnomed[0];
                snomed.Description = arraySnomed[1];
                Snomeds.Insert(snomed);
            }
        }
コード例 #4
0
        private void FormDiseaseDefEdit_Load(object sender, System.EventArgs e)
        {
            textName.Text = DiseaseDefCur.DiseaseName;
            string i9descript = ICD9s.GetCodeAndDescription(DiseaseDefCur.ICD9Code);

            if (i9descript == "")
            {
                textICD9.Text = DiseaseDefCur.ICD9Code;
            }
            else
            {
                textICD9.Text = i9descript;
            }
            Icd10 i10 = Icd10s.GetByCode(DiseaseDefCur.Icd10Code);

            if (i10 == null)
            {
                textIcd10.Text = DiseaseDefCur.Icd10Code;
            }
            else
            {
                textIcd10.Text = i10.Icd10Code + "-" + i10.Description;
            }
            string sdescript = Snomeds.GetCodeAndDescription(DiseaseDefCur.SnomedCode);

            if (sdescript == "")
            {
                textSnomed.Text = DiseaseDefCur.SnomedCode;
            }
            else
            {
                textSnomed.Text = sdescript;
            }
            checkIsHidden.Checked = DiseaseDefCur.IsHidden;
        }
コード例 #5
0
        private void butSnomed_Click(object sender, EventArgs e)
        {
            FormSnomeds FormS = new FormSnomeds();

            FormS.IsSelectionMode = true;
            FormS.ShowDialog();
            if (FormS.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (DiseaseDefs.ContainsSnomed(FormS.SelectedSnomed.SnomedCode, DiseaseDefCur.DiseaseDefNum))            //DiseaseDefNum could be zero
            {
                MsgBox.Show(this, "Snomed code already exists in the problems list.");
                return;
            }
            DiseaseDefCur.SnomedCode = FormS.SelectedSnomed.SnomedCode;
            string sdescript = Snomeds.GetCodeAndDescription(FormS.SelectedSnomed.SnomedCode);

            if (sdescript == "")
            {
                textSnomed.Text = FormS.SelectedSnomed.SnomedCode;
            }
            else
            {
                textSnomed.Text = sdescript;
            }
        }
コード例 #6
0
        private void butProblemSelect_Click(object sender, EventArgs e)
        {
            FormDiseaseDefs FormDD = new FormDiseaseDefs();

            FormDD.IsSelectionMode = true;
            FormDD.ShowDialog();
            if (FormDD.DialogResult != DialogResult.OK)
            {
                return;
            }
            //the list should only ever contain one item.
            DiseaseDef disCur = FormDD.ListSelectedDiseaseDefs[0];

            if (disCur == null)
            {
                return;
            }
            EduResourceCur.DiseaseDefNum    = disCur.DiseaseDefNum;
            EduResourceCur.MedicationNum    = 0;
            EduResourceCur.SmokingSnoMed    = "";
            EduResourceCur.LabResultID      = "";
            EduResourceCur.LabResultName    = "";
            EduResourceCur.LabResultCompare = "";
            textProblem.Text           = disCur.DiseaseName;
            textICD9.Text              = ICD9s.GetCodeAndDescription(disCur.ICD9Code);
            textSnomed.Text            = Snomeds.GetCodeAndDescription(disCur.SnomedCode);
            textMedication.Text        = "";
            textTobaccoAssessment.Text = "";
            textLabResultsID.Text      = "";
            textLabTestName.Text       = "";
            textCompareValue.Text      = "";
        }
コード例 #7
0
        private void butProblemSelect_Click(object sender, EventArgs e)
        {
            FormDiseaseDefs FormDD = new FormDiseaseDefs();

            FormDD.IsSelectionMode = true;
            FormDD.ShowDialog();
            if (FormDD.DialogResult != DialogResult.OK)
            {
                return;
            }
            DiseaseDef disCur = DiseaseDefs.GetItem(FormDD.SelectedDiseaseDefNum);

            if (disCur == null)
            {
                return;
            }
            EduResourceCur.DiseaseDefNum = FormDD.SelectedDiseaseDefNum;
            textProblem.Text             = disCur.DiseaseName;
            textICD9.Text   = ICD9s.GetCodeAndDescription(disCur.ICD9Code);
            textSnomed.Text = Snomeds.GetCodeAndDescription(disCur.SnomedCode);
            EduResourceCur.MedicationNum = 0;
            textLabResultsID.Text        = "";
            textLabTestName.Text         = "";
            textCompareValue.Text        = "";
        }
コード例 #8
0
        private void FillGridAssessments()
        {
            gridAssessments.BeginUpdate();
            gridAssessments.Columns.Clear();
            gridAssessments.Columns.Add(new ODGridColumn("Date", 70));
            gridAssessments.Columns.Add(new ODGridColumn("Type", 170));
            gridAssessments.Columns.Add(new ODGridColumn("Description", 170));
            gridAssessments.Columns.Add(new ODGridColumn("Documentation", 170));
            gridAssessments.Rows.Clear();
            ODGridRow row;
            List <EhrMeasureEvent> listEvents = EhrMeasureEvents.RefreshByType(PatCur.PatNum, EhrMeasureEventType.TobaccoUseAssessed);

            foreach (EhrMeasureEvent eventCur in listEvents)
            {
                row = new ODGridRow();
                row.Cells.Add(eventCur.DateTEvent.ToShortDateString());
                Loinc lCur = Loincs.GetByCode(eventCur.CodeValueEvent);              //TobaccoUseAssessed events can be one of three types, all LOINC codes
                row.Cells.Add(lCur != null?lCur.NameLongCommon:eventCur.EventType.ToString());
                Snomed sCur = Snomeds.GetByCode(eventCur.CodeValueResult);
                row.Cells.Add(sCur != null?sCur.Description:"");
                row.Cells.Add(eventCur.MoreInfo);
                row.Tag = eventCur;
                gridAssessments.Rows.Add(row);
            }
            gridAssessments.EndUpdate();
        }
コード例 #9
0
ファイル: FormEhrSettings.cs プロジェクト: kjb7749/testImport
 private void comboPregCodes_SelectionChangeCommitted(object sender, EventArgs e)
 {
     if (!Security.IsAuthorized(Permissions.SecurityAdmin, false))
     {
         comboPregCodes.SelectedIndex = OldPregListSelectedIdx;
         return;
     }
     NewPregCodeSystem      = "SNOMEDCT";
     textPregCodeValue.Text = "";
     if (comboPregCodes.SelectedIndex == 0)           //none
     {
         textPregCodeDescript.Clear();
         labelPregWarning.Visible = true;
     }
     else
     {
         Snomed sPreg = Snomeds.GetByCode(comboPregCodes.SelectedItem.ToString());
         if (sPreg == null)
         {
             MsgBox.Show(this, "The snomed table does not contain this code.  The code should be added to the snomed table by running the Code System Importer tool.");
         }
         else
         {
             textPregCodeDescript.Text = sPreg.Description;
         }
         labelPregWarning.Visible = false;
     }
 }
コード例 #10
0
ファイル: FormEhrSettings.cs プロジェクト: kjb7749/testImport
 private void comboEncCodes_SelectionChangeCommitted(object sender, EventArgs e)
 {
     if (!Security.IsAuthorized(Permissions.SecurityAdmin, false))
     {
         comboEncCodes.SelectedIndex = OldEncListSelectedIdx;
         return;
     }
     NewEncCodeSystem      = "SNOMEDCT";
     textEncCodeValue.Text = "";
     if (comboEncCodes.SelectedIndex == 0)           //none
     {
         textEncCodeDescript.Clear();
         labelEncWarning.Visible = true;
     }
     else
     {
         Snomed sEnc = Snomeds.GetByCode(comboEncCodes.SelectedItem.ToString());
         if (sEnc == null)               //this check may not be necessary now that we are not adding the code to the list to be selected if they do not have it in the snomed table.  Harmelss and safe.
         {
             MsgBox.Show(this, "The snomed table does not contain this code.  The code should be added to the snomed table by running the Code System Importer tool.");
         }
         else
         {
             textEncCodeDescript.Text = sEnc.Description;
         }
         labelEncWarning.Visible = false;
     }
 }
コード例 #11
0
ファイル: EhrCodes.cs プロジェクト: royedwards/DRDNet
        ///<summary>Returns EhrCodes for the specified EhrMeasureEventType ordered by how often and how recently they have been used.  Results are
        ///ordered by applying a weight based on the date diff from current date to DateTEvent of the EhrMeasureEvents.  EhrCodes used most
        ///recently will have the largest weight and help move the EhrCode to the top of the list.  Specify a limit amount if the result set should only
        ///be a certain number of EhrCodes at most.</summary>
        public static List <EhrCode> GetForEventTypeByUse(EhrMeasureEventType ehrMeasureEventTypes)
        {
            List <EhrCode> retVal = new List <EhrCode>();
            //list of CodeValueResults of the specified type ordered by a weight calculated by summing values based on how recently the codes were used
            List <string> listCodes = EhrMeasureEvents.GetListCodesUsedForType(ehrMeasureEventTypes);

            foreach (string codeStr in listCodes)
            {
                EhrCode codeCur = Listt.FirstOrDefault(x => x.CodeValue == codeStr);
                Snomed  sCur    = null;
                if (codeCur == null)
                {
                    sCur = Snomeds.GetByCode(codeStr);
                    if (sCur == null)
                    {
                        continue;
                    }
                    codeCur = new EhrCode {
                        CodeValue = sCur.SnomedCode, Description = sCur.Description
                    };
                }
                retVal.Add(codeCur);
            }
            return(retVal.OrderBy(x => x.Description).ToList());
        }
コード例 #12
0
        private void comboEncCodes_SelectionChangeCommitted(object sender, EventArgs e)
        {
            EncCodeSystem         = "SNOMEDCT";
            textEncCodeValue.Text = "";
            Snomed sEnc = Snomeds.GetByCode(comboEncCodes.SelectedItem.ToString());

            textEncCodeDescript.Text = sEnc.Description;
            labelEncWarning.Visible  = false;
        }
コード例 #13
0
 private void FormEhrCarePlanEdit_Load(object sender, EventArgs e)
 {
     textDate.Text = _ehrCarePlan.DatePlanned.ToShortDateString();
     _snomedGoal   = null;
     if (!String.IsNullOrEmpty(_ehrCarePlan.SnomedEducation))             //Blank if new
     {
         _snomedGoal         = Snomeds.GetByCode(_ehrCarePlan.SnomedEducation);
         textSnomedGoal.Text = _snomedGoal.Description;
     }
     textInstructions.Text = _ehrCarePlan.Instructions;
 }
コード例 #14
0
        private void FormEhrMeasureEventEdit_Load(object sender, EventArgs e)
        {
            textDateTime.Text = _measureEventCur.DateTEvent.ToString();
            Patient patCur = Patients.GetPat(_measureEventCur.PatNum);

            if (patCur != null)
            {
                textPatient.Text = patCur.GetNameFL();
            }
            if (!String.IsNullOrWhiteSpace(MeasureDescript))
            {
                labelMoreInfo.Text = MeasureDescript;
            }
            if (_measureEventCur.EventType == EhrMeasureEventType.TobaccoUseAssessed)
            {
                Loinc lCur = Loincs.GetByCode(_measureEventCur.CodeValueEvent);              //TobaccoUseAssessed events can be one of three types, all LOINC codes
                if (lCur != null)
                {
                    textType.Text = lCur.NameLongCommon;                           //Example: History of tobacco use Narrative
                }
                Snomed sCur = Snomeds.GetByCode(_measureEventCur.CodeValueResult); //TobaccoUseAssessed results can be any SNOMEDCT code, we recommend one of 8 codes, but the CQM measure allows 54 codes and we let the user select any SNOMEDCT they want
                if (sCur != null)
                {
                    textResult.Text = sCur.Description;                  //Examples: Non-smoker (finding) or Smoker (finding)
                }
                //only visible if event is a tobacco use assessment
                textTobaccoDesireToQuit.Visible  = true;
                textTobaccoDuration.Visible      = true;
                textTobaccoStartDate.Visible     = true;
                labelTobaccoDesireToQuit.Visible = true;
                labelTobaccoDesireScale.Visible  = true;
                labelTobaccoStartDate.Visible    = true;
                textTobaccoDesireToQuit.Text     = _measureEventCur.TobaccoCessationDesire.ToString();
                if (_measureEventCur.DateStartTobacco.Year >= 1880)
                {
                    textTobaccoStartDate.Text = _measureEventCur.DateStartTobacco.ToShortDateString();
                }
                CalcTobaccoDuration();
            }
            else
            {
                //Currently, the TobaccoUseAssessed events are the only ones that can be deleted.
                butDelete.Enabled = false;
            }
            if (textType.Text == "")          //if not set by LOINC name above, then either not a TobaccoUseAssessed event or the code was not in the LOINC table, fill with EventType
            {
                textType.Text = _measureEventCur.EventType.ToString();
            }
            textMoreInfo.Text = _measureEventCur.MoreInfo;
        }
コード例 #15
0
 ///<summary>If IsSelectionMode, doubleclicking closes the form and returns the selected diseasedef.
 ///If !IsSelectionMode, doubleclicking opens FormDiseaseDefEdit and allows the user to edit or delete the selected diseasedef.
 ///Either way, validation always occurs first.</summary>
 private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
 {
     #region Validation
     if (!IsSelectionMode && !Security.IsAuthorized(Permissions.ProblemEdit))             //trying to double click to edit, but no permission.
     {
         return;
     }
     if (gridMain.SelectedIndices.Length == 0)
     {
         return;
     }
     #endregion
     DiseaseDef selectedDiseaseDef = (DiseaseDef)gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag;
     #region Selection Mode. Close the Form
     if (IsSelectionMode)             //selection mode.
     {
         if (!IsMultiSelect && Snomeds.GetByCode(selectedDiseaseDef.SnomedCode) == null)
         {
             MsgBox.Show(this, "You have selected a problem with an unofficial SNOMED CT code.  Please correct the problem definition by going to "
                         + "Lists | Problems and choosing an official code from the SNOMED CT list.");
             return;
         }
         DialogResult = DialogResult.OK;              //FormClosing takes care of filling ListSelectedDiseaseDefs.
         return;
     }
     #endregion
     #region Not Selection Mode. Open FormDiseaseDefEdit
     //not selection mode. double-click to edit.
     bool hasDelete = true;
     if (_listDiseaseDefsNumsNotDeletable.Contains(selectedDiseaseDef.DiseaseDefNum))
     {
         hasDelete = false;
     }
     //everything below this point is _not_ selection mode.  User guaranteed to have permission for ProblemEdit.
     FormDiseaseDefEdit FormD = new FormDiseaseDefEdit(selectedDiseaseDef, hasDelete);
     FormD.ShowDialog();
     //Security log entry made inside that form.
     if (FormD.DialogResult != DialogResult.OK)
     {
         return;
     }
     #endregion
     _listSecurityLogMsgs.Add(FormD.SecurityLogMsgText);
     if (FormD.DiseaseDefCur == null)           //User deleted the DiseaseDef.
     {
         _listDiseaseDefs.Remove(selectedDiseaseDef);
     }
     _isChanged = true;
     FillGrid();
 }
コード例 #16
0
        private void gridMain_CellClick(object sender, ODGridClickEventArgs e)
        {
            if (!CDSPermissions.GetForUser(Security.CurUser.UserNum).ShowInfobutton)             //Security.IsAuthorized(Permissions.EhrInfoButton,true)) {
            {
                return;
            }
            if (e.Col != 0)
            {
                return;
            }
            FormInfobutton FormIB = new FormInfobutton();

            FormIB.ListObjects.Add(Snomeds.GetByCode(gridMain.Rows[e.Row].Cells[1].Text));
            FormIB.ShowDialog();
        }
コード例 #17
0
 ///<summary>Only visible when using Selection Mode. Most of the actual logic is done on FormClosing.</summary>
 private void butOK_Click(object sender, EventArgs e)
 {
     //not even visible unless IsSelectionMode
     if (gridMain.SelectedIndices.Length == 0)
     {
         MsgBox.Show(this, "Please select an item first.");
         return;
     }
     if (IsSelectionMode && !IsMultiSelect)
     {
         if (Snomeds.GetByCode(_listDiseaseDefs[gridMain.GetSelectedIndex()].SnomedCode) == null)
         {
             MsgBox.Show(this, "You have selected a problem containing an invalid SNOMED CT.");
             return;
         }
     }
     DialogResult = DialogResult.OK;
 }
コード例 #18
0
 private void FormEduResourceEdit_Load(object sender, EventArgs e)
 {
     if (EduResourceCur.DiseaseDefNum != 0)
     {
         DiseaseDef def = DiseaseDefs.GetItem(EduResourceCur.DiseaseDefNum);
         textProblem.Text = def.DiseaseName;
         textICD9.Text    = ICD9s.GetCodeAndDescription(def.ICD9Code);
         textSnomed.Text  = Snomeds.GetCodeAndDescription(def.SnomedCode);
     }
     else if (EduResourceCur.MedicationNum != 0)
     {
         textMedication.Text = Medications.GetDescription(EduResourceCur.MedicationNum);
     }
     textLabResultsID.Text = EduResourceCur.LabResultID;
     textLabTestName.Text  = EduResourceCur.LabResultName;
     textCompareValue.Text = EduResourceCur.LabResultCompare;
     textUrl.Text          = EduResourceCur.ResourceUrl;
 }
コード例 #19
0
 private void FormPatListElementEdit_Load(object sender, EventArgs e)
 {
     listRestriction.Items.Clear();
     for (int i = 0; i < Enum.GetNames(typeof(EhrRestrictionType)).Length; i++)
     {
         listRestriction.Items.Add(Enum.GetNames(typeof(EhrRestrictionType))[i]);
     }
     listRestriction.SelectedIndex = (int)Element.Restriction;
     listOperand.SelectedIndex     = (int)Element.Operand;
     textCompareString.Text        = Element.CompareString;
     if (Element.Restriction == EhrRestrictionType.Problem && !IsNew)
     {
         textCompareString.Text = "";              //clear text box for simplicity
         if (ICD9s.CodeExists(Element.CompareString))
         {
             textCompareString.Text = Element.CompareString;
         }
         else if (Snomeds.CodeExists(Element.CompareString))
         {
             textSNOMED.Text = Element.CompareString;
         }
         else
         {
             MsgBox.Show(this, "Problem code provided is not an existing ICD9 or SNOMED code.");
             //no harm in continuing since this form is error checked on OK click.
         }
     }
     fillCombos();
     if (!IsNew)
     {
         comboUnits.Text = Element.LabValueUnits;
         comboLabValueType.SelectedIndex = (int)Element.LabValueType;
     }
     textLabValue.Text = Element.LabValue;
     if (Element.StartDate.Year > 1880)
     {
         textDateStart.Text = Element.StartDate.ToShortDateString();
     }
     if (Element.EndDate.Year > 1880)
     {
         textDateStop.Text = Element.EndDate.ToShortDateString();
     }
     ChangeLayout();
 }
コード例 #20
0
        private void FillGridEdu()
        {
            gridEdu.BeginUpdate();
            gridEdu.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Criteria", 300);

            gridEdu.Columns.Add(col);
            col = new ODGridColumn("Link", 100);
            gridEdu.Columns.Add(col);
            eduResourceList = EduResources.GenerateForPatient(patCur.PatNum);
            gridEdu.Rows.Clear();
            ODGridRow row;

            foreach (EduResource eduResCur in eduResourceList)
            {
                row = new ODGridRow();
                if (eduResCur.DiseaseDefNum != 0)
                {
                    row.Cells.Add("Problem: " + DiseaseDefs.GetItem(eduResCur.DiseaseDefNum).DiseaseName);
                    //row.Cells.Add("ICD9: "+DiseaseDefs.GetItem(eduResCur.DiseaseDefNum).ICD9Code);
                }
                else if (eduResCur.MedicationNum != 0)
                {
                    row.Cells.Add("Medication: " + Medications.GetDescription(eduResCur.MedicationNum));
                }
                else if (eduResCur.SmokingSnoMed != "")
                {
                    Snomed sCur        = Snomeds.GetByCode(eduResCur.SmokingSnoMed);
                    string criteriaCur = "Tobacco Use Assessment: ";
                    if (sCur != null)
                    {
                        criteriaCur += sCur.Description;
                    }
                    row.Cells.Add(criteriaCur);
                }
                else
                {
                    row.Cells.Add("Lab Results: " + eduResCur.LabResultName);
                }
                row.Cells.Add(eduResCur.ResourceUrl);
                gridEdu.Rows.Add(row);
            }
            gridEdu.EndUpdate();
        }
コード例 #21
0
ファイル: FormAllergyEdit.cs プロジェクト: royedwards/DRDNet
        private void FormAllergyEdit_Load(object sender, EventArgs e)
        {
            int allergyIndex = 0;

            allergyDefList = AllergyDefs.GetAll(false);
            if (allergyDefList.Count < 1)
            {
                MsgBox.Show(this, "Need to set up at least one Allergy from EHR setup window.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            for (int i = 0; i < allergyDefList.Count; i++)
            {
                comboAllergies.Items.Add(allergyDefList[i].Description);
                if (!AllergyCur.IsNew && allergyDefList[i].AllergyDefNum == AllergyCur.AllergyDefNum)
                {
                    allergyIndex = i;
                }
            }
            snomedReaction = Snomeds.GetByCode(AllergyCur.SnomedReaction);
            if (snomedReaction != null)
            {
                textSnomedReaction.Text = snomedReaction.Description;
            }
            if (!AllergyCur.IsNew)
            {
                if (AllergyCur.DateAdverseReaction < DateTime.Parse("01-01-1880"))
                {
                    textDate.Text = "";
                }
                else
                {
                    textDate.Text = AllergyCur.DateAdverseReaction.ToShortDateString();
                }
                comboAllergies.SelectedIndex = allergyIndex;
                textReaction.Text            = AllergyCur.Reaction;
                checkActive.Checked          = AllergyCur.StatusIsActive;
            }
            else
            {
                comboAllergies.SelectedIndex = 0;
            }
        }
コード例 #22
0
ファイル: CodeSystems.cs プロジェクト: royedwards/DRDNet
        ///<summary>Called after file is downloaded.  Throws exceptions.  It is assumed that this is called from a worker thread.  Progress delegate will be called every 100th iteration to inform thread of current progress. Quit flag can be set at any time in order to quit importing prematurely.</summary>
        public static void ImportSnomed(string tempFileName, ProgressArgs progress, ref bool quit, ref int numCodesImported, ref int numCodesUpdated,
                                        bool updateExisting)
        {
            if (tempFileName == null)
            {
                return;
            }
            Dictionary <string, Snomed> dictSnomeds = Snomeds.GetAll().ToDictionary(x => x.SnomedCode, x => x);

            string[] lines = File.ReadAllLines(tempFileName);
            string[] arraySnomed;
            Snomed   snomed = new Snomed();

            for (int i = 0; i < lines.Length; i++)       //each loop should read exactly one line of code. and each line of code should be a unique code
            {
                if (quit)
                {
                    return;
                }
                if (i % 100 == 0)
                {
                    progress(i + 1, lines.Length);
                }
                arraySnomed = lines[i].Split('\t');
                if (dictSnomeds.ContainsKey(arraySnomed[0]))                 //code already exists
                {
                    snomed = dictSnomeds[arraySnomed[0]];
                    if (updateExisting && snomed.Description != arraySnomed[1])
                    {
                        snomed.Description = arraySnomed[1];
                        Snomeds.Update(snomed);
                        numCodesUpdated++;
                    }
                    continue;
                }
                snomed.SnomedCode  = arraySnomed[0];
                snomed.Description = arraySnomed[1];
                Snomeds.Insert(snomed);
                numCodesImported++;
            }
        }
コード例 #23
0
 private void FormEhrMeasureEventEdit_Load(object sender, EventArgs e)
 {
     textDateTime.Text = MeasCur.DateTEvent.ToString();
     if (MeasCur.EventType == EhrMeasureEventType.TobaccoUseAssessed)
     {
         Loinc lCur = Loincs.GetByCode(MeasCur.CodeValueEvent);              //TobaccoUseAssessed events can be one of three types, all LOINC codes
         if (lCur != null)
         {
             textType.Text = lCur.NameLongCommon;                  //Example: History of tobacco use Narrative
         }
         Snomed sCur = Snomeds.GetByCode(MeasCur.CodeValueResult); //TobaccoUseAssessed results can be any SNOMEDCT code, we recommend one of 8 codes, but the CQM measure allows 54 codes and we let the user select any SNOMEDCT they want
         if (sCur != null)
         {
             textResult.Text = sCur.Description;                  //Examples: Non-smoker (finding) or Smoker (finding)
         }
     }
     if (textType.Text == "")          //if not set by LOINC name above, then either not a TobaccoUseAssessed event or the code was not in the LOINC table, fill with EventType
     {
         textType.Text = MeasCur.EventType.ToString();
     }
     textMoreInfo.Text = MeasCur.MoreInfo;
 }
コード例 #24
0
        private void FormEncounterTool_Load(object sender, EventArgs e)
        {
            FillRecEncCodesList();
            int countNotInSnomedTable = 0;

            for (int i = 0; i < _listRecEncCodes.Count; i++)
            {
                if (!Snomeds.CodeExists(_listRecEncCodes[i]))
                {
                    countNotInSnomedTable++;
                    continue;
                }
                comboEncCodes.Items.Add(_listRecEncCodes[i]);
            }
            if (countNotInSnomedTable > 0)
            {
                MsgBox.Show(this, "The snomed table does not contain one or more codes from the list of recommended encounter codes.  The snomed table should "
                            + "be updated by running the Code System Importer tool found in Setup | Chart | EHR.");
            }
            comboEncCodes.SelectedIndex = EncListSelectedIdx;
            textEncCodeValue.Text       = EncCodeValue;
            textEncCodeDescript.Text    = CodeDescription;
            labelEncWarning.Visible     = false;
        }
コード例 #25
0
        private void FormEhrAptObsEdit_Load(object sender, EventArgs e)
        {
            _appt = Appointments.GetOneApt(_ehrAptObsCur.AptNum);
            comboObservationQuestion.Items.Clear();
            string[] arrayQuestionNames = Enum.GetNames(typeof(EhrAptObsIdentifier));
            for (int i = 0; i < arrayQuestionNames.Length; i++)
            {
                comboObservationQuestion.Items.Add(arrayQuestionNames[i]);
                EhrAptObsIdentifier ehrAptObsIdentifier = (EhrAptObsIdentifier)i;
                if (_ehrAptObsCur.IdentifyingCode == ehrAptObsIdentifier)
                {
                    comboObservationQuestion.SelectedIndex = i;
                }
            }
            listValueType.Items.Clear();
            string[] arrayValueTypeNames = Enum.GetNames(typeof(EhrAptObsType));
            for (int i = 0; i < arrayValueTypeNames.Length; i++)
            {
                listValueType.Items.Add(arrayValueTypeNames[i]);
                EhrAptObsType ehrAptObsType = (EhrAptObsType)i;
                if (_ehrAptObsCur.ValType == ehrAptObsType)
                {
                    listValueType.SelectedIndex = i;
                }
            }
            if (_ehrAptObsCur.ValType == EhrAptObsType.Coded)
            {
                _strValCodeSystem = _ehrAptObsCur.ValCodeSystem;
                if (_ehrAptObsCur.ValCodeSystem == "LOINC")
                {
                    _loincValue    = Loincs.GetByCode(_ehrAptObsCur.ValReported);
                    textValue.Text = _loincValue.NameShort;
                }
                else if (_ehrAptObsCur.ValCodeSystem == "SNOMEDCT")
                {
                    _snomedValue   = Snomeds.GetByCode(_ehrAptObsCur.ValReported);
                    textValue.Text = _snomedValue.Description;
                }
                else if (_ehrAptObsCur.ValCodeSystem == "ICD9")
                {
                    _icd9Value     = ICD9s.GetByCode(_ehrAptObsCur.ValReported);
                    textValue.Text = _icd9Value.Description;
                }
                else if (_ehrAptObsCur.ValCodeSystem == "ICD10")
                {
                    _icd10Value    = Icd10s.GetByCode(_ehrAptObsCur.ValReported);
                    textValue.Text = _icd10Value.Description;
                }
            }
            else
            {
                textValue.Text = _ehrAptObsCur.ValReported;
            }
            comboUnits.Items.Clear();
            comboUnits.Items.Add("none");
            comboUnits.SelectedIndex = 0;
            List <string> listUcumCodes = Ucums.GetAllCodes();

            for (int i = 0; i < listUcumCodes.Count; i++)
            {
                string ucumCode = listUcumCodes[i];
                comboUnits.Items.Add(ucumCode);
                if (ucumCode == _ehrAptObsCur.UcumCode)
                {
                    comboUnits.SelectedIndex = i + 1;
                }
            }
            SetFlags();
        }
コード例 #26
0
        public static string Validate(Appointment appt)
        {
            StringBuilder sb           = new StringBuilder();
            Provider      provFacility = Providers.GetProv(PrefC.GetInt(PrefName.PracticeDefaultProv));

            if (!Regex.IsMatch(provFacility.NationalProvID, "^(80840)?[0-9]{10}$"))
            {
                WriteError(sb, "Invalid NPI for provider '" + provFacility.Abbr + "'");
            }
            if (PrefC.HasClinicsEnabled && appt.ClinicNum != 0)           //Using clinics and a clinic is assigned.
            {
                Clinic clinic = Clinics.GetClinic(appt.ClinicNum);
                if (clinic.Description == "")
                {
                    WriteError(sb, "Missing clinic description for clinic attached to appointment.");
                }
            }
            else              //Not using clinics for this patient
            {
                if (PrefC.GetString(PrefName.PracticeTitle) == "")
                {
                    WriteError(sb, "Missing practice title.");
                }
            }
            Patient pat = Patients.GetPat(appt.PatNum);

            if (pat.PatStatus == PatientStatus.Deceased && pat.DateTimeDeceased.Year < 1880)
            {
                WriteError(sb, "Missing date time deceased.");
            }
            List <EhrAptObs> listObservations = EhrAptObses.Refresh(appt.AptNum);

            if (listObservations.Count == 0)
            {
                WriteError(sb, "Missing observation.");
            }
            for (int i = 0; i < listObservations.Count; i++)
            {
                EhrAptObs obs = listObservations[i];
                if (obs.ValType == EhrAptObsType.Coded)
                {
                    if (obs.ValCodeSystem.Trim().ToUpper() == "LOINC")
                    {
                        Loinc loincVal = Loincs.GetByCode(obs.ValReported);
                        if (loincVal == null)
                        {
                            WriteError(sb, "Loinc code not found '" + loincVal.LoincCode + "'.  Please add by going to Setup | Chart | EHR.");
                        }
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "SNOMEDCT")
                    {
                        Snomed snomedVal = Snomeds.GetByCode(obs.ValReported);
                        if (snomedVal == null)
                        {
                            WriteError(sb, "Snomed code not found '" + snomedVal.SnomedCode + "'.  Please add by going to Setup | Chart | EHR.");
                        }
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "ICD9")
                    {
                        ICD9 icd9Val = ICD9s.GetByCode(obs.ValReported);
                        if (icd9Val == null)
                        {
                            WriteError(sb, "ICD9 code not found '" + icd9Val.ICD9Code + "'.  Please add by going to Setup | Chart | EHR.");
                        }
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "ICD10")
                    {
                        Icd10 icd10Val = Icd10s.GetByCode(obs.ValReported);
                        if (icd10Val == null)
                        {
                            WriteError(sb, "ICD10 code not found '" + icd10Val.Icd10Code + "'.  Please add by going to Setup | Chart | EHR.");
                        }
                    }
                }
                else if (obs.ValType == EhrAptObsType.Numeric && obs.UcumCode != "")             //We only validate the ucum code if it will be sent out.  Blank units allowed.
                {
                    Ucum ucum = Ucums.GetByCode(obs.UcumCode);
                    if (ucum == null)
                    {
                        WriteError(sb, "Invalid unit code '" + obs.UcumCode + "' for observation (must be UCUM code).");
                    }
                }
            }
            return(sb.ToString());
        }
コード例 #27
0
        ///<summary>Observation/result segment.  Used to transmit observations related to the patient and visit.  Guide page 64.</summary>
        private void OBX()
        {
            List <EhrAptObs> listObservations = EhrAptObses.Refresh(_appt.AptNum);

            for (int i = 0; i < listObservations.Count; i++)
            {
                EhrAptObs obs = listObservations[i];
                _seg = new SegmentHL7(SegmentNameHL7.OBX);
                _seg.SetField(0, "OBX");
                _seg.SetField(1, (i + 1).ToString());             //OBX-1 Set ID - OBX.  Required (length 1..4).  Must start at 1 and increment.
                //OBX-2 Value Type.  Required (length 1..3).  Cardinality [1..1].  Identifies the structure of data in observation value OBX-5.  Values allowed: TS=Time Stamp (Date and/or Time),TX=Text,NM=Numeric,CWE=Coded with exceptions,XAD=Address.
                if (obs.ValType == EhrAptObsType.Coded)
                {
                    _seg.SetField(2, "CWE");
                }
                else if (obs.ValType == EhrAptObsType.DateAndTime)
                {
                    _seg.SetField(2, "TS");
                }
                else if (obs.ValType == EhrAptObsType.Numeric)
                {
                    _seg.SetField(2, "NM");
                }
                else                  //obs.ValType==EhrAptObsType.Text
                {
                    _seg.SetField(2, "TX");
                }
                //OBX-3 Observation Identifier.  Required (length up to 478).  Cardinality [1..1].  Value set is HL7 table named "Observation Identifier".  Type CE.  We use LOINC codes because the testing tool used LOINC codes and so do vaccines.
                string obsIdCode         = "";
                string obsIdCodeDescript = "";
                string obsIdCodeSystem   = "LN";
                if (obs.IdentifyingCode == EhrAptObsIdentifier.BodyTemp)
                {
                    obsIdCode         = "11289-6";
                    obsIdCodeDescript = "Body temperature:Temp:Enctrfrst:Patient:Qn:";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.CheifComplaint)
                {
                    obsIdCode         = "8661-1";
                    obsIdCodeDescript = "Chief complaint:Find:Pt:Patient:Nom:Reported";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.DateIllnessOrInjury)
                {
                    obsIdCode         = "11368-8";
                    obsIdCodeDescript = "Illness or injury onset date and time:TmStp:Pt:Patient:Qn:";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.OxygenSaturation)
                {
                    obsIdCode         = "59408-5";
                    obsIdCodeDescript = "Oxygen saturation:MFr:Pt:BldA:Qn:Pulse oximetry";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.PatientAge)
                {
                    obsIdCode         = "21612-7";
                    obsIdCodeDescript = "Age Time Patient Reported";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.PrelimDiag)
                {
                    obsIdCode         = "44833-2";
                    obsIdCodeDescript = "Diagnosis.preliminary:Imp:Pt:Patient:Nom:";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.TreatFacilityID)
                {
                    obsIdCode         = "SS001";
                    obsIdCodeDescript = "Treating Facility Identifier";
                    obsIdCodeSystem   = "PHINQUESTION";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.TreatFacilityLocation)
                {
                    obsIdCode         = "SS002";
                    obsIdCodeDescript = "Treating Facility Location";
                    obsIdCodeSystem   = "PHINQUESTION";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.TriageNote)
                {
                    obsIdCode         = "54094-8";
                    obsIdCodeDescript = "Triage note:Find:Pt:Emergency department:Doc:";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.VisitType)
                {
                    obsIdCode         = "SS003";
                    obsIdCodeDescript = "Facility / Visit Type";
                    obsIdCodeSystem   = "PHINQUESTION";
                }
                WriteCE(3, obsIdCode, obsIdCodeDescript, obsIdCodeSystem);
                //OBX-4 Observation Sub-ID.  No longer used.
                //OBX-5 Observation Value.  Required if known (length 1..99999).  Value must match type in OBX-2.
                if (obs.ValType == EhrAptObsType.Address)
                {
                    WriteXAD(5, _sendingFacilityAddress1, _sendingFacilityAddress2, _sendingFacilityCity, _sendingFacilityState, _sendingFacilityZip);
                }
                else if (obs.ValType == EhrAptObsType.Coded)
                {
                    string codeDescript     = "";
                    string codeSystemAbbrev = "";
                    if (obs.ValCodeSystem.Trim().ToUpper() == "LOINC")
                    {
                        Loinc loincVal = Loincs.GetByCode(obs.ValReported);
                        codeDescript     = loincVal.NameShort;
                        codeSystemAbbrev = "LN";
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "SNOMEDCT")
                    {
                        Snomed snomedVal = Snomeds.GetByCode(obs.ValReported);
                        codeDescript     = snomedVal.Description;
                        codeSystemAbbrev = "SCT";
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "ICD9")
                    {
                        ICD9 icd9Val = ICD9s.GetByCode(obs.ValReported);
                        codeDescript     = icd9Val.Description;
                        codeSystemAbbrev = "I9";
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "ICD10")
                    {
                        Icd10 icd10Val = Icd10s.GetByCode(obs.ValReported);
                        codeDescript     = icd10Val.Description;
                        codeSystemAbbrev = "I10";
                    }
                    WriteCE(5, obs.ValReported.Trim(), codeDescript, codeSystemAbbrev);
                }
                else if (obs.ValType == EhrAptObsType.DateAndTime)
                {
                    DateTime dateVal    = DateTime.Parse(obs.ValReported.Trim());
                    string   strDateOut = dateVal.ToString("yyyyMMdd");
                    //The testing tool threw errors when there were trailing zeros, even though technically valid.
                    if (dateVal.Second > 0)
                    {
                        strDateOut += dateVal.ToString("HHmmss");
                    }
                    else if (dateVal.Minute > 0)
                    {
                        strDateOut += dateVal.ToString("HHmm");
                    }
                    else if (dateVal.Hour > 0)
                    {
                        strDateOut += dateVal.ToString("HH");
                    }
                    _seg.SetField(5, strDateOut);
                }
                else if (obs.ValType == EhrAptObsType.Numeric)
                {
                    _seg.SetField(5, obs.ValReported.Trim());
                }
                else                   //obs.ValType==EhrAptObsType.Text
                {
                    _seg.SetField(5, obs.ValReported);
                }
                //OBX-6 Units.  Required if OBX-2 is NM=Numeric.  Cardinality [0..1].  Type CE.  The guide suggests value sets: Pulse Oximetry Unit, Temperature Unit, or Age Unit.  However, the testing tool used UCUM, so we will use UCUM.
                if (obs.ValType == EhrAptObsType.Numeric)
                {
                    if (String.IsNullOrEmpty(obs.UcumCode))                      //If units are required but known, we must send a null flavor.
                    {
                        WriteCE(6, "UNK", "", "NULLFL");
                    }
                    else
                    {
                        Ucum ucum = Ucums.GetByCode(obs.UcumCode);
                        WriteCE(6, ucum.UcumCode, ucum.Description, "UCUM");
                    }
                }
                //OBX-7 References Range.  No longer used.
                //OBX-8 Abnormal Flags.  No longer used.
                //OBX-9 Probability.  No longer used.
                //OBX-10 Nature of Abnormal Test.  No longer used.
                _seg.SetField(11, "F");               //OBX-11 Observation Result Status.  Required (length 1..1).  Expected value is "F".
                //OBX-12 Effective Date of Reference Range.  No longer used.
                //OBX-13 User Defined Access Checks.  No longer used.
                //OBX-14 Date/Time of the Observation.  Optional.
                //OBX-15 Producer's ID.  No longer used.
                //OBX-16 Responsible Observer.  No longer used.
                //OBX-17 Observation Method.  No longer used.
                //OBX-18 Equipment Instance Identifier.  No longer used.
                //OBX-19 Date/Time of the Analysis.  No longer used.
                _msg.Segments.Add(_seg);
            }
        }
コード例 #28
0
        private void FillGridObservations()
        {
            gridObservations.BeginUpdate();
            gridObservations.ListGridColumns.Clear();
            gridObservations.ListGridColumns.Add(new UI.GridColumn("Observation", 200));   //0
            gridObservations.ListGridColumns.Add(new UI.GridColumn("Value Type", 200));    //1
            gridObservations.ListGridColumns.Add(new UI.GridColumn("Value", 0));           //2
            gridObservations.ListGridRows.Clear();
            List <EhrAptObs> listEhrAptObses = EhrAptObses.Refresh(_appt.AptNum);

            for (int i = 0; i < listEhrAptObses.Count; i++)
            {
                EhrAptObs  obs = listEhrAptObses[i];
                UI.GridRow row = new UI.GridRow();
                row.Tag = obs;
                row.Cells.Add(obs.IdentifyingCode.ToString());                //0 Observation
                if (obs.ValType == EhrAptObsType.Coded)
                {
                    row.Cells.Add(obs.ValType.ToString() + " - " + obs.ValCodeSystem);                //1 Value Type
                    if (obs.ValCodeSystem == "LOINC")
                    {
                        Loinc loincValue = Loincs.GetByCode(obs.ValReported);
                        row.Cells.Add(loincValue.NameShort);                        //2 Value
                    }
                    else if (obs.ValCodeSystem == "SNOMEDCT")
                    {
                        Snomed snomedValue = Snomeds.GetByCode(obs.ValReported);
                        row.Cells.Add(snomedValue.Description);                        //2 Value
                    }
                    else if (obs.ValCodeSystem == "ICD9")
                    {
                        ICD9 icd9Value = ICD9s.GetByCode(obs.ValReported);
                        row.Cells.Add(icd9Value.Description);                        //2 Value
                    }
                    else if (obs.ValCodeSystem == "ICD10")
                    {
                        Icd10 icd10Value = Icd10s.GetByCode(obs.ValReported);
                        row.Cells.Add(icd10Value.Description);                        //2 Value
                    }
                }
                else if (obs.ValType == EhrAptObsType.Address)
                {
                    string sendingFacilityAddress1 = PrefC.GetString(PrefName.PracticeAddress);
                    string sendingFacilityAddress2 = PrefC.GetString(PrefName.PracticeAddress2);
                    string sendingFacilityCity     = PrefC.GetString(PrefName.PracticeCity);
                    string sendingFacilityState    = PrefC.GetString(PrefName.PracticeST);
                    string sendingFacilityZip      = PrefC.GetString(PrefName.PracticeZip);
                    if (PrefC.HasClinicsEnabled && _appt.ClinicNum != 0)                   //Using clinics and a clinic is assigned.
                    {
                        Clinic clinic = Clinics.GetClinic(_appt.ClinicNum);
                        sendingFacilityAddress1 = clinic.Address;
                        sendingFacilityAddress2 = clinic.Address2;
                        sendingFacilityCity     = clinic.City;
                        sendingFacilityState    = clinic.State;
                        sendingFacilityZip      = clinic.Zip;
                    }
                    row.Cells.Add(obs.ValType.ToString());                                                                                                                      //1 Value Type
                    row.Cells.Add(sendingFacilityAddress1 + " " + sendingFacilityAddress2 + " " + sendingFacilityCity + " " + sendingFacilityState + " " + sendingFacilityZip); //2 Value
                }
                else
                {
                    row.Cells.Add(obs.ValType.ToString());             //1 Value Type
                    row.Cells.Add(obs.ValReported);                    //2 Value
                }
                gridObservations.ListGridRows.Add(row);
            }
            gridObservations.EndUpdate();
        }
コード例 #29
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            if (_showingInfoButton)                       //Security.IsAuthorized(Permissions.EhrInfoButton,true)) {
            {
                col           = new ODGridColumn("", 18); //infoButton
                col.ImageList = imageListInfoButton;
                gridMain.Columns.Add(col);
            }
            col = new ODGridColumn("SNOMED CT", 100);
            gridMain.Columns.Add(col);
            //col=new ODGridColumn("Deprecated",75,HorizontalAlignment.Center);
            //gridMain.Columns.Add(col);
            col = new ODGridColumn("Description", 500);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Used By CQM's", 75);
            gridMain.Columns.Add(col);
            //col=new ODGridColumn("Date Of Standard",100);
            //gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            if (textCode.Text.Contains(","))
            {
                SnomedList = Snomeds.GetByCodes(textCode.Text);
            }
            else
            {
                SnomedList = Snomeds.GetByCodeOrDescription(textCode.Text);
            }
            if (SnomedList.Count >= 10000)           //Max number of results returned.
            {
                MsgBox.Show(this, "Too many results. Only the first 10,000 results will be shown.");
            }
            List <ODGridRow> listAll = new List <ODGridRow>();

            for (int i = 0; i < SnomedList.Count; i++)
            {
                row = new ODGridRow();
                if (_showingInfoButton)                 //Security.IsAuthorized(Permissions.EhrInfoButton,true)) {
                {
                    row.Cells.Add("0");                 //index of infobutton
                }
                row.Cells.Add(SnomedList[i].SnomedCode);
                //row.Cells.Add("");//IsActive==NotDeprecated
                row.Cells.Add(SnomedList[i].Description);
                row.Cells.Add(EhrCodes.GetMeasureIdsForCode(SnomedList[i].SnomedCode, "SNOMEDCT"));
                row.Tag = SnomedList[i];
                //row.Cells.Add("");
                listAll.Add(row);
            }
            listAll.Sort(SortMeasuresMet);
            for (int i = 0; i < listAll.Count; i++)
            {
                gridMain.Rows.Add(listAll[i]);
            }
            gridMain.EndUpdate();
        }
コード例 #30
0
        private bool IsValid()
        {
            int index = listRestriction.SelectedIndex;

            if (index != 3)           //Not LabResult
            {
                textLabValue.Text = "";
            }
            if (index == 4)
            {
                textCompareString.Text = "";
            }
            switch (index)
            {
            case 0:                                          //Birthdate------------------------------------------------------------------------------------------------------------
                try {
                    Convert.ToInt32(textCompareString.Text); //used intead of PIn so that an empty string is not evaluated as 0
                }
                catch {
                    MsgBox.Show(this, "Please enter a valid age.");
                    return(false);
                }
                break;

            case 1:                     //Disease--------------------------------------------------------------------------------------------------------------
                if (textCompareString.Text == "" && textSNOMED.Text == "")
                {
                    MsgBox.Show(this, "Please enter a valid SNOMED or ICD9 code.");
                    return(false);
                }
                if (textCompareString.Text != "")
                {
                    if (ICD9s.GetByCode(textCompareString.Text) == null)
                    {
                        MsgBox.Show(this, "ICD9 code does not exist in database, pick from list.");
                        return(false);
                    }
                }
                if (textSNOMED.Text != "")
                {
                    if (Snomeds.GetByCode(textSNOMED.Text) == null)
                    {
                        MsgBox.Show(this, "SNOMED code does not exist in database, pick from list.");
                        return(false);
                    }
                }
                if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                    textDateStop.errorProvider1.GetError(textDateStop) != ""
                    )
                {
                    MessageBox.Show(Lan.g(this, "Please fix date entry errors."));
                    return(false);
                }
                break;

            case 2:                     //Medication-----------------------------------------------------------------------------------------------------------
                if (textCompareString.Text == "")
                {
                    MsgBox.Show(this, "Please enter a valid medication.");
                    return(false);
                }
                if (Medications.GetMedicationFromDbByName(textCompareString.Text) == null)
                {
                    MsgBox.Show(this, "Medication does not exist in database, pick from list.");
                    return(false);
                }
                if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                    textDateStop.errorProvider1.GetError(textDateStop) != ""
                    )
                {
                    MessageBox.Show(Lan.g(this, "Please fix date entry errors."));
                    return(false);
                }
                break;

            case 3:                     //LabResult------------------------------------------------------------------------------------------------------------
                if (textCompareString.Text == "")
                {
                    MsgBox.Show(this, "Please select a valid LOINC Code.");
                    return(false);
                }
                if (LOINCs.GetByCode(textCompareString.Text) == null)
                {
                    MsgBox.Show(this, "LOINC code does not exist in database, pick from list.");
                    return(false);
                }
                if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                    textDateStop.errorProvider1.GetError(textDateStop) != ""
                    )
                {
                    MessageBox.Show(Lan.g(this, "Please fix date entry errors."));
                    return(false);
                }
                break;

            case 4:                     //Gender---------------------------------------------------------------------------------------------------------------
                break;

            case 5:                     //CommPref-------------------------------------------------------------------------------------------------------------
                if (textCompareString.Text == "")
                {
                    MsgBox.Show(this, "Please enter a communication preference.");
                    return(false);
                }
                if (LOINCs.GetByCode(textCompareString.Text) == null)
                {
                    MsgBox.Show(this, "Communication preference not defined, pick from list.");
                    return(false);
                }
                break;

            case 6:                     //Allergy--------------------------------------------------------------------------------------------------------------
                if (textCompareString.Text == "")
                {
                    MsgBox.Show(this, "Please enter a valid allergy.");
                    return(false);
                }
                if (AllergyDefs.GetByDescription(textCompareString.Text) == null)
                {
                    MsgBox.Show(this, "Allergy does not exist in database, pick from list.");
                    return(false);
                }
                if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                    textDateStop.errorProvider1.GetError(textDateStop) != ""
                    )
                {
                    MessageBox.Show(Lan.g(this, "Please fix date entry errors."));
                    return(false);
                }
                break;
            }
            return(true);
        }