Example #1
0
 public HomeController(
     ICPFileService cpFileService,
     IDiagnoseService diagnoseService,
     IDiagService diagService,
     IHospitalPracticeService hospitalPracticeService,
     IPatientService patientService,
     IUsedDrugService usedDrugService,
     ILogger <HomeController> logger,
     MedicDataLocalization medicDataLocalization,
     ICacheable medicCache,
     IMedicLoggerService medicLoggerService,
     IFormattableFactory formattableFactory)
     : base(medicDataLocalization)
 {
     CPFileService           = cpFileService ?? throw new ArgumentNullException(nameof(cpFileService));
     DiagnoseService         = diagnoseService ?? throw new ArgumentNullException(nameof(diagnoseService));
     DiagService             = diagService ?? throw new ArgumentNullException(nameof(diagService));
     HospitalPracticeService = hospitalPracticeService ?? throw new ArgumentNullException(nameof(hospitalPracticeService));
     PatientService          = patientService ?? throw new ArgumentNullException(nameof(patientService));
     UsedDrugService         = usedDrugService ?? throw new ArgumentNullException(nameof(usedDrugService));
     Logger             = logger ?? throw new ArgumentNullException(nameof(logger));
     MedicCache         = medicCache ?? throw new ArgumentNullException(nameof(medicCache));
     MedicLoggerService = medicLoggerService ?? throw new ArgumentNullException(nameof(medicLoggerService));
     FormattableFactory = formattableFactory ?? throw new ArgumentNullException(nameof(formattableFactory));
 }
Example #2
0
 public LookupsBaseController(IPatientService patientService,
                              IHealthRegionService healthRegionService,
                              ICacheable medicCache,
                              MedicDataLocalization medicDataLocalization)
     : base(patientService, medicCache, medicDataLocalization)
 {
     _healthRegionService = healthRegionService ?? throw new ArgumentNullException(nameof(healthRegionService));
 }
 protected virtual List <SexOption> GetDefaultSexes() =>
 new List <SexOption>()
 {
     new SexOption()
     {
         Id = null, Name = MedicDataLocalization.Get(MedicDataLocalization.NoSelection)
     }
 };
Example #4
0
 protected virtual List <HealthRegionOption> GetDefaultHealthRegions() =>
 new List <HealthRegionOption>()
 {
     new HealthRegionOption()
     {
         Id = null, Name = MedicDataLocalization.Get(MedicDataLocalization.NoSelection)
     }
 };
 public AdministratorController(UserManager <IdentityUser> userManager,
                                IMedicLoggerService medicLoggerService,
                                MedicDataLocalization medicDataLocalization,
                                IConfiguration configuration)
 {
     UserManager              = userManager ?? throw new ArgumentNullException(nameof(userManager));
     MedicLoggerService       = medicLoggerService ?? throw new ArgumentNullException(nameof(medicLoggerService));
     MedicDataLocalization    = medicDataLocalization ?? throw new ArgumentNullException(nameof(medicDataLocalization));
     DefaultAdministratorName = configuration[MedicConstants.AdministratorName];
 }
Example #6
0
        public async Task <IActionResult> Index(PlannedSearch search, int page = 1)
        {
            try
            {
                PlannedWhereBuilder plannedWhereBuilder = new PlannedWhereBuilder(search);

                string searchParams = search != default ? search.ToString() : default;

                List <PlannedPreviewViewModel> plannings = await GetPage(search, plannedWhereBuilder, searchParams, page);

                string plannedCountKey = $"{MedicConstants.Planned} - {searchParams}";

                if (!base.MedicCache.TryGetValue(plannedCountKey, out int planningsCount))
                {
                    planningsCount = await PlannedService
                                     .GetPlanningsCountAsync(plannedWhereBuilder);

                    base.MedicCache.Set(plannedCountKey, planningsCount);
                }

                List <SexOption> sexOptions = base.GetDefaultSexes();
                sexOptions.AddRange(await base.GetSexesAsync());

                List <HealthRegionOption> healthRegions = base.GetDefaultHealthRegions();
                healthRegions.AddRange(await base.GetHealthRegionsAsync());

                return(View(new PlannedPageIndexModel()
                {
                    Plannings = plannings,
                    Title = MedicDataLocalization.Get(MedicDataLocalization.Plannings),
                    Description = MedicDataLocalization.Get(MedicDataLocalization.Plannings),
                    Keywords = MedicDataLocalization.Get(MedicDataLocalization.PlanningsSummary),
                    Search = search,
                    CurrentPage = page,
                    TotalPages = base.TotalPages((int)search.Length, planningsCount),
                    TotalResults = planningsCount,
                    Sexes = sexOptions,
                    HealthRegions = healthRegions
                }));
            }
            catch (Exception ex)
            {
                Task <int> _ = MedicLoggerService.SaveAsync(new Log()
                {
                    Message = ex.Message,
                    InnerExceptionMessage = ex?.InnerException?.Message ?? null,
                    Source     = ex.Source,
                    StackTrace = ex.StackTrace,
                    Date       = DateTime.Now
                });

                throw ex;
            }
        }
