Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: TIUPXPM

TIUPXPM.m

Go to the documentation of this file.
  1. TIUPXPM ;SLC OIFO/DKK,GSS - ADDITIONAL PERFORMANCE MONITORS ; 07/01/03
  1. ;;1.0;TEXT INTEGRATION UTILITIES;**168**Jun 20, 1997
  1. ;External reference to File ^AUPNVPRV supported by DBIA 1541
  1. ;External reference to File ^AUPNVSIT supported by DBIA 1625 & DBIA 3580
  1. ;-----------------------------------
  1. ;Determines if note has been appropriately signed in a timely manner.
  1. ;Originally written as an API for use by PIMS
  1. ;
  1. ;Note
  1. ;Category Type
  1. ; A No note for the Visit IEN
  1. ; B Acceptable Note ('signed')
  1. ; C Unacceptable Note ('unsigned')
  1. ; D Scanned Image
  1. ; E Purged, Deleted, or Retracted Note
  1. ;
  1. ;TIU Note Status Possible
  1. ;Code Description Category
  1. ;none No corresponding Progress Note for VIEN A
  1. ; 1 Undictated C or D
  1. ; 2 Untranscribed C
  1. ; 3 Unreleased -
  1. ; 4 Unverified C or D
  1. ; 5 Unsigned C
  1. ; 6 Uncosigned C
  1. ; 7 Completed B or C
  1. ; 8 Amended B or C
  1. ; 9 Purged E
  1. ;11 Active C
  1. ;13 Inactive C or D
  1. ;14 Deleted E
  1. ;15 Retracted E
  1. ;variable Scanned Image D
  1. ;
  1. ;Primary variables Used:
  1. ;ARY() = Array of all visit providers returned by GETPRV^PXAPIOE
  1. ;CSTATC = ","_Document status_","
  1. ;DOCTYP() = Array of all note types based on Progress Note Class
  1. ;SIG = Pointer to File #200 of signer^FM Date.Time of signing
  1. ;SIGA = Pointer to F#200 of Amended note signer^FM Date.Time
  1. ;SIGC = Pointer to F#200 of note Co-Signer^FM Date.Time
  1. ;STAT = Document status
  1. ;TIUIEN = TIU Note IEN
  1. ;VIEN = Visit IEN
  1. ;VPRV() = Array
  1. ;X,Y,Z = Scratch variables
  1. ;
  1. ;Returns:
  1. ;String with 6 fields ('^' delimiter)
  1. ; 1 VIEN
  1. ; 2 Note Category (A-E)
  1. ; 3 Signed By (pointer to File #200)
  1. ; 4 Signed Date.Time (FM format)
  1. ; 5 Co-signed By (pointer to File #200) - defined only if necessary
  1. ; 6 Co-signed Date.Time - defined only if necessary
  1. ;-------------------------
  1. ;
  1. PM(VIEN) ; external access point
  1. ; quit and return null if visit IEN is null
  1. I $G(VIEN)="" Q ""
  1. N ARY,CSTATC,DATE,PC,SIG,SIGA,SIGC,STAT,TIUIEN,VPRV
  1. S (TIUIEN,X,Z)=""
  1. ; get providers (returned in ARY array) who saw the patient
  1. D GETPRV^PXAPIOE(VIEN,"ARY") ; DBIA 1541
  1. ; create VPRV array of valid providers
  1. D PROV
  1. ; initalize return string
  1. S Y=""
  1. ; looking for notes re: visit/encounter, get each document in turn
  1. F S TIUIEN=$O(^TIU(8925,"V",VIEN,TIUIEN)) Q:TIUIEN="" D Q:$E(Y)="B"
  1. . ; get status of note, signers, and dates
  1. . D STAT
  1. . ;
  1. . ; Category B: Co-signed note by Primary Provider
  1. . I $D(SIGC),$G(VPRV(+SIGC))="P" D Q:$E(Y)="B"
  1. .. Q:'$D(^TIU(8925,TIUIEN,"TEXT"))
  1. .. I STAT=7 S Y="B"_U_SIG_U_SIGC Q
  1. .. I STAT=8 S Y="B"_U_SIGA_U_SIGC
  1. . ;
  1. . ; Cateogory B: Primary Provider signed & completed note
  1. . I $D(SIG),$G(VPRV(+SIG))="P" D Q:$E(Y)="B"
  1. .. I STAT=7,$D(^TIU(8925,TIUIEN,"TEXT")) S Y="B"_U_SIG_U_U
  1. . ;
  1. . ; Category B: Primary Provider Amended note
  1. . I $D(SIGA),$G(VPRV(+SIGA))="P" D Q:$E(Y)="B"
  1. .. I STAT=8,$D(^TIU(8925,TIUIEN,"TEXT")) S Y="B"_U_SIGA_U_U
  1. . ;
  1. . ; Category B: Signer a Secondary Provider but in VPRV & note complete
  1. . I STAT=7,$D(SIG),$G(VPRV(+SIG))="S" S Y="B"_U_SIG_U_U Q
  1. . ;
  1. . ; Category D: Scanned Image
  1. . I $D(^TIU(8925.91,"B",TIUIEN)) S Y="D"_U_U_U_U Q
  1. . ;
  1. . ; Category C: Unsigned note
  1. . I ",1,2,4,5,6,7,8,11,13,"[CSTATC,Y="" S Y="C"_U_U_U_U Q
  1. . ;
  1. . ; Category E: Purged, deleted, or retracted
  1. . I ",9,14,15,"[CSTATC,Y="" S Y="E"_U_U_U_U Q
  1. ;
  1. ; Category A: no note found for this visit
  1. S:Y="" Y="A"_U_U_U_U
  1. ; return Y string w/ first piece being VIEN
  1. S Y=VIEN_U_Y
  1. Q Y
  1. ;
  1. STAT ; get status of note and signer
  1. K SIG,SIGA,SIGC
  1. S STAT=$P($G(^TIU(8925,TIUIEN,0)),U,5),CSTATC=","_STAT_","
  1. ; document amended (STAT=8)
  1. I STAT=8 S X=$G(^TIU(8925,TIUIEN,16)) D
  1. . ; amended by ($P(X,U,2))
  1. . I $P(X,U,2) S SIGA=$P(X,U,2)_U_$P(X,U)
  1. S X=$G(^TIU(8925,TIUIEN,15))
  1. ; co-signature needed ($P(X,U,6)) 1=Yes, 0=No
  1. ; per J.Hawsey co-sig field is not reliably set, thus not used
  1. ; co-signer ($P(X,U,8))
  1. I $P(X,U,8) S SIGC=$P(X,U,8)_U_$P(X,U,7)
  1. ; signer of document ($P(X,U,2))
  1. I $P(X,U,2) S SIG=$P(X,U,2)_U_$P(X,U)
  1. Q
  1. ;
  1. PROV ; validate providers by $O through provider array (ARY) and
  1. ; creating VPRV array, where VPRV(VPRV)=Primary/Secondary^PersonClass
  1. S X=""
  1. F S X=$O(ARY(X)) Q:X="" D
  1. . ; Z=VPRV^PTIEN^VIEN^Prim/Secondary^Op/Attend^Ptr2PersonClass
  1. . S Z=ARY(X),VPRV=$P(Z,U)
  1. . ; Get Person Class information at the time of the visit
  1. . S PC=$P($$GET^XUA4A72(VPRV,+$G(^AUPNVSIT(VIEN,0))),U,7) ; DBIA 1625 & 3580
  1. . S VPRV(VPRV)=$P(Z,U,4)
  1. . ; quit if provider is Primary (that is, accept provider)
  1. . Q:$P(VPRV(VPRV),U)="P"
  1. . ; PA/NP's are V100000 through V100618, inclusive
  1. . ; Physician (MD/DO) Resident, Allopathic is V115500
  1. . ; Physician (MD/DO) Resident, Osteopathic is V115600
  1. . ; if PC is any of the above, then accept provider, otherwise - don't
  1. . ; note: already accepted Primary provider above
  1. . I (PC]"V100618"!(PC']"V099999")),(PC'="V115500"),(PC'="V115600") S VPRV(VPRV)="X"
  1. Q