| [613] | 1 | SCUTBK4 ;ALB/JLU;BROKER UTILITIES
 | 
|---|
 | 2 |  ;;5.3;Scheduling;**148,157**;AUG 13, 1993
 | 
|---|
 | 3 | ACTPOS(RESULTS,SCARY) ;
 | 
|---|
 | 4 |  ;
 | 
|---|
 | 5 |  ;This broker entry point returns an array of active positions for a
 | 
|---|
 | 6 |  ;patient on a specific team.
 | 
|---|
 | 7 |  ;
 | 
|---|
 | 8 |  ;INPUTS         SCARY - Contains the following subscripted elements
 | 
|---|
 | 9 |  ;               DFN - DFN of the patient.
 | 
|---|
 | 10 |  ;               BEGIN - The beginning date range.
 | 
|---|
 | 11 |  ;               END - The ending date range.
 | 
|---|
 | 12 |  ;               TEAM - The team associated with the patient.
 | 
|---|
 | 13 |  ;
 | 
|---|
 | 14 |  ;OUTPUTS        RESULTS - The array of active positions.  The following
 | 
|---|
 | 15 |  ;               is a description of the piece structure.
 | 
|---|
 | 16 |  ;               PIECE - Description
 | 
|---|
 | 17 |  ;                 1     IEN of TEAM POSITION FILE(#404.57)
 | 
|---|
 | 18 |  ;                 2     NAME of Position
 | 
|---|
 | 19 |  ;                 3     Current effective date
 | 
|---|
 | 20 |  ;                 4     Pointer to role (403.46)
 | 
|---|
 | 21 |  ;                 5     Name of Standard role
 | 
|---|
 | 22 |  ;                 6     Pointer to User Class
 | 
|---|
 | 23 |  ;                 7     Name of User Class
 | 
|---|
 | 24 |  ;                 8     IEN of 404.43
 | 
|---|
 | 25 |  ;
 | 
|---|
 | 26 |  N SCOK,SCDT,SCDFN,SCTEAM,SCPOS,LP,CNT,SCERR
 | 
|---|
 | 27 |  ;
 | 
|---|
 | 28 |  D CHK^SCUTBK
 | 
|---|
 | 29 |  D TMP^SCUTBK
 | 
|---|
 | 30 |  ;
 | 
|---|
 | 31 |  D PARSE(.SCARY) ;parse array for inputs
 | 
|---|
 | 32 |  K ^TMP($J,"ACTLST")
 | 
|---|
 | 33 |  ;gets a list o positions for this patient
 | 
|---|
 | 34 |  S SCOK=$$TPPT^SCAPMC(SCDFN,.SCDT,"","","","","","SCPOS","SCBKERR")
 | 
|---|
 | 35 |  I 'SCOK G EXIT
 | 
|---|
 | 36 |  S CNT=1
 | 
|---|
 | 37 |  ;
 | 
|---|
 | 38 |  ;loop through positions only getting the ones associated with the team
 | 
|---|
 | 39 |  ;and that are active.
 | 
|---|
 | 40 |  ;
 | 
|---|
 | 41 |  F LP=0:0 S LP=$O(SCPOS(LP)) Q:'LP  DO
 | 
|---|
 | 42 |  .I $P(SCPOS(LP),U,3)'=SCTEAM Q
 | 
|---|
 | 43 |  .I $P(SCPOS(LP),U,6)]"" Q
 | 
|---|
 | 44 |  .S ^TMP($J,"ACTLST",CNT)=$P(SCPOS(LP),U,1)_U_$P(SCPOS(LP),U,2)_U_$P(SCPOS(LP),U,5)_U_$P(SCPOS(LP),U,7)_U_$P(SCPOS(LP),U,8)_U_$P(SCPOS(LP),U,9)_U_$P(SCPOS(LP),U,10)_U_$P(SCPOS(LP),U,4)
 | 
|---|
 | 45 |  .S CNT=CNT+1
 | 
|---|
 | 46 |  .Q
 | 
|---|
 | 47 |  ;
 | 
|---|
 | 48 | EXIT S RESULTS=$NA(^TMP($J,"ACTLST"))
 | 
|---|
 | 49 |  Q
 | 
|---|
 | 50 |  ;
 | 
|---|
 | 51 | PARSE(ARY) ;parses the input parameters from the broker.
 | 
|---|
 | 52 |  ;
 | 
|---|
 | 53 |  S SCDFN=$G(ARY("DFN"))
 | 
|---|
 | 54 |  S SCDT("BEGIN")=$G(ARY("BEGIN"))
 | 
|---|
 | 55 |  S SCDT("END")=$G(ARY("END"))
 | 
|---|
 | 56 |  S SCTEAM=$G(ARY("TEAM"))
 | 
|---|
 | 57 |  Q
 | 
|---|
 | 58 |  ;
 | 
|---|
 | 59 | PARIEN(RESULT) ;returns the ien for 404.91
 | 
|---|
 | 60 |  ;used by SCMC GET PARAMETER IEN (rpc)
 | 
|---|
 | 61 |  ;
 | 
|---|
 | 62 |  N RES
 | 
|---|
 | 63 |  S RES=$O(^SD(404.91,0))
 | 
|---|
 | 64 |  S RESULT=$S(RES="":0,1:+RES)
 | 
|---|
 | 65 |  Q
 | 
|---|