Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
        ///<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());
        }
Ejemplo n.º 3
0
 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;
     }
 }
Ejemplo n.º 4
0
 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;
     }
 }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
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;
        }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
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;
        }
Ejemplo n.º 9
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();
 }
Ejemplo n.º 10
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();
        }
Ejemplo n.º 11
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;
 }
Ejemplo n.º 12
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();
        }
Ejemplo n.º 13
0
        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;
            }
        }
Ejemplo n.º 14
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;
 }
 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.GetByCode(Element.CompareString) != null)
         {
             textCompareString.Text = Element.CompareString;
         }
         else if (Snomeds.GetByCode(Element.CompareString) != null)
         {
             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.
         }
     }
     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();
 }
Ejemplo n.º 16
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());
        }
Ejemplo n.º 17
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);
            }
        }
Ejemplo n.º 18
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Date", 70);

            gridMain.Columns.Add(col);
            col = new ODGridColumn("Type", 170);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Description", 170);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Documentation", 170);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow        row;
            List <ODGridRow> listRows = new List <ODGridRow>();

            #region AssessedEvents
            _ListEvents = EhrMeasureEvents.RefreshByType(PatCur.PatNum, EhrMeasureEventType.TobaccoUseAssessed);
            for (int i = 0; i < _ListEvents.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_ListEvents[i].DateTEvent.ToShortDateString());
                Loinc lCur = Loincs.GetByCode(_ListEvents[i].CodeValueEvent);              //TobaccoUseAssessed events can be one of three types, all LOINC codes
                if (lCur != null)
                {
                    row.Cells.Add(lCur.NameLongCommon);
                }
                else
                {
                    row.Cells.Add(_ListEvents[i].EventType.ToString());
                }
                Snomed sCur = Snomeds.GetByCode(_ListEvents[i].CodeValueResult);
                if (sCur != null)
                {
                    row.Cells.Add(sCur.Description);
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(_ListEvents[i].MoreInfo);
                row.Tag = _ListEvents[i];
                listRows.Add(row);
            }
            #endregion
            #region CessationInterventions
            _ListInterventions = Interventions.Refresh(PatCur.PatNum, InterventionCodeSet.TobaccoCessation);
            for (int i = 0; i < _ListInterventions.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_ListInterventions[i].DateEntry.ToShortDateString());
                row.Cells.Add(InterventionCodeSet.TobaccoCessation.ToString() + " Counseling");
                string descript = "";
                switch (_ListInterventions[i].CodeSystem)
                {
                case "CPT":
                    Cpt cptCur = Cpts.GetByCode(_ListInterventions[i].CodeValue);
                    if (cptCur != null)
                    {
                        descript = cptCur.Description;
                    }
                    break;

                case "SNOMEDCT":
                    Snomed sCur = Snomeds.GetByCode(_ListInterventions[i].CodeValue);
                    if (sCur != null)
                    {
                        descript = sCur.Description;
                    }
                    break;
                }
                row.Cells.Add(descript);
                row.Cells.Add(_ListInterventions[i].Note);
                row.Tag = _ListInterventions[i];
                listRows.Add(row);
            }
            #endregion
            #region CessationMedications
            _ListMedPats = MedicationPats.Refresh(PatCur.PatNum, true);
            List <EhrCode> listEhrMeds = EhrCodes.GetForValueSetOIDs(new List <string> {
                "2.16.840.1.113883.3.526.3.1190"
            }, true);                                                                                                                     //Tobacco Use Cessation Pharmacotherapy Value Set
            //listEhrMeds will contain 41 medications for tobacco cessation if those exist in the rxnorm table
            for (int i = _ListMedPats.Count - 1; i > -1; i--)
            {
                bool found = false;
                for (int j = 0; j < listEhrMeds.Count; j++)
                {
                    if (_ListMedPats[i].RxCui.ToString() == listEhrMeds[j].CodeValue)
                    {
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    _ListMedPats.RemoveAt(i);
                }
            }
            for (int i = 0; i < _ListMedPats.Count; i++)
            {
                row = new ODGridRow();
                string dateRange = "";
                if (_ListMedPats[i].DateStart.Year > 1880)
                {
                    dateRange = _ListMedPats[i].DateStart.ToShortDateString();
                }
                if (_ListMedPats[i].DateStop.Year > 1880)
                {
                    if (dateRange != "")
                    {
                        dateRange += " - ";
                    }
                    dateRange += _ListMedPats[i].DateStop.ToShortDateString();
                }
                if (dateRange == "")
                {
                    dateRange = _ListMedPats[i].DateTStamp.ToShortDateString();
                }
                row.Cells.Add(dateRange);
                row.Cells.Add(InterventionCodeSet.TobaccoCessation.ToString() + " Medication");
                string medDescript = RxNorms.GetDescByRxCui(_ListMedPats[i].RxCui.ToString());
                row.Cells.Add(medDescript);
                row.Cells.Add(_ListMedPats[i].PatNote);
                row.Tag = _ListMedPats[i];
                listRows.Add(row);
            }
            #endregion
            listRows.Sort(SortDate);
            for (int i = 0; i < listRows.Count; i++)
            {
                gridMain.Rows.Add(listRows[i]);
            }
            gridMain.EndUpdate();
        }
