コード例 #1
0
        protected void BuildAllMedications(int PatientID, string FormName, string FormType)
        {
            MedicationDa medDa = new MedicationDa();
            DataSet      medDs = medDa.FormGetRecords(PatientID, FormName, FormType, null);

            if (medDs.Tables.Count > 0 && medDs.Tables[0].Rows.Count > 0)
            {
                medicationsAll.DataSource = medDs.Tables[0].DefaultView;
                medicationsAll.DataBind();
            }
        }
コード例 #2
0
        protected void BuildMedications(int PatientID, string FormName, string FormType)
        {
            string stopDate = System.DateTime.Now.ToShortDateString();

            if (Session[SessionKey.CurrentListType] != null && Session[SessionKey.CurrentListType].ToString() == "Clinic" && Session[SessionKey.CurrentClinicDate] != null && Session[SessionKey.CurrentClinicDate].ToString().Length > 0)
            {
                stopDate = Session[SessionKey.CurrentClinicDate].ToString();
            }


            MedicationDa medDa = new MedicationDa();
            DataSet      medDs = medDa.FormGetRecords(PatientID, FormName, FormType, stopDate);

            if (medDs.Tables.Count > 0 && medDs.Tables[0].Rows.Count > 0)
            {
                medications.DataSource = medDs.Tables[0].DefaultView;
                medications.DataBind();
            }
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tableToKeys"></param>
        private void HandleMedications(IDictionary <string, IEnumerable <int> > tableToKeys)
        {
            // show only on Medication related forms
            string[] medTables          = new string[] { new Medication().TableName, new MedicalTherapy().TableName };
            bool     displayMedications = tableToKeys.Keys.Intersect(medTables).Count() > 0;

            if (displayMedications)
            {
                MedicationsSection.Visible = true;

                int          patientId   = int.Parse(BaseDecryptedPatientId);
                MedicationDa da          = new MedicationDa();
                DataView     medications = da.GetMedicationsAndOralMedTx(patientId, null).DefaultView;
                MedicationsGridView.DataSource = medications;
                MedicationsGridView.DataBind();
            }
            else
            {
                MedicationsSection.Visible = false;
            }
        }
コード例 #4
0
        protected virtual void BuildAdditionalGUMedicationSection(int PatientID, string FormName, string FormType)
        {
            // Medications
            string stopDate = System.DateTime.Now.ToShortDateString();

            if (Session[SessionKey.CurrentListType] != null && Session[SessionKey.CurrentListType].ToString() == "Clinic" && Session[SessionKey.CurrentClinicDate] != null && Session[SessionKey.CurrentClinicDate].ToString().Length > 0)
            {
                try
                {
                    stopDate = Convert.ToDateTime(Session[SessionKey.CurrentClinicDate]).ToShortDateString();
                }
                catch { }
            }


            MedicationDa medDa = new MedicationDa();
            DataSet      medDs = medDa.FormGetRecords(PatientID, FormName, FormType, stopDate);

            medDs.Tables[0].Columns.Add("MedTableType");

            foreach (DataRow dr in medDs.Tables[0].Rows)
            {
                dr["MedTableType"] = "Medications";
            }

            MedicalTherapyDa medTxDa = new MedicalTherapyDa();
            DataSet          medTxDs = medTxDa.FormGetRecords(PatientID, FormName, FormType);

            if (medTxDs.Tables.Count > 0 && medTxDs.Tables[0].Rows.Count > 0)
            {
                DataView medTxDv = new DataView(medTxDs.Tables[0]);
                string   filter  = "(MedTxRoute = 'Orally') AND (Isnull(MedTxStopDateText,'') = '')";
                medTxDv.RowFilter = filter;

                foreach (DataRowView drv in medTxDv)
                {
                    DataRow newRow;
                    newRow = medDs.Tables[0].NewRow();
                    newRow["Medication"]      = drv.Row["MedTxAgent"];
                    newRow["MedDose"]         = drv.Row["MedTxDose"];
                    newRow["MedUnits"]        = drv.Row["MedTxUnits"];
                    newRow["MedSchedule"]     = drv.Row["MedTxSchedule"];
                    newRow["MedIndication"]   = drv.Row["MedTxIndication"];
                    newRow["MedRoute"]        = drv.Row["MedTxRoute"];
                    newRow["MedDateText"]     = drv.Row["MedTxDateText"];
                    newRow["MedDate"]         = drv.Row["MedTxDate"];
                    newRow["MedStopDateText"] = drv.Row["MedTxStopDateText"];
                    newRow["MedicationId"]    = drv.Row["MedicalTherapyId"];
                    newRow["MedTableType"]    = "MedicalTherapy";


                    medDs.Tables[0].Rows.Add(newRow);
                }
            }



            DataView medDv = new DataView(medDs.Tables[0]);

            medDv.Sort = "MedDate, MedStopDate, Medication";


            medicationsAll.DataSource = medDv;

            medicationsAll.DataBind();
        }
コード例 #5
0
        // this is mostly identical to the method BuildMedications(int minNumMedRowsToShow, int minNumBlankMedRows)
        // but we need to populate 2 different medications sections on this form and the usual methods both
        // call for the same repeater id.  this version uses a different ID for the repeater
        protected virtual void BuildAdditionalGUMedicationSection(int minNumMedRowsToShow, int minNumBlankMedRows, int numRowsToShowIfNoRecords)
        {
            if (patientID != 0)
            {
                // Medications
                string stopDate = System.DateTime.Now.ToShortDateString();

                if (Session[SessionKey.CurrentListType] != null && Session[SessionKey.CurrentListType].ToString() == "Clinic" && Session[SessionKey.CurrentClinicDate] != null && Session[SessionKey.CurrentClinicDate].ToString().Length > 0)
                {
                    try
                    {
                        stopDate = Convert.ToDateTime(Session[SessionKey.CurrentClinicDate]).ToShortDateString();
                    }
                    catch { }
                }


                MedicationDa medDa = new MedicationDa();
                DataSet      medDs = medDa.FormGetRecords(this.patientID, this._formName, "Dynamic", stopDate);

                MedicalTherapyDa medTxDa = new MedicalTherapyDa();
                DataSet          medTxDs = medTxDa.FormGetRecords(this.patientID, this._formName, "Dynamic");
                if (medTxDs.Tables.Count > 0 && medTxDs.Tables[0].Rows.Count > 0)
                {
                    DataView medTxDv = new DataView(medTxDs.Tables[0]);
                    string   filter  = "(MedTxRoute = 'Orally') AND (Isnull(MedTxStopDateText,'') = '')"; //"(MedTxRoute = 'Orally') AND (MedTxStopDateText = '')";
                    medTxDv.RowFilter = filter;

                    foreach (DataRowView drv in medTxDv)
                    {
                        DataRow newRow;
                        newRow = medDs.Tables[0].NewRow();
                        newRow["Medication"]      = drv.Row["MedTxAgent"];
                        newRow["MedDose"]         = drv.Row["MedTxDose"];
                        newRow["MedUnits"]        = drv.Row["MedTxUnits"];
                        newRow["MedSchedule"]     = drv.Row["MedTxSchedule"];
                        newRow["MedIndication"]   = drv.Row["MedTxIndication"];
                        newRow["MedRoute"]        = drv.Row["MedTxRoute"];
                        newRow["MedDateText"]     = drv.Row["MedTxDateText"];
                        newRow["MedDate"]         = drv.Row["MedTxDate"];
                        newRow["MedStopDateText"] = drv.Row["MedTxStopDateText"];
                        medDs.Tables[0].Rows.Add(newRow);
                    }
                }


                // set the number of blank rows that are added to the medications section

                if (medDs.Tables.Count > 0 && medDs.Tables[0].Rows.Count > 0)
                {
                    int numBlankMedRows = minNumMedRowsToShow - medDs.Tables[0].Rows.Count;

                    // be sure you have at least the number of blank rows specified earlier
                    if (numBlankMedRows < minNumBlankMedRows)
                    {
                        numBlankMedRows = minNumBlankMedRows;
                    }

                    // add the blank rows
                    for (int i = 0; i < numBlankMedRows; i++)
                    {
                        DataRow blankMedsRow;
                        blankMedsRow = medDs.Tables[0].NewRow();
                        blankMedsRow["Medication"]      = "&nbsp;";
                        blankMedsRow["MedDose"]         = "&nbsp;";
                        blankMedsRow["MedSchedule"]     = "&nbsp;";
                        blankMedsRow["MedDateText"]     = "&nbsp;";
                        blankMedsRow["MedStopDateText"] = "&nbsp;";
                        blankMedsRow["MedIndication"]   = "&nbsp;";
                        blankMedsRow["MedRoute"]        = "&nbsp;";
                        blankMedsRow["MedDate"]         = "12/31/9999"; // temp fix to facilitate sorting - VERY HACKY - jf
                        medDs.Tables[0].Rows.Add(blankMedsRow);
                    }



                    DataView medDv = new DataView(medDs.Tables[0]);
                    medDv.Sort = "MedDate, MedStopDate, Medication";


                    AdditionalGUMedicationSection.DataSource = medDv;
                }
                else
                {
                    AdditionalGUMedicationSection.DataSource = BlankMedications(numRowsToShowIfNoRecords).DefaultView;
                }
            }
            else
            {
                AdditionalGUMedicationSection.DataSource = BlankMedications(numRowsToShowIfNoRecords).DefaultView;
            }
            AdditionalGUMedicationSection.DataBind();
        }
コード例 #6
0
        protected void BuildHypogonadism()
        {
            DataTable HypogonadismTable = this.HypogonadismTable();


            // Lab Tests
            LabTestDa             lDa = new LabTestDa();
            List <List <string> > HypogonadismLabs      = HypogonadismLabKey();
            List <string>         HypogonadismLabValues = new List <string>();

            foreach (List <string> l in HypogonadismLabs)
            {
                HypogonadismLabValues.AddRange(l);
            }

            DataSet lDs = lDa.GetLabTestsbyList(this._patientId, HypogonadismLabValues.ToArray());

            if (lDs != null && lDs.Tables.Count > 0 && lDs.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow hRow in lDs.Tables[0].Rows)
                {
                    foreach (List <string> l in HypogonadismLabs)
                    {
                        //                     if (hRow[BOL.LabTest.LabTest_Field].ToString().ToUpper() == l[0].ToUpper())
                        if (l.Contains(hRow[BOL.LabTest.LabTest_Field].ToString().ToUpper()))
                        {
                            HypogonadismTable = AddValueToHypogonadismTable(HypogonadismTable, hRow[BOL.LabTest.LabDateText].ToString(), l[0], hRow[BOL.LabTest.LabResult].ToString(), (int)hRow[BOL.LabTest.LabTestId]);
                            break;
                        }
                    }
                }
            }


            // Medications
            MedicationDa  mDa = new MedicationDa();
            List <string> HypogonadismMedications = HypogonadismMedicationKey();

            DataSet mDs = mDa.FormGetRecords(this._patientId, "", "Dynamic", "");

            if (mDs != null && mDs.Tables.Count > 0 && mDs.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow mRow in mDs.Tables[0].Rows)
                {
                    foreach (string m in HypogonadismMedications)
                    {
                        if (mRow[BOL.Medication.Medication_Field].ToString().ToUpper() == m.ToUpper())
                        {
                            string medValue = mRow[BOL.Medication.Medication_Field].ToString();
                            //                                if (mRow[BOL.Medication.MedDose].ToString().Length > 0) medValue += (" (" + mRow[BOL.Medication.MedDose].ToString() + mRow[BOL.Medication.MedUnits].ToString() + ")");
                            HypogonadismTable = AddValueToHypogonadismTable(HypogonadismTable, mRow[BOL.Medication.MedDateText].ToString(), "Medication", medValue, (int)mRow[BOL.Medication.MedicationId]);
                            HypogonadismTable = AddValueToHypogonadismTable(HypogonadismTable, mRow[BOL.Medication.MedDateText].ToString(), "MedDose", mRow[BOL.Medication.MedDose].ToString());
                            HypogonadismTable = AddValueToHypogonadismTable(HypogonadismTable, mRow[BOL.Medication.MedDateText].ToString(), "MedUnits", mRow[BOL.Medication.MedUnits].ToString());
                            break;
                        }
                    }
                }
            }



            if (HypogonadismTable.Rows.Count > 0)
            {
                foreach (DataRow hRow in HypogonadismTable.Rows)
                {
                    if (hRow["DateText"].ToString().Length > 0)
                    {
                        DateTime dt;
                        if (DateTime.TryParse(hRow["DateText"].ToString(), out dt))
                        {
                            hRow["Date"] = dt;
                        }
                    }
                }

                int maxRowsToShowOnForm = 8;

                if (HypogonadismTable.Rows.Count > maxRowsToShowOnForm)
                {
                    int      numRecordsToDelete = HypogonadismTable.Rows.Count - maxRowsToShowOnForm;
                    DataView hgv = HypogonadismTable.DefaultView;
                    hgv.Sort = "Date ASC";
                    DataTable hgt = hgv.ToTable();

                    for (int i = 0; i < numRecordsToDelete; i++)
                    {
                        hgt.Rows[0].Delete();
                    }

                    DataView hgv2 = hgt.DefaultView;
                    hgv2.Sort = "Date ASC";
                    FillHypogonadism(hgv2);
                }
                else
                {
                    DataView hv = HypogonadismTable.DefaultView;
                    hv.Sort = "Date ASC";
                    FillHypogonadism(hv);
                }
            }
        }