/// <summary> /// Constructs a new DependentModel based on a PatientModel. /// </summary> /// <param name="userDeleagate">The UserDelegate model.</param> /// <param name="patientModel">The Patien Model to be converted.</param> /// <returns>The Dependent Model.</returns> public static DependentModel CreateFromModels(UserDelegate userDeleagate, PatientModel patientModel) { return(new DependentModel() { OwnerId = userDeleagate.OwnerId, DelegateId = userDeleagate.DelegateId, Version = userDeleagate.Version, DependentInformation = DependentInformation.FromPatientModel(patientModel), }); }
/// <summary> /// Constructs a new DependentModel based on a PatientModel. /// </summary> /// <param name="resourceDeleagate">The ResourceDelegate model.</param> /// <param name="patientModel">The Patien Model to be converted.</param> /// <returns>The Dependent Model.</returns> public static DependentModel CreateFromModels(ResourceDelegate resourceDeleagate, PatientModel patientModel) { return(new DependentModel() { OwnerId = resourceDeleagate.ResourceOwnerHdid, DelegateId = resourceDeleagate.ProfileHdid, ReasonCode = resourceDeleagate.ReasonCode, Version = resourceDeleagate.Version, DependentInformation = DependentInformation.FromPatientModel(patientModel), }); }
/// <summary> /// Constructs a new DependentInformation based on a PatientModel. /// </summary> /// <param name="patientModel">The Patien Model to be converted.</param> /// <returns>The Dependent Model.</returns> public static DependentInformation FromPatientModel(PatientModel patientModel) { DependentInformation result = new DependentInformation() { HdId = patientModel.HdId, FirstName = patientModel.FirstName, LastName = patientModel.LastName, PHN = patientModel.PersonalHealthNumber, Gender = patientModel.Gender, DateOfBirth = patientModel.Birthdate, }; return(result); }
/// <summary> /// Constructs a new DependentInformation based on a PatientModel. /// </summary> /// <param name="patientModel">The Patien Model to be converted.</param> /// <returns>The Dependent Model.</returns> public static DependentInformation FromPatientModel(PatientModel patientModel) { DependentInformation result = new DependentInformation() { HdId = patientModel.HdId, Name = $"{patientModel.FirstName} {patientModel.LastName} ", Gender = patientModel.Gender, DateOfBirth = patientModel.Birthdate, }; if (patientModel.PersonalHealthNumber.Length > 3) { result.MaskedPHN = patientModel.PersonalHealthNumber.Remove(patientModel.PersonalHealthNumber.Length - 5, 4) + "****"; } else { result.MaskedPHN = "****"; } return(result); }