Ejemplo n.º 19
0
        private void FormPatientSmoking_Load(object sender, EventArgs e)
        {
            PatOld = PatCur.Copy();
            _TobaccoCodeSelected  = PatCur.SmokingSnoMed;
            textDateAssessed.Text = DateTime.Now.ToString();
            #region ComboSmokeStatus
            comboSmokeStatus.Items.Add("None");            //First and default index
            //Smoking statuses add in the same order as they appear in the SmokingSnoMed enum (Starting at comboSmokeStatus index 1). Changes to the enum order will change the order added so they will always match
            for (int i = 0; i < Enum.GetNames(typeof(SmokingSnoMed)).Length; i++)
            {
                //if snomed code exists in the snomed table, use the code - description for the combo box, otherwise use the original abbreviated description
                Snomed smokeCur = Snomeds.GetByCode(((SmokingSnoMed)i).ToString().Substring(1));
                if (smokeCur != null)
                {
                    comboSmokeStatus.Items.Add(smokeCur.Description);
                }
                else
                {
                    switch ((SmokingSnoMed)i)
                    {
                    case SmokingSnoMed._266927001:
                        comboSmokeStatus.Items.Add("UnknownIfEver");
                        break;

                    case SmokingSnoMed._77176002:
                        comboSmokeStatus.Items.Add("SmokerUnknownCurrent");
                        break;

                    case SmokingSnoMed._266919005:
                        comboSmokeStatus.Items.Add("NeverSmoked");
                        break;

                    case SmokingSnoMed._8517006:
                        comboSmokeStatus.Items.Add("FormerSmoker");
                        break;

                    case SmokingSnoMed._428041000124106:
                        comboSmokeStatus.Items.Add("CurrentSomeDay");
                        break;

                    case SmokingSnoMed._449868002:
                        comboSmokeStatus.Items.Add("CurrentEveryDay");
                        break;

                    case SmokingSnoMed._428061000124105:
                        comboSmokeStatus.Items.Add("LightSmoker");
                        break;

                    case SmokingSnoMed._428071000124103:
                        comboSmokeStatus.Items.Add("HeavySmoker");
                        break;
                    }
                }
            }
            comboSmokeStatus.SelectedIndex = 0;          //None
            try {
                comboSmokeStatus.SelectedIndex = (int)Enum.Parse(typeof(SmokingSnoMed), "_" + _TobaccoCodeSelected, true) + 1;
            }
            catch {
                //if not one of the statuses in the enum, get the Snomed object from the patient's current smoking snomed code
                Snomed smokeCur = Snomeds.GetByCode(_TobaccoCodeSelected);
                if (smokeCur != null)               //valid snomed code, set the combo box text to this snomed description
                {
                    comboSmokeStatus.SelectedIndex = -1;
                    comboSmokeStatus.Text          = smokeCur.Description;
                }
            }
            #endregion
            //This takes a while the first time the window loads due to Code Systems.
            Cursor = Cursors.WaitCursor;
            FillGrid();
            Cursor = Cursors.Default;
            #region ComboAssessmentType
            _ListAssessmentCodes = EhrCodes.GetForValueSetOIDs(new List <string> {
                "2.16.840.1.113883.3.526.3.1278"
            }, true);                                      //'Tobacco Use Screening' value set
            if (_ListAssessmentCodes.Count == 0)           //This should only happen if the EHR.dll does not exist or if the codes in the ehrcode list do not exist in the corresponding table
            {
                MsgBox.Show(this, "The codes used for Tobacco Use Screening assessments do not exist in the LOINC table in your database.  You must run the Code System Importer tool in Setup | EHR to import this code set.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            EhrMeasureEvent mostRecentAssessment = new EhrMeasureEvent();
            for (int i = _ListEvents.Count - 1; i > -1; i--)
            {
                if (_ListEvents[i].EventType == EhrMeasureEventType.TobaccoUseAssessed)
                {
                    mostRecentAssessment = _ListEvents[i];                  //_ListEvents filled ordered by DateTEvent, most recent assessment is last one in the list of type assessed
                    break;
                }
            }
            for (int i = 0; i < _ListAssessmentCodes.Count; i++)
            {
                comboAssessmentType.Items.Add(_ListAssessmentCodes[i].Description);
                if (i == 0)
                {
                    comboAssessmentType.SelectedIndex = i;                  //default to the first one in the list, 'History of tobacco use Narrative'
                }
                if (mostRecentAssessment.CodeValueEvent == _ListAssessmentCodes[i].CodeValue && mostRecentAssessment.CodeSystemEvent == _ListAssessmentCodes[i].CodeSystem)
                {
                    comboAssessmentType.SelectedIndex = i;                  //set to most recent assessment
                }
            }
            #endregion
        }
        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);
        }
