Esempio n. 1
0
        public async Task <InClinicProcedureViewModel> GetInClinicProcedureAsync(int id)
        {
            if (id < 0)
            {
                throw new ArgumentException(nameof(id));
            }

            return(await Task <InClinicProcedureViewModel> .Run(() =>
            {
                InClinicProcedure inClinicProcedure = MedicContext.InClinicProcedures
                                                      .Include(icp => icp.PatientBranch)
                                                      .ThenInclude(pb => pb.HealthRegion)
                                                      .Include(icp => icp.PatientHealthRegion)
                                                      .SingleOrDefault(icp => icp.Id == id);

                if (inClinicProcedure == default)
                {
                    return default;
                }

                PatientSummaryViewModel patient = base.GetPatient <PatientSummaryViewModel>(p => p.Id == inClinicProcedure.PatientId);

                HealthcarePractitionerSummaryViewModel sender =
                    base.GetHealthcarePractitioner <HealthcarePractitionerSummaryViewModel>(hp => hp.Id == inClinicProcedure.SenderId);

                CeasedClinicalViewModel ceasedClinical = base.GetCeasedClinical <CeasedClinicalViewModel>(cc => cc.Id == inClinicProcedure.CeasedClinicalPathId);

                DiagPreviewViewModel firstMainDiag = base.GetDiag <DiagPreviewViewModel>(d => d.Id == inClinicProcedure.FirstMainDiagId);

                DiagPreviewViewModel secondMainDiag = base.GetDiag <DiagPreviewViewModel>(d => d.Id == inClinicProcedure.SecondMainDiagId);

                return new InClinicProcedureViewModel()
                {
                    Id = inClinicProcedure.Id,
                    Patient = patient,
                    PatientBranch = inClinicProcedure?.PatientBranch?.HealthRegion?.Name ?? default,
                    PatientHealthRegion = inClinicProcedure.PatientHealthRegion.Name,
                    Sender = sender,
                    APrSend = inClinicProcedure.APrSend,
                    TypeProcSend = inClinicProcedure.TypeProcSend,
                    DateSend = inClinicProcedure.DateSend,
                    CPrPriem = inClinicProcedure.CPrPriem,
                    APrPriem = inClinicProcedure.APrPriem,
                    TypeProcPriem = inClinicProcedure.TypeProcPriem,
                    ProcRefuse = inClinicProcedure.ProcRefuse,
                    CeasedClinicalPath = ceasedClinical,
                    IZNumChild = inClinicProcedure.IZNumChild,
                    IZYearChild = inClinicProcedure.IZYearChild,
                    FirstVisitDate = inClinicProcedure.FirstVisitDate,
                    PlanVisitDate = inClinicProcedure.PlanVisitDate,
                    VisitDoctorUniqueIdentifier = inClinicProcedure.VisitDoctorUniqueIdentifier,
                    VisitDoctorName = inClinicProcedure.VisitDoctorName,
                    FirstMainDiag = firstMainDiag,
                    SecondMainDiag = secondMainDiag,
                    PatientStatus = inClinicProcedure.PatientStatus,
                    NZOKPay = inClinicProcedure.NZOKPay
                };
            }));
        }
