private Entry CreateAPr05PreviewViewModelEntry(APr05PreviewViewModel model) { if (model == default) { throw new ArgumentNullException(nameof(model)); } return(EhrManager.EntryBuilder .Clear() .AddItems( EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DiagnoseDate)).Build()) .AddValue(EhrManager.DATEBuilder.Clear().AddDate(model.DiagnoseDate).Build()).Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Staging)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Staging).Build()).Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Imuno)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Imuno).Build()).Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Genetic)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Genetic).Build()).Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Sign)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Sign).Build()).Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.NZOKPay)).Build()) .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.NZOKPay).Build()).Build() ) .Build()); }
public async Task <CommissionAprViewModel> GetCommissionAprAsync(int id) { if (id < 1) { throw new ArgumentException(nameof(id)); } return(await Task <CommissionAprViewModel> .Run(() => { CommissionApr commissionApr = MedicContext.CommissionAprs .Include(ca => ca.PatientBranch) .ThenInclude(pb => pb.HealthRegion) .Include(ca => ca.PatientHRegion) .SingleOrDefault(ca => ca.Id == id); if (commissionApr == default) { return default; } PatientSummaryViewModel patient = base.GetPatient <PatientSummaryViewModel>(p => p.Id == commissionApr.PatientId); HealthcarePractitionerSummaryViewModel sender = base.GetHealthcarePractitioner <HealthcarePractitionerSummaryViewModel>(hp => hp.Id == commissionApr.SenderId); HealthcarePractitionerSummaryViewModel chairman = base.GetHealthcarePractitioner <HealthcarePractitionerSummaryViewModel>(hp => hp.Id == commissionApr.ChairmanId); DiagPreviewViewModel mainDiag = base.GetDiag <DiagPreviewViewModel>(d => d.Id == commissionApr.MainDiagId); List <DiagPreviewViewModel> addedDiag = base.GetDiags <DiagPreviewViewModel>(d => d.CommissionAprId == commissionApr.Id); APr38PreviewViewModel APr38 = MedicContext.APr38s .ProjectTo <APr38PreviewViewModel>(Configuration) .SingleOrDefault(apr => apr.Id == commissionApr.APr38Id); APr05PreviewViewModel APr05 = MedicContext.APr05s .ProjectTo <APr05PreviewViewModel>(Configuration) .SingleOrDefault(apr => apr.Id == commissionApr.APr05Id); return new CommissionAprViewModel() { Id = commissionApr.Id, Patient = patient, PatientBranch = commissionApr?.PatientBranch?.HealthRegion?.Name ?? default, PatientHRegion = commissionApr.PatientHRegion.Name, Sender = sender, AprSend = commissionApr.AprSend, SendDate = commissionApr.SendDate, AprPriem = commissionApr.AprPriem, SpecCommission = commissionApr.SpecCommission, NoDecision = commissionApr.NoDecision, DecisionDate = commissionApr.DecisionDate, Chairman = chairman, MainDiag = mainDiag, AddDiags = addedDiag, APr38 = APr38, APr05 = APr05, Sign = commissionApr.Sign, NZOKPay = commissionApr.NZOKPay }; })); }