From 23e67de865e5db9236907c6bd5654c55dbe06601 Mon Sep 17 00:00:00 2001 From: Will Maethner Date: Fri, 10 Aug 2018 15:46:43 -0500 Subject: [PATCH 1/4] Add FHIR server support. Initial FHIR server integration. Uses a default hardcoded FHIR server and can search a patient and study on that server. --- Common/Model/ClientModel.cs | 8 ++ .../Controllers/WebSubClientController.cs | 113 +++++++++++++++++- .../Views/WebSubClient/WebSubClient.cshtml | 73 +++++++++++ WebSubClient/WebSubClient.csproj | 1 + 4 files changed, 189 insertions(+), 6 deletions(-) diff --git a/Common/Model/ClientModel.cs b/Common/Model/ClientModel.cs index 8758a17..9e4b033 100644 --- a/Common/Model/ClientModel.cs +++ b/Common/Model/ClientModel.cs @@ -20,5 +20,13 @@ public ClientModel() public string Topic { get; set; } public List ActiveSubscriptions { get; set; } public List SubscriptionsToHub { get; set; } + + //Patient Info + public string PatientName { get; set; } + public string PatientDOB { get; set; } + public string PatientOpenErrorDiv { get; set; } + + //Study Info + public string StudyOpenErrorDiv { get; set; } } } diff --git a/WebSubClient/Controllers/WebSubClientController.cs b/WebSubClient/Controllers/WebSubClientController.cs index ec913af..56b9fbf 100644 --- a/WebSubClient/Controllers/WebSubClientController.cs +++ b/WebSubClient/Controllers/WebSubClientController.cs @@ -9,6 +9,8 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Newtonsoft.Json; +using Hl7.Fhir.Rest; +using Hl7.Fhir.Model; namespace FHIRcastSandbox.Controllers { [Route("")] @@ -24,19 +26,69 @@ public IActionResult Index() { public class WebSubClientController : Controller { private readonly ILogger logger; + private FhirClient client; #region Constructors public WebSubClientController(ILogger logger) { this.logger = logger; this.UID = Guid.NewGuid().ToString("n"); + createFHIRClient(); + } + + private void createFHIRClient() + { + client = new FhirClient("http://test.fhir.org/r3"); + client.PreferredFormat = ResourceFormat.Json; + } + + private Patient GetPatient(string id) + { + Uri uri = new Uri("http://test.fhir.org/r3/Patient/" + id); + try + { + return client.Read(uri); + } + catch (FhirOperationException ex) + { + foreach (var item in ex.Outcome.Children) + { + Narrative nar = item as Narrative; + if (nar != null) + { + internalModel.PatientOpenErrorDiv = nar.Div; + } + } + return null; + } + } + + private ImagingStudy GetStudy(string id) + { + Uri uri = new Uri("http://test.fhir.org/r3/ImagingStudy/" + id); + try + { + return client.Read(uri); + } + catch (FhirOperationException ex) + { + foreach (var item in ex.Outcome.Children) + { + Narrative nar = item as Narrative; + if (nar != null) + { + internalModel.StudyOpenErrorDiv = nar.Div; + } + } + return null; + } } #endregion #region Properties public static ClientModel internalModel; - private static Dictionary pendingSubs = new Dictionary(); - private static Dictionary activeSubs = new Dictionary(); + private static Dictionary pendingSubs = new Dictionary(); + private static Dictionary activeSubs = new Dictionary(); public string UID { get; set; } #endregion @@ -49,10 +101,13 @@ public IActionResult Refresh() { if (internalModel == null) { internalModel = new ClientModel(); } internalModel.ActiveSubscriptions = activeSubs.Values.ToList(); - + //internalModel.PatientName = GetPatient("100").Name[0].ToString(); + //internalModel.PatientDOB = GetPatient("100").BirthDate; return View("WebSubClient", internalModel); } + + /// /// Called when the client updates its context. Lets the hub know of the changes so it /// can notify any subscribing apps. @@ -70,6 +125,52 @@ public IActionResult Post([FromForm] ClientModel model) { return View("WebSubClient", model); } + + [Route("openPatient")] + [HttpPost] + public IActionResult OpenPatient(string patientID) + { + if (internalModel == null) { internalModel = new ClientModel(); } + if (patientID.Length > 0) + { + Patient pat = GetPatient(patientID); + if (pat != null) + { + internalModel.PatientName = $"{pat.Name[0].Family}, {pat.Name[0].Given.FirstOrDefault()}"; + internalModel.PatientDOB = pat.BirthDate; + internalModel.PatientOpenErrorDiv = ""; + } + else + { + internalModel.PatientName = ""; + internalModel.PatientDOB = ""; + } + } + + return View("WebSubClient", internalModel); + } + + [Route("openStudy")] + [HttpPost] + public IActionResult OpenStudy(string studyID) + { + if (internalModel == null) { internalModel = new ClientModel(); } + if (studyID.Length > 0) + { + ImagingStudy study = GetStudy(studyID); + if (study != null) + { + internalModel.AccessionNumber = study.Accession.Value; + internalModel.StudyOpenErrorDiv = ""; + } + else + { + internalModel.AccessionNumber = ""; + } + } + + return View("WebSubClient", internalModel); + } #endregion #region Subscription events @@ -87,7 +188,7 @@ public IActionResult Get(string subscriptionId, [FromQuery] SubscriptionVerifica //Received a verification request for non-pending subscription, return a NotFound response if (!pendingSubs.ContainsKey(subscriptionId)) { return NotFound(); } - Subscription sub = pendingSubs[subscriptionId]; + Model.Subscription sub = pendingSubs[subscriptionId]; //Validate verification subcription with our subscription. If a match return challenge //otherwise return NotFound response. @@ -135,7 +236,7 @@ public async Task Subscribe(string subscriptionUrl, string topic, var secret = Encoding.UTF8.GetString(buffer, 0, buffer.Length); var httpClient = new HttpClient(); string subUID = Guid.NewGuid().ToString("n"); - var data = new Subscription() + var data = new Model.Subscription() { UID = subUID, Callback = new Uri(this.Request.Scheme + "://" + this.Request.Host + "/client/" + subUID), @@ -176,7 +277,7 @@ public async Task Subscribe(string subscriptionUrl, string topic, public async Task Unsubscribe(string subscriptionId) { this.logger.LogDebug($"Unsubscribing subscription {subscriptionId}"); if (!activeSubs.ContainsKey(subscriptionId)) { return View("WebSubClient", internalModel); } - Subscription sub = activeSubs[subscriptionId]; + Model.Subscription sub = activeSubs[subscriptionId]; sub.Mode = SubscriptionMode.unsubscribe; var httpClient = new HttpClient(); diff --git a/WebSubClient/Views/WebSubClient/WebSubClient.cshtml b/WebSubClient/Views/WebSubClient/WebSubClient.cshtml index c0f1d01..1ee942f 100644 --- a/WebSubClient/Views/WebSubClient/WebSubClient.cshtml +++ b/WebSubClient/Views/WebSubClient/WebSubClient.cshtml @@ -155,6 +155,79 @@ } + +
+ @* Patient context *@ +
+ +
+ @Html.Label("Name: " + Model.PatientName) +
+ @Html.Label("DOB: " + Model.PatientDOB) +
+ @* Study context *@ +
+
+ +
+ @Html.Label("Accession number: " + Model.AccessionNumber) +
+
+
+ +
+
+
+ @{ + using (Html.BeginForm("openPatient", "WebSubClient", FormMethod.Post)) + { + +
+
+ +
+
+
+ @if (!string.IsNullOrEmpty(Model.PatientOpenErrorDiv)) + { + @Html.Raw(Model.PatientOpenErrorDiv) + } +
+ +
+
+
+ } + } +
+
+
+
+ @{ + using (Html.BeginForm("openStudy", "WebSubClient", FormMethod.Post)) + { + +
+
+ +
+
+
+ @if (!string.IsNullOrEmpty(Model.StudyOpenErrorDiv)) + { + @Html.Raw(Model.StudyOpenErrorDiv) + } +
+ +
+
+
+ } + } +
+
+
+ } diff --git a/WebSubClient/WebSubClient.csproj b/WebSubClient/WebSubClient.csproj index 9f7fdf2..4a27d04 100644 --- a/WebSubClient/WebSubClient.csproj +++ b/WebSubClient/WebSubClient.csproj @@ -6,6 +6,7 @@ + From 6d3806914b3eb8d7a0f9550a9e8b851f084fb917 Mon Sep 17 00:00:00 2001 From: Will Maethner Date: Fri, 10 Aug 2018 16:34:51 -0500 Subject: [PATCH 2/4] Clean up to open patient and study --- Common/Model/ClientModel.cs | 6 +- .../Controllers/WebSubClientController.cs | 171 ++++++++++++------ .../Views/WebSubClient/WebSubClient.cshtml | 6 +- 3 files changed, 119 insertions(+), 64 deletions(-) diff --git a/Common/Model/ClientModel.cs b/Common/Model/ClientModel.cs index 9e4b033..e586f1d 100644 --- a/Common/Model/ClientModel.cs +++ b/Common/Model/ClientModel.cs @@ -13,9 +13,9 @@ public ClientModel() public string UserIdentifier { get; set; } public string PatientIdentifier { get; set; } public string PatientIdIssuer { get; set; } - public string AccessionNumber { get; set; } + public string AccessionNumberGroup { get; set; } - public string StudyId { get; set; } + public string Event { get; set; } public string Topic { get; set; } public List ActiveSubscriptions { get; set; } @@ -27,6 +27,8 @@ public ClientModel() public string PatientOpenErrorDiv { get; set; } //Study Info + public string StudyId { get; set; } + public string AccessionNumber { get; set; } public string StudyOpenErrorDiv { get; set; } } } diff --git a/WebSubClient/Controllers/WebSubClientController.cs b/WebSubClient/Controllers/WebSubClientController.cs index 56b9fbf..bdbd5ac 100644 --- a/WebSubClient/Controllers/WebSubClientController.cs +++ b/WebSubClient/Controllers/WebSubClientController.cs @@ -27,6 +27,9 @@ public class WebSubClientController : Controller { private readonly ILogger logger; private FhirClient client; + private Patient _patient; + private ImagingStudy _study; + #region Constructors public WebSubClientController(ILogger logger) { @@ -41,47 +44,7 @@ private void createFHIRClient() client.PreferredFormat = ResourceFormat.Json; } - private Patient GetPatient(string id) - { - Uri uri = new Uri("http://test.fhir.org/r3/Patient/" + id); - try - { - return client.Read(uri); - } - catch (FhirOperationException ex) - { - foreach (var item in ex.Outcome.Children) - { - Narrative nar = item as Narrative; - if (nar != null) - { - internalModel.PatientOpenErrorDiv = nar.Div; - } - } - return null; - } - } - - private ImagingStudy GetStudy(string id) - { - Uri uri = new Uri("http://test.fhir.org/r3/ImagingStudy/" + id); - try - { - return client.Read(uri); - } - catch (FhirOperationException ex) - { - foreach (var item in ex.Outcome.Children) - { - Narrative nar = item as Narrative; - if (nar != null) - { - internalModel.StudyOpenErrorDiv = nar.Div; - } - } - return null; - } - } + #endregion #region Properties @@ -131,21 +94,20 @@ public IActionResult Post([FromForm] ClientModel model) { public IActionResult OpenPatient(string patientID) { if (internalModel == null) { internalModel = new ClientModel(); } - if (patientID.Length > 0) + if (patientID != null) { - Patient pat = GetPatient(patientID); - if (pat != null) + _patient = GetPatient(patientID); + if (_patient != null) { - internalModel.PatientName = $"{pat.Name[0].Family}, {pat.Name[0].Given.FirstOrDefault()}"; - internalModel.PatientDOB = pat.BirthDate; - internalModel.PatientOpenErrorDiv = ""; - } - else - { - internalModel.PatientName = ""; - internalModel.PatientDOB = ""; - } - } + _study = null; + ClearPatientInfo(); + return UpdateClientModel(); + } + } + else + { + internalModel.PatientOpenErrorDiv = "

