Beispiel #1
0
        public PatientAppointmentDisplay GetExistingPatientAppointment(string patientId, DateTime appointmentDate, int serviceAreaId, int reasonId)
        {
            PatientAppointmentDisplay appointmentDisplay = new PatientAppointmentDisplay();
            PatientAppointment        appointment        = new PatientAppointment();

            try
            {
                var patientAppointment = new PatientAppointmentManager();
                int id = Convert.ToInt32(patientId);
                appointment = patientAppointment.GetByPatientId(id).FirstOrDefault(n => n.AppointmentDate.Date == appointmentDate.Date && n.ServiceAreaId == serviceAreaId && n.ReasonId == reasonId);
                if (appointment != null)
                {
                    appointmentDisplay = Mapappointments(appointment);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Msg = e.Message;
            }
            return(appointmentDisplay);
        }
        public AppointmentStatistics GetAppointmentStatistics(DateTime date)
        {
            AppointmentStatistics statistics = new AppointmentStatistics();

            try
            {
                var appointment = new PatientAppointmentManager();
                var masterVisit = new PatientMasterVisitManager();

                /* JN - Hit the database once
                 * statistics.TotalAppointments = appointment.GetByDate(date).Count;
                 * statistics.MetAppointments = appointment.GetByDate(date).Count(n => n.StatusId==1241);
                 * statistics.MissedAppointments = appointment.GetByDate(date).Count(n => n.StatusId == 1240);
                 * statistics.WalkIns = masterVisit.GetByDate(date).Count(n => n.VisitScheduled == 0); ;
                 */
                var apps = appointment.GetAppointmentSummaryByDate(date).FirstOrDefault();
                statistics.TotalAppointments  = 0;
                statistics.MetAppointments    = 0;
                statistics.MissedAppointments = 0;
                if (apps != null)
                {
                    statistics.TotalAppointments  = apps.Total;
                    statistics.MetAppointments    = apps.Met;
                    statistics.MissedAppointments = apps.Missed + apps.PreviouslyMissed;
                }
                statistics.WalkIns = masterVisit.GetByDate(date).Count(n => n.VisitScheduled == 0);
            }
            catch (Exception e)
            {
                Msg = e.Message;
            }

            return(statistics);
        }
Beispiel #3
0
        public object GetAppointmentSummaryByDate(DateTime appointmentDate)
        {
            var appointment = new PatientAppointmentManager();
            var apps        = appointment.GetAppointmentSummaryByDate(appointmentDate).FirstOrDefault();

            return(apps);
        }
Beispiel #4
0
        public IEnumerable <PatientAppointmentDisplay> GetPatientAppointments(string patientId)
        {
            List <PatientAppointmentDisplay>        appointmentsDisplay = new List <PatientAppointmentDisplay>();
            IEnumerable <PatientAppointmentDisplay> listAppointments    = new List <PatientAppointmentDisplay>();
            var appointments         = new List <PatientAppointment>();
            var bluecardAppointments = new List <BlueCardAppointment>();

            try
            {
                var patientAppointment = new PatientAppointmentManager();
                int id = Convert.ToInt32(patientId);
                appointments         = patientAppointment.GetByPatientId(id);
                bluecardAppointments = patientAppointment.GetBluecardAppointmentsByPatientId(id);
                foreach (var appointment in appointments)
                {
                    PatientAppointmentDisplay appointmentDisplay = Mapappointments(appointment);
                    appointmentsDisplay.Add(appointmentDisplay);
                }

                foreach (var appointment in bluecardAppointments)
                {
                    PatientAppointmentDisplay appointmentDisplay = MapBluecardappointments(appointment);
                    appointmentsDisplay.Add(appointmentDisplay);
                }

                listAppointments = appointmentsDisplay.OrderByDescending(n => n.AppointmentDate);
            }
            catch (Exception e)
            {
                Msg = e.Message;
            }
            return(listAppointments);
        }
Beispiel #5
0
        public string AddPatientAppointment(int patientId, int patientMasterVisitId, DateTime appointmentDate, string description, int reasonId, int serviceAreaId, int statusId, int differentiatedCareId, int userId)
        {
            PatientAppointment patientAppointment = new PatientAppointment()
            {
                PatientId            = patientId,
                PatientMasterVisitId = patientMasterVisitId,
                AppointmentDate      = appointmentDate,
                Description          = description,
                DifferentiatedCareId = differentiatedCareId,
                ReasonId             = reasonId,
                ServiceAreaId        = serviceAreaId,
                StatusId             = statusId,
                CreatedBy            = userId,
                CreateDate           = DateTime.Now
            };

            try
            {
                var appointment = new PatientAppointmentManager();
                Result = appointment.AddPatientAppointments(patientAppointment);
                if (Result > 0)
                {
                    Msg = "Patient appointment Added Successfully!";
                }
            }
            catch (Exception e)
            {
                Msg = e.Message;
            }
            return(Msg);
        }
        protected void getSessionData(int patientId, int patientMasterVisitId)
        {
            var PCN = new PatientClinicalNotesLogic();

            //PatientClinicalNotes[] notesList = PCN.getPatientClinicalNotes(PatientId).ToArray();
            PatientClinicalNotes[] notesList = (PatientClinicalNotes[])Session["PatientNotesData"];
            if (notesList != null)
            {
                if (notesList.Any())
                {
                    foreach (var value in notesList)
                    {
                        //PCId = Convert.ToInt32(value.NotesCategoryId);
                        TextBox ntb = (TextBox)FindControl("session1tb" + value.NotesCategoryId.ToString());
                        if (ntb != null)
                        {
                            ntb.Text = value.ClinicalNotes;
                        }
                        if (LookupLogic.GetLookupItemId("Session1FollowupDate") == value.NotesCategoryId.ToString())
                        {
                            PatientAppointmentManager appointmentmgr = new PatientAppointmentManager();
                            if (value.ClinicalNotes != "")
                            {
                                List <PatientAppointment> paList = appointmentmgr.GetByDate(Convert.ToDateTime(value.ClinicalNotes));
                                foreach (var pavalue in paList)
                                {
                                    appointmentId = pavalue.Id;
                                }
                            }
                        }
                    }
                }
            }
            var PSM = new PatientScreeningManager();

            PatientScreening[] screeningList = (PatientScreening[])Session["PatientScreeningData"];
            if (screeningList != null)
            {
                foreach (var value in screeningList)
                {
                    //PCId = Convert.ToInt32(value.ScreeningTypeId);
                    RadioButtonList rbl = (RadioButtonList)FindControl("session1rb" + value.ScreeningCategoryId.ToString());
                    if (rbl != null)
                    {
                        rbl.SelectedValue = value.ScreeningValueId.ToString();
                    }
                }
            }
            //PatientAppointmentManager appointmentmgr = new PatientAppointmentManager();
            //PatientAppointment pa = appointmentmgr.GetAppointmentSummaryByDate(AppointmentId);
            //AppointmentDate.Text = pa.AppointmentDate.ToString("dd-MMM-yyy");
        }
        private void AutoFillAppointments(int AppointmentId)
        {
            PatientAppointmentManager appointmentmgr = new PatientAppointmentManager();
            PatientAppointment        pa             = appointmentmgr.GetPatientAppointment(AppointmentId);

            AppointmentDate.Text = pa.AppointmentDate.ToString("dd-MMM-yyy");
            //AppointmentDate.Text = "";
            ServiceArea.SelectedValue        = pa.ServiceAreaId.ToString();
            Reason.SelectedValue             = pa.ReasonId.ToString();
            DifferentiatedCare.SelectedValue = pa.DifferentiatedCareId.ToString();
            description.Text      = pa.Description.ToString();
            status.SelectedValue  = pa.StatusId.ToString();
            UpdateAppointmentDate = pa.AppointmentDate.ToString("dd-MMM-yyy");
        }
Beispiel #8
0
        public int GetPatientAppointmentCount(DateTime date)
        {
            int count = 0;
            List <PatientAppointment> appointments = new List <PatientAppointment>();

            try
            {
                var appointment = new PatientAppointmentManager();
                appointments = appointment.GetByDate(date);
                count        = appointments.Count;
            }
            catch (Exception e)
            {
                Msg = e.Message;
            }
            return(count);
        }
        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 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            double       bmi = 0.0;
            string       bmiZ;
            decimal      diastolic     = 0;
            decimal      systolic      = 0;
            string       bmiAnalysis   = "";
            string       bpAnalysis    = "";
            var          patientVitals = new PatientVitalsManager();
            PatientVital patientTriage;

            if (Request.QueryString["visitId"] != null)
            {
                Session["ExistingRecordPatientMasterVisitID"] = Request.QueryString["visitId"].ToString();
                patientTriage = patientVitals.GetByPatientVisitId(Convert.ToInt32(Session["ExistingRecordPatientMasterVisitID"]));
            }
            else
            {
                Session["ExistingRecordPatientMasterVisitID"] = "0";
                patientTriage = patientVitals.GetByPatientId(PatientId);
            }

            PatientLookupManager pMgr = new PatientLookupManager();
            //PatientVital patientTriage = patientVitals.GetByPatientId(PatientId);
            PatientLookup thisPatient = pMgr.GetPatientDetailSummary(PatientId);
            int           age         = Convert.ToInt32(HttpContext.Current.Session["Age"]);
            DateTime      DoB         = Convert.ToDateTime(thisPatient.DateOfBirth);
            var           patientAge  = PatientManager.CalculateYourAge(DoB);

            lblAge.Text = "<strong><i>" + patientAge.Replace("Age:", "") + "</i></strong>";
            string notTaken = "<span class='label label-danger'>Not Taken!</span>";

            if (patientTriage != null)
            {
                lblDatetaken.Text = Convert.ToDateTime(patientTriage.VisitDate).ToString("dd-MMM-yyyy");
                bmi       = Convert.ToDouble(patientTriage.BMI);
                bmiZ      = Convert.ToString(patientTriage.BMIZ);
                diastolic = Convert.ToDecimal(patientTriage.Bpdiastolic);
                systolic  = Convert.ToDecimal(patientTriage.BpSystolic);

                bpDiastolic = Convert.ToInt32(diastolic);
                bpSystloic  = Convert.ToInt32(systolic);

                bgSystolicT.Text  = bpSystloic.ToString() + " (Systolic)";
                pgDiastolicT.Text = bpDiastolic.ToString() + " (Diastolic)";

                if (patientTriage.Temperature > 0)
                {
                    if (patientTriage.Temperature > 40)
                    {
                        lblTemperature.Text = "<span class='label label-danger'>" +
                                              Convert.ToString(patientTriage.Temperature) +
                                              "°C | Possible Hyperpyrexia‎";
                    }
                    else if (Convert.ToDouble(patientTriage.Temperature) >= 36.0 &&
                             Convert.ToDouble(patientTriage.Temperature) <= 38)
                    {
                        lblTemperature.Text = "<span class='label label-success'>" +
                                              Convert.ToString(patientTriage.Temperature) + "°C | Normal‎";
                    }
                    else if (Convert.ToDouble(patientTriage.Temperature) > 38 &&
                             Convert.ToDouble(patientTriage.Temperature) <= 40.0)
                    {
                        lblTemperature.Text = "<span class='label label-danger'>" +
                                              Convert.ToString(patientTriage.Temperature) +
                                              "°C | Possible Hyperpyrexia‎";
                    }
                    else if (patientTriage.Temperature < 32)
                    {
                        lblTemperature.Text = "<span class='label label-danger'>" +
                                              Convert.ToString(patientTriage.Temperature) + "°C | Medical Emergency‎";
                    }
                    else if (patientTriage.Temperature >= 32 && patientTriage.Temperature < 36)
                    {
                        lblTemperature.Text = "<span class='label label-danger'>" +
                                              Convert.ToString(patientTriage.Temperature) + "°C | Hypothermia ‎";
                    }
                }
                else
                {
                    lblTemperature.Text = "<span class='label label-danger'>" +
                                          Convert.ToString(patientTriage.Temperature) + "NO Temperature Readings ‎";
                }



                if (diastolic < 1 & systolic < 1)
                {
                    lblbloodpressure.Text = "<span class='label label-danger'> NOT TAKEN </span>";
                }
                else
                {
                    if (systolic < 120 & diastolic < 80)
                    {
                        bpAnalysis = "<span class='label label-success'>" + Convert.ToString(systolic) + "/" + Convert.ToString(diastolic) + "mm[Hg] | Normal </span>";
                    }
                    else if (systolic >= 120 | systolic < 129 & diastolic < 80)
                    {
                        bpAnalysis = "<span class='label label-success'>" + Convert.ToString(systolic) + "/" + Convert.ToString(diastolic) + "mm[Hg]  | Elavated </span>";
                    }
                    else if (systolic > 130 || systolic < 139 && diastolic > 80 || diastolic < 89)
                    {
                        bpAnalysis = "<span class='label label-warning'> " + Convert.ToString(systolic) + "/" + Convert.ToString(diastolic) + "mm[Hg]  | HYPERTENSION STAGE 1</span>";
                    }
                    else if (systolic > 140 && diastolic > 90)
                    {
                        bpAnalysis = "<span class='label label-danger'> " + Convert.ToString(systolic) + "/" + Convert.ToString(diastolic) + " |mm[Hg] | HYPERTENSION STAGE 2</span>";
                    }
                    else if (systolic > 180 && diastolic > 120)
                    {
                        bpAnalysis = "<span class='label label-warning'> " + Convert.ToString(systolic) + "/" + Convert.ToString(diastolic) + " |mm[Hg] | HYPERTENSIVE CRISIS </span>";
                    }

                    lblbloodpressure.Text = bpAnalysis;
                }

                if (age > 15 & patientTriage.Muac > 0)
                {
                    lblMuac.Text = Convert.ToString(patientTriage.Muac) + "cms";
                    lblMuac.Text = "<span class='label label-warning'> " + Convert.ToString(patientTriage.Muac) + " | CMs " + "</span>";
                }
                else
                {
                    lblMuac.Text = "<span class='label label-danger'>  0 | Cms </span>";
                }
                if (age > 15)
                {
                    if (bmi < 18.5)
                    {
                        bmiAnalysis = "<span class='label label-danger'>" + Convert.ToString(patientTriage.BMI) +
                                      "Kg/M2" +
                                      " | Under weight</span>";
                    }
                    else if (bmi >= 18.5 & bmi < 25.0)
                    {
                        bmiAnalysis = "<span class='label label-success'> " + Convert.ToString(patientTriage.BMI) +
                                      "Kg/M2" +
                                      " | Normal weight</span>";
                    }
                    else if (bmi >= 25 & bmi < 30.0)
                    {
                        bmiAnalysis = "<span class='label label-warning'> " + Convert.ToString(patientTriage.BMI) +
                                      "Kg/M2" +
                                      " | Over weight<span>";
                    }
                    else
                    {
                        bmiAnalysis = "<span class='label label-danger'> " + Convert.ToString(patientTriage.BMI) +
                                      "Kg/M2" +
                                      " | Obese<span>";
                    }
                }
                else
                {
                    bmiAnalysis = bmiZ;
                }



                lblBMI.Text = bmiAnalysis;
                if ((int)patientTriage.HeartRate == 0)
                {
                    lblPulseRate.Text = notTaken;
                }
                else
                {
                    lblPulseRate.Text = "<span class='label label-info'>" + patientTriage.HeartRate + " beats/min</span>";
                }
                if ((int)patientTriage.SpO2 == 0)
                {
                    lblOxygenSaturation.Text = notTaken;
                }
                else
                {
                    lblOxygenSaturation.Text = "<span class='label label-info'>" + patientTriage.SpO2 + " %</span>";
                }
                if ((int)patientTriage.RespiratoryRate == 0)
                {
                    lblRespiratoryRate.Text = notTaken;
                }
                else
                {
                    lblRespiratoryRate.Text = "<span class='label label-info'>" + patientTriage.RespiratoryRate + " breaths/min</span>";
                }

                lblNurseComments.Text = "<span class='label label-info'>" + patientTriage.NursesComments + "</span>";
            }
            else
            {
                lblTemperature.Text      = notTaken;
                lblbloodpressure.Text    = notTaken;
                lblBMI.Text              = notTaken;
                lblPulseRate.Text        = notTaken;
                lblOxygenSaturation.Text = notTaken;
                lblRespiratoryRate.Text  = notTaken;
            }

            var patientAppointment = new PatientAppointmentManager();
            var pa = patientAppointment.GetByPatientId(PatientId);

            if (pa != null)
            {
                foreach (var item in pa)
                {
                    lblappointmentDate.Text   = "<span class='pull-right'>" + Convert.ToDateTime(item.AppointmentDate).ToString("dd-MMM-yyyy") + "</span>";
                    lblAppointmentReason.Text = "<span class='pull-right'>" + LookupLogic.GetLookupNameById(item.ReasonId) + "</span>";
                    lblappointmentStatus.Text = "<span class='pull-right'>" + LookupLogic.GetLookupNameById(item.StatusId) + "</span>";
                    lblcareStatus.Text        = "<span class='pull-right'>" + LookupLogic.GetLookupNameById(item.DifferentiatedCareId) + "</span>";
                }
            }
        }
