Example #1
0
        public static void Update_MutualPorPaciente(MutualPorPacienteList MutualPorPacienteList, int pPatientId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                MutualPorPaciente wMutual = null;

                foreach (MutualPorPacienteBE wMutualBE in MutualPorPacienteList)
                {
                    if (wMutualBE.EntityState == Fwk.Bases.EntityState.Added)
                    {
                        wMutual                   = new MutualPorPaciente();
                        wMutual.IdPaciente        = pPatientId;
                        wMutual.IdMutual          = wMutualBE.IdMutual;
                        wMutual.NroAfiliadoMutual = wMutualBE.NroAfiliadoMutual;
                        wMutual.IsActive          = true;
                        dc.MutualPorPacientes.AddObject(wMutual);
                    }

                    if (wMutualBE.EntityState == Fwk.Bases.EntityState.Changed)
                    {
                        wMutual = dc.MutualPorPacientes.Where(p => p.IdMutual.Equals(wMutualBE.IdMutual)).FirstOrDefault();
                        wMutual.NroAfiliadoMutual = wMutualBE.NroAfiliadoMutual;
                        wMutual.IsActive          = wMutualBE.IsActive;
                    }
                }
                dc.SaveChanges();
            }
        }
Example #2
0
        public static void Create(Health.BE.PersonaBE personaBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Health.Back.BE.Persona persona = new Health.Back.BE.Persona();
                persona.UserId = personaBE.UserId;
                persona.Apellido = personaBE.Apellido;
                persona.Nombre = personaBE.Nombre;
                persona.NroDocumento = personaBE.NroDocumento;
                persona.TipoDocumento = personaBE.TipoDocumento;
                persona.IdEstadocivil = personaBE.IdEstadocivil;
                persona.FechaNacimiento = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(personaBE.FechaNacimiento);
                persona.FechaAlta = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(System.DateTime.Now);
                persona.LastAccessTime = persona.FechaAlta;
                persona.LastAccessUserId = personaBE.LastAccessUserId;

                persona.Street = personaBE.Street;
                persona.StreetNumber = personaBE.StreetNumber;
                persona.Floor = personaBE.Floor;
                persona.CountryId = personaBE.CountryId;
                persona.ProvinceId = personaBE.ProvinceId;
                persona.CityId = personaBE.CityId;
                persona.Neighborhood = personaBE.Neighborhood;
                persona.mail = personaBE.mail;
                persona.Telefono1 = personaBE.Telefono1;
                persona.Telefono2 = personaBE.Telefono2;
                persona.ZipCode = persona.ZipCode;
                persona.Foto = personaBE.Foto;

                dc.Personas.AddObject(persona);
                dc.SaveChanges();
                personaBE.FechaAlta = persona.FechaAlta;
                personaBE.IdPersona = persona.IdPersona;
            }
        }
Example #3
0
        public static void Update(ResourceSchedulingList resourceSchedulingList, Guid userId)
        {
            ResourceScheduling r_db       = null;
            DateTime           updateDate = System.DateTime.Now;

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                foreach (ResourceSchedulingBE rbe in resourceSchedulingList)
                {
                    r_db = dc.ResourceSchedulings.Where(p => p.IdSheduler.Equals(rbe.IdSheduler)).FirstOrDefault <ResourceScheduling>();

                    r_db.UpdatedDate  = updateDate;
                    r_db.UpdateUserId = userId;

                    r_db.DateEnd     = rbe.DateEnd;
                    r_db.DateStart   = rbe.DateStart;
                    r_db.Description = rbe.Description;
                    r_db.Duration    = rbe.Duration;
                    r_db.TimeEnd     = rbe.TimeEnd;
                    r_db.TimeStart   = rbe.TimeStart;

                    r_db.WeekDays = rbe.WeekDays;
                }
                dc.SaveChanges();
            }
        }
Example #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pResourceSchedulingList"></param>
        /// <param name="userId"></param>
        public static void Create(ResourceSchedulingList pResourceSchedulingList,Guid userId)
        {
            ResourceScheduling r = null;
            DateTime creationDate = System.DateTime.Now;
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                foreach (ResourceSchedulingBE rbe in pResourceSchedulingList)
                {
                    r = new ResourceScheduling();

                    r.CreationDate = creationDate;
                    r.CreationUserId = userId;
                    r.DateEnd = rbe.DateEnd;
                    r.DateStart = rbe.DateStart;
                    r.Description = rbe.Description;
                    r.Duration = rbe.Duration;
                    r.TimeEnd = rbe.TimeEnd;
                    r.TimeStart = rbe.TimeStart;
                    r.ResourceId = rbe.ResourceId;
                    r.WeekDays = rbe.WeekDays;
                    r.HealthInstitutionId = rbe.HealthInstitutionId;
                    dc.ResourceSchedulings.AddObject(r);
                }
                dc.SaveChanges();

            }
        }
Example #5
0
        /// <summary>
        /// Por el momento representa Turnos otorgados a un profesional
        /// </summary>
        /// <param name="startDate">Fecha desde</param>
        /// <param name="status">Estado que del appointment se desea cunsultar</param>
        /// <param name="resourceId">Id a quien pertenezca el appointment</param>
        /// <returns>AppointmentList, Appointment con ProfesionalAppointment</returns>
        public static AppointmentList Retrive_ProfessionalAppointment(DateTime?startDate, int?status, int?resourseId = null, Guid?healthInstitutionId = null)
        {
            AppointmentList list = new AppointmentList();

            if (startDate.HasValue)
            {
                startDate = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(startDate.Value);
            }

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                var appointment_db = dc.Appointments.Where <Appointment>(p =>
                                                                         (!startDate.HasValue || p.Start.Value >= startDate.Value) &&
                                                                         (!status.HasValue || status.Value.Equals(p.Status.Value)) &&
                                                                         (!resourseId.HasValue || p.ResourceId.Value.Equals(resourseId.Value)) &&
                                                                         (!healthInstitutionId.HasValue || p.HealthInstitutionId.Value.Equals(healthInstitutionId.Value))
                                                                         );//.OrderByDescending(sort=>sort.CreationDate);

                foreach (Appointment r in appointment_db)
                {
                    AppointmentBE wAppoiment = (AppointmentBE)r;
                    wAppoiment.ProfesionalAppointment = (ProfesionalAppointmentBE)r.ProfesionalAppointment;
                    list.Add(wAppoiment);
                }
            }
            return(list);
        }
