Ejemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ReconciliationComponent(EntityRef targetProfileRef, IList <PatientProfileSummary> reconciledProfiles, IList <ReconciliationCandidate> candidates)
        {
            _targetProfiles = reconciledProfiles;
            _candidates     = candidates;

            _selectedTargetProfile = CollectionUtils.SelectFirst(reconciledProfiles, p => p.PatientProfileRef.Equals(targetProfileRef, true));
        }
Ejemplo n.º 2
0
        private static void NewOrder(WorklistItemSummaryBase worklistItem, IDesktopWindow desktopWindow)
        {
            if (worklistItem == null)
            {
                NewOrder(null, "New Order", desktopWindow);
                return;
            }

            PatientProfileSummary summary = null;

            Platform.GetService <IBrowsePatientDataService>(
                service =>
            {
                var response = service.GetData(new GetDataRequest
                {
                    GetPatientProfileDetailRequest = new GetPatientProfileDetailRequest
                    {
                        PatientProfileRef = worklistItem.PatientProfileRef
                    }
                });
                summary = response.GetPatientProfileDetailResponse.PatientProfile.GetSummary();
            });

            NewOrder(summary, desktopWindow);
        }
 protected OrderEditorArgs(DesktopWindow desktopWindow, PatientProfileSummary patientProfile, OrderRequisition requisition, OrderSubmitType submitType)
     : base(desktopWindow)
 {
     PatientProfile = patientProfile;
     Requisition    = requisition;
     SubmitType     = submitType;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a new visit for the specified patient.
        /// </summary>
        /// <param name="patientRef">Patient for which the visit is created.</param>
        /// <param name="informationAuthority">Information authority to use for the visit number.</param>
        /// <param name="admitOffsetDays">A positive or negative number of days from today.</param>
        /// <param name="AdmissionType">Emergency or other types</param>
        /// <returns></returns>
        public static VisitSummary CreateVisit(PatientProfileSummary patientProfile, EnumValueInfo informationAuthority, int admitOffsetDays, EnumValueInfo AdmissionType)
        {
            InitReferenceDataCacheOnce();

            // Generate an active visit with randomize properties

            var          now = Platform.Time;
            const string activeAdmittedVisitStatus = "AA";
            var          visitDetail = new VisitDetail
            {
                Patient       = patientProfile,
                VisitNumber   = new CompositeIdentifierDetail(GenerateRandomIntegerString(10), informationAuthority),
                PatientClass  = ChooseRandom(_visitEditorFormData.PatientClassChoices),
                PatientType   = ChooseRandom(_visitEditorFormData.PatientTypeChoices),
                AdmissionType = AdmissionType ?? ChooseRandom(_visitEditorFormData.AdmissionTypeChoices),
                Status        = CollectionUtils.SelectFirst(_visitEditorFormData.VisitStatusChoices, enumValue => enumValue.Code == activeAdmittedVisitStatus),
                AdmitTime     = now + TimeSpan.FromDays(admitOffsetDays),
                Facility      = ChooseRandom(_visitEditorFormData.FacilityChoices)
            };

            VisitSummary visit = null;

            Platform.GetService(
                delegate(IVisitAdminService service)
            {
                var addVisitResponse = service.AddVisit(new AddVisitRequest(visitDetail));
                visit = addVisitResponse.Visit;
            });

            return(visit);
        }
Ejemplo n.º 5
0
        private static void PlaceRandomOrderForPatient(PatientProfileSummary patientProfile, EnumValueInfo informationAuthority)
        {
            // find a random active visit, or create one
            var randomVisit = GetActiveVisitForPatient(patientProfile.PatientRef, informationAuthority) ??
                              RandomUtils.CreateVisit(patientProfile, informationAuthority, 0);

            // create the order
            RandomUtils.RandomOrder(randomVisit, informationAuthority, null, 0);
        }
Ejemplo n.º 6
0
        public void SetSelectedTargetProfile(ISelection selection)
        {
            var profile = (PatientProfileSummary)selection.Item;

            if (profile != _selectedTargetProfile)
            {
                _selectedTargetProfile = profile;
                UpdateDiff();
            }
        }
Ejemplo n.º 7
0
        public PatientBiographyDocument(PatientProfileSummary patientProfile, IDesktopWindow window)
            : base(patientProfile.PatientRef, window)
        {
            Platform.CheckForNullReference(patientProfile.PatientRef, "PatientRef");
            Platform.CheckForNullReference(patientProfile.PatientProfileRef, "PatientProfileRef");

            _patientRef  = patientProfile.PatientRef;
            _profileRef  = patientProfile.PatientProfileRef;
            _patientName = patientProfile.Name;
            _mrn         = patientProfile.Mrn;
        }
Ejemplo n.º 8
0
        public void SetSelectedReconciliationProfile(ISelection selection)
        {
            var entry   = (ReconciliationCandidateTableEntry)selection.Item;
            var profile = (entry == null) ? null : entry.ReconciliationCandidate.PatientProfile;

            if (profile != _selectedReconciliationProfile)
            {
                _selectedReconciliationProfile = profile;
                UpdateDiff();
            }
        }
Ejemplo n.º 9
0
        private static void NewOrder(PatientProfileSummary patientProfile, IDesktopWindow desktopWindow)
        {
            if (patientProfile == null)
            {
                NewOrder(null, "New Order", desktopWindow);
                return;
            }

            var title = string.Format(SR.TitleNewOrder, PersonNameFormat.Format(patientProfile.Name), MrnFormat.Format(patientProfile.Mrn));

            NewOrder(patientProfile, title, desktopWindow);
        }
Ejemplo n.º 10
0
        public PatientProfileSummary CreatePatientProfileSummary(PatientProfile profile, IPersistenceContext context)
        {
            var nameAssembler       = new PersonNameAssembler();
            var healthcardAssembler = new HealthcardAssembler();

            var summary = new PatientProfileSummary
            {
                Mrn               = new MrnAssembler().CreateMrnDetail(profile.Mrn),
                DateOfBirth       = profile.DateOfBirth,
                Healthcard        = healthcardAssembler.CreateHealthcardDetail(profile.Healthcard),
                Name              = nameAssembler.CreatePersonNameDetail(profile.Name),
                PatientRef        = profile.Patient.GetRef(),
                PatientProfileRef = profile.GetRef(),
                Sex               = EnumUtils.GetEnumValueInfo(profile.Sex, context)
            };

            return(summary);
        }
        private void SaveChanges()
        {
            SynchronizeAttachedDocumentChanges();

            Platform.GetService <IPatientAdminService>(service =>
            {
                if (_isNew)
                {
                    var response = service.AddPatient(new AddPatientRequest(_profile));
                    _result      = response.PatientProfile;
                }
                else
                {
                    var response = service.UpdatePatientProfile(new UpdatePatientProfileRequest(_profileRef, _profile));
                    _result      = response.PatientProfile;
                }
            });
        }
Ejemplo n.º 12
0
        private static PatientProfileSummary GetRandomPatient()
        {
            var queryString = string.Format("{0}, {1}", RandomUtils.GetRandomAlphaChar(), RandomUtils.GetRandomAlphaChar());

            PatientProfileSummary randomProfile = null;

            Platform.GetService(
                delegate(IRegistrationWorkflowService service)
            {
                // Get only 10 patients
                var request = new TextQueryRequest {
                    TextQuery = queryString, Page = new SearchResultPage(0, 10)
                };
                var response  = service.PatientProfileTextQuery(request);
                randomProfile = RandomUtils.ChooseRandom(response.Matches);
            });

            return(randomProfile);
        }
Ejemplo n.º 13
0
        public override void Accept()
        {
            if (this.HasValidationErrors)
            {
                this.ShowValidation(true);
                return;
            }

            try
            {
                // give extension pages a chance to save data prior to commit
                _extensionPages.ForEach(delegate(IVisitEditorPage page) { page.Save(); });

                Platform.GetService <IVisitAdminService>(
                    delegate(IVisitAdminService service)
                {
                    if (_isNew)
                    {
                        AddVisitResponse response = service.AddVisit(new AddVisitRequest(_visit));
                        _addedVisit = response.Visit;
                        _patient    = response.Visit.Patient;
                        _visitRef   = response.Visit.VisitRef;
                    }
                    else
                    {
                        UpdateVisitResponse response = service.UpdateVisit(new UpdateVisitRequest(_visitRef, _visit));
                        _addedVisit = response.Visit;
                        _patient    = response.Visit.Patient;
                        _visitRef   = response.Visit.VisitRef;
                    }
                });
                this.Exit(ApplicationComponentExitCode.Accepted);
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, SR.ExceptionCannotAddUpdateVisit, this.Host.DesktopWindow,
                                        delegate
                {
                    this.ExitCode = ApplicationComponentExitCode.Error;
                    this.Host.Exit();
                });
            }
        }