Example #7
0
 public PatientController(IPatientService patientService,
                          PatientLocalization patientLocalization,
                          MedicDataLocalization medicDataLocalization,
                          ICacheable medicCache,
                          IMedicLoggerService medicLoggerService,
                          IToEHRConverter toEHRConverter,
                          IFormattableFactory formattableFactory)
     : base(patientService, medicCache, medicDataLocalization)
 {
     PatientLocalization = patientLocalization ?? throw new ArgumentNullException(nameof(patientLocalization));
     MedicLoggerService  = medicLoggerService ?? throw new ArgumentNullException(nameof(medicLoggerService));
     ToEHRConverter      = toEHRConverter ?? throw new ArgumentNullException(nameof(toEHRConverter));
     FormattableFactory  = formattableFactory ?? throw new ArgumentNullException(nameof(formattableFactory));
 }
 public FileUploadController(
     IImportMedicFile importMedicFile,
     IMedicXmlParser medicXmlParser,
     IMappable mapper,
     MedicDataLocalization medicDataLocalization,
     IMedicLoggerService medicLoggerService,
     ICacheable medicCache)
 {
     ImportMedicFile       = importMedicFile ?? throw new ArgumentNullException(nameof(importMedicFile));
     MedicXmlParser        = medicXmlParser ?? throw new ArgumentNullException(nameof(medicXmlParser));
     Mapper                = mapper ?? throw new ArgumentNullException(nameof(mapper));
     MedicDataLocalization = medicDataLocalization ?? throw new ArgumentNullException(nameof(MedicBaseController));
     MedicLoggerService    = medicLoggerService ?? throw new ArgumentNullException(nameof(medicLoggerService));
     MedicCache            = medicCache ?? throw new ArgumentNullException(nameof(medicCache));
 }
Example #9
0
 public PlannedController(IPlannedService plannedService,
                          IPatientService patientService,
                          IHealthRegionService healthRegionService,
                          MedicDataLocalization medicDataLocalization,
                          ICacheable medicCache,
                          IMedicLoggerService medicLoggerService,
                          IToEHRConverter toEHRConverter,
                          IFormattableFactory formattableFactory)
     : base(patientService, healthRegionService, medicCache, medicDataLocalization)
 {
     PlannedService     = plannedService ?? throw new ArgumentNullException(nameof(plannedService));
     MedicLoggerService = medicLoggerService ?? throw new ArgumentNullException(nameof(medicLoggerService));
     ToEHRConverter     = toEHRConverter ?? throw new ArgumentNullException(nameof(toEHRConverter));
     FormattableFactory = formattableFactory ?? throw new ArgumentNullException(nameof(formattableFactory));
 }
Example #10
0
 public TransferController(
     ITransferService transferService,
     IMedicLoggerService medicLoggerService,
     IToEHRConverter toEHRConverter,
     IFormattableFactory formattableFactory,
     IPatientService patientService,
     IHealthRegionService healthRegionService,
     ICacheable medicCache,
     MedicDataLocalization medicDataLocalization) :
     base(patientService, healthRegionService, medicCache, medicDataLocalization)
 {
     this.TransferService    = transferService ?? throw new ArgumentNullException(nameof(transferService));
     this.MedicLoggerService = medicLoggerService ?? throw new ArgumentNullException(nameof(medicLoggerService));
     this.ToEHRConverter     = toEHRConverter ?? throw new ArgumentNullException(nameof(toEHRConverter));
     this.FormattableFactory = formattableFactory ?? throw new ArgumentNullException(nameof(formattableFactory));
 }
