Esempio n. 1
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;
        }
Esempio n. 2
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;
        }