source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSORXVW2.m@ 1150

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

initial load of WorldVistAEHR

File size: 6.6 KB
RevLine 
[613]1PSORXVW2 ;ISC-BIRM/PDW - view cmop activity logs ;08 Dec 1999 12:48 PM
2 ;;7.0;OUTPATIENT PHARMACY;**33,71,117,152,148**;DEC 1997
3 ; External Referrence to file # 550.2 granted by DBIA 2231
4 ;External reference to ^PS(50.607 supported by DBIA 2221
5 ;External reference to ^PS(51.2 supported by DBIA 2226
6 ;External reference to File ^PS(55 supported by DBIA 2228
7 ;External reference to VA(200 supported by DBIA 10060
8 ;get data from event multiple
9 S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" "
10 S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)="CMOP Event Log:",IEN=IEN+1
11 S ^TMP("PSOAL",$J,IEN,0)="Date/Time Rx Ref TRN-Order Stat Comments",IEN=IEN+1,$P(^TMP("PSOAL",$J,IEN,0),"=",79)="="
12 F PSXA=0:0 S PSXA=$O(^PSRX(DA,4,PSXA)) Q:'PSXA S PSX4=^(PSXA,0) D FIX D
13 .S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=$$DATE(DA,$P(PSX4,"^",3))_" "_$S('PSXFIL:"Orig",1:"Ref "_$G(PSXFIL))_" "_$G(PSXBREF)
14 .S ^TMP("PSOAL",$J,IEN,0)=^TMP("PSOAL",$J,IEN,0)_" "_$G(PSXT)_" "_$S($G(PSXTST)=3:$E($P($G(PSXCAN),"^"),1,35),$G(PSXNDC)'="":"NDC: "_PSXNDC,1:"")
15 . I PSXCAR="",PSXID="" Q
16 . N X S X="Carrier: "_$E(PSXCAR,1,21)
17 . S X=$$SETSTR^VALM1("Pkg ID: ",X,32,8)
18 . S X=X_PSXID
19 . S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=X
20 D:$O(^PSRX(DA,5,0))
21 .S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" "
22 .S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)="CMOP Lot#/Expiration Date Log:",IEN=IEN+1
23 .S ^TMP("PSOAL",$J,IEN,0)="Rx Ref Lot # Expiration Date"
24 .S IEN=IEN+1,$P(^TMP("PSOAL",$J,IEN,0),"=",79)="="
25 .F PSXZ=0:0 S PSXZ=$O(^PSRX(DA,5,PSXZ)) Q:PSXZ']"" S PSXLOT=^(PSXZ,0) D
26 ..S EXPDT=$P(PSXLOT,U,2)
27 ..S EXPDT=$E(EXPDT,4,5)_"/"_$E(EXPDT,6,7)_"/"_$E(EXPDT,2,3)
28 ..S RXREF=$P(PSXLOT,U,3)
29 ..S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=$S(RXREF=0:"Orig",RXREF>0:"Ref "_RXREF,1:"")_" "_$P(PSXLOT,U)_" "_EXPDT
30FINI K ANS,Y,%,I,Z,PSXLOT,PSXL,PSX4,F,PSXA,C,ER,PSXFIL,PSX4,PSXREA,PSXVID
31 K PSXREL,PSXTRDT,PSXT,PSXLOC,DTOUT,DUOUT,PSXSEQ,PSXA,PSXML,P,I1,I2
32 K PSXP,PSXE,PSXE1,PSXERR,PSXBAT,ZD1,ZD2,ZDT,RXREF,PSXZ,PSXTST,PSXTCAN
33 K PSXRDT,PSXNDC,PSXM,PSXL1,PSXCAN,PSX1,EXPDT,PSXBREF,RXREF1
34 K PSXCAR,PSXID
35 Q
36FIX ; translate data
37 S PSXBAT=$P(PSX4,U),PSXSEQ=$P(PSX4,U,2)
38 S PSXFIL=$P(PSX4,U,3),PSXTST=$P(PSX4,U,4)
39 S PSXBREF=$G(PSXBAT)_"-"_$G(PSXSEQ)
40 S PSXZT=$P(PSX4,U,5),PSXZT1=$P(PSXZT,"."),PSXZT2=$P(PSXZT,".",2)
41 I $G(PSXZT)']"" K PSXZT,PSXZT1,PSXZT2 G F1
42 S PSXZT2=$E(PSXZT2,1,4)
43 S PSXZT1=$E(PSXZT1,4,5)_"/"_$E(PSXZT1,6,7)_"/"_$E(PSXZT1,2,3)
44 S PSXTCAN=PSXZT1_"@"_PSXZT2 K PSXZT1,PSXZT2,PSXZT
45F1 S PSXNDC=$P(PSX4,U,8)
46 S PSXCAN=$G(^PSRX(DA,4,PSXA,1))
47 S PSXCAR=$P(PSXCAN,U,3)
48 S PSXID=$P(PSXCAN,U,4)
49 ; get cmop site
50 S I1=PSXBAT ; S I1=$O(^PSX(550.2,"B",PSXBAT,""))
51P1 ; get transmission d/t
52 S ZDT=$P(^PSX(550.2,I1,0),U,6),ZD1=$P(ZDT,"."),ZD2=$P(ZDT,".",2)
53 S ZD2=$E(ZD2,1,4)
54 S ZD1=$E(ZD1,4,5)_"/"_$E(ZD1,6,7)_"/"_$E(ZD1,2,3)
55 S PSXTRDT=ZD1_"@"_ZD2
56Q1 S:PSXTST=0 PSXT="TRAN"
57 S PSXRDT="Not Released"
58 I PSXTST=1 D
59 .I PSXFIL>0,('$D(^PSRX(DA,1,PSXFIL,0))) S PSXT="Disp Refill Deleted" Q
60 .S PSX1=$S(PSXFIL=0:$P(^PSRX(DA,2),"^",13),1:$P(^PSRX(DA,1,PSXFIL,0),"^",18))
61 .Q:PSX1']""
62 .I PSX1'["." S PSXRDT=$E(PSX1,4,5)_"/"_$E(PSX1,6,7)_"/"_$E(PSX1,2,3) G SKIP
63 .S ZR=PSX1,ZR1=$P(ZR,"."),ZR2=$P(ZR,".",2)
64 .S ZR2=$E(ZR2,1,4)
65 .S PSXRDT=$E(ZR1,4,5)_"/"_$E(ZR1,6,7)_"/"_$E(ZR1,2,3)_"@"_ZR2
66 .K ZR,ZR1,ZR2
67SKIP .S PSXT="DISP"
68 S:PSXTST=2 PSXT="RTRN"
69 S:PSXTST=3 PSXT="NDISP"
70 Q
71 ;
72COPAY ;Copay activity log
73 S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" ",IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)="Copay Activity Log:"
74 S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)="# Date Reason Rx Ref Initiator Of Activity",IEN=IEN+1,$P(^TMP("PSOAL",$J,IEN,0),"=",79)="="
75 I '$O(^PSRX(DA,"COPAY",0)) S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)="There's NO Copay activity to report" Q
76 F N=0:0 S N=$O(^PSRX(DA,"COPAY",N)) Q:'N S P1=^(N,0),DTT=P1\1 D DAT^PSORXVW1 D
77 .S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=N_" "_DAT_" ",$P(RN," ",21)=" ",REA=$P(P1,"^",2),REA=$F("ARICE",REA)-1
78 .I REA D
79 ..S STA=$P("ANNUAL CAP REACHED^COPAY RESET^IB-INITIATED COPAY^REMOVE COPAY CHARGE^RX EDITED^","^",REA)
80 ..S ^TMP("PSOAL",$J,IEN,0)=^TMP("PSOAL",$J,IEN,0)_STA_$E(RN,$L(STA)+1,21)
81 .E S $P(STA," ",21)=" ",^TMP("PSOAL",$J,IEN,0)=^TMP("PSOAL",$J,IEN,0)_STA
82 .K STA,RN S $P(RN," ",15)=" ",RF=+$P(P1,"^",4)
83 .S RFT=$S(RF>0:"REFILL "_RF,1:"ORIGINAL")
84 .S ^TMP("PSOAL",$J,IEN,0)=^TMP("PSOAL",$J,IEN,0)_RFT_$E(RN,$L(RFT)+1,15)_$S($D(^VA(200,+$P(P1,"^",3),0)):$P(^(0),"^"),1:$P(P1,"^",3))
85 .S:$P(P1,"^",5)]""!($P(P1,"^",6)]"")!($P(P1,"^",7)]"") IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)="Comment: "_$P(P1,"^",5)
86 .I $P(P1,"^",6)]"" S ^TMP("PSOAL",$J,IEN,0)=^TMP("PSOAL",$J,IEN,0)_" Old value="_$P(P1,"^",6)_" New value="_$P(P1,"^",7)
87 Q
88DOSE ;displays dosing instruction for both simple and complex Rxs.
89 I '$O(^PSRX(DA,6,0)) S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" Dosage: " Q
90 F I=0:0 S I=$O(^PSRX(DA,6,I)) Q:'I S DOSE=^PSRX(DA,6,I,0) D DOSE1
91 K DOSE
92 Q
93DOSE1 ;
94 I '$P(DOSE,"^",2),$P(DOSE,"^",9)]"" S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" Verb: "_$P(DOSE,"^",9)
95 S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" *Dosage: "_$S($E($P(DOSE,"^"),1)="."&($P(DOSE,"^",2)):"0",1:"")_$P(DOSE,"^")_$S($P(DOSE,"^",3):$P(^PS(50.607,$P(DOSE,"^",3),0),"^"),1:"")
96 I '$P(DOSE,"^",2),$P($G(^PS(55,PSODFN,"LAN")),"^") S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" Oth. Lang. Dosage: "_$G(^PSRX(DA,6,I,1))
97 I $P(DOSE,"^",2),$P(DOSE,"^",9)]"" S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" Verb: "_$P(DOSE,"^",9)
98 I $P(DOSE,"^",2) S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" Dispense Units: "_$S($E($P(DOSE,"^",2),1)=".":"0",1:"")_$P(DOSE,"^",2)
99 I $P(DOSE,"^",2) S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" Noun: "_$P(DOSE,"^",4)
100 S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" *Route: "_$S($P(DOSE,"^",7):$P(^PS(51.2,$P(DOSE,"^",7),0),"^"),1:"")
101 S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" *Schedule: "_$P(DOSE,"^",8)
102 I $P(DOSE,"^",5)]"" S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" *Duration: "_$P(DOSE,"^",5)_" ("_$S($P(DOSE,"^",5)["M":"MINUTES",$P(DOSE,"^",5)["H":"HOURS",$P(DOSE,"^",5)["L":"MONTHS",$P(DOSE,"^",5)["W":"WEEKS",1:"DAYS")_")"
103 I $P(DOSE,"^",6)]"" S IEN=IEN+1,^TMP("PSOAL",$J,IEN,0)=" *Conjunction: "_$S($P(DOSE,"^",6)="A":"AND",$P(DOSE,"^",6)="T":"THEN",$P(DOSE,"^",6)="E":"EXCEPT",1:"")
104 Q
105 ;
106DATE(RX,RFL) ;
107 I $G(PSXTST)=3,$G(PSXTCAN)'="" Q PSXTCAN
108 I $G(PSXTST)=1 Q $G(PSXRDT)
109 I $G(PSXTST)=3,'RFL,$$GET1^DIQ(52,RX,32.1,"I") Q $$FMTE^XLFDT($$GET1^DIQ(52,RX,32.1,"I"),2)
110 I $G(PSXTST)=3,RFL,$$GET1^DIQ(52.1,RFL_","_RX,5,"I") Q $$FMTE^XLFDT($$GET1^DIQ(52.1,RFL_","_RX,32.1,"I"),2)
111 Q $G(PSXTRDT)
112 ;
113DAT S DAT="",DTT=DTT\1 Q:DTT'?7N S DAT=$E(DTT,4,5)_"/"_$E(DTT,6,7)_"/"_$E(DTT,2,3)
114 Q
Note: See TracBrowser for help on using the repository browser.