Example #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pResourceSchedulingList"></param>
        /// <param name="userId"></param>
        public static void Create(ResourceSchedulingList pResourceSchedulingList, Guid userId)
        {
            ResourceScheduling r            = null;
            DateTime           creationDate = System.DateTime.Now;

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                foreach (ResourceSchedulingBE rbe in pResourceSchedulingList)
                {
                    r = new ResourceScheduling();

                    r.CreationDate        = creationDate;
                    r.CreationUserId      = userId;
                    r.DateEnd             = rbe.DateEnd;
                    r.DateStart           = rbe.DateStart;
                    r.Description         = rbe.Description;
                    r.Duration            = rbe.Duration;
                    r.TimeEnd             = rbe.TimeEnd;
                    r.TimeStart           = rbe.TimeStart;
                    r.ResourceId          = rbe.ResourceId;
                    r.WeekDays            = rbe.WeekDays;
                    r.HealthInstitutionId = rbe.HealthInstitutionId;
                    dc.ResourceSchedulings.AddObject(r);
                }
                dc.SaveChanges();
            }
        }
Example #7
0
        public static void Create(Health.BE.PersonaBE personaBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Health.Back.BE.Persona persona = new Health.Back.BE.Persona();
                persona.UserId = personaBE.UserId;
                persona.Apellido = personaBE.Apellido;
                persona.Nombre = personaBE.Nombre;
                persona.NroDocumento = personaBE.NroDocumento;
                persona.TipoDocumento = personaBE.TipoDocumento;
                persona.IdEstadocivil = personaBE.IdEstadocivil;
                persona.FechaNacimiento = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(personaBE.FechaNacimiento);
                persona.FechaAlta = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(System.DateTime.Now);
                persona.LastAccessTime = persona.FechaAlta;
                persona.LastAccessUserId = personaBE.LastAccessUserId;

                persona.Calle = personaBE.Calle;
                persona.CalleNumero = personaBE.CalleNumero;
                persona.Piso = personaBE.Piso;
                persona.IdPais = personaBE.IdPais;
                persona.IdProvincia = personaBE.IdProvincia;
                persona.IdLocalidad = personaBE.IdLocalidad;
                persona.Barrio = personaBE.Barrio;
                persona.mail = personaBE.mail;
                persona.Telefono1 = personaBE.Telefono1;
                persona.Telefono2 = personaBE.Telefono2;
                persona.Foto = personaBE.Foto;

                dc.Personas.AddObject(persona);
                dc.SaveChanges();
                personaBE.FechaAlta = persona.FechaAlta;
                personaBE.IdPersona = persona.IdPersona;
            }
        }
Example #8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="nombre"></param>
        /// <param name="apellido"></param>
        /// <returns></returns>
        public static List<PersonaBE> SearchByParams(string nombre, string apellido)
        {
            List<PersonaBE> wPersonasBEList = new List<PersonaBE>();
            List<Persona> wPersonas = null;

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                if (String.IsNullOrEmpty(nombre) || String.IsNullOrEmpty(apellido))
                    wPersonas = dc.Personas.ToList<Persona>();
                else
                {
                    var Personas = from p in dc.Personas
                                       where
                                           (String.IsNullOrEmpty(nombre) || p.Nombre.Contains(nombre)
                                           || (String.IsNullOrEmpty(apellido) || p.Apellido.Contains(apellido)))
                                       select p;

                    wPersonas = Personas.ToList<Persona>();
                }
               
            

                foreach (Persona p in wPersonas)
                {
                   
                    wPersonasBEList.Add( (PersonaBE)p);
                }


            }
            return wPersonasBEList;
        }
Example #9
0
 static List <CEI10_Temp> Retrive_Temporal_All()
 {
     using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
     {
         return(dc.CEI10_Temp.ToList <CEI10_Temp>());
     }
 }
Example #10
0
        static void Insert(CEI_10List list)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                CEI_10 wCEI_10;
                try
                {
                    foreach (CEI_10BE c in list)
                    {
                        //falla i10
                        wCEI_10             = new CEI_10();
                        wCEI_10.ParentCode  = c.ParentCode.Trim();
                        wCEI_10.Code        = c.Code.Trim();
                        wCEI_10.Description = c.Description;
                        wCEI_10.HasChilds   = c.HasChilds;

                        dc.CEI_10.AddObject(wCEI_10);
                        dc.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
 /// <summary>
 /// Determina si es padre
 /// </summary>
 /// <param name="healthInstitutionId"></param>
 /// <returns></returns>
 public static bool IsParent(Guid healthInstitutionId)
 {
     using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
     {
         return(dc.HealthInstitutions.Any(s => s.HealthInstitutionId.Equals(healthInstitutionId) && !s.HealthInstitutionIdParent.HasValue));
     }
 }
        /// <summary>
        /// Asigna y/o crea un rol
        /// </summary>
        /// <param name="pHealthInstitutionId"></param>
        /// <param name="pProfesionalId_ToAssign"></param>
        /// <param name="pUserId"></param>
        /// <param name="roleName"></param>
        public static void Profesional_UsersInRoles_Assign(Guid pHealthInstitutionId, Int32 pProfesionalId_ToAssign, Guid pUserId, string roleName)
        {
            Back.BE.HealthInstitution_Profesional wHealthInstitution_Profesional = new Back.BE.HealthInstitution_Profesional();
            Back.BE.HealtInstitute_UsersInRoles   wHealtInstitute_UsersInRoles   = new BE.HealtInstitute_UsersInRoles();
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                //Si no existe la relacion del profesional con la inst.. se genera
                if (!dc.HealthInstitution_Profesional.Any(p =>
                                                          p.HealthInstitutionId.Equals(pHealthInstitutionId) &&
                                                          p.Profesional.IdProfesional.Equals(pProfesionalId_ToAssign)))
                {
                    wHealthInstitution_Profesional.HealthInstitutionId = pHealthInstitutionId;
                    wHealthInstitution_Profesional.ProfesionalId       = pProfesionalId_ToAssign;
                    wHealthInstitution_Profesional.UserId      = pUserId;
                    wHealthInstitution_Profesional.IsLockedOut = false;
                    wHealthInstitution_Profesional.ActiveFlag  = true;

                    if (roleName.Equals("inst_owner") || roleName.Equals("inst_admin"))
                    {
                        wHealthInstitution_Profesional.IsAdmin = roleName.Equals("inst_admin");
                        wHealthInstitution_Profesional.IsOwner = roleName.Equals("inst_owner");
                    }
                    dc.HealthInstitution_Profesional.AddObject(wHealthInstitution_Profesional);
                }


                wHealtInstitute_UsersInRoles.UserId = pUserId;
                wHealtInstitute_UsersInRoles.HealthInstitutionId = pHealthInstitutionId;
                wHealtInstitute_UsersInRoles.RoleName            = roleName;

                dc.HealtInstitute_UsersInRoles.AddObject(wHealtInstitute_UsersInRoles);

                dc.SaveChanges();
            }
        }
Example #13
0
        public static void UpdateMedicalEvent(MedicalEventBE medicalEvent, Guid createdUserId)
        {

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                MedicalEvent medicalEvent_db = dc.MedicalEvents.Where(p => p.MedicalEventId.Equals(medicalEvent.MedicalEventId)).FirstOrDefault<MedicalEvent>();


                medicalEvent_db.MedicalEventId_Parent = medicalEvent.MedicalEventId_Parent;
                medicalEvent_db.ProfesionalId = medicalEvent.ProfesionalId;

                medicalEvent_db.PatientId = medicalEvent.PatientId;

                medicalEvent_db.IdEspesialidad = medicalEvent.IdEspesialidad;
                medicalEvent_db.IdTipoConsulta = medicalEvent.IdTipoConsulta;

                medicalEvent_db.Motivo = medicalEvent.Motivo;
      
                medicalEvent_db.Evolucion = medicalEvent.Evolucion;

   
                medicalEvent_db.MetodoComplementario = medicalEvent.MetodoComplementario;
                medicalEvent_db.AppointmentId = medicalEvent.AppointmentId;
                medicalEvent_db.HealthInstitutionId = medicalEvent.HealthInstitutionId;
                //medicalEvent_db.CreatedDate = System.DateTime.Now;
                //medicalEvent_db.CreatedUserId = createdUserId;
                dc.SaveChanges();

            }
        }
