public ActionResult Create(PatientTestResultModel model) { if (ModelState.IsValid) { pro.Insert(model); } return(View(model)); }
//public List<PatientTestResultModel> GetPatienTestInTree(int PatientID, DateTime TestDate, int PatientTestID) //{ // using (EHMSEntities ent = new EHMSEntities()) // { // List<PatientTestResultModel> PatientTestList = new List<PatientTestResultModel>();//final list // List<PatientTestResultModel> tempListForLoop = new List<PatientTestResultModel>();//templist // } //} public List <PatientTestResultModel> GetPatientTest(int PatientID, DateTime TestDate, int PatientTestID) { using (EHMSEntities ent = new EHMSEntities()) { List <PatientTestResultModel> PatientTestList = new List <PatientTestResultModel>(); var test = TestDate.Date; var data = (from pt in ent.PatientTests join ptd in ent.PatientTestDetails on pt.PatientTestID equals ptd.PatientTestID join spt in ent.SetupPathoTests on ptd.TestID equals spt.TestId join un in ent.SetupUnits on spt.UnitId equals un.UnitId where pt.PatientTestID == PatientTestID && pt.TestRegistrationDate == TestDate && !ent.PatientTestResults.Select(x => x.PatientTestDetailID).Contains(ptd.PatientTestDetailID) select new { pt.PatientID, ptd.TestID, spt.TestName, ptd.SectionID, ptd.PatientTestID, ptd.PatientTestDetailID, spt.RefRange, spt.ParentId, spt.IsParent, spt.ConvFactor, un.UnitName }).ToList(); foreach (var item in data) { var dataF = ent.Database.SqlQuery <PatientTestResultModel>("getPatientTestListParentWise '" + item.ParentId + "', '" + item.TestID + "'").ToList(); //var dataF = (from spt in ent.SetupPathoTest where spt.ParentId==item.TestID // //pt.PatientTestID == PatientTestID && pt.TestRegistrationDate == TestDate && !ent.PatientTestResult.Select(x => x.PatientTestDetailID).Contains(ptd.PatientTestDetailID) // select new {spt.TestId, spt.TestName, spt.SectionId, spt.RefRange, spt.ParentId, spt.IsParent }).ToList(); //if (item.IsParent == true) //{ foreach (var itemF in dataF) { PatientTestResultModel model = new PatientTestResultModel(); model.TestID = itemF.TestID; model.TestName = itemF.TestName; model.SectionID = (int)itemF.SectionID; model.PatientTestID = item.PatientTestID; model.PatientTestDetailID = item.PatientTestDetailID; model.RefRange = itemF.RefRange; PatientTestList.Add(model); } //} //else //{ // PatientTestResultModel model = new PatientTestResultModel(); // model.PatientTestID = item.PatientTestID; // model.TestID = item.TestID; // model.TestName = item.TestName; // model.SectionID = item.SectionID; // model.PatientTestID = item.PatientTestID; // model.PatientTestDetailID = item.PatientTestDetailID; // model.RefRange = item.RefRange; // PatientTestList.Add(model); //} } return(PatientTestList); } }
public ActionResult Create(string ipValue, string did, string tdate, string PatientTestID, string deptId) { using (EHMSEntities ent = new EHMSEntities()) { PatientTestResultModel model = new PatientTestResultModel(); if (did != "" && ipValue != null) { if (did != null || ipValue != "") { int ipValueInt = 0; int PatientDepartmentId = 0; int DropDownDepartmentId = Convert.ToInt32(deptId); if (DropDownDepartmentId != 1001) { if (ipValue != "") { ipValueInt = Convert.ToInt32(ipValue); //get patient department id from opd master PatientDepartmentId = Utility.getPatientDepartmentIdFromOpdMaster(ipValueInt); } model.PopulatePatientTestDetailsModel = pro.GetPatientTestDetailList(ipValueInt, 4).FirstOrDefault(); //model.PatientTestResultModelList = pro.GetPatientTest(Convert.ToInt32(ipValue ?? "0")); //model.PathoSectionModelResultList = pro.GetPathoSections(); model.PathoSectionModelResultList = pro.GetPathoSectionsbyPatientTest(Convert.ToInt32(PatientTestID ?? "0")); model.PopulatePatientTestDetailModelList = pro.GetPopulatePatientTestDetailModelList(ipValueInt, PatientDepartmentId, did); } else//This is for emergency Case { if (ipValue != "") { ipValueInt = Convert.ToInt32(ipValue); PatientDepartmentId = 10; } model.PopulatePatientTestDetailsModel = pro.GetPatientTestDetailListForEmerGency(ipValueInt).FirstOrDefault(); //model.PatientTestResultModelList = pro.GetPatientTest(Convert.ToInt32(ipValue ?? "0")); //model.PathoSectionModelResultList = pro.GetPathoSections(); model.PathoSectionModelResultList = pro.GetPathoSectionsbyPatientTest(Convert.ToInt32(PatientTestID ?? "0")); model.PopulatePatientTestDetailModelList = pro.GetPopulatePatientTestDetailModelList(ipValueInt, PatientDepartmentId, did); } } if (tdate != "" && tdate != null) { int ipValueInt = Convert.ToInt32(ipValue); //get patient department id from opd master int PatientDepartmentId = Utility.getPatientDepartmentIdFromOpdMaster(ipValueInt); model.PathoSectionModelResultList = pro.GetPathoSectionsbyPatientTest(Convert.ToInt32(PatientTestID ?? "0")); model.PopulatePatientTestDetailModelList = pro.GetPopulatePatientTestDetailModelList(ipValueInt, PatientDepartmentId, did); model.PatientTestResultModelList = pro.GetPatientTest(ipValueInt, Convert.ToDateTime(tdate), Convert.ToInt32(PatientTestID ?? "0")); } } return(View(model)); } }
public ActionResult PatientReportResult(string PatientTestID) { int PTestId = 0; if (PatientTestID != "" && PatientTestID != string.Empty) { PTestId = Convert.ToInt32(PatientTestID); } PatientTestResultModel model = new PatientTestResultModel(); model.PopulatePatientTestResultReportModelList = pro.GetPatientTestReportResultList(PTestId); model.TestID = PTestId; return(View("PatientTestResultReport", model)); }
public ActionResult SearchPatient(int srchVal, string value) { PatientTestResultModel model = new PatientTestResultModel(); //OpdModel model = new OpdModel(); OpdProvider pro = new OpdProvider(); if (srchVal == 1) { try { int patientId = Convert.ToInt16(value); string str = ""; model.OpdModelList = pro.SearchOPD(patientId, str); return(PartialView("_OpdPatientRecordsWithPatientId", model)); } catch (Exception e) { TempData["msz"] = "Please Check Patient Id"; return(PartialView("_OpdPatientRecordsWithPatientId", model)); } } if (srchVal == 5) { int age = Convert.ToInt16(value); } if (srchVal == 2) { model.OpdModelList = pro.SearchOPD(0, value); return(PartialView("_OpdPatientRecordsWithPatientId", model)); } if (srchVal == 3) { model.OpdModelList = pro.SearchOPDWithArress(value); return(PartialView("_OpdPatientRecordsWithPatientId", model)); } if (srchVal == 4) { model.OpdModelList = pro.SearchOPDWithPhone(value); return(PartialView("_OpdPatientRecordsWithPatientId", model)); } return(View()); }
public void Insert(PatientTestResultModel model) { using (EHMSEntities ent = new EHMSEntities()) { foreach (var item in model.PatientTestResultModelList) { if (item.Value1 != null && item.Value1 != "") { var objTosavePatientTestResult = AutoMapper.Mapper.Map <PatientTestResultModel, PatientTestResult>(model); objTosavePatientTestResult.PatientTestID = item.PatientTestID; objTosavePatientTestResult.PatientTestDetailID = item.PatientTestDetailID; objTosavePatientTestResult.TestID = item.TestID; objTosavePatientTestResult.Value1 = item.Value1; objTosavePatientTestResult.Value2 = item.Value2; objTosavePatientTestResult.Status = true; ent.PatientTestResults.Add(objTosavePatientTestResult); } } ent.SaveChanges(); } }
public ActionResult PatientReport(string fDate, string tDate, string pid, string deptId) { int patientId = 0; if (pid != "" && pid != string.Empty) { patientId = Convert.ToInt32(pid); } PatientTestResultModel model = new PatientTestResultModel(); if (fDate != null && tDate != null) { int DepartMentId = Convert.ToInt32(deptId); if (DepartMentId == 1001) { model.PopulatePatientTestModelList = pro.GetPatientTestListForEmer(fDate, tDate, patientId).ToList(); } else { model.PopulatePatientTestModelList = pro.GetPatientTestList(fDate, tDate, patientId).ToList(); } } return(View(model)); }