Beispiel #1
0
        public ActionResult CreateAdverseEvent(int patientId)
        {
            IClinicalStudyDesign studyDesign = clinicalStudyDesignFactory.Create();

            Visit aeVisit = studyDesign.AddAdverseEventVisit(patientId);

            clinicalStudyDesignFactory.Release(studyDesign);


            if (aeVisit == null)
            {
                return(null);
            }


            return(Content(aeVisit.Caption));
        }
        public void AddAdverseEventVisit(Patient patient)
        {
            var visit = clinicalStudyDesign.AddAdverseEventVisit(patient.Id);

            var day1Date = patient.Visits.FirstOrDefault(v => v.VisitTypeValue == (int)VisitType.Day1).VisitDate;

            SetRealVisitDateAndTime(visit, day1Date.Value.AddDays(randomGenerator.Next(9)));
            //vitals form
            var form = visit.Forms.ToList().OrderBy(f => f.OrderNo).Last(f => f.FormType == FormType.AdverseEvent);

            form.FormState = FormState.Completed;
            var formData = adverseEventFormDataRepository.GetFormDataByFormId(form.Id);



            formData.AdverseExperience.Value = GetRandomAdverseEvent();
            formData.RelationshipToInvestigationalDrug.Value =
                ((int)(AdverseEventRelanshionship)(randomGenerator.Next(4) + 1)).ToString();
            formData.Outcome.Value =
                ((int)(AdverseEventOutcome)(randomGenerator.Next(2) + 1)).ToString();
            formData.Intensity.Value =
                ((int)(AdverseEventIntensity)(randomGenerator.Next(3) + 1)).ToString();

            int onsetHour   = randomGenerator.Next(0, 23);
            int onsetMinute = randomGenerator.Next(0, 60);

            onsetMinute = onsetMinute - onsetMinute % 10;
            var onsetDate = visit.VisitDate.Value.AddDays(-(randomGenerator.Next(3) + 1)).Date;

            onsetDate = onsetDate.AddHours(onsetHour);
            onsetDate = onsetDate.AddMinutes(onsetMinute);
            formData.OnsetDate.Value = onsetDate.Date.ToString();
            formData.OnsetTime.Value = onsetDate.ToString();

            var endDate = onsetDate.AddMinutes(randomGenerator.Next(3, 36) * 10);

            formData.EndDate.Value = endDate.Date.ToString();
            formData.EndTime.Value = endDate.ToString();
        }