Ejemplo n.º 14
0
        private void LoadPatientProfile()
        {
            Async.CancelPending(this);

            if (_patientRef == null)
            {
                return;
            }

            Async.Request(this,
                          (IBrowsePatientDataService service) =>
            {
                var request = new GetDataRequest
                {
                    ListPatientProfilesRequest = new ListPatientProfilesRequest(_patientRef)
                };
                return(service.GetData(request));
            },
                          response =>
            {
                _profileChoices = response.ListPatientProfilesResponse.Profiles;

                _selectedProfile = _defaultProfileRef != null
                                                ? CollectionUtils.SelectFirst(_profileChoices, pp => pp.PatientProfileRef.Equals(_defaultProfileRef, true))
                                                : CollectionUtils.FirstElement(_profileChoices);

                _profileViewComponent.PatientProfile = _selectedProfile;

                NotifyPropertyChanged("SelectedProfile");
                NotifyAllPropertiesChanged();
            },
                          exception =>
            {
                _profileChoices  = new List <PatientProfileSummary>();
                _selectedProfile = null;
                _profileViewComponent.PatientProfile = null;
                ExceptionHandler.Report(exception, this.Host.DesktopWindow);

                NotifyPropertyChanged("SelectedProfile");
                NotifyAllPropertiesChanged();
            });
        }