Ejemplo n.º 21
0
        private void FillGridInterventions()
        {
            gridInterventions.BeginUpdate();
            gridInterventions.Columns.Clear();
            gridInterventions.Columns.Add(new ODGridColumn("Date", 70));
            gridInterventions.Columns.Add(new ODGridColumn("Type", 150));
            gridInterventions.Columns.Add(new ODGridColumn("Description", 160));
            gridInterventions.Columns.Add(new ODGridColumn("Declined", 60)
            {
                TextAlign = HorizontalAlignment.Center
            });
            gridInterventions.Columns.Add(new ODGridColumn("Documentation", 140));
            gridInterventions.Rows.Clear();
            //build list of rows of CessationInterventions and CessationMedications so we can order the list by date and type before filling the grid
            List <ODGridRow> listRows = new List <ODGridRow>();
            ODGridRow        row;

            #region CessationInterventions
            List <Intervention> listInterventions = Interventions.Refresh(PatCur.PatNum, InterventionCodeSet.TobaccoCessation);
            foreach (Intervention iCur in listInterventions)
            {
                row = new ODGridRow();
                row.Cells.Add(iCur.DateEntry.ToShortDateString());
                string type     = InterventionCodeSet.TobaccoCessation.ToString() + " Counseling";
                string descript = "";
                switch (iCur.CodeSystem)
                {
                case "CPT":
                    Cpt cptCur = Cpts.GetByCode(iCur.CodeValue);
                    descript = cptCur != null?cptCur.Description:"";
                    break;

                case "SNOMEDCT":
                    Snomed sCur = Snomeds.GetByCode(iCur.CodeValue);
                    descript = sCur != null?sCur.Description:"";
                    break;

                case "RXNORM":
                    //if the user checks the "Patient Declined" checkbox, we enter the tobacco cessation medication as an intervention that was declined
                    type = InterventionCodeSet.TobaccoCessation.ToString() + " Medication";
                    RxNorm rCur = RxNorms.GetByRxCUI(iCur.CodeValue);
                    descript = rCur != null?rCur.Description:"";
                    break;
                }
                row.Cells.Add(type);
                row.Cells.Add(descript);
                row.Cells.Add(iCur.IsPatDeclined?"X":"");
                row.Cells.Add(iCur.Note);
                row.Tag = iCur;
                listRows.Add(row);
            }
            #endregion
            #region CessationMedications
            //Tobacco Use Cessation Pharmacotherapy Value Set
            string[] arrayRxCuiStrings = EhrCodes.GetForValueSetOIDs(new List <string> {
                "2.16.840.1.113883.3.526.3.1190"
            }, true)
                                         .Select(x => x.CodeValue).ToArray();
            //arrayRxCuiStrings will contain 41 RxCui strings for tobacco cessation medications if those exist in the rxnorm table
            List <MedicationPat> listMedPats = MedicationPats.Refresh(PatCur.PatNum, true).FindAll(x => arrayRxCuiStrings.Contains(x.RxCui.ToString()));
            foreach (MedicationPat medPatCur in listMedPats)
            {
                row = new ODGridRow();
                List <string> listMedDates = new List <string>();
                if (medPatCur.DateStart.Year > 1880)
                {
                    listMedDates.Add(medPatCur.DateStart.ToShortDateString());
                }
                if (medPatCur.DateStop.Year > 1880)
                {
                    listMedDates.Add(medPatCur.DateStop.ToShortDateString());
                }
                if (listMedDates.Count == 0)
                {
                    listMedDates.Add(medPatCur.DateTStamp.ToShortDateString());
                }
                row.Cells.Add(string.Join(" - ", listMedDates));
                row.Cells.Add(InterventionCodeSet.TobaccoCessation.ToString() + " Medication");
                row.Cells.Add(RxNorms.GetDescByRxCui(medPatCur.RxCui.ToString()));
                row.Cells.Add(medPatCur.PatNote);
                row.Tag = medPatCur;
                listRows.Add(row);
            }
            #endregion
            listRows.OrderBy(x => PIn.Date(x.Cells[0].Text))            //rows ordered by date, oldest first
            .ThenBy(x => x.Cells[3].Text != "")
            //interventions at the top, declined med interventions below normal interventions
            .ThenBy(x => x.Tag.GetType().Name != "Intervention" || ((Intervention)x.Tag).CodeSystem == "RXNORM").ToList()
            .ForEach(x => gridInterventions.Rows.Add(x));                    //then add rows to gridInterventions
            gridInterventions.EndUpdate();
        }
