//check if the test is related to a patient disease //test can be independent or related to a patient disease //when it is related the PatientDisease Value will the id of patient disease //otherwise it will be empty //if it is related to a disease we have to get all the past tests related to this disease public IActionResult Create(int id, [FromQuery(Name = "PatientDisease")] string PatientDisease) { var TestTypeList = _context.TestType.ToList(); SelectList TestTypeId = new SelectList(TestTypeList, "TestTypeId", "TestTypeName"); ViewData["TestTypeId"] = TestTypeId; PatientTest patientTest = new PatientTest() { PatientId = id }; if (PatientDisease != null) { int.TryParse(PatientDisease, out int patientDiseaseID); patientTest.PatientDiseaseId = patientDiseaseID; IEnumerable <PatientTest> PatientTestList = _context.PatientTest.Include(x => x.TestType).Include(x => x.Patient).Where(x => x.PatientDiseaseId == patientTest.PatientDiseaseId).ToList(); ViewData["PatientTestList"] = PatientTestList; } else { IEnumerable <PatientTest> PatientTestList = _context.PatientTest.Include(x => x.TestType).Include(x => x.Patient).Where(x => x.PatientId == id).ToList(); ViewData["PatientTestList"] = PatientTestList; } return(View(patientTest)); }
public IActionResult Edit(PatientTest patientTest) { List <IFormFile> ImageList = patientTest.ImageFiles; long? patientTestID = patientTest.PatientTestId; if (ImageList != null) { foreach (IFormFile image in ImageList) { if (image != null && image.ContentType.Contains("image")) { using (MemoryStream memory = new MemoryStream()) { image.CopyTo(memory); PatientTestImages patientTestImages = new PatientTestImages() { PatientTestId = patientTestID, Image = memory.ToArray() }; _context.PatientTestImages.Add(patientTestImages); _context.SaveChanges(); } } } } _context.Update(patientTest); _context.SaveChanges(); return(RedirectToAction("Create", new { id = patientTest.PatientId, PatientDisease = patientTest.PatientDiseaseId.ToString() })); }
/// <summary> /// /// </summary> /// <param name="visitid"></param> /// <param name="template"></param> /// <returns></returns> public PatientTestDto AddNewPatientTest(int visitid, TestTemplate template) { MapperConfig.ConfigAutoMapper(); PatientTest Test = new PatientTest(); int testTemplateID = TestTemplateRepository.GetTestTemplate(template.TemplateName).TestTemplateId; Test.TemplateID = testTemplateID; Test.VisitID = visitid; /*This will update by MLT After he Approved the test */ Test.ApprovedBy = 0; Test.CreatedBy = "EMP"; Test.Price = TestTemplateRepository.GetTestTemplate(template.TemplateName).Price; Test.CreatedDate = DateTime.Now; Test.ApprovedDate = DateTime.Now; Test.ModifiedBy = string.Empty; Test.ModifiedDate = null; var patientTest = PatientTestRepository.Insert(Mapper.Map <PatientTest>(Test)); return(Mapper.Map <PatientTestDto>(patientTest)); }
public ActionResult EditTest(DoctorTestViewModel vm, int id, IFormCollection collection) { var pat = new PatientTest { TestId = vm.TestId, TestName = vm.TestName, DepartmentId = vm.DepartmentId, }; try { if (id > 0) { _testRepository.UpdateTest(pat); } else { _testRepository.AddTest(pat); } _testRepository.SaveChangesAsync(); return(RedirectToAction("Index")); } catch { return(View(pat)); } }
private void SavePatientTestInfo() { foreach (GridViewRow row1 in TestEntryGridView.Rows) { PatientTest patientTest = new PatientTest(); patientTest.TestTypeID = Convert.ToInt32((row1.FindControl("testTypeIdLabel") as Label).Text); patientTest.PatientID = patientID; testEntryManager.SavePatientInformation(patientTest); } }
public void InsertPatientFromDetail(PatientTestModel model) { using (EHMSEntities ent = new EHMSEntities()) { if (model.ReferDoctorID == 1009) { model.ReferDoctorID = 20;//Default doctor Id } var objInsertPatientTest = new PatientTest() { //insert into patienttest PatientID = model.PatientInformationModel.EmergencyMasterId, DepartmentID = model.PatientInformationModel.DepartmentID, ReferDoctorID = model.ReferDoctorID, TestRegistrationDate = model.TestRegistrationDate, Status = true }; ent.PatientTests.Add(objInsertPatientTest); ent.SaveChanges(); foreach (var item in model.TestCheckBoxListModelList) { var objInsertPatientDetail = new PatientTestDetail() { //insert into patientdetail PatientTestID = objInsertPatientTest.PatientTestID, PatientID = model.PatientInformationModel.EmergencyMasterId, DepartmentID = model.PatientInformationModel.DepartmentID, SectionID = item.SectionId, TestID = item.TestId, TestDate = item.TestDate, TestTime = item.TestTime, DeliveryDate = item.DeliveryDate, DeliveryStatus = false }; ent.PatientTestDetails.Add(objInsertPatientDetail); //ent.SaveChanges(); // update status in centralized billing //var objtoUpdateCentralizedBilling = ent.CentralizedBilling.Where(x => x.BillNumber == item.BillNumber && x.ItemID == item.TestId && x.PatientId == model.PatientInformationModel.EmergencyMasterId); //foreach (var item2 in objtoUpdateCentralizedBilling) //{ // item2.Status = false; //} int BillNumberInt = Convert.ToInt32(item.BillNo); var objtoUpdateCentralizedBilling = ent.CentralizedBillingDetails.Where(x => x.BillNo == BillNumberInt && x.Status == true); foreach (var item2 in objtoUpdateCentralizedBilling) { item2.Status = false; } ent.SaveChanges(); } } }
public string SavePatientInformation(PatientTest patientTest) { int rowAffected = testEntryGetway.SavePatientTestInformation(patientTest); if (rowAffected > 0) { return("success"); } else { return("failed"); } }
public int SavePatientTest(PatientTest test, TestsSetup set) { SqlConnection connection = new SqlConnection(connectionString); string query = "exec spInsertPatientTest '" + set.Name + "','" + test.Mobile + "'"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); int rowAffected = command.ExecuteNonQuery(); connection.Close(); return(rowAffected); }
public int SavePatientTestInformation(PatientTest patientTest) { int rowAffected; //throw new NotImplementedException(); ; string query = "INSERT INTO PatientTest(patientID, testSetupID, created_at) VALUES(" + patientTest.PatientID + "," + patientTest.TestTypeID + ",GETDATE())"; command.CommandText = query; connection.Open(); rowAffected = command.ExecuteNonQuery(); connection.Close(); return(rowAffected); }
private void SavePatientTestInfo() { TestsSetup testSet = new TestsSetup(); PatientTest test = new PatientTest(); if (ViewState["TestsSetup"] != null) { DataTable currentTable = (DataTable)ViewState["TestsSetup"]; for (int i = 0; i < currentTable.Rows.Count; i++) { testSet.Name = currentTable.Rows[i][1].ToString(); test.Mobile = mobileNoTextBox.Text; patientInfoManager.SavePatientTest(test, testSet); } } }
public void ApproveTestByMLT() { PatientTest patientTest = new PatientTest() { VisitID = 69, }; User user = new User() { UserId = 76, Username = "******" }; TestResultManager testManager = new TestResultManager(); var approve = testManager.ApproveTest(patientTest, user); }
public int SavePatientTestInformation(PatientTest patientTest) { int rowAffected; string connectionString = WebConfigurationManager.ConnectionStrings["DiagnosticCenterDB"].ConnectionString; SqlConnection connection = new SqlConnection(connectionString); string query = "INSERT INTO PatientTest(patientID, testSetupID, createdAt) VALUES(" + patientTest.PatientID + "," + patientTest.TestTypeID + ",GETDATE())"; SqlCommand command = new SqlCommand(query, connection); connection.Open(); rowAffected = command.ExecuteNonQuery(); connection.Close(); return(rowAffected); }
//Get patient test id from route public IActionResult Edit(int id) { bool existed = _context.PatientTest.Any(x => x.PatientTestId == id); if (existed) { SelectList TestTypeList = new SelectList(_context.TestType.ToList(), "TestTypeId", "TestTypeName"); ViewData["TestTypeId"] = TestTypeList; IEnumerable <PatientTestImages> PatientTestImageList = _context.PatientTestImages.Where(x => x.PatientTestId == id).ToList(); ViewData["ImageList"] = PatientTestImageList; PatientTest patientTest = _context.PatientTest.Where(x => x.PatientTestId == id).FirstOrDefault(); return(View(patientTest)); } else { return(NotFound()); } }
/// <summary> /// /// </summary> /// <param name="Patient"></param> /// <returns></returns> /// public Patient GetTest(PatientDto Patient) { if (Patient.ContactNo.Length <= 10) { if (patient.GetPatient(Patient.ContactNo) != null) { int PatientID = patient.GetPatient(Patient.ContactNo).PatientId; if (VisitHelper.GetVisitByPatientID(PatientID) == null) { System.Diagnostics.Debug.WriteLine("Visit Not Found!"); } else { int visitid = VisitHelper.GetVisitByPatientID(PatientID).PatientVisitId; System.Diagnostics.Debug.WriteLine("Visit Found!"); if (test.GetTest(visitid) == null) { System.Diagnostics.Debug.WriteLine("Test Not Found!"); PatientTest Test = test.GetTest(visitid); } else { System.Diagnostics.Debug.WriteLine("Test Found!"); PatientTest Test = test.GetTest(visitid); } } } else { System.Diagnostics.Debug.WriteLine("Patient Not Found!"); } } else { System.Diagnostics.Debug.WriteLine("Invalid Contact Number"); } return(null); }
/// <summary> /// /// </summary> /// <param name="patientTest"></param> /// <param name="user"></param> /// <returns></returns> /// public PatientTestDto ApproveTest(PatientTest patientTest, User user) { MapperConfig.ConfigAutoMapper(); patientTest.TemplateID = TestRepo.GetTest(patientTest.VisitID).TemplateID; patientTest.PatientTestID = TestRepo.GetTest(patientTest.VisitID).PatientTestID; patientTest.CreatedBy = TestRepo.GetTest(patientTest.VisitID).CreatedBy; patientTest.ModifiedBy = user.Username; patientTest.ApprovedBy = user.UserId; patientTest.CreatedDate = new DateTime(2016, 5, 5); patientTest.ModifiedDate = DateTime.Now; patientTest.ApprovedDate = DateTime.Now; System.Diagnostics.Debug.WriteLine("Test Approved by : " + user.Username + " "); TestRepo.Update(Mapper.Map <PatientTest>(patientTest)); return(null); }
public async Task <ActionResult> CreateTest(DoctorTestViewModel vm, IFormCollection collection) { var pat = new PatientTest { TestId = vm.TestId, TestName = vm.TestName, DepartmentId = vm.DepartmentId, //Department = vm.deptL }; try { _testRepository.AddTest(pat); await _testRepository.SaveChangesAsync(); return(RedirectToAction("Index")); } catch { return(View(pat)); } }
public IActionResult Create(PatientTest patientTest) { List <IFormFile> ImageList = patientTest.ImageFiles; if (ModelState.IsValid) { _context.PatientTest.Add(patientTest); _context.SaveChanges(); long patientTestId = patientTest.PatientTestId; //int? patientDiseaseId = patientTest.PatientDiseaseId; //int? patientId = patientTest.PatientId; if (ImageList != null) { foreach (IFormFile image in ImageList) { if (image != null && image.ContentType.Contains("image")) { using (var stream = new MemoryStream()) { image.CopyTo(stream); byte[] Image = stream.ToArray(); PatientTestImages patientTestImages = new PatientTestImages(); patientTestImages.Image = Image; patientTestImages.PatientTestId = patientTestId; _context.PatientTestImages.Add(patientTestImages); _context.SaveChanges(); } } } } return(RedirectToAction("Create", new { id = patientTest.PatientId, PatientDisease = patientTest.PatientDiseaseId.ToString() })); } else { return(View(patientTest)); } }
public void Add(PatientTest Patienttest) { _PatientTestService.Insert(Patienttest); }
public int SavePatientTest(PatientTest test, TestsSetup set) { return(patientGetway.SavePatientTest(test, set)); }
public void RemoveTest(PatientTest test) { _appDbContext.Tests.Remove(test); }
public void UpdateTest(PatientTest test) { _appDbContext.Tests.Update(test); }
public void AddTest(PatientTest patient) { _appDbContext.Tests.Add(patient); }
public void Add(PatientTest Patienttest) { _PatientTestRepository.Insert(Patienttest); }
public static void Seed(IServiceProvider serviceProvider) { using (var context = new AppDbContext(serviceProvider.GetRequiredService <DbContextOptions <AppDbContext> >())) { //AppDbContext context = applicationBuilder.ApplicationServices.GetRequiredService<AppDbContext>(); //UserManager<IdentityUser> userManager = serviceProvider.GetRequiredService<UserManager<IdentityUser>>(); // Add Customers //var justin = new PatientForm //{ //var user = new IdentityUser("tenece"); // userManager.CreateAsync(user, "%ten"); var mike = new Physician { Id = 2, PhysicianName = "Dave bane" }; context.Physicians.Add(mike); var pat = new PatientForm { Id = 1, Fullname = "Justin Noon", Age = 27, ClinicalDiagnosis = "RVS", ClinicNo = 3, DepartmentId = 3, //Test = new PatientTest //{ // t //} //PhysicianId = 2, //Test = 5, //Department = "Infection and Disease" }; context.Patients.Add(pat); var arv = new PatientTest { TestId = 5, TestName = "HIV", DepartmentId = 3 }; context.Tests.Add(arv); var vir = new TestDepartment { DeptId = 3, Department = "Virus" }; context.Departments.Add(vir); //}; var ruth = new TestRegister { Id = 1, Date = DateTime.Now, PatientId = 1, TId = 5, ResultId = 8 }; context.Appointments.Add(ruth); var res = new TestResult { Id = 8, IsCompleted = true }; context.Results.Add(res); context.SaveChanges(); } }