Example #14
0
        public static void Update(ResourceSchedulingList resourceSchedulingList, Guid userId)
        {
            ResourceScheduling r_db = null;
            DateTime updateDate = System.DateTime.Now;
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                foreach (ResourceSchedulingBE rbe in resourceSchedulingList)
                {

                    r_db = dc.ResourceSchedulings.Where(p => p.IdSheduler.Equals(rbe.IdSheduler)).FirstOrDefault<ResourceScheduling>();

                    r_db.UpdatedDate = updateDate;
                    r_db.UpdateUserId = userId;

                    r_db.DateEnd = rbe.DateEnd;
                    r_db.DateStart = rbe.DateStart;
                    r_db.Description = rbe.Description;
                    r_db.Duration = rbe.Duration;
                    r_db.TimeEnd = rbe.TimeEnd;
                    r_db.TimeStart = rbe.TimeStart;
                    
                    r_db.WeekDays = rbe.WeekDays;
                    
                }
                dc.SaveChanges();

            }
        }
Example #15
0
        public static void UpdateMedicalEvent(MedicalEventBE medicalEvent, Guid createdUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                MedicalEvent medicalEvent_db = dc.MedicalEvents.Where(p => p.MedicalEventId.Equals(medicalEvent.MedicalEventId)).FirstOrDefault <MedicalEvent>();


                medicalEvent_db.MedicalEventId_Parent = medicalEvent.MedicalEventId_Parent;
                medicalEvent_db.ProfesionalId         = medicalEvent.ProfesionalId;

                medicalEvent_db.PatientId = medicalEvent.PatientId;

                medicalEvent_db.IdEspesialidad = medicalEvent.IdEspesialidad;
                medicalEvent_db.IdTipoConsulta = medicalEvent.IdTipoConsulta;

                medicalEvent_db.Motivo = medicalEvent.Motivo;

                medicalEvent_db.Evolucion = medicalEvent.Evolucion;


                medicalEvent_db.MetodoComplementario = medicalEvent.MetodoComplementario;
                medicalEvent_db.AppointmentId        = medicalEvent.AppointmentId;
                medicalEvent_db.HealthInstitutionId  = medicalEvent.HealthInstitutionId;
                //medicalEvent_db.CreatedDate = System.DateTime.Now;
                //medicalEvent_db.CreatedUserId = createdUserId;
                dc.SaveChanges();
            }
        }
Example #16
0
        public static List<PatientBE> SearchByParams(string nombre, string apellido)
        {
            List<PatientBE> wPatientsBEList = new List<PatientBE>();
            List<Patient> wPatients = null;

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                if (String.IsNullOrEmpty(nombre) || String.IsNullOrEmpty(apellido))
                    wPatients = dc.Patients.ToList<Patient>();
                else
                {
                    var Patients = from p in dc.Patients
                                    where
                                        (String.IsNullOrEmpty(nombre) || p.Persona.Nombre.Contains(nombre)
                                        || (String.IsNullOrEmpty(apellido) || p.Persona.Apellido.Contains(apellido)))
                                    select p;

                    wPatients = Patients.ToList<Patient>();
                }

                PatientBE wPatientBE = null;

                foreach (Patient p in wPatients)
                {
                    wPatientBE = (PatientBE)p;
                    wPatientBE.IdPersona = p.Persona.IdPersona;
                    wPatientBE.Persona = (PersonaBE)p.Persona;
                    wPatientsBEList.Add(wPatientBE);
                }


            }
            return wPatientsBEList;
        }
Example #17
0
        public static void UpdatePatientAllergy(PatientAllergyBE patientAllergyBE, Guid lastAccessUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientAllergy patientAllergy_db = dc.PatientAllergies.Where(p => p.PatientId.Equals(patientAllergyBE.PatientId)).FirstOrDefault <PatientAllergy>();

                patientAllergy_db.AnimalAllergy      = patientAllergyBE.AnimalAllergy;
                patientAllergy_db.ChemicalAllergy    = patientAllergyBE.ChemicalAllergy;
                patientAllergy_db.FoodAllergy        = patientAllergyBE.FoodAllergy;
                patientAllergy_db.InsectAllergy      = patientAllergyBE.InsectAllergy;
                patientAllergy_db.MedicamentsAllergy = patientAllergyBE.MedicamentsAllergy;
                patientAllergy_db.MiteAllergy        = patientAllergyBE.MiteAllergy;
                patientAllergy_db.PollenAllergy      = patientAllergyBE.PollenAllergy;
                patientAllergy_db.SunAllergy         = patientAllergyBE.SunAllergy;

                patientAllergy_db.Observation  = patientAllergyBE.Observation;
                patientAllergy_db.OtherAllergy = patientAllergyBE.OtherAllergy;

                patientAllergy_db.GeneralDetails   = patientAllergyBE.GeneralDetails;
                patientAllergy_db.Enabled          = patientAllergyBE.Enabled;
                patientAllergy_db.LastAccessTime   = System.DateTime.Now;
                patientAllergy_db.LastAccessUserId = lastAccessUserId;
                dc.SaveChanges();
            }
        }