Ejemplo n.º 22
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn("Date", 70);

            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Prov", 50);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Item Not Performed", 130);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Code", 102);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Code Description", 150);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Reason Code", 80);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Reason Description", 150);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Note", 150);
            gridMain.ListGridColumns.Add(col);
            listNotPerf = EhrNotPerformeds.Refresh(PatCur.PatNum);
            gridMain.ListGridRows.Clear();
            GridRow row;

            for (int i = 0; i < listNotPerf.Count; i++)
            {
                row = new GridRow();
                row.Cells.Add(listNotPerf[i].DateEntry.ToShortDateString());
                row.Cells.Add(Providers.GetAbbr(listNotPerf[i].ProvNum));
                //Item not performed------------------------------------------------------------
                switch (listNotPerf[i].CodeValue)
                {
                case "39156-5":                        //BMI exam
                    row.Cells.Add(EhrNotPerformedItem.BMIExam.ToString());
                    break;

                case "428191000124101":                        //CurrentMedsDocumented
                    row.Cells.Add(EhrNotPerformedItem.DocumentCurrentMeds.ToString());
                    break;

                case "11366-2":                        //History of tobacco use Narrative
                case "68535-4":                        //Have you used tobacco in the last 30 days
                case "68536-2":                        //Have you used smokeless tobacco in last 30 days
                    row.Cells.Add(EhrNotPerformedItem.TobaccoScreening.ToString());
                    break;

                default:                        //We will default to Influenza Vaccine, there are 26 codes, for this item
                    row.Cells.Add(EhrNotPerformedItem.InfluenzaVaccination.ToString());
                    break;
                }
                //Code not performed------------------------------------------------------------
                row.Cells.Add(listNotPerf[i].CodeValue + " (" + listNotPerf[i].CodeSystem + ")");
                //Description of code not performed---------------------------------------------
                string descript = "";
                //to get description, first determine which table the code is from.  EhrNotPerformed is allowed to be CPT, CVX, LOINC, SNOMEDCT.
                switch (listNotPerf[i].CodeSystem)
                {
                case "CPT":
                    Cpt cptCur = Cpts.GetByCode(listNotPerf[i].CodeValue);
                    if (cptCur != null)
                    {
                        descript = cptCur.Description;
                    }
                    break;

                case "CVX":
                    Cvx cvxCur = Cvxs.GetOneFromDb(listNotPerf[i].CodeValue);
                    if (cvxCur != null)
                    {
                        descript = cvxCur.Description;
                    }
                    break;

                case "LOINC":
                    Loinc lCur = Loincs.GetByCode(listNotPerf[i].CodeValue);
                    if (lCur != null)
                    {
                        descript = lCur.NameLongCommon;
                    }
                    break;

                case "SNOMEDCT":
                    Snomed sCur = Snomeds.GetByCode(listNotPerf[i].CodeValue);
                    if (sCur != null)
                    {
                        descript = sCur.Description;
                    }
                    break;
                }
                row.Cells.Add(descript);
                //Reason Code-------------------------------------------------------------------
                row.Cells.Add(listNotPerf[i].CodeValueReason + " (" + listNotPerf[i].CodeSystemReason + ")");
                //Reason Description------------------------------------------------------------
                descript = "";
                if (listNotPerf[i].CodeValueReason != "")
                {
                    //reason codes are only allowed to be SNOMEDCT codes
                    Snomed sCur = Snomeds.GetByCode(listNotPerf[i].CodeValueReason);
                    if (sCur != null)
                    {
                        descript = sCur.Description;
                    }
                }
                row.Cells.Add(descript);
                //Note--------------------------------------------------------------------------
                row.Cells.Add(listNotPerf[i].Note);
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
Ejemplo n.º 23
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();
        }
Ejemplo n.º 24
0
        public void FormEncounters_Load(object sender, EventArgs e)
        {
            _patCur          = Patients.GetPat(_encCur.PatNum);
            this.Text       += " - " + _patCur.GetNameLF();
            textDateEnc.Text = _encCur.DateEncounter.ToShortDateString();
            _provNumSelected = _encCur.ProvNum;
            comboProv.Items.Clear();
            _listProviders = Providers.GetDeepCopy(true);
            for (int i = 0; i < _listProviders.Count; i++)
            {
                comboProv.Items.Add(_listProviders[i].GetLongDesc());                //Only visible provs added to combobox.
                if (_listProviders[i].ProvNum == _encCur.ProvNum)
                {
                    comboProv.SelectedIndex = i;                  //Sets combo text too.
                }
            }
            if (_provNumSelected == 0)           //Is new
            {
                comboProv.SelectedIndex = 0;
                _provNumSelected        = _listProviders[0].ProvNum;
            }
            if (comboProv.SelectedIndex == -1)                            //The provider exists but is hidden
            {
                comboProv.Text = Providers.GetLongDesc(_provNumSelected); //Appends "(hidden)" to the end of the long description.
            }
            textNote.Text       = _encCur.Note;
            textCodeValue.Text  = _encCur.CodeValue;
            textCodeSystem.Text = _encCur.CodeSystem;
            //to get description, first determine which table the code is from.  Encounter is only allowed to be a CDT, CPT, HCPCS, and SNOMEDCT.  Will be null if new encounter.
            switch (_encCur.CodeSystem)
            {
            case "CDT":
                textCodeDescript.Text = ProcedureCodes.GetProcCode(_encCur.CodeValue).Descript;
                break;

            case "CPT":
                Cpt cptCur = Cpts.GetByCode(_encCur.CodeValue);
                if (cptCur != null)
                {
                    textCodeDescript.Text = cptCur.Description;
                }
                break;

            case "HCPCS":
                Hcpcs hCur = Hcpcses.GetByCode(_encCur.CodeValue);
                if (hCur != null)
                {
                    textCodeDescript.Text = hCur.DescriptionShort;
                }
                break;

            case "SNOMEDCT":
                Snomed sCur = Snomeds.GetByCode(_encCur.CodeValue);
                if (sCur != null)
                {
                    textCodeDescript.Text = sCur.Description;
                }
                break;

            case null:
                textCodeDescript.Text = "";
                break;

            default:
                MsgBox.Show(this, "Error: Unknown code system");
                break;
            }
        }
