public function __invoke(RegisterWalkIn $registerWalkIn) { $patient = Patient::walkIn(PersonalInformation::fromDetails(FullName::fromParts($registerWalkIn->firstName, $registerWalkIn->lastName), BirthDate::fromYearMonthDayFormat($registerWalkIn->dateOfBirth), new Sex($registerWalkIn->sex), $registerWalkIn->patientId), $registerWalkIn->indication, $registerWalkIn->patientId); $this->patientRepository->add($patient); }
public static function walkIn(PersonalInformation $personalInformation, $indication, PatientId $id) { $patient = new Patient($personalInformation, $indication, true, $id); $patient->record(new WalkInRegistered($personalInformation, $indication)); return $patient; }