jasonwa.ng
07/05/2023, 10:26 PMrahul1
07/05/2023, 10:30 PMServiceRequest.requester and ServiceRequest.authoredOn are probably the most appropriaterahul1
07/05/2023, 10:31 PMrahul1
07/05/2023, 10:34 PMjasonwa.ng
07/05/2023, 11:02 PMrequester and authoredOn to track the actual ordering physician + when the order was signedjasonwa.ng
07/05/2023, 11:02 PMjasonwa.ng
07/05/2023, 11:08 PMnote field if that makes sensejasonwa.ng
07/05/2023, 11:09 PMrahul1
07/05/2023, 11:35 PMrahul1
07/05/2023, 11:37 PMrahul1
07/05/2023, 11:39 PMjasonwa.ng
07/06/2023, 11:31 PMrelevantHistory item is being returned at all, actuallyjasonwa.ng
07/06/2023, 11:31 PMjasonwa.ng
07/06/2023, 11:33 PMmutation CREATE_ORDER(
$categoryCode: String!
$codingSystem: String!
$categoryDisplay: String!
$orderDate: String!
$requestedOn: String!
$becameActiveOn: String
$orderingPhysicianRef: String!
$orderInstructions: String
$patientRef: String!
$cnaRefs: [ReferenceCreate!]!
$orderStatus: String!
$isVerbalOrder: Boolean!
$receivedFrom: String!
$receivedAt: String!
) {
ServiceRequestCreate(
res: {
resourceType: "ServiceRequest"
code: { coding: [{ system: $codingSystem, code: $categoryCode, display: $categoryDisplay }] }
category: [{ coding: [{ system: $codingSystem, code: $categoryCode, display: $categoryDisplay }] }]
occurrenceDateTime: $orderDate
requester: { reference: $orderingPhysicianRef }
orderDetail: { text: $orderInstructions }
extension: [
{
# Extension for verbal order status
url: "https://blah.org/fhir/StructureDefinition/verbal-order"
valueBoolean: $isVerbalOrder
}
{
# Extension for requested on date
url: "https://blah.org/fhir/StructureDefinition/requested-on"
valueDateTime: $requestedOn
}
]
authoredOn: $becameActiveOn
note: [
{
time: $receivedAt,
text: $receivedFrom,
extension: [{
url: "https://blah.org/fhir/StructureDefinition/blah-note-code",
valueString: "received_from"
}]
}
]
# Additional (potentially required) fields
status: $orderStatus
intent: "order"
subject: { reference: $patientRef }
priority: "routine"
performer: $cnaRefs
}
) {
id
}
}jasonwa.ng
07/06/2023, 11:36 PM{
"data": {
"ServiceRequestCreate": {
"id": "86560382-db5a-4ff5-af79-2009736c0e94"
}
}
}rahul1
07/07/2023, 3:36 AM{
id
}
With graphQL mutations (https://graphql.org/learn/queries/#mutations), this section specifies which fields from the newly created resource are returned to the client.
E.g.
mutation {
ServiceRequestCreate(
res: {
resourceType: "ServiceRequest",
status: "active",
intent: "order",
subject: {reference: "Patient/123"}
}
) {
id
}
}
returns
{
"data": {
"newOrder": {
"id": "a14eb5ae-58d2-4322-a4e7-82c232ab4033"
}
}
}
and
mutation {
ServiceRequestCreate(
res: {
resourceType: "ServiceRequest",
status: "active",
intent: "order",
subject: {reference: "Patient/123"}
}
) {
id
relevantHistory {
reference
}
}
}
returns
{
"data": {
"ServiceRequestCreate": {
"id": "0807db8a-20c5-412c-b3ea-12520359533c",
"relevantHistory": null
}
}
}rahul1
07/07/2023, 3:39 AMCREATE_ORDER mutationrahul1
07/07/2023, 3:40 AM