Ejemplo n.º 25
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Date", 80);

            gridMain.Columns.Add(col);
            col = new ODGridColumn("Prov", 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Code", 110);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Description", 180);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Note", 100);
            gridMain.Columns.Add(col);
            listEncs = Encounters.Refresh(PatCur.PatNum);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < listEncs.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listEncs[i].DateEncounter.ToShortDateString());
                row.Cells.Add(Providers.GetAbbr(listEncs[i].ProvNum));
                row.Cells.Add(listEncs[i].CodeValue);
                string descript = "";
                //to get description, first determine which table the code is from.  Encounter is only allowed to be a CDT, CPT, HCPCS, and SNOMEDCT.
                switch (listEncs[i].CodeSystem)
                {
                case "CDT":
                    descript = ProcedureCodes.GetProcCode(listEncs[i].CodeValue).Descript;
                    break;

                case "CPT":
                    Cpt cptCur = Cpts.GetByCode(listEncs[i].CodeValue);
                    if (cptCur != null)
                    {
                        descript = cptCur.Description;
                    }
                    break;

                case "HCPCS":
                    Hcpcs hCur = Hcpcses.GetByCode(listEncs[i].CodeValue);
                    if (hCur != null)
                    {
                        descript = hCur.DescriptionShort;
                    }
                    break;

                case "SNOMEDCT":
                    Snomed sCur = Snomeds.GetByCode(listEncs[i].CodeValue);
                    if (sCur != null)
                    {
                        descript = sCur.Description;
                    }
                    break;
                }
                row.Cells.Add(descript);
                row.Cells.Add(listEncs[i].Note);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Ejemplo n.º 26
