source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCAPMCA.m@ 1078

Last change on this file since 1078 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 5.6 KB
RevLine 
[613]1SCAPMCA ;BP-CIOFO/KEITH - API to return all patient assignment information ;7/8/99 18:16
2 ;;5.3;Scheduling;**177**;AUG 13, 1993
3 ;
4GETALL(DFN,SCDT,SCARR) ;Get all assignment information
5 ;Input: DFN=patient ifn
6 ;Input: SCDT=date range and "include" values (optional) where
7 ; SCDT("BEGIN")=begin date
8 ; SCDT("END")=end date
9 ; SCDT("INCL")='1' for assignments active during entire date
10 ; range, '0' for assignments active at any time
11 ; during date range.
12 ; ***If undefined, "BEGIN" and "END" = DT, "INCL" = 0
13 ; SCARR=name of array to return data (default ^TMP("SC",$J,...)
14 ;
15 ;Output: '0' for error, '1' otherwise
16 ;Output: array returned in SCARR in hierarchical format (returned only
17 ; if assignments exist)
18 ;
19 ; @SCARR@(DFN,"TM",a,b)=team data
20 ; @SCARR@(DFN,"TM",a,b,"POS",c)=position data
21 ; @SCARR@(DFN,"TM",a,b,"POS",c,"PROV",d)=provider data
22 ; @SCARR@(DFN,"TM",a,b,"POS",c,"PPOS",e)=preceptor position data
23 ; @SCARR@(DFN,"TM",a,b,"POS",c,"PPOS",e,"PPROV",f)=preceptor
24 ; provider data
25 ;
26 ; where: a = TEAM file (#404.51) ifn
27 ; b = PATIENT TEAM ASSIGNMENT file (#404.42) ifn
28 ; c = PATIENT TEAM POSITION ASSIGNMENT file (#404.43) ifn
29 ; d = POSITION ASSIGNMENT HISTORY file (#404.52) ifn
30 ; e = TEAM POSITION file (#404.57) ifn
31 ; f = POSITION ASSIGNMENT HISTORY file (#404.52) ifn
32 ;
33 ;Output: array returned in SCARR in "flat" format (the zeroeth nodes
34 ; of this array are always returned -- equal to zero if no
35 ; assignments exist.
36 ;
37 ; @SCARR@(DFN,"NPCPOS",0)=non-PC position count
38 ; @SCARR@(DFN,"NPCPOS",n)=non-PC position data
39 ; @SCARR@(DFN,"NPCPPOS",0)=non-PC preceptor position count
40 ; @SCARR@(DFN,"NPCPPOS",n)=non-PC preceptor position data
41 ; @SCARR@(DFN,"NPCPPR",0)=non-PC preceptor provider count
42 ; @SCARR@(DFN,"NPCPPR",n)=non-PC preceptor provider data
43 ; @SCARR@(DFN,"NPCPR",0)=non-PC provider count
44 ; @SCARR@(DFN,"NPCPR",n)=non-PC provider data
45 ; @SCARR@(DFN,"NPCTM",0)=non-PC team count
46 ; @SCARR@(DFN,"NPCTM",n)=non-PC team data
47 ; @SCARR@(DFN,"PCAP",0)=PC associate provider count
48 ; @SCARR@(DFN,"PCAP",n)=PC associate provider data
49 ; @SCARR@(DFN,"PCPOS",0)=PC position count
50 ; @SCARR@(DFN,"PCPOS",n)=PC position data
51 ; @SCARR@(DFN,"PCPPOS",0)=PC preceptor position count
52 ; @SCARR@(DFN,"PCPPOS",n)=PC preceptor position data
53 ; @SCARR@(DFN,"PCPR",0)=PC provider count
54 ; @SCARR@(DFN,"PCPR",n)=PC provider data
55 ; @SCARR@(DFN,"PCTM",0)=PC team count
56 ; @SCARR@(DFN,"PCTM",n)=PC team data
57 ;
58 ; where: n = incrementing number 1 to 'n'.
59 ;
60 ; --output array data strings--
61 ;
62 ; Team information data:
63 ;
64 ; Piece Description
65 ; 1 IEN of TEAM file entry
66 ; 2 Name of team
67 ; 3 IEN of file #404.42 (Pt Tm Assignment)
68 ; 4 current effective date
69 ; 5 current inactivate date (if any)
70 ; 6 pointer to 403.47 (purpose)
71 ; 7 Name of Purpose
72 ; 8 Is this the pt's PC Team?
73 ;
74 ; Position information data:
75 ;
76 ; Piece Description
77 ; 1 IEN of TEAM POSITION File (#404.57)
78 ; 2 Name of Position
79 ; 3 IEN of Team #404.51
80 ; 4 IEN of file #404.43 (Pt Tm Pos Assign)
81 ; 5 current effective date
82 ; 6 current inactivate date (if any)
83 ; 7 pointer to 403.46 (role)
84 ; 8 Name of Standard Role
85 ; 9 pointer to User Class (#8930)
86 ; 10 Name of User Class
87 ; 11 Pointer to patient team assignment (404.42)
88 ;
89 ; Provider information data:
90 ;
91 ; Piece Description
92 ; 1 IEN of NEW PERSON file entry (#200)
93 ; 2 Name of person
94 ; 3 IEN of TEAM POSITION file (#404.57)
95 ; 4 Name of Position
96 ; 5 IEN OF USR CLASS(#8930) of POSITION(#404.57)
97 ; 6 USR Class Name
98 ; 7 IEN of STANDARD POSITION (#403.46)
99 ; 8 Standard Role (Position) Name
100 ; 9 Activation Date for 404.52 (not 404.59!)
101 ; 10 Inactivation Date for 404.52
102 ; 11 IEN of Position Ass History (404.52)
103 ; 12 IEN of Preceptor Position
104 ; 13 Name of Preceptor Position
105 ;
106 ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107 ;
108SETUP N SCI,SCX,SCRATCH1,SCADT,SCIDT,SCII,SCIII,SCPAH,SCPCPOSF,SCPCTF
109 N SCPOS,SCPOSD,SCPOSPRC,SCPPOS,SCPPOS0,SCPPOSD,SCPPROVD,SCPRD
110 N SCPROVD,SCPTA,SCPTPA,SCRATCH2,SCSUB,SCTM,SCTMD,SCPOSPDT,SCPTPA0
111 Q:'$D(^DPT(DFN,0)) 0
112 I '$D(SCDT("BEGIN")),$D(SCDT("END")) S SCDT("BEGIN")=SCDT("END")
113 I '$D(SCDT("END")),$D(SCDT("BEGIN")) S SCDT("END")=SCDT("BEGIN")
114 I '$D(SCDT("BEGIN"))&'$D(SCDT("END")) S (SCDT("BEGIN"),SCDT("END"))=DT
115 S SCX=SCDT("BEGIN") I SCX>SCDT("END") S SCDT("BEGIN")=SCDT("END"),SCDT("END")=SCX
116 S SCDT="SCDT"
117 I $L($G(SCDT("INCL")))'=1!("01"'[$G(SCDT("INCL"))) S SCDT("INCL")=0
118 I '$L($G(SCARR)) S SCARR="^TMP(""SC"",$J)" K @SCARR@(DFN)
119 S SCX="NPCPOS^NPCPPOS^NPCPPR^NPCPR^NPCTM^PCAP^PCPOS^PCPPOS^PCPR^PCTM"
120 F SCI=1:1:10 S @SCARR@(DFN,$P(SCX,U,SCI),0)=0 ;initialize flat array
121 S SCRATCH1="^TMP(""SCRATCH1"",$J)" K @SCRATCH1
122 S SCRATCH2="^TMP(""SCRATCH2"",$J)" K @SCRATCH2
123 D GETDAT^SCAPMCA1
124 K ^TMP("SCRATCH1",$J),^TMP("SCRATCH2",$J)
125 Q 1
Note: See TracBrowser for help on using the repository browser.