source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SCMCRT1.m@ 642

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

initial load of FOIAVistA 6/30/08 version

File size: 3.6 KB
Line 
1SCMCRT1 ;ALB/SCK - TEAM PROFILE REPORT ; 10/30/95
2 ;;5.3;Scheduling;**41**;AUG 13, 1993
3 ;;1T1;Primary Care Management Module
4 ;
5 ; Routine for collecting Team information for the
6 ; Team Profile report
7 ;
8START(SCTS,SCPS,SCTEAMS,SCBRK) ;
9 ; SCTS = Team Status
10 ; SCPS = Positon status
11 ; SCBRK = Page break as team changes
12 ;
13 ; Status values:
14 ; 1 Show active only
15 ; 0 Show inactive only
16 ; -1 Show all
17 ; 10 Selected Teams
18 ;
19 ; SCTEAMS = List of teams to print
20 ;
21 N SCTM,SCTMIEN,SCI,SCDTRNG,SCERMSG,SCRTN
22 K ^TMP("PCMTP")
23 S SCDTRNG=""
24 ;
25 IF $G(SCTS)=10,$G(SCTEAMS)=0 D G CONT
26 . S SCTM=""
27 . F S SCTM=$O(SCTEAMS(SCTM)) Q:SCTM="" D
28 .. D BLD(SCTM)
29 ;
30 S SCTM=""
31 F S SCTM=$O(^SCTM(404.51,"B",SCTM)) Q:SCTM="" D
32 . S SCTMIEN="",SCTMIEN=$O(^SCTM(404.51,"B",SCTM,SCTMIEN))
33 . Q:'$$TEAMOK(SCTS,SCTMIEN)
34 . D BLD(SCTMIEN)
35 ;
36CONT ;
37 D TMRPT^SCMCRT1A(SCBRK)
38 Q
39 ;
40TEAMOK(SCACT,SCIEN) ; function to check teams current status against
41 ; the requested status
42 ;
43 ; SCACT - See status values above
44 ; SCIEN - IEN value for the team in 404.51
45 ;
46 ; Returns 0 if team does not meet requested status,
47 ; 1 if team does meet the requested status.
48 ;
49 ;
50 N SCRTN,SCOK,SCER
51 S SCOK=1
52 G:SCACT<0 TEAMOKQ
53 IF '+$$ACTHIST^SCAPMCU1(404.58,SCIEN,"SCDTRNG","SCER") S SCOK=0
54TEAMOKQ Q (SCOK)
55 ;
56POSTOK(SCPACT,SCIEN) ; function to check a positions current status against
57 ; against the requested status
58 ;
59 ; SCPACT - See status values above
60 ; SCIEN - Ien value for the position in the 404.57 file
61 ;
62 ; Returns 0 if position does not meet requested status
63 ; 1 if position does meet the status
64 ;
65 N SCOK,SCER
66 S SCOK=1
67 G:SCPACT<0 POSTOKQ
68 IF '+$$ACTHIST^SCAPMCU1(404.59,SCIEN,"SCDTRNG","SCER") S SCOK=0
69POSTOKQ Q (SCOK)
70 ;
71BLD(SCIEN) ; Build entry for the team profile in ^TMP("PCMTP",$J)
72 ;
73 ; Team information is on the zero node. The format is the same
74 ; as for the zero node in file #404.51
75 ;
76 ; The team description (WP field nodes) are on the "D" node.
77 ; The teams positions are on individual "P" nodes, by name.
78 ; Format is position ien^standard role (external)^primary care^
79 ; max patients allowed^active status.
80 ;
81 N SCTNODE,II,SCPNODE,SCPIEN
82 S SCTNODE=$G(^SCTM(404.51,SCIEN,0))
83 Q:$D(SCTNODE)=0
84 ;
85 ; Loop thru all the teams in file 404.51 and build the zero node
86 ; for the requested teams
87 ;
88 S ^TMP("PCMTP",$J,SCIEN,0)=SCTNODE
89 IF $D(^SCTM(404.51,SCIEN,"D")) D
90 . S II=0
91 . F S II=$O(^SCTM(404.51,SCIEN,"D",II)) Q:II="" D
92 .. S ^TMP("PCMTP",$J,SCIEN,"D",II)=$G(^SCTM(404.51,SCIEN,"D",II,0))
93 ;
94 ; For each team, loop thru all the team positions, and build
95 ; nodes for each position that matches the requested status
96 ;
97 S SCPIEN=""
98 F S SCPIEN=$O(^SCTM(404.57,"C",SCIEN,SCPIEN)) Q:SCPIEN="" D
99 . Q:'$$POSTOK(SCPS,SCPIEN)
100 . S SCPNODE=$G(^SCTM(404.57,SCPIEN,0))
101 . S ^TMP("PCMTP",$J,SCIEN,"P",$P(SCPNODE,U))=SCPIEN_"^"_$$ROLE($P(SCPNODE,U,3))_"^"_$$CARE($P(SCPNODE,U,4))_"^"_+$P(SCPNODE,U,8)_"^"_$$ACTPOS(SCPIEN)
102 ;
103 IF $D(^TMP("PCMTP",$J,SCIEN,"P"))=0 S ^TMP("PCMTP",$J,SCIEN,"P","NO POSITIONS")=""
104 Q
105 ;
106ACTPOS(SCIEN) ; Returns the active status of the position for the
107 ; date range of the report.
108 ;
109 N SCSTAT,SCER
110 S SCTAT=$$ACTHIST^SCAPMCU1(404.59,SCIEN,"SCDTRNG","SCER")
111 Q +SCTAT
112 ;
113ROLE(SCIEN) ; Returns the standard role for a position in external format
114 ;
115 N SCROLE
116 S SCROLE="NO STANDARD ROLE"
117 G:$G(SCIEN)="" ROLEQ
118 S SCROLE=$P($G(^SD(403.46,SCIEN,0)),U)
119ROLEQ Q SCROLE
120 ;
121CARE(SCC) ; Returns Yes if the position can provide primary care, No
122 ; if the position cannot.
123 ;
124 N STAT
125 S STAT="NO"
126 S:SCC=1 STAT="YES"
127CAREQ Q STAT
128 ;
129QSTART ;
130 D START(SCTMS,SCPOS,.SCTEAMS,SCBRK)
131 Q
Note: See TracBrowser for help on using the repository browser.