source: FOIAVistA/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSJOREN.m@ 1008

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

initial load of FOIAVistA 6/30/08 version

File size: 2.9 KB
Line 
1PSJOREN ;BIR/CML3-INTERFACE FOR INPATIENT PHARMACY AND OE/RR ;07 AUG 97 / 3:21 PM
2 ;;5.0; INPATIENT MEDICATIONS ;**109,127**;16 DEC 97
3 ;
4 ;Reference to ^ORD(100.98 supported by DBIA 873
5 ;Reference to ^PS(51.2 supported by DBIA 2178
6 ;Reference to ^PS(55 supported by DBIA 2191
7 ;
8ENTRY ;
9 K PSGOEE,PSGOES
10 ;S PSJORPF=0 S:ORNP PSJORPV=ORNP,PSJORPVN=$P(^VA(200,+ORNP,0),"^"),X=$G(^("PS")) I $S('ORNP:1,'X:1,'$P(X,"^",4):0,1:$P(X,"^",4)'>DT) D PS I PSJORPF G OUT
11 I '$D(^DPT(+ORVP,.1)) W !!,"THIS PATIENT HAS NOT BEEN ADMITTED.",!,"(Any non-IV orders entered will be discontinued by the pharmacist...)"
12 ;
13GO ; get orders
14 ; S PSJORPCL=XQORNOD,PSJORNS=+XQORNOD,PSJORL=ORL,PSJORTS=ORTS,PSJORVP=ORVP
15 S PSGOEORF=1,PSGOEAV=0,PSJORTOU=$O(^ORD(100.98,"B","INPATIENT MEDICATIONS",0)),PSGOEDMR=$O(^PS(51.2,"B","ORAL",0)),PSGOEPR=PSJORPV
16 F S PSGOEOS="U" D ^PSGOE7 Q:Y<0 D:X?1"S."1.E ^PSGOES I X'?1."S."1.E D ^PSGOE6 K PSGOEE D:$D(Y) ^PSGOETO
17 ;
18DONE ;
19 ; I $P(PSJSYSL,"^",2)]"" S PSGOP=PSGP D ENQL^PSGLW
20 ;
21OUT ;
22 ; S PSJNKF=1 D ENIVKV^PSGSETU K PSJORPCL,PSJORTOI,PSJORTOU,PSJORPV,PSJORPVN,PSJORNS,PSJORVP,PSJORL,PSJORTS,PSGOEORF,PSGOEAV,PSJORPF,PSJORQF,PSJPV,PSGOEOS Q
23 Q ;
24PS ;
25 W $C(7),!!,"The selected PROVIDER is NOT qualified to write MEDICATION orders. You must",!,"select a valid provider to be able to continue with Inpatient Medications."
26 K DIC S DIC="^VA(200,",DIC(0)="AEMQZ",DIC("A")="Select PHARMACY PROVIDER: ",DIC("S")="S PSG=$G(^(""PS"")) I PSG,$S('$P(PSG,""^"",4):1,1:DT<$P(PSG,""^"",4))" F W ! D ^DIC Q:$D(DUOUT)!$D(DTOUT)!(Y>0) W $C(7)," (Required.)"
27 K DIC S:Y'>0 PSJORPF=11 S:Y>0 PSJORPV=+Y,PSJORPVN=Y(0,0) Q
28 Q
29ENBKOUT(DFN,ON) ; Undo Renew.
30 Q:'$G(ON)
31 N PSJOLD,PSJRES,PSJOC,PSJOC2,PSIVACT,PSIVALT,PSIVREA,ON55,PSGAL,DA,PSIVAL,PSJUNDC
32 S PSJOC=PSOC,PSJOC2=PSJHLMTN,PSIVAL=24000
33 S X=$G(^PS(53.1,+ON,0)) Q:'X
34 S PSJRES=$P(X,U,24),(X,PSJOLD)=$P(X,U,25)
35 I PSJOLD["V" S:$D(^PS(55,DFN,"IV",+PSJOLD,2)) $P(^(2),U,6)="",$P(^(2),U,9)="",$P(^(0),U,17)="A",PSIVACT=1,PSIVALT=$S(PSOC="CR":2,1:1),PSJUNDC=1,PSIVAL=$P($G(^PS(53.3,+PSIVAL,0)),U),PSIVREA="PNRD",ON55=PSJOLD D LOG^PSIVORAL
36 I PSJOLD["U" S:$D(^PS(55,DFN,5,+PSJOLD,0)) $P(^(0),U,26,27)=U,$P(^(0),U,9)="A",PSGAL("C")=24000,DA=+PSJOLD,DA(1)=DFN D ^PSGAL5
37 S PSOC="SC",PSJHLMTN="ORM" D EN1^PSJHL2(DFN,PSOC,PSJOLD) S PSOC=PSJOC,PSJHLMTN=PSJOC2
38 Q
39 ;
40ENUDTX(DFN,ON,RES) ; Set up ORTX( Array for UD orders.
41 K ORTX N DO,MRN,ND0,NDP1,ND2,PD,ST,SCH
42 S Y=2 I ON["A"!(ON["O") S ND0=$G(^PS(55,DFN,5,+ON,0)),NDP1=$G(^(.1)),ND2=$G(^(2)),Y=2 F X=0:0 S X=$O(^PS(55,DFN,5,+ON,12,X)) Q:'X S Y=Y+1,ORTX(Y)=$G(^(X,0))
43 E S ND0=$G(^PS(53.1,+ON,0)),NDP1=$G(^(.1)),ND2=$G(^(2)),Y=2 F X=0:0 S X=$O(^PS(53.1,+ON,12,X)) Q:'X S Y=Y+1,ORTX(Y)=$G(^(X,0))
44 S ORTX(1)=$S($G(RES)="NR":"RENEWAL -",$G(RES)="OR":"RENEWED -",1:"")_$P($G(^PS(50.3,+NDP1,0)),U)
45 S ORTX(2)=" Give: "_$S($P(NDP1,U,2)]"":$P(NDP1,U,2)_" ",1:"")_$P($G(^PS(51.2,+$P(ND0,U,3),0)),U,3)_" "_$P(ND2,U)_$S($P(ND2,U)["PRN":"",$P(ND0,U,7)="P":" PRN",1:"")
46 I $G(DFN),$G(ON) S:ON["U" ^PS(55,"AUE",DFN,+ON)=""
47 Q
Note: See TracBrowser for help on using the repository browser.