Last active
December 18, 2016 08:36
-
-
Save mat-mcloughlin/bdbeba60fc20ce2e08310b12ce12d355 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Encounter | |
{ | |
string patientName; | |
DateTime birthDate; | |
int ageInYears; | |
DateTime timeOfAdmission; | |
WardHistory wardHistory; | |
bool currentlyAdmitted; | |
public void AdmitPatient(string patientName, DateTime birthDate, int ageInYears, DateTime timeOfAdmission, int wardNumber) | |
{ | |
if (currentlyAdmitted) | |
{ | |
throw new DomainException("Patient is already admitted"); | |
} | |
Raise(new PatientAdmitted(patientName, birthDate, ageInYears, timeOfAdmission, wardNumber)); | |
} | |
public void MarkPatientAsTreated() | |
{ | |
if (!currentlyAdmitted) | |
{ | |
throw new DomainException("Cannot treat a patient that is not admitted"); | |
} | |
Raise(new PatientMarkedAsTreated()); | |
} | |
public void TransferPatient(int toWardNumber) | |
{ | |
if (!currentlyAdmitted) | |
{ | |
throw new DomainException("Cannot transfer a patient that is not admitted"); | |
} | |
if (wardHistory.Current.WardNumber == toWardNumber) | |
{ | |
throw new DomainException("Cannot transfer a patient to the ward they are currently on"); | |
} | |
Raise(new PatientTransfered(toWardNumber)); | |
} | |
public void DischargePatient() | |
{ | |
if (!currentlyAdmitted) | |
{ | |
throw new DomainException("Cannot discharge a patient that is not admitted"); | |
} | |
Raise( new PatientDischarged()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment