SDPMUT1 ; BPFO/JRC - Performance Monitors Utilities; 6-19-2003 ; 12/22/03 11:32am [6/21/04 3:26pm]
;;5.3;SCHEDULING;**292,335,371,1015**;AUGUST 13, 1993;Build 21
;
GETDATA(SCRNARR,SORTARR,OUTARR) ;Get progress note compliance information
;Input : SCRNARR - Screening array full global reference
; SORTARR - Sort array full global reference
; OUTARR - Output array full global reference
;Output : None
; @OUTARR@("SUMMARY") = Enc^Comply^ ^Prov^Stop^ET^Scan^Signed
; Enc - Number of encounters checked for compliance
; Comply - Compliant encounters (note signed w/in time limit)
; Prov - Unique primary encounter providers
; Stop - Unique primary stop codes
; ET - Total elapsed time (days) to sign PN
; Scan - Encounters with scanned notes
; Signed - Encounters with signed notes
; @OUTARR@("SUBTOTAL",SUB1) = SUMMARY node for sort level 1
; @OUTARR@("SUMMARY","PI") = F0^F1^F2^F3^F4^F5^F6^F7^F8^F9^F10^F11
; Fx - Notes signed in x to X+1 days
; F11 - Notes signed in 10 or more days
; @OUTARR@("SUBTOTAL",SUB1,"PI") = PI node for sort level 1
; @OUTARR@("DETAIL",SUB1,SUB2,DFN,PtrEnc) = Prov^DT^ET
; Prov - TIU Provider
; DT - Date Provider signed progress note
; ET - Number of days that elpased before signing PN
;Note : OUTARR is initialized (i.e. KILLed) on input
; : When division is used as a sorting subscript,
; DivisionName^DivisionNumber is used as the subscript
; : Time is stripped from the encounter date when used as a
; sorting subscript
;
;Declare variables
N PTRENC,DATE,ENDDATE,UNQARR,STOP,LOOP
;Get begin and end dates for scan
S DATE=$G(@SCRNARR@("RANGE"))
S ENDDATE=$P(DATE,U,2)
S DATE=$P(DATE,U,1)
Q:('DATE)!('ENDDATE)
S DATE=$P(DATE,".",1)-.000001
S $P(ENDDATE,".",2)=999999
;Initialize output and array used to track uniques
S UNQARR=$NA(^TMP("SDPMUT1-UNIQUE",$J))
K @UNQARR,@OUTARR
;Scan
S STOP=0
F LOOP=1:1 S DATE=+$O(^SCE("B",DATE)) Q:('DATE)!(DATE>ENDDATE) D Q:STOP
.S PTRENC=0
.F S PTRENC=+$O(^SCE("B",DATE,PTRENC)) Q:'PTRENC D Q:STOP
..;Task asked to stop
..I '(LOOP#100) S STOP=$$S^%ZTLOAD() Q:STOP
..;Screen out encounter
..Q:$$SCREEN^SDPMUT2(PTRENC,SCRNARR)
..;Set output array
..D GET
;Cleanup and quit
K @UNQARR
Q
GET ;Get info & establish output array for GETDATA
;Input : PTRENC - Pointer to Outpatient Encounter file
; UNQARR - Array to use for unique calculations
; Input parameters for GETDATA (SCRNARR, SORTARR, and OUTARR)
;Ouput : See GETDATA for format of nodes set into OUTARR
; Unique Stop Codes
; @UNQARR@("SUMMARY","STOP",SUB1,PtrStopCode)
; @UNQARR@("SUBTOTAL","STOP",SUB1,PtrStopCode)
; Unique Primary Encounter Providers
; @UNQARR@("SUMMARY","PROV",SUB1,PtrProvider)
; @UNQARR@("SUBTOTAL","PROV",SUB1,PtrProvider)
;Declare variables
N DFN,DIV,CLINIC,NODE,NOTEINFO,PROV,ENCDT,SUB1,SUB2,TIUPROV
N TIUDT,TIUET,SUMNODE,SUBNODE,ESUB1,ESUB2,SCODE,X
S NODE=^SCE(PTRENC,0)
S DFN=+$P(NODE,U,2),DIV=+$P(NODE,U,11),CLINIC=+$P(NODE,U,4)
S SCODE=+$P(NODE,U,3),ENCDT=+NODE
;Get primary encounter provider
S PROV=$$ENCPROV^SDPMUT2(PTRENC)
;Set sorting subscripts (ESUB1 & ESUB2)
; If SUBx = 1 Set sorting criteria to division
; If SUBx = 2 Set soring criteria to clinic
; If SUBx = 3 Set sorting criteria to Provider
; If SUBx = 4 Set sorting criteria to Stop Code
; If SUBx = 5 Set sorting criteria to Encounter Date
; If SUBx = 6 Set sorting criteria to Patient
S NODE=@SORTARR
S SUB1=$P(NODE,"^",1)
S SUB2=$P(NODE,"^",2)
F NODE="SUB1","SUB2" D I @("E"_NODE)="" S @("E"_NODE)="UNKNOWN"
.I @NODE=1 D Q
..S X=$G(^DG(40.8,DIV,0))
..S @("E"_NODE)=$P(X,U,1)_"^"_$P(X,U,2)
.I @NODE=2 D Q
..S @("E"_NODE)=$P($G(^SC(CLINIC,0)),U,1)
.I @NODE=3 D Q
..S @("E"_NODE)=$P($G(^VA(200,PROV,0)),U,1)
.I @NODE=4 D Q
..S @("E"_NODE)=$P($G(^DIC(40.7,SCODE,0)),U,1)
.I @NODE=5 D Q
..S @("E"_NODE)=$P(ENCDT,".",1)
.I @NODE=6 D Q
..S @("E"_NODE)=$P($G(^DPT(DFN,0)),U,1)
.S @("E"_NODE)="UNKNOWN"
;Increment Encounters for hospital and sort level 1
S $P(@OUTARR@("SUMMARY"),U,1)=$P($G(@OUTARR@("SUMMARY")),U,1)+1
S $P(@OUTARR@("SUBTOTAL",ESUB1),U,1)=$P($G(@OUTARR@("SUBTOTAL",ESUB1)),U,1)+1
;Get TIU information
S NOTEINFO=$$NOTEINF^SDPMUT2(PTRENC)
S (TIUPROV,TIUDT,TIUET)=""
;Only update performance indicators for note status of B
I $P((NOTEINFO),U,2)="B" D
.S TIUPROV=$P((NOTEINFO),U,5)
.S TIUDT=$P((NOTEINFO),U,6)
.I 'TIUPROV D
..S TIUPROV=$P((NOTEINFO),U,3)
..S TIUDT=$P((NOTEINFO),U,4)
.S TIUET=$$FMDIFF^XLFDT(TIUDT,ENCDT)
.I TIUET<0 Q
.;Increment Compliant Notes for hospital and sort level 1
.I TIUET'>@SCRNARR@("TLMT") D
..S $P(@OUTARR@("SUMMARY"),U,2)=$P($G(@OUTARR@("SUMMARY")),U,2)+1
..S $P(@OUTARR@("SUBTOTAL",ESUB1),U,2)=$P($G(@OUTARR@("SUBTOTAL",ESUB1)),U,2)+1
.;Increment Total Elapsed Time for hospital and sort level 1
.S $P(@OUTARR@("SUMMARY"),U,6)=$P($G(@OUTARR@("SUMMARY")),U,6)+TIUET
.S $P(@OUTARR@("SUBTOTAL",ESUB1),U,6)=$P($G(@OUTARR@("SUBTOTAL",ESUB1)),U,6)+TIUET
.;Increment Total Signed Notes for hospital and sort level 1
.S $P(@OUTARR@("SUMMARY"),U,8)=$P($G(@OUTARR@("SUMMARY")),U,8)+1
.S $P(@OUTARR@("SUBTOTAL",ESUB1),U,8)=$P($G(@OUTARR@("SUBTOTAL",ESUB1)),U,8)+1
.;Update performance indicator node for hospital and sort level 1
.S SUMNODE=$G(@OUTARR@("SUMMARY","PI"))
.S SUBNODE=$G(@OUTARR@("SUBTOTAL",ESUB1,"PI"))
.I TIUET'<0&(TIUET'>1) D
..S $P(SUMNODE,U,1)=$P($G(SUMNODE),U,1)+1
..S $P(SUBNODE,U,1)=$P($G(SUBNODE),U,1)+1
.I TIUET>1&(TIUET'>2) D
..S $P(SUMNODE,U,2)=$P($G(SUMNODE),U,2)+1
..S $P(SUBNODE,U,2)=$P($G(SUBNODE),U,2)+1
.I TIUET>2&(TIUET'>3) D
..S $P(SUMNODE,U,3)=$P($G(SUMNODE),U,3)+1
..S $P(SUBNODE,U,3)=$P($G(SUBNODE),U,3)+1
.I TIUET>3&(TIUET'>4) D
..S $P(SUMNODE,U,4)=$P($G(SUMNODE),U,4)+1
..S $P(SUBNODE,U,4)=$P($G(SUBNODE),U,4)+1
.I TIUET>4&(TIUET'>5) D
..S $P(SUMNODE,U,5)=$P($G(SUMNODE),U,5)+1
..S $P(SUBNODE,U,5)=$P($G(SUBNODE),U,5)+1
.I TIUET>5&(TIUET'>6) D
..S $P(SUMNODE,U,6)=$P($G(SUMNODE),U,6)+1
..S $P(SUBNODE,U,6)=$P($G(SUBNODE),U,6)+1
.I TIUET>6&(TIUET'>7) D
..S $P(SUMNODE,U,7)=$P($G(SUMNODE),U,7)+1
..S $P(SUBNODE,U,7)=$P($G(SUBNODE),U,7)+1
.I TIUET>7&(TIUET'>8) D
..S $P(SUMNODE,U,8)=$P($G(SUMNODE),U,8)+1
..S $P(SUBNODE,U,8)=$P($G(SUBNODE),U,8)+1
.I TIUET>8&(TIUET'>9) D
..S $P(SUMNODE,U,9)=$P($G(SUMNODE),U,9)+1
..S $P(SUBNODE,U,9)=$P($G(SUBNODE),U,9)+1
.I TIUET>9&(TIUET'>10) D
..S $P(SUMNODE,U,10)=$P($G(SUMNODE),U,10)+1
..S $P(SUBNODE,U,10)=$P($G(SUBNODE),U,10)+1
.I TIUET>10 D
..S $P(SUMNODE,U,11)=$P($G(SUMNODE),U,11)+1
..S $P(SUBNODE,U,11)=$P($G(SUBNODE),U,11)+1
.S @OUTARR@("SUMMARY","PI")=SUMNODE
.S @OUTARR@("SUBTOTAL",ESUB1,"PI")=SUBNODE
.Q
;Increment Scanned Notes for hospital and sort level 1 (if required)
I @SCRNARR@("SCANNED")&($P(NOTEINFO,U,2)["D") D
.S $P(@OUTARR@("SUMMARY"),U,7)=$P($G(@OUTARR@("SUMMARY")),U,7)+1
.S $P(@OUTARR@("SUBTOTAL",ESUB1),U,7)=$P($G(@OUTARR@("SUBTOTAL",ESUB1)),U,7)+1
.Q
;Only update performance indicators for note status of A
I $P((NOTEINFO),U,2)="A" D
.S $P(@OUTARR@("SUMMARY"),U,9)=$P($G(@OUTARR@("SUMMARY")),U,9)+1
.S $P(@OUTARR@("SUBTOTAL",ESUB1),U,9)=$P($G(@OUTARR@("SUBTOTAL",ESUB1)),U,9)+1
.Q
;Increment unique Stop Codes for hospital and sort level 1
I SCODE D
.I '($D(@UNQARR@("SUMMARY","STOP",ESUB1,SCODE))#2) D
..S $P(@OUTARR@("SUMMARY"),U,5)=$P($G(@OUTARR@("SUMMARY")),U,5)+1
..S @UNQARR@("SUMMARY","STOP",ESUB1,SCODE)=""
..Q
.I '($D(@UNQARR@("SUBTOTAL","STOP",ESUB1,SCODE))#2) D
..S $P(@OUTARR@("SUBTOTAL",ESUB1),U,5)=$P($G(@OUTARR@("SUBTOTAL",ESUB1)),U,5)+1
..S @UNQARR@("SUBTOTAL","STOP",ESUB1,SCODE)=""
..Q
.Q
;Increment unique Providers for hospital and sort level 1
I PROV D
.I '($D(@UNQARR@("SUMMARY","PROV",ESUB1,PROV))#2) D
..S $P(@OUTARR@("SUMMARY"),U,4)=$P($G(@OUTARR@("SUMMARY")),U,4)+1
..S @UNQARR@("SUMMARY","PROV",ESUB1,PROV)=""
..Q
.I '($D(@UNQARR@("SUBTOTAL","PROV",ESUB1,PROV))#2) D
..S $P(@OUTARR@("SUBTOTAL",ESUB1),U,4)=$P($G(@OUTARR@("SUBTOTAL",ESUB1)),U,4)+1
..S @UNQARR@("SUBTOTAL","PROV",ESUB1,PROV)=""
..Q
.Q
;Set detailed node
S @OUTARR@("DETAIL",ESUB1,ESUB2,DFN,PTRENC)=TIUPROV_"^"_TIUDT_"^"_TIUET
Q
SDPMUT1 ; BPFO/JRC - Performance Monitors Utilities; 6-19-2003 ; 12/22/03 11:32am [6/21/04 3:26pm]
+1 ;;5.3;SCHEDULING;**292,335,371,1015**;AUGUST 13, 1993;Build 21
+2 ;
GETDATA(SCRNARR,SORTARR,OUTARR) ;Get progress note compliance information
+1 ;Input : SCRNARR - Screening array full global reference
+2 ; SORTARR - Sort array full global reference
+3 ; OUTARR - Output array full global reference
+4 ;Output : None
+5 ; @OUTARR@("SUMMARY") = Enc^Comply^ ^Prov^Stop^ET^Scan^Signed
+6 ; Enc - Number of encounters checked for compliance
+7 ; Comply - Compliant encounters (note signed w/in time limit)
+8 ; Prov - Unique primary encounter providers
+9 ; Stop - Unique primary stop codes
+10 ; ET - Total elapsed time (days) to sign PN
+11 ; Scan - Encounters with scanned notes
+12 ; Signed - Encounters with signed notes
+13 ; @OUTARR@("SUBTOTAL",SUB1) = SUMMARY node for sort level 1
+14 ; @OUTARR@("SUMMARY","PI") = F0^F1^F2^F3^F4^F5^F6^F7^F8^F9^F10^F11
+15 ; Fx - Notes signed in x to X+1 days
+16 ; F11 - Notes signed in 10 or more days
+17 ; @OUTARR@("SUBTOTAL",SUB1,"PI") = PI node for sort level 1
+18 ; @OUTARR@("DETAIL",SUB1,SUB2,DFN,PtrEnc) = Prov^DT^ET
+19 ; Prov - TIU Provider
+20 ; DT - Date Provider signed progress note
+21 ; ET - Number of days that elpased before signing PN
+22 ;Note : OUTARR is initialized (i.e. KILLed) on input
+23 ; : When division is used as a sorting subscript,
+24 ; DivisionName^DivisionNumber is used as the subscript
+25 ; : Time is stripped from the encounter date when used as a
+26 ; sorting subscript
+27 ;
+28 ;Declare variables
+29 NEW PTRENC,DATE,ENDDATE,UNQARR,STOP,LOOP
+30 ;Get begin and end dates for scan
+31 SET DATE=$GET(@SCRNARR@("RANGE"))
+32 SET ENDDATE=$PIECE(DATE,U,2)
+33 SET DATE=$PIECE(DATE,U,1)
+34 IF ('DATE)!('ENDDATE)
QUIT
+35 SET DATE=$PIECE(DATE,".",1)-.000001
+36 SET $PIECE(ENDDATE,".",2)=999999
+37 ;Initialize output and array used to track uniques
+38 SET UNQARR=$NAME(^TMP("SDPMUT1-UNIQUE",$JOB))
+39 KILL @UNQARR,@OUTARR
+40 ;Scan
+41 SET STOP=0
+42 FOR LOOP=1:1
SET DATE=+$ORDER(^SCE("B",DATE))
IF ('DATE)!(DATE>ENDDATE)
QUIT
Begin DoDot:1
+43 SET PTRENC=0
+44 FOR
SET PTRENC=+$ORDER(^SCE("B",DATE,PTRENC))
IF 'PTRENC
QUIT
Begin DoDot:2
+45 ;Task asked to stop
+46 IF '(LOOP#100)
SET STOP=$$S^%ZTLOAD()
IF STOP
QUIT
+47 ;Screen out encounter
+48 IF $$SCREEN^SDPMUT2(PTRENC,SCRNARR)
QUIT
+49 ;Set output array
+50 DO GET
End DoDot:2
IF STOP
QUIT
End DoDot:1
IF STOP
QUIT
+51 ;Cleanup and quit
+52 KILL @UNQARR
+53 QUIT
GET ;Get info & establish output array for GETDATA
+1 ;Input : PTRENC - Pointer to Outpatient Encounter file
+2 ; UNQARR - Array to use for unique calculations
+3 ; Input parameters for GETDATA (SCRNARR, SORTARR, and OUTARR)
+4 ;Ouput : See GETDATA for format of nodes set into OUTARR
+5 ; Unique Stop Codes
+6 ; @UNQARR@("SUMMARY","STOP",SUB1,PtrStopCode)
+7 ; @UNQARR@("SUBTOTAL","STOP",SUB1,PtrStopCode)
+8 ; Unique Primary Encounter Providers
+9 ; @UNQARR@("SUMMARY","PROV",SUB1,PtrProvider)
+10 ; @UNQARR@("SUBTOTAL","PROV",SUB1,PtrProvider)
+11 ;Declare variables
+12 NEW DFN,DIV,CLINIC,NODE,NOTEINFO,PROV,ENCDT,SUB1,SUB2,TIUPROV
+13 NEW TIUDT,TIUET,SUMNODE,SUBNODE,ESUB1,ESUB2,SCODE,X
+14 SET NODE=^SCE(PTRENC,0)
+15 SET DFN=+$PIECE(NODE,U,2)
SET DIV=+$PIECE(NODE,U,11)
SET CLINIC=+$PIECE(NODE,U,4)
+16 SET SCODE=+$PIECE(NODE,U,3)
SET ENCDT=+NODE
+17 ;Get primary encounter provider
+18 SET PROV=$$ENCPROV^SDPMUT2(PTRENC)
+19 ;Set sorting subscripts (ESUB1 & ESUB2)
+20 ; If SUBx = 1 Set sorting criteria to division
+21 ; If SUBx = 2 Set soring criteria to clinic
+22 ; If SUBx = 3 Set sorting criteria to Provider
+23 ; If SUBx = 4 Set sorting criteria to Stop Code
+24 ; If SUBx = 5 Set sorting criteria to Encounter Date
+25 ; If SUBx = 6 Set sorting criteria to Patient
+26 SET NODE=@SORTARR
+27 SET SUB1=$PIECE(NODE,"^",1)
+28 SET SUB2=$PIECE(NODE,"^",2)
+29 FOR NODE="SUB1","SUB2"
Begin DoDot:1
+30 IF @NODE=1
Begin DoDot:2
+31 SET X=$GET(^DG(40.8,DIV,0))
+32 SET @("E"_NODE)=$PIECE(X,U,1)_"^"_$PIECE(X,U,2)
End DoDot:2
QUIT
+33 IF @NODE=2
Begin DoDot:2
+34 SET @("E"_NODE)=$PIECE($GET(^SC(CLINIC,0)),U,1)
End DoDot:2
QUIT
+35 IF @NODE=3
Begin DoDot:2
+36 SET @("E"_NODE)=$PIECE($GET(^VA(200,PROV,0)),U,1)
End DoDot:2
QUIT
+37 IF @NODE=4
Begin DoDot:2
+38 SET @("E"_NODE)=$PIECE($GET(^DIC(40.7,SCODE,0)),U,1)
End DoDot:2
QUIT
+39 IF @NODE=5
Begin DoDot:2
+40 SET @("E"_NODE)=$PIECE(ENCDT,".",1)
End DoDot:2
QUIT
+41 IF @NODE=6
Begin DoDot:2
+42 SET @("E"_NODE)=$PIECE($GET(^DPT(DFN,0)),U,1)
End DoDot:2
QUIT
+43 SET @("E"_NODE)="UNKNOWN"
End DoDot:1
IF @("E"_NODE)=""
SET @("E"_NODE)="UNKNOWN"
+44 ;Increment Encounters for hospital and sort level 1
+45 SET $PIECE(@OUTARR@("SUMMARY"),U,1)=$PIECE($GET(@OUTARR@("SUMMARY")),U,1)+1
+46 SET $PIECE(@OUTARR@("SUBTOTAL",ESUB1),U,1)=$PIECE($GET(@OUTARR@("SUBTOTAL",ESUB1)),U,1)+1
+47 ;Get TIU information
+48 SET NOTEINFO=$$NOTEINF^SDPMUT2(PTRENC)
+49 SET (TIUPROV,TIUDT,TIUET)=""
+50 ;Only update performance indicators for note status of B
+51 IF $PIECE((NOTEINFO),U,2)="B"
Begin DoDot:1
+52 SET TIUPROV=$PIECE((NOTEINFO),U,5)
+53 SET TIUDT=$PIECE((NOTEINFO),U,6)
+54 IF 'TIUPROV
Begin DoDot:2
+55 SET TIUPROV=$PIECE((NOTEINFO),U,3)
+56 SET TIUDT=$PIECE((NOTEINFO),U,4)
End DoDot:2
+57 SET TIUET=$$FMDIFF^XLFDT(TIUDT,ENCDT)
+58 IF TIUET<0
QUIT
+59 ;Increment Compliant Notes for hospital and sort level 1
+60 IF TIUET'>@SCRNARR@("TLMT")
Begin DoDot:2
+61 SET $PIECE(@OUTARR@("SUMMARY"),U,2)=$PIECE($GET(@OUTARR@("SUMMARY")),U,2)+1
+62 SET $PIECE(@OUTARR@("SUBTOTAL",ESUB1),U,2)=$PIECE($GET(@OUTARR@("SUBTOTAL",ESUB1)),U,2)+1
End DoDot:2
+63 ;Increment Total Elapsed Time for hospital and sort level 1
+64 SET $PIECE(@OUTARR@("SUMMARY"),U,6)=$PIECE($GET(@OUTARR@("SUMMARY")),U,6)+TIUET
+65 SET $PIECE(@OUTARR@("SUBTOTAL",ESUB1),U,6)=$PIECE($GET(@OUTARR@("SUBTOTAL",ESUB1)),U,6)+TIUET
+66 ;Increment Total Signed Notes for hospital and sort level 1
+67 SET $PIECE(@OUTARR@("SUMMARY"),U,8)=$PIECE($GET(@OUTARR@("SUMMARY")),U,8)+1
+68 SET $PIECE(@OUTARR@("SUBTOTAL",ESUB1),U,8)=$PIECE($GET(@OUTARR@("SUBTOTAL",ESUB1)),U,8)+1
+69 ;Update performance indicator node for hospital and sort level 1
+70 SET SUMNODE=$GET(@OUTARR@("SUMMARY","PI"))
+71 SET SUBNODE=$GET(@OUTARR@("SUBTOTAL",ESUB1,"PI"))
+72 IF TIUET'<0&(TIUET'>1)
Begin DoDot:2
+73 SET $PIECE(SUMNODE,U,1)=$PIECE($GET(SUMNODE),U,1)+1
+74 SET $PIECE(SUBNODE,U,1)=$PIECE($GET(SUBNODE),U,1)+1
End DoDot:2
+75 IF TIUET>1&(TIUET'>2)
Begin DoDot:2
+76 SET $PIECE(SUMNODE,U,2)=$PIECE($GET(SUMNODE),U,2)+1
+77 SET $PIECE(SUBNODE,U,2)=$PIECE($GET(SUBNODE),U,2)+1
End DoDot:2
+78 IF TIUET>2&(TIUET'>3)
Begin DoDot:2
+79 SET $PIECE(SUMNODE,U,3)=$PIECE($GET(SUMNODE),U,3)+1
+80 SET $PIECE(SUBNODE,U,3)=$PIECE($GET(SUBNODE),U,3)+1
End DoDot:2
+81 IF TIUET>3&(TIUET'>4)
Begin DoDot:2
+82 SET $PIECE(SUMNODE,U,4)=$PIECE($GET(SUMNODE),U,4)+1
+83 SET $PIECE(SUBNODE,U,4)=$PIECE($GET(SUBNODE),U,4)+1
End DoDot:2
+84 IF TIUET>4&(TIUET'>5)
Begin DoDot:2
+85 SET $PIECE(SUMNODE,U,5)=$PIECE($GET(SUMNODE),U,5)+1
+86 SET $PIECE(SUBNODE,U,5)=$PIECE($GET(SUBNODE),U,5)+1
End DoDot:2
+87 IF TIUET>5&(TIUET'>6)
Begin DoDot:2
+88 SET $PIECE(SUMNODE,U,6)=$PIECE($GET(SUMNODE),U,6)+1
+89 SET $PIECE(SUBNODE,U,6)=$PIECE($GET(SUBNODE),U,6)+1
End DoDot:2
+90 IF TIUET>6&(TIUET'>7)
Begin DoDot:2
+91 SET $PIECE(SUMNODE,U,7)=$PIECE($GET(SUMNODE),U,7)+1
+92 SET $PIECE(SUBNODE,U,7)=$PIECE($GET(SUBNODE),U,7)+1
End DoDot:2
+93 IF TIUET>7&(TIUET'>8)
Begin DoDot:2
+94 SET $PIECE(SUMNODE,U,8)=$PIECE($GET(SUMNODE),U,8)+1
+95 SET $PIECE(SUBNODE,U,8)=$PIECE($GET(SUBNODE),U,8)+1
End DoDot:2
+96 IF TIUET>8&(TIUET'>9)
Begin DoDot:2
+97 SET $PIECE(SUMNODE,U,9)=$PIECE($GET(SUMNODE),U,9)+1
+98 SET $PIECE(SUBNODE,U,9)=$PIECE($GET(SUBNODE),U,9)+1
End DoDot:2
+99 IF TIUET>9&(TIUET'>10)
Begin DoDot:2
+100 SET $PIECE(SUMNODE,U,10)=$PIECE($GET(SUMNODE),U,10)+1
+101 SET $PIECE(SUBNODE,U,10)=$PIECE($GET(SUBNODE),U,10)+1
End DoDot:2
+102 IF TIUET>10
Begin DoDot:2
+103 SET $PIECE(SUMNODE,U,11)=$PIECE($GET(SUMNODE),U,11)+1
+104 SET $PIECE(SUBNODE,U,11)=$PIECE($GET(SUBNODE),U,11)+1
End DoDot:2
+105 SET @OUTARR@("SUMMARY","PI")=SUMNODE
+106 SET @OUTARR@("SUBTOTAL",ESUB1,"PI")=SUBNODE
+107 QUIT
End DoDot:1
+108 ;Increment Scanned Notes for hospital and sort level 1 (if required)
+109 IF @SCRNARR@("SCANNED")&($PIECE(NOTEINFO,U,2)["D")
Begin DoDot:1
+110 SET $PIECE(@OUTARR@("SUMMARY"),U,7)=$PIECE($GET(@OUTARR@("SUMMARY")),U,7)+1
+111 SET $PIECE(@OUTARR@("SUBTOTAL",ESUB1),U,7)=$PIECE($GET(@OUTARR@("SUBTOTAL",ESUB1)),U,7)+1
+112 QUIT
End DoDot:1
+113 ;Only update performance indicators for note status of A
+114 IF $PIECE((NOTEINFO),U,2)="A"
Begin DoDot:1
+115 SET $PIECE(@OUTARR@("SUMMARY"),U,9)=$PIECE($GET(@OUTARR@("SUMMARY")),U,9)+1
+116 SET $PIECE(@OUTARR@("SUBTOTAL",ESUB1),U,9)=$PIECE($GET(@OUTARR@("SUBTOTAL",ESUB1)),U,9)+1
+117 QUIT
End DoDot:1
+118 ;Increment unique Stop Codes for hospital and sort level 1
+119 IF SCODE
Begin DoDot:1
+120 IF '($DATA(@UNQARR@("SUMMARY","STOP",ESUB1,SCODE))#2)
Begin DoDot:2
+121 SET $PIECE(@OUTARR@("SUMMARY"),U,5)=$PIECE($GET(@OUTARR@("SUMMARY")),U,5)+1
+122 SET @UNQARR@("SUMMARY","STOP",ESUB1,SCODE)=""
+123 QUIT
End DoDot:2
+124 IF '($DATA(@UNQARR@("SUBTOTAL","STOP",ESUB1,SCODE))#2)
Begin DoDot:2
+125 SET $PIECE(@OUTARR@("SUBTOTAL",ESUB1),U,5)=$PIECE($GET(@OUTARR@("SUBTOTAL",ESUB1)),U,5)+1
+126 SET @UNQARR@("SUBTOTAL","STOP",ESUB1,SCODE)=""
+127 QUIT
End DoDot:2
+128 QUIT
End DoDot:1
+129 ;Increment unique Providers for hospital and sort level 1
+130 IF PROV
Begin DoDot:1
+131 IF '($DATA(@UNQARR@("SUMMARY","PROV",ESUB1,PROV))#2)
Begin DoDot:2
+132 SET $PIECE(@OUTARR@("SUMMARY"),U,4)=$PIECE($GET(@OUTARR@("SUMMARY")),U,4)+1
+133 SET @UNQARR@("SUMMARY","PROV",ESUB1,PROV)=""
+134 QUIT
End DoDot:2
+135 IF '($DATA(@UNQARR@("SUBTOTAL","PROV",ESUB1,PROV))#2)
Begin DoDot:2
+136 SET $PIECE(@OUTARR@("SUBTOTAL",ESUB1),U,4)=$PIECE($GET(@OUTARR@("SUBTOTAL",ESUB1)),U,4)+1
+137 SET @UNQARR@("SUBTOTAL","PROV",ESUB1,PROV)=""
+138 QUIT
End DoDot:2
+139 QUIT
End DoDot:1
+140 ;Set detailed node
+141 SET @OUTARR@("DETAIL",ESUB1,ESUB2,DFN,PTRENC)=TIUPROV_"^"_TIUDT_"^"_TIUET
+142 QUIT