source: FOIAVistA/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOTPINA.m@ 847

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

initial load of FOIAVistA 6/30/08 version

File size: 2.0 KB
Line 
1PSOTPINA ;BIR/MR - Driver to Inactivate TPB patients ;12/01/03
2 ;;7.0;OUTPATIENT PHARMACY;**160,227**;DEC 1997
3 ;
4EN Q ;placed out of order by PSO*7*227
5 N PSOSDHL,PSOSDOE,TODAY,%,DIE,DA,DR,DO,PSOINA,X
6 ; - Patient not defined
7 I '$D(^DPT(+$G(DFN),0)) Q
8 ;
9 ; - Patient not in the TPB ELIGIBILITY file (#52.91)
10 I '$D(^PS(52.91,DFN)) Q
11 ;
12 ; - Patient TPB's Benefit is INACTIVE
13 I $$GET1^DIQ(52.91,DFN,2,"I") Q
14 ;
15 ; - At least ONE active TPB prescription found
16 I $$ACTRX^PSOTPCUL(DFN,1) Q
17 ;
18 ; - Checking the OUTPATIENT ENCOUNTER
19 S (PSOSDHL,PSOSDOE)="",PSOINA=0 D NOW^%DTC S TODAY=%\1
20 F S PSOSDHL=$O(^TMP("SDEVT",$J,PSOSDHL)) Q:'PSOSDHL D I PSOINA Q
21 . F S PSOSDOE=$O(^TMP("SDEVT",$J,PSOSDHL,1,"SDOE",PSOSDOE)) Q:'PSOSDOE D I PSOINA Q
22 . . ;
23 . . ; - Appointment is not CHECKED OUT
24 . . I $$UP^XLFSTR($TR($$GET1^DIQ(409.68,PSOSDOE,.12),"- "))'="CHECKEDOUT" Q
25 . . ;
26 . . ; - STOP CODE for the Encounter Location not TPB
27 . . I '$$TPBSC^PSOTPCUL($$GET1^DIQ(409.68,PSOSDOE,.04,"I")) Q
28 . . ;
29 . . ; Inactivate TPB benefits for the patient
30 . . S DIE=52.91,DA=DFN,DR="2///"_TODAY_";3///1" D ^DIE S PSOINA=1
31 . . ;
32 . . ; - Send Mailman Message about TPB inactivation for Patient
33 . . D MAIL(DFN,PSOSDOE)
34 ;
35 Q
36 ;
37MAIL(DFN,ENC) ; - Create/Send Mailman Message about Inactivation to
38 ; PSO TPB GROUP (Mail Group)
39 ;
40 N XMTEXT,XMDUZ,XMSUB,XMY,VADM,CNAM,PNAM,DAT,MSG,DIFROM,X
41 ;
42 D DEM^VADPT S PNAM=$P(VADM(1),"^")_" ("_$P($P(VADM(2),"^",2),"-",3)_")"
43 S DAT=$$GET1^DIQ(409.68,ENC,.01),CNAM=$$GET1^DIQ(409.68,ENC,.04)
44 ;
45 S XMDUZ="PHARMACY TPB SCHEDULING MONITOR"
46 D SXMY^PSOTPCUL("PSO TPB GROUP")
47 S XMSUB="TPB PATIENT BENEFIT INACTIVATION"
48 ;
49 S MSG(1)="The following patient had the TPB (Transitional Pharmacy Benefit) benefit"
50 S MSG(2)="automatically inactivated because the following appointment was found: "
51 S MSG(3)=" "
52 S MSG(4)=" Patient : "_PNAM
53 S MSG(5)=" VA Clinic : "_CNAM
54 S MSG(6)=" Appointment Date: "_DAT
55 ;
56 S XMTEXT="MSG(" D ^XMD
57 Q
Note: See TracBrowser for help on using the repository browser.