source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCMCTSK6.m@ 862

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

initial load of WorldVistAEHR

File size: 8.2 KB
Line 
1SCMCTSK6 ;ALB/JDS - PCMM Bulletins ; 7/19/05 10:04am
2 ;;5.3;Scheduling;**297**;AUG 13, 1993
3 Q
4MAKEMAIL(TYPE) ;
5 N PRE,IN
6 S ZERO=$G(^SCPT(404.43,+ENTRY,0)),ZERO1=$G(^SCPT(404.42,+ZERO,0))
7 S T=+$P(ZERO1,U,3),IN=$P($G(^SCTM(404.51,T,0)),U,7) S INSTNM=$$GET1^DIQ(4,(+IN)_",",.01)
8 I INSTNM'=DIV S DIV=INSTNM D
9 .S ^TMP("SCMCTXT",$J,CNT,0)=" "
10 .S ^TMP("SCMCTXT",$J,CNT+1,0)=" INSTITUTION: "_DIV,CNT=CNT+2
11 S PROV=$P($$GETPRTP^SCAPMCU2(+$P(ZERO,U,2),DT),U,2)
12 S PRE=$P($$OKPREC2^SCMCLK(+$P(ZERO,U,2),DT),U,2)
13 S A=$E($$NAME^SCMCQK1(+ZERO1)_$J("",30),1,20)_" "_$E($$GET1^DIQ(2,(+ZERO1)_",",.0905)_$J("",5),2,5)_" "
14 S A=A_$E(PROV_$J("",20),1,17)_" "_$E($E($$TEAMNM^SCMCQK1(+$P(ZERO1,U,3)),1,14)_$J("",20),1,15)
15 ;S A=A_" "_$E($$POSITION^SCMCQK1(+$P(ZERO,U,2))_$J("",20),1,20)
16 D INACTDT^SCMCTSK1(+ENTRY) S Y=X S:$G(TYPE)=2 Y=$P(ZERO,U,4),Y=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3),A=A_$E(Y_$J("",20),1,11)
17 I $G(TYPE)=3 S Y=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3) S A=A_" "_$E(Y_$J("",20),1,11)
18 I $G(TYPE)=1 S Y=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3) S A=A_" "_$E(Y_$J("",20),1,11)
19 I $G(TYPE)=2 S B=$P(ZERO,U,12),A=A_" "_$S(B="NA":"NO APPT",B="DU":"DECEASED",1:"Unknown")
20 S ^TMP("SCMCTXT",$J,CNT,0)=A
21 I PRE'=PROV I $L(PRE) S CNT=CNT+1,^TMP("SCMCTXT",$J,CNT,0)=$J("",26)_$E(PRE,1,17)
22 S CNT=CNT+1
23 Q
24MM(TYPE) ;for providers
25 N EXP
26 S Y=$P($G(^SCTM(404.44,1,1)),U,9)
27 S EXP=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3)
28 S ZERO=$G(^SCTM(404.52,+ENTRY,0)) N CLI
29 S TP=$G(^SCTM(404.57,+ZERO,0)) D MAIL^SCMCTSK5(+ZERO,+$P(TP,U,2)) S T=$P(TP,U,2)
30 S ^TMP("SCML",$J,"POS",+$P(ZERO,U,3))=""
31 S ^TMP("SCML",$J,"XM",+$P(ZERO,U,3),+ZERO)=""
32 I TYPE=5 S Y=$P(ZERO,U,2),EXP=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3)
33 S IN=$P($G(^SCTM(404.51,T,0)),U,7) S INSTNM=$$GET1^DIQ(4,(+IN)_",",.01)
34 I INSTNM'=DIV S DIV=INSTNM D
35 .S ^TMP("SCMCTXT",$J,CNT,0)=" "
36 .S ^TMP("SCMCTXT",$J,CNT+1,0)=" INSTITUTION: "_DIV,CNT=CNT+2
37 N I,CNT1 S CNT1=0
38 S ROLE=$P($G(^SD(403.46,+$P(TP,U,3),0)),U)
39 S PC=$P($$GET^XUA4A72(+$P(ZERO,U,3)),U,2)
40 I $G(^TMP("SCMCTXT",$J,3,0))["|POS|" S A=^(0),^(0)=$P(A,"|POS|")_$P(TP,U)_" ROLE: "_ROLE D
41 .S A=$G(^TMP("SCMCTXT",$J,5,0)),^(0)=$P(A,"|PC|")_PC
42 F I=0:0 S I=$O(^SCTM(404.57,+ZERO,5,I)) Q:'I S CLI(CNT1)=$P($G(^SC(I,0)),U),CNT1=CNT1+1
43 S A=$E($P($G(^VA(200,+$P(ZERO,U,3),0)),U)_$J("",20),1,14)_" "_$E($G(CLI(0))_$J("",10),1,9)
44 S A=A_" "_$E($P(TP,U)_$J("",20),1,10)_" "_$E(ROLE_$J("",20),1,14)
45 S A=A_" "_$E(PC_$J("",20),1,14)
46 S A=A_" "_$E($$PCPOSCNT^SCAPMCU1(+ZERO,DT,0)_$J("",9),1,4)_" "_EXP
47 S ^TMP("SCMCTXT",$J,CNT,0)=A
48 F I=1:1 Q:'$D(CLI(I)) I $L(CLI(I)) S CNT=CNT+1,^TMP("SCMCTXT",$J,CNT,0)=$J("",15)_$E(CLI(I),1,9)
49 S CNT=CNT+1
50 Q
51PRMAIL(TYPE) ;
52 ;Send mail to providers
53 N USER
54 F USER=0:0 S USER=$O(^TMP("SCML",$J,"XM",USER)) Q:'USER D
55 .F I=HEAD:0 S I=$O(^TMP("SCMCTXT",$J,I)) Q:'I K ^(I)
56 .I TYPE=5 D M5
57 .S CNT=HEAD,DIV=""
58 .F I=0:0 S I=$O(^TMP("SCMC",$J,I)) Q:'I S ENTRY=+$O(^(I,0)) D
59 ..S ZERO=$G(^SCPT(404.43,+ENTRY,0)),ZERO1=$G(^SCPT(404.42,+ZERO,0))
60 ..I TYPE>3 D Q
61 ...S ZERO=$G(^SCTM(404.52,+ENTRY,0))
62 ...I $D(^TMP("SCML",$J,"XM",USER,+ZERO)) D MM(TYPE)
63 ..I $D(^TMP("SCML",$J,"XM",USER,+$P(ZERO,U,2))) D MAKEMAIL(TYPE)
64 .I CNT=HEAD Q
65 .S XMY(USER)="",XMTEXT="^TMP(""SCMCTXT"",$J,"
66 .S XMSUB="Patients Scheduled for Inactivation from Primary Care Panel"
67 .I TYPE=3 S XMSUB="Patients With Extended PCMM Inactivation Date"
68 .I TYPE=2 S XMSUB="Patients Automated Inactivations from Primary Care Panels"
69 .I TYPE=4 S XMSUB="Primary Care Providers Scheduled for Inactivation"
70 .I TYPE=5 S XMSUB="Primary Care Providers Inactivated"
71 .D ^XMD
72 Q
73M5 ;Individual provider bulletin
74 Q:$G(^TMP("SCMCTXT",$J,1,0))["ATTENTION"
75 F I=1:1:CNT-1 Q:'$D(^TMP("SCMCTXT",$J,I)) S A=^(I,0),^TMP("SCMCTXT",$J,I+11,0)=A
76 F I=0:1:10 S A=$P($T(M6+I),";;",2),^TMP("SCMCTXT",$J,I+1,0)=A
77 S HEAD=HEAD+12
78 Q
79M6 ;;ATTENTION: You may be inactivated as Primary Care Staff in the computer program
80 ;;Primary Care Management Module (PCMM) VistA
81 ;;Your Primary Care position |POS| Role |ROLE|
82 ;;May not correspond to your Person Class of
83 ;;|PC|
84 ;;in VistA (file 200). Associate Primary Care Providers who provide Primary Care
85 ;;must be a Resident or Intern (Physician) a Nurse Practitioner or a Physician's
86 ;;Assistant. Primary Care Providers must be an Attending physician (MD or DO),
87 ;;Nurse Practitioner or a Physician's Assistant
88 ;;Please contact your PCMM Coordinator or information systems department if you
89 ;;do not think you should be inactivated in PCMM as a provider.
90 Q
91ACLIN ;Get sting of clinics in Alpha Order
92 S X=""
93 N A,I
94 F I=0:0 S I=$O(^SCTM(404.57,+$G(D0),5,I)) Q:'I S A=$P($G(^SC(I,0)),U) I $L(A) S A(A)=""
95 S A="" F S A=$O(A(A)) Q:A="" S X=X_$E(A,1,5)_U
96 S X=$P(X,U,1,$S(X[U:$L(X,U)-1,1:1))
97 Q
98BULL ;
99 N FLDS
100 S DISUPNO=1
101 K ^TMP("SCMC",$J),^TMP("SCMCTXT",$J),^TMP("SCML",$J),XMY
102 S XMY("G.PCMM PATIENT/PROVIDER INACTIVE")=""
103 S XMTEXT="^TMP(""SCMCTXT"",$J,"
104 S DIC="^SCTM(404.52,",BY="[SCMC PROVIDER INACTIVATED]",DHIT="S CNT=$G(CNT)+1,^TMP(""SCMC"",$J,CNT,D0)=""""",CNT=0
105 S FLDS="",IOP="",DHD="@@",FR="",TO="" D EN1^DIP
106 S XMSUB="Primary Care Providers Inactivated"
107 D LINES^SCMCTSK5(5)
108 D ^XMD
109 D PRMAIL^SCMCTSK5(5)
110 Q
111FTERPT ;FTEE REPORT
112 D PROMPT^SCMCTSK3("DIRECT PC FTEE-PANEL SIZE")
113 Q:'$D(^TMP("SC",$J,"XR"))
114 ;D FLAGG^SCMCTSK3
115 S Q=""""
116 S DIC="^SCTM(404.52,",L=0
117 D FTEE
118 S (SCDHD,DHD)="DIRECT PC FTEE AND PANEL SIZE REPORT"
119 D BY^SCMCTSK2
120 S DIOBEG="D DIOBEG^SCMCTSK4"
121 S FLDS="[SCMC DIRECT PC FTEE]"
122 I $D(^TMP("SC",$J,"SCLIN")) S FLDS="[SCMC DIRECT PC FTEE 1 CLN]"
123 S DIOEND="D DIOEND^SCMCTSK7"
124 D EN1^DIP
125 Q
126FTEE ;Sort FLAGGED
127 K ^TMP("SCSORT",$J)
128 N I,A,J
129 I '$D(^TMP("SC",$J,"SORT",1)) S ^(1)="DV^INSTITUTION^SCDIV",SORTN="INSTITUTION",^(2)="TM^TEAM^SCTEAM",^(3)="PR^PROVIDER^SCPROV"
130 N SORT S A="" F S A=$O(^TMP("SC",$J,A)) Q:A="" I "XRSORTDTR"'[A I $G(^(A))'="ALL" S SORT($S(A="ASPR":"PR",A="CLINIC":"EC",A="DIV":"DV",A="POS":"TP",1:"TM"))=""
131 F I=0:0 S I=$O(^SCTM(404.52,"AIDT",I)) Q:'I S K=$O(^SCTM(404.52,"AIDT",I,1,-9999999)) I K D
132 .I $O(^SCTM(404.52,"AIDT",I,0,K),-1) Q ;inactive
133 .S J=$O(^SCTM(404.52,"AIDT",I,1,K,0)) Q:'J
134 .D SORT(0)
135 Q
136SORT(INACTIVE) ;
137 N A,B,C,D,E,QUIT,SCA,K,KCNT
138 S ZERO=$G(^SCTM(404.52,+J,0))
139 S QUIT=0,KCNT=0
140 F K=1:1 Q:'$D(^TMP("SC",$J,"SORT",K)) S A=^(K) K SORT($P(A,U)) S @("A("_K_")=$$"_$P(A,U)_"("_J_")") D I (A(K)=-1)!($P(A(K),U)="") S QUIT=1 Q
141 .I ($P(A,U)="EC")!($P(A,U)="AC") D
142 ..I $L(A(K),U)>2 S KCNT=K
143 ..N I F I=1:1:$L(A(K),U)-1 S ^TMP("SC",$J,"SCLIN",+ZERO,$P(A(K),U,I))=""
144 Q:QUIT
145 S A="" F S A=$O(SORT(A)) Q:A="" S @("B=$$"_A_"("_J_")") I B=-1 S QUIT=1 Q
146 Q:QUIT
147 F PIECE=1:1:$S(KCNT:$L(A(KCNT),U)-1,1:1) D
148 .S B="E" K @B
149 .F K=1:1:$O(A(99),-1) S @B@($P(A(K),U,$S(K=KCNT:PIECE,1:1)))="" S C=$Q(@B) K @B S B=C
150 .S @B@(J)=""
151 .M ^TMP("SCSORT",$J)=E
152 Q
153DV(PP) ;return institution sort of patient assignment entry and then IEN of team^ien of position
154 N A,B,C,T,I,INSTNM,INSTN
155 S T=+$P($G(^SCTM(404.57,+ZERO,0)),U,2) I $D(INST(T)) Q INST(T)_U_T_U_(+ZERO)
156 S I=+$P($G(^SCTM(404.51,T,0)),U,7) I $O(^TMP("SC",$J,"DIV",0)) I '$D(^TMP("SC",$J,"DIV",I)) Q -1
157 S INSTNM=$$GET1^DIQ(4,(+I)_",",.01),INSTN=$$GET1^DIQ(4,(+I)_",",99)
158 S INST(T)=$S($L(INSTN)=3:INSTN_" ",1:"")_INSTNM Q INST(T)_U_T_U_(+ZERO)
159EC(PP) Q $$AC(PP)
160AC(PP) ;return enrolled clinics
161 N I,A
162 S A=""
163 F I=0:0 S I=$O(^SCTM(404.57,+ZERO,5,I)) Q:'I D
164 .;I '$$PTCL^SCRPO2(DFN,U_I,0,DT) Q ;not enrolled
165 .I $D(CLIN(I)) S A=A_CLIN(I)_U Q
166 .I $O(^TMP("SC",$J,"CLINIC",0)) I '$D(^(I)) Q
167 .S CLIN(I)=$P($G(^SC(I,0)),U) I $L(CLIN(I)) S A=A_CLIN(I)_U
168 Q $S(A="":-1,1:A)
169TM(PP) ;Return Team
170 N I,A,T
171 S T=+$P($G(^SCTM(404.57,+ZERO,0)),U,2)
172 I $D(TEAM(T)) Q TEAM(T)
173 I $O(^TMP("SC",$J,"TEAM",0)) I '$D(^(T)) Q -1
174 S TEAM(T)=$P($G(^SCTM(404.51,+T,0)),U)
175 I '$L(TEAM(T)) K TEAM(T) Q -1
176 Q TEAM(T)
177TP(A) ;return the team position
178 N TP S TP=+ZERO
179 I $O(^TMP("SC",$J,"POS",0)) I '$D(^(TP)) Q -1
180 Q $P($G(^SCTM(404.57,+TP,0)),U)
181PR(PP) ;Return assigned provider
182 N A
183 I $O(^TMP("SC",$J,"ASPR",0)) I '$D(^(+$P(ZERO,U,3))) Q -1
184 S A=$$GET1^DIQ(200,(+$P(ZERO,U,3))_",",.01) Q $S(A="":-1,1:A)
185 Q
186PCP(D0) ;PCP or AP
187 N TP,A S TP=+$G(^SCTM(404.52,D0,0))
188 S A=$O(^SCTM(404.53,"AIDT",TP,1,0),-1) I 'A Q "PCP"
189 I $O(^SCTM(404.53,"AIDT",TP,0,A),-1) Q "PCP"
190 Q "AP"
191CLN(D0) ;sorted by clinic get next one
192 N A S A=$O(^TMP("SC",$J,"SCLIN",D0,"")) Q:A=""
193 N I F I=0:0 S I=$O(^SC("B",A,I)) Q:'I I $D(^SCTM(404.57,D0,5,I)) Q
194 Q:'I
195 S DIPA("NUM")="`"_I K ^TMP("SC",$J,"SCLIN",D0,A)
Note: See TracBrowser for help on using the repository browser.