private Entry CreateEpicrisisEntry(EpicrisisSummaryViewModel model) { if (model == default) { throw new ArgumentNullException(nameof(model)); } IEntryBuilder createHistologicalBuilder = EhrManager.EntryBuilder.Clear() .AddItems( EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.History)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.History).Build()) .Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.FairCondition)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.FairCondition).Build()) .Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.ClinicalExaminations)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.ClinicalExaminations).Build()) .Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Consultations)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Consultations).Build()) .Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Regimen)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Regimen).Build()) .Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DiseaseCourse)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.DiseaseCourse).Build()) .Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Complications)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Complications).Build()) .Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.SampleProtocol)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.SampleProtocol).Build()) .Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.PostoperativeStatus)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.PostoperativeStatus).Build()) .Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DischargeStatus)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.DischargeStatus).Build()) .Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Recommendations)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Recommendations).Build()) .Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.CheckupAfterDischarge)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.CheckupAfterDischarge).Build()) .Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.GPRecommendations)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.GPRecommendations).Build()) .Build(), EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.OtherDocuments)).Build()) .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.OtherDocuments).Build()) .Build() ); if (model.DateOfSurgery != default) { createHistologicalBuilder.AddItems( EhrManager.ElementBuilder.Clear() .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.DateOfSurgery)).Build()) .AddValue(EhrManager.DATEBuilder.Clear().AddDate((DateTime)model.DateOfSurgery).Build()) .Build() ); } return(createHistologicalBuilder.Build()); }
public async Task <OutViewModel> GetOutAsync(int id) { if (id < 1) { throw new ArgumentException(nameof(id)); } return(await Task <OutViewModel> .Run(() => { Out outEntity = MedicContext.Outs .Include(o => o.PatientBranch) .ThenInclude(pb => pb.HealthRegion) .Include(o => o.PatientHRegion) .Include(o => o.CPFile) .ThenInclude(cp => cp.FileType) .SingleOrDefault(o => o.Id == id); if (outEntity == default) { return default; } PatientSummaryViewModel patient = base.GetPatient <PatientSummaryViewModel>(p => p.Id == outEntity.PatientId); HealthcarePractitionerSummaryViewModel sender = base.GetHealthcarePractitioner <HealthcarePractitionerSummaryViewModel>(hp => hp.Id == outEntity.SenderId); List <DiagnosePreviewViewModel> sendDiagnoses = base.GetDiagnoses <DiagnosePreviewViewModel>(d => d.SendOutId == outEntity.Id); List <DiagnosePreviewViewModel> diagnoses = base.GetDiagnoses <DiagnosePreviewViewModel>(d => d.OutId == outEntity.Id); DiagnosePreviewViewModel dead = base.GetDiagnose <DiagnosePreviewViewModel>(d => d.Id == outEntity.DeadId); HistologicalResultSummaryViewModel histologicalResult = MedicContext.HistologicalResults .ProjectTo <HistologicalResultSummaryViewModel>(Configuration) .SingleOrDefault(hr => hr.Id == outEntity.HistologicalResultId); EpicrisisSummaryViewModel epicrisis = MedicContext.Epicrises .ProjectTo <EpicrisisSummaryViewModel>(Configuration) .SingleOrDefault(e => e.Id == outEntity.EpicrisisId); DiagnosePreviewViewModel outMainDiagnose = base.GetDiagnose <DiagnosePreviewViewModel>(d => d.Id == outEntity.OutMainDiagnoseId); List <DiagnosePreviewViewModel> outDiagnoses = base.GetDiagnoses <DiagnosePreviewViewModel>(d => d.OutOutId == outEntity.Id); List <UsedDrugSummaryViewModel> usedDrugs = MedicContext.UsedDrugs .Where(ud => ud.OutId == outEntity.Id) .ProjectTo <UsedDrugSummaryViewModel>(Configuration) .ToList(); List <ProcedureSummaryViewModel> procedures = base.GetProcedures <ProcedureSummaryViewModel>(p => p.OutId == outEntity.Id); return new OutViewModel() { Id = outEntity.Id, Patient = patient, PatientBranch = outEntity?.PatientBranch?.HealthRegion?.Name ?? default, PatientHRegion = outEntity?.PatientHRegion?.Name ?? default, Sender = sender, InType = outEntity.InType, SendDate = outEntity.SendDate, SendDiagnoses = sendDiagnoses, SendUrgency = outEntity.SendUrgency, SendClinicalPath = outEntity.SendClinicalPath, SendAPr = outEntity.SendAPr, PlannedNumber = outEntity.PlannedNumber, InAPr = outEntity.InAPr, UniqueIdentifier = outEntity.UniqueIdentifier, ExaminationDate = outEntity.ExaminationDate, Diagnoses = diagnoses, Urgency = outEntity.Urgency, ClinicalPath = outEntity.ClinicalPath, NZOKPay = outEntity.NZOKPay, InMedicalWard = outEntity.InMedicalWard, EntryDate = outEntity.EntryDate, Severity = outEntity.Severity, Delay = outEntity.Delay, Payer = outEntity.Payer, AgeInDays = outEntity.AgeInDays, WeightInGrams = outEntity.WeightInGrams, BirthWeight = outEntity.BirthWeight, MotherIZYear = outEntity.MotherIZYear, MotherIZNo = outEntity.MotherIZNo, IZYear = outEntity.IZYear, IZNo = outEntity.IZNo, OutMedicalWard = outEntity.OutMedicalWard, OutUniqueIdentifier = outEntity.OutUniqueIdentifier, OutDate = outEntity.OutDate, OutType = outEntity.OutType, Dead = dead, BirthPractice = outEntity.BirthPractice, BirthNumber = outEntity.BirthNumber, BirthGestWeek = outEntity.BirthGestWeek, OutClinicalPath = outEntity.OutClinicalPath, OutAPr = outEntity.OutAPr, HistologicalResult = histologicalResult, Epicrisis = epicrisis, OutMainDiagnose = outMainDiagnose, OutDiagnoses = outDiagnoses, UsedDrugs = usedDrugs, Procedures = procedures, BedDays = outEntity.BedDays, HLDateFrom = outEntity.HLDateFrom, HLNumber = outEntity.HLNumber, HLTotalDays = outEntity.HLTotalDays, StateAtDischarge = outEntity.StateAtDischarge, Laparoscopic = outEntity.Laparoscopic, EndCourse = outEntity.EndCourse, CPFile = outEntity?.CPFile?.FileType?.Name ?? default }; })); }