Overview
The cancellation operation reverses previously registered medical services and procedures. Like registration, it supports both header-level and item-level validation, allowing for partial cancellation scenarios.Operation Method
Hl7Service.java:52-63
Endpoint URL: Retrieved via EnvironmentConfig.getHl7CancelacionUrl()
Request Structure
CancelacionRequest
The request contains operation data, cancellation-specific fields, technical parameters, and provider information.Operation Data Fields
Operation mode. Typically “N” for new cancellation (max length: 1)
Credential number as Long. Example:
7180171001151Service type identifier. Example:
2Registration datetime. May be empty for cancellations
Manual processing indicator. Enum values:
MANUAL(“0”)CAPITADOR(“C”)COMSULTA(“L”)
Cancellation-Specific Fields
External ticket number. Typically
0 for cancellationsCancellation header identifier. Nullable.
Cancellation mode. Typically “N” (max length: varies)
External error code if applicable. Nullable.
Technical Data Fields
Terminal identifier
Internal transaction number
Provider Fields
Provider CUIT tax identification as Long
HL7 Free Parameters
Custom parameter 1 for additional data
Custom parameter 2 for additional data
Example Request
Response Structure
CancelacionResponse
The response has a two-level structure identical to registration: a header (cabecera) and optional detail items (detalle).Header information containing overall cancellation transaction data and rejection status
Array of detail items with individual item rejection information. May be null if no detail validation is performed.
CancelacionCabecera
Header-level response data for the cancellation.Transaction Fields
Transaction identifier for the cancellation
Transaction registration timestamp
Rejection Fields
Header rejection code. If greater than 0, the entire cancellation is rejected at the header level.
Human-readable description of the header rejection reason
Member Information
Patient’s full name
Patient Medical Identifier
Patient age
Patient sex
Coverage Information
Plan code identifier
Tax status indicator
Tax law applicability
CancelacionDetalle
Item-level detail with individual cancellation rejection tracking.Transaction identifier for this detail item
Item rejection code. If greater than 0, this specific item cancellation is rejected.
Human-readable description of the item rejection reason
Example Response (Full Success)
Example Response (Header Rejected)
Example Response (Partial Success)
Validation Logic
The cancellation validation follows the same two-level pattern as registration (Hl7Service.java:171-209):
1. Header Validation
Header Rejection: If
rechaCabecera > 0 in the cabecera, the entire cancellation is rejected. No items are cancelled.2. Detail Validation
Partial Success: If the header is accepted but one or more detail items have
recha > 0, the operation returns PARTIAL status. Each rejected item is tracked with Hl7ItemError having origin = DETALLE.Result Status
OK - Complete success- Header accepted:
rechaCabecerais 0, null, or negative - All detail items cancelled or no detail validation performed
- Full cancellation processed
- Header accepted:
rechaCabecerais 0, null, or negative - One or more detail items rejected:
recha > 0 - Contains list of
Hl7ItemErrorwith originDETALLE - Some items cancelled, others rejected
- Header rejected:
rechaCabecera > 0 - No items processed
- Contains functional error with rejection details
- Network error, invalid response, or parsing failure
- No response data available
Handling Results
Complete Success
Partial Success
Header Rejection
Technical Error
Environment Configuration
The cancellation endpoint URL is constructed using:EnvironmentConfig.java:65-70):
Version Difference: Note that cancellation uses API version v2, while eligibility and registration use v3.
https://api.example.com/api/v2/prestadores/hl7/cancela-prestacion
Common Cancellation Scenarios
Scenario 1: Cancel Entire Service
When cancelling a complete service transaction:- Provide the original transaction identifier
- Set
modoandcancelModoto “N” - If successful, all items are cancelled
Scenario 2: Partial Cancellation Not Allowed
If a service item is outside the cancellation window:- Header accepted with
rechaCabecera = 0 - Specific items rejected in
detallearray - Result status:
PARTIAL - Review
denoItemfor rejection reasons
Scenario 3: Already Cancelled
Attempting to cancel a previously cancelled service:- Header rejected with specific code (e.g., 310)
rechaCabeDeno: “Prestación ya cancelada previamente”- Result status:
REJECTED
Related Operations
Registration Operations
View the registration flow that precedes cancellation
Result Types
Handle partial cancellations and rejections