protected void HandlePatientLocation(Visit visit, PL patientLocation, bool isCurrent) { var location = FindLocation(patientLocation); var visitLocation = new VisitLocation { Role = VisitLocationRole.CR, Location = location, Room = patientLocation.Room.Value, Bed = patientLocation.Bed.Value, StartTime = Platform.Time }; if (isCurrent) { visit.Facility = location.Facility; visit.CurrentLocation = visitLocation.Location; visit.CurrentRoom = visitLocation.Room; visit.CurrentBed = visitLocation.Bed; } visit.Locations.Add(visitLocation); foreach ( var existing in visit.Locations.Where( existing => existing != visitLocation && existing.Role == visitLocation.Role && existing.EndTime.HasValue == false)) { existing.EndTime = Platform.Time; } }
private static VisitLocationDetail CreateVisitLocationDetail(VisitLocation vl, IPersistenceContext context) { var detail = new VisitLocationDetail { Location = new LocationAssembler().CreateLocationSummary(vl.Location), Room = vl.Room, Bed = vl.Bed, Role = EnumUtils.GetEnumValueInfo(vl.Role, context), StartTime = vl.StartTime, EndTime = vl.EndTime }; return(detail); }