public ReportingWorklistItemSummary CreateWorklistItemSummary(ReportingWorklistItem domainItem, IPersistenceContext context) { PersonNameAssembler assembler = new PersonNameAssembler(); return new ReportingWorklistItemSummary( domainItem.ProcedureStepRef, domainItem.ProcedureRef, domainItem.OrderRef, domainItem.PatientRef, domainItem.PatientProfileRef, domainItem.ReportRef, new MrnAssembler().CreateMrnDetail(domainItem.Mrn), assembler.CreatePersonNameDetail(domainItem.PatientName), domainItem.AccessionNumber, EnumUtils.GetEnumValueInfo(domainItem.OrderPriority, context), EnumUtils.GetEnumValueInfo(domainItem.PatientClass), domainItem.DiagnosticServiceName, domainItem.ProcedureName, domainItem.ProcedurePortable, domainItem.HasErrors, EnumUtils.GetEnumValueInfo(domainItem.ProcedureLaterality, context), domainItem.ProcedureStepName, domainItem.Time, domainItem.ActivityStatus.HasValue ? EnumUtils.GetEnumValueInfo(domainItem.ActivityStatus.Value, context) : null, domainItem.ReportPartIndex ); }
public ReportingWorklistItemSummary CreateWorklistItemSummary(ReportingWorklistItem domainItem, IPersistenceContext context) { PersonNameAssembler assembler = new PersonNameAssembler(); return(new ReportingWorklistItemSummary( domainItem.ProcedureStepRef, domainItem.ProcedureRef, domainItem.OrderRef, domainItem.PatientRef, domainItem.PatientProfileRef, domainItem.ReportRef, new MrnAssembler().CreateMrnDetail(domainItem.Mrn), assembler.CreatePersonNameDetail(domainItem.PatientName), domainItem.AccessionNumber, EnumUtils.GetEnumValueInfo(domainItem.OrderPriority, context), EnumUtils.GetEnumValueInfo(domainItem.PatientClass), domainItem.DiagnosticServiceName, domainItem.ProcedureName, domainItem.ProcedurePortable, domainItem.HasErrors, EnumUtils.GetEnumValueInfo(domainItem.ProcedureLaterality, context), domainItem.ProcedureStepName, domainItem.Time, domainItem.ActivityStatus.HasValue ? EnumUtils.GetEnumValueInfo(domainItem.ActivityStatus.Value, context) : null, domainItem.ReportPartIndex )); }
public OrderNoteboxItemSummary CreateSummary(OrderNoteboxItem item, IPersistenceContext context) { var mrnAssembler = new MrnAssembler(); var nameAssembler = new PersonNameAssembler(); var staffAssembler = new StaffAssembler(); var groupAssembler = new StaffGroupAssembler(); var staffRecipients = new List <StaffSummary>(); var groupRecipients = new List <StaffGroupSummary>(); foreach (var recipient in item.Recipients) { if (recipient is Staff) { staffRecipients.Add(staffAssembler.CreateStaffSummary((Staff)recipient, context)); } if (recipient is StaffGroup) { groupRecipients.Add(groupAssembler.CreateSummary((StaffGroup)recipient)); } } return(new OrderNoteboxItemSummary( item.NoteRef, item.OrderRef, item.PatientRef, item.PatientProfileRef, mrnAssembler.CreateMrnDetail(item.Mrn), nameAssembler.CreatePersonNameDetail(item.PatientName), item.DateOfBirth, item.AccessionNumber, item.DiagnosticServiceName, item.Category, item.Urgent, item.PostTime, staffAssembler.CreateStaffSummary(item.Author, context), item.OnBehalfOfGroup == null ? null : groupAssembler.CreateSummary(item.OnBehalfOfGroup), item.IsAcknowledged, staffRecipients, groupRecipients)); }
public RegistrationWorklistItemSummary CreateWorklistItemSummary(WorklistItem domainItem, IPersistenceContext context) { var nameAssembler = new PersonNameAssembler(); var healthcardAssembler = new HealthcardAssembler(); return new RegistrationWorklistItemSummary( domainItem.ProcedureRef, domainItem.OrderRef, domainItem.PatientRef, domainItem.PatientProfileRef, new MrnAssembler().CreateMrnDetail(domainItem.Mrn), nameAssembler.CreatePersonNameDetail(domainItem.PatientName), domainItem.AccessionNumber, EnumUtils.GetEnumValueInfo(domainItem.OrderPriority, context), EnumUtils.GetEnumValueInfo(domainItem.PatientClass), domainItem.DiagnosticServiceName, domainItem.ProcedureName, domainItem.ProcedurePortable, EnumUtils.GetEnumValueInfo(domainItem.ProcedureLaterality, context), domainItem.Time); }
public RegistrationWorklistItemSummary CreateWorklistItemSummary(WorklistItem domainItem, IPersistenceContext context) { var nameAssembler = new PersonNameAssembler(); var healthcardAssembler = new HealthcardAssembler(); return(new RegistrationWorklistItemSummary( domainItem.ProcedureRef, domainItem.OrderRef, domainItem.PatientRef, domainItem.PatientProfileRef, new MrnAssembler().CreateMrnDetail(domainItem.Mrn), nameAssembler.CreatePersonNameDetail(domainItem.PatientName), domainItem.AccessionNumber, EnumUtils.GetEnumValueInfo(domainItem.OrderPriority, context), EnumUtils.GetEnumValueInfo(domainItem.PatientClass), domainItem.DiagnosticServiceName, domainItem.ProcedureName, domainItem.ProcedurePortable, EnumUtils.GetEnumValueInfo(domainItem.ProcedureLaterality, context), domainItem.Time)); }
public MergeExternalPractitionerResponse MergeExternalPractitioner(MergeExternalPractitionerRequest request) { Platform.CheckForNullReference(request, "request"); Platform.CheckMemberIsSet(request.LeftPractitionerRef, "LeftPractitionerRef"); Platform.CheckMemberIsSet(request.RightPractitionerRef, "RightPractitionerRef"); var left = PersistenceContext.Load <ExternalPractitioner>(request.LeftPractitionerRef, EntityLoadFlags.Proxy); var right = PersistenceContext.Load <ExternalPractitioner>(request.RightPractitionerRef, EntityLoadFlags.Proxy); // if we are only doing a cost estimate, exit here without modifying any data if (request.EstimateCostOnly) { var cost = EstimateAffectedRecords(right, left); return(new MergeExternalPractitionerResponse(cost)); } // unpack the request, loading all required entities var nameAssembler = new PersonNameAssembler(); var name = new PersonName(); nameAssembler.UpdatePersonName(request.Name, name); var defaultContactPoint = request.DefaultContactPointRef != null? PersistenceContext.Load <ExternalPractitionerContactPoint>(request.DefaultContactPointRef) : null; var deactivatedContactPoints = request.DeactivatedContactPointRefs == null ? new List <ExternalPractitionerContactPoint>() : CollectionUtils.Map(request.DeactivatedContactPointRefs, (EntityRef cpRef) => PersistenceContext.Load <ExternalPractitionerContactPoint>(cpRef)); var cpReplacements = CollectionUtils.Map(request.ContactPointReplacements ?? (new Dictionary <EntityRef, EntityRef>()), kvp => new KeyValuePair <ExternalPractitionerContactPoint, ExternalPractitionerContactPoint>( PersistenceContext.Load <ExternalPractitionerContactPoint>(kvp.Key, EntityLoadFlags.Proxy), PersistenceContext.Load <ExternalPractitionerContactPoint>(kvp.Value, EntityLoadFlags.Proxy))); // merge the practitioners var result = ExternalPractitioner.MergePractitioners(left, right, name, request.LicenseNumber, request.BillingNumber, request.ExtendedProperties, defaultContactPoint, deactivatedContactPoints, cpReplacements ); PersistenceContext.Lock(result, DirtyState.New); // if user has verify permission, verify the result if (Thread.CurrentPrincipal.IsInRole(AuthorityTokens.Admin.Data.ExternalPractitionerVerification)) { result.MarkVerified(); } // queue work items to migrate orders and visits foreach (var practitioner in new[] { right, left }) { var queueItem = MergeWorkQueueItem.Create(practitioner.GetRef()); PersistenceContext.Lock(queueItem, DirtyState.New); } PersistenceContext.SynchState(); var assembler = new ExternalPractitionerAssembler(); return(new MergeExternalPractitionerResponse(assembler.CreateExternalPractitionerSummary(result, this.PersistenceContext))); }