Ejemplo n.º 1
0
 public ScheduleWindow(RecommendationDto recommendationDto, Window Owner)
 {
     InitializeComponent();
     this.recommendationDto = recommendationDto;
     this.Owner             = Owner;
     SetAppointmentInfoContent();
     SetPatientNameComboBox();
 }
 public static Recommendation ToEntity(this RecommendationDto dto)
 {
     return(new Recommendation
     {
         ID = dto.ID,
         Value = dto.Value,
         Comment = dto.Comment
     });
 }
        public async Task <IActionResult> CreateRecommendation(RecommendationDto recommendation)
        {
            var recommendationToCreate = _mapper.Map <Recommendation>(recommendation);

            _repo.Add(recommendationToCreate);
            if (await _repo.SaveAll())
            {
                return(NoContent());
            }

            return(BadRequest("Filed to Create Recommendation"));
        }
        private void AddScheduleExaminationButton(int row, RecommendationDto recommendation)
        {
            Button scheduleBtn = CreateScheduleButton();

            Grid.SetRow(scheduleBtn, row);
            Grid.SetColumn(scheduleBtn, DynamicGrid.ColumnDefinitions.Count - 2);
            DynamicGrid.Children.Add(scheduleBtn);

            scheduleBtn.Click += (s, e) =>
            {
                ScheduleWindow scheduleWindow = new ScheduleWindow(recommendation, this);
                scheduleWindow.ShowDialog();
            };
        }
Ejemplo n.º 5
0
        public List <SearchResultDTO> GetSearchResult()
        {
            IMapObjectController   mapObjectController = new MapObjectController();
            List <SearchResultDTO> retVal = new List <SearchResultDTO>();

            for (int i = 0; i < searchResult.Count(); i++)
            {
                RecommendationDto          recommendationDto = searchResult.ElementAt(i);
                MapObject                  mo              = mapObjectController.GetMapObjectById(recommendationDto.RoomId);
                string                     doctor          = recommendationDto.Doctor.Person.Name + " " + recommendationDto.Doctor.Person.Surname;
                string                     timeInterval    = recommendationDto.TimeInterval.Start.ToString() + "-" + recommendationDto.TimeInterval.End.ToString();
                AppointmentSearchResultDTO searchResultDTO = new AppointmentSearchResultDTO()
                {
                    MapObjectId       = mo.Id,
                    Content           = mo.Name + AllConstants.ContentSeparator + doctor + AllConstants.ContentSeparator + timeInterval,
                    RecommendationDto = recommendationDto
                };
                retVal.Add(searchResultDTO);
            }
            return(retVal);
        }
