コード例 #1
0
        public ConsumerHabPlan GetModel()
        {
            ConsumerHabPlan model = new ConsumerHabPlan();

            if (this.ConsumerHabPlanId.HasValue)
            {
                model.ConsumerHabPlanId = this.ConsumerHabPlanId.Value;
            }
            else
            {
                model.ConsumerHabPlanId = 0;
            }
            model.ConsumerId      = this.ConsumerId;
            model.HabServiceId    = this.HabServiceId;
            model.CoordinatorId   = this.Coordinator.ContactId;
            model.FrequencyId     = this.FrequencyId;
            model.DurationId      = this.DurationId;
            model.StatusId        = this.StatusId;
            model.AddedById       = this.AddedById;
            model.UpdatedById     = this.UpdatedById;
            model.Name            = this.Name;
            model.QMRP            = this.QMRP;
            model.EnrolmentDate   = this.EnrolmentDate;
            model.DatePlan        = this.DatePlan;
            model.SignatureDate   = this.SignatureDate;
            model.EffectivePlan   = this.EffectivePlan;
            model.IsAproved       = this.IsAproved;
            model.IsAutoSignature = this.IsAutoSignature;
            model.DateCreated     = this.DateCreated;
            model.DateUpdated     = this.DateUpdated;

            return(model);
        }
コード例 #2
0
        public ConsumerHabPlanViewModel(ConsumerHabPlan model)
        {
            this.ConsumerHabPlanId = model.ConsumerHabPlanId;
            this.Name           = model.Name;
            this.HabServiceId   = model.HabServiceId;
            this.HabServiceName = model.ServicesList.ServiceDescription;
            if (model.Contact != null)
            {
                this.Coordinator = new EmployeeSearchViewModel(model.Contact);
            }

            this.FrequencyId     = model.FrequencyId;
            this.FrequencyName   = model.ConsumerHabPlanFrequency.Name;
            this.DurationId      = model.DurationId;
            this.DurationName    = model.ConsumerHabPlanDuration.Name;
            this.StatusId        = model.StatusId;
            this.StatusName      = model.ConsumerHabPlanStatus.Name;
            this.QMRP            = model.QMRP;
            this.EnrolmentDate   = model.EnrolmentDate;
            this.DatePlan        = model.DatePlan;
            this.SignatureDate   = model.SignatureDate;
            this.EffectivePlan   = model.EffectivePlan;
            this.IsAproved       = model.IsAproved;
            this.IsAutoSignature = model.IsAutoSignature;
            this.DateCreated     = model.DateCreated;
            this.DateUpdated     = model.DateUpdated;


            if (model.ConsumerHabPlanValuedOutcomes != null)
            {
                this.ValuedOutcomes = ConsumerHabPlanValuedOutcomeViewModel.GetList(model.ConsumerHabPlanValuedOutcomes.ToList());
            }
            else
            {
                this.ValuedOutcomes = new List <ConsumerHabPlanValuedOutcomeViewModel>();
            }
            if (model.ConsumerHabPlanSafeguards != null)
            {
                this.Safeguards = ConsumerHabPlanSafeguardViewModel.GetList(model.ConsumerHabPlanSafeguards.ToList());
            }

            this.AddedById   = model.AddedById;
            this.AddedByName = model.SystemUser.LastName + ", " + model.SystemUser.FirstName;

            this.UpdatedById = model.UpdatedById;
            if (this.UpdatedById.HasValue)
            {
                this.UpdatedByName = model.SystemUser1.LastName + ", " + model.SystemUser1.FirstName;
            }
            else
            {
                this.UpdatedByName = "";
            }
        }
コード例 #3
0
        public override Dictionary <string, object> GetDataSets(ConsumerHabPlan habPlanEntity, ConsumerHabPlansManagement consumerHabPlanManagement)
        {
            Dictionary <string, object> dataSets = new Dictionary <string, object>();

            if (habPlanEntity == null)
            {
                return(dataSets);
            }

            List <ReportHabPlanOutcomeValue> valueOutcomeList = consumerHabPlanManagement.GetReportHabPlanOutcomeValueList(habPlanEntity);
            IEnumerable <object>             timeObjs         = new[]
            {
                new
                {
                    PatientName    = consumerHabPlanManagement.GetName(habPlanEntity.Consumer),
                    PatientDOB     = consumerHabPlanManagement.GetDate(habPlanEntity.Consumer.DateOfBirth),
                    EnrollmentDate = consumerHabPlanManagement.GetDate(habPlanEntity.EnrolmentDate),
                    SignatureDate  = consumerHabPlanManagement.GetDate(habPlanEntity.SignatureDate),
                    CHCoordinator  = habPlanEntity.Contact != null?consumerHabPlanManagement.GetName(habPlanEntity.Contact) : "",
                                         Frequency                         = habPlanEntity.ConsumerHabPlanFrequency.Name,
                                         Duration                          = habPlanEntity.ConsumerHabPlanDuration.Name,
                                         Medicaid                          = consumerHabPlanManagement.GetMedicaidNumberByDate(habPlanEntity.Consumer, habPlanEntity.DatePlan),
                                         HabService                        = habPlanEntity.ServicesList.ServiceDescription,
                                         DateOfPlan                        = consumerHabPlanManagement.GetDate(habPlanEntity.DatePlan),
                                         EffectiveDate                     = consumerHabPlanManagement.GetDate(habPlanEntity.EffectivePlan),
                                         MSC                               = habPlanEntity.Consumer.ServiceCoordinatorContact != null?consumerHabPlanManagement.GetScheduledMSCName(habPlanEntity.Consumer, habPlanEntity.DatePlan) : "",
                                                                  CCO      = habPlanEntity.Consumer.ServiceCoordinatorContact?.CCO ?? "",
                                                                  Outcome1 = valueOutcomeList.GetSafeDataByIndex(0) ?? new ReportHabPlanOutcomeValue(),
                                                                  Outcome2 = valueOutcomeList.GetSafeDataByIndex(1) ?? new ReportHabPlanOutcomeValue(),
                                                                  Outcome3 = valueOutcomeList.GetSafeDataByIndex(2) ?? new ReportHabPlanOutcomeValue(),
                                                                  Outcome4 = valueOutcomeList.GetSafeDataByIndex(3) ?? new ReportHabPlanOutcomeValue(),

                                                                  TypeDocument        = consumerHabPlanManagement.GetServiceName(habPlanEntity),
                                                                  Safeguards          = consumerHabPlanManagement.GetSafeguards(habPlanEntity),
                                                                  ShowReviewedBy      = !habPlanEntity.ServicesList.ServiceType.Contains("Community"),
                                                                  CHSignature         = consumerHabPlanManagement.GetSignature(habPlanEntity),
                                                                  CHSignatureMimeType = consumerHabPlanManagement.GetSignatureType(habPlanEntity),
                                                                  CoordinatorLabel    = consumerHabPlanManagement.GetCoordinatorLabel(habPlanEntity)
                }
            };

            dataSets.Add("DataSet1", timeObjs);
            dataSets.Add("DataSetSafeGuards", consumerHabPlanManagement.GetSafeguardsWithActions(habPlanEntity));
            return(dataSets);
        }
