| 1 | SCAPMC16 ;ALB/CMM - TEAM/CLINIC APIs ;03/19/96 | 
|---|
| 2 | ;;5.3;Scheduling;**41**;AUG 13, 1993 | 
|---|
| 3 | ; | 
|---|
| 4 | TMCL(SCCLN,SCDATES,SCLIST,SCERR) ;  -- list of teams for a clinic | 
|---|
| 5 | ; input: | 
|---|
| 6 | ; SCCLN = ien of HOSPITAL LOCATION <FILE#44> [required] | 
|---|
| 7 | ; SCDATES("BEGIN") = begin date to search (inclusive) | 
|---|
| 8 | ;                      [default: TODAY] | 
|---|
| 9 | ;        ("END")   = end date to search (inclusive) | 
|---|
| 10 | ;                      [default: TODAY] | 
|---|
| 11 | ;        ("INCL")  = 1: only use patients who were assigned to | 
|---|
| 12 | ;                       team for entire date range | 
|---|
| 13 | ;                    0: anytime in date range | 
|---|
| 14 | ;                      [default: 1] | 
|---|
| 15 | ;  SCLIST -array name to store list | 
|---|
| 16 | ;          [ex. ^TMP("SCPT",$J)] | 
|---|
| 17 | ; | 
|---|
| 18 | ;  SCERR = array NAME to store error messages. | 
|---|
| 19 | ;          [ex. ^TMP("ORXX",$J)] | 
|---|
| 20 | ; | 
|---|
| 21 | ; Output: | 
|---|
| 22 | ;  SCLIST() = array of positions (includes SCTP xref) | 
|---|
| 23 | ;             Format: | 
|---|
| 24 | ;               Subscript: Sequential # from 1 to n | 
|---|
| 25 | ;               Piece     Description | 
|---|
| 26 | ;                 1       IEN of Team #404.51 | 
|---|
| 27 | ;                 2       Team Name | 
|---|
| 28 | ;                Subscript: "SCTP",SCTM,IEN ="" | 
|---|
| 29 | ; | 
|---|
| 30 | ;  SCERR() = Array of errors | 
|---|
| 31 | ;  @SCERR@(0) = number of errors, undefined if none | 
|---|
| 32 | ;             Format: | 
|---|
| 33 | ;               Subscript: Sequential # from 1 to n | 
|---|
| 34 | ;               Piece     Description | 
|---|
| 35 | ;                 1       error description | 
|---|
| 36 | ;  Returned: 1 if ok, 0 if error | 
|---|
| 37 | ; | 
|---|
| 38 | ST ; | 
|---|
| 39 | N OKAY,NODE,ENT,PCLIST,ERR2,CNT,TIEN | 
|---|
| 40 | I '$D(SCCLN)!('$D(SCLIST)) S @SCERR@(0)="undefined variables" Q 0 | 
|---|
| 41 | I '$D(SCERR) Q 0 | 
|---|
| 42 | ; | 
|---|
| 43 | S PCLIST="PCLST",ERR2="ERROR2" | 
|---|
| 44 | S OKAY=$$TPCL^SCAPMC30(SCCLN,.SCDATES,"","","","",.PCLIST,.ERR2) | 
|---|
| 45 | ;  ^ positions for a clinic SCCLN | 
|---|
| 46 | I 'OKAY S @SCERR@(0)="error in TPCL^SCAPMC30 call" | 
|---|
| 47 | Q:'OKAY 0 | 
|---|
| 48 | ; | 
|---|
| 49 | S (CNT,ENT)=0 | 
|---|
| 50 | F  S ENT=$O(@PCLIST@(ENT)) Q:ENT=""!(ENT'?.N)  D | 
|---|
| 51 | .S NODE=$G(@PCLIST@(ENT)) | 
|---|
| 52 | .S TIEN=+$P(NODE,"^",3) ;team ien | 
|---|
| 53 | .I $D(@SCLIST@("SCTP",TIEN)) Q | 
|---|
| 54 | .;unique entries only | 
|---|
| 55 | .S CNT=CNT+1 | 
|---|
| 56 | .S @SCLIST@(CNT)=TIEN ;team ien | 
|---|
| 57 | .S @SCLIST@("SCTP",TIEN,CNT)="" | 
|---|
| 58 | .S $P(@SCLIST@(CNT),"^",2)=$P($G(^SCTM(404.51,TIEN,0)),"^") ;team name | 
|---|
| 59 | S @SCLIST@(0)=CNT | 
|---|
| 60 | Q 1 | 
|---|