public void TestGetPatientNotFound()
        {
            using (RpcBroker broker = this.GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioGetPatientInformationCommand command = new DsioGetPatientInformationCommand(broker);

                command.AddCommandArguments("999");

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Fail, response.Status);
            }
        }
Exemplo n.º 2
0
        public void TestGetPatient()
        {
            using (RpcBroker broker = this.GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioGetPatientInformationCommand command = new DsioGetPatientInformationCommand(broker);

                command.AddCommandArguments(TestConfiguration.DefaultPatientDfn);

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
            }
        }
        public void TestGetPatient()
        {
            using (RpcBroker broker = this.GetConnectedBroker())
            {
                this.SignonToBroker(broker, 2);

                DsioGetPatientInformationCommand command = new DsioGetPatientInformationCommand(broker);

                //command.AddCommandArguments("704");
                //command.AddCommandArguments("100007");
                //command.AddCommandArguments("434");
                //command.AddCommandArguments("28");
                command.AddCommandArguments("715");

                RpcResponse response = command.Execute();

                Assert.AreEqual(RpcResponseStatus.Success, response.Status);
            }
        }
        //public PatientDemographicsResult GetPatientDemographicsX(string dfn)
        //{
        //    // *** NOTE: Uses ORWPT SELECT...

        //    PatientDemographicsResult result = new PatientDemographicsResult();

        //    OrwptSelectCommand command = new OrwptSelectCommand(this.broker);

        //    command.AddDfnArgument(dfn);

        //    RpcResponse response = command.Execute();

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

        //    if (result.Success)
        //    {
        //        result.Patient = new BasePatient();
        //        result.Patient.Dfn = command.Patient.Dfn;
        //        result.Patient.LastName = Util.Piece(command.Patient.PatientName, ",", 1);
        //        result.Patient.FirstName = Util.Piece(command.Patient.PatientName, ",",2);

        //        result.Patient.DateOfBirth = Util.GetDateTime(command.Patient.DOB);

        //        if (result.Patient.DateOfBirth == DateTime.MinValue)
        //            result.Patient.DateOfBirthInexact = Util.GetInexactDateFromFM(command.Patient.DOB);

        //        result.Patient.FullSSN = command.Patient.SSN;

        //        int length = result.Patient.FullSSN.Length;

        //        if (length == 9)
        //            result.Patient.Last4 = result.Patient.FullSSN.Substring(5);
        //        else if (length == 10)
        //            if (result.Patient.FullSSN.EndsWith("P"))
        //                result.Patient.Last4 = result.Patient.FullSSN.Substring(5, 4);

        //    }

        //    return result;
        //}

        public PatientDemographicsResult GetPatientDemographics(string dfn)
        {
            PatientDemographicsResult result = new PatientDemographicsResult();

            DsioGetPatientInformationCommand command = new DsioGetPatientInformationCommand(this.broker);

            command.AddCommandArguments(dfn);

            RpcResponse response = command.Execute();

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

            if (result.Success)
            {
                result.Patient = new BasePatient();

                // *** Dfn ***
                result.Patient.Dfn = command.Patient.Dfn;

                // *** Name ***
                result.Patient.LastName  = Util.Piece(command.Patient.PatientName, ",", 1);
                result.Patient.FirstName = Util.Piece(command.Patient.PatientName, ",", 2);

                // *** SSN ***
                result.Patient.FullSSN = command.Patient.SSN;

                int length = result.Patient.FullSSN.Length;

                if (length == 9)
                {
                    result.Patient.Last4 = result.Patient.FullSSN.Substring(5);
                }
                else if (length == 10)
                {
                    if (result.Patient.FullSSN.EndsWith("P"))
                    {
                        result.Patient.Last4 = result.Patient.FullSSN.Substring(5, 4);
                    }
                }

                // *** DOB ***
                result.Patient.DateOfBirth = VistaDates.ParseDateString(command.Patient.DOB, VistaDates.VistADateOnlyFormat);

                // *** Gravida Para ***
                if (string.IsNullOrWhiteSpace(command.Patient.GravidaPara))
                {
                    result.Patient.GravidaPara = "G? P????";
                }
                else
                {
                    result.Patient.GravidaPara = command.Patient.GravidaPara;
                }

                result.Patient.Pregnant = (command.Patient.Pregnant == "YES") ? true : false;

                // *** Last Live Birth ***
                if (!string.IsNullOrWhiteSpace(command.Patient.LastLiveBirth))
                {
                    result.Patient.LastLiveBirth = VistaDates.ParseDateString(command.Patient.LastLiveBirth, VistaDates.VistADateOnlyFormat);
                }

                // *** Lactating ***
                result.Patient.Lactating = (command.Patient.Lactating == "YES") ? true : false;

                // *** Add phone numbers ***
                result.Patient.HomePhone   = command.Patient.HomePhone;
                result.Patient.WorkPhone   = command.Patient.WorkPhone;
                result.Patient.MobilePhone = command.Patient.MobilePhone;

                // *** Contact dates ***
                // TODO: Should last contact have time?
                result.Patient.LastContactDate = VistaDates.ParseDateString(command.Patient.LastContactDate, VistaDates.VistADateOnlyFormat);
                result.Patient.NextContactDue  = VistaDates.ParseDateString(command.Patient.NextContactDue, VistaDates.VistADateOnlyFormat);

                // *** Checklist Date ***
                result.Patient.NextChecklistDue = VistaDates.ParseDateString(command.Patient.NextChecklistDue, VistaDates.VistADateOnlyFormat);

                // *** LMP ***
                result.Patient.Lmp = VistaDates.ParseDateString(command.Patient.Lmp, VistaDates.VistADateOnlyFormat);

                // *** Current Pregnancy High Risk ***
                result.Patient.CurrentPregnancyHighRisk = (command.Patient.CurrentPregnancyHighRisk == "TRUE");
                result.Patient.HighRiskDetails          = command.Patient.HighRiskDetails;

                // *** Zip, Email ***
                result.Patient.ZipCode = command.Patient.ZipCode;
                result.Patient.Email   = command.Patient.Email;

                // *** Text4Baby ***
                if (command.Patient.Text4BabyStatus.Equals("enrolled", StringComparison.CurrentCultureIgnoreCase))
                {
                    result.Patient.Text4BabyStatus = Text4BabyStatus.Enrolled;
                }
                else if (command.Patient.Text4BabyStatus.Equals("not interested", StringComparison.CurrentCultureIgnoreCase))
                {
                    result.Patient.Text4BabyStatus = Text4BabyStatus.NotInterested;
                }

                result.Patient.Text4BabyStatusUpdatedOn = VistaDates.FlexParse(command.Patient.Text4BabyDate);
            }

            return(result);
        }