Example #18
0
        public static void CreatePatientAllergy(PatientAllergyBE patientAllergyBE, Guid lastAccessUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientAllergy patientAllergy_db = new PatientAllergy();
                patientAllergy_db.PatientId = patientAllergyBE.PatientId;

                patientAllergy_db.AnimalAllergy      = patientAllergyBE.AnimalAllergy;
                patientAllergy_db.ChemicalAllergy    = patientAllergyBE.ChemicalAllergy;
                patientAllergy_db.FoodAllergy        = patientAllergyBE.FoodAllergy;
                patientAllergy_db.InsectAllergy      = patientAllergyBE.InsectAllergy;
                patientAllergy_db.MedicamentsAllergy = patientAllergyBE.MedicamentsAllergy;
                patientAllergy_db.MiteAllergy        = patientAllergyBE.MiteAllergy;
                patientAllergy_db.PollenAllergy      = patientAllergyBE.PollenAllergy;
                patientAllergy_db.SunAllergy         = patientAllergyBE.SunAllergy;

                patientAllergy_db.Observation  = patientAllergyBE.Observation;
                patientAllergy_db.OtherAllergy = patientAllergyBE.OtherAllergy;


                patientAllergy_db.GeneralDetails   = patientAllergyBE.GeneralDetails;
                patientAllergy_db.MedicalEventId   = patientAllergyBE.MedicalEventId;
                patientAllergy_db.Enabled          = true;
                patientAllergy_db.LastAccessTime   = System.DateTime.Now;
                patientAllergy_db.LastAccessUserId = lastAccessUserId;

                dc.PatientAllergies.AddObject(patientAllergy_db);
                dc.SaveChanges();
            }
        }
Example #19
0
        public static List <PatientBE> SearchByParams(string nombre, string apellido)
        {
            List <PatientBE> wPatientsBEList = new List <PatientBE>();
            List <Patient>   wPatients       = null;

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                if (String.IsNullOrEmpty(nombre) || String.IsNullOrEmpty(apellido))
                {
                    wPatients = dc.Patients.ToList <Patient>();
                }
                else
                {
                    var Patients = from p in dc.Patients
                                   where
                                   (String.IsNullOrEmpty(nombre) || p.Persona.Nombre.Contains(nombre) ||
                                    (String.IsNullOrEmpty(apellido) || p.Persona.Apellido.Contains(apellido)))
                                   select p;

                    wPatients = Patients.ToList <Patient>();
                }

                PatientBE wPatientBE = null;

                foreach (Patient p in wPatients)
                {
                    wPatientBE           = (PatientBE)p;
                    wPatientBE.IdPersona = p.Persona.IdPersona;
                    wPatientBE.Persona   = (PersonaBE)p.Persona;
                    wPatientsBEList.Add(wPatientBE);
                }
            }
            return(wPatientsBEList);
        }
Example #20
0
        public static void AddPatientMedicaments(PatientMedicament_ViewBE patientMedicament_View, Guid createdUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientMedicament patientMedicament_db = new PatientMedicament();

                patientMedicament_db.Status = patientMedicament_View.Status;

                patientMedicament_db.MedicalEventId = patientMedicament_View.MedicalEventId;
                patientMedicament_db.PatientId      = patientMedicament_View.PatientId;
                if (patientMedicament_View.PatientMedicamentId_Parent >= 0)
                {
                    patientMedicament_db.PatientMedicamentId_Parent = patientMedicament_View.PatientMedicamentId_Parent;
                }

                patientMedicament_db.MedicamentName         = patientMedicament_View.MedicamentName;
                patientMedicament_db.MedicamentPresentation = patientMedicament_View.MedicamentPresentation;
                patientMedicament_db.Dosis             = patientMedicament_View.Dosis;
                patientMedicament_db.Periodicity_hours = patientMedicament_View.Periodicity_hours;
                patientMedicament_db.CreatedDate       = System.DateTime.Now;
                patientMedicament_db.CreatedUserId     = createdUserId;
                patientMedicament_db.DaysCount         = patientMedicament_View.DaysCount;
                patientMedicament_db.Enabled           = true;
                dc.PatientMedicaments.AddObject(patientMedicament_db);
                dc.SaveChanges();
            }
        }
Example #21
0
        public static int CreateMedicalEvent(MedicalEventBE medicalEvent, Guid createdUserId)
        {

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                MedicalEvent medicalEvent_db = new MedicalEvent();


                medicalEvent_db.MedicalEventId_Parent = medicalEvent.MedicalEventId_Parent;
                medicalEvent_db.ProfesionalId = medicalEvent.ProfesionalId;

                medicalEvent_db.PatientId = medicalEvent.PatientId;

                medicalEvent_db.IdEspesialidad = medicalEvent.IdEspesialidad;
                medicalEvent_db.IdTipoConsulta = medicalEvent.IdTipoConsulta;

                medicalEvent_db.Motivo = medicalEvent.Motivo;
   
                medicalEvent_db.MetodoComplementario = medicalEvent.MetodoComplementario;
                medicalEvent_db.Evolucion = medicalEvent.Evolucion;
                medicalEvent_db.AppointmentId = medicalEvent.AppointmentId;

                medicalEvent_db.CreatedDate = System.DateTime.Now;
                medicalEvent_db.CreatedUserId = createdUserId;
                medicalEvent_db.HealthInstitutionId = medicalEvent.HealthInstitutionId;

                dc.MedicalEvents.AddObject(medicalEvent_db);
                dc.SaveChanges();
                return medicalEvent_db.MedicalEventId;
            }
        }
