SCAPMC27 ;ALB/REW - PTST Patients with a Stop Code ; JUN 30, 1995
;;5.3;Scheduling;**41,140**;AUG 13, 1993
;;1.0
PTST(SCST,SCDATES,SCMAXCNT,SCLIST,SCERR,MORE) ; -- list of patients with a IEN of 40.7
; USE $$PTSTEXT(below) if you have stop code (e.g. 301)
; input:
; SCST = stop code
; SCDATES("BEGIN") = begin date to search (inclusive)
; [default: TODAY]
; ("END") = end date to search (inclusive)
; [default: TODAY]
; ("INCL") = 1: only use patients who were assigned to
; team for entire date range
; 0: anytime in date range
; [default: 1]
; SCMAXCNT = Maximum Number to Return - Default=99
; SCLIST -array name to store list
; [ex. ^TMP("SCPT",$J)]
;
; SCERR = array NAME to store error messages.
; [ex. ^TMP("ORXX",$J)]
; MORE - For continuing lists (see scapmc28)
;Note: Don't Return DFNs where $D(^TMP("SCMC",$J,"EXCLUDE PT","SCPTA",+DFN)) is true
; Output:
; SCLIST() = array of patients
; Format:
; Subscript: Sequential # from 1 to n
; Piece Description
; 1 IEN of PATIENT file entry
; 2 Name of patient
; 3 ien to 40.7 - Not Stop Code!! stp=$$intstp
; 4 AMIS reporting stop code
;
; SCEFFDT - negative of effective date
; SCN - current subscript (counter) 1->n
; SCPTA0 is 0 node of Patient Team Assignment file 1st piece is DFN
; SCERR() = Array of DIALOG file messages(errors) .
; @SCERR@(0)=number of errors, undefined if none
; Foramt:
; Subscript: Sequential # from 1 to n
; Piece Description
; 1 IEN of DIALOG file
;
; Returned: 1 if ok, 0 if error^More?
;
;
ST N SCDT,SCEND,SCCL,SCNODE,SCX
N SCLSEQ,SCN,SCESEQ,SCPARM,SCP,SCBEGIN,SCEND,SCINCL,SCDTS
S SCX=0
G:'$$OKDATA STQ ;check/setup variables
; -- loop file#44
LP S SCDT=SCBEGIN
S:'$P(SCEND,".",2) SCEND=$$FMADD^XLFDT(SCEND,1) ;ending is end of day
IF $G(MORE) D
.S SCSTART=+$P($G(@SCLIST@(0)),U,2)
.S SCBEGIN=+$P($G(@SCLIST@(0)),U,3)
.S SCCL=+$P($G(@SCLIST@(0)),U,4)
.K @SCLIST
ELSE D
.S SCSTART=0
.S SCCL=0
; go thru clinics with stop code=SCST
F S:'$G(MORE) SCCL=$O(^SC(SCCL)) Q:'SCCL S:$P($G(^SC(SCCL,0)),U,7)=SCST SCX=$$PTAPX^SCAPMC28(.SCCL,.SCBEGIN,.SCEND,.SCMAXCNT,.SCLIST,.SCERR,.SCSTART) S MORE=0
STQ Q SCX
;
OKDATA() ;check/setup variables
N SCOK
S SCOK=1
S SCMAXCNT=$G(SCMAXCNT,99)
D INIT^SCAPMCU1(.SCOK) ; set default dates & error array (if undefined)
IF '$D(^DIC(40.7,+$G(SCST),0)) D S SCOK=0
. S SCPARM("STOP")=$G(SCST,"Undefined")
. D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
; -- is it a valid TEAM ien passed (Error # 4045101 in DIALOG file)
Q SCOK
;
INTST(STOP) ;given stop code return ient
Q +$O(^DIC(40.7,"C",+$G(STOP),0))
;
PTSTEXT(SCSTOP,SCDATES,SCMAXCNT,SCLIST,SCERR) ; -- list of patients with AMIS REPORTING STOP CODE
; For variables see: PTST (above)
; Returned: 1 if ok, 0 if error^More?
N SCST
S SCST=$$INTST(.SCSTOP)
Q $$PTST(.SCST,.SCDATES,.SCMAXCNT,.SCLIST,.SCERR,.MORE)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCAPMC27 3322 printed Oct 16, 2024@18:38:38 Page 2
SCAPMC27 ;ALB/REW - PTST Patients with a Stop Code ; JUN 30, 1995
+1 ;;5.3;Scheduling;**41,140**;AUG 13, 1993
+2 ;;1.0
PTST(SCST,SCDATES,SCMAXCNT,SCLIST,SCERR,MORE) ; -- list of patients with a IEN of 40.7
+1 ; USE $$PTSTEXT(below) if you have stop code (e.g. 301)
+2 ; input:
+3 ; SCST = stop code
+4 ; SCDATES("BEGIN") = begin date to search (inclusive)
+5 ; [default: TODAY]
+6 ; ("END") = end date to search (inclusive)
+7 ; [default: TODAY]
+8 ; ("INCL") = 1: only use patients who were assigned to
+9 ; team for entire date range
+10 ; 0: anytime in date range
+11 ; [default: 1]
+12 ; SCMAXCNT = Maximum Number to Return - Default=99
+13 ; SCLIST -array name to store list
+14 ; [ex. ^TMP("SCPT",$J)]
+15 ;
+16 ; SCERR = array NAME to store error messages.
+17 ; [ex. ^TMP("ORXX",$J)]
+18 ; MORE - For continuing lists (see scapmc28)
+19 ;Note: Don't Return DFNs where $D(^TMP("SCMC",$J,"EXCLUDE PT","SCPTA",+DFN)) is true
+20 ; Output:
+21 ; SCLIST() = array of patients
+22 ; Format:
+23 ; Subscript: Sequential # from 1 to n
+24 ; Piece Description
+25 ; 1 IEN of PATIENT file entry
+26 ; 2 Name of patient
+27 ; 3 ien to 40.7 - Not Stop Code!! stp=$$intstp
+28 ; 4 AMIS reporting stop code
+29 ;
+30 ; SCEFFDT - negative of effective date
+31 ; SCN - current subscript (counter) 1->n
+32 ; SCPTA0 is 0 node of Patient Team Assignment file 1st piece is DFN
+33 ; SCERR() = Array of DIALOG file messages(errors) .
+34 ; @SCERR@(0)=number of errors, undefined if none
+35 ; Foramt:
+36 ; Subscript: Sequential # from 1 to n
+37 ; Piece Description
+38 ; 1 IEN of DIALOG file
+39 ;
+40 ; Returned: 1 if ok, 0 if error^More?
+41 ;
+42 ;
ST NEW SCDT,SCEND,SCCL,SCNODE,SCX
+1 NEW SCLSEQ,SCN,SCESEQ,SCPARM,SCP,SCBEGIN,SCEND,SCINCL,SCDTS
+2 SET SCX=0
+3 ;check/setup variables
if '$$OKDATA
GOTO STQ
+4 ; -- loop file#44
LP SET SCDT=SCBEGIN
+1 ;ending is end of day
if '$PIECE(SCEND,".",2)
SET SCEND=$$FMADD^XLFDT(SCEND,1)
+2 IF $GET(MORE)
Begin DoDot:1
+3 SET SCSTART=+$PIECE($GET(@SCLIST@(0)),U,2)
+4 SET SCBEGIN=+$PIECE($GET(@SCLIST@(0)),U,3)
+5 SET SCCL=+$PIECE($GET(@SCLIST@(0)),U,4)
+6 KILL @SCLIST
End DoDot:1
+7 IF '$TEST
Begin DoDot:1
+8 SET SCSTART=0
+9 SET SCCL=0
End DoDot:1
+10 ; go thru clinics with stop code=SCST
+11 FOR
if '$GET(MORE)
SET SCCL=$ORDER(^SC(SCCL))
if 'SCCL
QUIT
if $PIECE($GET(^SC(SCCL,0)),U,7)=SCST
SET SCX=$$PTAPX^SCAPMC28(.SCCL,.SCBEGIN,.SCEND,.SCMAXCNT,.SCLIST,.SCERR,.SCSTART)
SET MORE=0
STQ QUIT SCX
+1 ;
OKDATA() ;check/setup variables
+1 NEW SCOK
+2 SET SCOK=1
+3 SET SCMAXCNT=$GET(SCMAXCNT,99)
+4 ; set default dates & error array (if undefined)
DO INIT^SCAPMCU1(.SCOK)
+5 IF '$DATA(^DIC(40.7,+$GET(SCST),0))
Begin DoDot:1
+6 SET SCPARM("STOP")=$GET(SCST,"Undefined")
+7 DO ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
End DoDot:1
SET SCOK=0
+8 ; -- is it a valid TEAM ien passed (Error # 4045101 in DIALOG file)
+9 QUIT SCOK
+10 ;
INTST(STOP) ;given stop code return ient
+1 QUIT +$ORDER(^DIC(40.7,"C",+$GET(STOP),0))
+2 ;
PTSTEXT(SCSTOP,SCDATES,SCMAXCNT,SCLIST,SCERR) ; -- list of patients with AMIS REPORTING STOP CODE
+1 ; For variables see: PTST (above)
+2 ; Returned: 1 if ok, 0 if error^More?
+3 NEW SCST
+4 SET SCST=$$INTST(.SCSTOP)
+5 QUIT $$PTST(.SCST,.SCDATES,.SCMAXCNT,.SCLIST,.SCERR,.MORE)