Ejemplo n.º 6
0
        public async Task GetTask(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            try
            {
                var userResponse = await result;

                var luisResult = await LuisHelper.GetIntentAndEntitiesFromLUIS(userResponse.Text);

                var recommendationResult = new RecommendationDto()
                {
                    Matcher = new MatcherResponse()
                    {
                        Results = new List <MatcherItem>()
                        {
                            new MatcherItem()
                            {
                                Id    = 3034,
                                Raw   = "pasta",
                                Score = 0.6,
                                Type  = "Category"
                            },
                            new MatcherItem()
                            {
                                Id    = 3034,
                                Raw   = "pizza",
                                Score = 0.6,
                                Type  = "Category"
                            },
                            new MatcherItem()
                            {
                                Id    = 3034,
                                Raw   = "vino",
                                Score = 0.6,
                                Type  = "Category"
                            }
                        }
                    },
                    Products = new List <ProductDto>()
                    {
                        new ProductDto()
                        {
                            CategoryId  = 3034,
                            Description = "prodotto 1",
                            Id          = 1,
                            SKU         = "1"
                        },
                        new ProductDto()
                        {
                            CategoryId  = 3034,
                            Description = "prodotto 2",
                            Id          = 2,
                            SKU         = "2"
                        },
                        new ProductDto()
                        {
                            CategoryId  = 3034,
                            Description = "prodotto 3",
                            Id          = 3,
                            SKU         = "3"
                        },
                        new ProductDto()
                        {
                            CategoryId  = 3034,
                            Description = "prodotto 4",
                            Id          = 4,
                            SKU         = "4"
                        }
                    }
                };


                context.UserData.SetValue("LastRecommendationProducts", recommendationResult.Products);
                context.UserData.SetValue("LastRecommendationMatcher", recommendationResult.Matcher);

                switch (luisResult.TopScoringIntent.Intent)
                {
                case LuisIntent.Yes:
                {
                    if (recommendationResult.Products.Count > minSuggestionProductNumber)
                    {
                        context.Call(_dialogFactory.Create <GetSuggestionProductByCardTask>(), Callback);
                    }
                    else
                    {
                        await context.PostAsync(MessagesResource.NoSuggestionProduct);

                        context.Call(_dialogFactory.Create <GetPromoProductByCardTask>(), Callback);
                    }
                    break;
                }

                case LuisIntent.No:
                {
                    context.Call(_dialogFactory.Create <AskIfWantProductPositionTask>(), Callback);
                    break;
                }

                default:
                {
                    var handler = new HandleUserIncorrectInput(context);

                    if (handler.CheckCounterErrors())
                    {
                        await handler.UserErrorLimitExceeded();

                        context.Call(_dialogFactory.Create <GreetingDialog>(), Callback);
                    }
                    else
                    {
                        await context.PostAsync(MessagesResource.CourtesyChooseError);

                        var sender = new SendCorrectYesOrNoCard(context);
                        await sender.Send(MessagesResource.AskIfWantSuggestions);

                        context.Wait(GetTask);
                    }
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                await context.PostAsync(MessagesResource.CourtesyError);

                context.Call(_dialogFactory.Create <GreetingDialog>(), Callback);
            }
        }
Ejemplo n.º 7
0
        public void AddDiagnosticRepository(List <DiagnosticCustom> pobjDiagnosticRepository, int nodeId, int systemUserId)
        {
            try
            {
                string NewId0      = "(No generado)";
                string componentId = null;

                if (pobjDiagnosticRepository != null)
                {
                    foreach (var dr in pobjDiagnosticRepository)
                    {
                        #region DiagnosticRepository -> ADD / UPDATE / DELETE

                        // ADD
                        if (dr.RecordType == (int)RecordType.Temporal && (dr.RecordStatus == (int)RecordStatus.Agregado || dr.RecordStatus == (int)RecordStatus.Editado))
                        {
                            DiagnosticRepositoryDto objEntity = new DiagnosticRepositoryDto();

                            // En caso de haber mas de un ComponentID quiere decir que lo datos provienen de un examen agrupador con una categoria (LAB,PSICOLOGIA)
                            // entonces cojo el ID del hijo mayor (osea el primer ID)[0]
                            // Buscar un palote
                            if (dr.ComponentId != null)
                            {
                                if (dr.ComponentId.Contains('|'))
                                {
                                    componentId = (dr.ComponentId.Split('|'))[0];
                                }
                                else
                                {
                                    componentId = dr.ComponentId;
                                }
                            }

                            objEntity.v_DiagnosticRepositoryId = dr.DiagnosticRepositoryId;
                            objEntity.v_ServiceId   = dr.ServiceId;
                            objEntity.v_ComponentId = componentId;
                            objEntity.v_DiseasesId  = dr.DiseaseId;
                            // ID del Control que generó el DX automático [v_ComponentFieldsId]
                            objEntity.v_ComponentFieldId   = dr.ComponentFieldsId;
                            objEntity.i_AutoManualId       = (int)AutoManual.Manual;                   // dr.AutoManualId;
                            objEntity.i_PreQualificationId = (int)PreQualification.Aceptado;           // dr.PreQualificationId;
                                                                                                       // Total Diagnósticos
                            objEntity.i_FinalQualificationId     = (int)FinalQualification.Definitivo; // dr.FinalQualificationId;
                            objEntity.i_DiagnosticTypeId         = (int)TipoDx.Enfermedad_Comun;       // dr.DiagnosticTypeId;
                            objEntity.i_IsSentToAntecedent       = dr.IsSentToAntecedent;
                            objEntity.d_ExpirationDateDiagnostic = dr.ExpirationDateDiagnostic;

                            objEntity.d_InsertDate   = DateTime.Now;
                            objEntity.i_InsertUserId = systemUserId;
                            objEntity.i_IsDeleted    = 0;

                            // Accidente laboral
                            objEntity.i_DiagnosticSourceId = dr.DiagnosticSourceId;
                            objEntity.i_ShapeAccidentId    = dr.ShapeAccidentId;

                            objEntity.i_BodyPartId = dr.BodyPartId;
                            objEntity.i_ClassificationOfWorkAccidentId = dr.ClassificationOfWorkAccidentId;

                            // Enfermedad laboral
                            objEntity.i_RiskFactorId = dr.RiskFactorId;
                            objEntity.i_ClassificationOfWorkdiseaseId = dr.ClassificationOfWorkdiseaseId;

                            // Autogeneramos el Pk de la tabla
                            NewId0 = new Common.Utils().GetPrimaryKey(nodeId, 29, "DR");
                            // Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 29), "DR");
                            objEntity.v_DiagnosticRepositoryId = NewId0;

                            Ctx.DiagnosticRepository.Add(objEntity);
                        } // UPDATE
                        else if (dr.RecordType == (int)RecordType.NoTemporal && dr.RecordStatus == (int)RecordStatus.Editado)
                        {
                            // Obtener la entidad fuente
                            var objEntitySource = (from a in Ctx.DiagnosticRepository
                                                   where a.v_DiagnosticRepositoryId == dr.DiagnosticRepositoryId
                                                   select a).FirstOrDefault();

                            // Crear la entidad con los datos actualizados
                            objEntitySource.i_AutoManualId       = (int)AutoManual.Manual;         //dr.AutoManualId;
                            objEntitySource.i_PreQualificationId = (int)PreQualification.Aceptado; //dr.PreQualificationId;
                            objEntitySource.v_ComponentId        = dr.ComponentId.Split('|')[0];
                            // ID del Control que generó el DX automático [v_ComponentFieldsId]
                            //objEntitySource.v_ComponentFieldsId = dr.v_ComponentFieldsId;
                            // Total Diagnósticos
                            if (objEntitySource.i_FinalQualificationId == null)
                            {
                                objEntitySource.i_FinalQualificationId = dr.FinalQualificationId;
                            }



                            objEntitySource.i_DiagnosticTypeId         = (int)TipoDx.Enfermedad_Comun;//dr.DiagnosticTypeId;
                            objEntitySource.i_IsSentToAntecedent       = dr.IsSentToAntecedent;
                            objEntitySource.d_ExpirationDateDiagnostic = dr.ExpirationDateDiagnostic;

                            // Accidente laboral
                            objEntitySource.i_DiagnosticSourceId             = dr.DiagnosticSourceId;
                            objEntitySource.i_ShapeAccidentId                = dr.ShapeAccidentId;
                            objEntitySource.i_BodyPartId                     = dr.BodyPartId;
                            objEntitySource.i_ClassificationOfWorkAccidentId = dr.ClassificationOfWorkAccidentId;

                            // Enfermedad laboral
                            objEntitySource.i_RiskFactorId = dr.RiskFactorId;
                            objEntitySource.i_ClassificationOfWorkdiseaseId = dr.ClassificationOfWorkdiseaseId;

                            objEntitySource.d_UpdateDate   = DateTime.Now;
                            objEntitySource.i_UpdateUserId = systemUserId;
                        } // DELETE
                        else if (dr.RecordType == (int)RecordType.NoTemporal && dr.RecordStatus == (int)RecordStatus.Eliminado)
                        {
                            // Obtener la entidad fuente
                            var objEntitySource = (from a in Ctx.DiagnosticRepository
                                                   where a.v_DiagnosticRepositoryId == dr.DiagnosticRepositoryId
                                                   select a).FirstOrDefault();

                            // Crear la entidad con los datos actualizados
                            objEntitySource.d_UpdateDate   = DateTime.Now;
                            objEntitySource.i_UpdateUserId = systemUserId;
                            objEntitySource.i_IsDeleted    = 1;
                        }

                        #endregion

                        #region Restricciones -> ADD / DELETE

                        if (dr.Restrictions != null)
                        {
                            // Operaciones básicas [Add,Update,Delete] restricciones
                            foreach (var r in dr.Restrictions)
                            {
                                if (r.RecordType == (int)RecordType.Temporal && r.RecordStatus == (int)RecordStatus.Agregado)
                                {
                                    RestrictionDto objRestriction = new RestrictionDto();

                                    var NewId1 = new Common.Utils().GetPrimaryKey(nodeId, 30, "RD");
                                    //Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 30), "RD");
                                    objRestriction.v_ServiceId   = dr.ServiceId;
                                    objRestriction.v_ComponentId = dr.ComponentId.Split('|')[0];
                                    //objRestriction.v_RestrictionByDiagnosticId = NewId1;
                                    objRestriction.v_RestrictionId          = NewId1;
                                    objRestriction.v_DiagnosticRepositoryId = NewId0 == "(No generado)" ? dr.DiagnosticRepositoryId : NewId0;

                                    objRestriction.v_MasterRestrictionId = r.MasterRestrictionId.Length > 16 ? null : r.MasterRestrictionId;
                                    objRestriction.d_InsertDate          = DateTime.Now;
                                    objRestriction.i_InsertUserId        = systemUserId;
                                    objRestriction.i_IsDeleted           = 0;

                                    Ctx.Restriction.Add(objRestriction);
                                }
                                else if (r.RecordType == (int)RecordType.NoTemporal && r.RecordStatus == (int)RecordStatus.Eliminado)
                                {
                                    // Obtener la entidad fuente v_RestrictionByDiagnosticId
                                    var objEntitySource = (from a in Ctx.Restriction
                                                           where a.v_RestrictionId == r.RestrictionId
                                                           select a).FirstOrDefault();

                                    // Crear la entidad con los datos actualizados
                                    objEntitySource.d_UpdateDate   = DateTime.Now;
                                    objEntitySource.i_UpdateUserId = systemUserId;
                                    objEntitySource.i_IsDeleted    = 1;
                                }
                                //dbContext.SaveChanges();
                            }
                        }

                        #endregion

                        #region Recomendaciones -> ADD / DELETE

                        if (dr.Recommendations != null)
                        {
                            // Grabar recomendaciones
                            foreach (var r in dr.Recommendations)
                            {
                                if (r.RecordType == (int)RecordType.Temporal && r.RecordStatus == (int)RecordStatus.Agregado)
                                {
                                    RecommendationDto objRecommendation = new RecommendationDto();

                                    var NewId1 = new Common.Utils().GetPrimaryKey(nodeId, 32, "RR");
                                    //Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 32), "RR");
                                    objRecommendation.v_ServiceId              = dr.ServiceId;
                                    objRecommendation.v_ComponentId            = dr.ComponentId.Split('|')[0];
                                    objRecommendation.v_RecommendationId       = NewId1;
                                    objRecommendation.v_DiagnosticRepositoryId = NewId0 == "(No generado)" ? dr.DiagnosticRepositoryId : NewId0;

                                    //objRecommendation.v_MasterRecommendationId = r.v_RecommendationId.Length > 16 ? null : r.v_MasterRecommendationId;
                                    objRecommendation.v_MasterRecommendationId = r.MasterRecommendationId;
                                    objRecommendation.d_InsertDate             = DateTime.Now;
                                    objRecommendation.i_InsertUserId           = systemUserId;
                                    objRecommendation.i_IsDeleted = 0;

                                    Ctx.Recommendation.Add(objRecommendation);
                                }
                                else if (r.RecordType == (int)RecordType.NoTemporal && r.RecordStatus == (int)RecordStatus.Eliminado)
                                {
                                    // Obtener la entidad fuente
                                    var objEntitySource = (from a in Ctx.Recommendation
                                                           where a.v_RecommendationId == r.RecommendationId
                                                           select a).FirstOrDefault();

                                    // Crear la entidad con los datos actualizados
                                    objEntitySource.d_UpdateDate   = DateTime.Now;
                                    objEntitySource.i_UpdateUserId = systemUserId;
                                    objEntitySource.i_IsDeleted    = 1;
                                }
                                //dbContext.SaveChanges();
                            }
                        }

                        #endregion
                    }

                    // Guardar los cambios
                    Ctx.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
        }