Пример #1
0
        /// <summary>
        /// add report for specific patient (no PDF file).
        /// </summary>
        /// <param name="body"> MedicalReportBody object that has list of Medical Reports , each medical report has list of panels that has list of biomarkers </param>
        /// <returns> Response object with status code and message</returns>
        public async Task <Response> MedicalReport(MedicalReportBody body)
        {
            Response jsonObj;

            try
            {
                Client.DefaultRequestHeaders.Clear();
                Client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json;");
                var auth = GetToken();
                Client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer " + auth.Result.access_token);
                var Content     = JsonConvert.SerializeObject(body);
                var buffer      = System.Text.Encoding.UTF8.GetBytes(Content);
                var byteContent = new ByteArrayContent(buffer);
                using (HttpResponseMessage response = await Client.PostAsync("http://104.155.18.156/aggregator/api/web/v1/medical-records/add", byteContent))
                {
                    string responseBody = response.Content.ReadAsStringAsync().Result;
                    jsonObj = JsonConvert.DeserializeObject <Response>(responseBody);
                }
            }
            catch (Exception e)
            {
                throw;
            }

            return(jsonObj);
        }
Пример #2
0
        /// <summary>
        /// add report for specific patient (no PDF file).
        /// </summary>
        /// <param name="body"> MedicalReportBody object that has list of Medical Reports , each medical report has list of panels that has list of biomarkers </param>
        /// <returns> Response object with status code and message</returns>
        public static async Task <Response> MedicalReport(MedicalReportBody body)
        {
            Response jsonObj;

            try
            {
                var Content     = JsonConvert.SerializeObject(body);
                var buffer      = System.Text.Encoding.UTF8.GetBytes(Content);
                var byteContent = new ByteArrayContent(buffer);
                var token       = GetToken().Result;
                using (HttpResponseMessage response = await Client.PostAsync("http://104.155.18.156/aggregator/api/web/v1/medical-records/add", byteContent))
                {
                    string responseBody = response.Content.ReadAsStringAsync().Result;
                    jsonObj = JsonConvert.DeserializeObject <Response>(responseBody);
                }
            }
            catch (Exception e)
            {
                throw;
            }

            return(jsonObj);
        }