source: FOIAVistA/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUPXPM.m@ 1314

Last change on this file since 1314 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.5 KB
Line 
1TIUPXPM ;SLC OIFO/DKK,GSS - ADDITIONAL PERFORMANCE MONITORS ; 07/01/03
2 ;;1.0;TEXT INTEGRATION UTILITIES;**168**Jun 20, 1997
3 ;External reference to File ^AUPNVPRV supported by DBIA 1541
4 ;External reference to File ^AUPNVSIT supported by DBIA 1625 & DBIA 3580
5 ;-----------------------------------
6 ;Determines if note has been appropriately signed in a timely manner.
7 ;Originally written as an API for use by PIMS
8 ;
9 ;Note
10 ;Category Type
11 ; A No note for the Visit IEN
12 ; B Acceptable Note ('signed')
13 ; C Unacceptable Note ('unsigned')
14 ; D Scanned Image
15 ; E Purged, Deleted, or Retracted Note
16 ;
17 ;TIU Note Status Possible
18 ;Code Description Category
19 ;none No corresponding Progress Note for VIEN A
20 ; 1 Undictated C or D
21 ; 2 Untranscribed C
22 ; 3 Unreleased -
23 ; 4 Unverified C or D
24 ; 5 Unsigned C
25 ; 6 Uncosigned C
26 ; 7 Completed B or C
27 ; 8 Amended B or C
28 ; 9 Purged E
29 ;11 Active C
30 ;13 Inactive C or D
31 ;14 Deleted E
32 ;15 Retracted E
33 ;variable Scanned Image D
34 ;
35 ;Primary variables Used:
36 ;ARY() = Array of all visit providers returned by GETPRV^PXAPIOE
37 ;CSTATC = ","_Document status_","
38 ;DOCTYP() = Array of all note types based on Progress Note Class
39 ;SIG = Pointer to File #200 of signer^FM Date.Time of signing
40 ;SIGA = Pointer to F#200 of Amended note signer^FM Date.Time
41 ;SIGC = Pointer to F#200 of note Co-Signer^FM Date.Time
42 ;STAT = Document status
43 ;TIUIEN = TIU Note IEN
44 ;VIEN = Visit IEN
45 ;VPRV() = Array
46 ;X,Y,Z = Scratch variables
47 ;
48 ;Returns:
49 ;String with 6 fields ('^' delimiter)
50 ; 1 VIEN
51 ; 2 Note Category (A-E)
52 ; 3 Signed By (pointer to File #200)
53 ; 4 Signed Date.Time (FM format)
54 ; 5 Co-signed By (pointer to File #200) - defined only if necessary
55 ; 6 Co-signed Date.Time - defined only if necessary
56 ;-------------------------
57 ;
58PM(VIEN) ; external access point
59 ; quit and return null if visit IEN is null
60 I $G(VIEN)="" Q ""
61 N ARY,CSTATC,DATE,PC,SIG,SIGA,SIGC,STAT,TIUIEN,VPRV
62 S (TIUIEN,X,Z)=""
63 ; get providers (returned in ARY array) who saw the patient
64 D GETPRV^PXAPIOE(VIEN,"ARY") ; DBIA 1541
65 ; create VPRV array of valid providers
66 D PROV
67 ; initalize return string
68 S Y=""
69 ; looking for notes re: visit/encounter, get each document in turn
70 F S TIUIEN=$O(^TIU(8925,"V",VIEN,TIUIEN)) Q:TIUIEN="" D Q:$E(Y)="B"
71 . ; get status of note, signers, and dates
72 . D STAT
73 . ;
74 . ; Category B: Co-signed note by Primary Provider
75 . I $D(SIGC),$G(VPRV(+SIGC))="P" D Q:$E(Y)="B"
76 .. Q:'$D(^TIU(8925,TIUIEN,"TEXT"))
77 .. I STAT=7 S Y="B"_U_SIG_U_SIGC Q
78 .. I STAT=8 S Y="B"_U_SIGA_U_SIGC
79 . ;
80 . ; Cateogory B: Primary Provider signed & completed note
81 . I $D(SIG),$G(VPRV(+SIG))="P" D Q:$E(Y)="B"
82 .. I STAT=7,$D(^TIU(8925,TIUIEN,"TEXT")) S Y="B"_U_SIG_U_U
83 . ;
84 . ; Category B: Primary Provider Amended note
85 . I $D(SIGA),$G(VPRV(+SIGA))="P" D Q:$E(Y)="B"
86 .. I STAT=8,$D(^TIU(8925,TIUIEN,"TEXT")) S Y="B"_U_SIGA_U_U
87 . ;
88 . ; Category B: Signer a Secondary Provider but in VPRV & note complete
89 . I STAT=7,$D(SIG),$G(VPRV(+SIG))="S" S Y="B"_U_SIG_U_U Q
90 . ;
91 . ; Category D: Scanned Image
92 . I $D(^TIU(8925.91,"B",TIUIEN)) S Y="D"_U_U_U_U Q
93 . ;
94 . ; Category C: Unsigned note
95 . I ",1,2,4,5,6,7,8,11,13,"[CSTATC,Y="" S Y="C"_U_U_U_U Q
96 . ;
97 . ; Category E: Purged, deleted, or retracted
98 . I ",9,14,15,"[CSTATC,Y="" S Y="E"_U_U_U_U Q
99 ;
100 ; Category A: no note found for this visit
101 S:Y="" Y="A"_U_U_U_U
102 ; return Y string w/ first piece being VIEN
103 S Y=VIEN_U_Y
104 Q Y
105 ;
106STAT ; get status of note and signer
107 K SIG,SIGA,SIGC
108 S STAT=$P($G(^TIU(8925,TIUIEN,0)),U,5),CSTATC=","_STAT_","
109 ; document amended (STAT=8)
110 I STAT=8 S X=$G(^TIU(8925,TIUIEN,16)) D
111 . ; amended by ($P(X,U,2))
112 . I $P(X,U,2) S SIGA=$P(X,U,2)_U_$P(X,U)
113 S X=$G(^TIU(8925,TIUIEN,15))
114 ; co-signature needed ($P(X,U,6)) 1=Yes, 0=No
115 ; per J.Hawsey co-sig field is not reliably set, thus not used
116 ; co-signer ($P(X,U,8))
117 I $P(X,U,8) S SIGC=$P(X,U,8)_U_$P(X,U,7)
118 ; signer of document ($P(X,U,2))
119 I $P(X,U,2) S SIG=$P(X,U,2)_U_$P(X,U)
120 Q
121 ;
122PROV ; validate providers by $O through provider array (ARY) and
123 ; creating VPRV array, where VPRV(VPRV)=Primary/Secondary^PersonClass
124 S X=""
125 F S X=$O(ARY(X)) Q:X="" D
126 . ; Z=VPRV^PTIEN^VIEN^Prim/Secondary^Op/Attend^Ptr2PersonClass
127 . S Z=ARY(X),VPRV=$P(Z,U)
128 . ; Get Person Class information at the time of the visit
129 . S PC=$P($$GET^XUA4A72(VPRV,+$G(^AUPNVSIT(VIEN,0))),U,7) ; DBIA 1625 & 3580
130 . S VPRV(VPRV)=$P(Z,U,4)
131 . ; quit if provider is Primary (that is, accept provider)
132 . Q:$P(VPRV(VPRV),U)="P"
133 . ; PA/NP's are V100000 through V100618, inclusive
134 . ; Physician (MD/DO) Resident, Allopathic is V115500
135 . ; Physician (MD/DO) Resident, Osteopathic is V115600
136 . ; if PC is any of the above, then accept provider, otherwise - don't
137 . ; note: already accepted Primary provider above
138 . I (PC]"V100618"!(PC']"V099999")),(PC'="V115500"),(PC'="V115600") S VPRV(VPRV)="X"
139 Q
Note: See TracBrowser for help on using the repository browser.