0
        private void FormPatientSmoking_Load(object sender, EventArgs e)
        {
            _patOld = PatCur.Copy();
            textDateAssessed.Text     = DateTime.Now.ToString();
            textDateIntervention.Text = DateTime.Now.ToString();
            #region ComboSmokeStatus
            comboSmokeStatus.Items.Add("None");            //First and default index
            //Smoking statuses add in the same order as they appear in the SmokingSnoMed enum (Starting at comboSmokeStatus index 1).
            //Changes to the enum order will change the order added so they will always match
            for (int i = 0; i < Enum.GetNames(typeof(SmokingSnoMed)).Length; i++)
            {
                //if snomed code exists in the snomed table, use the snomed description for the combo box, otherwise use the original abbreviated description
                Snomed smokeCur = Snomeds.GetByCode(((SmokingSnoMed)i).ToString().Substring(1));
                if (smokeCur != null)
                {
                    comboSmokeStatus.Items.Add(smokeCur.Description);
                }
                else
                {
                    switch ((SmokingSnoMed)i)
                    {
                    case SmokingSnoMed._266927001:
                        comboSmokeStatus.Items.Add("UnknownIfEver");
                        break;

                    case SmokingSnoMed._77176002:
                        comboSmokeStatus.Items.Add("SmokerUnknownCurrent");
                        break;

                    case SmokingSnoMed._266919005:
                        comboSmokeStatus.Items.Add("NeverSmoked");
                        break;

                    case SmokingSnoMed._8517006:
                        comboSmokeStatus.Items.Add("FormerSmoker");
                        break;

                    case SmokingSnoMed._428041000124106:
                        comboSmokeStatus.Items.Add("CurrentSomeDay");
                        break;

                    case SmokingSnoMed._449868002:
                        comboSmokeStatus.Items.Add("CurrentEveryDay");
                        break;

                    case SmokingSnoMed._428061000124105:
                        comboSmokeStatus.Items.Add("LightSmoker");
                        break;

                    case SmokingSnoMed._428071000124103:
                        comboSmokeStatus.Items.Add("HeavySmoker");
                        break;
                    }
                }
            }
            comboSmokeStatus.SelectedIndex = 0;          //None
            try {
                comboSmokeStatus.SelectedIndex = (int)Enum.Parse(typeof(SmokingSnoMed), "_" + PatCur.SmokingSnoMed, true) + 1;
            }
            catch {
                //if not one of the statuses in the enum, get the Snomed object from the patient's current smoking snomed code
                Snomed smokeCur = Snomeds.GetByCode(PatCur.SmokingSnoMed);
                if (smokeCur != null)               //valid snomed code, set the combo box text to this snomed description
                {
                    comboSmokeStatus.SelectedIndex = -1;
                    comboSmokeStatus.Text          = smokeCur.Description;
                }
            }
            #endregion
            //This takes a while the first time the window loads due to Code Systems.
            Cursor = Cursors.WaitCursor;
            FillGridAssessments();
            FillGridInterventions();
            Cursor = Cursors.Default;
            #region ComboAssessmentType
            _listAssessmentCodes = EhrCodes.GetForValueSetOIDs(new List <string> {
                "2.16.840.1.113883.3.526.3.1278"
            }, true);                                      //'Tobacco Use Screening' value set
            if (_listAssessmentCodes.Count == 0)           //This should only happen if the EHR.dll does not exist or if the codes in the ehrcode list do not exist in the corresponding table
            {
                MsgBox.Show(this, "The codes used for Tobacco Use Screening assessments do not exist in the LOINC table in your database.  You must run the Code System Importer tool in Setup | Chart | EHR to import this code set.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            _listAssessmentCodes.ForEach(x => comboAssessmentType.Items.Add(x.Description));
            string mostRecentAssessmentCode = "";
            if (gridAssessments.Rows.Count > 1)
            {
                //gridAssessments.Rows are tagged with all TobaccoUseAssessed events for the patient ordered by DateTEvent, last is most recent
                mostRecentAssessmentCode = ((EhrMeasureEvent)gridAssessments.Rows[gridAssessments.Rows.Count - 1].Tag).CodeValueResult;
            }
            //use Math.Max so that if _listAssessmentCodes doesn't contain the mostRecentAssessment code the combobox will default to the first in the list
            comboAssessmentType.SelectedIndex = Math.Max(0, _listAssessmentCodes.FindIndex(x => x.CodeValue == mostRecentAssessmentCode));
            #endregion ComboAssessmentType
            #region ComboTobaccoStatus
            //list is filled with the EhrCodes for all tobacco user statuses using the CQM value set
            _listUserCodes = EhrCodes.GetForValueSetOIDs(new List <string> {
                "2.16.840.1.113883.3.526.3.1170"
            }, true).OrderBy(x => x.Description).ToList();
            //list is filled with the EhrCodes for all tobacco non-user statuses using the CQM value set
            _listNonUserCodes = EhrCodes.GetForValueSetOIDs(new List <string> {
                "2.16.840.1.113883.3.526.3.1189"
            }, true).OrderBy(x => x.Description).ToList();
            _listRecentTobaccoCodes = EhrCodes.GetForEventTypeByUse(EhrMeasureEventType.TobaccoUseAssessed);
            //list is filled with any SNOMEDCT codes that are attached to EhrMeasureEvents for the patient that are not in the User and NonUser lists
            _listCustomTobaccoCodes = new List <EhrCode>();
            //codeValues is an array of all user and non-user tobacco codes
            string[] codeValues = _listUserCodes.Concat(_listNonUserCodes).Concat(_listRecentTobaccoCodes).Select(x => x.CodeValue).ToArray();
            //listEventCodes will contain all unique tobacco codes that are not in the user and non-user lists
            List <string> listEventCodes = new List <string>();
            foreach (ODGridRow row in gridAssessments.Rows)
            {
                string eventCodeCur = ((EhrMeasureEvent)row.Tag).CodeValueResult;
                if (codeValues.Contains(eventCodeCur) || listEventCodes.Contains(eventCodeCur))
                {
                    continue;
                }
                listEventCodes.Add(eventCodeCur);
            }
            Snomed sCur;
            foreach (string eventCode in listEventCodes.OrderBy(x => x))
            {
                sCur = Snomeds.GetByCode(eventCode);
                if (sCur == null)               //don't add invalid SNOMEDCT codes
                {
                    continue;
                }
                _listCustomTobaccoCodes.Add(new EhrCode {
                    CodeValue = sCur.SnomedCode, Description = sCur.Description
                });
            }
            _listCustomTobaccoCodes = _listCustomTobaccoCodes.OrderBy(x => x.Description).ToList();
            //list will contain all of the tobacco status EhrCodes currently in comboTobaccoStatus
            _listTobaccoStatuses = new List <EhrCode>();
            //default to all tobacco statuses (custom, user, and non-user) in the status dropdown box
            radioRecentStatuses.Checked = true;          //causes combo box and _listTobaccoStatuses to be filled with all statuses
            #endregion ComboTobaccoStatus
            #region ComboInterventionType and ComboInterventionCode
            //list is filled with EhrCodes for counseling interventions using the CQM value set
            _listCounselInterventionCodes = EhrCodes.GetForValueSetOIDs(new List <string> {
                "2.16.840.1.113883.3.526.3.509"
            }, true).OrderBy(x => x.Description).ToList();
            //list is filled with EhrCodes for medication interventions using the CQM value set
            _listMedInterventionCodes = EhrCodes.GetForValueSetOIDs(new List <string> {
                "2.16.840.1.113883.3.526.3.1190"
            }, true).OrderBy(x => x.Description).ToList();
            _listRecentIntvCodes = EhrCodes.GetForIntervAndMedByUse(InterventionCodeSet.TobaccoCessation, new List <string> {
                "2.16.840.1.113883.3.526.3.1190"
            });
            _listInterventionCodes = new List <EhrCode>();
            //default to all interventions (couseling and medication) in the intervention dropdown box
            radioRecentInterventions.Checked = true;          //causes combo box and _listInterventionCodes to be filled with all intervention codes
            #endregion ComboInterventionType and ComboInterventionCode
            _comboToolTip = new ToolTip()
            {
                InitialDelay = 1000, ReshowDelay = 1000, ShowAlways = true
            };
        }
Ejemplo n.º 27
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn("Restriction", 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Compare string", 120);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Operand", 120);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Lab value", 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("After Date", 120);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Before Date", 120);
            gridMain.Columns.Add(col);
            //col=new ODGridColumn("Order",120,HorizontalAlignment.Center);
            //gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < _elementList.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_elementList[i].Restriction.ToString());
                if (_elementList[i].Restriction == EhrRestrictionType.Problem)
                {
                    if (Snomeds.CodeExists(_elementList[i].CompareString))
                    {
                        row.Cells.Add(_elementList[i].CompareString + " - " + Snomeds.GetByCode(_elementList[i].CompareString).Description);
                    }
                    else
                    {
                        row.Cells.Add(_elementList[i].CompareString + " - NON-SNOMED CT CODE");
                    }
                }
                else
                {
                    row.Cells.Add(_elementList[i].CompareString);
                }
                if (_elementList[i].Restriction == EhrRestrictionType.Gender ||
                    _elementList[i].Restriction == EhrRestrictionType.Problem ||
                    _elementList[i].Restriction == EhrRestrictionType.Medication ||
                    _elementList[i].Restriction == EhrRestrictionType.CommPref ||
                    _elementList[i].Restriction == EhrRestrictionType.Allergy)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(_elementList[i].Operand.ToString());
                }
                row.Cells.Add(_elementList[i].LabValue);
                if (_elementList[i].StartDate.Year > 1880)
                {
                    row.Cells.Add(_elementList[i].StartDate.ToShortDateString());
                }
                else
                {
                    row.Cells.Add("");
                }
                if (_elementList[i].EndDate.Year > 1880)
                {
                    row.Cells.Add(_elementList[i].EndDate.ToShortDateString());
                }
                else
                {
                    row.Cells.Add("");
                }
                //if(ElementList[i].OrderBy) {
                //  row.Cells.Add("X");
                //}
                //else {
                //  row.Cells.Add("");
                //}
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Ejemplo n.º 28
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Category", 80);

            gridMain.Columns.Add(col);
            col = new ODGridColumn("Code", 100);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("CodeSystem", 120);
            gridMain.Columns.Add(col);
            //col=new ODGridColumn("Op+Value",80);//Example: >=150
            //gridMain.Columns.Add(col);
            col = new ODGridColumn("Description", 250);         //Also includes values for labloinc and demographics and vitals. Example: ">150, BP Systolic"
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            //EhrTriggerCur.ProblemDefNumList-----------------------------------------------------------------------------------------------------------------------
            string[] arrayString = EhrTriggerCur.ProblemDefNumList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Problem");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("Problem Def");
                row.Cells.Add(DiseaseDefs.GetItem(PIn.Long(arrayString[i])).DiseaseName);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.ProblemIcd9List---------------------------------------------------------------------------------------------------------------------------
            arrayString = EhrTriggerCur.ProblemIcd9List.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Problem");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("ICD9 CM");
                row.Cells.Add(ICD9s.GetByCode(arrayString[i]).Description);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.ProblemIcd10List;
            arrayString = EhrTriggerCur.ProblemIcd10List.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Problem");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("ICD10 CM");
                row.Cells.Add(Icd10s.GetByCode(arrayString[i]).Description);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.ProblemSnomedList;
            arrayString = EhrTriggerCur.ProblemSnomedList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Problem");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("SNOMED CT");
                row.Cells.Add(Snomeds.GetByCode(arrayString[i]).Description);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.MedicationNumList
            arrayString = EhrTriggerCur.MedicationNumList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Medication");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("Medication Def");
                row.Cells.Add(Medications.GetDescription(PIn.Long(arrayString[i])));
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.RxCuiList
            arrayString = EhrTriggerCur.RxCuiList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Medication");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("RxCui");
                row.Cells.Add(RxNorms.GetByRxCUI(arrayString[i]).Description);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.CvxList
            arrayString = EhrTriggerCur.CvxList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Medication");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("Cvx");
                row.Cells.Add(Cvxs.GetByCode(arrayString[i]).Description);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.AllergyDefNumList
            arrayString = EhrTriggerCur.AllergyDefNumList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Allergy");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("Allergy Def");
                row.Cells.Add(AllergyDefs.GetOne(PIn.Long(arrayString[i])).Description);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.DemographicsList
            arrayString = EhrTriggerCur.DemographicsList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                string[] arrayStringElements = arrayString[i].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                switch (arrayStringElements[0])
                {
                case "age":
                    row.Cells.Add("Demographic");
                    row.Cells.Add("30525-0");
                    row.Cells.Add("LOINC");
                    row.Cells.Add("Age" + arrayStringElements[1]);                          //Example "Age>55"
                    gridMain.Rows.Add(row);
                    break;

                case "gender":
                    row.Cells.Add("Demographic");
                    row.Cells.Add("46098-0");
                    row.Cells.Add("LOINC");
                    row.Cells.Add("Gender:" + arrayString[i].Replace("gender,", ""));                         //Example "Gender:Male, Female, Unknown/Undifferentiated"
                    gridMain.Rows.Add(row);
                    break;

                default:
                    //should never happen
                    continue;                            //next trigger
                }
            }
            //EhrTriggerCur.LabLoincList
            arrayString = EhrTriggerCur.LabLoincList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                Loinc _loincTemp = Loincs.GetByCode(arrayString[i]);              //.Split(new string[] { ";" },StringSplitOptions.None)[0]);
                if (_loincTemp == null)
                {
                    continue;
                }
                row.Cells.Add("Laboratory");
                row.Cells.Add(_loincTemp.LoincCode);
                row.Cells.Add("LOINC");
                row.Cells.Add(_loincTemp.NameShort);
                //switch(arrayString[i].Split(new string[] { ";" },StringSplitOptions.RemoveEmptyEntries).Length) {
                //	case 1://loinc only comparison
                //		row.Cells.Add(_loincTemp.NameShort);
                //		break;
                //	case 2://microbiology or unitless lab.
                //		Snomed _snomedTemp=Snomeds.GetByCode(arrayString[i].Split(new string[] { ";" },StringSplitOptions.None)[1]);
                //		row.Cells.Add(_loincTemp.NameShort+", "
                //			+(_snomedTemp==null?arrayString[i].Split(new string[] { ";" },StringSplitOptions.None)[1]:_snomedTemp.Description));//Example: Bacteria Identified, Campylobacter jenuni
                //		break;
                //	case 3://"traditional lab results"
                //		row.Cells.Add(_loincTemp.NameShort+" "
                //	+arrayString[i].Split(new string[] { ";" },StringSplitOptions.None)[1]+" "//example: >150 or a snomed code if microbiology
                //	+arrayString[i].Split(new string[] { ";" },StringSplitOptions.None)[2]    //example: mg/dL or blank
                //			);
                //		break;
                //	default://should never happen. Will display blank.
                //		row.Cells.Add("");
                //		break;
                //}
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.VitalLoincList
            arrayString = EhrTriggerCur.VitalLoincList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                string[] arrayStringElements = arrayString[i].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                switch (arrayStringElements[0])
                {
                case "height":
                    row.Cells.Add("Vitals");
                    row.Cells.Add("8302-2");
                    row.Cells.Add("LOINC");
                    row.Cells.Add("Height" + arrayString[i].Replace("height,", "") + " in.");                       //Example "Age>55"
                    gridMain.Rows.Add(row);
                    break;

                case "weight":
                    row.Cells.Add("Vitals");
                    row.Cells.Add("29463-7");
                    row.Cells.Add("LOINC");
                    row.Cells.Add("Weight:" + arrayString[i].Replace("weight,", ""));                         //Example "Gender:Male, Female, Unknown/Undifferentiated"
                    gridMain.Rows.Add(row);
                    break;

                case "bp???":
                    row.Cells.Add("Vitals");
                    row.Cells.Add("???There are two.");
                    row.Cells.Add("LOINC");
                    row.Cells.Add("???");                            //Example "Gender:Male, Female, Unknown/Undifferentiated"
                    gridMain.Rows.Add(row);
                    break;

                case "BMI":
                    row.Cells.Add("Vitals");
                    row.Cells.Add("39156-5");
                    row.Cells.Add("LOINC");
                    row.Cells.Add("BMI" + arrayString[i].Replace("BMI,", "").Replace("%", "") + "%");                      //Example "Gender:Male, Female, Unknown/Undifferentiated"
                    gridMain.Rows.Add(row);
                    break;

                default:
                    //should never happen
                    continue;                            //next trigger
                }
            }
            //End trigger fields.
            gridMain.EndUpdate();
        }
