public void ChangeDetails(DateTime testDate, string testResult, LabTestUnit testUnit, string labValue, string referenceLower, string referenceUpper) { TestDate = testDate; TestResult = testResult; if (testUnit != null) { TestUnitId = testUnit.Id; TestUnit = testUnit; } LabValue = labValue; ReferenceLower = referenceLower; ReferenceUpper = referenceUpper; }
public PatientLabTest(DateTime testDate, string testResult, LabTest labTest, LabTestUnit testUnit, string labValue, string referenceLower, string referenceUpper, string labTestSource) { PatientLabTestGuid = Guid.NewGuid(); Archived = false; TestDate = testDate; TestResult = testResult; LabTestId = labTest.Id; LabTest = labTest; if (testUnit != null) { TestUnitId = testUnit.Id; TestUnit = testUnit; } LabValue = labValue; ReferenceLower = referenceLower; ReferenceUpper = referenceUpper; LabTestSource = labTestSource; }
public void ChangeLabTestDetails(int patientLabTestId, DateTime testDate, string testResult, LabTestUnit testUnit, string labValue, string referenceLower, string referenceUpper) { var patientLabTest = PatientLabTests.SingleOrDefault(t => t.Id == patientLabTestId); if (patientLabTest == null) { throw new KeyNotFoundException($"Unable to locate lab test {patientLabTestId} on patient {Id}"); } if (DateOfBirth.HasValue) { if (testDate.Date < DateOfBirth.Value.Date) { throw new DomainException("Test Date should be after patient Date Of Birth"); } } patientLabTest.ChangeDetails(testDate, testResult, testUnit, labValue, referenceLower, referenceUpper); }
public PatientLabTest AddLabTest(DateTime testDate, string testResult, LabTest labTest, LabTestUnit testUnit, string labValue, string referenceLower, string referenceUpper) { if (DateOfBirth.HasValue) { if (testDate.Date < DateOfBirth.Value.Date) { throw new DomainException("Test Date should be after patient Date Of Birth"); } } var newPatientLabTest = new PatientLabTest(testDate, testResult, labTest, testUnit, labValue, referenceLower, referenceUpper, labTest.Description); PatientLabTests.Add(newPatientLabTest); return(newPatientLabTest); }