private void loadPatientEncounter()
        {
            Entities.CCC.Encounter.PatientEncounter.PresentingComplaintsEntity pce = new Entities.CCC.Encounter.PatientEncounter.PresentingComplaintsEntity();
            pce = PEL.loadPatientEncounter(Session["ExistingRecordPatientMasterVisitID"].ToString() == "0" ? Session["PatientMasterVisitID"].ToString() : Session["ExistingRecordPatientMasterVisitID"].ToString(), Session["PatientPK"].ToString());
            PatientAppointmentManager patientAppointmentManager = new PatientAppointmentManager();

            PatientEncounterLogic patientEncounter = new PatientEncounterLogic();

            DataTable   theDT        = patientEncounter.loadPatientEncounterPhysicalExam(Session["ExistingRecordPatientMasterVisitID"].ToString() == "0" ? Session["PatientMasterVisitID"].ToString() : Session["ExistingRecordPatientMasterVisitID"].ToString(), Session["PatientPK"].ToString());
            DataTable   theDTAdverse = patientEncounter.loadPatientEncounterAdverseEvents(Session["ExistingRecordPatientMasterVisitID"].ToString() == "0" ? Session["PatientMasterVisitID"].ToString() : Session["ExistingRecordPatientMasterVisitID"].ToString(), Session["PatientPK"].ToString());
            bool        isOnEdit     = false;
            LookupLogic lookUp       = new LookupLogic();

            /////PRESENTING COMPLAINTS
            visitdateval = pce.visitDate;
            //if (pce.visitDate != "")
            //    visitdateval = pce.visitDate;
            //else
            //    visitdateval = "";

            LMPval        = pce.lmp;
            EDDval        = pce.edd;
            nxtAppDateval = pce.nextAppointmentDate;
            if (!String.IsNullOrWhiteSpace(pce.visitScheduled))
            {
                isOnEdit = true;
            }

            if (pce.visitScheduled == "1")
            {
                vsYes.Checked = true;
            }
            else if (pce.visitScheduled == "0")
            {
                vsNo.Checked = true;
            }

            //rblVisitScheduled.SelectedValue = pce.visitScheduled;
            ddlVisitBy.SelectedValue = pce.visitBy;

            if (pce.anyComplaint == "1")
            {
                rdAnyComplaintsYes.Checked = true;
            }
            else if (pce.anyComplaint == "0")
            {
                rdAnyComplaintsNo.Checked = true;
            }

            complaints.Value = pce.complaints;
            //ICF Updates
            //Tb outcome
            ddlOnAntiTBDrugs.SelectedValue = getSelectedValue(pce.OnAntiTB);
            //On IPT
            ddlICFCurrentlyOnIPT.SelectedValue = getSelectedValue(pce.OnIPT);
            //start IPT
            ddlICFStartIPT.SelectedValue = getSelectedValue(pce.EverBeenOnIPT);

            //Cough
            ddlICFCough.SelectedValue = getSelectedValue(pce.Cough);
            //fever
            ddlICFFever.SelectedValue = getSelectedValue(pce.Fever);
            //weight
            ddlICFWeight.SelectedValue = getSelectedValue(pce.NoticeableWeightLoss);
            //night sweats
            ddlICFNightSweats.SelectedValue = getSelectedValue(pce.NightSweats);

            //sputum
            ddlSputumSmear.SelectedValue = pce.SputumSmear;
            //gene expert
            ddlGeneXpert.SelectedValue = pce.geneXpert;
            //chest
            ddlChestXray.SelectedValue = pce.ChestXray;
            //anti tb
            ddlStartAntiTB.SelectedValue = getSelectedValue(pce.startAntiTB);
            //contacts invitatio
            ddlInvitationofContacts.SelectedValue = getSelectedValue(pce.InvitationOfContacts);
            //ipt evaluation
            ddlEvaluatedforIPT.SelectedValue = getSelectedValue(pce.EvaluatedForIPT);

            IptCw.IPTurineColour.SelectedValue         = pce.YellowColouredUrine;
            IptCw.IPTNumbness.SelectedValue            = pce.Numbness;
            IptCw.IPTYellowEyes.SelectedValue          = pce.YellownessOfEyes;
            IptCw.IPTAbdominalTenderness.SelectedValue = pce.AdominalTenderness;
            IptCw.IPTLiverTest.Text         = pce.LiverFunctionTests;
            IptCw.IPTStartIPT.SelectedValue = pce.startIPT;
            IptCw.StartDateIPT.Text         = pce.IPTStartDate;

            //tb outcome
            ddlICFTBScreeningOutcome.SelectedValue = pce.tbScreening;
            nutritionscreeningstatus.SelectedValue = pce.nutritionStatus;
            txtWorkPlan.Text = pce.WorkPlan;
            foreach (ListItem item in cblGeneralExamination.Items)
            {
                for (int i = 0; i < pce.generalExams.Length; i++)
                {
                    if (item.Value == pce.generalExams[i])
                    {
                        item.Selected = true;
                    }
                }
            }



            ////PATIENT MANAGEMENT
            foreach (ListItem item in cblPHDP.Items)
            {
                for (int i = 0; i < pce.phdp.Length; i++)
                {
                    if (item.Value == pce.phdp[i])
                    {
                        item.Selected = true;
                    }
                }
            }

            arvAdherance.SelectedValue = pce.ARVAdherence;
            ctxAdherance.SelectedValue = pce.CTXAdherence;
            if (pce.StabilityCategorization != null)
            {
                ((PatientCategorizationStatus)Convert.ToInt16(pce.StabilityCategorization)).ToString();
                var stabilityAsessment = ((PatientCategorizationStatus)Convert.ToInt16(pce.StabilityCategorization)).ToString();
                stabilityStatus.SelectedValue = stabilityStatus.Items.FindByText(stabilityAsessment).Value;
            }
            WHOStage.SelectedValue = pce.WhoStage;

            if (theDT.Rows.Count > 0 && isOnEdit)
            {
                systemsOkNo.Checked = true;
            }
            else if (theDT.Rows.Count == 0 && isOnEdit)
            {
                systemsOkYes.Checked = true;
            }

            if (theDTAdverse.Rows.Count > 0 && isOnEdit)
            {
                rdAnyAdverseEventsYes.Checked = true;
            }
            else if (theDTAdverse.Rows.Count == 0 && isOnEdit)
            {
                rdAnyAdverseEventsNo.Checked = true;
            }
            AppointmentId        = pce.appointmentId;
            AppointmentDate.Text = pce.nextAppointmentDate;

            NextAppointmentDate = Convert.ToDateTime(pce.nextAppointmentDate);
            //if (pce.nextAppointmentDate != "")
            //{
            //    if (pce.nextAppointmentDate != null)
            //        AppointmentDate.Text = DateTime.Parse(pce.nextAppointmentDate.Trim()).ToString("dd-MMM-yyyy", CultureInfo.InvariantCulture);
            //}
            ServiceArea.SelectedValue        = pce.appointmentServiceArea;
            Reason.SelectedValue             = pce.appointmentReason;
            DifferentiatedCare.SelectedValue = pce.nextAppointmentType;
            description.Text  = pce.appointmentDesc;
            IsEditAppointment = (pce.nextAppointmentType != null);
            // IsEditAppointmentId=(pce.)
            //status.SelectedValue = pce.appontmentStatus;
            if (IsEditAppointment)
            {
                if (!string.IsNullOrWhiteSpace(pce.nextAppointmentType))
                {
                    var app = patientAppointmentManager.GetByPatientId((int)Session["PatientPK"])
                              .Where(x => x.AppointmentDate == Convert.ToDateTime(pce.nextAppointmentDate)).ToList();
                    if (app != null)
                    {
                        IsEditAppointmentId = app[0].Id;
                    }
                }
            }

            //AppointmentDate.Text = pce.nextAppointmentDate.ToString();
            //ipt pop ups
            Page.ClientScript.RegisterStartupScript(this.GetType(), "tbInfectedYesNo", "tbInfectedChange();", true);
            Page.ClientScript.RegisterStartupScript(this.GetType(), "IcfChange", "IcfChange();", true);
            Page.ClientScript.RegisterStartupScript(this.GetType(), "IcfActionChange", "IcfActionChange();", true);
        }
