public int UpdatePatientScreening(int id, DateTime visitDate, int patientId, int patientMasterVisitId, int screeningTypeId, bool screeningDone, DateTime screeningDate, int screeningCategoryId, int screeningValueId, string comment) { try { var PS = new PatientScreening() { Id = id, PatientId = patientId, PatientMasterVisitId = patientMasterVisitId, VisitDate = visitDate, ScreeningTypeId = screeningTypeId, ScreeningDone = Convert.ToBoolean(screeningDone), ScreeningDate = screeningDate, ScreeningCategoryId = screeningCategoryId, ScreeningValueId = screeningValueId, Comment = comment }; return(_patientScreening.UpdatePatientScreening(PS)); } catch (Exception) { throw; } }
public async Task <PatientScreening> addPatientScreening(int patientId, int patientMasterVisitId, int screeningTypeId, DateTime screeningDate, int screeningValueId, int userId) { try { PatientScreening patientScreening = new PatientScreening() { PatientId = patientId, PatientMasterVisitId = patientMasterVisitId, ScreeningTypeId = screeningTypeId, ScreeningDone = true, ScreeningDate = screeningDate, ScreeningCategoryId = null, ScreeningValueId = screeningValueId, Comment = null, Active = true, DeleteFlag = false, CreatedBy = userId, CreateDate = DateTime.Now, VisitDate = screeningDate }; await _unitOfWork.Repository <PatientScreening>().AddAsync(patientScreening); await _unitOfWork.SaveAsync(); return(patientScreening); } catch (Exception e) { throw e; } }
public int updatePatientScreeningById(PatientScreening p) { using (UnitOfWork _unitOfWork = new UnitOfWork(new GreencardContext())) { _unitOfWork.PatientScreeningRepository.Update(p); Result = _unitOfWork.Complete(); _unitOfWork.Dispose(); return(Result); } }
public int AddPatientScreening(PatientScreening a) { using (UnitOfWork unitOfWork = new UnitOfWork(new GreencardContext())) { unitOfWork.PatientScreeningRepository.Add(a); Result = unitOfWork.Complete(); unitOfWork.Dispose(); return(Result); } }
public int AddUpdatePatientScreening(int patientId, int patientMasterVisitId, int screeningType, int screeningCategory, int screeningValue, int userId) { try { int screeningResult; if (patientMasterVisitId > 0) { screeningResult = _patientScreening.checkScreeningByVisitId(patientId, patientMasterVisitId, screeningType, screeningCategory); } else { //(screening>0) ? update:add screeningResult = _patientScreening.checkScreeningByScreeningCategoryId(patientId, screeningType, screeningCategory); } if (screeningResult > 0) { var PS = new PatientScreening() { PatientId = patientId, PatientMasterVisitId = patientMasterVisitId, VisitDate = DateTime.Today, ScreeningTypeId = screeningType, ScreeningDone = true, ScreeningDate = DateTime.Today, ScreeningCategoryId = screeningCategory, ScreeningValueId = screeningValue, Comment = null, CreatedBy = userId, Id = screeningResult }; return(_patientScreening.updatePatientScreeningById(PS)); } else { var PS = new PatientScreening() { PatientId = patientId, PatientMasterVisitId = patientMasterVisitId, VisitDate = DateTime.Today, ScreeningTypeId = screeningType, ScreeningDone = true, ScreeningDate = DateTime.Today, ScreeningCategoryId = screeningCategory, ScreeningValueId = screeningValue, Comment = null, CreatedBy = userId }; return(_patientScreening.AddPatientScreening(PS)); } } catch (Exception) { throw; } }
public int UpdateCurrentPatientScreening(PatientScreening psc) { try { return(_patientScreening.UpdatePatientScreening(psc)); } catch (Exception) { throw; } }
public async Task <PatientScreening> UpdatePatientScreening(PatientScreening patientScreening) { try { _unitOfWork.Repository <PatientScreening>().Update(patientScreening); await _unitOfWork.SaveAsync(); return(patientScreening); } catch (Exception e) { throw e; } }
public async Task <Result <AddPatientScreeningResponse> > Handle(AddPatientScreeningCommand request, CancellationToken cancellationToken) { using (_unitOfWork) { try { for (int i = 0; i < request.ScreeningType.Count; i++) { var screening = request.ScreeningType[i]; var screeningType = await _unitOfWork.Repository <LookupItemView>().Get(x => x.MasterName == "TbScreening").FirstOrDefaultAsync(); int screeningTypeId = screeningType != null ? screeningType.MasterId : 0; PatientScreening patientConsent = new PatientScreening() { PatientId = request.PatientId, PatientMasterVisitId = request.PatientMasterVisitId, ScreeningTypeId = screeningTypeId, ScreeningDone = true, ScreeningDate = request.ScreeningDate, ScreeningCategoryId = null, ScreeningValueId = screening.Value, Comment = null, Active = true, DeleteFlag = false, CreatedBy = request.UserId, CreateDate = DateTime.Now, VisitDate = request.ScreeningDate }; await _unitOfWork.Repository <PatientScreening>().AddAsync(patientConsent); await _unitOfWork.SaveAsync(); } _unitOfWork.Dispose(); return(Result <AddPatientScreeningResponse> .Valid(new AddPatientScreeningResponse() { IsScreeningDone = true })); } catch (Exception e) { Log.Error(e.Message); return(Result <AddPatientScreeningResponse> .Invalid(e.Message)); } } }
public int updateScreeningYesNo(int patientId, int patientMasterVisitId, int screeningType, int screeningCategory, int screeningValue, int userId) { IPatientScreeningManager _patientScreening = (IPatientScreeningManager)ObjectFactory.CreateInstance("BusinessProcess.CCC.Screening.BPatientScreeningManager, BusinessProcess.CCC"); try { //(screening>0) ? update:add int screeningResult = _patientScreening.checkScreeningByScreeningCategoryId(patientId, screeningType, screeningCategory); if (screeningResult > 0) { var PS = new PatientScreening() { PatientId = patientId, PatientMasterVisitId = patientMasterVisitId, VisitDate = DateTime.Today, ScreeningTypeId = screeningType, ScreeningDone = true, ScreeningDate = DateTime.Today, ScreeningCategoryId = screeningCategory, ScreeningValueId = screeningValue, Comment = null, CreatedBy = userId, Id = screeningResult }; return(_patientScreening.updatePatientScreeningById(PS)); } else { var PS = new PatientScreening() { PatientId = patientId, PatientMasterVisitId = patientMasterVisitId, VisitDate = DateTime.Today, ScreeningTypeId = screeningType, ScreeningDone = true, ScreeningDate = DateTime.Today, ScreeningCategoryId = screeningCategory, ScreeningValueId = screeningValue, Comment = null, CreatedBy = userId }; return(_patientScreening.AddPatientScreening(PS)); } } catch (Exception) { throw; } }
public int UpdatePatientScreening(PatientScreening u) { using (UnitOfWork unitOfWork = new UnitOfWork(new GreencardContext())) { var ps = unitOfWork.PatientScreeningRepository.FindBy( x => x.Id == u.Id) .FirstOrDefault(); if (ps != null) { ps.VisitDate = u.VisitDate; ps.ScreeningTypeId = u.ScreeningTypeId; ps.ScreeningDone = u.ScreeningDone; ps.ScreeningDate = u.ScreeningDate; ps.ScreeningCategoryId = u.ScreeningCategoryId; ps.ScreeningValueId = u.ScreeningValueId; ps.Comment = u.Comment; } unitOfWork.PatientScreeningRepository.Update(ps); Result = unitOfWork.Complete(); unitOfWork.Dispose(); return(Result); } }
public int AddPatientScreening(int patientId, int patientMasterVisitid, DateTime visitDate, int screeningTypeId, bool?screeningDone, DateTime screeningDate, int screeningCategoryId, int screeningValueId, string comment, int userId) { try { var PS = new PatientScreening() { PatientId = patientId, PatientMasterVisitId = patientMasterVisitid, VisitDate = visitDate, ScreeningTypeId = screeningTypeId, ScreeningDone = screeningDone, ScreeningDate = screeningDate, ScreeningCategoryId = screeningCategoryId, ScreeningValueId = screeningValueId, Comment = comment, CreatedBy = userId }; return(_patientScreening.AddPatientScreening(PS)); } catch (Exception) { throw; } }
public async Task <Result <MonthlyRefillResponse> > Handle(AddMonthlyRefillCommand request, CancellationToken cancellationToken) { try { var clinicalnotes = await _prepUnitOfWork.Repository <PatientClinicalNotes>().Get(x => x.PatientId == request.PatientId && x.ServiceAreaId == request.ServiceAreaId && x.PatientMasterVisitId == request.PatientMasterVisitId && x.DeleteFlag == false).ToListAsync(); if (request.clinicalNotes.Count > 0) { if (clinicalnotes.Count > 0) { foreach (var x in clinicalnotes) { if (String.IsNullOrEmpty(request.clinicalNotes[0].remark) == true) { x.DeleteFlag = true; } else { x.DeleteFlag = false; x.ClinicalNotes = request.clinicalNotes[0].remark; } _prepUnitOfWork.Repository <PatientClinicalNotes>().Update(x); await _prepUnitOfWork.SaveAsync(); message += "Remarks is updated"; } } else { if (request.clinicalNotes.Count > 0) { if (String.IsNullOrEmpty(request.clinicalNotes[0].remark.ToString()) == false) { PatientClinicalNotes cl = new PatientClinicalNotes(); cl.ServiceAreaId = request.ServiceAreaId; cl.ClinicalNotes = request.clinicalNotes[0].remark; cl.DeleteFlag = false; cl.PatientId = request.PatientId; cl.PatientMasterVisitId = request.PatientMasterVisitId; cl.CreatedBy = request.CreatedBy; cl.CreateDate = DateTime.Now; await _prepUnitOfWork.Repository <PatientClinicalNotes>().AddAsync(cl); await _prepUnitOfWork.SaveAsync(); message += "Remarks is added successfully"; } } } } if (request.Adherence.Count > 0) { var AdherenceOutcome = await _prepUnitOfWork.Repository <AdherenceOutcome>().Get(x => x.PatientId == request.PatientId && x.PatientMasterVisitId == request.PatientMasterVisitId && x.AdherenceType == request.Adherence[0].AdherenceType && x.DeleteFlag == false).ToListAsync(); if (AdherenceOutcome.Count > 0) { foreach (var x in AdherenceOutcome) { if (x.AdherenceType == request.Adherence[0].AdherenceType && x.Score == request.Adherence[0].Score) { x.DeleteFlag = false; x.CreateBy = request.CreatedBy; x.CreateDate = DateTime.Now; Id = x.Id; _prepUnitOfWork.Repository <AdherenceOutcome>().Update(x); await _prepUnitOfWork.SaveAsync(); message += "Adherence Outcome has been updated"; } else { x.DeleteFlag = true; _prepUnitOfWork.Repository <AdherenceOutcome>().Update(x); await _prepUnitOfWork.SaveAsync(); AdherenceOutcome adc = new AdherenceOutcome(); adc.PatientId = request.PatientId; adc.PatientMasterVisitId = request.PatientMasterVisitId; adc.Score = request.Adherence[0].Score; adc.AdherenceType = request.Adherence[0].AdherenceType; adc.CreateBy = request.CreatedBy; adc.CreateDate = DateTime.Now; await _prepUnitOfWork.Repository <AdherenceOutcome>().AddAsync(adc); await _prepUnitOfWork.SaveAsync(); Id = adc.Id; message += "Adherence Outcome has been Saved"; } } } else { AdherenceOutcome adc = new AdherenceOutcome(); adc.PatientId = request.PatientId; adc.PatientMasterVisitId = request.PatientMasterVisitId; adc.Score = request.Adherence[0].Score; adc.AdherenceType = request.Adherence[0].AdherenceType; adc.CreateBy = request.CreatedBy; adc.CreateDate = DateTime.Now; await _prepUnitOfWork.Repository <AdherenceOutcome>().AddAsync(adc); await _prepUnitOfWork.SaveAsync(); Id = adc.Id; message += "Adherence Outcome has been Saved"; } } else { AdherenceOutcome adc = new AdherenceOutcome(); adc.PatientId = request.PatientId; adc.PatientMasterVisitId = request.PatientMasterVisitId; adc.Score = request.Adherence[0].Score; adc.AdherenceType = request.Adherence[0].AdherenceType; adc.CreateBy = request.CreatedBy; adc.CreateDate = DateTime.Now; await _prepUnitOfWork.Repository <AdherenceOutcome>().AddAsync(adc); await _prepUnitOfWork.SaveAsync(); Id = adc.Id; message += "Adherence Outcome has been Saved"; } if (request.screeningdetail.Count > 0) { var patientscreeninglist = await _prepUnitOfWork.Repository <PatientScreening>().Get(x => x.PatientId == request.PatientId && x.PatientMasterVisitId == request.PatientMasterVisitId).ToListAsync(); if (patientscreeninglist.Count > 0) { foreach (var x in patientscreeninglist) { x.DeleteFlag = true; _prepUnitOfWork.Repository <PatientScreening>().Update(x); await _prepUnitOfWork.SaveAsync(); } foreach (var detail in request.screeningdetail) //.ForEach(async x => { var find = patientscreeninglist.Find(t => t.ScreeningTypeId == detail.ScreeningTypeId && t.ScreeningValueId == detail.ScreeningValueId); if (find != null) { find.DeleteFlag = false; find.VisitDate = request.VisitDate; find.CreatedBy = request.CreatedBy; find.Comment = detail.Comment; _prepUnitOfWork.Repository <PatientScreening>().Update(find); await _prepUnitOfWork.SaveAsync(); } else { PatientScreening sc = new PatientScreening(); sc.DeleteFlag = false; sc.VisitDate = request.VisitDate; sc.ScreeningTypeId = detail.ScreeningTypeId; sc.ScreeningValueId = detail.ScreeningValueId; sc.ScreeningDone = true; sc.Active = true; sc.CreateDate = DateTime.Now; sc.CreatedBy = request.CreatedBy; sc.Comment = detail.Comment; sc.PatientId = request.PatientId; sc.PatientMasterVisitId = request.PatientMasterVisitId; await _prepUnitOfWork.Repository <PatientScreening>().AddAsync(sc); await _prepUnitOfWork.SaveAsync(); } } message += "Monthly Refill updated successfully"; } else { foreach (var requestdetail in request.screeningdetail) { PatientScreening sc = new PatientScreening(); sc.DeleteFlag = false; sc.VisitDate = request.VisitDate; sc.ScreeningTypeId = requestdetail.ScreeningTypeId; sc.ScreeningValueId = requestdetail.ScreeningValueId; sc.ScreeningDone = true; sc.Active = true; sc.CreateDate = DateTime.Now; sc.CreatedBy = request.CreatedBy; sc.Comment = requestdetail.Comment; sc.PatientId = request.PatientId; sc.PatientMasterVisitId = request.PatientMasterVisitId; await _prepUnitOfWork.Repository <PatientScreening>().AddAsync(sc); await _prepUnitOfWork.SaveAsync(); } message += "Monthly refill saved successfully"; } } return(Result <MonthlyRefillResponse> .Valid(new MonthlyRefillResponse() { Message = message, Id = Id })); } catch (Exception ex) { return(Result <MonthlyRefillResponse> .Invalid(ex.Message)); } }
public async Task <Result <UpdatePatientScreeningsResult> > Handle(UpdatePatientScreeningsCommand request, CancellationToken cancellationToken) { using (_maternityUnitOfWork) { try { if (request.Screenings.Count > 0) { var Visitscreenings = await _maternityUnitOfWork.Repository <PatientScreening>().Get(x => x.PatientId == request.PatientId && x.PatientMasterVisitId == request.PatientMasterVisitId).ToListAsync(); if (Visitscreenings.Count > 0) { foreach (var x in Visitscreenings) { x.DeleteFlag = true; _maternityUnitOfWork.Repository <PatientScreening>().Update(x); await _maternityUnitOfWork.SaveAsync(); } } for (int i = 0; i < request.Screenings.Count; i++) { var screenings = await _maternityUnitOfWork.Repository <PatientScreening>().Get(x => x.PatientId == request.PatientId && x.PatientMasterVisitId == request.PatientMasterVisitId && x.ScreeningCategoryId == request.Screenings[i].ScreeningCategoryId && x.ScreeningTypeId == request.Screenings[i].ScreeningTypeId && x.ScreeningValueId == request.Screenings[i].ScreeningValueId).FirstOrDefaultAsync(); if (request.Screenings[i].Comment != null) { comment = request.Screenings[i].Comment; } else { comment = ""; } if (screenings != null) { screenings.ScreeningValueId = request.Screenings[i].ScreeningValueId; screenings.DeleteFlag = false; screenings.Comment = comment; _maternityUnitOfWork.Repository <PatientScreening>().Update(screenings); await _maternityUnitOfWork.SaveAsync(); } else { var screening = new PatientScreening { PatientId = request.PatientId, PatientMasterVisitId = request.PatientMasterVisitId, DeleteFlag = false, CreateDate = DateTime.Now, CreatedBy = request.CreatedBy, Comment = comment, Active = false, ScreeningCategoryId = request.Screenings[i].ScreeningCategoryId, ScreeningDate = request.VisitDate, ScreeningDone = true, ScreeningTypeId = request.Screenings[i].ScreeningTypeId, ScreeningValueId = request.Screenings[i].ScreeningValueId, VisitDate = request.VisitDate }; await _maternityUnitOfWork.Repository <PatientScreening>().AddAsync(screening); await _maternityUnitOfWork.SaveAsync(); } } } return(Result <UpdatePatientScreeningsResult> .Valid(new UpdatePatientScreeningsResult() { Message = "Successfully updated patient screening" })); } catch (Exception e) { Log.Error(e, $"An error occured while trying to update patient screening for patientId: {request.PatientId} and patientMasterVisitId {request.PatientMasterVisitId}"); return(Result <UpdatePatientScreeningsResult> .Invalid($"An error occured while trying to update patient screening for patientId: {request.PatientId} and patientMasterVisitId {request.PatientMasterVisitId}")); } } }