public void UpdatePatientAllergies_Test()
        {
            List <PatientAllergyData> data = new System.Collections.Generic.List <PatientAllergyData>();

            PatientAllergyData p1 = new PatientAllergyData
            {
                AllergyId   = "54489a72fe7a59146485bce5",
                EndDate     = DateTime.UtcNow,
                Id          = "5452567ed433231b9c516d8e",
                Notes       = "first note for patient allergy",
                PatientId   = "54087f43d6a48509407d69cb",
                ReactionIds = new List <string> {
                    "54494b5ad433232a446f7323", "54494b5dd433232a446f7324", "54494b60d433232a446f7325"
                },
                SeverityId = "54494a96d433232a446f7313",
                SourceId   = "544e9976d433231d9c0330ae",
                StartDate  = DateTime.UtcNow,
                StatusId   = 1,
                SystemName = "Engage1",
                UpdatedOn  = DateTime.UtcNow
            };

            PatientAllergyData p2 = new PatientAllergyData
            {
                AllergyId   = "54489a79fe7a59146485bd1e",
                EndDate     = DateTime.UtcNow,
                Id          = "5452584ed4332305d8fa10b5",
                Notes       = "asdasfddfjskdfjsldfugiosdgjksgj",
                PatientId   = "54087f43d6a48509407d69cb",
                ReactionIds = new List <string> {
                    "54494b5ad433232a446f7323"
                },
                SeverityId = "54494a96d433232a446f7313",
                SourceId   = "544e9976d433231d9c0330ae",
                StartDate  = DateTime.UtcNow,
                StatusId   = 1,
                SystemName = "Engage2",
                UpdatedOn  = DateTime.UtcNow
            };

            data.Add(p1);
            data.Add(p2);
            PutPatientAllergiesDataRequest request = new PutPatientAllergiesDataRequest
            {
                Context              = context,
                ContractNumber       = contractNumber,
                PatientAllergiesData = data,
                UserId  = userId,
                Version = version
            };

            //[Route("/{Context}/{Version}/{ContractNumber}/PatientAllergy/Update/Bulk", "PUT")]
            PutPatientAllergiesDataResponse response = client.Put <PutPatientAllergiesDataResponse>(
                string.Format("{0}/{1}/{2}/{3}/PatientAllergy/Update/Bulk", url, context, version, contractNumber), request);

            Assert.IsNotNull(response);
        }
示例#2
0
        public PutPatientAllergiesDataResponse Put(PutPatientAllergiesDataRequest request)
        {
            PutPatientAllergiesDataResponse response = new PutPatientAllergiesDataResponse {
                Version = request.Version
            };

            try
            {
                RequireUserId(request);
                response.PatientAllergiesData = Manager.UpdatePatientAllergies(request);
            }
            catch (Exception ex)
            {
                RaiseException(response, ex);
            }
            return(response);
        }
示例#3
0
        public List <PatientAllergyData> UpdatePatientAllergies(PostPatientAllergiesRequest request)
        {
            try
            {
                List <PatientAllergyData> result = null;
                IRestClient client = new JsonServiceClient();
                //[Route("/{Context}/{Version}/{ContractNumber}/PatientAllergy/Update/Bulk", "PUT")]
                var url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/PatientAllergy/Update/Bulk",
                                                               DDAllergyUrl,
                                                               "NG",
                                                               request.Version,
                                                               request.ContractNumber), request.UserId);

                if (request.PatientAllergies != null && request.PatientAllergies.Count > 0)
                {
                    List <PatientAllergyData> data = new List <PatientAllergyData>();
                    request.PatientAllergies.ForEach(a => data.Add(Mapper.Map <PatientAllergyData>(a)));
                    PutPatientAllergiesDataResponse dataDomainResponse = client.Put <PutPatientAllergiesDataResponse>(url, new PutPatientAllergiesDataRequest
                    {
                        Context              = "NG",
                        ContractNumber       = request.ContractNumber,
                        UserId               = request.UserId,
                        Version              = request.Version,
                        PatientAllergiesData = data
                    } as object);

                    if (dataDomainResponse != null)
                    {
                        result = dataDomainResponse.PatientAllergiesData;
                    }
                }
                return(result);
            }
            catch (WebServiceException ex)
            {
                throw new WebServiceException("AD:UpdatePatientAllergies()::" + ex.Message, ex.InnerException);
            }
        }