From d044a46f27885c313f9f2b3503ee9f595ee41fd6 Mon Sep 17 00:00:00 2001 From: James Friel Date: Mon, 13 Nov 2023 09:51:33 +0000 Subject: [PATCH] tidy up adds --- .../ExternalApis/SemEHRConfiguration.cs | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Rdmp.Dicom/ExternalApis/SemEHRConfiguration.cs b/Rdmp.Dicom/ExternalApis/SemEHRConfiguration.cs index eaae70db..11e5df18 100644 --- a/Rdmp.Dicom/ExternalApis/SemEHRConfiguration.cs +++ b/Rdmp.Dicom/ExternalApis/SemEHRConfiguration.cs @@ -5,6 +5,7 @@ using Newtonsoft.Json.Linq; using System.Text.RegularExpressions; using System.Web; +using System.Text.Json.Nodes; namespace Rdmp.Dicom.ExternalApis { @@ -288,22 +289,28 @@ public JObject GetQueryJson() termsArray.Add(termsObj); //Set the filter - dynamic filterObj = new JObject(); + var filterObj = new JObject(); if (UseStartDate) - filterObj.start_date = StartDate.ToString(StartEndDateFormat); + filterObj.Add("start_date", StartDate.ToString(StartEndDateFormat)); + //filterObj.start_date = StartDate.ToString(StartEndDateFormat); if (UseEndDate) - filterObj.end_date = EndDate.ToString(StartEndDateFormat); + filterObj.Add("end_date", EndDate.ToString(StartEndDateFormat)); + //filterObj.end_date = EndDate.ToString(StartEndDateFormat); if (Modalities.Count > 0) - filterObj.modalities = new JArray(Modalities); + filterObj.Add("modalities", new JArray(Modalities)); + //filterObj.modalities = new JArray(Modalities); //Create API JSON - dynamic apiCallJson = new JObject(); - apiCallJson.terms = termsArray; - apiCallJson.filter = filterObj; + var apiCallJson = new JObject(); + apiCallJson.Add("terms", termsArray); + apiCallJson.Add("filter", filterObj); + //apiCallJson.terms = termsArray; + //apiCallJson.filter = filterObj; /*if (ReturnFields.Count > 0) apiCallJson.returnFields = new JArray(ReturnFields);*/ if (!string.IsNullOrWhiteSpace(ReturnField)) - apiCallJson.returnFields = new JArray(ReturnField); + apiCallJson.Add("returnFields", new JArray(ReturnField)); + //apiCallJson.returnFields = new JArray(ReturnField); return apiCallJson; }