Beispiel #2
0
        public ArrayList GetAdverseEvents()
        {
            int adverseEventId       = 0;
            int patientId            = Convert.ToInt32(Session["PatientPK"].ToString());
            int patientMasterVisitId = Convert.ToInt32(Session["ExistingRecordPatientMasterVisitID"].ToString() == "0" ? Session["PatientMasterVisitID"].ToString() : Session["ExistingRecordPatientMasterVisitID"].ToString());
            var outcomeString        = "";

            PatientEncounterLogic             patientEncounter           = new PatientEncounterLogic();
            PatientAdverseEventOutcomeManager patientAdverseEventOutcome = new PatientAdverseEventOutcomeManager();

            LookupLogic lookupLogic = new LookupLogic();


            DataTable theDT = patientEncounter.loadPatientEncounterAdverseEvents(Session["ExistingRecordPatientMasterVisitID"].ToString() == "0" ? Session["PatientMasterVisitID"].ToString() : Session["ExistingRecordPatientMasterVisitID"].ToString(), Session["PatientPK"].ToString());
            ArrayList rows  = new ArrayList();

            foreach (DataRow row in theDT.Rows)
            {
                string   eventoutcome = "";
                DateTime outcomeDate  = DateTime.Today;

                //get the adverse Event form the db
                var items = lookupLogic.GetItemIdByGroupAndItemName("AdverseEvents", row["EventName"].ToString());
                foreach (var item in items)
                {
                    adverseEventId = item.ItemId;
                }

                // get the outcome for the adverse event
                // var outcome =patientAdverseEventOutcome.GetAdverseEventOutcome(adverseEventId, patientMasterVisitId, patientId);

                var adverseEventOutcomes = patientAdverseEventOutcome.GetAdverseEventOutcome(adverseEventId, patientMasterVisitId, patientId);



                if (adverseEventOutcomes.Count > 0)
                {
                    foreach (var adverseEventOutcome in adverseEventOutcomes)
                    {
                        eventoutcome = lookupLogic.GetLookupItemNameById(adverseEventOutcome.OutcomeId);
                        outcomeDate  = Convert.ToDateTime(adverseEventOutcome.OutcomeDate);
                    }
                    if (string.IsNullOrEmpty(eventoutcome))
                    {
                        string[] i = new string[7]
                        {
                            row["SeverityID"].ToString(), row["AdverseEventId"].ToString(), row["EventName"].ToString(), row["EventCause"].ToString(),
                            row["Severity"].ToString(), row["Action"].ToString(),
                            "<button type='button' class='btnAddAdverseEventOutcome btn btn-info fa fa-plus-circle btn-fill' onclick='AdverseEventOutcome();'> Specify Outcome</button> <button type='button' class='btnDelete btn btn-danger fa fa-minus-circle btn-fill' > Remove</button>"
                        };
                        rows.Add(i);
                    }
                    else
                    {
                        if (eventoutcome == "Died")
                        {
                            outcomeString = "<span class='text-danger'><strong>" + eventoutcome +
                                            "</strong></span> | <span class='text-info'><strong>" + outcomeDate.ToString("dd-MMM-yyy") + "</strong></span>";
                        }
                        else
                        {
                            outcomeString = "<span class='text-primary'><strong>" + eventoutcome +
                                            "</strong></span> | <span class='text-info'><strong>" + outcomeDate.ToString("dd-MMM-yyy") + "</strong></span>";
                        }
                        string[] i = new string[6]
                        {
                            row["SeverityID"].ToString(),
                            row["EventName"].ToString(),
                            row["EventCause"].ToString(),
                            row["Severity"].ToString(),
                            row["Action"].ToString(),
                            outcomeString
                            //"<span class='text-info'>outcome:</span>"+eventoutcome+ "<span class='text-info'>outcome Date:</span>"+ outcomeDate
                        };
                        rows.Add(i);
                    }
                }
                else
                {
                    string[] i = new string[7]
                    {
                        row["SeverityID"].ToString(), row["AdverseEventId"].ToString(), row["EventName"].ToString(), row["EventCause"].ToString(),
                        row["Severity"].ToString(), row["Action"].ToString(),
                        "<button type='button' class='btnAddAdverseEventOutcome btn btn-info fa fa-plus-circle btn-fill' onclick='AdverseEventOutcome();'> Specify Outcome</button> <button type='button' class='btnDelete btn btn-danger fa fa-minus-circle btn-fill' > Remove</button>"
                    };
                    rows.Add(i);
                }
            }
            return(rows);
        }
        private void loadPatientEncounter()
        {
            Entities.CCC.Encounter.PatientEncounter.PresentingComplaintsEntity pce = new Entities.CCC.Encounter.PatientEncounter.PresentingComplaintsEntity();
            pce = PEL.loadPatientEncounter(Session["ExistingRecordPatientMasterVisitID"].ToString() == "0" ? Session["PatientMasterVisitID"].ToString() : Session["ExistingRecordPatientMasterVisitID"].ToString(), Session["PatientPK"].ToString());

            PatientEncounterLogic patientEncounter = new PatientEncounterLogic();

            DataTable theDT        = patientEncounter.loadPatientEncounterPhysicalExam(Session["ExistingRecordPatientMasterVisitID"].ToString() == "0" ? Session["PatientMasterVisitID"].ToString() : Session["ExistingRecordPatientMasterVisitID"].ToString(), Session["PatientPK"].ToString());
            DataTable theDTAdverse = patientEncounter.loadPatientEncounterAdverseEvents(Session["ExistingRecordPatientMasterVisitID"].ToString() == "0" ? Session["PatientMasterVisitID"].ToString() : Session["ExistingRecordPatientMasterVisitID"].ToString(), Session["PatientPK"].ToString());
            bool      isOnEdit     = false;

            /////PRESENTING COMPLAINTS
            visitdateval = pce.visitDate;
            //if (pce.visitDate != "")
            //    visitdateval = pce.visitDate;
            //else
            //    visitdateval = "";

            LMPval        = pce.lmp;
            EDDval        = pce.edd;
            nxtAppDateval = pce.nextAppointmentDate;
            if (!String.IsNullOrWhiteSpace(pce.visitScheduled))
            {
                isOnEdit = true;
            }

            if (pce.visitScheduled == "1")
            {
                vsYes.Checked = true;
            }
            else if (pce.visitScheduled == "0")
            {
                vsNo.Checked = true;
            }

            //rblVisitScheduled.SelectedValue = pce.visitScheduled;
            ddlVisitBy.SelectedValue = pce.visitBy;

            if (pce.anyComplaint == "1")
            {
                rdAnyComplaintsYes.Checked = true;
            }
            else if (pce.anyComplaint == "0")
            {
                rdAnyComplaintsNo.Checked = true;
            }

            complaints.Value            = pce.complaints;
            tbInfected.SelectedValue    = pce.OnAntiTB;
            onIpt.SelectedValue         = pce.OnIPT;
            EverBeenOnIpt.SelectedValue = pce.EverBeenOnIPT;

            cough.SelectedValue       = pce.Cough;
            fever.SelectedValue       = pce.Fever;
            weightLoss.SelectedValue  = pce.NoticeableWeightLoss;
            nightSweats.SelectedValue = pce.NightSweats;

            sputum.SelectedValue             = pce.SputumSmear;
            geneXpert.SelectedValue          = pce.geneXpert;
            chest.SelectedValue              = pce.ChestXray;
            antiTb.SelectedValue             = pce.startAntiTB;
            contactsInvitation.SelectedValue = pce.InvitationOfContacts;
            iptEvaluation.SelectedValue      = pce.EvaluatedForIPT;

            IptCw.IPTurineColour.SelectedValue         = pce.YellowColouredUrine;
            IptCw.IPTNumbness.SelectedValue            = pce.Numbness;
            IptCw.IPTYellowEyes.SelectedValue          = pce.YellownessOfEyes;
            IptCw.IPTAbdominalTenderness.SelectedValue = pce.AdominalTenderness;
            IptCw.IPTLiverTest.Text         = pce.LiverFunctionTests;
            IptCw.IPTStartIPT.SelectedValue = pce.startIPT;
            IptCw.StartDateIPT.Text         = pce.IPTStartDate;


            tbscreeningstatus.SelectedValue        = pce.tbScreening;
            nutritionscreeningstatus.SelectedValue = pce.nutritionStatus;
            txtWorkPlan.Text = pce.WorkPlan;
            foreach (ListItem item in cblGeneralExamination.Items)
            {
                for (int i = 0; i < pce.generalExams.Length; i++)
                {
                    if (item.Value == pce.generalExams[i])
                    {
                        item.Selected = true;
                    }
                }
            }



            ////PATIENT MANAGEMENT
            foreach (ListItem item in cblPHDP.Items)
            {
                for (int i = 0; i < pce.phdp.Length; i++)
                {
                    if (item.Value == pce.phdp[i])
                    {
                        item.Selected = true;
                    }
                }
            }

            arvAdherance.SelectedValue = pce.ARVAdherence;
            ctxAdherance.SelectedValue = pce.CTXAdherence;
            WHOStage.SelectedValue     = pce.WhoStage;

            if (theDT.Rows.Count > 0 && isOnEdit)
            {
                systemsOkNo.Checked = true;
            }
            else if (theDT.Rows.Count == 0 && isOnEdit)
            {
                systemsOkYes.Checked = true;
            }

            if (theDTAdverse.Rows.Count > 0 && isOnEdit)
            {
                rdAnyAdverseEventsYes.Checked = true;
            }
            else if (theDTAdverse.Rows.Count == 0 && isOnEdit)
            {
                rdAnyAdverseEventsNo.Checked = true;
            }

            AppointmentDate.Text = pce.nextAppointmentDate;
            //if (pce.nextAppointmentDate != "")
            //{
            //    if (pce.nextAppointmentDate != null)
            //        AppointmentDate.Text = DateTime.Parse(pce.nextAppointmentDate.Trim()).ToString("dd-MMM-yyyy", CultureInfo.InvariantCulture);
            //}
            ServiceArea.SelectedValue        = pce.appointmentServiceArea;
            Reason.SelectedValue             = pce.appointmentReason;
            DifferentiatedCare.SelectedValue = pce.nextAppointmentType;
            description.Text = pce.appointmentDesc;
            //status.SelectedValue = pce.appontmentStatus;

            //ipt pop ups
            Page.ClientScript.RegisterStartupScript(this.GetType(), "tbInfectedYesNo", "tbInfectedChange();", true);
            Page.ClientScript.RegisterStartupScript(this.GetType(), "IcfChange", "IcfChange();", true);
            Page.ClientScript.RegisterStartupScript(this.GetType(), "IcfActionChange", "IcfActionChange();", true);
        }