Beispiel #1
0
        public static async Task <NewPatientVisitViewModel> BuildPatientVisitVM(AspergillosisContext context,
                                                                                int patientId, object visitDate = null)
        {
            var patientManager = new PatientManager(context);
            var patient        = await patientManager.FindPatientWithRelationsByIdAsync(patientId);

            if (patient == null)
            {
                return(null);
            }
            var patientMeasurements = context.PatientMeasurements
                                      .Where(pm => pm.PatientId == patient.ID);

            var patientVM = new NewPatientVisitViewModel();

            if (visitDate != null)
            {
                DateTime patientVisitDate = (DateTime)visitDate;
                patientVM.VisitDate = DateHelper.DateTimeToUnixTimestamp(patientVisitDate).ToString();
            }
            patientVM.PatientId                = patient.ID;
            patientVM.STGQuestionnaires        = patient.STGQuestionnaires;
            patientVM.PatientRadiologyFindings = patient.PatientRadiologyFindings;
            patientVM.PatientImmunoglobulines  = patient.PatientImmunoglobulines;
            if (patientMeasurements != null)
            {
                patientVM.PatientMeasurements = patientMeasurements.ToList();
            }
            return(patientVM);
        }
        protected async Task <PatientDetailsViewModel> GetExportViewModel(int id)
        {
            var crfManager = new CaseReportFormManager(_context);
            var patient    = await _patientManager.FindPatientWithRelationsByIdAsync(id);

            var patientDetailsViewModel = PatientDetailsViewModel.BuildPatientViewModel(_context, patient, crfManager);

            SetItemsToShowInExport(patientDetailsViewModel);
            return(patientDetailsViewModel);
        }
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var patient = await _patientManager.FindPatientWithRelationsByIdAsync(id);

            LoadReleatedMedicalTrials(patient);
            LoadRelatedDrugLevels(patient);
            if (patient == null)
            {
                return(NotFound());
            }

            var patientDetailsViewModel = PatientDetailsViewModel
                                          .BuildPatientViewModel(_context, patient, _caseReportFormManager);

            return(PartialView(patientDetailsViewModel));
        }
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var patient = _patientManager.FindPatientWithRelationsByIdAsync(id).Result;

            if (patient == null)
            {
                return(NotFound());
            }
            var anonPatientViewModel = AnonPatientDetailsViewModel.BuildAnonPatientViewModel(_context, patient);

            return(PartialView(@"/Views/Anonymous/Patients/Details.cshtml", anonPatientViewModel));
        }