Exemplo n.º 1
0
        public IEnumerable <AppointmentNew> Get(string PatientId)
        {
            WallEntities db = new WallEntities();
            IEnumerable <Appointment> app     = _appointments.GetByUserId(PatientId);
            List <AppointmentNew>     appoint = new List <AppointmentNew>();

            foreach (var a in app)
            {
                Guid           userid = new Guid(a.UserId);
                MembershipUser pat    = Membership.GetUser(userid);
                AppointmentNew appnew = new AppointmentNew();
                appnew._id            = a._id;
                appnew.Address        = a.Address;
                appnew.AppointmentsID = a.AppointmentsID;
                appnew.CenterName     = a.CenterName;
                appnew.Reason         = a.Reason;
                appnew.Date           = a.Date;
                appnew.Time           = a.Time;
                appnew.EncounterType  = a.EncounterType;
                appnew.Physician      = a.Physician;
                appnew.Patient        = pat.UserName;
                appnew.UserId         = a.UserId;
                appoint.Add(appnew);
            }

            //return appoint.AsEnumerable();
            IEnumerable <AppointmentNew> appointnew = appoint.AsEnumerable();

            return(appointnew);
        }
Exemplo n.º 2
0
        public ActionResult HealthActs()
        {
            if (Session["UserId"] != null)
            {
                userId = Session["UserId"].ToString();
            }
            IEnumerable <EncounterReport> encs         = encrepo.GetByUserId(userId).OrderByDescending(date => date._id).AsEnumerable();
            List <HealthActivityModel>    healthmodels = new List <HealthActivityModel>();

            foreach (var enctrs in encs)
            {
                HealthActivityModel hmodel = new HealthActivityModel();
                if (enctrs.Action.Contains("Medication"))
                {
                    Medication med = _meds.GetById(enctrs.RefId);
                    hmodel.Medication = med;
                }
                else if (enctrs.Action.Contains("ReasonForHospitalization"))
                {
                    Appointment    app    = _appointments.GetById(enctrs.RefId);
                    Guid           useid  = new Guid(app.UserId);
                    MembershipUser pat    = Membership.GetUser(useid);
                    AppointmentNew appnew = new AppointmentNew();
                    appnew._id            = app._id;
                    appnew.Address        = app.Address;
                    appnew.AppointmentsID = app.AppointmentsID;
                    appnew.CenterName     = app.CenterName;
                    appnew.Reason         = app.Reason;
                    appnew.Date           = app.Date;
                    appnew.Time           = app.Time;
                    appnew.EncounterType  = app.EncounterType;
                    appnew.Physician      = app.Physician;
                    appnew.Patient        = pat.UserName;
                    appnew.UserId         = app.UserId;

                    hmodel.AppointmentNew = appnew;
                }
                else if (enctrs.Action.Contains("LabResult"))
                {
                    LabResult lab = _labresults.GetById(enctrs.RefId);
                    hmodel.LabResult = lab;
                }
                //else if (enctrs.Action.Contains("Medication"))
                //{

                //}

                if (hmodel != null)
                {
                    healthmodels.Add(hmodel);
                }
            }
            return(Json(healthmodels));
        }