コード例 #1
0
        public List <TramasList> GettramasPageAndFilteredPartos(ref OperationResult pobjOperationResult, int?pintPageIndex, int?pintResultsPerPage, string pstrSortExpression, string pstrFilterExpression, DateTime?pdatBeginDate, DateTime?pdatEndDate)
        {
            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();

                var query = from A in dbContext.tramas

                            join C in dbContext.systemuser on A.i_InsertUserId equals C.i_SystemUserId
                            join D in dbContext.person on C.v_PersonId equals D.v_PersonId
                            join E in dbContext.systemuser on new { i_UpdateUserId = A.i_UpdateUserId.Value }
                equals new { i_UpdateUserId = E.i_SystemUserId } into E_join
                from E in E_join.DefaultIfEmpty()

                join F in dbContext.person on new { v_PersonId = E.v_PersonId }
                equals new { v_PersonId = F.v_PersonId } into F_join
                from F in F_join.DefaultIfEmpty()

                join G in dbContext.systemparameter on new { a = A.i_TipoParto.Value, b = 350 }
                equals new { a = G.i_ParameterId, b = G.i_GroupId } into G_join                 // TIPO PARTO DETAIL
                from G in G_join.DefaultIfEmpty()

                join H in dbContext.systemparameter on new { a = A.i_TipoNacimiento.Value, b = 351 }
                equals new { a = H.i_ParameterId, b = H.i_GroupId } into H_join                 // NACIMIENTO DETAIL
                from H in H_join.DefaultIfEmpty()

                join I in dbContext.systemparameter on new { a = A.i_TipoComplicacion.Value, b = 352 }
                equals new { a = I.i_ParameterId, b = I.i_GroupId } into I_join                 // COMPLICACION DETAIL
                from I in I_join.DefaultIfEmpty()

                where A.i_IsDeleted == 0 && A.v_TipoRegistro == "Partos"

                select new TramasList
                {
                    v_TramaId                = A.v_TramaId,
                    v_TipoRegistro           = A.v_TipoRegistro,
                    d_FechaIngreso           = A.d_FechaIngreso.Value,
                    tipoParto_Detail         = G.v_Value1,
                    tipoNacimiento_Detail    = H.v_Value1,
                    tipoCompliacacion_Detail = I.v_Value1,
                    d_InsertDate             = A.d_InsertDate.Value,
                    d_UpdateDate             = A.d_UpdateDate.Value,
                    User_Crea                = D.v_FirstName + " " + D.v_FirstLastName + " " + D.v_SecondLastName,
                    User_Act = E.i_SystemUserId == null ? "---" : F.v_FirstName + " " + F.v_FirstLastName + " " + F.v_SecondLastName,
                };
                #region
                if (!string.IsNullOrEmpty(pstrFilterExpression))
                {
                    query = query.Where(pstrFilterExpression);
                }
                if (pdatBeginDate.HasValue && pdatEndDate.HasValue)
                {
                    query = query.Where("d_FechaIngreso >= @0 && d_FechaIngreso <= @1", pdatBeginDate.Value, pdatEndDate.Value);
                }
                if (!string.IsNullOrEmpty(pstrSortExpression))
                {
                    query = query.OrderBy(pstrSortExpression);
                }
                if (pintPageIndex.HasValue && pintResultsPerPage.HasValue)
                {
                    int intStartRowIndex = pintPageIndex.Value * pintResultsPerPage.Value;
                    query = query.Skip(intStartRowIndex);
                }
                if (pintResultsPerPage.HasValue)
                {
                    query = query.Take(pintResultsPerPage.Value);
                }
                #endregion
                List <TramasList> objData = query.ToList();
                var tramasdetalle         = (from a in objData
                                             select new TramasList
                {
                    v_TramaId = a.v_TramaId,
                    v_TipoRegistro = a.v_TipoRegistro,
                    d_FechaIngreso = a.d_FechaIngreso,
                    tipoParto_Detail = a.tipoParto_Detail,
                    tipoNacimiento_Detail = a.tipoNacimiento_Detail,
                    tipoCompliacacion_Detail = a.tipoCompliacacion_Detail,
                    User_Crea = a.User_Crea,
                    User_Act = a.User_Act,
                    d_InsertDate = a.d_InsertDate,
                    d_UpdateDate = a.d_UpdateDate,
                }).ToList();
                pobjOperationResult.Success = 1;
                return(tramasdetalle);
            }
            catch (Exception e)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(e);
                return(null);
                //Console.WriteLine(e);
                //throw;
            }
        }
