public ActionResult Course(int id) { List <Visit> visitList = new List <Visit>(); List <Test> testList = new List <Test>(); List <Visit> tmpV = new List <Visit>(); List <Test> tmpT = new List <Test>(); visitList.AddRange(VisitTable.GetDataByPatientId(Properties.UserId)); testList.AddRange(TestTable.GetDataByPatientId(Properties.UserId)); dynamic output = new ExpandoObject(); id--; Visit currentVisit = new Visit(); currentVisit = visitList[id]; visitList.RemoveRange(0, id); foreach (Visit v in visitList) { if (currentVisit.DoctorName == v.DoctorName && DateTime.Compare(currentVisit.Date, v.Date) <= 0) { try { foreach (Test t in testList) { if (currentVisit.DoctorName == t.DoctorName && DateTime.Compare(currentVisit.Date, t.Date) <= 0) { tmpT.Add(t); testList.Remove(t); break; } } } catch { } currentVisit = v; tmpV.Add(v); } } output.Visit = tmpV; output.Test = tmpT; return(View(output)); }
public ActionResult PatientView(Patient patient) { var patients = PatientTable.GetPatientById(Properties.UserId); var description = MedicalDescriptionTable.GetDataByPatientId(Properties.UserId); var visit = VisitTable.GetDataByPatientId(Properties.UserId); var prescript = PrescriptionTable.GetData(Properties.UserId); var test = TestTable.GetData(Properties.UserId); var leavesick = SickLeaveTable.GetDataByPatientId(Properties.UserId); var doc = DocumentationTable.GetDataByPatientId(Properties.UserId); // ViewData["PatientName"] = PatientTable.GetPatientById(patient.Id); ViewData["PatientName"] = patients[0]; ViewData["visitData"] = visit; ViewData["prescriptioneData"] = prescript; ViewData["Tests"] = test; ViewData["sickLeaveData"] = leavesick; ViewData["medicalDescription"] = description; ViewData["documentation"] = doc; return(View()); }