Stream: implementers
Topic: Create Order on FHIR server - ResourceReference
Santosh Jami (Aug 24 2017 at 00:35):
Hi guys,
I am trying to place an Order into the Spark FHIR Server.
My input is OrderDTO which has a structure like this:
{
"PatientID" : "WD046960A",
"LabDetailsDTO" : {
"LabToken" : "Quest",
"LabFacility" : "MET"
},
"OrderingProvider" : {
"NPI" : "2341345025",
"FirstName" : "OPFirstName",
"LastName" : "OPLastName",
"Address" : null,
"HomePhoneNoDelimiters" : "435-342-1543"
},
"LabOrders" : [
"HEPC",
"HIV"
]
}
I see the Order Subject / Source / Target - all of them are ResourceReference data types.
I have the patients in DB, so I am able to form the ResourceReference for the Patient.
I don't have the Ordering Provider in the DB, how should I handle adding the Ordering Provider to the Order object?
var fhirOrder = new Order();
//get the patient resource from DB
var q = new SearchParams().Add("identifier", orderDTO.SafeEMRId).OrderBy("_lastUpdated", SortOrder.Descending);
var patientSearchEntry = fhirClient.Search<Patient>(q).Entry.Single();
fhirOrder.Subject = new ResourceReference { Reference = string.Format("Patient/{0}", patientSearchEntry.Resource.Id) };
fhirOrder.Source = new ResourceReference { }; //??How to add the Ordering provider?
return fhirOrder;
Should I create an entry of Ordering Provider in DB and add a reference to it as I did for the subject?
Any help is greatly appreciated.
Thanks
Santosh Jami
Last updated: Apr 12 2022 at 19:14 UTC