Skip to content

Maintain provider notes

clsNote maintains a general-purpose note row that can be attached to a provider, provider location, bill, or claim through optional foreign-key fields, categorized by a note type/category code pair.

Field Value
Operation ID OP-PRV-12
Trigger Caller calls NewCbpNote/GetCbpNote, edits properties, and calls Save() or Delete()
Inputs ProviderLocationSeqNum (create-time), NoteTypeCode, NoteCategoryCode, ActiveFlag, optional BillID/ClaimID/ProviderSeqNum/ProviderLocationSeqNum, NoteTxt
Outputs Persisted CBP_NOTE row
Primary components clsNote.Create, BeforeInsert/BeforeUpdate/BeforeDelete
Entry point Business\SAIF.Business.Provider\clsNote.vb

Steps

  1. Create. NewCbpNote(inDataportal, inProviderLocSeqNum): if ProviderLocationSeqNum > 0, Create() assigns a new seq num via GetNextSeqNum("CBP_NOTE_SEQ"); otherwise it uses the criteria's note seq num directly. m_CreateUser/m_CreateDate are stamped, but the provider location seq num itself is not copied onto the object during create — it must be set explicitly before save.*
  2. Retrieve. Reads CBP_NOTE joined to CBP_NOTE_TYPE_CODE (NOTE_TYPE_CODE = CODE and NOTE_CATEGORY_CODE = CBP_NOTE_CATEGORY_CODE) by CBP_NOTE_SEQ_NUM (SQL-041), also reading PROVIDER_CONTACT_NOTE_FLAG AS ContactNoteFlag to derive IsContactNote.
  3. Validate before save (BR-015):
  4. CommonBusinessRules.TextRequired on NoteTypeCode: "Error: Missing Type."
  5. CommonBusinessRules.TextRequired on NoteTxt: "Error: Missing note."
  6. Insert. Writes CBP_NOTE_SEQ_NUM, NOTE_TYPE_CODE, NOTE_CATEGORY_CODE, ACTIVE_FLAG, CREATE_DATE/CREATE_USER, UPDATE_NUM, optional BILL_ID/CLAIM_ID/PROVIDER_SEQ_NUM/PROVIDER_LOCATION_SEQ_NUM, and NOTE_TXT to CBP_NOTE (SQL-017).
  7. On a rows-affected value other than 1: add "Insert Failed".
  8. Update. Writes type/category/active flag, UPDATE_DATE/UPDATE_USER, UPDATE_NUM = UPDATE_NUM + 1, and the optional foreign keys and note text to CBP_NOTE (SQL-065) with concurrency check WHERE CBP_NOTE_SEQ_NUM = :CbpNoteSeqNum AND UPDATE_NUM = :UpdateNum.
  9. On a rows-affected value other than 1: add the DB contention error; otherwise increment m_UpdateNum and MarkOld().
  10. Delete. Deletes the CBP_NOTE row by CBP_NOTE_SEQ_NUM and UPDATE_NUM (SQL-087).
  11. On a rows-affected value other than 1: add the DB contention error; otherwise MarkNew().

Process flow

flowchart TD
    Start([Caller edits note]) --> TypeCheck{Note type entered?}
    TypeCheck -->|No| Fail([Missing type<br>or text blocks save])
    TypeCheck -->|Yes| TextCheck{Note text entered?}
    TextCheck -->|No| Fail
    TextCheck -->|Yes| Persist[Insert/update/delete CBP_NOTE]
    Persist --> Rows{RowsAffected = 1?}
    Rows -->|No| Contention([Insert Failed / DB contention error])
    Rows -->|Yes| Done([Save complete])

Failure and edge-case behavior

  • Create() does not copy the provider location seq num from the criteria onto the note object, so callers creating a location-scoped note must set that field explicitly before save or the association will be lost.*
  • IsContactNote is entirely derived from the joined CBP_NOTE_TYPE_CODE.PROVIDER_CONTACT_NOTE_FLAG, not stored on the note row itself.
  • Delete, unlike clsProviderLocation's delete path, does enforce UPDATE_NUM concurrency.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

  • Business\SAIF.Business.Provider\clsNote.vb