source: FOIAVistA/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOORNE6.m@ 1446

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

initial load of FOIAVistA 6/30/08 version

File size: 7.0 KB
Line 
1PSOORNE6 ;ISC-BHAM/SAB-display orders from backdoor ;5/23/05 2:08pm
2 ;;7.0;OUTPATIENT PHARMACY;**46,103,117,156,210**;DEC 1997
3 ;External reference to MAIN^TIUEDIT is supported by DBIA 2410
4 ;PSO*210 add call to WORDWRAP api
5 ;
6SIG ;called from psoorne3
7 I $G(PSOSIGFL)!$G(PSOCOPY)!($O(SIG(0))) G DOSE
8 I '$P(^PSRX(PSORXED("IRXN"),"SIG"),"^",2) D Q
9 .S X=$P(^PSRX(PSORXED("IRXN"),"SIG"),"^") D SIGONE^PSOHELP S SIG=$E($G(INS1),2,250)
10 .F SG=1:1:$L(SIG) S:$L(^TMP("PSOPO",$J,IEN,0)_" "_$P(SIG," ",SG))>80 IEN=IEN+1,$P(^TMP("PSOPO",$J,IEN,0)," ",21)=" " S:$P(SIG," ",SG)'="" ^TMP("PSOPO",$J,IEN,0)=$G(^TMP("PSOPO",$J,IEN,0))_" "_$P(SIG," ",SG)
11 F I=0:0 S I=$O(^PSRX(PSORXED("IRXN"),"SIG1",I)) Q:'I S MIG=$P(^PSRX(PSORXED("IRXN"),"SIG1",I,0),"^") D
12 .S SIG(I)=MIG
13 .F SG=1:1:$L(MIG) S:$L(^TMP("PSOPO",$J,IEN,0)_" "_$P(MIG," ",SG))>80 IEN=IEN+1,$P(^TMP("PSOPO",$J,IEN,0)," ",21)=" " S:$P(MIG," ",SG)'="" ^TMP("PSOPO",$J,IEN,0)=$G(^TMP("PSOPO",$J,IEN,0))_" "_$P(MIG," ",SG)
14 .S SIGOK=1 K MIG,SG
15 Q
16DOSE ;displays new SIG with dosing
17 F I=0:0 S I=$O(SIG(I)) Q:'$D(SIG(+I)) D
18 .F SG=1:1:$L(SIG(I)) S:$L(^TMP("PSOPO",$J,IEN,0)_" "_$P(SIG(I)," ",SG))>75 IEN=IEN+1,$P(^TMP("PSOPO",$J,IEN,0)," ",21)=" " S:$P(SIG(I)," ",SG)'="" ^TMP("PSOPO",$J,IEN,0)=$G(^TMP("PSOPO",$J,IEN,0))_" "_$P(SIG(I)," ",SG)
19 S SIGOK=1 K MIG,I
20 Q
21K1 ;
22 K DRET,SIG,RTE,PRC,PHI,PSONOOR,PSOFDR,PSORXED,REF,DIR,DUOUT,DIRUT,SIGOK
23 Q
24K2 ;
25 K SIG,DRET,RTE,PRC,PHI,DIR,DIRUT,DTOUT,PSOOELSE,DUOUT,PSOFDR,SIGOK,PSORXED,REF,INS1
26 Q
27K3 ;
28 K PSLST,ORD,IEN,ORN,RPH,ST,REFL,REF,PSOACT,ORSV,CC,CRIT,CT,DAYS,DDER,DEA,DSMSG,HDR,PSOAC,PSOFLAG,RFCNT
29 K UPMI,RIFN,RX,RXDA,RXOR,RXREF,SEG1,SER,STA,PSOFDR,SIGOK,INCOM,PSONOOR,ACTREF,ACTREN,INS1,RX0,RX2,RX3
30 Q
31ACP1 ;
32 K REA,DA,MSG S REA="C",DA=PSONEW("OIRXN") S MSG="Renewed"_$S($G(PSOFDR):" from CPRS",1:"")
33 S PSCAN(PSONEW("ORX #"))=DA_"^C" D CAN^PSOCAN,DCORD^PSONEW2 K REA,DA,MSG,PSCAN,RXXN
34 S RXXN=$O(^TMP("PSORXN",$J,0)) I RXXN D
35 .S RXN1=^TMP("PSORXN",$J,RXXN) D EN^PSOHLSN1(RXXN,$P(RXN1,"^"),$P(RXN1,"^",2),"",$P(RXN1,"^",3))
36 .I $P(^PSRX(RXXN,"STA"),"^")=5 D EN^PSOHLSN1(RXXN,"SC","ZS",$P(RXN1,"^",4))
37 I $G(PSONOTE) D FULL^VALM1,MAIN^TIUEDIT(3,.TIUDA,PSODFN,"","","","",1) K PSONOTE
38 K VERB,RTE,DRET,RXXN,RXN1,^TMP("PSORXN",$J)
39 S BBRN="",BBRN1=$O(^PSRX("B",PSONEW("NRX #"),BBRN)) I $P($G(^PSRX(BBRN1,0)),"^",11)["W" S BINGCRT="Y",BINGRTE="W"
40 Q
41INST ;formats instruction from front door
42 I $O(^PSRX(RXN,"PI",0)) S PHI=^PSRX(RXN,"PI",0),T=0 D
43 .F S T=$O(^PSRX(RXN,"PI",T)) Q:'T S PHI(T)=^PSRX(RXN,"PI",T,0)
44 .S IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Instructions:"
45 .S T=0 F S T=$O(^PSRX(RXN,"PI",T)) Q:'T D ;PSO*210
46 .. S MIG=^PSRX(RXN,"PI",T,0)
47 .. D WORDWRAP^PSOUTLA2(MIG,.IEN,$NA(^TMP("PSOAO",$J)),21)
48 K T,TY,MIG,SG
49 Q
50PC ;displays provider comments
51 I $O(^PSRX(RXN,"PRC",0)) S PRC=^PSRX(RXN,"PRC",0),T=0 D
52 .F S T=$O(^PSRX(RXN,"PRC",T)) Q:'T S PRC(T)=^PSRX(RXN,"PRC",T,0)
53 .S IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Provider Comments:"
54 .S T=0 F S T=$O(^PSRX(RXN,"PRC",T)) Q:'T D ;PSO*210
55 .. S MIG=^PSRX(RXN,"PRC",T,0)
56 .. D WORDWRAP^PSOUTLA2(MIG,.IEN,$NA(^TMP("PSOAO",$J)),21)
57 K T,TY,MIG,SG
58 Q
59INST1 ;formats instruction from front door
60 I $O(^PSRX(RXN,"PI",0)) S PHI=^PSRX(RXN,"PI",0),T=0 D
61 .F S T=$O(^PSRX(RXN,"PI",T)) Q:'T S PHI(T)=^PSRX(RXN,"PI",T,0)
62 .S IEN=IEN+1,^TMP("PSOPO",$J,IEN,0)=" Instructions:"
63 .S T=0 F S T=$O(^PSRX(RXN,"PI",T)) Q:'T D ;PSO*210
64 .. S MIG=^PSRX(RXN,"PI",T,0)
65 .. D WORDWRAP^PSOUTLA2(MIG,.IEN,$NA(^TMP("PSOPO",$J)),21)
66 K T,TY,MIG,SG
67 Q
68PC1 ;displays provider comments
69 I $O(^PSRX(RXN,"PRC",0)) S PRC=^PSRX(RXN,"PRC",0),T=0 D
70 .F S T=$O(^PSRX(RXN,"PRC",T)) Q:'T S PRC(T)=^PSRX(RXN,"PRC",T,0)
71 .S IEN=IEN+1,^TMP("PSOPO",$J,IEN,0)=" Provider Comments:"
72 .S T=0 F S T=$O(^PSRX(RXN,"PRC",T)) Q:'T D ;PSO*210
73 .. S MIG=^PSRX(RXN,"PRC",T,0)
74 .. D WORDWRAP^PSOUTLA2(MIG,.IEN,$NA(^TMP("PSOPO",$J)),21)
75 K T,TY,MIG,SG
76 Q
77ORCHK ;
78 S (PSONEW("QFLG"),PSONEW("DFLG"))=0
79 D FULL^VALM1 W !
80 I $G(PSODRUG("NAME"))']"" D S:$D(DIRUT)!($G(PSODRUG("NAME"))']"") ACP=0 Q:$G(PSOQFLG)!($D(DIRUT))
81 .W !,"DRUG NAME REQUIRED" D 2^PSOORNW1,FULL^VALM1 I $G(PSODRUG("NAME"))']"" S VALMSG="No Dispense Drug selected."
82 S PSOMIS=$S($G(PSONEW("DOSE",1))']"":1,$G(PSONEW("SCHEDULE",1))']"":2,1:0)
83 D:PSOMIS I PSODIR("DFLG")=1 S (PSONEW("QFLG"),POERR("DFLG"))=1 Q
84 .W !!,"Incomplete Dosaging Instructions - "_$S(PSOMIS=2:"Schedule",1:"Dosage")_".",! S FDORC=1 D DOSE^PSOORED4(.PSONEW) K FDORC
85 .I $G(PSONEW("DOSE",1))']""!($G(PSONEW("SCHEDULE",1))']"") S PSODIR("DFLG")=1 Q
86 .D EN^PSOFSIG(.PSONEW) I PSONEW("ENT")>0,$O(SIG(0)) S (SIGOK,NEWDOSE)=1
87 .D INS^PSODIR(.PSONEW),EN^PSOFSIG(.PSONEW)
88 K PSOMIS,PSODOSE,POERR("DFLG"),PSONEW("QFLG") S I=0
89 F S I=$O(PSONEW("DOSE",I)) Q:'I I $L(PSONEW("DOSE",I))>60 S (PSONEW("QFLG"),POERR("DFLG"))=1,PSODOSE("MSG",I)="Dosage #"_I_" is greater 60 characters in length!",VALMSG="Dosage Greater than 60 Characters, Please Edit!"
90 I $G(POERR("DFLG"))=1 D K PSODOSE,I Q
91 .S I=0 F S I=$O(PSODOSE("MSG",I)) Q:'I W !,PSODOSE("MSG",I)
92 .H 3
93 Q:$G(PSONEW("QFLG"))
94 K PSONEW("FLD") F FLD="PATIENT STATUS^5","QTY^9","DAYS SUPPLY^8","# OF REFILLS^10","ISSUE DATE^6","FILL DATE^7","MAIL/WINDOW^11","PROVIDER NAME^13" D I $G(PSONEW($P(FLD,"^")))']"" S VALMBCK="R",PSONEW("FLD")=1
95 .I $G(PSONEW($P(FLD,"^")))']"" W !,$P(FLD,"^")_" is required data" N RTN S RTN=$P(FLD,"^",2)_"^PSOORNEW" D @RTN K RTN
96 Q:$G(PSONEW("DFLG"))=1
97QTY I PSONEW("QTY")'=+PSONEW("QTY") W !,"Quantity must be ALL numeric!",! D 9^PSOORNEW Q:$G(PSONEW("DFLG"))=1 G QTY
98 I $G(PSODRUG("MAXDOSE"))]"",(PSONEW("QTY")/PSONEW("DAYS SUPPLY")>PSODRUG("MAXDOSE")) D Q:$G(PSONEW("DFLG"))=1!($G(PSONEW("QFLG"))) G QTY
99 .W !,$C(7)," Greater than Maximum dose of "_PSODRUG("MAXDOSE")_" per day"
100 .D KV^PSOVER1 S DIR(0)="Y",DIR("B")="Yes",DIR("A")="Do You Want to Edit Days Supply and Quantity Fields"
101 .S DIR("?")="Enter 'Y' for Yes, 'N' for No, '^' to exit."
102 .D ^DIR I $D(DIRUT) D KV^PSOVER1 K X,Y S PSONEW("DFLG")=1 Q
103 .D KV^PSOVER1 I 'Y K X,Y Q
104 .D 8^PSOORNEW Q:$G(PSONEW("DFLG")) D 9^PSOORNEW
105 I $G(PSONEW("PROVIDER")) D PROV^PSOUTIL(.PSONEW) I $G(PSONEW("DFLG")) S PSODIR("DFLG")=1 Q
106 S PSONEW("DFLG")=0 K DIC,X,Y
107 Q
108DISP ;
109 S:$P(RX2,"^",10)&('$G(PSOCOPY)) IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Verified By: "_$P(^VA(200,$P(RX2,"^",10),0),"^")
110 I $P($G(^PSRX(RXN,"OR1")),"^",5) S IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Finished By: "_$P(^VA(200,$P(^PSRX(RXN,"OR1"),"^",5),0),"^")
111 I $P($G(^PSRX(RXN,"OR1")),"^",6) D
112 .S IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Filled By: "_$P(^VA(200,$P(^PSRX(RXN,"OR1"),"^",6),0),"^")
113 I $P($G(^PSRX(RXN,"OR1")),"^",7) D
114 .S IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Checked By: "_$P(^VA(200,$P(^PSRX(RXN,"OR1"),"^",7),0),"^")
115 S $P(RN," ",35)=" ",IEN=IEN+1,^TMP("PSOAO",$J,IEN,0)=" Entry By: "_$P(^VA(200,$P(RX0,"^",16),0),"^")_$E(RN,$L($P(^VA(200,$P(RX0,"^",16),0),"^"))+1,35)
116 S Y=$P(RX2,"^") X ^DD("DD")
117 S ^TMP("PSOAO",$J,IEN,0)=^TMP("PSOAO",$J,IEN,0)_"Entry Date: "_$E($P(RX2,"^"),4,5)_"/"_$E($P(RX2,"^"),6,7)_"/"_$E($P(RX2,"^"),2,3)_" "_$P(Y,"@",2) K RN
118 S (VALMCNT,PSOPF)=IEN S:$P($G(^PSRX(RXN,"PKI")),"^") VALMSG="Digitally Signed Order"
119 Q
Note: See TracBrowser for help on using the repository browser.