SCAPMC10 ;ALB/REW - Team API's: PRPT ; JUN 26, 1995
;;5.3;Scheduling;**41,1015**;AUG 13, 1993;Build 21
;;1.0
PRPT(DFN,SCDATES,SCPOSA,SCUSRA,SCROLEA,SCPURPA,SCLIST,SCERR,SCYESCL) ; -- practs for patient (No support for scyescl)
; input:
; DFN = ien of PATIENT <FILE#2> [required]
; SCDATES("BEGIN") = begin date to search (inclusive)
; [default: TODAY]
; ("END") = end date to search (inclusive)
; [default: TODAY]
; ("INCL") = 1: only use pracitioners who were on
; team for entire date range
; 0: anytime in date range
; [default: 1]
; SCPOSA= array of positions to include reverse with scposa('exclude')
; SCUSRA= array of usr classes included reverse with scusra('exclude')
; SCROLEA= array of usr classes included reverse with scusra('exclude')
;SCPURPA - array of pointers to team purpose file 403.47
; if none definded - retruns all teams
; if @scpurpa@('exclude') is defined - exclude listed teams
; SCERR = array NAME to store error messages.
; [ex. ^TMP("ORXX",$J)]
; SCYESCL=Boolean indicator to include patients' enrollments in
; clinics - [0:strong recommendation/default=NO,1=YES] **NOT SUPPORTED **
;
; Output:
; SCLIST() = array of practitioners
; Format:
; Subscript: Sequential # from 1 to n
; Piece Description
; 1 IEN of NEW PERSON file entry (#200)
; 2 Name of person
; 3 IEN of TEAM POSITION file (#404.57)
; 4 Name of Position
; 5 IEN OF USR CLASS(#8930) of POSITION (#404.57)
; 6 USR Class Name
; 7 IEN of STANDARD POSITION (#403.46)
; 8 Standard Role (Position) Name
; 9 Activation Date for 404.52 (not 404.59!)
; 10 Inactivation Date for 404.52
; 11 IEN of Position Ass History (404.52)
; 12 IEN of Preceptor Position
; 13 Name of Preceptor Position
;
; SCERR() = Array of DIALOG file messages(errors) .
; @SCERR(0)= Number of error(s), UNDEFINED if no errors
; Foramt:
; Subscript: Sequential # from 1 to n
; Piece Description
; 1 IEN of DIALOG file
; Returned: 1 if ok, 0 if error
;
; -- initialize control variables
;
ST N SCTP,SCPOS0,SCOK,SCTEAMS,INDX,SCPRACTS,SCND,SCU,SCR,SCPOSIT,SCX,SCTP,SC44
N SCLSEQ,SCN,SCESEQ,SCPARM,SCP,SCBEGIN,SCEND,SCINCL,SCDTS
N SCENROLL,SCPOSIT,PT,ENR
G:'$$OKDATA PRPTQ ; check/setup variables
; put list of patient's positions in SCPOSIT()
IF '$$TPPT^SCAPMC23(DFN,.SCDATES,.SCPOSA,.SCUSA,.SCPURPA,.SCROLEA,.SCYESCL,"SCPOSIT",.SCERR) G PRPTQ
F INDX=1:1:$G(SCPOSIT(0)) S SCX=$G(SCPOSIT(INDX)) D
.IF 'SCX D Q
..S SCPARM("Position Xref")=$G(SCX)
..D ERR^SCAPMCU1(.SCESEQ,,SCPARM,"",.SCERR)
.S SCTP=$P(SCX,U,1)
.S PT("BEGIN")=$S(SCBEGIN>$P(SCX,U,5):SCBEGIN,1:$P(SCX,U,5))
.S PT("END")=$S('$P(SCX,U,6):SCEND,(SCEND<$P(SCX,U,6)):SCEND,1:$P(SCX,U,6))
.S PT("INCL")=SCINCL
.;go thru each pt team position assignment
.Q:'$$PRTP^SCAPMC8(SCTP,"PT",.SCLIST,.SCERR)
PRPTQ Q $G(@SCERR@(0))<1
;
OKDATA() ;check/setup variables - return 1 if ok; 0 if error
N SCOK
S SCOK=1
D INIT^SCAPMCU1(.SCOK) ; set default dates & error array (if undefined)
IF '$D(^DPT(+$G(DFN),0)) D S SCOK=0
. S SCPARM("PATIENT")=$G(DFN,"Undefined")
. D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
S SCPOSA=$G(SCPOSA,"")
S SCUSRA=$G(SCUSRA,"")
Q SCOK
SCAPMC10 ;ALB/REW - Team API's: PRPT ; JUN 26, 1995
+1 ;;5.3;Scheduling;**41,1015**;AUG 13, 1993;Build 21
+2 ;;1.0
PRPT(DFN,SCDATES,SCPOSA,SCUSRA,SCROLEA,SCPURPA,SCLIST,SCERR,SCYESCL) ; -- practs for patient (No support for scyescl)
+1 ; input:
+2 ; DFN = ien of PATIENT <FILE#2> [required]
+3 ; SCDATES("BEGIN") = begin date to search (inclusive)
+4 ; [default: TODAY]
+5 ; ("END") = end date to search (inclusive)
+6 ; [default: TODAY]
+7 ; ("INCL") = 1: only use pracitioners who were on
+8 ; team for entire date range
+9 ; 0: anytime in date range
+10 ; [default: 1]
+11 ; SCPOSA= array of positions to include reverse with scposa('exclude')
+12 ; SCUSRA= array of usr classes included reverse with scusra('exclude')
+13 ; SCROLEA= array of usr classes included reverse with scusra('exclude')
+14 ;SCPURPA - array of pointers to team purpose file 403.47
+15 ; if none definded - retruns all teams
+16 ; if @scpurpa@('exclude') is defined - exclude listed teams
+17 ; SCERR = array NAME to store error messages.
+18 ; [ex. ^TMP("ORXX",$J)]
+19 ; SCYESCL=Boolean indicator to include patients' enrollments in
+20 ; clinics - [0:strong recommendation/default=NO,1=YES] **NOT SUPPORTED **
+21 ;
+22 ; Output:
+23 ; SCLIST() = array of practitioners
+24 ; Format:
+25 ; Subscript: Sequential # from 1 to n
+26 ; Piece Description
+27 ; 1 IEN of NEW PERSON file entry (#200)
+28 ; 2 Name of person
+29 ; 3 IEN of TEAM POSITION file (#404.57)
+30 ; 4 Name of Position
+31 ; 5 IEN OF USR CLASS(#8930) of POSITION (#404.57)
+32 ; 6 USR Class Name
+33 ; 7 IEN of STANDARD POSITION (#403.46)
+34 ; 8 Standard Role (Position) Name
+35 ; 9 Activation Date for 404.52 (not 404.59!)
+36 ; 10 Inactivation Date for 404.52
+37 ; 11 IEN of Position Ass History (404.52)
+38 ; 12 IEN of Preceptor Position
+39 ; 13 Name of Preceptor Position
+40 ;
+41 ; SCERR() = Array of DIALOG file messages(errors) .
+42 ; @SCERR(0)= Number of error(s), UNDEFINED if no errors
+43 ; Foramt:
+44 ; Subscript: Sequential # from 1 to n
+45 ; Piece Description
+46 ; 1 IEN of DIALOG file
+47 ; Returned: 1 if ok, 0 if error
+48 ;
+49 ; -- initialize control variables
+50 ;
ST NEW SCTP,SCPOS0,SCOK,SCTEAMS,INDX,SCPRACTS,SCND,SCU,SCR,SCPOSIT,SCX,SCTP,SC44
+1 NEW SCLSEQ,SCN,SCESEQ,SCPARM,SCP,SCBEGIN,SCEND,SCINCL,SCDTS
+2 NEW SCENROLL,SCPOSIT,PT,ENR
+3 ; check/setup variables
IF '$$OKDATA
GOTO PRPTQ
+4 ; put list of patient's positions in SCPOSIT()
+5 IF '$$TPPT^SCAPMC23(DFN,.SCDATES,.SCPOSA,.SCUSA,.SCPURPA,.SCROLEA,.SCYESCL,"SCPOSIT",.SCERR)
GOTO PRPTQ
+6 FOR INDX=1:1:$GET(SCPOSIT(0))
SET SCX=$GET(SCPOSIT(INDX))
Begin DoDot:1
+7 IF 'SCX
Begin DoDot:2
+8 SET SCPARM("Position Xref")=$GET(SCX)
+9 DO ERR^SCAPMCU1(.SCESEQ,,SCPARM,"",.SCERR)
End DoDot:2
QUIT
+10 SET SCTP=$PIECE(SCX,U,1)
+11 SET PT("BEGIN")=$SELECT(SCBEGIN>$PIECE(SCX,U,5):SCBEGIN,1:$PIECE(SCX,U,5))
+12 SET PT("END")=$SELECT('$PIECE(SCX,U,6):SCEND,(SCEND<$PIECE(SCX,U,6)):SCEND,1:$PIECE(SCX,U,6))
+13 SET PT("INCL")=SCINCL
+14 ;go thru each pt team position assignment
+15 IF '$$PRTP^SCAPMC8(SCTP,"PT",.SCLIST,.SCERR)
QUIT
End DoDot:1
PRPTQ QUIT $GET(@SCERR@(0))<1
+1 ;
OKDATA() ;check/setup variables - return 1 if ok; 0 if error
+1 NEW SCOK
+2 SET SCOK=1
+3 ; set default dates & error array (if undefined)
DO INIT^SCAPMCU1(.SCOK)
+4 IF '$DATA(^DPT(+$GET(DFN),0))
Begin DoDot:1
+5 SET SCPARM("PATIENT")=$GET(DFN,"Undefined")
+6 DO ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
End DoDot:1
SET SCOK=0
+7 SET SCPOSA=$GET(SCPOSA,"")
+8 SET SCUSRA=$GET(SCUSRA,"")
+9 QUIT SCOK