Example #22
0
        public static void Update_MutualPorPaciente(MutualPorPacienteList MutualPorPacienteList, int pPatientId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                MutualPorPaciente wMutual = null;

                foreach (MutualPorPacienteBE wMutualBE in MutualPorPacienteList)
                {
                    if (wMutualBE.EntityState == Fwk.Bases.EntityState.Added)
                    {
                        wMutual = new MutualPorPaciente();
                        wMutual.IdPaciente = pPatientId;
                        wMutual.IdMutual = wMutualBE.IdMutual;
                        wMutual.NroAfiliadoMutual = wMutualBE.NroAfiliadoMutual;
                        wMutual.IsActive = true;
                        dc.MutualPorPacientes.AddObject(wMutual);
                    }

                    if (wMutualBE.EntityState == Fwk.Bases.EntityState.Changed)
                    {
                        wMutual = dc.MutualPorPacientes.Where(p => p.IdMutual.Equals(wMutualBE.IdMutual)).FirstOrDefault();
                        wMutual.NroAfiliadoMutual = wMutualBE.NroAfiliadoMutual;
                        wMutual.IsActive = wMutualBE.IsActive;
                    }
                }
                dc.SaveChanges();
            }
        }
Example #23
0
 public static bool Existe(string pNombre)
 {
     using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
     {
         return(dc.Mutuals.Any <Mutual>(p => p.Nombre.Equals(pNombre)));
     }
 }
Example #24
0
        /// <summary>
        /// Retorna profecionales directamente relacionados in la inst
        /// Retorna  Profesional_FullViewBE
        /// </summary>
        /// <param name="healthInstId"></param>
        /// <returns></returns>
        public static List<Profesional_FullViewBE> SearchBy_HealthInstRelated(Guid healthInstId, List<Int32> prof_ids_JustRetrived = null)
        {
            Profesional_FullViewList wProfesionalsBEList = new Profesional_FullViewList();
            Profesional_FullViewBE wProfesionalBE=null;
            if (prof_ids_JustRetrived == null) prof_ids_JustRetrived = new List<int>();
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                //Profecionales de la institucion
        

                var wProfesionals_DB = from p in dc.Profesional_FullView
                                       from hp in dc.HealthInstitution_Profesional
                                       where
                                            hp.HealthInstitutionId.Equals(healthInstId)
                                           && hp.ProfesionalId.Equals(p.IdProfesional)
                                           && (prof_ids_JustRetrived.Count().Equals(0) || !prof_ids_JustRetrived.Contains(p.IdProfesional)) //Exeptua los just retriveds
                                       select p;

                foreach (var item in wProfesionals_DB)
                {
                    wProfesionalBE = (Profesional_FullViewBE)item;
                    //wProfesionalBE.HealthInstitution_Profesional = (HealthInstitution_ProfesionalBE)item.Prof_hp;
                    wProfesionalsBEList.Add(wProfesionalBE);
                }
            }
            return wProfesionalsBEList;
        }
Example #25
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="nombre"></param>
        /// <param name="apellido"></param>
        /// <returns></returns>
        public static List<Profesional_FullViewBE> SearchByParams(string nombre, string apellido)
        {
            Profesional_FullViewList wProfesionalsBEList = new Profesional_FullViewList();
            List<Profesional_FullView> wProfesionals = null;

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                if (String.IsNullOrEmpty(nombre) || String.IsNullOrEmpty(apellido))
                    wProfesionals = dc.Profesional_FullView.ToList<Profesional_FullView>();
                else
                {
                    var Profesionals = from p in dc.Profesional_FullView
                                       where
                                           (String.IsNullOrEmpty(nombre) || p.Nombre.Contains(nombre)
                                           || (String.IsNullOrEmpty(apellido) || p.Apellido.Contains(apellido)))
                                       select p;

                    wProfesionals = Profesionals.ToList<Profesional_FullView>();
                }

                Profesional_FullViewBE wProfesionalBE = null;

                foreach (Profesional_FullView p in wProfesionals)
                {
                    wProfesionalBE = (Profesional_FullViewBE)p;
                    wProfesionalsBEList.Add(wProfesionalBE);
                }


            }
            return wProfesionalsBEList;
        }