Beispiel #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //set menu count values
            PatientLookupManager        patientLookup             = new PatientLookupManager();
            PatientFamilyTestingManager patientFamilyTesting      = new PatientFamilyTestingManager();
            PatientAppointmentManager   patientAppointmentManager = new PatientAppointmentManager();

            lblPatientCount.Text      = patientLookup.GetTotalpatientCount().ToString();
            lblFamilyTesting.Text     = patientFamilyTesting.GetPatientFamilyCount(PatientId).ToString();
            lblAppointments.Text      = patientAppointmentManager.GetCountByPatientId(PatientId).ToString();
            patientLookup             = null;
            patientFamilyTesting      = null;
            patientAppointmentManager = null;
            //check session coming from stopped encounter
            if (Request.QueryString["reset"] != null)
            {
                Response.Clear();
                Session["PatientPK"] = 0;
            }
            //Create New sessions:
            Page.Header.DataBind();
            if (Session["AppLocation"] == null)
            {
                IQCareMsgBox.Show("SessionExpired", this);
                Response.Redirect("~/frmLogOff.aspx");
            }
            if (Session.Count == 0)
            {
                IQCareMsgBox.Show("SessionExpired", this);
                Response.Redirect("~/frmLogOff.aspx");
            }
            if ((Session["AppUserID"] == null && Session["AppUserID"].ToString() == "") || CurrentSession.Current == null)
            {
                IQCareMsgBox.Show("SessionExpired", this);
                Response.Redirect("~/frmLogOff.aspx");
            }
            lblTitle.Text = "International Quality Care Patient Management and Monitoring System [" + Session["AppLocation"].ToString() + "]";
            string url = Request.RawUrl.ToString();

            Application["PrvFrm"] = url;
            //string pageName = this.Page.ToString();
            System.IO.FileInfo fileinfo = new System.IO.FileInfo(Request.Url.AbsolutePath);
            string             pageName = fileinfo.Name;

            if (Session["PatientId"] != null)
            {
                if (int.Parse(Session["PatientId"].ToString()) > 0)
                {
                    //VY added 2014-10-14 for changing level one navigation Menu depending on whether patient has been selected or not
                    if (Session["TechnicalAreaId"] != null)
                    {
                        MenuItem facilityHome = (navUserControl.FindControl("mainMenu") as Menu).FindItem("Facility Home");
                        facilityHome.Text        = "<i class='fa fa-search-plus fa-1x text-muted' aria-hidden='true'></i> <span class='fa-1x text-muted'><strong> Find/Add Patient</strong></span>";
                        facilityHome.NavigateUrl = String.Format("~/Patient/FindAdd.aspx?srvNm={0}&mod={1}", Session["TechnicalAreaName"], Session["TechnicalAreaId"]);
                        MenuItem facilityStats = (navUserControl.FindControl("mainMenu") as Menu).FindItem("Facility Statistics");
                        facilityStats.Text        = "<i class='fa fa-cubes fa-1x text-muted' aria-hidden='true'></i> <span class='fa-1x text-muted'><strong>Select Service</strong></span>";
                        facilityStats.NavigateUrl = "~/frmFacilityHome.aspx";
                    }

                    if (pageName.Equals("frmPatient_Home.aspx") ||
                        pageName.ToLower().Equals("frmscheduler_appointmentnewhistory.aspx")

                        )
                    {
                        // level2Navigation.Style.Add("display", "inline");
                        // levelTwoNavigationUserControl1.CanExecute = true;
                    }
                }
                else
                {
                    //VY added 2014-10-14 for changing level one navigation Menu depending on whether patient has been selected or not
                    MenuItem facilityHome = (navUserControl.FindControl("mainMenu") as Menu).FindItem("Facility Home");
                    facilityHome.Text        = "<i class='fa fa-cubes fa-1x text-muted' aria-hidden='true'></i> <span class='fa-1x text-muted'><strong>Select Service</strong></span>";
                    facilityHome.NavigateUrl = "~/frmFacilityHome.aspx";
                    MenuItem facilityStats = (navUserControl.FindControl("mainMenu") as Menu).FindItem("Facility Statistics");
                    facilityStats.Text        = "<i class='fa fa-line-chart fa-1x text-muted' aria-hidden='true'></i> <span class='fa-1x text-muted'><strong>Facility Statistics</strong></span>";
                    facilityStats.NavigateUrl = "~/Statistics/Facility.aspx";
                }
            }
            else
            {
                // level2Navigation.Style.Add("display", "none");
                // levelTwoNavigationUserControl1.CanExecute = false;
            }

            if (Session["AppUserName"] != null)
            {
                lblUserName.Text = Session["AppUserName"].ToString();
            }
            if (Session["AppLocation"] != null)
            {
                lblLocation.Text = Session["AppLocation"].ToString();
            }
            IIQCareSystem AdminManager;

            AdminManager = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security");

            if (Session["AppDateFormat"].ToString() != "")
            {
                lblDate.Text = AdminManager.SystemDate().ToString(Session["AppDateFormat"].ToString());
            }
            else
            {
                lblDate.Text = AdminManager.SystemDate().ToString("dd-MMM-yyyy");
            }


            lblversion.Text = GblIQCare.VersionName; // AuthenticationManager.AppVersion;
            lblrelDate.Text = GblIQCare.ReleaseDate; //AuthenticationManager.ReleaseDate;
        }
