private Entry CreateHematologyPartEntry(HematologyPartPreviewViewModel model) { if (model == default) { throw new ArgumentNullException(nameof(model)); } IEntryBuilder entryBuilder = EhrManager.EntryBuilder.Clear(); if (model.PredMarker != default && model.PredMarker.Choices != default && model.PredMarker.Choices.Count > 0) { Cluster[] choiceCluster = model.PredMarker.Choices.Where(c => c != default).Select(c => CreateChoiceCluster(c, nameof(model.PredMarker.Choices))).ToArray(); entryBuilder.AddItems(EhrManager.ClusterBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PredMarker)).Build()) .AddParts(choiceCluster) .Build()); } return(entryBuilder.Build()); }
public async Task <ProtocolDrugTherapyViewModel> GetProtocolDrugTherapyAsync(int id) { if (id < 1) { throw new ArgumentException(nameof(id)); } return(await Task <ProtocolDrugTherapyViewModel> .Run(() => { ProtocolDrugTherapy protocolDrugTherapy = MedicContext.ProtocolDrugTherapies .Include(pdt => pdt.PatientBranch) .ThenInclude(pb => pb.HealthRegion) .Include(pdt => pdt.PatientHRegion) .Include(pdt => pdt.CPFile) .ThenInclude(cp => cp.FileType) .SingleOrDefault(pdt => pdt.Id == id); if (protocolDrugTherapy == default) { return default; } PatientSummaryViewModel patient = base.GetPatient <PatientSummaryViewModel>(p => p.Id == protocolDrugTherapy.PatientId); PracticePreviewViewModel practice = MedicContext.Practices .ProjectTo <PracticePreviewViewModel>(Configuration) .SingleOrDefault(p => p.Id == protocolDrugTherapy.PracticeId); DiagPreviewViewModel diag = base.GetDiag <DiagPreviewViewModel>(d => d.Id == protocolDrugTherapy.DiagId); HematologyPartPreviewViewModel hematologyPart = MedicContext.HematologyParts .ProjectTo <HematologyPartPreviewViewModel>(Configuration) .SingleOrDefault(hp => hp.Id == protocolDrugTherapy.Id); ChemotherapyPartPreviewViewModel chemotherapyPart = MedicContext.ChemotherapyParts .ProjectTo <ChemotherapyPartPreviewViewModel>(Configuration) .SingleOrDefault(cp => cp.Id == protocolDrugTherapy.ChemotherapyPartId); List <DrugProtocolPreviewViewModel> drugProtocols = MedicContext.DrugProtocols .Where(dp => dp.ProtocolDrugTherapyId == protocolDrugTherapy.Id) .ProjectTo <DrugProtocolPreviewViewModel>(Configuration) .ToList(); List <AccompanyingDrugPreviewViewModel> accompanyingDrugs = MedicContext.AccompanyingDrugs .Where(ad => ad.ProtocolDrugTherapyId == protocolDrugTherapy.Id) .ProjectTo <AccompanyingDrugPreviewViewModel>(Configuration) .ToList(); HealthcarePractitionerSummaryViewModel chairman = base.GetHealthcarePractitioner <HealthcarePractitionerSummaryViewModel>(hp => hp.Id == protocolDrugTherapy.ChairmanId); return new ProtocolDrugTherapyViewModel() { Id = protocolDrugTherapy.Id, Patient = patient, PatientBranch = protocolDrugTherapy?.PatientBranch?.HealthRegion?.Name ?? default, PatientHRegion = protocolDrugTherapy?.PatientHRegion?.Name ?? default, Practice = practice, NumberOfDecision = protocolDrugTherapy.NumberOfDecision, DecisionDate = protocolDrugTherapy.DecisionDate, PracticeCodeProtocol = protocolDrugTherapy.PracticeCodeProtocol, NumberOfProtocol = protocolDrugTherapy.NumberOfProtocol, ProtocolDate = protocolDrugTherapy.ProtocolDate, Diag = diag, Height = protocolDrugTherapy.Height, Weight = protocolDrugTherapy.Weight, BSA = protocolDrugTherapy.BSA, TherapyLine = protocolDrugTherapy.TherapyLine, Scheme = protocolDrugTherapy.Scheme, CycleCount = protocolDrugTherapy.CycleCount, HematologyPart = hematologyPart, ChemotherapyPart = chemotherapyPart, DrugProtocols = drugProtocols, AccompanyingDrugs = accompanyingDrugs, Chairman = chairman, Sign = protocolDrugTherapy.Sign, CPFile = protocolDrugTherapy?.CPFile?.FileType.Name, }; })); }