SCAPMC16 ;ALB/CMM - TEAM/CLINIC APIs ;03/19/96
;;5.3;Scheduling;**41,1015**;AUG 13, 1993;Build 21
;
TMCL(SCCLN,SCDATES,SCLIST,SCERR) ; -- list of teams for a clinic
; input:
; SCCLN = ien of HOSPITAL LOCATION <FILE#44> [required]
; 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]
; SCLIST -array name to store list
; [ex. ^TMP("SCPT",$J)]
;
; SCERR = array NAME to store error messages.
; [ex. ^TMP("ORXX",$J)]
;
; Output:
; SCLIST() = array of positions (includes SCTP xref)
; Format:
; Subscript: Sequential # from 1 to n
; Piece Description
; 1 IEN of Team #404.51
; 2 Team Name
; Subscript: "SCTP",SCTM,IEN =""
;
; SCERR() = Array of errors
; @SCERR@(0) = number of errors, undefined if none
; Format:
; Subscript: Sequential # from 1 to n
; Piece Description
; 1 error description
; Returned: 1 if ok, 0 if error
;
ST ;
N OKAY,NODE,ENT,PCLIST,ERR2,CNT,TIEN
I '$D(SCCLN)!('$D(SCLIST)) S @SCERR@(0)="undefined variables" Q 0
I '$D(SCERR) Q 0
;
S PCLIST="PCLST",ERR2="ERROR2"
S OKAY=$$TPCL^SCAPMC30(SCCLN,.SCDATES,"","","","",.PCLIST,.ERR2)
; ^ positions for a clinic SCCLN
I 'OKAY S @SCERR@(0)="error in TPCL^SCAPMC30 call"
Q:'OKAY 0
;
S (CNT,ENT)=0
F S ENT=$O(@PCLIST@(ENT)) Q:ENT=""!(ENT'?.N) D
.S NODE=$G(@PCLIST@(ENT))
.S TIEN=+$P(NODE,"^",3) ;team ien
.I $D(@SCLIST@("SCTP",TIEN)) Q
.;unique entries only
.S CNT=CNT+1
.S @SCLIST@(CNT)=TIEN ;team ien
.S @SCLIST@("SCTP",TIEN,CNT)=""
.S $P(@SCLIST@(CNT),"^",2)=$P($G(^SCTM(404.51,TIEN,0)),"^") ;team name
S @SCLIST@(0)=CNT
Q 1
SCAPMC16 ;ALB/CMM - TEAM/CLINIC APIs ;03/19/96
+1 ;;5.3;Scheduling;**41,1015**;AUG 13, 1993;Build 21
+2 ;
TMCL(SCCLN,SCDATES,SCLIST,SCERR) ; -- list of teams for a clinic
+1 ; input:
+2 ; SCCLN = ien of HOSPITAL LOCATION <FILE#44> [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 patients who were assigned to
+8 ; team for entire date range
+9 ; 0: anytime in date range
+10 ; [default: 1]
+11 ; SCLIST -array name to store list
+12 ; [ex. ^TMP("SCPT",$J)]
+13 ;
+14 ; SCERR = array NAME to store error messages.
+15 ; [ex. ^TMP("ORXX",$J)]
+16 ;
+17 ; Output:
+18 ; SCLIST() = array of positions (includes SCTP xref)
+19 ; Format:
+20 ; Subscript: Sequential # from 1 to n
+21 ; Piece Description
+22 ; 1 IEN of Team #404.51
+23 ; 2 Team Name
+24 ; Subscript: "SCTP",SCTM,IEN =""
+25 ;
+26 ; SCERR() = Array of errors
+27 ; @SCERR@(0) = number of errors, undefined if none
+28 ; Format:
+29 ; Subscript: Sequential # from 1 to n
+30 ; Piece Description
+31 ; 1 error description
+32 ; Returned: 1 if ok, 0 if error
+33 ;
ST ;
+1 NEW OKAY,NODE,ENT,PCLIST,ERR2,CNT,TIEN
+2 IF '$DATA(SCCLN)!('$DATA(SCLIST))
SET @SCERR@(0)="undefined variables"
QUIT 0
+3 IF '$DATA(SCERR)
QUIT 0
+4 ;
+5 SET PCLIST="PCLST"
SET ERR2="ERROR2"
+6 SET OKAY=$$TPCL^SCAPMC30(SCCLN,.SCDATES,"","","","",.PCLIST,.ERR2)
+7 ; ^ positions for a clinic SCCLN
+8 IF 'OKAY
SET @SCERR@(0)="error in TPCL^SCAPMC30 call"
+9 IF 'OKAY
QUIT 0
+10 ;
+11 SET (CNT,ENT)=0
+12 FOR
SET ENT=$ORDER(@PCLIST@(ENT))
IF ENT=""!(ENT'?.N)
QUIT
Begin DoDot:1
+13 SET NODE=$GET(@PCLIST@(ENT))
+14 ;team ien
SET TIEN=+$PIECE(NODE,"^",3)
+15 IF $DATA(@SCLIST@("SCTP",TIEN))
QUIT
+16 ;unique entries only
+17 SET CNT=CNT+1
+18 ;team ien
SET @SCLIST@(CNT)=TIEN
+19 SET @SCLIST@("SCTP",TIEN,CNT)=""
+20 ;team name
SET $PIECE(@SCLIST@(CNT),"^",2)=$PIECE($GET(^SCTM(404.51,TIEN,0)),"^")
End DoDot:1
+21 SET @SCLIST@(0)=CNT
+22 QUIT 1