IntegrationsHL7 (Old Flow)Inbound

Bill Cancel

Inbound HL7/SFTP documentation for cancelling an existing bill through ORC CA.

👤 Development Team📅 Updated: May 5, 2026📁 Integrations🏷️ HL7🏷️ SFTP🏷️ Inbound🏷️ Bill Cancel

Bill Cancel

This operation cancels an existing active bill when the inbound HL7 order sends a cancellation status. It is handled synchronously inside hl7/2_3/createOrder/.

When This Flow Runs

All conditions must be true:

  • orderNumber is present.
  • An active bill exists for the same lab and order number, or for the numeric labBillId equivalent of the order number.
  • uniqueOrderNo = 1.
  • cancelBill = 1.
  • orm_status is CA, case-insensitively.

orm_status is parsed from ORC-1.

Implementation Path

StepFunctionDescription
Existing bill lookuphl7/2_3/createOrder/Finds active matching bill.
Cancellation payload creationhl7/2_3/createOrder/Builds the cancellation payload from the existing bill and inbound comments.
Bill cancellationcancelBillCommonFunctionApplies standard Crelio bill cancellation behavior.

Internal Cancellation Payload

The router creates an internal cancellation payload for cancelBillCommonFunction.

FieldValue
labBillIdExisting bill's labBillId.
labIdLab ID resolved from authKey.
labUserIdExisting bill user ID, falling back to token user ID.
deductionFlag0. This integration path does not request payment deletion.
billCommentInbound bill comments, usually from NTE.
labUserNameLab user name from the inbound token.
fromApi0.
orgSMSFlag0.

Cancellation Effects

cancelBillCommonFunction applies the normal product cancellation flow:

  • Marks the bill as cancelled with isCancel = 1.
  • Clears refund and write-off flags on the bill.
  • Updates lastEditedBy and lastUpdatedTime.
  • Appends cancellation details to the bill comments.
  • Updates organization due and ledger entries where applicable.
  • Marks related billingInfo rows as dismissed.
  • Marks related labReportRelation rows as dismissed.
  • Clears rack/location fields on related collected samples.
  • Updates report/sample search indexes through existing helpers.
  • Calls cancelBillTaskCall for asynchronous cancellation side effects.

Response

{
  "status": 200,
  "Message": "Bill canceled successfully for Order Number : <orderNumber>"
}

Important Notes

  • This flow cancels the full bill.
  • It does not selectively cancel only the tests listed in OBR.
  • Test/sample-level cancellation through sample status is documented in Update Order.
  • If uniqueOrderNo = 0, this bill-cancel branch is not used.
  • If cancelBill = 0, the same inbound CA message can be acknowledged as a duplicate order instead of cancelling the bill.

Common Issues

IssueCheck
Cancellation is not triggeredConfirm uniqueOrderNo = 1, cancelBill = 1, and ORC-1 = CA.
Bill is not foundConfirm the inbound orderNumber matches an active bill order number or numeric labBillId.
Request returns Bill already existsThe bill was found, but cancellation conditions were not all met.
Only one test should be cancelledUse a test/sample cancellation flow, not the full bill cancel configuration.

On this page