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

            prog.Add("558c756184ac0707d02f72c8");

            PatientNoteData data = new PatientNoteData
            {
                PatientId         = "5429d29984ac050c788bd34f",
                Text              = "GGGG",
                ProgramIds        = prog,
                TypeId            = "54909997d43323251c0a1dfe",
                MethodId          = "540f1da7d4332319883f3e8c",
                ValidatedIdentity = false,
                ContactedOn       = DateTime.Now.AddDays(4)
            };

            InsertPatientNoteDataRequest request = new InsertPatientNoteDataRequest
            {
                Context        = context,
                ContractNumber = contractNumber,
                UserId         = userId,
                Version        = version,
                PatientNote    = data,
                PatientId      = "5429d29984ac050c788bd34f",
            };

            string requestURL = string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Note", url, context, version, contractNumber, data.PatientId);
            //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/Note", "POST")]
            InsertPatientNoteDataResponse response = client.Post <InsertPatientNoteDataResponse>(requestURL, request);

            Assert.IsNotNull(response);
        }
Ejemplo n.º 2
0
        public InsertPatientNoteDataResponse Post(InsertPatientNoteDataRequest request)
        {
            InsertPatientNoteDataResponse response = new InsertPatientNoteDataResponse();

            try
            {
                RequireUserId(request);
                response.Id      = Manager.InsertPatientNote(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                RaiseException(response, ex);
            }
            return(response);
        }
Ejemplo n.º 3
0
        public PostPatientNoteResponse InsertPatientNote(PostPatientNoteRequest request)
        {
            try
            {
                if (request.Note == null)
                {
                    throw new Exception("The Note property is null in the request.");
                }
                else if (string.IsNullOrEmpty(request.Note.Text))
                {
                    throw new Exception("Note text is a required field.");
                }

                PostPatientNoteResponse response = new PostPatientNoteResponse();
                //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/Note/Insert", "PUT")]
                //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/Note", "POST")]
                IRestClient client = new JsonServiceClient();
                string      url    = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/patient/{4}/note",
                                                                          DDPatientNoteUrl,
                                                                          "NG",
                                                                          request.Version,
                                                                          request.ContractNumber,
                                                                          request.PatientId), request.UserId);

                PatientNoteData noteData = new PatientNoteData {
                    Text              = request.Note.Text,
                    ProgramIds        = request.Note.ProgramIds,
                    CreatedById       = request.UserId,
                    CreatedOn         = request.Note.CreatedOn,
                    PatientId         = request.Note.PatientId,
                    TypeId            = request.Note.TypeId,
                    MethodId          = request.Note.MethodId,
                    OutcomeId         = request.Note.OutcomeId,
                    WhoId             = request.Note.WhoId,
                    SourceId          = request.Note.SourceId,
                    Duration          = request.Note.Duration,
                    ContactedOn       = request.Note.ContactedOn,
                    ValidatedIdentity = request.Note.ValidatedIdentity,
                    DataSource        = request.Note.DataSource
                };

                InsertPatientNoteDataResponse dataDomainResponse =
                    client.Post <InsertPatientNoteDataResponse>(url, new InsertPatientNoteDataRequest
                {
                    PatientNote    = noteData,
                    Context        = "NG",
                    ContractNumber = request.ContractNumber,
                    Version        = request.Version,
                    UserId         = request.UserId,
                    PatientId      = request.PatientId
                } as object);

                if (dataDomainResponse != null && !(string.IsNullOrEmpty(dataDomainResponse.Id)))
                {
                    response.Id      = dataDomainResponse.Id;
                    response.Version = dataDomainResponse.Version;
                }

                return(response);
            }
            catch (WebServiceException ex) { throw ex; }
        }