public UpdatePatientNoteDataResponse Put(UpdatePatientNoteDataRequest request) { UpdatePatientNoteDataResponse response = new UpdatePatientNoteDataResponse(); try { RequireUserId(request); response.PatientNoteData = Manager.UpdatePatientNote(request); } catch (Exception ex) { RaiseException(response, ex); } return(response); }
public void UpdatePatientNote_Test() { List <string> prog = new List <string>(); prog.Add("558c756184ac0707d02f72c8"); PatientNoteData data = new PatientNoteData { Id = "558c757284ac05114837dc38", PatientId = "5429d29984ac050c788bd34f", Text = "ABCABC", ProgramIds = prog, TypeId = "54909997d43323251c0a1dfe", MethodId = "540f1da7d4332319883f3e8c", WhoId = "540f1fc3d4332319883f3e97", OutcomeId = "540f1f14d4332319883f3e93", SourceId = "540f2091d4332319883f3e9c", Duration = 10, ValidatedIdentity = false, ContactedOn = DateTime.Now.AddDays(4) }; UpdatePatientNoteDataRequest request = new UpdatePatientNoteDataRequest { Context = context, ContractNumber = contractNumber, UserId = userId, Version = version, PatientNoteData = data, Id = data.Id, PatientId = data.PatientId }; string requestURL = string.Format("{0}/{1}/{2}/{3}/Patient/{4}/Note/{5}", url, context, version, contractNumber, data.PatientId, data.Id); //[Route("/{Context}/{Version}/{ContractNumber}/Patient/{PatientId}/Note/{Id}", "PUT")] UpdatePatientNoteDataResponse response = client.Put <UpdatePatientNoteDataResponse>(requestURL, request); Assert.IsNotNull(response); }
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; } }