コード例 #4
0
        public async Task <Int32> Save(ConsumerHabPlan dbModel, List <ConsumerHabPlanValuedOutcome> outcomes,
                                       List <ConsumerHabPlanVOServeAction> actions, List <ConsumerHabPlanSafeguard> safeguards)
        {
            if (dbModel.ConsumerHabPlanId == 0)
            {
                _context.ConsumerHabPlans.Add(dbModel);
            }
            else
            {
                var model = await _context.ConsumerHabPlans.SingleOrDefaultAsync(x =>
                                                                                 x.ConsumerHabPlanId == dbModel.ConsumerHabPlanId);

                if (model != null)
                {
                    model.ConsumerId      = dbModel.ConsumerId;
                    model.HabServiceId    = dbModel.HabServiceId;
                    model.CoordinatorId   = dbModel.CoordinatorId;
                    model.FrequencyId     = dbModel.FrequencyId;
                    model.DurationId      = dbModel.DurationId;
                    model.StatusId        = dbModel.StatusId;
                    model.AddedById       = dbModel.AddedById;
                    model.UpdatedById     = dbModel.UpdatedById;
                    model.Name            = dbModel.Name;
                    model.QMRP            = dbModel.QMRP;
                    model.EnrolmentDate   = dbModel.EnrolmentDate;
                    model.SignatureDate   = dbModel.SignatureDate;
                    model.DatePlan        = dbModel.DatePlan;
                    model.EffectivePlan   = dbModel.EffectivePlan;
                    model.IsAproved       = dbModel.IsAproved;
                    model.IsAutoSignature = dbModel.IsAutoSignature;
                    model.DateCreated     = dbModel.DateCreated;
                    model.DateUpdated     = dbModel.DateUpdated;
                    var outcomes_old =
                        _context.ConsumerHabPlanValuedOutcomes.Where(x => x.HabPlanId == dbModel.ConsumerHabPlanId);
                    var actions_old = _context.ConsumerHabPlanVOServeActions.Where(x =>
                                                                                   outcomes_old.Any(z => z.Id == x.HabPlanValuedOutcomeId));
                    var safeguards_old =
                        _context.ConsumerHabPlanSafeguards.Where(x => x.ConsumerHabPlanId == dbModel.ConsumerHabPlanId);
                    _context.ConsumerHabPlanVOServeActions.RemoveRange(actions_old);
                    _context.ConsumerHabPlanValuedOutcomes.RemoveRange(outcomes_old);
                    _context.ConsumerHabPlanSafeguards.RemoveRange(safeguards_old);
                }
            }
            await _context.SaveChangesAsync();

            if (outcomes.Count > 0)
            {
                foreach (var outcome in outcomes)
                {
                    outcome.HabPlanId = dbModel.ConsumerHabPlanId;
                    Int32 tempId = outcome.Id;
                    outcome.Id = 0;
                    _context.ConsumerHabPlanValuedOutcomes.Add(outcome);
                    await _context.SaveChangesAsync();

                    foreach (var action in actions)
                    {
                        if (action.HabPlanValuedOutcomeId == tempId && tempId < 0)
                        {
                            action.HabPlanValuedOutcomeId = outcome.Id;
                            _context.ConsumerHabPlanVOServeActions.Add(action);
                        }
                    }
                }
                await _context.SaveChangesAsync();
            }

            if (safeguards.Count > 0)
            {
                foreach (var safeguard in safeguards)
                {
                    safeguard.ConsumerHabPlanId          = dbModel.ConsumerHabPlanId;
                    safeguard.ConsumerHabPlanSafeguardId = 0;
                    _context.ConsumerHabPlanSafeguards.Add(safeguard);
                }
                await _context.SaveChangesAsync();
            }
            return(dbModel.ConsumerHabPlanId);
        }
コード例 #5
0
 public virtual Dictionary <string, object> GetDataSets(ConsumerHabPlan habPlanEntity, ConsumerHabPlansManagement consumerHabPlanManagement)
 {
     return(new Dictionary <string, object>());
 }