public async Task <string> _Create(DoctorVisit visit) { try { if (HelperExtensions.isAllowedforEditingorAdd(visit.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(visit.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { //return RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." }); return("Cycle is locked."); } var patient = await _db.Patients.FindAsync(visit.PatientId); ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; if (patient != null) { int a = Convert.ToInt32(visit.AdditionalProviders); var additonal = _db.SecondaryDoctors.AsNoTracking().Where(x => x.Id == a).FirstOrDefault()?.FullName; visit.AdditionalProviders = additonal; _db.DoctorVisits.Add(visit); patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; await _db.SaveChangesAsync(); return("True"); } return("False"); } catch (Exception ex) { return(ex.Message); } //return View(new DoctorVisit { PatientId = visit.PatientId }); }
public async Task <string> _EditMedication(PatientMedicalHistory_MedicationRx medicationRx) { if (HelperExtensions.isAllowedforEditingorAdd(medicationRx.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(medicationRx.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { //return RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." }); return("Cycle is locked."); } var patient = _db.Patients.Find(medicationRx.PatientId); if (patient != null && ModelState.IsValid) { patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(medicationRx).State = EntityState.Modified; await _db.SaveChangesAsync(); return("True"); } else { var errorList = ModelState.Values.SelectMany(m => m.Errors) .Select(e => e.ErrorMessage) .ToList(); var errorstr = string.Join(",", errorList); return(errorstr); } ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; ViewBag.CurrentPage = "Medical History"; //return RedirectToAction("Patient", "CurrentMedication", new { patientId = medicationRx.PatientId }); }
public async Task <ActionResult> Create(DoctorVisit visit) { if (HelperExtensions.isAllowedforEditingorAdd(visit.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(visit.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return(RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." })); } var patient = await _db.Patients.FindAsync(visit.PatientId); ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; if (patient != null) { _db.DoctorVisits.Add(visit); patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; await _db.SaveChangesAsync(); return(RedirectToAction("ListDoctorVisits", new { patientId = visit.PatientId })); } return(View(new DoctorVisit { PatientId = visit.PatientId })); }
public async Task <ActionResult> EditMedication(PatientMedicalHistory_MedicationRx medicationRx) { if (HelperExtensions.isAllowedforEditingorAdd(medicationRx.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(medicationRx.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return(RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." })); } var patient = _db.Patients.Find(medicationRx.PatientId); if (patient != null && ModelState.IsValid) { patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(medicationRx).State = EntityState.Modified; await _db.SaveChangesAsync(); } ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; ViewBag.CurrentPage = "Medical History"; return(RedirectToAction("Patient", "CurrentMedication", new { patientId = medicationRx.PatientId })); }
public async Task <ActionResult> GeneralConditions(PatientMedicalHistory_GeneralCondition conditions) { if (HelperExtensions.isAllowedforEditingorAdd(conditions.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(conditions.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return(RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." })); } var patient = await _db.Patients.FindAsync(conditions.PatientId); if (patient != null) { patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; var gconditions = _db.PatientMedicalHistory_GeneralConditions.Where(x => x.PatientId == conditions.PatientId).FirstOrDefault(); if (gconditions == null) { _db.PatientMedicalHistory_GeneralConditions.Add(conditions); } else { _db.Entry(conditions).State = EntityState.Modified; } //_db.Set<PatientMedicalHistory_GeneralCondition>().AddOrUpdate(conditions); await _db.SaveChangesAsync(); } ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; ViewBag.CurrentPage = "Medical History"; return(RedirectToAction("Patient", "CurrentMedication", new { patientId = conditions.PatientId })); }
public async Task <ActionResult> Create(PatientProfile_Address address) { if (HelperExtensions.isAllowedforEditingorAdd(address.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(address.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return(RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." })); } var patient = await _db.Patients.FindAsync(address.PatientId); if (patient != null && ModelState.IsValid) { patient.Address1 = address.Address1; patient.Address2 = address.Address2; patient.City = address.City; patient.State = address.State; patient.Zipcode = address.Zip; patient.BuildingType = address.BuildingType; patient.DeliveryPermisison = address.DeliveryPermisison; patient.DeliveryInstruction = address.DeliveryInstruction; if (patient.AddressId != null) { _db.Entry(address).State = EntityState.Modified; } else { _db.PatientProfile_Addresses.Add(address); await _db.SaveChangesAsync(); patient.AddressId = address.Id; } patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; await _db.SaveChangesAsync(); return(RedirectToAction("Create", "PatientUrgencyContact", new { patientId = patient.Id })); } var sameAddress = new PatientProfile_Address { PatientId = address.PatientId, Address1 = patient?.Address1, Address2 = patient?.Address2, City = patient?.City, State = patient?.State, Zip = patient?.Zipcode, BuildingType = patient?.BuildingType, DeliveryPermisison = patient?.DeliveryPermisison, DeliveryInstruction = patient?.DeliveryInstruction }; ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; return(View(sameAddress)); }
public bool AssignStatusToAllPatients(string EnrolmentStatus, string EnrollmentSubStatus, string EnrollmentReason, string EnrollmentStatusnote, int[] Patients) { try { if (EnrollmentSubStatus != "In-Active Enrolled") { EnrollmentReason = ""; } if (Patients.Count() > 0) { foreach (var patientid in Patients) { var patient = _db.Patients.Where(x => x.Id == patientid).FirstOrDefault(); patient.EnrollmentStatus = EnrolmentStatus; patient.EnrollmentSubStatus = EnrollmentSubStatus; patient.EnrollmentSubStatusReason = EnrollmentReason; patient.EnrollmentStatusNotes = EnrollmentStatusnote; patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; if (EnrollmentSubStatus == "Active Enrolled") { patient.CcmStatus = "Enrolled"; if (patient.CCMEnrolledOn == null) { patient.CCMEnrolledOn = DateTime.Now; patient.CCMEnrolledBy = User.Identity.GetUserId(); //HelperExtensions.UpdateCurrentMonthActivityfromCycleZeroToOne(patient.Id); try { var reviewtimeccms = _db.ReviewTimeCcms.Where(x => x.PatientId == patient.Id && x.Cycle == 0).ToList().Where(x => x.StartTime.Date.Month == DateTime.Now.Month).ToList(); foreach (var reviewtimeccmitem in reviewtimeccms) { reviewtimeccmitem.Cycle = 1; _db.Entry(reviewtimeccmitem).State = EntityState.Modified; _db.SaveChanges(); } } catch/* (Exception ex)*/ { } } } //patient.CCMEnrolledBy = User.Identity.GetUserId(); //patient.CCMEnrolledOn = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; _db.SaveChanges(); patient.Cycle = CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(patient.Id, BillingCodeHelper.cmmBillingCatagoryid); //HelperExtensions.GetCCMCycleStatus(patient.Id, patient.Cycle, User.Identity.GetUserId(),patient.EnrollmentSubStatus); CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patient.Id, BillingCodeHelper.cmmBillingCatagoryid, patient.Cycle); } } } catch /*(Exception ex)*/ { return(false); } return(true); }
//private readonly ApplicationdbContect _db = new ApplicationdbContect(); //private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // GET: G0506 public ActionResult Index(int PatientId) { var primaryinsurance = new G0506_PrimaryInsurance(); var secondaryinsurance = new G0506_SecondaryInsurance(); var patientinfo = _db.G0506_PatientsInfo.Where(p => p.PatientId == PatientId).FirstOrDefault(); if (patientinfo != null) { primaryinsurance = _db.G0506_PrimaryInsurance.Where(p => p.Id == patientinfo.G0506_PrimaryInsuranceId).FirstOrDefault(); secondaryinsurance = _db.G0506_SecondaryInsurance.Where(p => p.Id == patientinfo.G0506_SecondaryInsuranceId).FirstOrDefault(); } G0506ViewModel viewModel = new G0506ViewModel(); viewModel.G0506_PatientsInfo = patientinfo; viewModel.G0506_PrimaryInsurance = primaryinsurance; viewModel.G0506_SecondaryInsurance = secondaryinsurance; ViewBag.PatientId = PatientId; var Category = "G0506 INITIAL VISIT"; ViewBag.Message = Category; ViewBag.BillingReviewId = HelperExtensions.ReviewTimeGet(Category, PatientId, User.Identity.GetUserId(), BillingCodeHelper.G0506BillingCatagoryid); var G0506FormDataViewModel = new G0506FormDataViewModel(); var PatientInfo = _db.G0506_PatientsInfo.Where(x => x.PatientId == PatientId).FirstOrDefault(); if (patientinfo == null) { patientinfo = new G0506_PatientsInfo(); patientinfo.PatientId = PatientId; patientinfo.CreatedBy = User.Identity.GetUserId(); patientinfo.CreatedOn = DateTime.Now; _db.G0506_PatientsInfo.Add(patientinfo); _db.SaveChanges(); } if (PatientInfo != null) { ViewBag.AdditionalProviders = _db.G0506_AdditionalProviders.Where(sd => sd.G0506_PatientsInfoId == PatientInfo.Id).ToList(); } else { ViewBag.AdditionalProviders = new List <G0506_AdditionalProviders>(); } ViewBag.G0506Status = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(PatientId, BillingCodeHelper.G0506BillingCatagoryid, null); return(View(viewModel)); }
public async Task <string> _Create([Bind(Include = "Id,Code10,Code9,PatientId,DateCreated")] Icd10Codes icd10Codes1, string[] ICD10Codes, string[] ICD9Codes, string[] DiseaseState, string[] DiseaseType, DateTime[] DateCreated, string[] DiseaseHistory) { if (HelperExtensions.isAllowedforEditingorAdd(icd10Codes1.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(icd10Codes1.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return("Cycle is locked."); } if (ModelState.IsValid) { var alreadycodes = _db.Icd10Codes.AsNoTracking().Where(x => x.PatientId == icd10Codes1.PatientId).ToList(); for (int i = 0; i <= ICD10Codes.Count() - 1; i++) { var alreadyitem = alreadycodes.Where(x => x.Code10 == ICD10Codes[i]).FirstOrDefault(); if (alreadyitem == null) { Icd10Codes icd10Codesnew = new Icd10Codes(); icd10Codesnew.Code10 = ICD10Codes[i]; icd10Codesnew.Code9 = ICD9Codes[i]; icd10Codesnew.PatientId = icd10Codes1.PatientId; icd10Codesnew.DateCreated = DateCreated[i]; icd10Codesnew.DiseaseState = DiseaseState[i]; icd10Codesnew.DiseaseType = DiseaseType[i]; icd10Codesnew.DiseaseHistory = DiseaseHistory[i]; _db.Icd10Codes.Add(icd10Codesnew); } } //foreach (var item in ICD10Codes) //{ // var alreadyitem = alreadycodes.Where(x => x.Code10 == item).FirstOrDefault(); // if (alreadyitem == null) // { // Icd10Codes icd10Codesnew = new Icd10Codes(); // icd10Codesnew.Code10 = item; // icd10Codesnew.Code9 = icd10Codes.Code9; // icd10Codesnew.PatientId = icd10Codes.PatientId; // icd10Codesnew.DateCreated = icd10Codes.DateCreated; // _db.Icd10Codes.Add(icd10Codesnew); // } //} await _db.SaveChangesAsync(); return("True"); } else { var errorList = ModelState.Values.SelectMany(m => m.Errors) .Select(e => e.ErrorMessage) .ToList(); var errorstr = string.Join(",", errorList); return(errorstr); } //return "False"; }
public async Task <string> _Create(PatientProfile_Contact contact) { if (HelperExtensions.isAllowedforEditingorAdd(contact.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(contact.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { //return RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." }); return("Cycle is locked."); } var patient = await _db.Patients.FindAsync(contact.PatientId); if (patient != null && ModelState.IsValid) { patient.MobilePhoneNumber = contact.CellPhoneNumber; patient.AllowText = contact.CellPhonePermission; patient.WorkPhoneNumber = contact.WorkPhoneNumber; patient.HomePhoneNumber = contact.HomePhoneNumber; patient.Email = contact.Email; patient.AllowEmail = contact.EmailPermission; if (patient.ContactId != null) { _db.Entry(contact).State = EntityState.Modified; } else { _db.PatientProfile_Contact.Add(contact); await _db.SaveChangesAsync(); patient.ContactId = contact.Id; } patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; await _db.SaveChangesAsync(); //return RedirectToAction("Create", "PatientAddress", new { patientId = patient?.Id }); return("True"); } else { var errorList = ModelState.Values.SelectMany(m => m.Errors) .Select(e => e.ErrorMessage) .ToList(); var errorstr = string.Join(",", errorList); return(errorstr); } ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; //return View(contact); return("False"); }
public async Task <string> _Create(PatientMedicalHistory_MedicalStatus medicalStatus) { if (HelperExtensions.isAllowedforEditingorAdd(medicalStatus.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(medicalStatus.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { //return RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." }); return("Cycle is locked."); } var patient = _db.Patients.Find(medicalStatus.PatientId); if (patient != null && ModelState.IsValid) { if (patient.MedicalStatusId != null) { _db.Entry(medicalStatus).State = EntityState.Modified; } else { _db.PatientMedicalHistory_MedicalStatuses.Add(medicalStatus); await _db.SaveChangesAsync(); patient.MedicalStatusId = medicalStatus.Id; } patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; await _db.SaveChangesAsync(); //return RedirectToAction("Create", "PatientMedicalHistory_MedicalCondition", new { patientId = patient.Id }); return("True"); } else { var errorList = ModelState.Values.SelectMany(m => m.Errors) .Select(e => e.ErrorMessage) .ToList(); if (errorList.Contains("Invalid Phone Number") && errorList.Contains("Invalid Phone Number")) { var val = errorList.IndexOf("Invalid Phone Number"); errorList.RemoveAt(val); } var errorstr = string.Join(",", errorList); return(errorstr); } ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; return("False"); //return View(medicalStatus); }
public async Task <ActionResult> DeleteConfirmed(int id) { Icd10Codes icd10Codes = await _db.Icd10Codes.FindAsync(id); if (HelperExtensions.isAllowedforEditingorAdd(icd10Codes.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(icd10Codes.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return(RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." })); } _db.Icd10Codes.Remove(icd10Codes); await _db.SaveChangesAsync(); return(RedirectToAction("_Index", new { patientId = icd10Codes.PatientId })); }
public async Task <string> _Delete(int id) { PatientProfile_UrgencyContact urgencyDetails = await _db.PatientProfile_UrgencyContacts.FindAsync(id); if (HelperExtensions.isAllowedforEditingorAdd(urgencyDetails.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(urgencyDetails.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return("Cycle is locked."); } _db.PatientProfile_UrgencyContacts.Remove(urgencyDetails); await _db.SaveChangesAsync(); return("True"); }
public ActionResult BacktoProgessbyLiaison(int?patientId, int Cycle, string Reason, string FeedBack, int?BillingcategoryId) { try { var patient = _db.Patients.Where(x => x.Id == patientId).FirstOrDefault(); patient.EnrollmentNotes = FeedBack; _db.Entry(patient).State = EntityState.Modified; _db.SaveChanges(); var patientccmcycle = Cycle; CategoryCycleStatusHelper.User = User; var patientccmcyclestatus = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patient.Id, BillingCodeHelper.cmmBillingCatagoryid, patientccmcycle); if (patient != null) { if (BillingcategoryId == BillingCodeHelper.cmmBillingCatagoryid) { if (patientccmcyclestatus == "Ready for Clinical Sign-Off") { HelperExtensions.UpdateCCMCycleStatus(patient.Id, patientccmcycle, "Enrolled", User.Identity.GetUserId(), Reason, true); } else { return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Not Allowed." })); } } else { CategoryCycleStatusHelper.User = User; var patientcyclestatus = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patient.Id, BillingcategoryId.GetInteger(), patientccmcycle); if (patientcyclestatus == "Ready for Clinical Sign-Off") { HelperExtensions.UpdatecategoryStatus(BillingcategoryId, patient.Id, patientccmcycle, "Enrolled", User.Identity.GetUserId(), Reason, true); } else { return(RedirectToAction("Details", "Patient", new { id = patient.Id, status = "Not Allowed." })); } } } return(RedirectToAction("Index", "CcmStatus", new { status = "Ready for Clinical Sign-Off", BillingcategoryId = BillingcategoryId })); } catch (Exception ex) { log.Error(Environment.NewLine + User.Identity.GetUserName() + "-------" + User.Identity.GetUserId() + Environment.NewLine + ex.Message + "-----" + ex.StackTrace); return(RedirectToAction("Index", "CcmStatus", new { status = "Ready for Clinical Sign-Off" })); /*return ex.Message + "------------------" + ex.StackTrace;*/ } }
public async Task <ActionResult> Edit([Bind(Include = "Id,Code10,Code9,PatientId,DateCreated")] Icd10Codes icd10Codes) { if (HelperExtensions.isAllowedforEditingorAdd(icd10Codes.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(icd10Codes.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return(RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." })); } if (ModelState.IsValid) { _db.Entry(icd10Codes).State = EntityState.Modified; await _db.SaveChangesAsync(); return(RedirectToAction("Index", new { patientId = icd10Codes.PatientId })); } return(View(icd10Codes)); }
public async Task <ActionResult> Create(SecondaryDoctor secondaryDoctor) { if (HelperExtensions.isAllowedforEditingorAdd(secondaryDoctor.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(secondaryDoctor.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return(RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." })); } if (ModelState.IsValid) { _db.SecondaryDoctors.Add(secondaryDoctor); await _db.SaveChangesAsync(); return(RedirectToAction("Index", new { patientId = secondaryDoctor.PatientId })); } return(View(secondaryDoctor)); }
public async Task <string> _Create(PatientLifestyle_LifeStress lifeStress) { if (HelperExtensions.isAllowedforEditingorAdd(lifeStress.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(lifeStress.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { //return RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." }); return("Cycle is locked."); } var patient = _db.Patients.Find(lifeStress.PatientId); if (patient != null && ModelState.IsValid) { if (patient.LifeStressId != null) { _db.Entry(lifeStress).State = EntityState.Modified; } else { _db.PatientLifestyle_LifeStresses.Add(lifeStress); await _db.SaveChangesAsync(); patient.LifeStressId = lifeStress.Id; } patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; await _db.SaveChangesAsync(); return("True"); //return RedirectToAction("Create", "PatientLifestyle_NutritionalSupplement", new { patientId = patient?.Id }); } ViewBag.Coping_StressId = new SelectList(_db.PatientLifestyle_LifeStress_CopingStresses, "Id", "Type", lifeStress.Coping_StressId); ViewBag.LifeStressId = new SelectList(_db.PatientLifestyle_LifeStress_Stresses, "Id", "Type", lifeStress.LifeStressId); ViewBag.workStressId = new SelectList(_db.PatientLifestyle_LifeStress_Stresses, "Id", "Type", lifeStress.workStressId); ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; return("False"); //return View(lifeStress); }
public async Task <string> _Create(PatientProfile_Insurance insurance, string MedicareIdNumber, string MedicaidIdNumber, string OtherInsuranceIdNumber) { if (HelperExtensions.isAllowedforEditingorAdd(insurance.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(insurance.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { //return RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." }); return("Cycle is locked."); } var patient = _db.Patients.Find(insurance.PatientId); if (patient != null && ModelState.IsValid) { if (patient.InsuranceId != null) { _db.Entry(insurance).State = EntityState.Modified; } else { _db.PatientProfile_Insurance.Add(insurance); await _db.SaveChangesAsync(); patient.InsuranceId = insurance.Id; } // patient.MedicaidIdNumber = MedicaidIdNumber; patient.MedicareIdNumber = MedicareIdNumber; patient.OtherInsuranceIdNumber = OtherInsuranceIdNumber; // patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; await _db.SaveChangesAsync(); return("True"); //return RedirectToAction("Create", "PatientMedicalStatus", new { patientId = patient.Id }); } ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; return("False"); //return View(insurance); }
public async Task <string> _Create(PatientLifestyle_NutritionalSupplement supplement) { if (HelperExtensions.isAllowedforEditingorAdd(supplement.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(supplement.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { //return RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." }); return("Cycle is locked."); } var patient = await _db.Patients.FindAsync(supplement.PatientId); if (ModelState.IsValid && patient != null) { if (patient.NutritionalSupplementId != null) { _db.Entry(supplement).State = EntityState.Modified; } else { _db.PatientLifestyle_NutritionalSupplements.Add(supplement); await _db.SaveChangesAsync(); patient.NutritionalSupplementId = supplement.Id; } patient.UpdatedOn = DateTime.Now; patient.UpdatedBy = User.Identity.GetUserId(); patient.CcmStatus = "Claims Submission"; patient.CcmClaimSubmissionDate = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; await _db.SaveChangesAsync(); return("True"); //return RedirectToAction("Index", "CcmStatus", new { status = "Enrolled" }); } ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; return("False"); //return View(supplement); }
public async Task <ActionResult> Create(CarePlan carePlan) { try { CategoryCycleStatusHelper.User = User; if (HelperExtensions.isAllowedforEditingorAdd(carePlan.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(carePlan.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return(RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." })); } var patient = await _db.Patients.FirstOrDefaultAsync(p => p.Id == carePlan.PatientId); if (patient != null && ModelState.IsValid) { _db.Set <CarePlan>().AddOrUpdate(carePlan); patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; await _db.SaveChangesAsync(); } var physician = await _db.Physicians.FindAsync(patient?.PhysicianId); ViewBag.PhysicianName = physician?.FirstName + ' ' + physician?.LastName; ViewBag.PatientName = patient?.FirstName + ' ' + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; return(View(carePlan)); } catch (Exception ex) { CarePlan carePlan1 = new CarePlan(); ViewBag.PhysicianName = "Error"; ViewBag.PatientName = "Error"; ViewBag.PatientId = 0; ViewBag.CcmStatus = "Error"; log.Error(Environment.NewLine + User.Identity.GetUserName() + "-------" + User.Identity.GetUserId() + Environment.NewLine + ex.Message + "-----" + ex.StackTrace); return(View(carePlan1)); /*return ex.Message + "------------------" + ex.StackTrace;*/ } }
public async Task <string> Patient(PatientMedicalHistory_MedicationOTC medicationOtc) { if (HelperExtensions.isAllowedforEditingorAdd(medicationOtc.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(medicationOtc.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { //return RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." }); return("Cycle is locked."); } var patient = _db.Patients.Find(medicationOtc.PatientId); if (patient != null && ModelState.IsValid) { if (patient.MedicationOtcId != null) { _db.Entry(medicationOtc).State = EntityState.Modified; } else { _db.PatientMedicalHistory_MedicationOTCs.Add(medicationOtc); await _db.SaveChangesAsync(); patient.MedicationOtcId = medicationOtc.Id; } patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; await _db.SaveChangesAsync(); return("True"); //return RedirectToAction("Create", "PatientWorkAndRelationship", new { patientId = patient.Id }); } ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; return("False"); //return View(medicationOtc); }
public void ReviewTimePost(int reviewId, string activity) { if (/*User.IsInRole("Liaison") || User.IsInRole("Sales") &&*/ reviewId > 0) { var review = _db.ReviewTimeCcms.Find(reviewId); //var ccmcyclestatus=_db.CCMCycleStatuses.Where(x => x.PatientId == review.PatientId && x.Cycle == review.Cycle).FirstOrDefault(); //if(ccmcyclestatus.CCMStatus=="Enrolled" || ccmcyclestatus.CCMStatus=="In Progress") if (1 == 1) { if (review != null) { review.BillingcategoryId = BillingCodeHelper.cmmBillingCatagoryid; review.BillingCategory = _db.BillingCategories.Where(p => p.BillingCategoryId == review.BillingcategoryId).Select(p => p).FirstOrDefault(); review.EndTime = DateTime.Now; review.ReviewTime = DateTime.Now - review.StartTime; if (activity == null || activity == "") { activity = "Idle"; } review.Activity = activity; if (review.PatientId.Value > 0) { review.Cycle = CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(review.PatientId.Value, BillingCodeHelper.cmmBillingCatagoryid); } if (review.ReviewTime.TotalSeconds < 15 && activity == "Idle") { _db.ReviewTimeCcms.Remove(review); _db.Entry(review).State = EntityState.Deleted; _db.SaveChanges(); return; } _db.Entry(review).State = EntityState.Modified; _db.SaveChanges(); } } } }
public void ReviewTimePostOtherCategories(int?reviewId, string activity) { List <ReviewTimeActivityViewModel> ReviewTimeActivityList = JsonConvert.DeserializeObject <List <ReviewTimeActivityViewModel> >(activity); foreach (var ReviewTimeActivity in ReviewTimeActivityList) { reviewId = null; reviewId = Convert.ToInt32(ReviewTimeActivity.ReviewId); if (reviewId != null && reviewId != 0) { var review = _db.ReviewTimeCcms.Find(reviewId); review.BillingcategoryId = Convert.ToInt32(ReviewTimeActivity.BillingCategoryId); review.BillingCategory = _db.BillingCategories.Where(p => p.BillingCategoryId == review.BillingcategoryId).Select(p => p).FirstOrDefault(); review.EndTime = DateTime.Now; review.ReviewTime = DateTime.Now - review.StartTime; if (ReviewTimeActivity.Activity == null || ReviewTimeActivity.Activity == "") { ReviewTimeActivity.Activity = "Idle"; } review.Activity = ReviewTimeActivity.Activity; if (review.PatientId.Value > 0) { review.Cycle = CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(review.PatientId.Value, BillingCodeHelper.cmmBillingCatagoryid); } if (review.ReviewTime.TotalSeconds < 15 && ReviewTimeActivity.Activity == "Idle") { _db.ReviewTimeCcms.Remove(review); _db.Entry(review).State = EntityState.Deleted; _db.SaveChanges(); return; } _db.Entry(review).State = EntityState.Modified; _db.SaveChanges(); } } }
public async Task <ActionResult> Create(PatientLifestyle_DietAndHabit dietHabit) { if (HelperExtensions.isAllowedforEditingorAdd(dietHabit.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(dietHabit.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return(RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." })); } var patient = _db.Patients.Find(dietHabit.PatientId); if (patient != null && ModelState.IsValid) { if (patient.DietAndHabitId != null) { _db.Entry(dietHabit).State = EntityState.Modified; } else { _db.PatientLifestyle_DietAndHabits.Add(dietHabit); await _db.SaveChangesAsync(); patient.DietAndHabitId = dietHabit.Id; } patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; await _db.SaveChangesAsync(); return(RedirectToAction("Create", "PatientLifestyle_LifeStress", new { patientId = patient.Id })); } ViewBag.AlcoholId = new SelectList(_db.PatientLifestyle_DietAndHabit_AlcoholFrequencies, "id", "Type", dietHabit.AlcoholId); ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; return(View(dietHabit)); }
public async Task <string> _Edit([Bind(Include = "Id,Code10,Code9,DiseaseState,DiseaseType,DiseaseHistory,PatientId,DateCreated")] Icd10Codes icd10Codes) { if (HelperExtensions.isAllowedforEditingorAdd(icd10Codes.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(icd10Codes.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return("Cycle is locked."); } if (ModelState.IsValid) { _db.Entry(icd10Codes).State = EntityState.Modified; await _db.SaveChangesAsync(); return("True"); //return RedirectToAction("Index", new { patientId = icd10Codes.PatientId }); } else { var errorList = ModelState.Values.SelectMany(m => m.Errors) .Select(e => e.ErrorMessage) .ToList(); var errorstr = string.Join(",", errorList); return(errorstr); } }
public async Task <ActionResult> Create(PatientProfile_UrgencyContact urgencyContact) { if (HelperExtensions.isAllowedforEditingorAdd(urgencyContact.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(urgencyContact.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return(RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." })); } var patient = _db.Patients.Find(urgencyContact.PatientId); if (patient != null && ModelState.IsValid) { if (patient.UrgencyContactId != null) { _db.Entry(urgencyContact).State = EntityState.Modified; } else { _db.PatientProfile_UrgencyContacts.Add(urgencyContact); await _db.SaveChangesAsync(); patient.UrgencyContactId = urgencyContact.Id; } patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; await _db.SaveChangesAsync(); return(RedirectToAction("Create", "PatientInsurance", new { patientId = patient.Id })); } ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; return(View(urgencyContact)); }
public async Task <string> _PatientProfile_CreateHospitalVisit(PatientProfile_Hospitalvisits hospitalDetails) { if (HelperExtensions.isAllowedforEditingorAdd(hospitalDetails.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(hospitalDetails.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { //return RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." }); return("Cycle is locked."); } //hospitalDetails.HospitalName = _db.Hospitals.Where(x => x.Id == hospitalDetails.HospitalsId).FirstOrDefault().HospitalName; //hospitalDetails.Doctors = _db.Physicians.Where(y => y.Id == hospitalDetails.PhysicianId).FirstOrDefault().FirstName; //hospitalDetails.Department = _db.Departments.Where(y => y.Id == hospitalDetails.DepartmentId).FirstOrDefault().DepartmentName; hospitalDetails.CreatedBy = User.Identity.GetUserId(); hospitalDetails.CreatedOn = DateTime.Now; hospitalDetails.UpdatedOn = DateTime.Now; var patient = _db.Patients.Find(hospitalDetails.PatientId); if (patient != null && ModelState.IsValid) { _db.patientProfile_Hospitalvisits.Add(hospitalDetails); try { await _db.SaveChangesAsync(); } catch (Exception ex) { } return("True"); } ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; ViewBag.CurrentPage = "Hospital Visits"; // return RedirectToAction("Patient", "CurrentMedication", new { patientId = medicationRx.PatientId }); return("False"); }
public async Task <string> _Create(PatientMedicalHistory_Allergy allergy) { if (HelperExtensions.isAllowedforEditingorAdd(allergy.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(allergy.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { return("Cycle is locked."); } var patient = _db.Patients.Find(allergy.PatientId); if (patient != null && ModelState.IsValid) { if (patient.AllergyId != null) { _db.Entry(allergy).State = EntityState.Modified; } else { _db.PatientMedicalHistory_Allergies.Add(allergy); await _db.SaveChangesAsync(); patient.AllergyId = allergy.Id; } patient.UpdatedBy = User.Identity.GetUserId(); patient.UpdatedOn = DateTime.Now; _db.Entry(patient).State = EntityState.Modified; await _db.SaveChangesAsync(); return("True"); } ViewBag.PatientName = patient?.FirstName + " " + patient?.LastName; ViewBag.PatientId = patient?.Id; ViewBag.CcmStatus = patient?.CcmStatus; return("False"); }
public async Task <string> _Create(SecondaryDoctor secondaryDoctor) { if (HelperExtensions.isAllowedforEditingorAdd(secondaryDoctor.PatientId, CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(secondaryDoctor.PatientId, BillingCodeHelper.cmmBillingCatagoryid), User.Identity.GetUserId()) == false) { //return RedirectToAction("Index", "CcmStatus", new { status = HelperExtensions.GetStatusRedirectionbyUser(User.Identity.GetUserId()), Message = "Cycle is locked." }); return("Cycle is locked."); } if (ModelState.IsValid) { secondaryDoctor.CreatedOn = DateTime.Now; secondaryDoctor.CreatedBy = User.Identity.GetUserId(); secondaryDoctor.Status = true; _db.SecondaryDoctors.Add(secondaryDoctor); await _db.SaveChangesAsync(); return("True"); //return RedirectToAction("Index", new { patientId = secondaryDoctor.PatientId }); } return("False"); //return View(secondaryDoctor); }
private static void UpdatePatientCycleAndCycleStatus(int patientId, int BillingCategoryId) { int cycle = CategoryCycleStatusHelper.GetPatientNewOrOldCycleByCategory(patientId, BillingCategoryId); string cyclestatus = CategoryCycleStatusHelper.GetPatientNewOrOldCycleStatusbyCategory(patientId, BillingCategoryId, cycle, true); }