{
  "resourceType": "StructureDefinition",
  "id": "profile-PaymentNotice",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-PaymentNotice",
  "name": "PaymentNotice",
  "title": "Payment Notice",
  "status": "active",
  "experimental": false,
  "description": "A record showing a payment made to a patient",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    },
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "PaymentNotice",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/PaymentNotice",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "PaymentNotice.id",
        "path": "PaymentNotice.id",
        "comment": "This will be the odbNum followed by the date.  If there are multiple payments to the same odbNum for the same day, add a sequence number to make the payments unique.",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "PaymentNotice.status",
        "path": "PaymentNotice.status",
        "patternCode": "active"
      },
      {
        "id": "PaymentNotice.created.extension",
        "path": "PaymentNotice.created.extension",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "PaymentNotice.created.extension:dar",
        "path": "PaymentNotice.created.extension",
        "sliceName": "dar",
        "min": 1,
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
            ]
          }
        ]
      },
      {
        "id": "PaymentNotice.created.extension:dar.url",
        "path": "PaymentNotice.created.extension.url",
        "fixedUri": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
      },
      {
        "id": "PaymentNotice.created.extension:dar.value[x]",
        "path": "PaymentNotice.created.extension.value[x]",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "ordered": false,
          "rules": "open"
        }
      },
      {
        "id": "PaymentNotice.created.extension:dar.value[x]:dar",
        "path": "PaymentNotice.created.extension.value[x]",
        "sliceName": "dar",
        "min": 1
      },
      {
        "id": "PaymentNotice.paymentDate",
        "path": "PaymentNotice.paymentDate",
        "min": 1,
        "type": [
          {
            "code": "date",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-date-full"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "PaymentDTO.paymentDate"
          }
        ]
      },
      {
        "id": "PaymentNotice.payee",
        "path": "PaymentNotice.payee",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "PaymentNotice.payee.extension",
        "path": "PaymentNotice.payee.extension",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "PaymentNotice.payee.extension:patient",
        "path": "PaymentNotice.payee.extension",
        "sliceName": "patient",
        "min": 1,
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/alternate-reference"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "PaymentDTO.odbNum"
          }
        ]
      },
      {
        "id": "PaymentNotice.payee.extension:patient.url",
        "path": "PaymentNotice.payee.extension.url",
        "fixedUri": "http://hl7.org/fhir/StructureDefinition/alternate-reference"
      },
      {
        "id": "PaymentNotice.payee.extension:patient.value[x]",
        "path": "PaymentNotice.payee.extension.value[x]",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-rest"
            ],
            "targetProfile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Patient-search"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "PaymentNotice.payee.display",
        "path": "PaymentNotice.payee.display",
        "short": "Patient name",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "PaymentDTO.name"
          }
        ]
      },
      {
        "id": "PaymentNotice.recipient",
        "path": "PaymentNotice.recipient",
        "patternReference": {
          "display": "BPCS"
        }
      },
      {
        "id": "PaymentNotice.amount",
        "path": "PaymentNotice.amount",
        "type": [
          {
            "code": "Money",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Money-CAD"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "PaymentDTO.amount"
          }
        ]
      },
      {
        "id": "PaymentNotice.paymentStatus",
        "path": "PaymentNotice.paymentStatus",
        "min": 1,
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/paymentstatus",
              "code": "paid"
            }
          ]
        }
      }
    ]
  }
}