Пример #1
0
        public TrackingHistoryResult GetPatientEntries(string dfn, int page, int itemsPerPage)
        {
            // *** Gets one page of tracking history entries for a patient ***

            TrackingHistoryResult result = new TrackingHistoryResult();

            DsioGetTrackingCommand command = new DsioGetTrackingCommand(this.broker);

            // *** If we don't have a valid page, get all ***
            if (page > 0)
            {
                command.AddPatientLogsParameter(dfn, page, itemsPerPage);
            }
            else
            {
                command.AddPatientLogsParameter(dfn);
            }

            // *** Execute the command ***
            RpcResponse response = command.Execute();

            // *** Store success and message ***
            result.Success = (response.Status == RpcResponseStatus.Success);
            result.Message = response.InformationalMessage;

            if (result.Success)
            {
                // *** Add results to return value ***
                result.TrackingEntries = GetTrackingEntries(command.TrackingItems);
                result.TotalEntries    = command.TotalResults;
            }
            return(result);
        }
        private List <FlaggedPatient> ProcessDsioFlaggedPatients(Dictionary <string, DsioFlaggedPatient> dsioFlaggedPatients)
        {
            // *** Get list of flagged patients from dictionary of dsio flagged patients ***

            List <FlaggedPatient> returnList = new List <FlaggedPatient>();

            // *** Loop ***
            foreach (DsioFlaggedPatient dsioPatient in dsioFlaggedPatients.Values)
            {
                // *** Get tracking history for this patient ***

                DsioGetTrackingCommand command = new DsioGetTrackingCommand(broker);

                command.AddPatientLogsParameter(dsioPatient.Dfn);

                RpcResponse response = command.Execute();

                if (response.Status == RpcResponseStatus.Success)
                {
                    foreach (DsioTrackingItem item in command.TrackingItems)
                    {
                        dsioPatient.TrackingItems.Add(item.Id, item);
                    }
                }

                // *** Create new flagged patient and add to list ***
                FlaggedPatient patient = this.GetFlaggedPatient(dsioPatient);

                returnList.Add(patient);
            }
            return(returnList);
        }
Пример #3
0
        public TrackingHistoryResult GetHistoryEntries(int page, int itemsPerPage)
        {
            TrackingHistoryResult returnResult = new TrackingHistoryResult();

            if (this.broker == null)
            {
                returnResult.Message = "No broker";
            }
            else
            {
                DsioGetTrackingCommand command = new DsioGetTrackingCommand(this.broker);

                //command.AddGetAllParameters();
                command.AddGetAllParameters(page, itemsPerPage);

                RpcResponse response = command.Execute();

                returnResult.Success = (response.Status == RpcResponseStatus.Success);
                returnResult.Message = response.InformationalMessage;

                if (returnResult.Success)
                {
                    returnResult.TrackingEntries = GetTrackingEntries(command.TrackingItems);
                    returnResult.TotalEntries    = command.TotalResults;
                }
            }

            return(returnResult);
        }
Пример #4
0
        public void TestGetTracking_AllEntries()
        {
            using (RpcBroker broker = GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioGetTrackingCommand command = new DsioGetTrackingCommand(broker);

                command.AddGetAllParameters(1, 5);

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
                Assert.IsNotNull(command.TrackingItems);

                if (command.TrackingItems.Count > 0)
                {
                    foreach (DsioTrackingItem item in command.TrackingItems)
                    {
                        Assert.IsFalse(string.IsNullOrWhiteSpace(item.Id));
                        Assert.IsFalse(string.IsNullOrWhiteSpace(item.Dfn));
                        Assert.IsFalse(string.IsNullOrWhiteSpace(item.PatientName));
                        //Assert.IsFalse(string.IsNullOrWhiteSpace(item.Reason));
                        Assert.IsFalse(string.IsNullOrWhiteSpace(item.Source));
                        Assert.IsFalse(string.IsNullOrWhiteSpace(item.TrackingItemDateTime));
                        Assert.IsFalse(string.IsNullOrWhiteSpace(item.TrackingType));
                        Assert.IsFalse(string.IsNullOrWhiteSpace(item.User));
                    }
                }
                broker.Disconnect();
            }
        }
        public TrackedPatientsResult GetTrackedPatients(int page, int itemsPerPage)
        {
            // *** Gets a tracked patients result from the broker ***

            TrackedPatientsResult result = new TrackedPatientsResult();

            // *** Create the command needed to get tracked patients ***
            DsioGetTrackingCommand command = new DsioGetTrackingCommand(this.broker);

            // *** Add appropriate parameters ***
            command.AddGetTrackedPatientsParameters(page, itemsPerPage);

            // *** Execute command and get response ***
            RpcResponse response = command.Execute();

            // *** Add response to return result ***
            result.Success = (response.Status == RpcResponseStatus.Success);

            // *** Check for success ***
            if (result.Success)
            {
                result.Patients = new List <TrackedPatient>();

                // *** Check if we have result ***
                if (command.TrackedPatients != null)
                {
                    // *** Loop through resulting patients ***
                    foreach (DsioTrackedPatient dsioPatient in command.TrackedPatients)
                    {
                        // *** Get strongly typed patient from dsio Patient ***
                        TrackedPatient trackedPatient = GetTrackedPatient(dsioPatient);

                        // *** Add patient to list ***
                        result.Patients.Add(trackedPatient);
                    }
                }

                result.TotalResults = command.TotalResults;
            }
            else
            {
                result.Message = response.InformationalMessage;
            }

            return(result);
        }
Пример #6
0
        public void TestGetTracking_FlaggedPatients()
        {
            using (RpcBroker broker = GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioGetTrackingCommand command = new DsioGetTrackingCommand(broker);

                command.AddGetFlaggedPatientsParameters(1, 1000);

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);

                broker.Disconnect();
            }
        }
Пример #7
0
        public void TestGetTracking_AllEntriesByPatient()
        {
            using (RpcBroker broker = GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioGetTrackingCommand command = new DsioGetTrackingCommand(broker);

                command.AddPatientLogsParameter(TestConfiguration.DefaultPatientDfn, 1, 3);

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
                Assert.IsNotNull(command.TrackingItems);

                broker.Disconnect();
            }
        }
        public FlaggedPatientsResult GetFlaggedPatients(int page, int itemsPerPage)
        {
            // *** Gets a list of flagged patients ***

            FlaggedPatientsResult result = new FlaggedPatientsResult();

            // *** Create the command ***
            DsioGetTrackingCommand command = new DsioGetTrackingCommand(this.broker);

            // *** Add the parameters ***
            command.AddGetFlaggedPatientsParameters(page, itemsPerPage);

            // *** Execute the command ***
            RpcResponse response = command.Execute();

            result.Success = (response.Status == RpcResponseStatus.Success);
            result.Message = response.InformationalMessage;

            // *** Check for success and results ***
            if (result.Success)
            {
                if (command.FlaggedPatientResult != null)
                {
                    if (command.FlaggedPatientResult.FlaggedPatients != null)
                    {
                        if (command.FlaggedPatientResult.FlaggedPatients.Count > 0)
                        {
                            result.Patients = ProcessDsioFlaggedPatients(command.FlaggedPatientResult.FlaggedPatients);

                            result.TotalResults = command.TotalResults;
                        }
                    }
                }
            }

            return(result);
        }