Example #26
0
        /// <summary>
        /// Retorna MedicalEventDetail_ViewList del propieo evento y de eventos anteriores que sean relevante y esten con relevancia activa
        /// </summary>
        /// <param name="patientId"></param>
        /// <param name="medicalEventId"></param>
        /// <returns></returns>
        public static MedicalEventDetail_ViewList Retrive_MedicalEventDetail_ViewList_Patinet(int patientId)
        {
            MedicalEventDetail_ViewList list = new MedicalEventDetail_ViewList();

            try
            {
                using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
                {
                    var details_from_others_Events = dc.MedicalEventDetail_View.Where(p =>
                                                                                      p.PatientId.Equals(patientId) &&

                                                                                      p.RelevanceType.HasValue &&
                                                                                      p.ActiveRelevance.Value.Equals(true));



                    foreach (MedicalEventDetail_View item_db in details_from_others_Events)
                    {
                        list.Add((MedicalEventDetail_ViewBE)item_db);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(list);
        }
Example #27
0
        public static int CreateMedicalEvent(MedicalEventBE medicalEvent, Guid createdUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                MedicalEvent medicalEvent_db = new MedicalEvent();


                medicalEvent_db.MedicalEventId_Parent = medicalEvent.MedicalEventId_Parent;
                medicalEvent_db.ProfesionalId         = medicalEvent.ProfesionalId;

                medicalEvent_db.PatientId = medicalEvent.PatientId;

                medicalEvent_db.IdEspesialidad = medicalEvent.IdEspesialidad;
                medicalEvent_db.IdTipoConsulta = medicalEvent.IdTipoConsulta;

                medicalEvent_db.Motivo = medicalEvent.Motivo;

                medicalEvent_db.MetodoComplementario = medicalEvent.MetodoComplementario;
                medicalEvent_db.Evolucion            = medicalEvent.Evolucion;
                medicalEvent_db.AppointmentId        = medicalEvent.AppointmentId;

                medicalEvent_db.CreatedDate         = System.DateTime.Now;
                medicalEvent_db.CreatedUserId       = createdUserId;
                medicalEvent_db.HealthInstitutionId = medicalEvent.HealthInstitutionId;

                dc.MedicalEvents.AddObject(medicalEvent_db);
                dc.SaveChanges();
                return(medicalEvent_db.MedicalEventId);
            }
        }
Example #28
0
        static void Insert(CEI_10List list)
        {

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                CEI_10 wCEI_10;
                try
                {
                    foreach (CEI_10BE c in list)
                    {
                        //falla i10
                        wCEI_10 = new CEI_10();
                        wCEI_10.ParentCode = c.ParentCode.Trim();
                        wCEI_10.Code = c.Code.Trim();
                        wCEI_10.Description = c.Description;
                        wCEI_10.HasChilds = c.HasChilds;

                        dc.CEI_10.AddObject(wCEI_10);
                        dc.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

            }
        }
Example #29
0
        /// <summary>
        /// retorna medicamentos de unevento determinado y
        /// </summary>
        /// <param name="patientId"></param>
        /// <param name="medicalEventId"></param>
        /// <returns></returns>
        public static PatientMedicament_ViewList RetrivePatientMedicaments(int patientId, int medicalEventId, bool includePermanets)
        {
            PatientMedicament_ViewList list = new PatientMedicament_ViewList();

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                var list_db = dc.PatientMedicament_View.Where(
                    p => p.PatientId.Equals(patientId) &&
                    p.MedicalEventId.Equals(medicalEventId)
                    );

                if (includePermanets)
                {
                    var list_Permanent_db = dc.PatientMedicament_View.Where(
                        p => p.PatientId.Equals(patientId) &&
                        !p.MedicalEventId.Equals(medicalEventId) &&
                        (p.Status.Equals((int)MedicamentStatus.Permanente) && p.Enabled
                        ));

                    foreach (PatientMedicament_View patientMedicament_db in list_Permanent_db)
                    {
                        list.Add((PatientMedicament_ViewBE)patientMedicament_db);
                    }
                }
                foreach (PatientMedicament_View patientMedicament_db in list_db)
                {
                    list.Add((PatientMedicament_ViewBE)patientMedicament_db);
                }
            }
            return(list);
        }
Example #30
0
        public static void Update(PatientBE Patient)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Patient wPatient = dc.Patients.Where(p => p.PatientId.Equals(Patient.PatientId)).FirstOrDefault <Patient>();

                wPatient.Persona.Apellido        = Patient.Persona.Apellido;
                wPatient.Persona.Nombre          = Patient.Persona.Nombre;
                wPatient.Persona.NroDocumento    = Patient.Persona.NroDocumento;
                wPatient.Persona.TipoDocumento   = Patient.Persona.TipoDocumento;
                wPatient.Persona.IdEstadocivil   = Patient.Persona.IdEstadocivil;
                wPatient.Persona.FechaNacimiento = Patient.Persona.FechaNacimiento;
                wPatient.Persona.Sexo            = Patient.Persona.Sexo;

                wPatient.Persona.Street       = Patient.Persona.Street;
                wPatient.Persona.StreetNumber = Patient.Persona.StreetNumber;
                wPatient.Persona.Floor        = Patient.Persona.Floor;
                wPatient.Persona.CountryId    = Patient.Persona.CountryId;
                wPatient.Persona.ProvinceId   = Patient.Persona.ProvinceId;
                wPatient.Persona.CityId       = Patient.Persona.CityId;
                wPatient.Persona.Neighborhood = Patient.Persona.Neighborhood;
                wPatient.Persona.mail         = Patient.Persona.mail;
                wPatient.Persona.Telefono1    = Patient.Persona.Telefono1;
                wPatient.Persona.Telefono2    = Patient.Persona.Telefono2;
                wPatient.Persona.Foto         = Patient.Persona.Foto;

                wPatient.LastAccessTime           = System.DateTime.Now;
                wPatient.LastAccessUserId         = Patient.LastAccessUserId;
                wPatient.Persona.LastAccessTime   = wPatient.LastAccessTime.Value;
                wPatient.Persona.LastAccessUserId = Patient.Persona.LastAccessUserId;
                dc.SaveChanges();
            }
        }
Example #31
0
        public static bool Exist(String nroDocumento)
        {
            
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                return dc.Personas.Any<Persona>(p => p.NroDocumento.Equals(nroDocumento));
                
            }
        }
Example #32
0
        private void gridView1_MouseDown(object sender, MouseEventArgs e)
        {
          //  if (e.Button != MouseButtons.Right) return;
            _HitInfo = gridView1.CalcHitInfo(new Point(e.X, e.Y));


            SelectedPersona = ((PersonaBE)gridView1.GetRow(_HitInfo.RowHandle));

            HealthEntities dc = new HealthEntities    ();
            dc.Personas.
         
        }
Example #33
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="activationKey"></param>
        /// <returns></returns>
        public static HealthInstitutionBE ValidateCode(String activationKey)
        {
            HealthInstitutionBE wHealthInstitutionBE = null;
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                var wHealthInstitution = dc.HealthInstitutions.Where(p => p.ActivationKey.Equals(activationKey)).FirstOrDefault<Health.Back.BE.HealthInstitution>();

                if (wHealthInstitution != null)
                    wHealthInstitutionBE = new HealthInstitutionBE(wHealthInstitution);
             
                return wHealthInstitutionBE;
            }
        }
Example #34
0
        public static PatientBE GetByDoc(int nroDocumento)
        {
            PatientBE wPatient = null;
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Patient Patient = dc.Patients.Where(p => p.Persona.NroDocumento.Equals(nroDocumento)).FirstOrDefault<Patient>();

                wPatient = (PatientBE)Patient;
                wPatient.Persona = (PersonaBE)Patient.Persona;

            }
            return wPatient;
        }
Example #35
0
        public static void Create(MutualBE pMutualBE)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Mutual wMutual = new Mutual();
                wMutual.Nombre = pMutualBE.Nombre;
                wMutual.ExigeCoseguro = pMutualBE.ExigeCoseguro;

                dc.Mutuals.AddObject(wMutual);
                dc.SaveChanges();
                wMutual.IdMutual = wMutual.IdMutual;
            }
        }
Example #36
0
        public static CEI_10List Retrive_All()
        {
            CEI_10List list = new CEI_10List();
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                foreach (CEI_10BE c in dc.CEI_10)
                {
                   list.Add((CEI_10BE)c);

                }
            }
            return list;
        }
Example #37
0
 public static MutualList RetriveAll()
 {
     MutualList list = new MutualList();
     MutualBE wMutualBE               ;
     using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
     {
         foreach (Mutual m_db in dc.Mutuals)
         {
             wMutualBE = (MutualBE)m_db;
             list.Add( wMutualBE);
         }
     }
     return list;
 }
