Ejemplo n.º 1
0
        public void UpdatePatientNote_Test()
        {
            List <string> prog = new List <string>();

            prog.Add("558c756184ac0707d02f72c8");

            PatientNote data = new PatientNote
            {
                Id                = "558c757284ac05114837dc38",
                PatientId         = "5429d29984ac050c788bd34f",
                Text              = "JJJJ",
                ProgramIds        = prog,
                TypeId            = "54909997d43323251c0a1dfe",
                MethodId          = "540f1da7d4332319883f3e8c",
                WhoId             = "540f1fc3d4332319883f3e97",
                OutcomeId         = "540f1f14d4332319883f3e93",
                SourceId          = "540f2091d4332319883f3e9c",
                Duration          = 123,
                ValidatedIdentity = true,
                ContactedOn       = DateTime.Now.AddDays(4)
            };

            UpdatePatientNoteRequest request = new UpdatePatientNoteRequest
            {
                ContractNumber = "InHealth001",
                UserId         = "54909997d43323251c0a1dfe",
                Version        = 1.0,
                PatientNote    = data,
                Id             = data.Id,
                PatientId      = data.PatientId
            };

            string requestURL = string.Format("{0}/{1}/{2}/Patient/{3}/Note/{4}?UserId={5}", "http://localhost:888/Nightingale", request.Version, request.ContractNumber, data.PatientId, data.Id, request.UserId);
            //[Route("/{Version}/{ContractNumber}/Patient/{PatientId}/Note/{Id}", "PUT")]
            IRestClient client = new JsonServiceClient();
            UpdatePatientNoteResponse response = client.Put <UpdatePatientNoteResponse>(requestURL, request);

            Assert.IsNotNull(response);
        }
Ejemplo n.º 2
0
        public UpdatePatientNoteResponse UpdatePatientNote(UpdatePatientNoteRequest request)
        {
            try
            {
                if (request.PatientNote == null)
                {
                    throw new Exception("The Note property is null in the request.");
                }
                else if (string.IsNullOrEmpty(request.PatientNote.Text))
                {
                    throw new Exception("Note text is a required field.");
                }

                UpdatePatientNoteResponse response = new UpdatePatientNoteResponse();
                if (request.PatientNote != null)
                {
                    PatientNote pn = request.PatientNote;
                    //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/Note/{Id}", "PUT")]
                    IRestClient client = new JsonServiceClient();
                    string      url    = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Note/{5}",
                                                                              DDPatientNoteUrl,
                                                                              "NG",
                                                                              request.Version,
                                                                              request.ContractNumber,
                                                                              pn.PatientId,
                                                                              pn.Id), request.UserId);

                    PatientNoteData pnData = new PatientNoteData
                    {
                        Id                = pn.Id,
                        Text              = pn.Text,
                        ProgramIds        = pn.ProgramIds,
                        CreatedById       = request.UserId,
                        CreatedOn         = pn.CreatedOn,
                        PatientId         = pn.PatientId,
                        TypeId            = pn.TypeId,
                        MethodId          = pn.MethodId,
                        OutcomeId         = pn.OutcomeId,
                        WhoId             = pn.WhoId,
                        SourceId          = pn.SourceId,
                        Duration          = pn.Duration,
                        ContactedOn       = pn.ContactedOn,
                        ValidatedIdentity = pn.ValidatedIdentity,
                        DataSource        = pn.DataSource
                    };
                    UpdatePatientNoteDataResponse dataDomainResponse =
                        client.Put <UpdatePatientNoteDataResponse>(url, new UpdatePatientNoteDataRequest
                    {
                        Context         = "NG",
                        ContractNumber  = request.ContractNumber,
                        Version         = request.Version,
                        UserId          = request.UserId,
                        PatientNoteData = pnData
                    } as object);
                    if (dataDomainResponse != null & dataDomainResponse.PatientNoteData != null)
                    {
                        response.PatientNote = Mapper.Map <PatientNote>(dataDomainResponse.PatientNoteData);;
                    }
                }
                return(response);
            }
            catch (WebServiceException ex) { throw ex; }
        }