Example #1
0
        private void Liberar()
        {
            try
            {
                OperationResult objOperationResult = new OperationResult();
                ServiceBL       objServiceBL       = new ServiceBL();

                servicecomponentDto         objservicecomponentDto = null;
                List <ServiceComponentList> ListServiceComponent   = new List <ServiceComponentList>();

                if (_categoryId == -1)
                {
                    _ServiceComponentId.Add(grdLlamandoPaciente.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString());
                }
                else
                {
                    var servCompCat = objServiceBL.GetServiceComponentByCategoryId(ref objOperationResult, _categoryId, _serviceId);

                    foreach (var item in servCompCat)
                    {
                        _ServiceComponentId.Add(item.v_ServiceComponentId);
                    }
                }

                List <servicecomponentDto> list = new List <servicecomponentDto>();

                for (int i = 0; i < _ServiceComponentId.Count; i++)
                {
                    objservicecomponentDto = new servicecomponentDto();
                    objservicecomponentDto.v_ServiceComponentId = _ServiceComponentId[i];
                    objservicecomponentDto.i_QueueStatusId      = (int)Common.QueueStatusId.LIBRE;
                    objservicecomponentDto.i_Iscalling          = (int)SiNo.NO;
                    objservicecomponentDto.d_EndDate            = DateTime.Now;
                    list.Add(objservicecomponentDto);
                }

                // update
                objServiceBL.UpdateServiceComponentOffice(list);

                #region Check de salir de circuito

                if (chkHability.Checked == true) // finaliza el servicio y actualiza el estado del servicio
                {
                    if (ddlServiceStatusId.SelectedValue.ToString() == ((int)ServiceStatus.Iniciado).ToString())
                    {
                        MessageBox.Show("Debe elegir cualquier otro estado que no sea (Iniciado)\nSi desea Liberar y/o Finalizar Circuito.", "ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    serviceDto objserviceDto = new serviceDto();

                    objserviceDto.v_ServiceId       = _serviceId;
                    objserviceDto.i_ServiceStatusId = int.Parse(ddlServiceStatusId.SelectedValue.ToString());
                    objserviceDto.v_Motive          = txtReason.Text;

                    objServiceBL.UpdateServiceOffice(ref objOperationResult, objserviceDto, Globals.ClientSession.GetAsList());

                    //Actualizamos el estado de la linea de la agenda como fuera de circuito
                    CalendarBL  objCalendarBL  = new CalendarBL();
                    calendarDto objcalendarDto = new calendarDto();
                    objcalendarDto = objCalendarBL.GetCalendar(ref objOperationResult, _CalendarId);
                    objcalendarDto.i_LineStatusId = 2;// int.Parse(Common.LineStatus.FueraCircuito.ToString());
                    objCalendarBL.UpdateCalendar(ref objOperationResult, objcalendarDto, Globals.ClientSession.GetAsList());
                }

                #endregion

                //Actualizar grdDataServiceComponent

                ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _serviceId);
                grdDataServiceComponent.DataSource = ListServiceComponent;

                btnRefresh_Click(null, null);

                txtReason.Text              = "";
                grdListaLlamando.Enabled    = true;
                grdLlamandoPaciente.Enabled = false;
                btnRefresh.Enabled          = true;
                chkHability.Enabled         = false;
                chkHability.Checked         = false;
                groupBox3.Enabled           = false;

                grdLlamandoPaciente.DataSource = new List <CalendarList>();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Common.Utils.ExceptionFormatter(ex), "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private DataSet GetReportAudiometria()
        {
            try
            {
                var serviceBL = new ServiceBL();
                DataSet dsAudiometria = new DataSet();

                var dxList = serviceBL.GetDiagnosticRepositoryByComponent(_serviceId, Constants.AUDIOMETRIA_ID);
                var dtDx = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(dxList);
                dtDx.TableName = "dtDiagnostic";
                dsAudiometria.Tables.Add(dtDx);

                //// Obtener las recomendaciones (removiendo las duplicadas)
                //var recom = dxList.SelectMany(s => s.Recomendations)
                //                  .GroupBy(x => x.v_RecommendationName)
                //                  .Select(group => group.First())
                //                  .ToList();

                var recom = dxList.SelectMany(s => s.Recomendations).ToList();

                //DataTable dtRecom = new DataTable();
                //dtRecom.TableName = "dtRecomendation";
                //dtRecom.Columns.Add("v_RecommendationName", typeof(string));

                //foreach (var item in recom)
                //{
                //    var row = dtRecom.NewRow();
                //    row["v_RecommendationName"] = item.v_RecommendationName;
                //    dtRecom.Rows.Add(row);
                //}

                //dsAudiometria.Tables.Add(dtRecom);

                var dtReco = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(recom);
                dtReco.TableName = "dtRecomendation";
                dsAudiometria.Tables.Add(dtReco);

                //-------******************************************************************************************

                var audioUserControlList = serviceBL.ReportAudiometriaUserControl(_serviceId, Constants.AUDIOMETRIA_ID);
                //aqui hay error corregir despues del cine
                var audioCabeceraList = serviceBL.ReportAudiometria(_serviceId, Constants.AUDIOMETRIA_ID);

                var dtAudiometriaUserControl = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(audioUserControlList);

                var dtCabecera = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(audioCabeceraList);


                dtCabecera.TableName = "dtAudiometria";
                dtAudiometriaUserControl.TableName = "dtAudiometriaUserControl";

                dsAudiometria.Tables.Add(dtCabecera);
                dsAudiometria.Tables.Add(dtAudiometriaUserControl);



                return dsAudiometria;
            }
            catch (Exception)
            {

                throw;
            }


        }
Example #3
0
        private void Atender()
        {
            OperationResult             objOperationResult     = new OperationResult();
            ServiceBL                   objServiceBL           = new ServiceBL();
            servicecomponentDto         objservicecomponentDto = new servicecomponentDto();
            List <ServiceComponentList> ListServiceComponent   = new List <ServiceComponentList>();

            _ServiceComponentId = new List <string>();

            if (chkVerificarHuellaDigital.Checked)
            {
                var checkingFinger = new frmCheckingFinger();
                checkingFinger._PacientId = _personId;
                checkingFinger.ShowDialog();

                if (checkingFinger.DialogResult == DialogResult.Cancel)
                {
                    return;
                }
            }

            DialogResult Result = MessageBox.Show("¿Está seguro de INICIAR ATENCIÓN este registro?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (_categoryId == -1)
            {
                _ServiceComponentId.Add(grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString());
            }
            else
            {
                foreach (var item in objServiceBL.GetServiceComponentByCategoryId(ref objOperationResult, _categoryId, _serviceId))
                {
                    _ServiceComponentId.Add(item.v_ServiceComponentId);
                }
            }

            if (Result == System.Windows.Forms.DialogResult.Yes)
            {
                for (int i = 0; i < _ServiceComponentId.Count(); i++)
                {
                    objservicecomponentDto = objServiceBL.GetServiceComponent(ref objOperationResult, _ServiceComponentId[i]);
                    objservicecomponentDto.i_QueueStatusId = (int)Common.QueueStatusId.OCUPADO;
                    objservicecomponentDto.d_StartDate     = DateTime.Now;
                    objServiceBL.UpdateServiceComponent(ref objOperationResult, objservicecomponentDto, Globals.ClientSession.GetAsList());
                }
                //Actualizar grdDataServiceComponent
                string strServicelId = grdListaLlamando.Selected.Rows[0].Cells[5].Value.ToString();
                ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, strServicelId);
                grdDataServiceComponent.DataSource = ListServiceComponent;

                _Flag = 1;

                Form frm;
                if (_TserviceId == (int)MasterService.AtxMedicaParticular || _TserviceId == (int)MasterService.AtxMedicaSeguros)
                {
                    frm = new Operations.frmMedicalConsult(_serviceId, string.Join("|", _componentIds.Select(p => p)), null);
                    frm.ShowDialog();
                }
                else
                {
                    this.Enabled = false;
                    frm          = new Operations.frmEso(_serviceId, string.Join("|", _componentIds.Select(p => p)), null, (int)MasterService.Eso);
                    frm.ShowDialog();
                    this.Enabled = true;
                    // Aviso automático de que se culminaron todos los examanes, se tendria que proceder
                    // a establecer el estado del servicio a (Culminado Esperando Aptitud)

                    var alert = objServiceBL.GetServiceComponentsCulminados(ref objOperationResult, _serviceId);

                    if (alert != null && alert.Count > 0)
                    {
                    }
                    else
                    {
                        MessageBox.Show("Todos los Examenes se encuentran concluidos.\nEl estado de la Atención es: En espera de Aptitud .", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        serviceDto objserviceDto = new serviceDto();
                        objserviceDto = objServiceBL.GetService(ref objOperationResult, objservicecomponentDto.v_ServiceId);
                        objserviceDto.i_ServiceStatusId = (int)ServiceStatus.EsperandoAptitud;
                        objserviceDto.v_Motive          = "Esperando Aptitud";

                        objServiceBL.UpdateService(ref objOperationResult, objserviceDto, Globals.ClientSession.GetAsList());
                    }
                }

                // refrecar la grilla
                ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _serviceId);
                grdDataServiceComponent.DataSource = ListServiceComponent;
            }
        }
Example #4
0
        private void Llamar()
        {
            OperationResult             objOperationResult   = new OperationResult();
            List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();
            CalendarBL          objCalendarBL   = new CalendarBL();
            CalendarList        objCalendar     = new CalendarList();
            List <CalendarList> objCalendarList = new List <CalendarList>();
            ProtocolBL          oProtocolBL     = new ProtocolBL();

            ServiceBL           objServiceBL           = new ServiceBL();
            servicecomponentDto objservicecomponentDto = new servicecomponentDto();

            _ServiceComponentId = new List <string>();

            // Verificar si un componente está en la categoría
            MedicalExamBL oMedicalExamBL = new MedicalExamBL();

            Boolean Resultado = oMedicalExamBL.VerificarComponentePorCategoria(_categoriaId, Constants.ELECTROCARDIOGRAMA_ID);

            if (Resultado)
            {
                List <ServiceComponentFieldValuesList> Valores = objServiceBL.ValoresComponente(_serviceId, Constants.ANTROPOMETRIA_ID);
                decimal ValorIMCServicio  = decimal.Parse(Valores.Find(p => p.v_ComponentFieldId == Constants.ANTROPOMETRIA_IMC_ID).v_Value1.ToString());
                decimal ValorIMCProtocolo = decimal.Parse(oProtocolBL.GetProtocolComponentByProtocol(ref objOperationResult, _ProtocolId, Constants.ELECTROCARDIOGRAMA_ID).r_Imc.ToString());

                if (ValorIMCServicio < ValorIMCProtocolo)
                {
                    MessageBox.Show("El I.M.C. del paciente tiene valores normales, no aplica para este examen", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }


            //Validación de Piso
            if (_Piso != "-1")
            {
                var ResultPiso = objServiceBL.PermitirLlamar(_serviceId, int.Parse(_Piso.ToString()));
                if (!ResultPiso)
                {
                    MessageBox.Show("El Paciente tiene consultorios por culminar, antes de ser llamado por este. Verifíquelo en unos minutos", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            if (int.Parse(_serviceStatusId) == (int)ServiceStatus.EsperandoAptitud)
            {
                MessageBox.Show("Este paciente ya tiene el servicio en espera de Aptitud, no puede ser llamado.", "INFORMACIÓN!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                return;
            }

            if (_IsCall == "OcupadoLlamado")
            {
                DialogResult Result = MessageBox.Show("¿Está seguro de LLAMAR a este paciente que está ocupado?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (Result == DialogResult.No)
                {
                    return;
                }
            }

            objCalendar.v_Pacient            = grdListaLlamando.Selected.Rows[0].Cells["v_Pacient"].Value.ToString();
            objCalendar.v_OrganizationName   = grdListaLlamando.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString();
            objCalendar.v_ServiceComponentId = grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString();

            if (_categoryId == -1)
            {
                _ServiceComponentId.Add(grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString());
            }
            else
            {
                foreach (var item in objServiceBL.GetServiceComponentByCategoryId(ref objOperationResult, _categoryId, _serviceId))
                {
                    _ServiceComponentId.Add(item.v_ServiceComponentId);
                }
            }

            // Cargar grilla de llamando al paciente  ************
            objCalendarList.Add(objCalendar);
            grdLlamandoPaciente.DataSource = objCalendarList;

            if (grdLlamandoPaciente.Rows.Count > 0)
            {
                grdLlamandoPaciente.Rows[0].Selected = true;
            }

            //*******************************************************

            for (int i = 0; i < _ServiceComponentId.Count; i++)
            {
                objservicecomponentDto = new servicecomponentDto();
                objservicecomponentDto.v_ServiceComponentId = _ServiceComponentId[i];
                objservicecomponentDto.i_QueueStatusId      = (int)Common.QueueStatusId.LLAMANDO;
                objservicecomponentDto.v_NameOfice          = cbOficina.Text.ToString();
                objServiceBL.UpdateServiceComponentOfficeLlamando(objservicecomponentDto);
            }

            //Actualizar grdDataServiceComponent
            ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _serviceId);
            grdDataServiceComponent.DataSource = ListServiceComponent;

            grdListaLlamando.Enabled    = false;
            grdLlamandoPaciente.Enabled = true;
            btnRefresh.Enabled          = false;

            chkHability.Enabled = true;

            btnLlamar.Enabled = false;
        }
Example #5
0
        public Yield PutPasswordChange(DreamContext context, DreamMessage request, Result <DreamMessage> response)
        {
            UserBE targetUser = GetUserFromUrlMustExist();
            string password   = request.AsText();

            if (string.IsNullOrEmpty(password))
            {
                throw new UserNewPasswordNotProvidedInvalidArgumentException();
            }
            if (password.Length < 4)
            {
                throw new UserNewPasswordTooShortInvalidArgumentException();
            }

            // Ensure that the password is being set only on local accounts
            ServiceBE s = ServiceBL.GetServiceById(targetUser.ServiceId);

            if (s != null && !ServiceBL.IsLocalAuthService(s))
            {
                throw new UserCanOnlyChangeLocalUserPasswordInvalidOperationException();
            }
            if (UserBL.IsAnonymous(targetUser))
            {
                throw new UserCannotChangeAnonPasswordInvalidOperationException();
            }

            // Admins can always change anyones password.
            if (PermissionsBL.IsUserAllowed(DekiContext.Current.User, Permissions.ADMIN))
            {
                //For admins a currentpassword is option but if given then it should be validated
                string currentPwd = context.GetParam("currentpassword", string.Empty);
                if (!string.IsNullOrEmpty(currentPwd))
                {
                    if (!AuthBL.IsValidAuthenticationForLocalUser(targetUser, currentPwd))
                    {
                        throw new UserCurrentPasswordIncorrectForbiddenException();
                    }
                }
            }
            else if (DekiContext.Current.User.ID == targetUser.ID)
            {
                if (context.GetParam("altpassword", false))
                {
                    throw new UserCannotChangeOwnAltPasswordInvalidOperationException();
                }

                // User changing their own password requires knowledge of their current password
                string currentPwd = context.GetParam("currentpassword");
                if (!AuthBL.IsValidAuthenticationForLocalUser(DekiContext.Current.User, currentPwd))
                {
                    throw new UserCurrentPasswordIncorrectForbiddenException();
                }
            }
            else
            {
                throw new UserMustBeTargetOrAdminForbiddenException();
            }
            bool altPassword = context.GetParam <bool>("altpassword", false);

            targetUser = UserBL.SetPassword(targetUser, password, altPassword);
            if (DekiContext.Current.User.ID == targetUser.ID)
            {
                response.Return(BuildSetAuthTokenResponse(AuthBL.CreateAuthTokenForUser(targetUser), null));
            }
            else
            {
                response.Return(DreamMessage.Ok());
            }
            yield break;
        }
Example #6
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            if (uvValidador.Validate(true, false).IsValid)
            {
                if (double.Parse(txtTalla.Text) < 0.5 || double.Parse(txtTalla.Text) > 2.5)
                {
                    MessageBox.Show("Talla: valor entre 0.5 y 2.5  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (double.Parse(txtPeso.Text) < 1 || double.Parse(txtPeso.Text) > 200)
                {
                    MessageBox.Show("Peso: valor entre 1 y 200  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (txtPerAbd.Text != "")
                {
                    if (double.Parse(txtPerAbd.Text) < 1 || double.Parse(txtPerAbd.Text) > 300)
                    {
                        MessageBox.Show("Perímetro Abdominal: valor entre 1 y 300  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
                if (txtPerCad.Text != "")
                {
                    if (double.Parse(txtPerCad.Text) < 1 || double.Parse(txtPerCad.Text) > 300)
                    {
                        MessageBox.Show("Perímetro Cadera: valor entre 1 y 300  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
                if (txtTemperatura.Text != "")
                {
                    if (double.Parse(txtTemperatura.Text) < 15 || double.Parse(txtTemperatura.Text) > 50)
                    {
                        MessageBox.Show("Temperatura: valor entre 15 y 50  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                if (int.Parse(txtPAS.Text) < 40 || int.Parse(txtPAS.Text) > 350)
                {
                    MessageBox.Show("PAS: valor entre 40 y 350  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (int.Parse(txtPAD.Text) < 40 || int.Parse(txtPAD.Text) > 350)
                {
                    MessageBox.Show("PAD: valor entre 40 y 350  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (txtFrecResp.Text != "")
                {
                    if (int.Parse(txtFrecResp.Text) < 0 || int.Parse(txtFrecResp.Text) > 60)
                    {
                        MessageBox.Show("Frecuencia Respiratoria: valor entre 0 y 60  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                if (txtFrecCard.Text != "")
                {
                    if (int.Parse(txtFrecCard.Text) < 0 || int.Parse(txtFrecCard.Text) > 250)
                    {
                        MessageBox.Show("Frecuencia Cardiaca: valor entre 0 y 250  ", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                OperationResult objOperationResult = new OperationResult();
                ServiceBL       _serviceBL         = new ServiceBL();
                ServiceComponentFieldValuesList        serviceComponentFieldValues      = null;
                ServiceComponentFieldsList             serviceComponentFields           = null;
                List <ServiceComponentFieldValuesList> _serviceComponentFieldValuesList = null;
                List <ServiceComponentFieldsList>      _serviceComponentFieldsList      = null;

                if (_serviceComponentFieldsList == null)
                {
                    _serviceComponentFieldsList = new List <ServiceComponentFieldsList>();
                }


                //Talla**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.ANTROPOMETRIA_TALLA_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtTalla.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);


                //Temperatura**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.FUNCIONES_VITALES_TEMPERATURA_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtTemperatura.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);

                //Peso**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.ANTROPOMETRIA_PESO_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtPeso.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);



                //PAS**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.FUNCIONES_VITALES_PAS_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtPAS.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);


                //IMC**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.ANTROPOMETRIA_IMC_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtImc.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);


                //PAD**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.FUNCIONES_VITALES_PAD_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtPAD.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);



                //Perímetro Abdomen**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.ANTROPOMETRIA_PERIMETRO_ABDOMINAL_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtPerAbd.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);

                //Frecuencia Cardiaca**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.FUNCIONES_VITALES_FREC_CARDIACA_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtFrecCard.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);

                //Perímetro Cadera**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.ANTROPOMETRIA_PERIMETRO_CADERA_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtPerCad.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);

                //Frecuencia Respiratoria**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.FUNCIONES_VITALES_FREC_RESPIRATORIA_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtFrecResp.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);


                //ICC**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.ANTROPOMETRIA_INDICE_CINTURA_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtICC.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);


                //Saturación Oxígeno**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
                serviceComponentFields = new ServiceComponentFieldsList();

                serviceComponentFields.v_ComponentFieldsId  = Constants.FUNCIONES_VITALES_SAT_O2_ID;
                serviceComponentFields.v_ServiceComponentId = _ServiceComponentId;

                _serviceComponentFieldValuesList = new List <ServiceComponentFieldValuesList>();
                serviceComponentFieldValues      = new ServiceComponentFieldValuesList();

                serviceComponentFieldValues.v_ComponentFieldValuesId = null;
                serviceComponentFieldValues.v_Value1 = txtSatOx.Text;
                _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

                serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

                // Agregar a mi lista
                _serviceComponentFieldsList.Add(serviceComponentFields);



                var result = _serviceBL.AddServiceComponentValues(ref objOperationResult,
                                                                  _serviceComponentFieldsList,
                                                                  Globals.ClientSession.GetAsList(),
                                                                  _PersonId,
                                                                  _ServiceComponentId);

                //lIMPIAR LA LISTA DE DXS
                List <DiagnosticRepositoryList> ListaDxByComponent        = new List <DiagnosticRepositoryList>();
                MedicalExamFieldValuesBL        oMedicalExamFieldValuesBL = new MedicalExamFieldValuesBL();
                //Elminar los Dx antiguos
                _serviceBL.EliminarDxAniguosPorComponente(_ServiceId, Constants.FUNCIONES_VITALES_ID, Globals.ClientSession.GetAsList());
                _serviceBL.EliminarDxAniguosPorComponente(_ServiceId, Constants.ANTROPOMETRIA_ID, Globals.ClientSession.GetAsList());
                ListaDxByComponent = new List <DiagnosticRepositoryList>();

                if (txtImc.Text != "")
                {
                    double IMC = double.Parse(txtImc.Text.ToString());
                    DiagnosticRepositoryList DxByComponent = new DiagnosticRepositoryList();

                    List <RecomendationList> Recomendations = new List <RecomendationList>();
                    List <RestrictionList>   Restrictions   = new List <RestrictionList>();

                    DxByComponent.i_AutoManualId         = 1;
                    DxByComponent.i_FinalQualificationId = (int)FinalQualification.Definitivo;
                    DxByComponent.i_PreQualificationId   = 1;
                    DxByComponent.v_ComponentFieldsId    = Constants.ANTROPOMETRIA_IMC_ID;

                    //Obtener el Componente que está amarrado al DX
                    string ComponentDx = oMedicalExamFieldValuesBL.ObtenerComponentDx(Constants.ANTROPOMETRIA_IMC_ID);
                    string DiseasesId  = "";
                    if (IMC <= 18.49)
                    {
                        DiseasesId = "N009-DD000000300";
                    }
                    else if (IMC >= 18.5 && IMC <= 24.99)
                    {
                        DiseasesId = "N009-DD000000788";
                    }
                    else if (IMC >= 25 && IMC <= 29.99)
                    {
                        DiseasesId = "N009-DD000000601";
                    }
                    else if (IMC >= 30 && IMC <= 34.99)
                    {
                        DiseasesId = "N009-DD000000602";
                    }
                    else if (IMC >= 35 && IMC <= 39.99)
                    {
                        DiseasesId = "N009-DD000000603";
                    }
                    else if (IMC >= 40)
                    {
                        DiseasesId = "N009-DD000000604";
                    }
                    string ComponentFieldId = Constants.ANTROPOMETRIA_IMC_ID;

                    DiagnosticRepositoryList oDiagnosticRepositoryListOld = _serviceBL.VerificarDxExistente(_ServiceId, DiseasesId, ComponentDx, ComponentFieldId);
                    if (oDiagnosticRepositoryListOld != null)
                    {
                        oDiagnosticRepositoryListOld.v_DiagnosticRepositoryId = oDiagnosticRepositoryListOld.v_DiagnosticRepositoryId;
                        oDiagnosticRepositoryListOld.i_RecordType             = (int)RecordType.NoTemporal;
                        oDiagnosticRepositoryListOld.i_RecordStatus           = (int)RecordStatus.EliminadoLogico;
                        oDiagnosticRepositoryListOld.i_DiagnosticTypeId       = (int)TipoDx.Enfermedad_Comun;
                        ListaDxByComponent.Add(oDiagnosticRepositoryListOld);
                    }

                    DxByComponent.v_DiagnosticRepositoryId = Guid.NewGuid().ToString();
                    DxByComponent.i_RecordType             = (int)RecordType.Temporal;
                    DxByComponent.i_RecordStatus           = (int)RecordStatus.Agregado;
                    DxByComponent.i_DiagnosticTypeId       = (int)TipoDx.Enfermedad_Comun;



                    DxByComponent.d_ExpirationDateDiagnostic = DateTime.Now;

                    string ComponentFieldValuesId = oMedicalExamFieldValuesBL.ObtenerIdComponentFieldValues(ComponentFieldId, DiseasesId);
                    DxByComponent.v_ComponentFieldValuesId = ComponentFieldValuesId;


                    DxByComponent.v_ComponentId = ComponentDx;
                    DxByComponent.v_DiseasesId  = DiseasesId;
                    DxByComponent.v_ServiceId   = _ServiceId;


                    //Obtener las recomendaciones

                    DxByComponent.Recomendations = oMedicalExamFieldValuesBL.ObtenerListaRecomendaciones(ComponentFieldValuesId, _ServiceId, Constants.FUNCIONES_VITALES_ID);

                    ListaDxByComponent.Add(DxByComponent);



                    //Llenar entidad ServiceComponent
                    servicecomponentDto serviceComponentDto = new servicecomponentDto();
                    serviceComponentDto.v_ServiceComponentId       = _ServiceComponentId;
                    serviceComponentDto.v_Comment                  = "";
                    serviceComponentDto.i_ServiceComponentStatusId = (int)ServiceComponentStatus.Evaluado;
                    serviceComponentDto.i_ExternalInternalId       = (int)ComponenteProcedencia.Interno;
                    serviceComponentDto.i_IsApprovedId             = (int)SiNo.NO;
                    serviceComponentDto.v_ComponentId              = Constants.FUNCIONES_VITALES_ID;
                    serviceComponentDto.v_ServiceId                = _ServiceId;


                    _serviceBL.AddDiagnosticRepository(ref objOperationResult,
                                                       ListaDxByComponent,
                                                       serviceComponentDto,
                                                       Globals.ClientSession.GetAsList(),
                                                       true);
                }

                ListaDxByComponent = new List <DiagnosticRepositoryList>();

                if (txtPAS.Text != "")
                {
                    DiagnosticRepositoryList DxByComponent = new DiagnosticRepositoryList();

                    List <RecomendationList> Recomendations = new List <RecomendationList>();
                    List <RestrictionList>   Restrictions   = new List <RestrictionList>();
                    int PAS = int.Parse(txtPAS.Text.ToString());

                    DxByComponent.i_AutoManualId         = 1;
                    DxByComponent.i_FinalQualificationId = (int)FinalQualification.Definitivo;
                    DxByComponent.i_PreQualificationId   = 1;
                    DxByComponent.v_ComponentFieldsId    = Constants.FUNCIONES_VITALES_PAS_ID;
                    //Obtener el Componente que está amarrado al DX
                    string ComponentDx = oMedicalExamFieldValuesBL.ObtenerComponentDx(Constants.FUNCIONES_VITALES_PAS_ID);
                    string DiseasesId  = "";
                    if (PAS > 140)
                    {
                        DiseasesId = "N009-DD000000606";
                        string ComponentFieldId = Constants.FUNCIONES_VITALES_PAS_ID;

                        DiagnosticRepositoryList oDiagnosticRepositoryListOld = _serviceBL.VerificarDxExistente(_ServiceId, DiseasesId, ComponentDx, ComponentFieldId);
                        if (oDiagnosticRepositoryListOld != null)
                        {
                            oDiagnosticRepositoryListOld.v_DiagnosticRepositoryId = oDiagnosticRepositoryListOld.v_DiagnosticRepositoryId;
                            oDiagnosticRepositoryListOld.i_RecordType             = (int)RecordType.NoTemporal;
                            oDiagnosticRepositoryListOld.i_RecordStatus           = (int)RecordStatus.EliminadoLogico;
                            oDiagnosticRepositoryListOld.i_DiagnosticTypeId       = (int)TipoDx.Enfermedad_Comun;
                            ListaDxByComponent.Add(oDiagnosticRepositoryListOld);
                        }

                        DxByComponent.v_DiagnosticRepositoryId = Guid.NewGuid().ToString();
                        DxByComponent.i_RecordType             = (int)RecordType.Temporal;
                        DxByComponent.i_RecordStatus           = (int)RecordStatus.Agregado;
                        DxByComponent.i_DiagnosticTypeId       = (int)TipoDx.Enfermedad_Comun;



                        DxByComponent.d_ExpirationDateDiagnostic = DateTime.Now;

                        string ComponentFieldValuesId = oMedicalExamFieldValuesBL.ObtenerIdComponentFieldValues(ComponentFieldId, DiseasesId);
                        DxByComponent.v_ComponentFieldValuesId = ComponentFieldValuesId;


                        DxByComponent.v_ComponentId = ComponentDx;
                        DxByComponent.v_DiseasesId  = DiseasesId;
                        DxByComponent.v_ServiceId   = _ServiceId;


                        //Obtener las recomendaciones

                        DxByComponent.Recomendations = oMedicalExamFieldValuesBL.ObtenerListaRecomendaciones(ComponentFieldValuesId, _ServiceId, Constants.FUNCIONES_VITALES_ID);

                        ListaDxByComponent.Add(DxByComponent);

                        //Llenar entidad ServiceComponent
                        servicecomponentDto serviceComponentDto = new servicecomponentDto();
                        serviceComponentDto.v_ServiceComponentId       = _ServiceComponentId;
                        serviceComponentDto.v_Comment                  = "";
                        serviceComponentDto.i_ServiceComponentStatusId = (int)ServiceComponentStatus.Evaluado;
                        serviceComponentDto.i_ExternalInternalId       = (int)ComponenteProcedencia.Interno;
                        serviceComponentDto.i_IsApprovedId             = (int)SiNo.NO;
                        serviceComponentDto.v_ComponentId              = Constants.FUNCIONES_VITALES_ID;
                        serviceComponentDto.v_ServiceId                = _ServiceId;


                        _serviceBL.AddDiagnosticRepository(ref objOperationResult,
                                                           ListaDxByComponent,
                                                           serviceComponentDto,
                                                           Globals.ClientSession.GetAsList(),
                                                           true);
                    }
                }


                ListaDxByComponent = new List <DiagnosticRepositoryList>();
                if (txtICC.Text != "")
                {
                    DiagnosticRepositoryList DxByComponent = new DiagnosticRepositoryList();

                    List <RecomendationList> Recomendations = new List <RecomendationList>();
                    List <RestrictionList>   Restrictions   = new List <RestrictionList>();
                    double ICC = double.Parse(txtICC.Text.ToString());

                    DxByComponent.i_AutoManualId         = 1;
                    DxByComponent.i_FinalQualificationId = (int)FinalQualification.Definitivo;
                    DxByComponent.i_PreQualificationId   = 1;
                    DxByComponent.v_ComponentFieldsId    = Constants.ANTROPOMETRIA_INDICE_CINTURA_ID;
                    //Obtener el Componente que está amarrado al DX
                    string ComponentDx = oMedicalExamFieldValuesBL.ObtenerComponentDx(Constants.ANTROPOMETRIA_INDICE_CINTURA_ID);
                    string DiseasesId  = "";
                    if (ICC > 1)
                    {
                        DiseasesId = "N009-DD000000605";

                        string ComponentFieldId = Constants.ANTROPOMETRIA_INDICE_CINTURA_ID;

                        DiagnosticRepositoryList oDiagnosticRepositoryListOld = _serviceBL.VerificarDxExistente(_ServiceId, DiseasesId, ComponentDx, ComponentFieldId);
                        if (oDiagnosticRepositoryListOld != null)
                        {
                            oDiagnosticRepositoryListOld.v_DiagnosticRepositoryId = oDiagnosticRepositoryListOld.v_DiagnosticRepositoryId;
                            oDiagnosticRepositoryListOld.i_RecordType             = (int)RecordType.NoTemporal;
                            oDiagnosticRepositoryListOld.i_RecordStatus           = (int)RecordStatus.EliminadoLogico;
                            oDiagnosticRepositoryListOld.i_DiagnosticTypeId       = (int)TipoDx.Enfermedad_Comun;
                            ListaDxByComponent.Add(oDiagnosticRepositoryListOld);
                        }

                        DxByComponent.v_DiagnosticRepositoryId = Guid.NewGuid().ToString();
                        DxByComponent.i_RecordType             = (int)RecordType.Temporal;
                        DxByComponent.i_RecordStatus           = (int)RecordStatus.Agregado;
                        DxByComponent.i_DiagnosticTypeId       = (int)TipoDx.Enfermedad_Comun;



                        DxByComponent.d_ExpirationDateDiagnostic = DateTime.Now;

                        string ComponentFieldValuesId = oMedicalExamFieldValuesBL.ObtenerIdComponentFieldValues(ComponentFieldId, DiseasesId);
                        DxByComponent.v_ComponentFieldValuesId = ComponentFieldValuesId;


                        DxByComponent.v_ComponentId = ComponentDx;
                        DxByComponent.v_DiseasesId  = DiseasesId;
                        DxByComponent.v_ServiceId   = _ServiceId;


                        //Obtener las recomendaciones

                        DxByComponent.Recomendations = oMedicalExamFieldValuesBL.ObtenerListaRecomendaciones(ComponentFieldValuesId, _ServiceId, Constants.FUNCIONES_VITALES_ID);

                        ListaDxByComponent.Add(DxByComponent);

                        //Llenar entidad ServiceComponent
                        servicecomponentDto serviceComponentDto = new servicecomponentDto();
                        serviceComponentDto.v_ServiceComponentId       = _ServiceComponentId;
                        serviceComponentDto.v_Comment                  = "";
                        serviceComponentDto.i_ServiceComponentStatusId = (int)ServiceComponentStatus.Evaluado;
                        serviceComponentDto.i_ExternalInternalId       = (int)ComponenteProcedencia.Interno;
                        serviceComponentDto.i_IsApprovedId             = (int)SiNo.NO;
                        serviceComponentDto.v_ComponentId              = Constants.FUNCIONES_VITALES_ID;
                        serviceComponentDto.v_ServiceId                = _ServiceId;


                        _serviceBL.AddDiagnosticRepository(ref objOperationResult,
                                                           ListaDxByComponent,
                                                           serviceComponentDto,
                                                           Globals.ClientSession.GetAsList(),
                                                           true);
                    }
                }
                _serviceBL.ActualizarEstadoComponentesPorCategoria(ref objOperationResult, 10, _ServiceId, (int)ServiceComponentStatus.Evaluado, Globals.ClientSession.GetAsList());


                MessageBox.Show("Los datos se grabaron correctamente", "VALIDACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Por favor corrija la información ingresada. Vea los indicadores de error.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #7
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            OperationResult     objOperationResult     = new OperationResult();
            CalendarBL          objCalendarBL          = new CalendarBL();
            ServiceBL           objServiceBL           = new ServiceBL();
            servicecomponentDto objservicecomponentDto = new servicecomponentDto();
            List <CalendarList> objCalendarList        = new List <CalendarList>();

            objCalendarList = objCalendarBL.GetCallPacientPagedAndFilteredGroupByCategoryId(ref objOperationResult, 0, null, "", "");

            if (objCalendarList == null)
            {
                return;
            }

            grdData.DataSource = objCalendarList;

            foreach (var item in objCalendarList)
            {
                if (item.i_QueueStatusId == (int)QueueStatusId.LLAMANDO && item.i_Iscalling == (int)SiNo.NO)
                {
                    string Repetitions = ConfigurationManager.AppSettings["Repetitions"];

                    for (int i = 0; i < int.Parse(Repetitions.ToString()); i++)
                    {
                        WindowsMediaPlayer wplayer = new WindowsMediaPlayer();

                        wplayer.URL = PathSound;

                        wplayer.controls.play();

                        string VTrabajador;

                        if (item.i_Gender == (int)Common.Gender.MASCULINO)
                        {
                            VTrabajador = "Trabajador";
                        }
                        else
                        {
                            VTrabajador = "Trabajadora";
                        }

                        if (item.v_NameOffice == "--Seleccionar--")
                        {
                            synth.SpeakAsync(string.Format(CallFormat, item.v_Pacient, item.v_OfficeNumber, item.v_CategoryName, VTrabajador));
                        }
                        else
                        {
                            synth.SpeakAsync(string.Format(CallFormat, item.v_Pacient, item.v_OfficeNumber + "," + item.v_NameOffice));
                        }
                    }
                }
            }

            List <CalendarList> x = objCalendarBL.GetCallPacientPagedAndFiltered(ref objOperationResult, 0, null, "", "");

            foreach (var item in x)
            {
                //Se actualiza el Flag de IsCalling para saber que el paciente ya ha sido llamado una vez
                string ServiceComponentId = item.v_ServiceComponentId;

                //if (NroTv =="1")
                //{
                objServiceBL.UpdateServiceComponentVisor(ref objOperationResult, ServiceComponentId, (int)SiNo.SI);
                //}
                //else if (NroTv == "2")
                //{
                //    objServiceBL.UpdateServiceComponentVisor_(ref objOperationResult, ServiceComponentId, (int)SiNo.SI);
                //}
            }
        }
Example #8
0
        private void Liberar()
        {
            try
            {
                OperationResult objOperationResult = new OperationResult();
                ServiceBL       objServiceBL       = new ServiceBL();
                _ServiceComponentId = new List <string>();

                servicecomponentDto         objservicecomponentDto = null;
                List <ServiceComponentList> ListServiceComponent   = new List <ServiceComponentList>();


                if (grdDataServiceComponent.Rows.Count() == 0)
                {
                    MessageBox.Show("Debe seleccionar un paciente para poder LIBERARLO", "ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (_categoryId == -1)
                {
                    _ServiceComponentId.Add(grdLlamandoPaciente.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString());
                }
                else
                {
                    var servCompCat = objServiceBL.GetServiceComponentByCategoryId(ref objOperationResult, _categoryId, _serviceId);

                    foreach (var item in servCompCat)
                    {
                        _ServiceComponentId.Add(item.v_ServiceComponentId);
                    }
                }

                List <servicecomponentDto> list = new List <servicecomponentDto>();

                for (int i = 0; i < _ServiceComponentId.Count; i++)
                {
                    objservicecomponentDto = new servicecomponentDto();
                    objservicecomponentDto.v_ServiceComponentId       = _ServiceComponentId[i];
                    objservicecomponentDto.i_QueueStatusId            = (int)Common.QueueStatusId.LIBRE;
                    objservicecomponentDto.i_Iscalling                = (int)SiNo.NO;
                    objservicecomponentDto.i_Iscalling_1              = (int)SiNo.NO;
                    objservicecomponentDto.d_EndDate                  = DateTime.Now;
                    objservicecomponentDto.i_ServiceComponentStatusId = (int)Common.ServiceComponentStatus.PorAprobacion;



                    list.Add(objservicecomponentDto);
                    //Buscar en la lista y reemplazar el i_QueueStatusId

                    foreach (var item in _objCalendarListAMC.Where(c => c.v_ServiceComponentId == _ServiceComponentId[i]))
                    {
                        item.i_QueueStatusId = (int)Common.QueueStatusId.LIBRE;
                    }
                }

                // update
                if (_componentName == "LABORATORIO")
                {
                    objServiceBL.UpdateServiceComponentOfficeLaboratorio(list);
                }
                else
                {
                    objServiceBL.UpdateServiceComponentOffice(list);
                }


                #region Check de salir de circuito

                if (chkHability.Checked == true) // finaliza el servicio y actualiza el estado del servicio
                {
                    if (ddlServiceStatusId.SelectedValue.ToString() == ((int)ServiceStatus.Iniciado).ToString())
                    {
                        MessageBox.Show("Debe elegir cualquier otro estado que no sea (Iniciado)\nSi desea Liberar y/o Finalizar Circuito.", "ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    serviceDto objserviceDto = new serviceDto();

                    objserviceDto.v_ServiceId       = _serviceId;
                    objserviceDto.i_ServiceStatusId = int.Parse(ddlServiceStatusId.SelectedValue.ToString());
                    objserviceDto.v_Motive          = txtReason.Text;

                    objServiceBL.UpdateServiceOffice(ref objOperationResult, objserviceDto, Globals.ClientSession.GetAsList());

                    //Actualizamos el estado de la linea de la agenda como fuera de circuito
                    CalendarBL  objCalendarBL  = new CalendarBL();
                    calendarDto objcalendarDto = new calendarDto();
                    objcalendarDto = objCalendarBL.GetCalendar(ref objOperationResult, _CalendarId);
                    objcalendarDto.i_LineStatusId = 2;// int.Parse(Common.LineStatus.FueraCircuito.ToString());
                    objCalendarBL.UpdateCalendar(ref objOperationResult, objcalendarDto, Globals.ClientSession.GetAsList());
                }

                #endregion

                //Actualizar grdDataServiceComponent

                ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _serviceId);
                grdDataServiceComponent.DataSource = ListServiceComponent;

                btnRefresh_Click(null, null);

                txtReason.Text           = "";
                grdListaLlamando.Enabled = true;
                //grdLlamandoPaciente.Enabled = false;
                btnRefresh.Enabled  = true;
                chkHability.Enabled = false;
                chkHability.Checked = false;
                groupBox3.Enabled   = false;

                List <CalendarList> GrillaVacia = new List <CalendarList>();
                grdLlamandoPaciente.DataSource = GrillaVacia;

                _objCalendarListAMC.RemoveAll(x => x.i_QueueStatusId == 1);
                grdLlamandoPaciente.DataSource = _objCalendarListAMC;
                //grdLlamandoPaciente.DataSource = _objCalendarListAMC.FindAll(p => p.i_QueueStatusId != 1);

                //grdLlamandoPaciente.DataSource = new List<CalendarList>();

                if (_objCalendarListAMC.Count == 0)
                {
                    if (_objCalendarListAMC.Count > 0)
                    {
                        grdLlamandoPaciente.Rows[0].Selected = true;
                    }

                    btnRellamar.Enabled                 = false;
                    btnAtenderVerServicio.Enabled       = false;
                    btnLiberarFinalizarCircuito.Enabled = false;
                    grdLlamandoPaciente.Enabled         = false;
                    //grdLlamandoPaciente_Click(null, null);
                }

                else
                {
                    grdLlamandoPaciente.Rows[0].Selected = true;
                }

                //grdLlamandoPaciente.DataSource = new List<CalendarList>();
            }
            catch (Exception ex)
            {
                MessageBox.Show(Common.Utils.ExceptionFormatter(ex), "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #9
0
        private void Llamar()
        {
            OperationResult             objOperationResult   = new OperationResult();
            List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();
            CalendarBL          objCalendarBL   = new CalendarBL();
            CalendarList        objCalendar     = new CalendarList();
            List <CalendarList> objCalendarList = new List <CalendarList>();
            ProtocolBL          oProtocolBL     = new ProtocolBL();

            ServiceBL           objServiceBL           = new ServiceBL();
            servicecomponentDto objservicecomponentDto = new servicecomponentDto();

            _ServiceComponentId = new List <string>();
            // Verificar si un componente está en la categoría
            MedicalExamBL oMedicalExamBL = new MedicalExamBL();


            //Verificar si el paciente ya ha sido llamado en la BD y no en la temporal



            //var Resultado = objServiceBL.VerificarSiPacienteNoPuedeSerLlamado(grdListaLlamando.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString());
            ////var Resultado = _objCalendarListAMC.Find(p => p.v_ServiceId == grdListaLlamando.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString());
            //if (Resultado != null)
            //{
            //    MessageBox.Show("Usted ya llamó al paciente o el paciente está siendo llamdo por otro consultorio.", "ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

            //    //grdListaLlamando.Enabled = false;
            //    grdLlamandoPaciente.Enabled = true;
            //    //btnRefresh.Enabled = false;

            //    chkHability.Enabled = true;

            //    btnLlamar.Enabled = false;
            //    btnRefresh_Click(null, null);

            //    if (grdLlamandoPaciente.Rows.Count > 0)
            //    {
            //        grdLlamandoPaciente.Rows[0].Selected = true;
            //        btnRellamar.Enabled = true;
            //        btnAtenderVerServicio.Enabled = true;
            //        btnLiberarFinalizarCircuito.Enabled = true;
            //    }
            //    return;
            //}


            Boolean Resultado1 = oMedicalExamBL.VerificarComponentePorCategoria(_categoriaId, Constants.ELECTROCARDIOGRAMA_ID);

            if (Resultado1)
            {
                List <ServiceComponentFieldValuesList> Valores = objServiceBL.ValoresComponente(_serviceId, Constants.ANTROPOMETRIA_ID);
                if (Valores.Count != 0)
                {
                    decimal ValorIMCServicio  = decimal.Parse(Valores.Find(p => p.v_ComponentFieldId == Constants.ANTROPOMETRIA_IMC_ID).v_Value1.ToString());
                    decimal ValorIMCProtocolo = decimal.Parse(oProtocolBL.GetProtocolComponentByProtocol(ref objOperationResult, _ProtocolId, Constants.ELECTROCARDIOGRAMA_ID).r_Imc.ToString());

                    if (ValorIMCServicio < ValorIMCProtocolo)
                    {
                        MessageBox.Show("El I.M.C. del paciente tiene valores normales, no aplica para este examen", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                        return;
                    }
                }
            }

            //Validación de Piso
            if (_Piso != "-1")
            {
                var ResultPiso = objServiceBL.PermitirLlamar(_serviceId, int.Parse(_Piso.ToString()));
                if (!ResultPiso)
                {
                    MessageBox.Show("El Paciente tiene consultorios por culminar, antes de ser llamado por este. Verifíquelo en unos minutos", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    return;
                }
            }

            if (int.Parse(_serviceStatusId) == (int)ServiceStatus.EsperandoAptitud)
            {
                MessageBox.Show("Este paciente ya tiene el servicio en espera de Aptitud, no puede ser llamado.", "INFORMACIÓN!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                return;
            }

            if (_IsCall == "OcupadoLlamado")
            {
                DialogResult Result = MessageBox.Show("Este paciente está ocupado en otro consultorio. Para llamarlo de todas formas seleccione SÍ", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (Result == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
            }


            List <CalendarList> GrillaVacia = new List <CalendarList>();

            grdLlamandoPaciente.DataSource = GrillaVacia;
            grdLlamandoPaciente.ClearUndoHistory();
            // Cargar grilla de llamando al paciente  ************
            _objCalendarListAMC.Add(objCalendar);
            grdLlamandoPaciente.DataSource = _objCalendarListAMC;
            //*******************************************************

            objCalendar.v_Pacient                 = grdListaLlamando.Selected.Rows[0].Cells["v_Pacient"].Value.ToString();
            objCalendar.v_OrganizationName        = grdListaLlamando.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString();
            objCalendar.v_ServiceComponentId      = grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString();
            objCalendar.v_ServiceId               = grdListaLlamando.Selected.Rows[0].Cells["v_ServiceId"].Value.ToString();
            objCalendar.d_Birthdate               = DateTime.Parse(grdListaLlamando.Selected.Rows[0].Cells["d_Birthdate"].Value.ToString());
            objCalendar.v_DocNumber               = grdListaLlamando.Selected.Rows[0].Cells["v_DocNumber"].Value.ToString();
            objCalendar.v_WorkingOrganizationName = grdListaLlamando.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString();
            objCalendar.v_ProtocolName            = grdListaLlamando.Selected.Rows[0].Cells["v_ProtocolName"].Value.ToString();
            objCalendar.v_ProtocolId              = grdListaLlamando.Selected.Rows[0].Cells["v_ProtocolId"].Value.ToString();
            objCalendar.v_EsoTypeName             = grdListaLlamando.Selected.Rows[0].Cells["v_EsoTypeName"].Value.ToString();
            objCalendar.v_PersonId                = grdListaLlamando.Selected.Rows[0].Cells["v_PersonId"].Value.ToString();
            objCalendar.i_QueueStatusId           = (int)QueueStatusId.LLAMANDO;

            if (_categoryId == -1)
            {
                _ServiceComponentId.Add(grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString());
            }
            else
            {
                foreach (var item in objServiceBL.GetServiceComponentByCategoryId(ref objOperationResult, _categoryId, _serviceId))
                {
                    _ServiceComponentId.Add(item.v_ServiceComponentId);
                }
            }



            for (int i = 0; i < _ServiceComponentId.Count; i++)
            {
                objservicecomponentDto = new servicecomponentDto();
                objservicecomponentDto.v_ServiceComponentId = _ServiceComponentId[i];
                objservicecomponentDto.i_QueueStatusId      = (int)Common.QueueStatusId.LLAMANDO;
                objservicecomponentDto.v_NameOfice          = cbOficina.Text.ToString();
                objServiceBL.UpdateServiceComponentOfficeLlamando(objservicecomponentDto);
            }

            //Actualizar grdDataServiceComponent
            ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _serviceId);
            grdDataServiceComponent.DataSource = ListServiceComponent;

            //grdListaLlamando.Enabled = false;
            grdLlamandoPaciente.Enabled = true;
            //btnRefresh.Enabled = false;

            chkHability.Enabled = true;

            btnLlamar.Enabled = false;
        }
        public List <ServiceOrderList> GetReportCotizacionConsolidado(string pstServiceOrderId)
        {
            //mon.IsActive = true;
            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();
                //var LogoEmpresa = GetLogoMedicalCenter();
                var MedicalCenter = new ServiceBL().GetInfoMedicalCenter();

                var query = from A in dbContext.serviceorderdetail
                            join B in dbContext.protocol on A.v_ProtocolId equals B.v_ProtocolId
                            join C in dbContext.serviceorder on A.v_ServiceOrderId equals C.v_ServiceOrderId
                            join E in dbContext.organization on B.v_CustomerOrganizationId equals E.v_OrganizationId
                            join I in dbContext.groupoccupation on B.v_GroupOccupationId equals I.v_GroupOccupationId
                            join F in dbContext.systemparameter on new { a = B.i_EsoTypeId.Value, b = 118 } equals new { a = F.i_ParameterId, b = F.i_GroupId }
                join J1 in dbContext.systemuser on new { i_InsertUserId = A.i_InsertUserId.Value }

                equals new { i_InsertUserId = J1.i_SystemUserId } into J1_join
                from J1 in J1_join.DefaultIfEmpty()

                join J2 in dbContext.systemuser on new { i_UpdateUserId = A.i_UpdateUserId.Value }
                equals new { i_UpdateUserId = J2.i_SystemUserId } into J2_join
                from J2 in J2_join.DefaultIfEmpty()

                join su in dbContext.systemuser on C.i_InsertUserId.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()

                where A.i_IsDeleted == 0 && A.v_ServiceOrderId == pstServiceOrderId
                    select new ServiceOrderList
                {
                    v_ServiceOrderId     = A.v_ServiceOrderId,
                    v_ProtocolId         = A.v_ProtocolId,
                    v_Protocol           = B.v_Name,
                    r_Price              = A.r_ProtocolPrice,
                    CantidadTrabajadores = A.i_NumberOfWorkerProtocol,
                    v_Organization       = E.v_Name,
                    RucCliente           = E.v_IdentificationNumber,
                    v_Address            = E.v_Address,
                    d_InsertDate         = C.d_InsertDate.Value,
                    EmpresaPropietaria   = MedicalCenter.v_Name,
                    GESO      = I.v_Name,
                    v_EsoType = F.v_Value1,
                    EmpresaPropietariaDireccion = MedicalCenter.v_Address,
                    EmpresaPropietariaTelefono  = MedicalCenter.v_PhoneNumber,
                    EmpresaPropietariaEmail     = MedicalCenter.v_Mail,
                    Firma = pr.b_SignatureImage,
                };

                //var query = from A in dbContext.serviceorder
                //            join A1 in dbContext.serviceorderdetail on new { a = pstServiceOrderId} equals new { a = A1.v_ServiceOrderId}
                //            join B in dbContext.systemparameter on new { a = A.i_ServiceOrderStatusId.Value, b = 194 } equals new { a = B.i_ParameterId, b = B.i_GroupId }
                //            join C in dbContext.serviceorderdetail on A.v_ServiceOrderId equals C.v_ServiceOrderId
                //            join D in dbContext.protocol on C.v_ProtocolId equals D.v_ProtocolId
                //            join E in dbContext.organization on D.v_CustomerOrganizationId equals E.v_OrganizationId
                //            join F in dbContext.systemparameter on new { a = D.i_EsoTypeId.Value, b = 118 } equals new { a = F.i_ParameterId, b = F.i_GroupId }
                //            join G in dbContext.protocolcomponent on D.v_ProtocolId equals G.v_ProtocolId
                //            join H in dbContext.component on G.v_ComponentId equals H.v_ComponentId
                //            join I in dbContext.groupoccupation on D.v_GroupOccupationId equals I.v_GroupOccupationId
                //            join J1 in dbContext.systemuser on new { i_InsertUserId = A.i_InsertUserId.Value }

                //                                            equals new { i_InsertUserId = J1.i_SystemUserId } into J1_join
                //            from J1 in J1_join.DefaultIfEmpty()

                //            join J2 in dbContext.systemuser on new { i_UpdateUserId = A.i_UpdateUserId.Value }
                //                                            equals new { i_UpdateUserId = J2.i_SystemUserId } into J2_join
                //            from J2 in J2_join.DefaultIfEmpty()
                //            join su in dbContext.systemuser on A.i_InsertUserId.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()
                //            where A.i_IsDeleted == 0 && A.v_ServiceOrderId == pstServiceOrderId
                //            //&& G.i_IsDeleted == 0
                //            //&& D.v_ProtocolId == pstrProtocolId

                //            select new ServiceOrderList
                //            {
                //                v_ServiceOrderId = A.v_ServiceOrderId,
                //                v_CustomServiceOrderId = A.v_CustomServiceOrderId,
                //                v_Description = A.v_Description,
                //                v_Comentary = A.v_Comentary,
                //                i_NumberOfWorker = A1.i_NumberOfWorkerProtocol,
                //                r_TotalCost = A1.r_Total,
                //                d_DeliveryDate = A.d_DeliveryDate,
                //                RucCliente = E.v_IdentificationNumber,
                //                i_ServiceOrderStatusId = A.i_ServiceOrderStatusId,
                //                v_ServiceOrderStatusName = B.v_Value1,
                //                v_CreationUser = J1.v_UserName,
                //                v_UpdateUser = J2.v_UserName,
                //                d_CreationDate = A.d_InsertDate,
                //                d_UpdateDate = A.d_UpdateDate,
                //                v_ProtocolId = C.v_ProtocolId,
                //                v_Protocol = D.v_Name,
                //                v_Organization = E.v_Name,
                //                v_ContacName = E.v_ContacName,
                //                v_Address = E.v_Address,
                //                v_EsoType = F.v_Value1,
                //                v_ComponentName = H.v_Name,
                //                r_Price = G.r_Price, // H.r_BasePrice.Value,
                //                d_InsertDate = A.d_InsertDate.Value,
                //                Logo = MedicalCenter.b_Image,
                //                EmpresaPropietaria = MedicalCenter.v_Name,
                //                EmpresaPropietariaDireccion = MedicalCenter.v_Address,
                //                EmpresaPropietariaTelefono = MedicalCenter.v_PhoneNumber,
                //                EmpresaPropietariaEmail = MedicalCenter.v_Mail,
                //                GESO = I.v_Name,
                //                Firma = pr.b_SignatureImage,

                //            };
                List <ServiceOrderList> objData = query.ToList();
                return(objData);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Example #11
0
        private void btnCustionarioNordico_Click(object sender, EventArgs e)
        {
            ServiceBL o = new ServiceBL();

            o.GetReportCuestionarioNordico("N009-SR000002065", "");
        }
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();
            ServiceBL       _serviceBL         = new ServiceBL();

            Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList        serviceComponentFieldValues      = null;
            Sigesoft.Node.WinClient.BE.ServiceComponentFieldsList             serviceComponentFields           = null;
            List <Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList> _serviceComponentFieldValuesList = null;
            List <Sigesoft.Node.WinClient.BE.ServiceComponentFieldsList>      _serviceComponentFieldsList      = null;

            if (_serviceComponentFieldsList == null)
            {
                _serviceComponentFieldsList = new List <Sigesoft.Node.WinClient.BE.ServiceComponentFieldsList>();
            }



            //Rítmo**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
            serviceComponentFields = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldsList();

            serviceComponentFields.v_ComponentFieldsId  = Constants.ELECTROCARDIOGRAMA_ONDA_P_ID;
            serviceComponentFields.v_ServiceComponentId = Session["ServiceComponentId"].ToString();

            _serviceComponentFieldValuesList = new List <Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList>();
            serviceComponentFieldValues      = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList();

            serviceComponentFieldValues.v_ComponentFieldValuesId = null;
            serviceComponentFieldValues.v_Value1 = dllRitmo.SelectedValue.ToString();
            _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

            serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

            // Agregar a mi lista
            _serviceComponentFieldsList.Add(serviceComponentFields);


            //Frecuencia**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
            serviceComponentFields = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldsList();

            serviceComponentFields.v_ComponentFieldsId  = Constants.ELECTROCARDIOGRAMA_RITMO_SINUAL_ID;
            serviceComponentFields.v_ServiceComponentId = Session["ServiceComponentId"].ToString();

            _serviceComponentFieldValuesList = new List <Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList>();
            serviceComponentFieldValues      = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList();

            serviceComponentFieldValues.v_ComponentFieldValuesId = null;
            serviceComponentFieldValues.v_Value1 = txtFrecuencia.Text;
            _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

            serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

            // Agregar a mi lista
            _serviceComponentFieldsList.Add(serviceComponentFields);



            //SEGMENTO PR**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
            serviceComponentFields = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldsList();

            serviceComponentFields.v_ComponentFieldsId  = Constants.ELECTROCARDIOGRAMA_INTERVALO_PR_ID;
            serviceComponentFields.v_ServiceComponentId = Session["ServiceComponentId"].ToString();

            _serviceComponentFieldValuesList = new List <Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList>();
            serviceComponentFieldValues      = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList();

            serviceComponentFieldValues.v_ComponentFieldValuesId = null;
            serviceComponentFieldValues.v_Value1 = txtSegPR.Text;
            _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

            serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

            // Agregar a mi lista
            _serviceComponentFieldsList.Add(serviceComponentFields);



            //ONDA QRS**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
            serviceComponentFields = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldsList();

            serviceComponentFields.v_ComponentFieldsId  = Constants.ELECTROCARDIOGRAMA_COMPLEJO_QRS_ANORMAL_ID;
            serviceComponentFields.v_ServiceComponentId = Session["ServiceComponentId"].ToString();

            _serviceComponentFieldValuesList = new List <Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList>();
            serviceComponentFieldValues      = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList();

            serviceComponentFieldValues.v_ComponentFieldValuesId = null;
            serviceComponentFieldValues.v_Value1 = txtOndaQRS.Text;
            _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

            serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

            // Agregar a mi lista
            _serviceComponentFieldsList.Add(serviceComponentFields);



            //SEGEMENTO QT**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
            serviceComponentFields = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldsList();

            serviceComponentFields.v_ComponentFieldsId  = Constants.ELECTROCARDIOGRAMA_INTERVALO_QT_ID;
            serviceComponentFields.v_ServiceComponentId = Session["ServiceComponentId"].ToString();

            _serviceComponentFieldValuesList = new List <Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList>();
            serviceComponentFieldValues      = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList();

            serviceComponentFieldValues.v_ComponentFieldValuesId = null;
            serviceComponentFieldValues.v_Value1 = txtSegQT.Text;
            _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

            serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

            // Agregar a mi lista
            _serviceComponentFieldsList.Add(serviceComponentFields);



            //EJE ORS**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
            serviceComponentFields = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldsList();

            serviceComponentFields.v_ComponentFieldsId  = Constants.ELECTROCARDIOGRAMA_OTROS2_ID;
            serviceComponentFields.v_ServiceComponentId = Session["ServiceComponentId"].ToString();

            _serviceComponentFieldValuesList = new List <Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList>();
            serviceComponentFieldValues      = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList();

            serviceComponentFieldValues.v_ComponentFieldValuesId = null;
            serviceComponentFieldValues.v_Value1 = txtEjeORS.Text;
            _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

            serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

            // Agregar a mi lista
            _serviceComponentFieldsList.Add(serviceComponentFields);



            //CONCLUSIONES**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
            serviceComponentFields = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldsList();

            serviceComponentFields.v_ComponentFieldsId  = Constants.ELECTROCARDIOGRAMA_ONDA_T_ID;
            serviceComponentFields.v_ServiceComponentId = Session["ServiceComponentId"].ToString();

            _serviceComponentFieldValuesList = new List <Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList>();
            serviceComponentFieldValues      = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList();

            serviceComponentFieldValues.v_ComponentFieldValuesId = null;
            serviceComponentFieldValues.v_Value1 = dllConclusiones.SelectedValue.ToString();
            _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

            serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

            // Agregar a mi lista
            _serviceComponentFieldsList.Add(serviceComponentFields);



            //DESCRIPCIÓN**-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-
            serviceComponentFields = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldsList();

            serviceComponentFields.v_ComponentFieldsId  = Constants.ELECTROCARDIOGRAMA_DESCRIPCION_ID;
            serviceComponentFields.v_ServiceComponentId = Session["ServiceComponentId"].ToString();

            _serviceComponentFieldValuesList = new List <Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList>();
            serviceComponentFieldValues      = new Sigesoft.Node.WinClient.BE.ServiceComponentFieldValuesList();

            serviceComponentFieldValues.v_ComponentFieldValuesId = null;
            serviceComponentFieldValues.v_Value1 = txtDescripcion.Text;
            _serviceComponentFieldValuesList.Add(serviceComponentFieldValues);

            serviceComponentFields.ServiceComponentFieldValues = _serviceComponentFieldValuesList;

            // Agregar a mi lista
            _serviceComponentFieldsList.Add(serviceComponentFields);



            var result = _serviceBL.AddServiceComponentValues(ref objOperationResult,
                                                              _serviceComponentFieldsList,
                                                              ((ClientSession)Session["objClientSession"]).GetAsList(),
                                                              Session["IdTrabajador"].ToString(),
                                                              Session["ServiceComponentId"].ToString());


            Alert.ShowInTop("Datos grabados correctamente.");
        }
        private void ShowReport()
        {
            List <string>   _filesNameToMerge  = new List <string>();
            OperationResult objOperationResult = new OperationResult();

            string ruta = Common.Utils.GetApplicationConfigValue("Interconsulta").ToString();
            var    aptitudeCertificate = new ServiceBL().GetReportInterconsulta(_serviceId, _Altitud, _Especialidad, _Labor, _Solicita, _Observaciones);

            //Verificar si el reporte existe en el repositorio
            string findReportInter = ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + ".pdf";

            string[] files    = Directory.GetFiles(ruta, "*.pdf");
            int      strIndex = 0;

            for (int i = 0; i < files.Length; i++)
            {
                strIndex = files[i].IndexOf(findReportInter);
                if (strIndex >= 0)
                {
                    File.Copy(findReportInter, ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + "_antiguo.pdf");
                    _filesNameToMerge.Add(ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + "_antiguo.pdf");
                }
            }

            //Crear el nuevo reporte Interconsulta
            var    rp = new Reports.crReporteInterconsulta();
            string RutaReportInterNew = ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + "_nuevo.pdf";

            DataSet   ds1 = new DataSet();
            DataTable dt  = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(aptitudeCertificate);

            dt.TableName = "dtInterconsulta";
            ds1.Tables.Add(dt);

            DataTable dt1 = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(_Lista);

            dt1.TableName = "dtDxs";
            ds1.Tables.Add(dt1);

            rp.SetDataSource(ds1);
            rp.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, RutaReportInterNew);

            //crystalReportViewer1.ReportSource = rp;
            //crystalReportViewer1.Show();

            //Agregar el nuevo reporte a la lista para unir PDFs
            _filesNameToMerge.Add(RutaReportInterNew);

            //Fusionar los reportes de la lista en un solo PDF
            var x = _filesNameToMerge.ToList();

            _mergeExPDF.FilesName = x;
            //_mergeExPDF.DestinationFile = Application.StartupPath + @"\TempMerge\" + _serviceId + "-" + aptitudeCertificate[0].Paciente +".pdf"; ;
            _mergeExPDF.DestinationFile = ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + ".pdf";
            _mergeExPDF.Execute();
            _mergeExPDF.RunFile();

            //Borrar temporal creadas
            System.IO.File.Delete(ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + "_nuevo.pdf");
            System.IO.File.Delete(ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + "_antiguo.pdf");
        }
        private void btnDoctor_Click(object sender, EventArgs e)
        {
            using (new LoadingClass.PleaseWait(this.Location, "Generando..."))
            {
                this.Enabled = false;

                var MedicalCenter = _serviceBL.GetInfoMedicalCenter();

                var lista = _hospitBL.GetHospitalizcion(ref _objOperationResult, hospiId);

                //var serviceId = lista.SelectMany(p => p.Servicios.Select(q=>q.v_ServiceId));
                int doctor = 1;
                hospser = _hospitBL.GetHospitServ(hospiId);

                var datosP = _pacientBL.DevolverDatosPaciente(hospser.v_ServiceId);

                string      ruta       = Common.Utils.GetApplicationConfigValue("rutaLiquidacion").ToString();
                ServiceList personData = _serviceBL.GetServicePersonData(ref objOperationResult, hospser.v_ServiceId);

                var    hospitalizacion           = _hospitBL.GetHospitalizacion(ref objOperationResult, hospiId);
                var    hospitalizacionhabitacion = _hospitBL.GetHospitalizacionHabitacion(ref objOperationResult, hospiId);
                var    medicoTratante            = new ServiceBL().GetMedicoTratante(hospser.v_ServiceId);
                string nombre = personData.v_DocNumber + "_" + personData.v_ProtocolName + "-LiquMédico";

                #region MANDAR PRECIO A BASE
                decimal totalFinal = 0;
                foreach (var hospitalizacion_precios in lista)
                {
                    var     ListaServicios       = hospitalizacion_precios.Servicios.FindAll(p => p.v_ServiceId != null);
                    decimal totalParcialMedicina = 0;
                    decimal sumaMedicina         = 0;
                    decimal sumaServicio         = 0;
                    foreach (var servicios in ListaServicios)
                    {
                        if (servicios.Tickets != null)
                        {
                            var ListaTickets = servicios.Tickets.FindAll(p => p.i_conCargoA == 1);
                            if (ListaTickets.Count() >= 1)
                            {
                                foreach (var tickets in ListaTickets)
                                {
                                    var detalletickets = tickets.Productos.FindAll(p => p.d_Cantidad != 0);
                                    foreach (var Detalle in detalletickets)
                                    {
                                        int cantidad = (int)Detalle.d_Cantidad;
                                        totalParcialMedicina = (decimal)(Detalle.d_PrecioVenta * cantidad);
                                        sumaMedicina        += (decimal)totalParcialMedicina;
                                    }
                                }
                            }
                            else
                            {
                                totalParcialMedicina = decimal.Round(totalParcialMedicina, 2);
                            }
                        }

                        var ListaComponentes = servicios.Componentes.FindAll(p => p.Precio != 0 && p.i_conCargoA == 1);
                        foreach (var compo in ListaComponentes)
                        {
                            decimal compoPrecio = (decimal)compo.Precio;
                            sumaServicio += compoPrecio;
                        }
                    }

                    decimal totalParcialHabitacion = 0;
                    decimal sumaHabitacion         = 0;
                    var     ListaHabitaciones      = hospitalizacion_precios.Habitaciones.FindAll(p => p.i_conCargoA == 1);

                    foreach (var habitacion in ListaHabitaciones)
                    {
                        DateTime inicio = habitacion.d_StartDate.Value.Date;
                        DateTime fin;

                        if (habitacion.d_EndDate != null || habitacion.d_EndDate.ToString() == "00/00/0000 0:0:0")
                        {
                            fin = habitacion.d_EndDate.Value.Date;
                        }
                        else
                        {
                            fin = DateTime.Now.Date;
                        }

                        TimeSpan nDias = fin - inicio;

                        int tSpan = nDias.Days;

                        //+ 1
                        int dias = 0;
                        if (tSpan == 0)
                        {
                            dias = tSpan + 1;
                        }
                        else
                        {
                            dias = tSpan;
                        }

                        decimal _habitacionPrecio = (decimal)habitacion.d_Precio;
                        _habitacionPrecio = decimal.Round(_habitacionPrecio, 2);

                        totalParcialHabitacion = (decimal)(habitacion.d_Precio * dias);
                        totalParcialHabitacion = decimal.Round(totalParcialHabitacion, 2);

                        sumaHabitacion += (decimal)totalParcialHabitacion;
                    }

                    totalFinal = sumaMedicina + sumaServicio + sumaHabitacion;

                    totalFinal = decimal.Round(totalFinal, 2);
                }


                var _Hospitalizacion = new HospitalizacionBL().GetHospitalizacion(ref objOperationResult, hospiId);

                _Hospitalizacion.d_PagoMedico = totalFinal;

                _hospitBL.UpdateHospitalizacion(ref objOperationResult, _Hospitalizacion, Globals.ClientSession.GetAsList());
                #endregion

                Liquidacion_Hospitalizacion.CreateLiquidacion(ruta + nombre + ".pdf", MedicalCenter, lista, datosP, doctor, hospitalizacion, hospitalizacionhabitacion, medicoTratante);

                this.Enabled = true;
            }
            this.Close();
        }