source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSONEW2.m@ 1154

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

revised back to 6/30/08 version

File size: 6.0 KB
Line 
1PSONEW2 ;BIR/DSD - displays new rx information for edit ;7/17/06 6:59pm
2 ;;7.0;OUTPATIENT PHARMACY;**32,37,46,71,94,124,139,157,143,226,237,239**;DEC 1997
3 ;External reference to ^PSDRUG supported by DBIA 221
4 ;External reference to ^DPT supported by DBIA 10035
5 ;External reference to PSOUL^PSSLOCK supported by DBIA 2789
6 ;External reference VADPT supported by DBIA 10061
7 ; This routine displays the entered new rx information and
8 ; asks if correct, if not allows editing of the data.
9 ;------------------------------------------------------------
10 ;PSO*237 issue expired error message
11 ;
12START ;
13 S (PSONEW("DFLG"),PSONEW2("QFLG"))=0
14 D STOP
15 D DISPLAY ; Displays information
16 ;Copay exemption checks
17 D SCP^PSORN52D
18 S PSONEWFF=1,PSOFLAG=1 K PSOANSQ,PSOANSQD S PSOCPZ("DFLG")=0,PSONEW("NEWCOPAY")=0
19 ;can't check PSOSCA for <50 here because of PSOBILL check in PSOCPB
20 I (PSOSCP<50&($P($G(^PS(53,+$G(PSONEW("PATIENT STATUS")),0)),"^",7)'=1)),$G(DUZ("AG"))="V" D COPAY^PSOCPB W !
21 I PSOSCA&(PSOSCP>49)!((PSOSCA!(PSOBILL=2))&($P($G(^PS(53,+$G(PSONEW("PATIENT STATUS")),0)),"^",7)=1))!(PSOSCP>49&(PSOBILL=2)) D SC^PSOMLLD2
22 I $G(PSOCPZ("DFLG")) K PSONEWFF,PSOANSQD,PSOCPZ("DFLG"),PSONEW("NEWCOPAY") S DIRUT="",PSONEW("DFLG")=1 D ASKX G END
23 ;IF MILL BILL, AND COPAY (*******TEST THE COPAY CHECK)
24 I $$DT^PSOMLLDT D I $G(PSOCPZ("DFLG")) K PSONEWFF,PSOANSQD,PSOANSQ,PSOCPZ("DFLG"),PSONEW("NEWCOPAY") S DIRUT="",PSONEW("DFLG")=1 D ASKX G END
25 .;New prompts Quit after first '^'
26 .I $D(PSOIBQS(PSODFN,"CV")) D CV^PSOMLLDT I $G(PSOCPZ("DFLG"))!($G(PSOANSQ("CV"))) K PSONEW("NEWCOPAY")
27 .I $D(PSOIBQS(PSODFN,"VEH")) D VEH^PSOMLLDT I $G(PSOCPZ("DFLG"))!($G(PSOANSQ("VEH"))) K PSONEW("NEWCOPAY")
28 .I $D(PSOIBQS(PSODFN,"RAD")) D RAD^PSOMLLDT I $G(PSOCPZ("DFLG"))!($G(PSOANSQ("RAD"))) K PSONEW("NEWCOPAY")
29 .I $D(PSOIBQS(PSODFN,"PGW")) D PGW^PSOMLLDT I $G(PSOCPZ("DFLG"))!($G(PSOANSQ("PGW"))) K PSONEW("NEWCOPAY")
30 .I $D(PSOIBQS(PSODFN,"MST")) D MST^PSOMLLDT I $G(PSOCPZ("DFLG"))!($G(PSOANSQ("MST"))) K PSONEW("NEWCOPAY")
31 .I $D(PSOIBQS(PSODFN,"HNC")) D HNC^PSOMLLDT I $G(PSOCPZ("DFLG"))!($G(PSOANSQ("HNC"))) K PSONEW("NEWCOPAY")
32 K PSOCPZ("DFLG"),PSONEWFF
33 D ASK K:$G(PSONEW("DFLG")) PSOANSQ G:PSONEW2("QFLG")!PSONEW("DFLG") END
34 S PSORX("EDIT")=1 D EN^PSOORNE1(.PSONEW),FULL^VALM1 G:$G(PSORX("FN")) END I '$G(PSORX("FN")) S PSONEW("DFLG")=1 K PSOANSQ G END ;D EDIT
35 G:'$G(PSONEW("DFLG")) START
36 S PSONEW("QFLG")=1,PSONEW("DFLG")=0
37END D EOJ
38 Q
39 ;------------------------------------------------------------
40STOP K PSEXDT,X,%DT S PSON52("QFLG")=0
41 S X1=PSOID,X2=PSONEW("DAYS SUPPLY")*(PSONEW("# OF REFILLS")+1)\1
42 S X2=$S(PSONEW("DAYS SUPPLY")=X2:X2,+$G(PSONEW("CS")):184,1:366)
43 I X2<30 D
44 . N % S %=$P($G(PSORX("PATIENT STATUS")),"^"),X2=30
45 . S:%?.N %=$P($G(^PS(53,+%,0)),"^") I %["AUTH ABS" S X2=5
46 D C^%DTC I PSONEW("FILL DATE")>$P(X,".") S PSEXDT=1_"^"_$P(X,".")
47 K X1,X2,X,%DT
48 Q
49DISPLAY ;
50 W !!,"Rx # ",PSONEW("RX #")
51 W ?23,$E(PSONEW("FILL DATE"),4,5),"/",$E(PSONEW("FILL DATE"),6,7),"/",$E(PSONEW("FILL DATE"),2,3),!,$G(PSORX("NAME")),?30,"#",PSONEW("QTY")
52 I $G(SIGOK),$O(SIG(0)) D K D G TRN
53 .F D=0:0 S D=$O(SIG(D)) W !,SIG(D) Q:'$O(SIG(D))
54 E S X=PSONEW("SIG") D SIGONE^PSOHELP W !,$G(INS1)
55TRN ;I $G(PSOPRC) F I=0:0 S I=$O(PRC(I)) Q:'I W !,PRC(I)
56 W !!,$S($G(PSODRUG("TRADE NAME"))]"":PSODRUG("TRADE NAME"),1:PSODRUG("NAME"))
57 W !,PSONEW("PROVIDER NAME"),?25,PSORX("CLERK CODE"),!,"# of Refills: ",PSONEW("# OF REFILLS"),!
58 Q
59 ;
60ASK ;
61 K DIR,X,Y S DIR("A")="Is this correct"
62 S DIR(0)="Y",DIR("B")="YES" D ^DIR K DIR I $D(DIRUT) S PSONEW("DFLG")=1 G ASKX
63ASK1 I Y D S PSONEW2("QFLG")=1
64 .S:$G(PSONEW("MAIL/WINDOW"))["W" BINGCRT=Y,BINGRTE="W"
65 .D:+$G(PSEXDT)
66 ..S Y=PSONEW("FILL DATE") X ^DD("DD") W !!,$C(7),Y_" fill date is greater than possible expiration date of " S Y=$P(PSEXDT,"^",2) X ^DD("DD") W Y_"."
67 .D DCORD K RORD,^TMP("PSORXDC",$J)
68ASKX I $D(DIRUT) D
69 .I +$G(PSEXDT) K DIRUT S (PSONEW2("QFLG"),PSONEW2("DFLG"),PSONEW("DFLG"),Y)=1
70 K X,Y,DIRUT,DTOUT,DUOUT
71 D:+$G(PSEXDT) PAUSE^VALM1
72 Q
73DCORD ;dc rxs and pending orders after new order is entered
74 F RORD=0:0 S RORD=$O(^TMP("PSORXDC",$J,RORD)) Q:'RORD D @$S($P(^TMP("PSORXDC",$J,RORD,0),"^")="P":"PEN",1:"RX52")
75 K RORD
76 Q
77PEN ;pending ^tmp("psorxdc",$j,rord,0)="p^"_rord_"^"_msg
78 S $P(^PS(52.41,RORD,0),"^",3)="DC",^PS(52.41,RORD,4)=$P(^TMP("PSORXDC",$J,RORD,0),"^",3)
79 K ^PS(52.41,"AOR",PSODFN,+$P($G(^PS(52.41,RORD,"INI")),"^"),RORD)
80 D EN^PSOHLSN($P(^PS(52.41,RORD,0),"^"),"OC",$P(^TMP("PSORXDC",$J,RORD,0),"^",3),"D") W $C(7),!," -Pending Order was discontinued..."
81 D PSOUL^PSSLOCK(RORD_"S") K ^TMP("PSORXDC",$J,RORD,0)
82 Q
83RX52 ;rxs in file 52 ^tmp("psorxdc",$j,rord,0)=52^rord^msg^rea^act^sta^dnm
84 S PSCAN($P(^PSRX(RORD,0),"^"))=RORD_"^"_$P(^TMP("PSORXDC",$J,RORD,0),"^",4)
85 S MSG=$P(^TMP("PSORXDC",$J,RORD,0),"^",3),REA=$P(^(0),"^",4),ACT=$P(^(0),"^",5)
86 N PSONOOR S PSONOOR="D",DUP=1,DA=RORD D CAN^PSOCAN K PSONOOR
87 W !," -Rx "_$P(^PSRX(RORD,0),"^")_" has been discontinued...",!
88 K PSOSD($P(^TMP("PSORXDC",$J,RORD,0),"^",6),$P(^TMP("PSORXDC",$J,RORD,0),"^",7))
89 D PSOUL^PSSLOCK(RORD) K ^TMP("PSORXDC",$J,RORD,0)
90 Q
91 ;
92EDIT ;
93 S PSORX("EDIT")=1
94 D ^PSONEW3
95 S PSONEW("DFLG")=$S($G(PSORX("DFLG")):1,1:0)
96 Q
97 ;
98EOJ ;
99 K PSONEW2,PSORX("EDIT"),PSORX("DFLG"),PSOEDIT,PSOSCA
100 Q
101 ;
102EN1(PSONEW2) ; Entry point to just display and ask if okay
103 S PSONEW("DFLG")=0
104 I $G(^PSRX(PSONEW2("IRXN"),0))']"" S PSONEW("DFLG")=1 G EN1X
105 S PSOX=^PSRX(PSONEW2("IRXN"),0),PSONEW("TRADE NAME")=$G(^("TN")),PSONEW("FILL DATE")=$P($G(^(2)),"^",2)
106 S PSONEW("RX #")=$P(PSOX,"^"),PSORX("NAME")=$P(^DPT($P(PSOX,"^",2),0),"^")
107 S PSONEW("QTY")=$P(PSOX,"^",7),PSODRUG("NAME")=$P(^PSDRUG($P(PSOX,"^",6),0),"^"),PSONEW("# OF REFILLS")=$P(PSOX,"^",9)
108 S PSORX("CLERK CODE")=$P(^VA(200,$P(PSOX,"^",16),0),"^")
109 S:$G(PSONEW("PROVIDER NAME"))="" PSONEW("PROVIDER NAME")=$P(^VA(200,$P(PSOX,"^",4),0),"^")
110 S PSONEW("SIG")=$P($G(^PSRX(PSONEW2("IRXN"),"SIG")),"^")
111 D DISPLAY
112 D ASK
113 I PSONEW("DFLG")=1 S PSONEW2("DFLG")=1
114EN1X ;
115 Q
116 ;
117EXPR ;Display Expired error message ;PSO*237
118 S PSONEW("DFLG")=1
119 W $C(7)
120 S VALMSG="Order is older than 365 days and can't be finished"
121 S XQORM("B")="DC"
122 Q
Note: See TracBrowser for help on using the repository browser.