示例#1
0
 private async Task LinkMedicationToReportInstances(IEnumerable <PatientClinicalEvent> clinicalEvents, List <ReportInstanceMedicationListItem> medications)
 {
     foreach (var clinicalEvent in clinicalEvents)
     {
         await _workFlowService.AddOrUpdateMedicationsForWorkFlowInstanceAsync(clinicalEvent.PatientClinicalEventGuid, medications);
     }
 }
示例#2
0
        private async Task AddOrUpdateMedicationsOnReportInstanceAsync(Patient patientFromRepo, DateTime medicationStartDate, DateTime?medicationEndDate, string medicationDisplayName, Guid medicationGuid)
        {
            var weeks = await GetNumberOfWeeksToCheckAsync();

            var clinicalEvents = GetClinicalEventsWhichOccuredDuringMedicationPeriod(patientFromRepo, medicationStartDate, medicationEndDate, weeks);
            var medications    = PrepareMedicationsForLinkingToReport(medicationDisplayName, medicationGuid);

            foreach (var clinicalEvent in clinicalEvents)
            {
                await _workFlowService.AddOrUpdateMedicationsForWorkFlowInstanceAsync(clinicalEvent.PatientClinicalEventGuid, medications);
            }
        }
        private async Task LinkMedicationsToClinicalEvent(Patient patientFromRepo, DateTime?onsetDate, Guid patientClinicalEventGuid)
        {
            var weeks = await GetNumberOfWeeksToCheckAsync();

            // Prepare medications
            List <ReportInstanceMedicationListItem> medications = new List <ReportInstanceMedicationListItem>();

            foreach (var med in patientFromRepo.PatientMedications.Where(m => m.Archived == false &&
                                                                         (m.EndDate == null && m.StartDate.AddDays(weeks * -7) <= onsetDate) ||
                                                                         (m.EndDate != null && m.StartDate.AddDays(weeks * -7) <= onsetDate && Convert.ToDateTime(m.EndDate).AddDays(weeks * 7) >= onsetDate))
                     .OrderBy(m => m.Concept.ConceptName))
            {
                var item = new ReportInstanceMedicationListItem()
                {
                    MedicationIdentifier         = med.DisplayName,
                    ReportInstanceMedicationGuid = med.PatientMedicationGuid
                };
                medications.Add(item);
            }
            await _workFlowService.AddOrUpdateMedicationsForWorkFlowInstanceAsync(patientClinicalEventGuid, medications);
        }