public string addAdherenceHIVStatus(int patientId, int patientMasterVisitId, int createdBy, int AcceptedStatus, int DisclosureComplete) { IPatientEncounter patientEncounter = (IPatientEncounter)ObjectFactory.CreateInstance("BusinessProcess.CCC.BPatientEncounter, BusinessProcess.CCC"); PatientEncounterManager patientEncounterManager = new PatientEncounterManager(); encounterTypeId = patientEncounterManager.GetPatientEncounterId("EncounterType", "Adherence-Barriers"); var foundEncounter = patientEncounterManager.GetEncounterIfExists(Convert.ToInt32(patientId), Convert.ToInt32(patientMasterVisitId), Convert.ToInt32(encounterTypeId)); if (foundEncounter != null) { EncounterResult = foundEncounter.Id; } else { EncounterResult = patientEncounterManager.AddpatientEncounter(Convert.ToInt32(patientId), Convert.ToInt32(patientMasterVisitId), patientEncounterManager.GetPatientEncounterId("EncounterType", "Adherence-Barriers"), 203, createdBy); } if (EncounterResult > 0) { try { var AL = new AdherenceLogic(); Result = AL.addAdherenceHIVStatus(patientId, patientMasterVisitId, createdBy, AcceptedStatus, DisclosureComplete); if (Result > 0) { Msg = " HIV Status Added Successfully"; } } catch (Exception e) { Msg = e.Message; } } return(Msg); }
public int savePatientEncounterPresentingComplaints(string patientMasterVisitID, string patientID, string serviceID, string VisitDate, string VisitScheduled, string VisitBy, string anyComplaints, string Complaints, int TBScreening, int NutritionalStatus, int userId, string adverseEvent, string presentingComplaints) { IPatientEncounter patientEncounter = (IPatientEncounter)ObjectFactory.CreateInstance("BusinessProcess.CCC.BPatientEncounter, BusinessProcess.CCC"); PatientEncounterManager patientEncounterManager = new PatientEncounterManager(); JavaScriptSerializer parser = new JavaScriptSerializer(); var advEvent = parser.Deserialize <List <AdverseEvents> >(adverseEvent); var pComplaints = parser.Deserialize <List <PresentingComplaints> >(presentingComplaints); int val = patientEncounter.savePresentingComplaints(patientMasterVisitID, patientID, serviceID, VisitDate, VisitScheduled, VisitBy, anyComplaints, Complaints, TBScreening, NutritionalStatus, userId, advEvent, pComplaints); //Set the Visit Encounter Here //TODO: ALWAYS CHECK IF AN ENCOUNTER EXITS BEFRE ADDING: encounterTypeId = patientEncounterManager.GetPatientEncounterId("EncounterType", "ccc-encounter".ToLower()); var foundEncounter = patientEncounterManager.GetEncounterIfExists(Convert.ToInt32(patientID), Convert.ToInt32(patientMasterVisitID), Convert.ToInt32(encounterTypeId)); if (foundEncounter != null) { result = foundEncounter.Id; } else { if (val > 0) { result = patientEncounterManager.AddpatientEncounter(Convert.ToInt32(patientID), Convert.ToInt32(patientMasterVisitID), patientEncounterManager.GetPatientEncounterId("EncounterType", "ccc-encounter".ToLower()), 203, userId); } } return((result > 0) ? val : 0); }
public int saveUpdatePharmacy(string PatientMasterVisitID, string PatientId, string LocationID, string OrderedBy, string UserID, string DispensedBy, string RegimenLine, string ModuleID, string pmscmFlag, string prescription, string TreatmentProgram, string PeriodTaken, string TreatmentPlan, string TreatmentPlanReason, string Regimen, string regimenText, string prescriptionDate, string dispensedDate) { IPatientPharmacy patientEncounter = (IPatientPharmacy)ObjectFactory.CreateInstance("BusinessProcess.CCC.BPatientPharmacy, BusinessProcess.CCC"); PatientEncounterManager patientEncounterManager = new PatientEncounterManager(); JavaScriptSerializer parser = new JavaScriptSerializer(); int val = 0; var drugPrescription = parser.Deserialize <List <DrugPrescription> >(prescription); string RegimenType = ""; for (int i = 0; i < drugPrescription.Count; i++) { if (!RegimenType.ToUpper().Contains(drugPrescription[i].DrugAbbr.ToUpper())) { if (drugPrescription[i].DrugAbbr != "") { RegimenType += drugPrescription[i].DrugAbbr + "/"; } } } result = patientEncounter.saveUpdatePharmacy(PatientMasterVisitID, PatientId, LocationID, OrderedBy, UserID, RegimenType.TrimEnd('/'), DispensedBy, RegimenLine, ModuleID, drugPrescription, pmscmFlag, TreatmentProgram, PeriodTaken, TreatmentPlan, TreatmentPlanReason, Regimen, prescriptionDate, dispensedDate); //-- Raise event if result is>0 for sharing with IL if (result > 0) { MessageEventArgs arg = new MessageEventArgs() { PatientId = Convert.ToInt32(PatientId), EntityId = result, // the orderId EventOccurred = "Prescription Raised", MessageType = MessageType.DrugPrescriptionRaised, FacilityId = 0, PatientMasterVisitId = Convert.ToInt32(PatientMasterVisitID) }; Publisher.RaiseEventAsync(this, arg).ConfigureAwait(false); // -- } if (result > 0) { val = patientEncounterManager.AddpatientEncounter(Convert.ToInt32(PatientId), Convert.ToInt32(PatientMasterVisitID), patientEncounterManager.GetPatientEncounterId("EncounterType", "Pharmacy-encounter".ToLower()), 204, Convert.ToInt32(UserID)); } return((val > 0) ? result : 0); // return result; }
public string AddpatientVitals(int patientId, int bpSystolic, int bpDiastolic, decimal heartRate, decimal height, decimal muac, int patientMasterVisitId, decimal respiratoryRate, decimal spo2, decimal tempreture, decimal weight, decimal bmi, decimal headCircumference, string bmiz, string weightForAge, string weightForHeight, DateTime visitDate) { try { PatientEncounterManager patientEncounterManager = new PatientEncounterManager(); int facilityId = Convert.ToInt32(Session["AppPosID"]); PatientVital patientVital = new PatientVital() { PatientId = patientId, BpSystolic = bpSystolic, Bpdiastolic = bpDiastolic, HeartRate = heartRate, Height = height, Muac = muac, PatientMasterVisitId = patientMasterVisitId, RespiratoryRate = respiratoryRate, SpO2 = spo2, Temperature = tempreture, Weight = weight, BMI = bmi, HeadCircumference = headCircumference, VisitDate = visitDate, BMIZ = bmiz, WeightForAge = weightForAge, WeightForHeight = weightForHeight, }; var vital = new PatientVitalsManager(); Result = vital.AddPatientVitals(patientVital, facilityId); int userId = Convert.ToInt32(Session["AppUserId"]); if (Result > 0) { Result = patientEncounterManager.AddpatientEncounter(patientId, patientMasterVisitId, patientEncounterManager.GetPatientEncounterId("EncounterType", "Triage-encounter".ToLower()), 204, userId); if (Result > 0) { Msg = "Patient Vitals Added Successfully!"; } } } catch (Exception e) { Msg = e.Message; } return(Msg); }
public int savePatientEncounter(int patientID, int patientMasterVisitID, string EncounterType, int ServiceAreaId, int userId) { int val = 0; IPatientEncounter patientEncounter = (IPatientEncounter)ObjectFactory.CreateInstance("BusinessProcess.CCC.BPatientEncounter, BusinessProcess.CCC"); PatientEncounterManager patientEncounterManager = new PatientEncounterManager(); encounterTypeId = patientEncounterManager.GetPatientEncounterId("EncounterType", EncounterType.ToLower()); var foundEncounter = patientEncounterManager.GetEncounterIfExists(Convert.ToInt32(patientID), Convert.ToInt32(patientMasterVisitID), Convert.ToInt32(encounterTypeId)); if (foundEncounter != null) { result = foundEncounter.Id; } else { result = patientEncounterManager.AddpatientEncounter(Convert.ToInt32(patientID), Convert.ToInt32(patientMasterVisitID), encounterTypeId, 203, userId); } return((result > 0) ? result : val); }
/// <summary> /// Saves the patient lab order. /// </summary> /// <param name="patientID">The patient identifier.</param> /// <param name="patient_Pk">The patient pk.</param> /// <param name="userId">The user identifier.</param> /// <param name="facilityID">The facility identifier.</param> /// <param name="moduleId">The module identifier.</param> /// <param name="patientMasterVisitId">The patient master visit identifier.</param> /// <param name="labOrderDate">The lab order date.</param> /// <param name="orderNotes">The order notes.</param> /// <param name="patientLabOrder">The patient lab order.</param> /// <param name="orderStatus">The order status.</param> /// <returns>order Id</returns> public int savePatientLabOrder(int patientID, int patient_Pk, int userId, int facilityID, int moduleId, int patientMasterVisitId, string labOrderDate, string orderNotes, string patientLabOrder, string orderStatus) { int visitId = 0; int orderId = 0; int testId = 0; //int _paramId = 0; DateTime orderDate = Convert.ToDateTime(labOrderDate); // DateTime orderDate = DateTime.Now; //DateTime orderDate = DateTime.Parse(labOrderDate); var jss = new JavaScriptSerializer(); IList <ListLabOrder> data = jss.Deserialize <IList <ListLabOrder> >(patientLabOrder); if (patientID > 0) { PatientVisit visit = new PatientVisit() { Ptn_Pk = patient_Pk, LocationID = facilityID, UserID = userId, TypeofVisit = 70, //Self (70) 71 (Treatmentsupporter) VisitDate = orderDate, ModuleId = moduleId, VisitType = 6 }; visitId = _visitManager.AddPatientVisit(visit); LabOrderEntity labOrder = new LabOrderEntity() { Ptn_pk = patient_Pk, PatientId = patientID, LocationId = facilityID, VisitId = visitId, ModuleId = moduleId, OrderedBy = userId, ClinicalOrderNotes = orderNotes, PatientMasterVisitId = patientMasterVisitId, OrderStatus = orderStatus, OrderDate = orderDate, UserId = userId }; orderId = _mgr.AddPatientLabOrder(labOrder); // DateTime? nullDate = null; foreach (ListLabOrder t in data) { LabDetailsEntity labDetails = new LabDetailsEntity() { LabOrderId = orderId, LabTestId = t.LabNameId, TestNotes = t.LabNotes, UserId = userId, CreatedBy = userId, StatusDate = DateTime.Now, ResultDate = t.ResultDate }; testId = _mgr.AddLabOrderDetails(labDetails); PatientLabTracker labTracker = new PatientLabTracker() { PatientId = patientID, PatientMasterVisitId = patientMasterVisitId, LabName = t.LabName, SampleDate = orderDate, Reasons = t.OrderReason, CreatedBy = userId, Results = orderStatus, LabOrderId = orderId, LabTestId = t.LabNameId, //parameter LabOrderTestId = testId, //uniquely identifies a particular test FacilityId = facilityID, ResultDate = t.ResultDate }; Result = _mgr.AddPatientLabTracker(labTracker); if (Result > 0) { Id = _patientEncounterManager.AddpatientEncounter(patientID, patientMasterVisitId, _patientEncounterManager.GetPatientEncounterId("EncounterType", "lab-encounter".ToLower()), 205, userId); } //add to dtlresults List <LookupTestParameter> _parameters = _lookupTest.GetTestParameter(t.LabNameId); if (_parameters != null) { foreach (LookupTestParameter p in _parameters) { LabResultsEntity labresults = new LabResultsEntity() { LabOrderId = orderId, LabTestId = t.LabNameId, LabOrderTestId = testId, ParameterId = p.Id, UserId = userId, CreatedBy = userId, StatusDate = DateTime.Now }; _mgr.AddPatientLabResults(labresults); } } } } return(orderId); }