source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOP288R.m@ 1766

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

initial load of WorldVistAEHR

File size: 2.4 KB
Line 
1PSOP288R ;REPORT FOR PATCH PSO*7.0*288
2 ;;7.0;OUTPATIENT PHARMACY;**288**;DEC 2007;Build 17
3 ;External reference to File ^PS(55 supported by DBIA 2228
4 ;External reference to File ^DPT supported by DBIA 10035
5 ;External reference to File ^SC supported by DBIA 10040
6 ;
7 ;FIND ERRONEOUS RECORDS IN THE PHARMACY PATIENT FILE (#55) AND ALLOW THE USER TO CLEAN THEM UP
8 ;
9EN W !!,"CREATING REPORT...",!
10 S ZTRTN="QUEUE^PSOP288R",ZTDESC="Erroneous Non-VA Meds Records Report",ZTIO="" D ^%ZTLOAD K IO("Q")
11 Q
12QUEUE N PSOPAT,PSONVA,PSONVA0,PSODRG,PSOI,PSOSPC,PSOPATDB,PSOTXT,PSOTEXT,XMY,XMTEXT,XMSUB,XMDUZ,PSOPATI,X,X1,X2,PSOLOC,PSODIV,PSODIVN
13 S PSOSPC="",PSODIVN=""
14 F PSOI=1:1:20 S $E(PSOSPC,PSOI)=" "
15 K ^XTMP("PSOP288") S X1=DT,X2=+90 D C^%DTC S ^XTMP("PSOP288",0)=$G(X)_U_DT_"^Erroneous Pharmacy Pateint File (#55) Non-VA Meds records"
16 S PSOPAT=0 F S PSOPAT=$O(^PS(55,PSOPAT)) Q:'PSOPAT D
17 .S PSONVA=0 F S PSONVA=$O(^PS(55,PSOPAT,"NVA",PSONVA)) Q:'PSONVA D
18 ..S PSONVA0=$G(^PS(55,PSOPAT,"NVA",PSONVA,0))
19 ..I $P(PSONVA0,"^",10)]"",$P(PSONVA0,"^",11)]"" Q
20 ..S PSOLOC=$P(PSONVA0,"^",12) I PSOLOC S PSODIV=$P(^SC(PSOLOC,0),"^",15) I PSODIV]"" S PSODIVN=$P($G(^DG(40.8,PSODIV,0)),"^")
21 ..S:PSODIVN="" PSODIVN="UNKNOWN"
22 ..S PSODRG=+PSONVA0
23 ..S ^XTMP("PSOP288",PSODIVN,PSOPAT,PSONVA)=PSODRG_U_$P($G(^PS(50.7,PSODRG,0)),"^")
24REP ;CREATE REPORT - SEND TO USER
25 S XMY(DUZ)=""
26 S XMDUZ=.5,XMSUB="ERRONEOUS NON-VA MEDS RECORDS IN PHARMACY PATIENT FILE"
27 ;
28 S PSOTXT=1
29 S PSOTEXT(PSOTXT)="REPORT OF ERRONEOUS PHARMACY PATIENT FILE (#55) NON-VA MEDS RECORDS"
30 S PSODIVN=0 F S PSODIVN=$O(^XTMP("PSOP288",PSODIVN)) Q:PSODIVN="" D
31 .S PSOTXT=PSOTXT+1
32 .S PSOTEXT(PSOTXT)=""
33 .S PSOTEXT(PSOTXT+1)="DIVISION: "_PSODIVN
34 .S PSOTEXT(PSOTXT+2)=""
35 .S PSOTXT=PSOTXT+2
36 .S PSOTEXT(PSOTXT)="IEN - PATIENT NAME",PSOTXT=PSOTXT+1
37 .S PSOTEXT(PSOTXT)=$E(PSOSPC,1,3)_"DRUG IEN - DRUG NAME",PSOTXT=PSOTXT+1
38 .S PSOTEXT(PSOTXT)="",PSOTXT=PSOTXT+1
39 .S PSOPAT=0 F S PSOPAT=$O(^XTMP("PSOP288",PSODIVN,PSOPAT)) Q:'PSOPAT D
40 ..S PSOPATI=$G(^DPT(PSOPAT,0))
41 ..S PSOTEXT(PSOTXT)=PSOPAT_" - "_$P(PSOPATI,U)
42 ..S PSOTXT=PSOTXT+1
43 ..S PSONVA=0 F S PSONVA=$O(^XTMP("PSOP288",PSODIVN,PSOPAT,PSONVA)) Q:'PSONVA D
44 ...S PSONVA0=$G(^PS(55,PSOPAT,"NVA",PSONVA,0))
45 ...S PSODRG=+PSONVA0
46 ...S PSOTEXT(PSOTXT)=$E(PSOSPC,1,3)_$P(PSONVA0,U)_" - "_$P($G(^PS(50.7,PSODRG,0)),U)
47 ...S PSOTXT=PSOTXT+1
48 I PSOTXT=1 S PSOTEXT(PSOTXT+1)="",PSOTEXT(PSOTXT+2)="NO ERRONEOUS ENTRIES FOUND"
49 S XMTEXT="PSOTEXT(" N DIFROM D ^XMD K XMDUZ,XMTEXT,XMSUB
50 Q
Note: See TracBrowser for help on using the repository browser.