Example #38
0
 public static CEI_10List Retrive_All_ChildsOnly()
 {
     CEI_10List list = new CEI_10List();
     using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
     {
         CEI_10BE c;
         foreach (CEI_10 item in dc.CEI_10.Where(p => p.HasChilds.Equals(false)))
         {
             //list.Add((CEI_10BE)c);
             c = new CEI_10BE();
             c.Code = item.Code;
             c.Description = item.Description;
             list.Add(c);
         }
     }
     return list;
 }
        /// <summary>
        /// Elimina rol a Institución
        /// Si es inst_owner o inst_admin establece .IsAdmin o.IsOwbner a falce respectivamente y posteriormente elimina el rol
        /// Si NO : l SOLO Elimina el rol
        /// </summary>
        /// <param name="pHealthInstitutionId"></param>
        /// <param name="userId"></param>
        /// <param name="rolName"></param>
        public static void Profesional_RemoveRol(Guid pHealthInstitutionId, Int32 pProfesionalId, Guid userId, string rolName)
        {
            Back.BE.HealthInstitution_Profesional wHealthInstitution_Profesional = null;
            Back.BE.HealtInstitute_UsersInRoles wHealtInstitute_UsersInRoles = null;
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                wHealthInstitution_Profesional = dc.HealthInstitution_Profesional.Where(p =>
                                                  p.HealthInstitutionId.Equals(pHealthInstitutionId) &&
                                                  p.Profesional.IdProfesional.Equals(pProfesionalId)).FirstOrDefault();

                //Si solo queda un unico rol el cual sera removido el usuario queda automaticamente en estado no vigente
                if (dc.HealtInstitute_UsersInRoles.Count(p => p.UserId.Equals(userId) && p.HealthInstitutionId.Equals(pHealthInstitutionId)) == 1)
                {
                    wHealthInstitution_Profesional.ActiveFlag = false;
                    wHealthInstitution_Profesional.IsOwner = false;
                    wHealthInstitution_Profesional.IsAdmin = false;
                }
                else
                {
                    if (rolName.Equals("inst_owner") || rolName.Equals("inst_admin"))
                    {
                        if (rolName.Equals("inst_owner"))
                            wHealthInstitution_Profesional.IsOwner = false;

                        if (rolName.Equals("inst_admin"))
                            wHealthInstitution_Profesional.IsAdmin = false;
                    }
                }

                //busca la entidad HealtInstitute_UsersInRoles
                wHealtInstitute_UsersInRoles = dc.HealtInstitute_UsersInRoles.Where(p =>
                      p.UserId.Equals(userId) &&
                      p.HealthInstitutionId.Equals(pHealthInstitutionId) &&
                      p.RoleName.Equals(rolName)).FirstOrDefault();

                //Elimina la entidad HealtInstitute_UsersInRoles
                if (wHealtInstitute_UsersInRoles != null)
                    dc.HealtInstitute_UsersInRoles.DeleteObject(wHealtInstitute_UsersInRoles);

                dc.SaveChanges();
            }
        }
Example #40
0
        public static void Create_MutualPorPaciente(MutualPorPacienteList pMutualesDelPatient, int pIdPatient)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                MutualPorPaciente wMutual =null;

                foreach (MutualPorPacienteBE wMutualBE in pMutualesDelPatient)
                {
                    wMutual = new MutualPorPaciente();
                    wMutual.IdPaciente = pIdPatient;
                    wMutual.IdMutual = wMutualBE.IdMutual;
                    wMutual.NroAfiliadoMutual = wMutualBE.NroAfiliadoMutual;

                    dc.MutualPorPacientes.AddObject(wMutual);
                 
                 
                }
                dc.SaveChanges();
            }
        }
        /// <summary>
        /// Crea una Institución
        /// Establece como profesional owner de  pHealthInstitution a pProfesionalId/pUserId
        /// </summary>
        /// <param name="pHealthInstitution">Institución</param>
        /// <param name="pProfesionalId">Profesional</param>
        /// <param name="pUserId"></param>
        public static void Create_From_Owner(Health.Back.BE.HealthInstitution pHealthInstitution, Int32 pProfesionalId, Guid pUserId)
        {
            Back.BE.HealthInstitution_Profesional wHealthInstitution_Profesional = new Back.BE.HealthInstitution_Profesional();
            Back.BE.HealtInstitute_UsersInRoles wHealtInstitute_UsersInRoles = new BE.HealtInstitute_UsersInRoles();

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                //Busco la institución padre si existe
                var parentHI = dc.HealthInstitutions.Where(p => !p.HealthInstitutionIdParent.HasValue
                    && p.HealthInstitution_Profesional.Any(prof => prof.ProfesionalId.Equals(pProfesionalId))).FirstOrDefault();
                if (parentHI != null)
                    pHealthInstitution.HealthInstitutionIdParent = parentHI.HealthInstitutionId;

                pHealthInstitution.HealthInstitutionId = Guid.NewGuid();
                pHealthInstitution.CreatedDate = System.DateTime.Now;
                dc.HealthInstitutions.AddObject(pHealthInstitution);

                wHealthInstitution_Profesional.HealthInstitutionId = pHealthInstitution.HealthInstitutionId;
                wHealthInstitution_Profesional.ProfesionalId = pProfesionalId;
                wHealthInstitution_Profesional.ActiveFlag = true;
                wHealthInstitution_Profesional.UserId = pUserId;
                wHealthInstitution_Profesional.IsLockedOut = false;
                wHealthInstitution_Profesional.IsOwner = true;
                dc.HealthInstitution_Profesional.AddObject(wHealthInstitution_Profesional);


                wHealtInstitute_UsersInRoles.UserId = pUserId;
                wHealtInstitute_UsersInRoles.HealthInstitutionId = pHealthInstitution.HealthInstitutionId;
                wHealtInstitute_UsersInRoles.RoleName = "inst_owner";

                dc.HealtInstitute_UsersInRoles.AddObject(wHealtInstitute_UsersInRoles);

                dc.SaveChanges();

            }


        }