Ejemplo n.º 15
0
 protected static void OpenPatient(PatientProfileSummary patientProfile, IDesktopWindow window)
 {
     try
     {
         var document = DocumentManager.Get <PatientBiographyDocument>(patientProfile.PatientRef);
         if (document == null)
         {
             document = new PatientBiographyDocument(patientProfile, window);
             document.Open();
         }
         else
         {
             document.Open();
         }
     }
     catch (Exception e)
     {
         ExceptionHandler.Report(e, window);
     }
 }
Ejemplo n.º 16
0
        private static void NewOrder(PatientProfileSummary patientProfile, string title, IDesktopWindow desktopWindow)
        {
            try
            {
                var component = new OrderEditorComponent(new OrderEditorComponent.NewOrderOperatingContext {
                    PatientProfile = patientProfile
                });
                var result = ApplicationComponent.LaunchAsDialog(
                    desktopWindow,
                    component,
                    title);

                if (result == ApplicationComponentExitCode.Accepted)
                {
                    DocumentManager.InvalidateFolder(typeof(Folders.Registration.ScheduledFolder));
                }
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, desktopWindow);
            }
        }
 public OrderSubmittedArgs(DesktopWindow desktopWindow, PatientProfileSummary patientProfile, OrderRequisition requisition, OrderSubmitType submitType)
     : base(desktopWindow, patientProfile, requisition, submitType)
 {
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Creates a new visit for the specified patient.
 /// </summary>
 /// <param name="patientRef">Patient for which the visit is created.</param>
 /// <param name="informationAuthority">Information authority to use for the visit number.</param>
 /// <param name="admitOffsetDays">A positive or negative number of days from today.</param>
 /// <returns></returns>
 public static VisitSummary CreateVisit(PatientProfileSummary patientProfile, EnumValueInfo informationAuthority, int admitOffsetDays)
 {
     return(CreateVisit(patientProfile, informationAuthority, admitOffsetDays, null));
 }
Ejemplo n.º 19
0
 public UpdatePatientProfileResponse(PatientProfileSummary patientProfile)
 {
     this.PatientProfile = patientProfile;
 }
Ejemplo n.º 20
0
 public AddPatientResponse(PatientProfileSummary patientProfile)
 {
     this.PatientProfile = patientProfile;
 }
Ejemplo n.º 21
0
 public VisitSummaryComponent(PatientProfileSummary patientProfile, bool dialogMode)
     : base(dialogMode)
 {
     _patientProfile = patientProfile;
 }
Ejemplo n.º 22
0
        public override void Start()
        {
            Platform.GetService <IVisitAdminService>(
                delegate(IVisitAdminService service)
            {
                LoadVisitEditorFormDataResponse response = service.LoadVisitEditorFormData(new LoadVisitEditorFormDataRequest());

                this.Pages.Add(new NavigatorPage("Visit",
                                                 _visitEditor = new VisitDetailsEditorComponent(
                                                     response.VisitNumberAssigningAuthorityChoices,
                                                     response.PatientClassChoices,
                                                     response.PatientTypeChoices,
                                                     response.AdmissionTypeChoices,
                                                     response.AmbulatoryStatusChoices,
                                                     response.VisitStatusChoices,
                                                     response.FacilityChoices,
                                                     response.CurrentLocationChoices)));

                // JR (may 2008): these pages are not currently needed, and they are not complete, so
                // better just to remove them for now

                //this.Pages.Add(new NavigatorPage("Visit/Practitioners",
                //    _visitPractionersSummary = new VisitPractitionersSummaryComponent(
                //        response.VisitPractitionerRoleChoices
                //    )));

                //this.Pages.Add(new NavigatorPage("Visit/Location",
                //    _visitLocationsSummary = new VisitLocationsSummaryComponent(
                //        response.VisitLocationRoleChoices
                //    )));

                if (_isNew)
                {
                    _visit         = new VisitDetail();
                    _visit.Patient = _patient;
                    _visit.VisitNumber.AssigningAuthority = response.VisitNumberAssigningAuthorityChoices.Count > 0 ?
                                                            response.VisitNumberAssigningAuthorityChoices[0] : null;
                    _visit.PatientClass  = response.PatientClassChoices[0];
                    _visit.PatientType   = response.PatientTypeChoices[0];
                    _visit.AdmissionType = response.AdmissionTypeChoices[0];
                    _visit.Status        = response.VisitStatusChoices[0];
                    _visit.Facility      = response.FacilityChoices[0];
                }
                else
                {
                    LoadVisitForEditResponse loadVisitResponse = service.LoadVisitForEdit(new LoadVisitForEditRequest(_visitRef));
                    _patient  = loadVisitResponse.VisitDetail.Patient;
                    _visitRef = loadVisitResponse.VisitRef;
                    _visit    = loadVisitResponse.VisitDetail;
                }
            });

            _visitEditor.Visit = _visit;
            //_visitPractionersSummary.Visit = _visit;
            //_visitLocationsSummary.Visit = _visit;

            // instantiate all extension pages
            _extensionPages = new List <IVisitEditorPage>();
            foreach (IVisitEditorPageProvider pageProvider in new VisitEditorPageProviderExtensionPoint().CreateExtensions())
            {
                _extensionPages.AddRange(pageProvider.GetPages(new EditorContext(this)));
            }

            // add extension pages to navigator
            // the navigator will start those components if the user goes to that page
            foreach (IVisitEditorPage page in _extensionPages)
            {
                this.Pages.Add(new NavigatorPage(page.Path, page.GetComponent()));
            }

            this.ValidationStrategy = new AllComponentsValidationStrategy();

            base.Start();
        }
Ejemplo n.º 23
0
 public VisitEditorComponent(VisitSummary editVisit)
 {
     _isNew    = false;
     _patient  = editVisit.Patient;
     _visitRef = editVisit.VisitRef;
 }
 public AddPatientResponse(PatientProfileSummary patientProfile)
 {
     this.PatientProfile = patientProfile;
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Constructor
 /// </summary>
 public VisitEditorComponent(PatientProfileSummary patientProfile)
 {
     _isNew   = true;
     _patient = patientProfile;
 }
Ejemplo n.º 26
0
 public UpdatePatientProfileResponse(PatientProfileSummary patientProfile)
 {
     this.PatientProfile = patientProfile;
 }