Beispiel #12
0
        public static string Update(PatientAppointSchedulingDTO appointmentScheduling)
        {
            try
            {
                //todo: fetch assigning facility from the message
                string assigning_Facility               = "";
                PatientAppointmentManager manager       = new PatientAppointmentManager();
                PatientLookupManager      patientLookup = new PatientLookupManager();
                LookupLogic lookupLogic = new LookupLogic();
                PatientMasterVisitManager masterVisitManager = new PatientMasterVisitManager();
                var           personIdentifierManager        = new PersonIdentifierManager();
                var           interopPlacerValuesManager     = new InteropPlacerValuesManager();
                PatientLookup patient           = new PatientLookup();
                string        cccNumber         = String.Empty;
                string        appointmentReason = String.Empty;
                string        appointmentStatus = String.Empty;
                string        appointmentType   = String.Empty;
                int           interopUserId     = InteropUser.UserId;

                foreach (var item in appointmentScheduling.PATIENT_IDENTIFICATION.INTERNAL_PATIENT_ID)
                {
                    if (item.IDENTIFIER_TYPE == "CCC_NUMBER" && item.ASSIGNING_AUTHORITY == "CCC")
                    {
                        cccNumber = item.ID;
                    }
                }
                string godsNumber = appointmentScheduling.PATIENT_IDENTIFICATION.EXTERNAL_PATIENT_ID.ID;

                if (!String.IsNullOrWhiteSpace(cccNumber))
                {
                    patient = patientLookup.GetPatientByCccNumber(cccNumber);
                    if (patient != null)
                    {
                        if (!string.IsNullOrWhiteSpace(godsNumber))
                        {
                            IdentifierManager identifierManager = new IdentifierManager();
                            Identifier        identifier        = identifierManager.GetIdentifierByCode("GODS_NUMBER");
                            var personIdentifiers = personIdentifierManager.GetPersonIdentifiers(patient.PersonId, identifier.Id);
                            if (personIdentifiers.Count == 0)
                            {
                                personIdentifierManager.AddPersonIdentifier(patient.PersonId, identifier.Id, godsNumber, interopUserId, assigning_Facility);
                            }
                        }

                        int patientMasterVisitId = masterVisitManager.GetLastPatientVisit(patient.Id).Id;
                        int serviceAreaId        = lookupLogic.GetItemIdByGroupAndItemName("ServiceArea", "MoH 257 GREENCARD")[0].ItemId;


                        foreach (var appointment in appointmentScheduling.APPOINTMENT_INFORMATION)
                        {
                            switch (appointment.APPOINTMENT_REASON)
                            {
                            case "PHARMACY_REFILL":
                                appointmentReason = "Pharmacy Refill";
                                break;

                            case "TREATMENT_PREP":
                                appointmentReason = "Treatment Preparation";
                                break;

                            case "LAB_TEST":
                                appointmentReason = "Lab Tests";
                                break;

                            case "FOLLOWUP":
                                appointmentReason = "Follow Up";
                                break;

                            default:
                                appointmentReason = "Follow Up";
                                break;
                            }

                            switch (appointment.APPOINTMENT_STATUS)
                            {
                            case "HONORED":
                                appointmentStatus = "Met";
                                break;

                            case "MISSED":
                                appointmentStatus = "Missed";
                                break;

                            case "PENDING":
                                appointmentStatus = "Pending";
                                break;

                            case "CANCELLED":
                                appointmentStatus = "CareEnded";
                                break;

                            default:
                                appointmentStatus = "Pending";
                                break;
                            }

                            switch (appointment.APPOINTMENT_TYPE)
                            {
                            case "CLINICAL":
                                appointmentType = "Standard Care";
                                break;

                            case "PHARMACY":
                                appointmentType = "Express Care";
                                break;

                            case "INVESTIGATION":
                                appointmentType = "Express Care";
                                break;

                            default:
                                appointmentType = "Standard Care";
                                break;
                            }
                            var reasons  = lookupLogic.GetItemIdByGroupAndItemName("AppointmentReason", appointmentReason);
                            int reasonId = 0;
                            if (reasons == null || reasons.Count > 0)
                            {
                                throw new Exception($"No matching reasons in the databases {appointmentReason}");
                            }
                            reasonId = reasons[0].ItemId;
                            int statusId = 0;
                            var status   = lookupLogic.GetItemIdByGroupAndItemName("AppointmentStatus", appointmentStatus);
                            if (status == null || status.Count > 0)
                            {
                                throw new Exception($"No matching appointmentstatus in the databases {appointmentStatus}");
                            }
                            statusId = status[0].ItemId;

                            int differentiatedCareId = 0;
                            var diffCare             = lookupLogic.GetItemIdByGroupAndItemName("DifferentiatedCare", appointmentType);
                            if (diffCare == null || diffCare.Count > 0)
                            {
                                throw new Exception($"No matching differentiated care option in the databases {appointmentType}");
                            }
                            differentiatedCareId = diffCare[0].ItemId;

                            InteropPlacerTypeManager interopPlacerTypeManager = new InteropPlacerTypeManager();
                            int interopPlacerTypeId = interopPlacerTypeManager.GetInteropPlacerTypeByName(appointment.PLACER_APPOINTMENT_NUMBER.ENTITY).Id;

                            var interopPlacerValues = interopPlacerValuesManager.GetInteropPlacerValues(interopPlacerTypeId, 3, Convert.ToInt32(appointment.PLACER_APPOINTMENT_NUMBER.NUMBER));
                            if (interopPlacerValues != null)
                            {
                                PatientAppointment patientAppointment = manager.GetPatientAppointment(interopPlacerValues.EntityId);
                                patientAppointment.AppointmentDate      = DateTime.ParseExact(appointment.APPOINTMENT_DATE, "yyyyMMdd", null);
                                patientAppointment.Description          = appointment.APPOINTMENT_NOTE;
                                patientAppointment.DifferentiatedCareId = differentiatedCareId;
                                patientAppointment.ReasonId             = reasonId;
                                patientAppointment.ServiceAreaId        = serviceAreaId;
                                patientAppointment.StatusId             = statusId;
                                manager.UpdatePatientAppointments(patientAppointment);
                            }
                            else
                            {
                                PatientAppointment patientAppointment = new PatientAppointment()
                                {
                                    PatientId            = patient.Id,
                                    PatientMasterVisitId = patientMasterVisitId,
                                    AppointmentDate      = DateTime.ParseExact(appointment.APPOINTMENT_DATE, "yyyyMMdd", null),
                                    Description          = appointment.APPOINTMENT_NOTE,
                                    DifferentiatedCareId = differentiatedCareId,
                                    ReasonId             = reasonId,
                                    ServiceAreaId        = serviceAreaId,
                                    StatusId             = statusId,
                                    CreatedBy            = interopUserId,
                                    CreateDate           = DateTime.Now
                                };

                                int appointmentId = manager.AddPatientAppointments(patientAppointment);
                                InteropPlacerValues placerValues = new InteropPlacerValues()
                                {
                                    IdentifierType      = 3,
                                    EntityId            = appointmentId,
                                    InteropPlacerTypeId = interopPlacerTypeId,
                                    PlacerValue         = Convert.ToInt32(appointment.PLACER_APPOINTMENT_NUMBER.NUMBER)
                                };
                                interopPlacerValuesManager.AddInteropPlacerValue(placerValues);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }

            return(String.Empty);
        }