Example #42
0
         /// <summary>
         /// Retorna todos los medicamentos asignados al Patient
         /// No importa si fueron suspendidos 
         /// </summary>
         /// <param name="patientId"></param>
         /// <returns></returns>
         public static PatientMedicament_ViewList RetrivePatientMedicamentsAlls(int patientId)
         {
             PatientMedicament_ViewList list = new PatientMedicament_ViewList();
             using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
             {
                 var list_db = dc.PatientMedicament_View.Where(
                     p => p.PatientId.Equals(patientId)                  );

                 foreach (PatientMedicament_View patientMedicament_db in list_db)
                 {
                     list.Add((PatientMedicament_ViewBE)patientMedicament_db);
                 }

             }
             return list;
         }
Example #43
0
        /// <summary>
        /// Crea Patient y persona
        /// </summary>
        /// <param name="PatientBE"></param>
        public static void Create(PatientBE PatientBE)
        {

            PersonasDAC.Create(PatientBE.Persona);

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                Patient p = new Patient();
                p.IdPersona = PatientBE.Persona.IdPersona;
                p.FechaAlta = PatientBE.Persona.FechaAlta;
                p.LastAccessTime = p.FechaAlta;
                p.LastAccessUserId = PatientBE.LastAccessUserId;

                dc.Patients.AddObject(p);
                dc.SaveChanges();
                PatientBE.PatientId = p.PatientId;
                PatientBE.IdPersona = p.IdPersona;
            }
            Create_PlanVacunacion(PatientBE);
        }
Example #44
0
        /// <summary>
        /// Por el momento representa Turnos otorgados a un Patient determinado por patientId
        /// </summary>
        /// <param name="startDate">Puede ser nula . Fecha de inicio para la busqueda</param>
        /// <param name="status"></param>
        /// <param name="patientId"></param>
        /// <returns>Patient_Appointments_ViewList, Appointment con ProfesionalAppointment</returns>
        public static Patient_Appointments_ViewList Retrive_Appointment(int patientId, DateTime? startDate, int? status)
        {
            Patient_Appointments_ViewList list = new Patient_Appointments_ViewList();
            if (startDate.HasValue)
                startDate = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(startDate.Value);

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                var appointment_db = dc.Patient_Appointments_View.Where<Patient_Appointments_View>(p =>
                    (!startDate.HasValue || p.Start.Value >= startDate.Value)
                    && (!status.HasValue || status.Value.Equals(p.Status.Value))
                    && (p.PatientId.Equals(patientId))
                    );

                foreach (Patient_Appointments_View r in appointment_db)
                {
                    Patient_Appointments_ViewBE wAppoimentBE = (Patient_Appointments_ViewBE)r;
                    wAppoimentBE = (Patient_Appointments_ViewBE)r;
                    list.Add(wAppoimentBE);
                }
            }
            return list;
        }
Example #45
0
        public static void DisablePatientMedicaments(int patientMedicamentId, Guid guid,MedicamentStatus status)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientMedicament patientMedicament_db = dc.PatientMedicaments.Where(p => p.PatientMedicamentId.Equals(patientMedicamentId)).FirstOrDefault<PatientMedicament>();

                if (patientMedicament_db != null)
                {
                    patientMedicament_db.Status = (int)status;
                    patientMedicament_db.Enabled = false;
                }
                dc.SaveChanges();
            }
        }
Example #46
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="patientMedicament_View"></param>
        /// <param name="createdUserId"></param>
        public static void UpdatePatientMedicaments(PatientMedicament_ViewBE patientMedicament_View, Guid createdUserId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientMedicament patientMedicament_db = dc.PatientMedicaments.Where(p => p.PatientMedicamentId.Equals(patientMedicament_View.PatientMedicamentId)).FirstOrDefault<PatientMedicament>();

                if (patientMedicament_db == null) return;

                patientMedicament_db.Status = patientMedicament_View.Status;
                
                patientMedicament_db.MedicalEventId = patientMedicament_View.MedicalEventId;
                patientMedicament_db.PatientId = patientMedicament_View.PatientId;

                patientMedicament_db.PatientMedicamentId_Parent = patientMedicament_View.PatientMedicamentId_Parent;
                patientMedicament_db.MedicamentName = patientMedicament_View.MedicamentName;
                patientMedicament_db.MedicamentPresentation = patientMedicament_View.MedicamentPresentation;
                patientMedicament_db.Dosis = patientMedicament_View.Dosis;
                patientMedicament_db.Periodicity_hours = patientMedicament_View.Periodicity_hours;
                patientMedicament_db.CreatedDate = System.DateTime.Now;
                patientMedicament_db.CreatedUserId = createdUserId;
                patientMedicament_db.Enabled = patientMedicament_View.Enabled;
                patientMedicament_db.DaysCount = patientMedicament_View.DaysCount;

                dc.SaveChanges();
            }
        }
Example #47
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pPatientMedicamentId"></param>
        public static void RemovePatientMedicaments(int pPatientMedicamentId)
        {
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                PatientMedicament patientMedicament_db = dc.PatientMedicaments.Where(p => p.PatientMedicamentId.Equals(pPatientMedicamentId)).FirstOrDefault<PatientMedicament>();

                dc.PatientMedicaments.DeleteObject(patientMedicament_db);
                dc.SaveChanges();
            }
        }
Example #48
0
        public static void AddPatientMedicaments(PatientMedicament_ViewBE patientMedicament_View, Guid createdUserId)
        {
            
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                PatientMedicament patientMedicament_db = new PatientMedicament();

                patientMedicament_db.Status = patientMedicament_View.Status;
                
                patientMedicament_db.MedicalEventId = patientMedicament_View.MedicalEventId;
                patientMedicament_db.PatientId = patientMedicament_View.PatientId;
                if(patientMedicament_View.PatientMedicamentId_Parent >=0)
                    patientMedicament_db.PatientMedicamentId_Parent = patientMedicament_View.PatientMedicamentId_Parent;

                patientMedicament_db.MedicamentName = patientMedicament_View.MedicamentName;
                patientMedicament_db.MedicamentPresentation = patientMedicament_View.MedicamentPresentation;
                patientMedicament_db.Dosis = patientMedicament_View.Dosis;
                patientMedicament_db.Periodicity_hours = patientMedicament_View.Periodicity_hours;
                patientMedicament_db.CreatedDate = System.DateTime.Now;
                patientMedicament_db.CreatedUserId = createdUserId;
                patientMedicament_db.DaysCount = patientMedicament_View.DaysCount;
                patientMedicament_db.Enabled = true;
                dc.PatientMedicaments.AddObject(patientMedicament_db);
                dc.SaveChanges();
            }
            
        }