Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SCAPMCA

SCAPMCA.m

Go to the documentation of this file.
  1. SCAPMCA ;BP-CIOFO/KEITH - API to return all patient assignment information ;7/8/99 18:16
  1. ;;5.3;Scheduling;**177**;AUG 13, 1993
  1. ;
  1. GETALL(DFN,SCDT,SCARR) ;Get all assignment information
  1. ;Input: DFN=patient ifn
  1. ;Input: SCDT=date range and "include" values (optional) where
  1. ; SCDT("BEGIN")=begin date
  1. ; SCDT("END")=end date
  1. ; SCDT("INCL")='1' for assignments active during entire date
  1. ; range, '0' for assignments active at any time
  1. ; during date range.
  1. ; ***If undefined, "BEGIN" and "END" = DT, "INCL" = 0
  1. ; SCARR=name of array to return data (default ^TMP("SC",$J,...)
  1. ;
  1. ;Output: '0' for error, '1' otherwise
  1. ;Output: array returned in SCARR in hierarchical format (returned only
  1. ; if assignments exist)
  1. ;
  1. ; @SCARR@(DFN,"TM",a,b)=team data
  1. ; @SCARR@(DFN,"TM",a,b,"POS",c)=position data
  1. ; @SCARR@(DFN,"TM",a,b,"POS",c,"PROV",d)=provider data
  1. ; @SCARR@(DFN,"TM",a,b,"POS",c,"PPOS",e)=preceptor position data
  1. ; @SCARR@(DFN,"TM",a,b,"POS",c,"PPOS",e,"PPROV",f)=preceptor
  1. ; provider data
  1. ;
  1. ; where: a = TEAM file (#404.51) ifn
  1. ; b = PATIENT TEAM ASSIGNMENT file (#404.42) ifn
  1. ; c = PATIENT TEAM POSITION ASSIGNMENT file (#404.43) ifn
  1. ; d = POSITION ASSIGNMENT HISTORY file (#404.52) ifn
  1. ; e = TEAM POSITION file (#404.57) ifn
  1. ; f = POSITION ASSIGNMENT HISTORY file (#404.52) ifn
  1. ;
  1. ;Output: array returned in SCARR in "flat" format (the zeroeth nodes
  1. ; of this array are always returned -- equal to zero if no
  1. ; assignments exist.
  1. ;
  1. ; @SCARR@(DFN,"NPCPOS",0)=non-PC position count
  1. ; @SCARR@(DFN,"NPCPOS",n)=non-PC position data
  1. ; @SCARR@(DFN,"NPCPPOS",0)=non-PC preceptor position count
  1. ; @SCARR@(DFN,"NPCPPOS",n)=non-PC preceptor position data
  1. ; @SCARR@(DFN,"NPCPPR",0)=non-PC preceptor provider count
  1. ; @SCARR@(DFN,"NPCPPR",n)=non-PC preceptor provider data
  1. ; @SCARR@(DFN,"NPCPR",0)=non-PC provider count
  1. ; @SCARR@(DFN,"NPCPR",n)=non-PC provider data
  1. ; @SCARR@(DFN,"NPCTM",0)=non-PC team count
  1. ; @SCARR@(DFN,"NPCTM",n)=non-PC team data
  1. ; @SCARR@(DFN,"PCAP",0)=PC associate provider count
  1. ; @SCARR@(DFN,"PCAP",n)=PC associate provider data
  1. ; @SCARR@(DFN,"PCPOS",0)=PC position count
  1. ; @SCARR@(DFN,"PCPOS",n)=PC position data
  1. ; @SCARR@(DFN,"PCPPOS",0)=PC preceptor position count
  1. ; @SCARR@(DFN,"PCPPOS",n)=PC preceptor position data
  1. ; @SCARR@(DFN,"PCPR",0)=PC provider count
  1. ; @SCARR@(DFN,"PCPR",n)=PC provider data
  1. ; @SCARR@(DFN,"PCTM",0)=PC team count
  1. ; @SCARR@(DFN,"PCTM",n)=PC team data
  1. ;
  1. ; where: n = incrementing number 1 to 'n'.
  1. ;
  1. ; --output array data strings--
  1. ;
  1. ; Team information data:
  1. ;
  1. ; Piece Description
  1. ; 1 IEN of TEAM file entry
  1. ; 2 Name of team
  1. ; 3 IEN of file #404.42 (Pt Tm Assignment)
  1. ; 4 current effective date
  1. ; 5 current inactivate date (if any)
  1. ; 6 pointer to 403.47 (purpose)
  1. ; 7 Name of Purpose
  1. ; 8 Is this the pt's PC Team?
  1. ;
  1. ; Position information data:
  1. ;
  1. ; Piece Description
  1. ; 1 IEN of TEAM POSITION File (#404.57)
  1. ; 2 Name of Position
  1. ; 3 IEN of Team #404.51
  1. ; 4 IEN of file #404.43 (Pt Tm Pos Assign)
  1. ; 5 current effective date
  1. ; 6 current inactivate date (if any)
  1. ; 7 pointer to 403.46 (role)
  1. ; 8 Name of Standard Role
  1. ; 9 pointer to User Class (#8930)
  1. ; 10 Name of User Class
  1. ; 11 Pointer to patient team assignment (404.42)
  1. ;
  1. ; Provider information data:
  1. ;
  1. ; Piece Description
  1. ; 1 IEN of NEW PERSON file entry (#200)
  1. ; 2 Name of person
  1. ; 3 IEN of TEAM POSITION file (#404.57)
  1. ; 4 Name of Position
  1. ; 5 IEN OF USR CLASS(#8930) of POSITION(#404.57)
  1. ; 6 USR Class Name
  1. ; 7 IEN of STANDARD POSITION (#403.46)
  1. ; 8 Standard Role (Position) Name
  1. ; 9 Activation Date for 404.52 (not 404.59!)
  1. ; 10 Inactivation Date for 404.52
  1. ; 11 IEN of Position Ass History (404.52)
  1. ; 12 IEN of Preceptor Position
  1. ; 13 Name of Preceptor Position
  1. ;
  1. ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1. ;
  1. SETUP N SCI,SCX,SCRATCH1,SCADT,SCIDT,SCII,SCIII,SCPAH,SCPCPOSF,SCPCTF
  1. N SCPOS,SCPOSD,SCPOSPRC,SCPPOS,SCPPOS0,SCPPOSD,SCPPROVD,SCPRD
  1. N SCPROVD,SCPTA,SCPTPA,SCRATCH2,SCSUB,SCTM,SCTMD,SCPOSPDT,SCPTPA0
  1. Q:'$D(^DPT(DFN,0)) 0
  1. I '$D(SCDT("BEGIN")),$D(SCDT("END")) S SCDT("BEGIN")=SCDT("END")
  1. I '$D(SCDT("END")),$D(SCDT("BEGIN")) S SCDT("END")=SCDT("BEGIN")
  1. I '$D(SCDT("BEGIN"))&'$D(SCDT("END")) S (SCDT("BEGIN"),SCDT("END"))=DT
  1. S SCX=SCDT("BEGIN") I SCX>SCDT("END") S SCDT("BEGIN")=SCDT("END"),SCDT("END")=SCX
  1. S SCDT="SCDT"
  1. I $L($G(SCDT("INCL")))'=1!("01"'[$G(SCDT("INCL"))) S SCDT("INCL")=0
  1. I '$L($G(SCARR)) S SCARR="^TMP(""SC"",$J)" K @SCARR@(DFN)
  1. S SCX="NPCPOS^NPCPPOS^NPCPPR^NPCPR^NPCTM^PCAP^PCPOS^PCPPOS^PCPR^PCTM"
  1. F SCI=1:1:10 S @SCARR@(DFN,$P(SCX,U,SCI),0)=0 ;initialize flat array
  1. S SCRATCH1="^TMP(""SCRATCH1"",$J)" K @SCRATCH1
  1. S SCRATCH2="^TMP(""SCRATCH2"",$J)" K @SCRATCH2
  1. D GETDAT^SCAPMCA1
  1. K ^TMP("SCRATCH1",$J),^TMP("SCRATCH2",$J)
  1. Q 1