- Log in to post comments
User bio
404 bio not found
Member since May 1, 2023
Posts:
Replies:
Hi Eyal,
The idea is to implement a custom FHIR operation as per the docs.
Once you set up the pre-installation subclassing
(this is where you override those 3 classes:
HS.FHIRServer.Storage.JsonAdvSQL.Interactions, HS.FHIRServer.Storage.JsonAdvSQL.InteractionsStrategy, HS.FHIRServer.Storage.JsonAdvSQL.RepoManager)
.png)
You can create a custom operations class (make sure you reference it in your Interactions class):
Class Testing.Internal.Interactions Extends HS.FHIRServer.Storage.JsonAdvSQL.Interactions
{
Parameter OperationHandlerClass As%String = "Testing.Internal.myOperations";
}
Class Testing.Internal.myOperations Extends HS.FHIRServer.Storage.JsonAdvSQL.BuiltInOperations
{
ClassMethod FHIRTypeOpCustompatienteverything(pService As HS.FHIRServer.API.Service, pRequest As HS.FHIRServer.API.Data.Request, pResponse As HS.FHIRServer.API.Data.Response)
{
if pRequest.Type="Patient" {
if (pRequest.QueryString '= ""){
Set fhirService = ##class(HS.FHIRServer.Service).EnsureInstance("/api/internal/test1") //fhir server endpoint Set request = ##class(HS.FHIRServer.API.Data.Request).%New()
Set request.RequestPath = "/Patient"set request.QueryString = pRequest.QueryString
Set request.RequestMethod = "GET"Do fhirService.DispatchRequest(request, .response)
Set json = response.Json
If json.%Get("entry") '="" {
Set iter = json.entry.%GetIterator()
While iter.%GetNext(.key, .value) { //for each patient entry request an everythingSet everythingRequest = ##class(HS.FHIRServer.API.Data.Request).%New()
Set everythingRequest.RequestPath = "/Patient/"_value.resource.id_"/$everything"Set everythingRequest.RequestMethod = "GET"Write !
Write"Patient ID: ", value.resource.id, !
Do fhirService.DispatchRequest(everythingRequest, .everythingResponse)
Write"Everything: ", !, everythingResponse.Json.%ToJSON()
}
}
}
else{
Set pResponse.Json = ##class(HS.FHIRServer.Util.Outcome).Create("information", "No Query String", "informational")
}
}
set pResponse.Status = 200
}
ClassMethod AddSupportedOperations(pMap As%DynamicObject)
{
do##super(pMap)
Do pMap.%Set("patient-identifiers-everything", "http://hl7.org/fhir/OperationDefinition/patient-identifiers-everything")
}
}
Hope this helps.
Ari
- Log in to post comments
Excellent step by step that so many of our customers have been asking about since the deprecation of SAM - thank you Stav!
- Log in to post comments
Open Exchange applications:
Certifications & Credly badges:
Ariel has no Certifications & Credly badges yet.
Followers:
Ariel has no followers yet.
Following:
Ariel has not followed anybody yet.
check out the just released HSSYS Mirroring Utility that lets you skip steps 4-9!