Example #11
0
        public async Task <IActionResult> Index(TransferSearch search, int page = 1)
        {
            try
            {
                TransferWhereBuilder plannedWhereBuilder = new TransferWhereBuilder(search);

                string searchParams = search != default ? search.ToString() : default;

                List <TransferPreviewViewModel> trasnfers = await GetPage(search, plannedWhereBuilder, searchParams, page);

                string trasnferCountKey = $"{MedicConstants.Transfers} - {searchParams}";

                if (!base.MedicCache.TryGetValue(trasnferCountKey, out int trasnfersCount))
                {
                    trasnfersCount = await TransferService
                                     .GetTrasnfersCountAsync(plannedWhereBuilder);

                    base.MedicCache.Set(trasnferCountKey, trasnfersCount);
                }

                return(View(new TransferPageIndexModel()
                {
                    Transfers = trasnfers,
                    Title = MedicDataLocalization.Get(MedicDataLocalization.Transfers),
                    Description = MedicDataLocalization.Get(MedicDataLocalization.Transfers),
                    Keywords = MedicDataLocalization.Get(MedicDataLocalization.TransfersSummary),
                    Search = search,
                    CurrentPage = page,
                    TotalPages = base.TotalPages((int)search.Length, trasnfersCount),
                    TotalResults = trasnfersCount
                }));
            }
            catch (Exception ex)
            {
                Task <int> _ = MedicLoggerService.SaveAsync(new Log()
                {
                    Message = ex.Message,
                    InnerExceptionMessage = ex?.InnerException?.Message ?? null,
                    Source     = ex.Source,
                    StackTrace = ex.StackTrace,
                    Date       = DateTime.Now
                });

                throw ex;
            }
        }
Example #12
0
 public OutController(IOutService outService,
                      IPatientService patientService,
                      IUsedDrugService usedDrugService,
                      IHealthRegionService healthRegionService,
                      MedicDataLocalization medicDataLocalization,
                      ICacheable medicCache,
                      IMedicLoggerService medicLoggerService,
                      IToEHRConverter toEHRConverter,
                      IFormattableFactory formattableFactory)
     : base(patientService, healthRegionService, medicCache, medicDataLocalization)
 {
     OutService         = outService ?? throw new ArgumentNullException(nameof(outService));
     UsedDrugService    = usedDrugService ?? throw new ArgumentNullException(nameof(usedDrugService));
     MedicLoggerService = medicLoggerService ?? throw new ArgumentNullException(nameof(medicLoggerService));
     ToEHRConverter     = toEHRConverter ?? throw new ArgumentNullException(nameof(toEHRConverter));
     FormattableFactory = formattableFactory ?? throw new ArgumentNullException(nameof(formattableFactory));
 }
Example #13
0
 public PathProcedureController(IPathProcedureService pathProcedureService,
                                IPatientService patientService,
                                IHealthRegionService healthRegionService,
                                IClinicUsedDrugsService clinicUsedDrugsService,
                                MedicDataLocalization medicDataLocalization,
                                ICacheable medicCache,
                                IMedicLoggerService medicLoggerService,
                                IToEHRConverter toEHRConverter,
                                IFormattableFactory formattableFactory)
     : base(patientService, healthRegionService, medicCache, medicDataLocalization)
 {
     PathProcedureService   = pathProcedureService ?? throw new ArgumentNullException(nameof(pathProcedureService));
     ClinicUsedDrugsService = clinicUsedDrugsService ?? throw new ArgumentNullException(nameof(clinicUsedDrugsService));
     MedicLoggerService     = medicLoggerService ?? throw new ArgumentNullException(nameof(medicLoggerService));
     ToEHRConverter         = toEHRConverter ?? throw new ArgumentNullException(nameof(toEHRConverter));
     FormattableFactory     = formattableFactory ?? throw new ArgumentNullException(nameof(formattableFactory));
 }
 public ProtocolDrugTherapyController(
     IProtocolDrugTherapyService protocolDrugTherapyService,
     IDrugProtocolService drugProtocolService,
     IPatientService patientService,
     IHealthRegionService healthRegionService,
     MedicDataLocalization medicDataLocalization,
     ICacheable medicCache,
     IMedicLoggerService medicLoggerService,
     IToEHRConverter toEHRConverter,
     IFormattableFactory formattableFactory)
     : base(patientService, healthRegionService, medicCache, medicDataLocalization)
 {
     ProtocolDrugTherapyService = protocolDrugTherapyService ?? throw new ArgumentNullException(nameof(protocolDrugTherapyService));
     DrugProtocolService        = drugProtocolService ?? throw new ArgumentNullException(nameof(drugProtocolService));
     MedicLoggerService         = medicLoggerService ?? throw new ArgumentNullException(nameof(medicLoggerService));
     ToEHRConverter             = toEHRConverter ?? throw new ArgumentNullException(nameof(toEHRConverter));
     FormattableFactory         = formattableFactory ?? throw new ArgumentNullException(nameof(formattableFactory));
 }
