/// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 26, Configuration.FieldSeparator),
                       Id,
                       ReferralStatus?.ToDelimitedString(),
                       ReferralPriority?.ToDelimitedString(),
                       ReferralType?.ToDelimitedString(),
                       ReferralDisposition != null ? string.Join(Configuration.FieldRepeatSeparator, ReferralDisposition.Select(x => x.ToDelimitedString())) : null,
                       ReferralCategory?.ToDelimitedString(),
                       OriginatingReferralIdentifier?.ToDelimitedString(),
                       EffectiveDate.HasValue ? EffectiveDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ExpirationDate.HasValue ? ExpirationDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ProcessDate.HasValue ? ProcessDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ReferralReason != null ? string.Join(Configuration.FieldRepeatSeparator, ReferralReason.Select(x => x.ToDelimitedString())) : null,
                       ExternalReferralIdentifier != null ? string.Join(Configuration.FieldRepeatSeparator, ExternalReferralIdentifier.Select(x => x.ToDelimitedString())) : null,
                       ReferralDocumentationCompletionStatus?.ToDelimitedString(),
                       PlannedTreatmentStopDate.HasValue ? PlannedTreatmentStopDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ReferralReasonText,
                       NumberOfAuthorizedTreatmentsUnits?.ToDelimitedString(),
                       NumberOfUsedTreatmentsUnits?.ToDelimitedString(),
                       NumberOfScheduleTreatmentsUnits?.ToDelimitedString(),
                       RemainingBenefitAmount?.ToDelimitedString(),
                       AuthorizedProvider?.ToDelimitedString(),
                       AuthorizedHealthProfessional?.ToDelimitedString(),
                       SourceText,
                       SourceDate.HasValue ? SourceDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       SourcePhone?.ToDelimitedString(),
                       Comment,
                       ActionCode
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Beispiel #2
0
        public async Task <Referral> Update(int id, ReferralStatus status)
        {
            var referral = await Context.Referrals.FirstAsync(p => p.Id == id);

            referral.UpdateStatus(status);
            return(referral);
        }
 public static Referral CreateReferral(int userId, int patientId, ReferralStatus status)
 {
     return(new Referral
     {
         UserId = userId,
         PatientId = patientId,
         Status = status
     });
 }
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 12, Configuration.FieldSeparator),
                       Id,
                       ReferralStatus?.ToDelimitedString(),
                       ReferralPriority?.ToDelimitedString(),
                       ReferralType?.ToDelimitedString(),
                       ReferralDisposition != null ? string.Join(Configuration.FieldRepeatSeparator, ReferralDisposition.Select(x => x.ToDelimitedString())) : null,
                       ReferralCategory?.ToDelimitedString(),
                       OriginatingReferralIdentifier?.ToDelimitedString(),
                       EffectiveDate.HasValue ? EffectiveDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ExpirationDate.HasValue ? ExpirationDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ProcessDate.HasValue ? ProcessDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ReferralReason != null ? string.Join(Configuration.FieldRepeatSeparator, ReferralReason.Select(x => x.ToDelimitedString())) : null,
                       ExternalReferralIdentifier != null ? string.Join(Configuration.FieldRepeatSeparator, ExternalReferralIdentifier.Select(x => x.ToDelimitedString())) : null
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
            private static Domain.Referrals.ReferralStatus MapStatus(ReferralStatus s)
            {
                switch (s)
                {
                case ReferralStatus.Accepted:
                    return(Domain.Referrals.ReferralStatus.Accepted);

                case ReferralStatus.Dismissed:
                    return(Domain.Referrals.ReferralStatus.Dismissed);

                case ReferralStatus.InProcess:
                    return(Domain.Referrals.ReferralStatus.InProcess);

                case ReferralStatus.New:
                    return(Domain.Referrals.ReferralStatus.New);

                case ReferralStatus.SpecialAttention:
                    return(Domain.Referrals.ReferralStatus.SpecialAttention);

                default:
                    throw new Exception("Could not map status");
                }
            }
 public void UpdateStatus(ReferralStatus newStatus)
 {
     this.Status = newStatus;
 }