No patient ID given.

"; + } return View("WebSubClient", internalModel); } @@ -155,22 +117,111 @@ public IActionResult OpenPatient(string patientID) public IActionResult OpenStudy(string studyID) { if (internalModel == null) { internalModel = new ClientModel(); } - if (studyID.Length > 0) + if (studyID != null) { - ImagingStudy study = GetStudy(studyID); - if (study != null) + _study = GetStudy(studyID); + if (_study != null) { - internalModel.AccessionNumber = study.Accession.Value; - internalModel.StudyOpenErrorDiv = ""; + ClearStudyInfo(); + ClearPatientInfo(); + return UpdateClientModel(); } else { - internalModel.AccessionNumber = ""; + internalModel.StudyOpenErrorDiv = "

No study ID given.

"; } } return View("WebSubClient", internalModel); } + + private IActionResult UpdateClientModel() + { + //Study is nothing just use patient + //Otherwise get patient from study + if (_study != null) + { + _patient = GetPatient("", _study.Patient.Reference); + + internalModel.AccessionNumber = (_study.Accession != null) ? _study.Accession.Value : ""; + internalModel.StudyId = _study.Uid; + } + else + { + ClearStudyInfo(); + } + + if (_patient == null) + { + ClearPatientInfo(); + } + else + { + internalModel.PatientName = $"{_patient.Name[0].Family}, {_patient.Name[0].Given.FirstOrDefault()}"; + internalModel.PatientDOB = _patient.BirthDate; + } + + return View("WebSubClient", internalModel); + } + + private void ClearPatientInfo() + { + internalModel.PatientName = ""; + internalModel.PatientDOB = ""; + internalModel.PatientOpenErrorDiv = ""; + } + + private void ClearStudyInfo() + { + internalModel.StudyId = ""; + internalModel.AccessionNumber = ""; + internalModel.StudyOpenErrorDiv = ""; + } + + private Patient GetPatient(string id, string patientURI = "") + { + + Uri uri = new Uri("http://test.fhir.org/r3/Patient/" + id); + + try + { + if (patientURI.Length > 0) { return client.Read(patientURI); } + else { return client.Read(uri); } + } + catch (FhirOperationException ex) + { + foreach (var item in ex.Outcome.Children) + { + Narrative nar = item as Narrative; + if (nar != null) + { + internalModel.PatientOpenErrorDiv = nar.Div; + } + } + return null; + } + } + + private ImagingStudy GetStudy(string id) + { + Uri uri = new Uri("http://test.fhir.org/r3/ImagingStudy/" + id); + try + { + return client.Read(uri); + } + catch (FhirOperationException ex) + { + foreach (var item in ex.Outcome.Children) + { + Narrative nar = item as Narrative; + if (nar != null) + { + internalModel.StudyOpenErrorDiv = nar.Div; + } + } + return null; + } + } #endregion #region Subscription events diff --git a/WebSubClient/Views/WebSubClient/WebSubClient.cshtml b/WebSubClient/Views/WebSubClient/WebSubClient.cshtml index 1ee942f..bf410f9 100644 --- a/WebSubClient/Views/WebSubClient/WebSubClient.cshtml +++ b/WebSubClient/Views/WebSubClient/WebSubClient.cshtml @@ -169,8 +169,10 @@
-
+
@Html.Label("Accession number: " + Model.AccessionNumber) +
+ @Html.Label("Study ID: " + Model.StudyId)
@@ -206,7 +208,7 @@ @{ using (Html.BeginForm("openStudy", "WebSubClient", FormMethod.Post)) { - +
From 2117b676acd365ba939b0e78cb1012157cdba2e0 Mon Sep 17 00:00:00 2001 From: Will Maethner Date: Sun, 19 Aug 2018 16:09:36 -0500 Subject: [PATCH 3/4] Enable patient serach and open using FHIR Added configurable FHIR server support and patient searching given an ID or name. --- Common/Common.csproj | 7 + Common/Model/ClientModel.cs | 12 + .../Controllers/WebSubClientController.cs | 124 +++++--- .../Views/WebSubClient/WebSubClient.cshtml | 270 ++++++++---------- WebSubClient/WebSubClient.csproj | 2 + 5 files changed, 236 insertions(+), 179 deletions(-) diff --git a/Common/Common.csproj b/Common/Common.csproj index 993e89d..5129918 100644 --- a/Common/Common.csproj +++ b/Common/Common.csproj @@ -5,7 +5,14 @@ + + + + ..\..\..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.viewfeatures\2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.ViewFeatures.dll + + + diff --git a/Common/Model/ClientModel.cs b/Common/Model/ClientModel.cs index e586f1d..1a86972 100644 --- a/Common/Model/ClientModel.cs +++ b/Common/Model/ClientModel.cs @@ -2,6 +2,8 @@ using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; +using Microsoft.AspNetCore.Mvc.Rendering; +using Hl7.Fhir.Model; namespace FHIRcastSandbox.Model { public class ClientModel : ModelBase { @@ -9,6 +11,8 @@ public ClientModel() { ActiveSubscriptions = new List(); SubscriptionsToHub = new List(); + PatientSearchOptions = new Dictionary(); + SearchPatients = new SelectList(new List()); } public string UserIdentifier { get; set; } public string PatientIdentifier { get; set; } @@ -22,13 +26,21 @@ public ClientModel() public List SubscriptionsToHub { get; set; } //Patient Info + public Patient Patient { get; set; } public string PatientName { get; set; } public string PatientDOB { get; set; } public string PatientOpenErrorDiv { get; set; } + public string SelectedPatientID { get; set; } + public IEnumerable SearchPatients { get; set; } + public Dictionary PatientSearchOptions { get; set; } + //Study Info public string StudyId { get; set; } public string AccessionNumber { get; set; } public string StudyOpenErrorDiv { get; set; } + + //FHIR Server Info + public string FHIRServer { get; set; } } } diff --git a/WebSubClient/Controllers/WebSubClientController.cs b/WebSubClient/Controllers/WebSubClientController.cs index bdbd5ac..83fa06a 100644 --- a/WebSubClient/Controllers/WebSubClientController.cs +++ b/WebSubClient/Controllers/WebSubClientController.cs @@ -1,3 +1,10 @@ +using FHIRcastSandbox.Model; +using Hl7.Fhir.Model; +using Hl7.Fhir.Rest; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; @@ -5,14 +12,9 @@ using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; -using FHIRcastSandbox.Model; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using Hl7.Fhir.Rest; -using Hl7.Fhir.Model; -namespace FHIRcastSandbox.Controllers { +namespace FHIRcastSandbox.Controllers +{ [Route("")] public class HomeController : Controller { public IActionResult Index() { @@ -25,22 +27,24 @@ public IActionResult Index() { [Route("client")] public class WebSubClientController : Controller { - private readonly ILogger logger; - private FhirClient client; - private Patient _patient; - private ImagingStudy _study; - + #region Constructors public WebSubClientController(ILogger logger) { this.logger = logger; this.UID = Guid.NewGuid().ToString("n"); - createFHIRClient(); + + if (internalModel == null) + { + internalModel = new ClientModel(); + internalModel.FHIRServer = DEFAULT_FHIR_SERVER; + createFHIRClient(); + } } - private void createFHIRClient() + private void createFHIRClient(string fhirServer = DEFAULT_FHIR_SERVER) { - client = new FhirClient("http://test.fhir.org/r3"); + client = new FhirClient(fhirServer); client.PreferredFormat = ResourceFormat.Json; } @@ -53,24 +57,30 @@ private void createFHIRClient() private static Dictionary pendingSubs = new Dictionary(); private static Dictionary activeSubs = new Dictionary(); + private readonly ILogger logger; + private static FhirClient client; + private static Patient _patient; + private static ImagingStudy _study; + const string DEFAULT_FHIR_SERVER = "http://test.fhir.org/r3"; + private const string VIEW_NAME = "WebSubClient"; + public string UID { get; set; } #endregion [HttpGet] - public IActionResult Get() => View("WebSubClient", new ClientModel()); + public IActionResult Get() + { + return View(VIEW_NAME, internalModel); + } #region Client Events public IActionResult Refresh() { if (internalModel == null) { internalModel = new ClientModel(); } internalModel.ActiveSubscriptions = activeSubs.Values.ToList(); - //internalModel.PatientName = GetPatient("100").Name[0].ToString(); - //internalModel.PatientDOB = GetPatient("100").BirthDate; - return View("WebSubClient", internalModel); + return View(VIEW_NAME, internalModel); } - - /// /// Called when the client updates its context. Lets the hub know of the changes so it /// can notify any subscribing apps. @@ -86,19 +96,45 @@ public IActionResult Post([FromForm] ClientModel model) { //var response = httpClient.PostAsync(this.Request.Scheme + "://" + this.Request.Host + "/api/hub/notify", new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json")).Result; var response = httpClient.PostAsync(this.Request.Scheme + "://localhost:5000/api/hub/notify", new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json")).Result; - return View("WebSubClient", model); + return View(VIEW_NAME, model); + } + + [Route("searchPatients")] + [HttpPost] + public IActionResult SearchPatients(string patientID, string patientName) + { + SearchParams pars = new SearchParams(); + if (patientID != null) { pars.Add("_id", patientID); } + if (patientName != null) { pars.Add("name", patientName); } + + Bundle bundle = client.Search(pars); + + List patients = new List(); + foreach (Bundle.EntryComponent entry in bundle.Entry) + { + Patient pat = (Patient)entry.Resource; + patients.Add(new SelectListItem + { + Value = pat.Id, + Text = pat.Name[0].ToString() + }); + } + + internalModel.SearchPatients = new SelectList(patients, "Value", "Text"); + + return View(VIEW_NAME, internalModel); } [Route("openPatient")] [HttpPost] - public IActionResult OpenPatient(string patientID) + public IActionResult OpenPatient(string patientSelect) { if (internalModel == null) { internalModel = new ClientModel(); } - if (patientID != null) + if (patientSelect != null) { - _patient = GetPatient(patientID); + _patient = GetPatient(patientSelect); if (_patient != null) - { + { _study = null; ClearPatientInfo(); return UpdateClientModel(); @@ -109,7 +145,7 @@ public IActionResult OpenPatient(string patientID) internalModel.PatientOpenErrorDiv = "

No patient ID given.

"; } - return View("WebSubClient", internalModel); + return View(VIEW_NAME, internalModel); } [Route("openStudy")] @@ -132,7 +168,22 @@ public IActionResult OpenStudy(string studyID) } } - return View("WebSubClient", internalModel); + return View(VIEW_NAME, internalModel); + } + + [Route("saveSettings")] + [HttpPost] + public IActionResult SaveSettings(string fhirServer) + { + //return PartialView("ErrorModal"); + if (fhirServer != internalModel.FHIRServer) + + { + internalModel.FHIRServer = fhirServer; + createFHIRClient(internalModel.FHIRServer); + } + + return View(VIEW_NAME, internalModel); } private IActionResult UpdateClientModel() @@ -161,7 +212,9 @@ private IActionResult UpdateClientModel() internalModel.PatientDOB = _patient.BirthDate; } - return View("WebSubClient", internalModel); + + internalModel.Patient = _patient; + return View(VIEW_NAME, internalModel); } private void ClearPatientInfo() @@ -180,13 +233,12 @@ private void ClearStudyInfo() private Patient GetPatient(string id, string patientURI = "") { - - Uri uri = new Uri("http://test.fhir.org/r3/Patient/" + id); + Uri uri = new Uri(client.Endpoint + "Patient/" + id); try { if (patientURI.Length > 0) { return client.Read(patientURI); } - else { return client.Read(uri); } + else { return client.Read(uri); } } catch (FhirOperationException ex) { @@ -204,7 +256,7 @@ private Patient GetPatient(string id, string patientURI = "") private ImagingStudy GetStudy(string id) { - Uri uri = new Uri("http://test.fhir.org/r3/ImagingStudy/" + id); + Uri uri = new Uri(client.Endpoint + "ImagingStudy/" + id); try { return client.Read(uri); @@ -320,14 +372,14 @@ public async Task Subscribe(string subscriptionUrl, string topic, var result = await httpClient.PostAsync(subscriptionUrl, httpcontent); if (internalModel == null) { internalModel = new ClientModel(); } - return View("WebSubClient", internalModel); + return View(VIEW_NAME, internalModel); } [Route("unsubscribe/{subscriptionId}")] [HttpPost] public async Task Unsubscribe(string subscriptionId) { this.logger.LogDebug($"Unsubscribing subscription {subscriptionId}"); - if (!activeSubs.ContainsKey(subscriptionId)) { return View("WebSubClient", internalModel); } + if (!activeSubs.ContainsKey(subscriptionId)) { return View(VIEW_NAME, internalModel); } Model.Subscription sub = activeSubs[subscriptionId]; sub.Mode = SubscriptionMode.unsubscribe; @@ -346,7 +398,7 @@ public async Task Unsubscribe(string subscriptionId) { activeSubs.Remove(subscriptionId); - return View("WebSubClient", internalModel); + return View(VIEW_NAME, internalModel); } #endregion diff --git a/WebSubClient/Views/WebSubClient/WebSubClient.cshtml b/WebSubClient/Views/WebSubClient/WebSubClient.cshtml index bf410f9..fb8bc0d 100644 --- a/WebSubClient/Views/WebSubClient/WebSubClient.cshtml +++ b/WebSubClient/Views/WebSubClient/WebSubClient.cshtml @@ -10,6 +10,7 @@ + View @@ -22,13 +23,13 @@

Client info

@* Title row *@
-

Subscription info

-

User session info

+

Subscription info

+

User session info

@* Content row *@
@* Subscription column *@ -
+
@* Create new subscriptions form *@
@@ -96,157 +97,123 @@
- @* User session column *@ -
+ + @* Session Info Column *@ +
-
- @{ - using (Html.BeginForm("Post", "WebSubClient", FormMethod.Post)) + @* Current status row *@ +
+ @* Patient column *@ +
+
Patient Context
+ @if (Model.Patient != null) { -
-
-
- -
- @Html.TextBoxFor(m => m.UserIdentifier, new { @class = "form-control" }) -
-
- -
- @Html.TextBoxFor(m => m.PatientIdentifier, new { @class = "form-control" }) -
-
- -
- @Html.TextBoxFor(m => m.PatientIdIssuer, new { @class = "form-control" }) -
-
-
-
- -
- @Html.TextBoxFor(m => m.AccessionNumber, new { @class = "form-control" }) -
-
- -
- @Html.TextBoxFor(m => m.AccessionNumberGroup, new { @class = "form-control" }) -
-
- -
- @Html.TextBoxFor(m => m.StudyId, new { @class = "form-control" }) -
-
-
+
+ @Html.Label("Name: " + Model.Patient.Name[0].ToString()) @*Model.PatientName)*@ +
+ @Html.Label("ID: " + Model.Patient.Id) +
+ @Html.Label("DOB: " + Model.Patient.BirthDate) + + } else + { +
No patient selected.
+ } +
+ @* Study column *@ +
+ +
+ @Html.Label("Accession number: " + Model.AccessionNumber) +
+ @Html.Label("Study ID: " + Model.StudyId) + +
+
+ @* Selection list row *@ +
+ @* Patient column *@ +
+ +
-
- + @{ + using (Html.BeginForm("openPatient", "WebSubClient", FormMethod.Post)) + { + +
+
+
+ } + } +
+ @* Study column *@ +
+ +
+
+ @* Search criteria row *@ +
+ @* Patient column *@ +
+
Patient search
+ + @{ + using (Html.BeginForm("searchPatients", "WebSubClient", FormMethod.Post)) + { +
- @Html.TextBoxFor(m => m.Topic, new { @class = "form-control" }) -
-
- +
+ +

- @Html.TextBoxFor(m => m.Event, new { @class = "form-control" }) -
-
- -
- } - -
- @* Patient context *@ -
- -
- @Html.Label("Name: " + Model.PatientName) +
- @Html.Label("DOB: " + Model.PatientDOB) -
- @* Study context *@ -
-
- -
- @Html.Label("Accession number: " + Model.AccessionNumber) -
- @Html.Label("Study ID: " + Model.StudyId) +
+
-
-
- -
-
-
- @{ - using (Html.BeginForm("openPatient", "WebSubClient", FormMethod.Post)) - { - -
-
- -
-
-
- @if (!string.IsNullOrEmpty(Model.PatientOpenErrorDiv)) - { - @Html.Raw(Model.PatientOpenErrorDiv) - } -
- -
-
-
- } - } -
-
-
-
- @{ - using (Html.BeginForm("openStudy", "WebSubClient", FormMethod.Post)) - { - -
-
- -
-
-
- @if (!string.IsNullOrEmpty(Model.StudyOpenErrorDiv)) - { - @Html.Raw(Model.StudyOpenErrorDiv) - } -
-
-
-
- } +
+
+
+ } + } +
+ @* Study column *@ +
+
Study search
+
+
+ @* Settings row *@ +
+
+
+
+ @{ + using (Html.BeginForm("saveSettings", "WebSubClient", FormMethod.Post)) + { +
+

+ Settings +

+
+
+ @*
@Html.TextBoxFor(m => m.FHIRServer, new { @class = "form-control" })
*@ + + +
} -
+ }
- - } - -
-
-
- @* Miscellaneous row *@ -
-
-
- @{ - using (Html.BeginForm("Refresh", "WebSubClient", FormMethod.Post)) - { -
- -
- } - } +
+
@@ -287,10 +254,27 @@ + + @* Miscellaneous row *@ +
+
+
+ @{ + using (Html.BeginForm("Refresh", "WebSubClient", FormMethod.Post)) + { +
+ +
+ } + } +
+
+
+ - + diff --git a/WebSubClient/WebSubClient.csproj b/WebSubClient/WebSubClient.csproj index 4a27d04..325f7d4 100644 --- a/WebSubClient/WebSubClient.csproj +++ b/WebSubClient/WebSubClient.csproj @@ -6,9 +6,11 @@ + + From 4197e3457a0e03239c8379f1b38e697062c4304a Mon Sep 17 00:00:00 2001 From: Will Maethner Date: Fri, 14 Sep 2018 10:28:52 -0500 Subject: [PATCH 4/4] Use NuGet reference instead of local reference --- Common/Common.csproj | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Common/Common.csproj b/Common/Common.csproj index 5129918..2be1f2a 100644 --- a/Common/Common.csproj +++ b/Common/Common.csproj @@ -7,12 +7,7 @@ - - - - - ..\..\..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.mvc.viewfeatures\2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.ViewFeatures.dll - +