Example #15
0
        public async Task <IActionResult> Planned(int id)
        {
            try
            {
                PlannedViewModel model;
                string           error = default;

                if (id < 1)
                {
                    model = default;
                    error = MedicDataLocalization.Get(MedicDataLocalization.InvalidId);
                }
                else
                {
                    model = await GetModelById(id);
                }

                return(View(new PlannedPagePlannedModel()
                {
                    Title = MedicDataLocalization.Get(MedicDataLocalization.Planned),
                    Description = MedicDataLocalization.Get(MedicDataLocalization.Planned),
                    Keywords = MedicDataLocalization.Get(MedicDataLocalization.PlannedSummary),
                    Planned = model,
                    Error = error
                }));
            }
            catch (Exception ex)
            {
                Task <int> _ = MedicLoggerService.SaveAsync(new Log()
                {
                    Message = ex.Message,
                    InnerExceptionMessage = ex?.InnerException?.Message ?? null,
                    Source     = ex.Source,
                    StackTrace = ex.StackTrace,
                    Date       = DateTime.Now
                });

                throw;
            }
        }
Example #16
0
        public async Task <IActionResult> Patient(int id)
        {
            try
            {
                PatientViewModel model;
                string           error;

                if (id < 1)
                {
                    model = default;
                    error = MedicDataLocalization.Get(MedicDataLocalization.InvalidId);
                }
                else
                {
                    model = await GetModelById(id);
                }

                return(View(new PatientPagePatientModel()
                {
                    Patient = model,
                    Title = PatientLocalization.Get(PatientLocalization.PatientData),
                    Description = PatientLocalization.Get(PatientLocalization.PatientData),
                    Keywords = PatientLocalization.Get(PatientLocalization.PatientViewMetaData),
                }));
            }
            catch (Exception ex)
            {
                Task <int> _ = MedicLoggerService.SaveAsync(new Log()
                {
                    Message = ex.Message,
                    InnerExceptionMessage = ex?.InnerException?.Message ?? null,
                    Source     = ex.Source,
                    StackTrace = ex.StackTrace,
                    Date       = DateTime.Now
                });

                throw;
            }
        }
Example #17
0
 public SexBaseController(IPatientService patientService, ICacheable medicCache, MedicDataLocalization medicDataLocalization)
     : base(medicDataLocalization)
 {
     _patientService = patientService ?? throw new ArgumentNullException(nameof(patientService));
     _medicCache     = medicCache ?? throw new ArgumentNullException(nameof(medicCache));
 }