Esempio n. 2
0
        private Entry CreateCeasedClinicalEntry(CeasedClinicalViewModel model)
        {
            if (model == default)
            {
                throw new ArgumentNullException(nameof(model));
            }

            return(EhrManager.EntryBuilder
                   .Clear()
                   .AddItems(
                       EhrManager.ElementBuilder.Clear()
                       .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.Code)).Build())
                       .AddValue(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(model.Code).Build()).Build(),
                       EhrManager.ElementBuilder.Clear()
                       .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.IZMedicalWard)).Build())
                       .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.IZMedicalWard).Build()).Build(),
                       EhrManager.ElementBuilder.Clear()
                       .AddName(EhrManager.SimpleTextBuilder.Clear().AddOriginalText(nameof(model.IZYearMedicalWard)).Build())
                       .AddValue(EhrManager.INTBuilder.Clear().AddValue(model.IZYearMedicalWard).Build()).Build()
                       )
                   .Build());
        }
        public async Task <PathProcedureViewModel> GetPathProcedureByIdAsync(int id)
        {
            return(await Task <PathProcedureViewModel> .Run(() =>
            {
                PathProcedure pathProcedure = MedicContext.PathProcedures
                                              .Include(pp => pp.PatientBranch)
                                              .ThenInclude(pb => pb.HealthRegion)
                                              .Include(pp => pp.PatientHRegion)
                                              .SingleOrDefault(pp => pp.Id == id);

                if (pathProcedure == default)
                {
                    return default;
                }

                PatientSummaryViewModel patient = base.GetPatient <PatientSummaryViewModel>(p => p.Id == pathProcedure.PatientId);

                HealthcarePractitionerSummaryViewModel sender =
                    base.GetHealthcarePractitioner <HealthcarePractitionerSummaryViewModel>(hp => hp.Id == pathProcedure.SenderId);

                CeasedClinicalViewModel CeasedProcedure = base.GetCeasedClinical <CeasedClinicalViewModel>(cc => cc.Id == pathProcedure.CeasedProcedureId);

                CeasedClinicalViewModel CeasedClinicalPath = base.GetCeasedClinical <CeasedClinicalViewModel>(cc => cc.Id == pathProcedure.CeasedClinicalPathId);

                DiagPreviewViewModel firstMainDiag = base.GetDiag <DiagPreviewViewModel>(d => d.Id == pathProcedure.FirstMainDiagId);

                DiagPreviewViewModel secondMainDiag = base.GetDiag <DiagPreviewViewModel>(d => d.Id == pathProcedure.SecondMainDiagId);

                List <ProcedureSummaryViewModel> doneNewProcedures = base.GetProcedures <ProcedureSummaryViewModel>(pr => pr.PathProcedureId == pathProcedure.Id);

                List <ClinicUsedDrugViewModel> usedDrugs = MedicContext.ClinicUsedDrugs
                                                           .Where(ud => ud.PathProcedureId == pathProcedure.Id)
                                                           .ProjectTo <ClinicUsedDrugViewModel>(Configuration)
                                                           .ToList();

                List <ClinicProcedureViewModel> clinicProcedure = MedicContext.ClinicProcedures
                                                                  .Where(cp => cp.PathProcedureId == pathProcedure.Id)
                                                                  .ProjectTo <ClinicProcedureViewModel>(Configuration)
                                                                  .ToList();

                List <DoneProcedureViewModel> doneProcedures = MedicContext.DoneProcedures
                                                               .Where(dp => dp.PathProcedureId == pathProcedure.Id)
                                                               .ProjectTo <DoneProcedureViewModel>(Configuration)
                                                               .ToList();

                return new PathProcedureViewModel()
                {
                    Id = pathProcedure.Id,
                    Patient = patient,
                    PatientBranch = pathProcedure?.PatientBranch?.HealthRegion?.Name ?? default,
                    PatientHRegion = pathProcedure?.PatientHRegion?.Name ?? default,
                    Sender = sender,
                    CPrSend = pathProcedure.CPrSend,
                    APrSend = pathProcedure.APrSend,
                    TypeProcSend = pathProcedure.TypeProcSend,
                    DateSend = pathProcedure.DateSend,
                    CPrPriem = pathProcedure.CPrPriem,
                    APrPriem = pathProcedure.APrPriem,
                    MedicalWard = pathProcedure.MedicalWard,
                    TypeProcPriem = pathProcedure.TypeProcPriem,
                    ProcRefuse = pathProcedure.ProcRefuse,
                    CeasedProcedure = CeasedProcedure,
                    CeasedClinicalPath = CeasedClinicalPath,
                    IZNumChild = pathProcedure.IZNumChild,
                    IZYearChild = pathProcedure.IZYearChild,
                    FirstVisitDate = pathProcedure.FirstVisitDate,
                    DatePlanPriem = pathProcedure.DatePlanPriem,
                    VisitDoctorUniqueIdentifier = pathProcedure.VisitDoctorUniqueIdentifier,
                    VisitDoctorName = pathProcedure.VisitDoctorName,
                    FirstMainDiag = firstMainDiag,
                    SecondMainDiag = secondMainDiag,
                    DateProcedureBegins = pathProcedure.DateProcedureBegins,
                    DateProcedureEnd = pathProcedure.DateProcedureEnd,
                    DoneNewProcedures = doneNewProcedures,
                    UsedDrugs = usedDrugs,
                    ClinicProcedures = clinicProcedure,
                    DoneProcedures = doneProcedures,
                    AllDoneProcedures = pathProcedure.AllDoneProcedures,
                    AllDrugCost = pathProcedure.AllDrugCost,
                    PatientStatus = pathProcedure.PatientStatus,
                    OutUniqueIdentifier = pathProcedure.OutUniqueIdentifier,
                    Sign = pathProcedure.Sign,
                    NZOKPay = pathProcedure.NZOKPay
                };
            }));
        }