예제 #1
0
        public VprOperationResult GetVprData(CdaOptions options)
        {
            VprOperationResult returnResult = new VprOperationResult();

            //VprPatientResult returnVal = null;

            if (this.broker != null)
            {
                //VprGetPatientDataCommand command = new VprGetPatientDataCommand(this.broker);
                DsioVprGetPatientDataCommand command = new DsioVprGetPatientDataCommand(this.broker);

                command.AddCommandArguments(options.Patient.Dfn, VprDataType.All, options.FromDate, options.ToDate);

                RpcResponse response = command.Execute();

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

                if (returnResult.Success)
                {
                    returnResult.VprData = command.PatientResult;
                }
            }

            return(returnResult);
        }
예제 #2
0
        public void TestGetPatientDataBadPatient()
        {
            using (RpcBroker broker = this.GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioVprGetPatientDataCommand command = new DsioVprGetPatientDataCommand(broker);

                command.AddCommandArguments("999");

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Fail, response.Status);
            }
        }
예제 #3
0
        public void TestGetLabData()
        {
            using (RpcBroker broker = this.GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioVprGetPatientDataCommand command = new DsioVprGetPatientDataCommand(broker);

                command.AddCommandArguments("715", Vpr.VprDataType.Labs);

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
            }
        }
예제 #4
0
        public void TestGetFamilyData()
        {
            using (RpcBroker broker = this.GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioVprGetPatientDataCommand command = new DsioVprGetPatientDataCommand(broker);

                command.AddCommandArguments(TestConfiguration.DefaultPatientDfn, Vpr.VprDataType.Family);

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
            }
        }
예제 #5
0
        /// <summary>
        /// Gets a list of lab results by patient
        /// </summary>
        /// <param name="dfn">Patient's unique DFN</param>
        /// <param name="labType">Type of lab to return (Any or Prenatal Only)</param>
        /// <param name="fromDate">Labs must be after or equal to this date if not min date</param>
        /// <param name="toDate">Labs must be before or equal to this date if not min date</param>
        /// <param name="page">Page of data to retrieve</param>
        /// <param name="itemsPerPage">Number of items on each page</param>
        /// <returns></returns>
        public LabItemsResult GetList(string dfn, LabResultType labType, bool filterByDate, DateTime fromDate, DateTime toDate, int page, int itemsPerPage)
        {
            LabItemsResult result = new LabItemsResult();

            // *** Using DSIO VPR to get a list of all labs ***
            DsioVprGetPatientDataCommand command = new DsioVprGetPatientDataCommand(this.broker);

            // *** Add the arguments ***
            command.AddCommandArguments(dfn, Commands.Vpr.VprDataType.Labs);

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

            // *** Add response to return ***
            result.Success = response.Status == RpcResponseStatus.Success;
            result.Message = response.InformationalMessage;

            // *** Check results ***
            if (result.Success)
            {
                if (command.PatientResult != null)
                {
                    if (command.PatientResult.Labs != null)
                    {
                        if (command.PatientResult.Labs.Count > 0)
                        {
                            // *** If we have labs to work with ***

                            // *** Set up paging ***
                            int curItem = 0;
                            int first   = (page - 1) * itemsPerPage + 1;
                            int last    = first + itemsPerPage - 1;

                            // *** Go throug all ***
                            foreach (Lab lab in command.PatientResult.Labs)
                            {
                                // *** If matches prenatal filter ***
                                if ((labType == LabResultType.Any) || (this.IsPrenatal(lab)))
                                {
                                    // *** If matches date criteria ***
                                    if (this.LabMatchesDateCriteria(filterByDate, fromDate, toDate, lab))
                                    {
                                        // *** Count the total items that match criteria ***
                                        curItem += 1;

                                        // *** If belongs in current page ***
                                        if ((curItem >= first) && (curItem <= last))
                                        {
                                            // *** Get a lab item based on data ***
                                            LabItem item = GetLabItem(lab);

                                            // *** Create the list if necessary ***
                                            if (result.Labs == null)
                                            {
                                                result.Labs = new List <LabItem>();
                                            }

                                            // *** Add to list ***
                                            result.Labs.Add(item);
                                        }
                                    }
                                }
                            }

                            // *** Set total results which match filters ***
                            result.TotalResults = curItem;
                        }
                    }
                }
            }
            return(result);
        }