Ejemplo n.º 29
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();
        }
Ejemplo n.º 30
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Code", 70);

            gridMain.Columns.Add(col);
            col = new ODGridColumn("CodeSystem", 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Description", 200);
            gridMain.Columns.Add(col);
            string        selectedValue  = comboCodeSet.SelectedItem.ToString();
            List <string> listValSetOIDs = new List <string>();

            if (selectedValue == "All")
            {
                listValSetOIDs = new List <string>(dictValueCodeSets.Values);
            }
            else              //this will limit the codes to only one value set oid
            {
                listValSetOIDs.Add(dictValueCodeSets[selectedValue]);
            }
            listCodes = EhrCodes.GetForValueSetOIDs(listValSetOIDs, true);         //these codes will exist in the corresponding table or will not be in the list
            gridMain.Rows.Clear();
            ODGridRow row;
            int       selectedIdx = -1;

            for (int i = 0; i < listCodes.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listCodes[i].CodeValue);
                row.Cells.Add(listCodes[i].CodeSystem);
                //Retrieve description from the associated table
                string descript = "";
                switch (listCodes[i].CodeSystem)
                {
                case "CPT":
                    Cpt cCur = Cpts.GetByCode(listCodes[i].CodeValue);
                    if (cCur != null)
                    {
                        descript = cCur.Description;
                    }
                    break;

                case "HCPCS":
                    Hcpcs hCur = Hcpcses.GetByCode(listCodes[i].CodeValue);
                    if (hCur != null)
                    {
                        descript = hCur.DescriptionShort;
                    }
                    break;

                case "ICD9CM":
                    ICD9 i9Cur = ICD9s.GetByCode(listCodes[i].CodeValue);
                    if (i9Cur != null)
                    {
                        descript = i9Cur.Description;
                    }
                    break;

                case "ICD10CM":
                    Icd10 i10Cur = Icd10s.GetByCode(listCodes[i].CodeValue);
                    if (i10Cur != null)
                    {
                        descript = i10Cur.Description;
                    }
                    break;

                case "RXNORM":
                    descript = RxNorms.GetDescByRxCui(listCodes[i].CodeValue);
                    break;

                case "SNOMEDCT":
                    Snomed sCur = Snomeds.GetByCode(listCodes[i].CodeValue);
                    if (sCur != null)
                    {
                        descript = sCur.Description;
                    }
                    break;
                }
                row.Cells.Add(descript);
                gridMain.Rows.Add(row);
                if (listCodes[i].CodeValue == InterventionCur.CodeValue && listCodes[i].CodeSystem == InterventionCur.CodeSystem)
                {
                    selectedIdx = i;
                }
            }
            gridMain.EndUpdate();
            if (selectedIdx > -1)
            {
                gridMain.SetSelected(selectedIdx, true);
                gridMain.ScrollToIndex(selectedIdx);
            }
        }