Example #18
0
        public async Task <IActionResult> Index(OutSearch search, int page = 1)
        {
            try
            {
                OutWhereBuilder outWhereBuilder = new OutWhereBuilder(search);

                string searchParams = search != default ? search.ToString() : default;

                string outsCountKey = $"{MedicConstants.OutsCount} - {searchParams}";

                List <OutPreviewViewModel> outs = await GetPage(search, outWhereBuilder, searchParams, page);

                if (!base.MedicCache.TryGetValue(outsCountKey, out int outsCount))
                {
                    outsCount = await OutService.GetOutsCountAsync(outWhereBuilder);

                    base.MedicCache.Set(outsCountKey, outsCount);
                }

                List <SexOption> sexOptions = base.GetDefaultSexes();
                sexOptions.AddRange(await base.GetSexesAsync());

                List <HealthRegionOption> healthRegions = base.GetDefaultHealthRegions();
                healthRegions.AddRange(await base.GetHealthRegionsAsync());

                List <UsedDrugCodeOption> usedDrugs = new List <UsedDrugCodeOption>()
                {
                    new UsedDrugCodeOption()
                    {
                        Key = string.Empty, Code = MedicDataLocalization.Get(MedicDataLocalization.NoSelection)
                    }
                };

                if (!MedicCache.TryGetValue(MedicConstants.UsedDrugs, out List <UsedDrugCodeOption> drugs))
                {
                    drugs = await UsedDrugService.UsedDrugsByCodeAsync();

                    MedicCache.Set(MedicConstants.UsedDrugs, drugs);
                }

                usedDrugs.AddRange(drugs);

                return(View(new OutPageIndexModel()
                {
                    Outs = outs,
                    Title = MedicDataLocalization.Get(MedicDataLocalization.OutsView),
                    Description = MedicDataLocalization.Get(MedicDataLocalization.OutsView),
                    Keywords = MedicDataLocalization.Get(MedicDataLocalization.OutsSummary),
                    Search = search,
                    CurrentPage = page,
                    TotalPages = base.TotalPages((int)search.Length, outsCount),
                    TotalResults = outsCount,
                    Sexes = sexOptions,
                    UsedDrugCodes = usedDrugs,
                    HealthRegions = healthRegions
                }));
            }
            catch (Exception ex)
            {
                Task <int> _ = MedicLoggerService.SaveAsync(new Log()
                {
                    Message = ex.Message,
                    InnerExceptionMessage = ex?.InnerException?.Message ?? null,
                    Source     = ex.Source,
                    StackTrace = ex.StackTrace,
                    Date       = DateTime.Now
                });

                throw;
            }
        }
        public async Task <IActionResult> Index(ProtocolDrugTherapySearch search, int page = 1)
        {
            try
            {
                ProtocolDrugTherapyWhereBuilder protocolDrugTherapyWhereBuilder = new ProtocolDrugTherapyWhereBuilder(search);

                string searchParams = search != default ? search.ToString() : default;

                List <ProtocolDrugTherapyPreviewViewModel> protocolDrugTherapies = await GetPage(search, protocolDrugTherapyWhereBuilder, searchParams, page);

                string protocolDrugTherapiesCountKey = $"{MedicConstants.ProtocolDrugTherapies} - {searchParams}";

                if (!base.MedicCache.TryGetValue(protocolDrugTherapiesCountKey, out int protocolDrugTherapiesCount))
                {
                    protocolDrugTherapiesCount = await ProtocolDrugTherapyService
                                                 .GetProtocolDrugTherapiesCountAsync(protocolDrugTherapyWhereBuilder);

                    base.MedicCache.Set(protocolDrugTherapiesCountKey, protocolDrugTherapiesCount);
                }

                List <string> atcNames = new List <string>()
                {
                    default
                };

                if (!base.MedicCache.TryGetValue(MedicConstants.AtcNames, out List <string> addedAtcNames))
                {
                    addedAtcNames = await DrugProtocolService.GetDrugProtocolATCNames();

                    addedAtcNames.Sort((x, y) => x.CompareTo(y));

                    base.MedicCache.Set(MedicConstants.AtcNames, addedAtcNames);
                }

                atcNames.AddRange(addedAtcNames);

                List <SexOption> sexOptions = base.GetDefaultSexes();
                sexOptions.AddRange(await base.GetSexesAsync());

                List <HealthRegionOption> healthRegions = base.GetDefaultHealthRegions();
                healthRegions.AddRange(await base.GetHealthRegionsAsync());

                return(View(new ProtocolDrugTherapyPageIndexModel()
                {
                    ProtocolDrugTherapies = protocolDrugTherapies,
                    Title = MedicDataLocalization.Get(MedicDataLocalization.ProtocolDrugTherapies),
                    Description = MedicDataLocalization.Get(MedicDataLocalization.ProtocolDrugTherapies),
                    Keywords = MedicDataLocalization.Get(MedicDataLocalization.ProtocolDrugTherapiesSummary),
                    Search = search,
                    CurrentPage = page,
                    TotalPages = base.TotalPages((int)search.Length, protocolDrugTherapiesCount),
                    TotalResults = protocolDrugTherapiesCount,
                    Sexes = sexOptions,
                    HealthRegions = healthRegions,
                    ATCNames = atcNames
                }));
            }
            catch (Exception ex)
            {
                Task <int> _ = MedicLoggerService.SaveAsync(new Log()
                {
                    Message = ex.Message,
                    InnerExceptionMessage = ex?.InnerException?.Message ?? null,
                    Source     = ex.Source,
                    StackTrace = ex.StackTrace,
                    Date       = DateTime.Now
                });

                throw;
            }
        }
Example #20
0
 public FormatterBaseController(MedicDataLocalization medicDataLocalization)
 {
     _medicDataLocalization = medicDataLocalization ?? throw new ArgumentNullException(nameof(medicDataLocalization));
 }