コード例 #2
0
        public PacientList DevolverDatosPaciente(string pstrServiceId)
        {
            try
            {
                DatabaseContext dbContext = new DatabaseContext();
                var             objEntity = (from a in dbContext.Service
                                             join b in dbContext.Person on a.v_PersonId equals b.v_PersonId

                                             join c in dbContext.SystemParameter on new { a = b.i_SexTypeId.Value, b = 100 }
                                             equals new { a = c.i_ParameterId, b = c.i_GroupId } // GENERO
                                             join d in dbContext.Protocol on a.v_ProtocolId equals d.v_ProtocolId


                                             join E in dbContext.DataHierarchy on new { a = b.i_DepartmentId.Value, b = 113 }
                                             equals new { a = E.i_ItemId, b = E.i_GroupId } into E_join
                                             from E in E_join.DefaultIfEmpty()

                                             join F in dbContext.DataHierarchy on new { a = b.i_ProvinceId.Value, b = 113 }
                                             equals new { a = F.i_ItemId, b = F.i_GroupId } into F_join
                                             from F in F_join.DefaultIfEmpty()

                                             join G in dbContext.DataHierarchy on new { a = b.i_DistrictId.Value, b = 113 }
                                             equals new { a = G.i_ItemId, b = G.i_GroupId } into G_join
                                             from G in G_join.DefaultIfEmpty()

                                             join H in dbContext.Person on a.v_PersonId equals H.v_PersonId into H_join
                                             from H in H_join.DefaultIfEmpty()

                                             join I in dbContext.DataHierarchy on new { a = H.i_DepartmentId.Value, b = 113 }
                                             equals new { a = I.i_ItemId, b = I.i_GroupId } into I_join
                                             from I in I_join.DefaultIfEmpty()

                                             join J in dbContext.DataHierarchy on new { a = H.i_ProvinceId.Value, b = 113 }
                                             equals new { a = J.i_ItemId, b = J.i_GroupId } into J_join
                                             from J in J_join.DefaultIfEmpty()

                                             join K in dbContext.DataHierarchy on new { a = H.i_DistrictId.Value, b = 113 }
                                             equals new { a = K.i_ItemId, b = K.i_GroupId } into K_join
                                             from K in K_join.DefaultIfEmpty()

                                             join M in dbContext.SystemParameter on new { a = H.i_MaritalStatusId.Value, b = 101 }
                                             equals new { a = M.i_ParameterId, b = M.i_GroupId } into M_join
                                             from M in M_join.DefaultIfEmpty()

                                             join N in dbContext.DataHierarchy on new { a = H.i_LevelOfId.Value, b = 108 }
                                             equals new { a = N.i_ItemId, b = N.i_GroupId } into N_join
                                             from N in N_join.DefaultIfEmpty()

                                             join P in dbContext.SystemParameter on new { a = b.i_BloodGroupId.Value, b = 154 }
                                             equals new { a = P.i_ParameterId, b = P.i_GroupId } into P_join
                                             from P in P_join.DefaultIfEmpty()

                                             join Q in dbContext.SystemParameter on new { a = b.i_BloodFactorId.Value, b = 155 }
                                             equals new { a = Q.i_ParameterId, b = Q.i_GroupId } into Q_join
                                             from Q in Q_join.DefaultIfEmpty()

                                             join r in dbContext.ServiceComponent on a.v_ServiceId equals r.v_ServiceId

                                             // Empresa / Sede Cliente ******************************************************
                                             join oc in dbContext.Organization on new { a = d.v_CustomerOrganizationId }
                                             equals new { a = oc.v_OrganizationId } into oc_join
                                             from oc in oc_join.DefaultIfEmpty()

                                             join z in dbContext.Organization on new { a = d.v_EmployerOrganizationId }
                                             equals new { a = z.v_OrganizationId } into z_join
                                             from z in z_join.DefaultIfEmpty()

                                             join lc in dbContext.Location on new { a = d.v_CustomerOrganizationId, b = d.v_CustomerLocationId }
                                             equals new { a = lc.v_OrganizationId, b = lc.v_LocationId } into lc_join
                                             from lc in lc_join.DefaultIfEmpty()

                                             //**********************************************************************************
                                             join O in dbContext.SystemParameter on new { a = 134, b = a.i_MacId.Value }
                                             equals new { a = O.i_GroupId, b = O.i_ParameterId } into O_join
                                             from O in O_join.DefaultIfEmpty()
                                             join J4 in dbContext.SystemParameter on new { ItemId = a.i_AptitudeStatusId.Value, groupId = 124 }
                                             equals new { ItemId = J4.i_ParameterId, groupId = J4.i_GroupId } into J4_join
                                             from J4 in J4_join.DefaultIfEmpty()

                                             join su in dbContext.SystemUser on a.i_UpdateUserMedicalAnalystId.Value equals su.i_SystemUserId into su_join
                                             from su in su_join.DefaultIfEmpty()

                                             join pr in dbContext.Professional on su.v_PersonId equals pr.v_PersonId into pr_join
                                             from pr in pr_join.DefaultIfEmpty()

                                             join su1 in dbContext.SystemUser on a.i_UpdateUserOccupationalMedicaltId.Value equals su1.i_SystemUserId into su1_join
                                             from su1 in su1_join.DefaultIfEmpty()

                                             join pr2 in dbContext.Professional on su1.v_PersonId equals pr2.v_PersonId into pr2_join
                                             from pr2 in pr2_join.DefaultIfEmpty()

                                             where a.v_ServiceId == pstrServiceId && a.i_IsDeleted == 0
                                             select new PacientList
                {
                    Trabajador = b.v_FirstLastName + " " + b.v_SecondLastName + " " + b.v_FirstName,
                    d_Birthdate = b.d_Birthdate.Value,
                    //
                    v_PersonId = b.v_PersonId,

                    v_FirstLastName = b.v_FirstLastName,
                    v_SecondLastName = b.v_SecondLastName,
                    v_FirstName = b.v_FirstName,
                    v_BirthPlace = b.v_BirthPlace,
                    v_DepartamentName = I.v_Value1,
                    v_ProvinceName = J.v_Value1,
                    v_DistrictName = K.v_Value1,
                    v_AdressLocation = b.v_AdressLocation,
                    GradoInstruccion = N.v_Value1,
                    v_CentroEducativo = b.v_CentroEducativo,
                    v_MaritalStatus = M.v_Value1,
                    v_BloodGroupName = P.v_Value1,
                    v_BloodFactorName = Q.v_Value1,
                    v_IdService = a.v_ServiceId,
                    v_OrganitationName = oc.v_Name,
                    i_NumberLivingChildren = b.i_NumberLivingChildren,
                    FechaCaducidad = a.d_GlobalExpirationDate,
                    FechaActualizacion = a.d_UpdateDate,
                    N_Informe = r.v_ServiceComponentId,
                    v_Religion = b.v_Religion,
                    v_Nacionalidad = b.v_Nacionalidad,
                    v_ResidenciaAnterior = b.v_ResidenciaAnterior,
                    i_DocTypeId = b.i_DocTypeId,
                    v_OwnerName = b.v_OwnerName,
                    v_Employer = z.v_Name,
                    v_ContactName = b.v_ContactName,
                    i_Relationship = b.i_Relationship,
                    v_EmergencyPhone = b.v_EmergencyPhone,
                    //
                    Genero = c.v_Value1,
                    i_SexTypeId = b.i_SexTypeId,
                    v_DocNumber = b.v_DocNumber,
                    v_TelephoneNumber = b.v_TelephoneNumber,
                    Empresa = oc.v_Name,
                    Sede = lc.v_Name,
                    v_CurrentOccupation = b.v_CurrentOccupation,
                    FechaServicio = a.d_ServiceDate.Value,
                    i_MaritalStatusId = b.i_MaritalStatusId,
                    // Antecedentes ginecologicos
                    d_PAP = a.d_PAP.Value,
                    d_Mamografia = a.d_Mamografia.Value,
                    v_CiruGine = a.v_CiruGine,
                    v_Gestapara = a.v_Gestapara,
                    v_Menarquia = a.v_Menarquia,
                    v_Findings = a.v_Findings,
                    d_Fur = a.d_Fur,
                    v_CatemenialRegime = a.v_CatemenialRegime,
                    i_MacId = a.i_MacId,
                    v_Mac = O.v_Value1,
                    v_Story = a.v_Story,
                    Aptitud = J4.v_Value1,
                    b_FirmaAuditor = pr.b_SignatureImage,
                    FirmaTrabajador = b.b_RubricImage,
                    HuellaTrabajador = b.b_FingerPrintImage,
                    FirmaDoctorAuditor = pr2.b_SignatureImage,
                }
                                             ).ToList();
                var DatosMedicoMedicinaEvaluador = ObtenerDatosMedicoMedicina(pstrServiceId, Constants.EXAMEN_FISICO_ID, Constants.EXAMEN_FISICO_7C_ID);
                //var DatosMedicoMedicinaAuditor = ObtenerDatosMedicoMedicinaAuditor(pstrServiceId, Constants.EXAMEN_FISICO_ID, Constants.EXAMEN_FISICO_7C_ID);

                var result = (from a in objEntity
                              select new PacientList
                {
                    Trabajador = a.Trabajador,
                    d_Birthdate = a.d_Birthdate,
                    v_ContactName = a.v_ContactName,
                    v_EmergencyPhone = a.v_EmergencyPhone,
                    i_Relationship = a.i_Relationship,
                    //
                    v_PersonId = a.v_PersonId,
                    v_FirstLastName = a.v_FirstLastName,
                    v_SecondLastName = a.v_SecondLastName,
                    v_FirstName = a.v_FirstName,
                    v_BirthPlace = a.v_BirthPlace,
                    v_DepartamentName = a.v_DepartamentName,
                    v_ProvinceName = a.v_ProvinceName,
                    v_DistrictName = a.v_DistrictName,
                    GradoInstruccion = a.GradoInstruccion,
                    v_MaritalStatus = a.v_MaritalStatus,
                    v_BloodGroupName = a.v_BloodGroupName,
                    v_BloodFactorName = a.v_BloodFactorName,
                    v_AdressLocation = a.v_AdressLocation,
                    v_IdService = a.v_IdService,
                    v_OrganitationName = a.v_OrganitationName,
                    i_NumberLivingChildren = a.i_NumberLivingChildren,
                    v_CentroEducativo = a.v_CentroEducativo,
                    FechaCaducidad = a.FechaCaducidad,
                    FechaActualizacion = a.FechaActualizacion,
                    N_Informe = a.N_Informe,
                    v_Religion = a.v_Religion,
                    v_Nacionalidad = a.v_Nacionalidad,
                    v_ResidenciaAnterior = a.v_ResidenciaAnterior,
                    i_DocTypeId = a.i_DocTypeId,
                    v_OwnerName = a.v_OwnerName,
                    v_Employer = a.v_Employer,
                    i_MaritalStatusId = a.i_MaritalStatusId,
                    //
                    Edad = GetEdad(a.d_Birthdate.Value),
                    Genero = a.Genero,
                    i_SexTypeId = a.i_SexTypeId,
                    v_DocNumber = a.v_DocNumber,
                    v_TelephoneNumber = a.v_TelephoneNumber,
                    Empresa = a.Empresa,
                    Sede = a.Sede,
                    v_CurrentOccupation = a.v_CurrentOccupation,
                    FechaServicio = a.FechaServicio,
                    MedicoGrabaMedicina = DatosMedicoMedicinaEvaluador == null ? "" : DatosMedicoMedicinaEvaluador.ApellidosDoctor + " " + DatosMedicoMedicinaEvaluador.NombreDoctor,
                    // Antecedentes ginecologicos
                    d_PAP = a.d_PAP,
                    d_Mamografia = a.d_Mamografia,
                    v_CiruGine = a.v_CiruGine,
                    v_Gestapara = a.v_Gestapara,
                    v_Menarquia = a.v_Menarquia,
                    v_Findings = a.v_Findings,
                    d_Fur = a.d_Fur,
                    v_CatemenialRegime = a.v_CatemenialRegime,
                    i_MacId = a.i_MacId,
                    v_Mac = a.v_Mac,
                    v_Story = a.v_Story,
                    Aptitud = a.Aptitud,
                    b_FirmaEvaluador = DatosMedicoMedicinaEvaluador == null ? null : DatosMedicoMedicinaEvaluador.FirmaMedicoMedicina,
                    b_FirmaAuditor = a.b_FirmaAuditor,
                    FirmaTrabajador = a.FirmaTrabajador,
                    HuellaTrabajador = a.HuellaTrabajador,
                    FirmaDoctorAuditor = a.FirmaDoctorAuditor
                }
                              ).FirstOrDefault();


                return(result);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }