source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCRPV1.m@ 1582

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

initial load of WorldVistAEHR

File size: 5.6 KB
Line 
1SCRPV1 ; bp/djb - PCMM Inconsistency Rpt - Main ; 8/25/99 9:52am
2 ;;5.3;Scheduling;**177**;AUG 13, 1993
3 ;
4 ;This routine is part of Patch 177 (PCMM Phase II). It prompts for
5 ;those Team and Position Assignments to be validated according to
6 ;the business rules that have been established for PCMM and the
7 ;relationship between Associate Provider and Preceptor.
8 ;
9 ;See tag IEN to include 404.43 IEN in printout.
10 ;
11EN ;
12 NEW QUIT,RESULT,SCMODE,SCPOS,SCTM,SCTYPE
13TOP ;
14 KILL SCMODE,SCTM,SCTYPE
15 S QUIT=0
16 ;
17 ;Get teams to include in report.
18 S SCTYPE("TM")=$$ASKTM() G:SCTYPE("TM")=0 EXIT
19 I SCTYPE("TM")="S" D GETTM G:SCTM=0 TOP
20 ;
21 ;Get MODE: Brief/Detail
22 I SCTYPE("TM")'="I" S SCMODE=$$ASKMODE() G:SCMODE=0 TOP
23 ;
24 S RESULT=$$DEVICE()
25 ;
26EXIT ; Cleanup and Exit
27 Q
28 ;
29RUN ;Gather the data and print the report.
30 ;
31 KILL ^TMP("PCMM PATIENT",$J)
32 KILL ^TMP("PCMM POSITION",$J)
33 ;
34 I SCTYPE("TM")="I" D LIST^SCRPV1B1 Q
35 I '$D(ZTQUEUED),'(IOST["P-"&(IOST["MESSAGE")) W "Please wait..."
36 ;
37 D ^SCRPV1A ;............Gather data
38 D ^SCRPV1B ;............Print report
39 ;
40 KILL ^TMP("PCMM PATIENT",$J)
41 KILL ^TMP("PCMM POSITION",$J)
42 Q
43 ;
44DEVICE() ; Select output device.
45 NEW POP,SCX,ZTDESC,ZTRTN,ZTSAVE
46 NEW %XX,%ZHFN,QUE
47 ;
48 W ! I SCTYPE("TM")'="I" D ;
49 . W !,"This report may take a long time to run."
50 . W !,"Queuing is recommended.",!
51 ;
52 S ZTRTN="RUN^SCRPV1"
53 S ZTDESC="PCMM Inconsistency Report"
54 S ZTSAVE("SC*")=""
55 S ZTSAVE("SCTYPE(")=""
56 S ZTSAVE("SCTM(")=""
57 D EN^XUTMDEVQ(ZTRTN,ZTDESC,.ZTSAVE)
58 Q POP
59 ;
60ASKTM() ; Ask user to select teams.
61 ; A = All Teams
62 ; S = Select Teams
63 ; Return: 0,A, or S.
64 ;
65 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
66 NEW COL,LINE
67 ;
68 S $P(LINE,"-",IOM)=""
69 S COL=(IOM/2-12)
70 W @IOF,!?COL,"PCMM INCONSISTENCY REPORT"
71 W !,LINE
72 W !!,"T E A M S"
73 S DIR(0)="SMO^A:All Teams;S:Specific Teams;I:Inconsistency Descriptions"
74 S DIR("A")=" Select TEAMS"
75 S DIR("?")="Select I for a list of inconsistency descriptions"
76 S DIR("?",1)="Select A for a report of All Teams"
77 S DIR("?",2)="Select S for a report of Specific Teams"
78 D ^DIR
79 Q $S($D(DIRUT):0,1:Y)
80 ;
81GETTM ;Allow the user to select multiple teams.
82 ;Set up SCTM array in format:
83 ; SCTM(TeamName,TeamIEN)=""
84 ;
85 NEW CNT,ND,TMI,TMN
86 NEW %,%Y,%Y1,C,DDH,X,SCESEQ,SCLSEQ,SCN
87 ;
88 KILL SCTM
89 S SCTM=0
90 F W ! S TMI=$$TEAM^SCMCMU(DT) Q:TMI<0 D ;
91 . S ND=$G(^SCTM(404.51,TMI,0))
92 . S TMN=$P(ND,U,1)
93 . Q:TMN']""
94 . Q:$D(SCTM(TMI))
95 . S SCTM(TMI)=""
96 . S SCTM=SCTM+1
97 Q
98 ;
99ASKMODE() ; Which report type to run: BRIEF or DETAIL.
100 ; B = Brief
101 ; DP = Detailed by PATIENT
102 ; DT = Detailed by TEAM
103 ; Return: 0,B, or D.
104 ;
105 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
106 ;
107 W !!,"R E P O R T T Y P E"
108 S DIR(0)="SMO^B:Brief;DP:Detailed by PATIENT;DT:Detailed by TEAM"
109 S DIR("A")=" Select REPORT TYPE"
110 S DIR("B")="DP"
111 S DIR("?")="Select DT for a detailed report by team"
112 S DIR("?",1)="Select B for a brief summary report"
113 S DIR("?",2)="Select DP for a detailed report by patient"
114 D ^DIR
115 Q $S($D(DIRUT):0,1:Y)
116 ;
117IEN ;Call here to include the 404.43 IEN on the right side of the
118 ;printout for all type 8 inconsistencies. You can use this number
119 ;to find the problem entry in Fileman. This feature only works
120 ;with the DP print option.
121 ;
122 NEW SCIEN
123 S SCIEN=1
124 G EN
125 ;
126MAIL(SCDUZ) ; Queue report as a MailMan Message.
127 NEW CNT,QUIT,RESULT,SCTYPE
128 NEW XMY,XMDUZ,XMSUB,XMTEXT
129 ;
130 KILL ^TMP("PCMM PATIENT",$J)
131 KILL ^TMP("PCMM POSITION",$J)
132 KILL ^TMP("SCMSG",$J)
133 ;
134 S CNT=1
135 D SET("This message was automatically generated by PCMM patch SD*5.3*177.")
136 ;
137 S SCTYPE("TM")="A" ;All Teams & Positions
138 D ^SCRPV1A ;..Gather data
139 D MAILPOS ;...Build position inconsistency array
140 D MAILPT ;....Build patient inconsistency array
141 ;
142 S XMDUZ=.5
143 S XMY(XMDUZ)=""
144 I $G(SCDUZ) S XMY(SCDUZ)=""
145 S XMSUB="PCMM INCONSISTENCY REPORT"
146 S XMTEXT="^TMP(""SCMSG"",$J,"
147 D ^XMD
148 ;
149 KILL ^TMP("PCMM PATIENT",$J)
150 KILL ^TMP("PCMM POSITION",$J)
151 KILL ^TMP("SCMSG",$J)
152 Q
153MAILPOS ;Print POSITION error counts only.
154 NEW ERROR,NUM,NUM1,POS,TM,TXT
155 ;
156 S NUM=0
157 F S NUM=$O(^TMP("PCMM POSITION",$J,NUM)) Q:'NUM D ;
158 . S TM=""
159 . F S TM=$O(^TMP("PCMM POSITION",$J,NUM,TM)) Q:TM="" D ;
160 .. S POS=""
161 .. F S POS=$O(^TMP("PCMM POSITION",$J,NUM,TM,POS)) Q:POS="" D ;
162 ... S ERROR(NUM\1)=($G(ERROR(NUM\1))+1)
163 ;
164 D SET(" ")
165 D SET("POSITION INCONSISTENCIES")
166 D SET("------------------------")
167 D SET(" ")
168 I '$D(^TMP("PCMM POSITION",$J)) D Q
169 . D SET("No inconsistencies found.")
170 ;
171 D SET("Total teams/positions per inconsistency type:")
172 S NUM=0
173 F S NUM=$O(ERROR(NUM)) Q:'NUM D ;
174 . S NUM1=(NUM\1)
175 . S TXT=$T(TXT+NUM1^SCRPV1B)
176 . ;W !?3,$P(TXT,";",3)_". "
177 . S TXT=$P(TXT,";",4)
178 . I TXT["[]" D ;
179 .. S TXT=$P(TXT,"[]",1)_"Team Assign/Team/Position"_$P(TXT,"[]",2)
180 . D SET(TXT_" - "_ERROR(NUM1))
181 Q
182 ;
183MAILPT ;Print PATIENT error counts only.
184 NEW DFN,DFNNAM,ERROR,NUM
185 ;
186 S DFNNAM=""
187 F S DFNNAM=$O(^TMP("PCMM PATIENT",$J,DFNNAM)) Q:DFNNAM="" D ;
188 . S DFN=0
189 . F S DFN=$O(^TMP("PCMM PATIENT",$J,DFNNAM,DFN)) Q:'DFN D ;
190 .. S NUM=0
191 .. F S NUM=$O(^TMP("PCMM PATIENT",$J,DFNNAM,DFN,NUM)) Q:'NUM D ;
192 ... S ERROR("PT",NUM\1)=($G(ERROR("PT",NUM\1))+1)
193 ;
194 D SET(" ")
195 D SET("PATIENT INCONSISTENCIES")
196 D SET("-----------------------")
197 D SET(" ")
198 I '$D(^TMP("PCMM PATIENT",$J)) D Q
199 . D SET("No inconsistencies found.")
200 ;
201 D SET("Total patients per inconsistency type:")
202 S NUM=0
203 F S NUM=$O(ERROR("PT",NUM)) Q:'NUM D ;
204 . S NUM=NUM\1
205 . S TXT=$T(TXT+NUM^SCRPV1B)
206 . ;W !?3,$P(TXT,";",3)_". "
207 . S TXT=$P(TXT,";",4)
208 . I TXT["[]" D ;
209 .. S TXT=$P(TXT,"[]",1)_"Team Assign/Team/Position"_$P(TXT,"[]",2)
210 . D SET(TXT_" - "_ERROR("PT",NUM))
211 Q
212 ;
213SET(TXT) ;Build message array
214 S ^TMP("SCMSG",$J,CNT)=TXT
215 S CNT=CNT+1
216 Q
Note: See TracBrowser for help on using the repository browser.