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 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); }
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); }
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>"; } } }