示例#1
0
        /// <summary>
        /// Prepare patient record with associated lab tests
        /// </summary>
        private async Task AddLabTestsAsync(Patient patient, List <LabTestDetail> labTests)
        {
            if (patient == null)
            {
                throw new ArgumentNullException(nameof(patient));
            }
            if (labTests == null)
            {
                throw new ArgumentNullException(nameof(labTests));
            }
            if (labTests.Count == 0)
            {
                return;
            }

            foreach (var labTest in labTests)
            {
                var labTestFromRepo = await _labTestRepository.GetAsync(lt => lt.Description == labTest.LabTestSource);

                var newLabTest = patient.AddLabTest(labTest.TestDate, labTest.TestResult, labTestFromRepo, null, string.Empty, string.Empty, string.Empty);

                // Custom Property handling
                _typeExtensionHandler.UpdateExtendable(newLabTest, labTest.CustomAttributes, "Admin");

                patient.PatientLabTests.Add(newLabTest);
            }
        }