SDSCRPT1 ;ALB/JAM/RBS - ASCD Reports for Service Connected Automated Monitor ; 4/24/07 4:30pm
;;5.3;Scheduling;**495,1015**;Aug 13, 1993;Build 21
;;MODIFIED FOR NATIONAL RELEASE from a Class III software product
;;known as Service Connected Automated Monitoring (SCAM).
;
; Routine should be called at specified tags only.
Q
RDPOV ; 'ROUTINE' tag called by option "SDSC ENC REPORT - Service Connected Encounters Report"
N ZTDESC,SDRTN,SDOPT,DIR,DIRUT,X,Y
W !,"Service Connected Encounters Report"
S DIR(0)="SO^S:Service Connected;N:Non-Service Connected;A:All"
S DIR("B")="S",DIR("A")="Which option do you want to run?"
D ^DIR I $D(DIRUT) Q
S SDOPT=$S(Y="S":1,Y="N":0,1:2)
S ZTDESC="COMPARE DISABILITY/POV PER ENCOUNTER",SDRTN="PRINT^SDSCRPT1"
G LOAD
;
NSCCOP ; 'ROUTINE' tag called by option "SDSC FIRST PARTY REPORT - First Party Billable Service Connected Report"
N ZTDESC,SDRTN
S ZTDESC="SERVICE CONNECTED CO-PAY REPORT",SDRTN="COPPRT^SDSCRPT1"
G LOAD
;
NSCINS ; 'ROUTINE' tag called by option "SDSC THIRD PARTY REPORT - Third Party Billable Service Connected Report"
N ZTDESC,SDRTN
S ZTDESC="SERVICE CONNECTED BILLING INSURANCE REPORT",SDRTN="INSPRT^SDSCRPT1"
G LOAD
;
SCPRV ;Provider Service Connected Encounters Report
N SDDET,DIR,DIRUT,X,Y,ZTDESC,SDRTN
W !,"Provider Service Connected Encounters Report"
S DIR(0)="SO^D:Detail;S:Summary",DIR("B")="S"
S DIR("A")="Which option do you want to run?"
D ^DIR I $D(DIRUT) Q
S SDDET=$S(Y="D":1,1:0)
S ZTDESC="SERV CONN REVIEW REPORT BY PROVIDER",SDRTN="PRVPRT^SDSCRPT1"
G LOAD
;
SCUSR ;User Service Connected Encounters Report
N SDDET,DIR,DIRUT,X,Y,ZTDESC,SDRTN
W !,"User Service Connected Encounters Report"
S DIR(0)="SO^D:Detail;S:Summary",DIR("B")="S"
S DIR("A")="Which option do you want to run?"
D ^DIR I $D(DIRUT) Q
S SDDET=$S(Y="D":1,1:0)
S ZTDESC="SERV CONN REVIEW REPORT BY USER",SDRTN="RVWPRT^SDSCRPT1"
G LOAD
;
LOAD ; Standard start tag for all current reports.
; Initialize variables if necessary.
N ZTIO,ZTSAVE,ZTRTN,P,L,SDABRT
K %ZIS D HOME^%ZIS
; Select division
D DIV I SDQFL G END
; Get start and end date for report.
D GETDATE^SDSCOMP I SDSCTDT="" G END
; Initialize page counts
S (P,L,SDABRT)=0
; Prompt user for DEVICE and handle TaskMan queuing if required.
S %ZIS="QM" D ^%ZIS G END:POP
I '$D(IO("Q")) U IO K ZTDESC G LOOP
S ZTIO=ION,ZTSAVE("*")="",ZTRTN="LOOP^SDSCRPT1" D ^%ZTLOAD
G END
LOOP ; Loop through each division and display the selected report.
N CT,SDSCDIV,SDSCDNM,SDI,THDR
S CT=0,SDSCDIV=$S(SDSCDVSL'[SDSCDVLN:SDSCDVSL,1:"")
I SDSCDIV="" S SDSCDNM="ALL" D @SDRTN
I SDSCDIV'="" D
. S THDR=""
. F SDI=1:1:$L(SDSCDVSL,",") S SDSCDIV=$P(SDSCDVSL,",",SDI) Q:SDSCDIV="" D Q:$G(SDABRT)=1
.. S SDSCDNM=$P(^DG(40.8,SDSCDIV,0),"^",1),THDR=THDR_SDSCDNM_",",CT=CT+1 D @SDRTN
D RPTEND
G END
;
PRINT ; Display the encounters previously stored for this date.
; This is a detailed report, set flag
N SDDET,SDOEDT,SDOE,SCVAL
S SDDET=1
U IO D HEADER^SDSCRPT2 I $G(SDABRT)=1 Q
; Loop through all encounters found in that date range.
S SDOEDT=SDSCTDT F S SDOEDT=$O(^SDSC(409.48,"AE",SDOEDT)) Q:SDOEDT\1>SDEDT Q:SDOEDT="" D Q:$G(SDABRT)=1
. S SDOE=0 F S SDOE=$O(^SDSC(409.48,"AE",SDOEDT,SDOE)) Q:'SDOE D Q:$G(SDABRT)=1
.. I $G(SDSCDIV)'="" Q:$P(^SDSC(409.48,SDOE,0),U,12)'=SDSCDIV
.. ; Get data
.. I '$$STDGET Q
.. S SCVAL=$P(^SDSC(409.48,SDOE,0),U,6)
.. I $S(SCVAL=SDOPT:1,SDOPT=2:1,1:0) D
... D ENCBDDT^SDSCRPT2
Q
;
INSPRT ;Display all encounters that may be billable to insurance.
N SDHDR,SDOEDT,SDOE,SCVAL
S SDHDR="OUTPATIENT ENCOUNTERS POTENTIALLY BILLABLE TO INSURANCE"
U IO D NBILLHD^SDSCRPT2 I $G(SDABRT)=1 Q
; Loop through all encounters found in that date range.
S SDOEDT=SDSCTDT F S SDOEDT=$O(^SDSC(409.48,"AE",SDOEDT)) Q:SDOEDT\1>SDEDT Q:SDOEDT="" D Q:$G(SDABRT)=1
. S SDOE=0 F S SDOE=$O(^SDSC(409.48,"AE",SDOEDT,SDOE)) Q:'SDOE D Q:$G(SDABRT)=1
.. I $G(SDSCDIV)'="" Q:$P(^SDSC(409.48,SDOE,0),U,12)'=SDSCDIV
.. ; Get data
.. I '$$STDGET Q
.. ; Check for ability of patients insurance to be billed
.. I $$NBTP^SDSCUTL() Q
.. ; If Not Service Connected (NSC) after reviews, print.
.. S SCVAL=$$SCHNG^SDSCUTL(SDOE) I '+SCVAL Q
.. I '($P(SCVAL,U,3)) D NBILLBD^SDSCRPT2
Q
;
COPPRT ;Display all encounters that may be billable for co-payment.
N SDHDR,SDOEDT,SDOE,SDVAL
S SDHDR="OUTPATIENT ENCOUNTERS POTENTIALLY BILLABLE FOR CO-PAYS"
U IO D NBILLHD^SDSCRPT2 I $G(SDABRT)=1 Q
; Loop through all encounters found in that date range.
S SDOEDT=SDSCTDT F S SDOEDT=$O(^SDSC(409.48,"AE",SDOEDT)) Q:SDOEDT\1>SDEDT Q:SDOEDT="" D Q:$G(SDABRT)=1
. S SDOE=0 F S SDOE=$O(^SDSC(409.48,"AE",SDOEDT,SDOE)) Q:'SDOE D Q:$G(SDABRT)=1
.. I $G(SDSCDIV)'="" Q:$P(^SDSC(409.48,SDOE,0),U,12)'=SDSCDIV
.. ; Get data
.. I '$$STDGET Q
.. ; Check for patients ability to be billed
.. I $$NBFP^SDSCUTL(SDOE) Q
.. ; If Not Service Connected (NSC) after reviews, print.
.. S SDVAL=$$SCHNG^SDSCUTL(SDOE) I '+SDVAL Q
.. I '$P(SDVAL,U,3) D NBILLBD^SDSCRPT2
Q
;
RVWPRT ;Display all User Reviewed encounters
;SDDET=1 - Detailed Report; SDDET=0 - Summary Report
N SDHDR,SDLEB,SDNWPV,SDPVCN,SDPCT,SDOEDT,SDOE
S SDHDR="OUTPATIENT ENCOUNTERS SERVICE CONNECTED REVIEW BY USER"
U IO D RVWHD^SDSCRPT2 I $G(SDABRT)=1 Q
; Loop through all encounters found in that date range.
S SDLEB=0 F S SDLEB=$O(^SDSC(409.48,"AG",SDLEB)) Q:'SDLEB D Q:$G(SDABRT)=1
. ; Reset flag to print provider name
. S SDNWPV=1,SDPVCN=0,SDPCT=0
. S SDOEDT=SDSCTDT F S SDOEDT=$O(^SDSC(409.48,"AG",SDLEB,SDOEDT)) Q:SDOEDT\1>SDEDT Q:SDOEDT="" D Q:$G(SDABRT)=1
.. S SDOE=0 F S SDOE=$O(^SDSC(409.48,"AG",SDLEB,SDOEDT,SDOE)) Q:'SDOE D Q:$G(SDABRT)=1
... I $G(SDSCDIV)'="" Q:$P(^SDSC(409.48,SDOE,0),U,12)'=SDSCDIV
... ; Get data
... I '$$STDGET Q
... S SDPCT=SDPCT+1
... D RVWBD^SDSCRPT2
. I SDPCT'=0 W ?3,"Total: "_SDPCT,! S L=L+1 Q
Q
;
PRVPRT ;Display all User Reviewed encounters by Provider
;SDDET=1 - Detailed Report; SDDET=0 - Summary Report
N SDHDR,SDPROV,SDNWPV,SDPVCN,SDPCT,SDOE,SDOEDT
S SDHDR="OUTPATIENT ENCOUNTERS SERVICE CONNECTED REVIEW BY PROVIDER"
U IO D PRVHD^SDSCRPT2 I $G(SDABRT)=1 Q
; Loop through all encounters found in that date range.
S SDPROV=0 F S SDPROV=$O(^SDSC(409.48,"AF",SDPROV)) Q:'SDPROV D Q:$G(SDABRT)=1
. ; Reset flag to print provider name, without the continued label.
. S SDNWPV=1,SDPVCN=0,SDPCT=0
. S SDOEDT=SDSCTDT F S SDOEDT=$O(^SDSC(409.48,"AF",SDPROV,SDOEDT)) Q:SDOEDT\1>SDEDT Q:SDOEDT="" D Q:$G(SDABRT)=1
.. S SDOE=0 F S SDOE=$O(^SDSC(409.48,"AF",SDPROV,SDOEDT,SDOE)) Q:'SDOE D Q:$G(SDABRT)=1
... I $G(SDSCDIV)'="" Q:$P(^SDSC(409.48,SDOE,0),U,12)'=SDSCDIV
... ; Get data
... I '$$STDGET Q
... S SDPCT=SDPCT+1
... D PRVBD^SDSCRPT2
. I SDPCT'=0 W ?3,"Total: "_SDPCT,! S L=L+1 Q
Q
;
RPTEND ;Report cleSDp.
I '$G(SDABRT) W !,"<End of Report>" I $E(IOST,1,2)="C-" D
.N DIR S DIR(0)="E" D ^DIR
I $G(SDABRT)=1 W !,"<Report Aborted>"
D ^%ZISC
I $D(ZTQUEUED) S ZTREQ="@"
Q
;
STDGET() ; All standard data retrieval from SD, Encounter and Visit.
; Get compiled data
S SDDATA=$G(^SDSC(409.48,SDOE,0)) Q:SDDATA="" 0
; Get encounter data
S SDOEDAT=$$GETOE^SDOE(SDOE) Q:SDOEDAT="" 0
; Get patient
S SDPAT=$P(SDOEDAT,U,2) Q:SDPAT="" 0
; Get clinic info
S SDCLIN=$P(SDOEDAT,U,4) Q:SDCLIN="" 0
; Get clinic stop code info
S SDCST=$P(SDOEDAT,U,3) Q:SDCST="" 0
; Retrieving the visit number, quit if no visit number found
S SDV0=$P(SDOEDAT,U,5) Q:SDV0="" 0
Q 1
;
END ; Clear all variables before exiting.
K SDSCTDT,SDEDT,SDFILEOK,X,X1,X2,Y,SDV0,SDDATA,SDPAT,SDCLIN,SDCST
K ZTQUEUED,ZTREQ,SDPOV,SDVPOV0,SDPROV,DTOUT,DUOUT,POP,SDSCBDT,SDSCEDT
K SDQFL,SDPCTS,SDSCDVSL,SDSCDVLN,SDRTN,SCLN,SDOEDAT
Q
;
DIV ; Ask Division
N DIR,X,Y
S SDQFL=0
D DIV^SDSCUTL
D ^DIR
I $G(DTOUT)!($G(DUOUT)) S SDQFL=1 Q
S SDSCDVSL=Y,SDSCDVLN=SCLN
Q
SDSCRPT1 ;ALB/JAM/RBS - ASCD Reports for Service Connected Automated Monitor ; 4/24/07 4:30pm
+1 ;;5.3;Scheduling;**495,1015**;Aug 13, 1993;Build 21
+2 ;;MODIFIED FOR NATIONAL RELEASE from a Class III software product
+3 ;;known as Service Connected Automated Monitoring (SCAM).
+4 ;
+5 ; Routine should be called at specified tags only.
+6 QUIT
RDPOV ; 'ROUTINE' tag called by option "SDSC ENC REPORT - Service Connected Encounters Report"
+1 NEW ZTDESC,SDRTN,SDOPT,DIR,DIRUT,X,Y
+2 WRITE !,"Service Connected Encounters Report"
+3 SET DIR(0)="SO^S:Service Connected;N:Non-Service Connected;A:All"
+4 SET DIR("B")="S"
SET DIR("A")="Which option do you want to run?"
+5 DO ^DIR
IF $DATA(DIRUT)
QUIT
+6 SET SDOPT=$SELECT(Y="S":1,Y="N":0,1:2)
+7 SET ZTDESC="COMPARE DISABILITY/POV PER ENCOUNTER"
SET SDRTN="PRINT^SDSCRPT1"
+8 GOTO LOAD
+9 ;
NSCCOP ; 'ROUTINE' tag called by option "SDSC FIRST PARTY REPORT - First Party Billable Service Connected Report"
+1 NEW ZTDESC,SDRTN
+2 SET ZTDESC="SERVICE CONNECTED CO-PAY REPORT"
SET SDRTN="COPPRT^SDSCRPT1"
+3 GOTO LOAD
+4 ;
NSCINS ; 'ROUTINE' tag called by option "SDSC THIRD PARTY REPORT - Third Party Billable Service Connected Report"
+1 NEW ZTDESC,SDRTN
+2 SET ZTDESC="SERVICE CONNECTED BILLING INSURANCE REPORT"
SET SDRTN="INSPRT^SDSCRPT1"
+3 GOTO LOAD
+4 ;
SCPRV ;Provider Service Connected Encounters Report
+1 NEW SDDET,DIR,DIRUT,X,Y,ZTDESC,SDRTN
+2 WRITE !,"Provider Service Connected Encounters Report"
+3 SET DIR(0)="SO^D:Detail;S:Summary"
SET DIR("B")="S"
+4 SET DIR("A")="Which option do you want to run?"
+5 DO ^DIR
IF $DATA(DIRUT)
QUIT
+6 SET SDDET=$SELECT(Y="D":1,1:0)
+7 SET ZTDESC="SERV CONN REVIEW REPORT BY PROVIDER"
SET SDRTN="PRVPRT^SDSCRPT1"
+8 GOTO LOAD
+9 ;
SCUSR ;User Service Connected Encounters Report
+1 NEW SDDET,DIR,DIRUT,X,Y,ZTDESC,SDRTN
+2 WRITE !,"User Service Connected Encounters Report"
+3 SET DIR(0)="SO^D:Detail;S:Summary"
SET DIR("B")="S"
+4 SET DIR("A")="Which option do you want to run?"
+5 DO ^DIR
IF $DATA(DIRUT)
QUIT
+6 SET SDDET=$SELECT(Y="D":1,1:0)
+7 SET ZTDESC="SERV CONN REVIEW REPORT BY USER"
SET SDRTN="RVWPRT^SDSCRPT1"
+8 GOTO LOAD
+9 ;
LOAD ; Standard start tag for all current reports.
+1 ; Initialize variables if necessary.
+2 NEW ZTIO,ZTSAVE,ZTRTN,P,L,SDABRT
+3 KILL %ZIS
DO HOME^%ZIS
+4 ; Select division
+5 DO DIV
IF SDQFL
GOTO END
+6 ; Get start and end date for report.
+7 DO GETDATE^SDSCOMP
IF SDSCTDT=""
GOTO END
+8 ; Initialize page counts
+9 SET (P,L,SDABRT)=0
+10 ; Prompt user for DEVICE and handle TaskMan queuing if required.
+11 SET %ZIS="QM"
DO ^%ZIS
IF POP
GOTO END
+12 IF '$DATA(IO("Q"))
USE IO
KILL ZTDESC
GOTO LOOP
+13 SET ZTIO=ION
SET ZTSAVE("*")=""
SET ZTRTN="LOOP^SDSCRPT1"
DO ^%ZTLOAD
+14 GOTO END
LOOP ; Loop through each division and display the selected report.
+1 NEW CT,SDSCDIV,SDSCDNM,SDI,THDR
+2 SET CT=0
SET SDSCDIV=$SELECT(SDSCDVSL'[SDSCDVLN:SDSCDVSL,1:"")
+3 IF SDSCDIV=""
SET SDSCDNM="ALL"
DO @SDRTN
+4 IF SDSCDIV'=""
Begin DoDot:1
+5 SET THDR=""
+6 FOR SDI=1:1:$LENGTH(SDSCDVSL,",")
SET SDSCDIV=$PIECE(SDSCDVSL,",",SDI)
IF SDSCDIV=""
QUIT
Begin DoDot:2
+7 SET SDSCDNM=$PIECE(^DG(40.8,SDSCDIV,0),"^",1)
SET THDR=THDR_SDSCDNM_","
SET CT=CT+1
DO @SDRTN
End DoDot:2
IF $GET(SDABRT)=1
QUIT
End DoDot:1
+8 DO RPTEND
+9 GOTO END
+10 ;
PRINT ; Display the encounters previously stored for this date.
+1 ; This is a detailed report, set flag
+2 NEW SDDET,SDOEDT,SDOE,SCVAL
+3 SET SDDET=1
+4 USE IO
DO HEADER^SDSCRPT2
IF $GET(SDABRT)=1
QUIT
+5 ; Loop through all encounters found in that date range.
+6 SET SDOEDT=SDSCTDT
FOR
SET SDOEDT=$ORDER(^SDSC(409.48,"AE",SDOEDT))
IF SDOEDT\1>SDEDT
QUIT
IF SDOEDT=""
QUIT
Begin DoDot:1
+7 SET SDOE=0
FOR
SET SDOE=$ORDER(^SDSC(409.48,"AE",SDOEDT,SDOE))
IF 'SDOE
QUIT
Begin DoDot:2
+8 IF $GET(SDSCDIV)'=""
IF $PIECE(^SDSC(409.48,SDOE,0),U,12)'=SDSCDIV
QUIT
+9 ; Get data
+10 IF '$$STDGET
QUIT
+11 SET SCVAL=$PIECE(^SDSC(409.48,SDOE,0),U,6)
+12 IF $SELECT(SCVAL=SDOPT:1,SDOPT=2:1,1:0)
Begin DoDot:3
+13 DO ENCBDDT^SDSCRPT2
End DoDot:3
End DoDot:2
IF $GET(SDABRT)=1
QUIT
End DoDot:1
IF $GET(SDABRT)=1
QUIT
+14 QUIT
+15 ;
INSPRT ;Display all encounters that may be billable to insurance.
+1 NEW SDHDR,SDOEDT,SDOE,SCVAL
+2 SET SDHDR="OUTPATIENT ENCOUNTERS POTENTIALLY BILLABLE TO INSURANCE"
+3 USE IO
DO NBILLHD^SDSCRPT2
IF $GET(SDABRT)=1
QUIT
+4 ; Loop through all encounters found in that date range.
+5 SET SDOEDT=SDSCTDT
FOR
SET SDOEDT=$ORDER(^SDSC(409.48,"AE",SDOEDT))
IF SDOEDT\1>SDEDT
QUIT
IF SDOEDT=""
QUIT
Begin DoDot:1
+6 SET SDOE=0
FOR
SET SDOE=$ORDER(^SDSC(409.48,"AE",SDOEDT,SDOE))
IF 'SDOE
QUIT
Begin DoDot:2
+7 IF $GET(SDSCDIV)'=""
IF $PIECE(^SDSC(409.48,SDOE,0),U,12)'=SDSCDIV
QUIT
+8 ; Get data
+9 IF '$$STDGET
QUIT
+10 ; Check for ability of patients insurance to be billed
+11 IF $$NBTP^SDSCUTL()
QUIT
+12 ; If Not Service Connected (NSC) after reviews, print.
+13 SET SCVAL=$$SCHNG^SDSCUTL(SDOE)
IF '+SCVAL
QUIT
+14 IF '($PIECE(SCVAL,U,3))
DO NBILLBD^SDSCRPT2
End DoDot:2
IF $GET(SDABRT)=1
QUIT
End DoDot:1
IF $GET(SDABRT)=1
QUIT
+15 QUIT
+16 ;
COPPRT ;Display all encounters that may be billable for co-payment.
+1 NEW SDHDR,SDOEDT,SDOE,SDVAL
+2 SET SDHDR="OUTPATIENT ENCOUNTERS POTENTIALLY BILLABLE FOR CO-PAYS"
+3 USE IO
DO NBILLHD^SDSCRPT2
IF $GET(SDABRT)=1
QUIT
+4 ; Loop through all encounters found in that date range.
+5 SET SDOEDT=SDSCTDT
FOR
SET SDOEDT=$ORDER(^SDSC(409.48,"AE",SDOEDT))
IF SDOEDT\1>SDEDT
QUIT
IF SDOEDT=""
QUIT
Begin DoDot:1
+6 SET SDOE=0
FOR
SET SDOE=$ORDER(^SDSC(409.48,"AE",SDOEDT,SDOE))
IF 'SDOE
QUIT
Begin DoDot:2
+7 IF $GET(SDSCDIV)'=""
IF $PIECE(^SDSC(409.48,SDOE,0),U,12)'=SDSCDIV
QUIT
+8 ; Get data
+9 IF '$$STDGET
QUIT
+10 ; Check for patients ability to be billed
+11 IF $$NBFP^SDSCUTL(SDOE)
QUIT
+12 ; If Not Service Connected (NSC) after reviews, print.
+13 SET SDVAL=$$SCHNG^SDSCUTL(SDOE)
IF '+SDVAL
QUIT
+14 IF '$PIECE(SDVAL,U,3)
DO NBILLBD^SDSCRPT2
End DoDot:2
IF $GET(SDABRT)=1
QUIT
End DoDot:1
IF $GET(SDABRT)=1
QUIT
+15 QUIT
+16 ;
RVWPRT ;Display all User Reviewed encounters
+1 ;SDDET=1 - Detailed Report; SDDET=0 - Summary Report
+2 NEW SDHDR,SDLEB,SDNWPV,SDPVCN,SDPCT,SDOEDT,SDOE
+3 SET SDHDR="OUTPATIENT ENCOUNTERS SERVICE CONNECTED REVIEW BY USER"
+4 USE IO
DO RVWHD^SDSCRPT2
IF $GET(SDABRT)=1
QUIT
+5 ; Loop through all encounters found in that date range.
+6 SET SDLEB=0
FOR
SET SDLEB=$ORDER(^SDSC(409.48,"AG",SDLEB))
IF 'SDLEB
QUIT
Begin DoDot:1
+7 ; Reset flag to print provider name
+8 SET SDNWPV=1
SET SDPVCN=0
SET SDPCT=0
+9 SET SDOEDT=SDSCTDT
FOR
SET SDOEDT=$ORDER(^SDSC(409.48,"AG",SDLEB,SDOEDT))
IF SDOEDT\1>SDEDT
QUIT
IF SDOEDT=""
QUIT
Begin DoDot:2
+10 SET SDOE=0
FOR
SET SDOE=$ORDER(^SDSC(409.48,"AG",SDLEB,SDOEDT,SDOE))
IF 'SDOE
QUIT
Begin DoDot:3
+11 IF $GET(SDSCDIV)'=""
IF $PIECE(^SDSC(409.48,SDOE,0),U,12)'=SDSCDIV
QUIT
+12 ; Get data
+13 IF '$$STDGET
QUIT
+14 SET SDPCT=SDPCT+1
+15 DO RVWBD^SDSCRPT2
End DoDot:3
IF $GET(SDABRT)=1
QUIT
End DoDot:2
IF $GET(SDABRT)=1
QUIT
+16 IF SDPCT'=0
WRITE ?3,"Total: "_SDPCT,!
SET L=L+1
QUIT
End DoDot:1
IF $GET(SDABRT)=1
QUIT
+17 QUIT
+18 ;
PRVPRT ;Display all User Reviewed encounters by Provider
+1 ;SDDET=1 - Detailed Report; SDDET=0 - Summary Report
+2 NEW SDHDR,SDPROV,SDNWPV,SDPVCN,SDPCT,SDOE,SDOEDT
+3 SET SDHDR="OUTPATIENT ENCOUNTERS SERVICE CONNECTED REVIEW BY PROVIDER"
+4 USE IO
DO PRVHD^SDSCRPT2
IF $GET(SDABRT)=1
QUIT
+5 ; Loop through all encounters found in that date range.
+6 SET SDPROV=0
FOR
SET SDPROV=$ORDER(^SDSC(409.48,"AF",SDPROV))
IF 'SDPROV
QUIT
Begin DoDot:1
+7 ; Reset flag to print provider name, without the continued label.
+8 SET SDNWPV=1
SET SDPVCN=0
SET SDPCT=0
+9 SET SDOEDT=SDSCTDT
FOR
SET SDOEDT=$ORDER(^SDSC(409.48,"AF",SDPROV,SDOEDT))
IF SDOEDT\1>SDEDT
QUIT
IF SDOEDT=""
QUIT
Begin DoDot:2
+10 SET SDOE=0
FOR
SET SDOE=$ORDER(^SDSC(409.48,"AF",SDPROV,SDOEDT,SDOE))
IF 'SDOE
QUIT
Begin DoDot:3
+11 IF $GET(SDSCDIV)'=""
IF $PIECE(^SDSC(409.48,SDOE,0),U,12)'=SDSCDIV
QUIT
+12 ; Get data
+13 IF '$$STDGET
QUIT
+14 SET SDPCT=SDPCT+1
+15 DO PRVBD^SDSCRPT2
End DoDot:3
IF $GET(SDABRT)=1
QUIT
End DoDot:2
IF $GET(SDABRT)=1
QUIT
+16 IF SDPCT'=0
WRITE ?3,"Total: "_SDPCT,!
SET L=L+1
QUIT
End DoDot:1
IF $GET(SDABRT)=1
QUIT
+17 QUIT
+18 ;
RPTEND ;Report cleSDp.
+1 IF '$GET(SDABRT)
WRITE !,"<End of Report>"
IF $EXTRACT(IOST,1,2)="C-"
Begin DoDot:1
+2 NEW DIR
SET DIR(0)="E"
DO ^DIR
End DoDot:1
+3 IF $GET(SDABRT)=1
WRITE !,"<Report Aborted>"
+4 DO ^%ZISC
+5 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+6 QUIT
+7 ;
STDGET() ; All standard data retrieval from SD, Encounter and Visit.
+1 ; Get compiled data
+2 SET SDDATA=$GET(^SDSC(409.48,SDOE,0))
IF SDDATA=""
QUIT 0
+3 ; Get encounter data
+4 SET SDOEDAT=$$GETOE^SDOE(SDOE)
IF SDOEDAT=""
QUIT 0
+5 ; Get patient
+6 SET SDPAT=$PIECE(SDOEDAT,U,2)
IF SDPAT=""
QUIT 0
+7 ; Get clinic info
+8 SET SDCLIN=$PIECE(SDOEDAT,U,4)
IF SDCLIN=""
QUIT 0
+9 ; Get clinic stop code info
+10 SET SDCST=$PIECE(SDOEDAT,U,3)
IF SDCST=""
QUIT 0
+11 ; Retrieving the visit number, quit if no visit number found
+12 SET SDV0=$PIECE(SDOEDAT,U,5)
IF SDV0=""
QUIT 0
+13 QUIT 1
+14 ;
END ; Clear all variables before exiting.
+1 KILL SDSCTDT,SDEDT,SDFILEOK,X,X1,X2,Y,SDV0,SDDATA,SDPAT,SDCLIN,SDCST
+2 KILL ZTQUEUED,ZTREQ,SDPOV,SDVPOV0,SDPROV,DTOUT,DUOUT,POP,SDSCBDT,SDSCEDT
+3 KILL SDQFL,SDPCTS,SDSCDVSL,SDSCDVLN,SDRTN,SCLN,SDOEDAT
+4 QUIT
+5 ;
DIV ; Ask Division
+1 NEW DIR,X,Y
+2 SET SDQFL=0
+3 DO DIV^SDSCUTL
+4 DO ^DIR
+5 IF $GET(DTOUT)!($GET(DUOUT))
SET SDQFL=1
QUIT
+6 SET SDSCDVSL=Y
SET SDSCDVLN=SCLN
+7 QUIT