source: FOIAVistA/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSONEW.m@ 949

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

initial load of FOIAVistA 6/30/08 version

File size: 5.1 KB
Line 
1PSONEW ;BIR/SAB-new rx order main driver ;07/26/96
2 ;;7.0;OUTPATIENT PHARMACY;**11,27,32,46,94,130,268**;DEC 1997;Build 9
3 ;External references L and UL^PSSLOCK supported by DBIA 2789
4 ;External reference to ^VA(200 supported by DBIA 224
5 ;External reference to ^XUSEC supported by DBIA 10076
6 ;External reference to ^ORX1 supported by DBIA 2186
7 ;External reference to ^ORX2 supported by DBIA 867
8 ;External reference to ^TIUEDIT supported by DBIA 2410
9 ;---------------------------------------------------------------
10OERR ;backdoor new rx for v7
11 K PSOREEDT,COPY,SPEED,PSOEDIT,DUR,DRET
12 S PSOPLCK=$$L^PSSLOCK(PSODFN,0) I '$G(PSOPLCK) D LOCK^PSOORCPY S VALMSG=$S($P($G(PSOPLCK),"^",2)'="":$P($G(PSOPLCK),"^",2)_" is working on this patient.",1:"Another person is entering orders for this patient.") K PSOPLCK S VALMBCK="" Q
13 K PSOPLCK S X=PSODFN_";DPT(" D LK^ORX2 I 'Y S VALMSG="Another person is entering orders for this patient.",VALMBCK="" D UL^PSSLOCK(PSODFN) Q
14AGAIN N VALMCNT K PSODRUG,PSOCOU,PSOCOUU,PSONOOR,PSORX("FN") W ! D HLDHDR^PSOLMUTL S (PSONEW("QFLG"),PSONEW("DFLG"))=0,PSOFROM="NEW",PSONOEDT=1
15 K ORD D FULL^VALM1,^PSONEW1 ; Continue order entry
16 I PSONEW("QFLG") G END
17 I PSONEW("DFLG") W !,$C(7),"RX DELETED",! S:$G(POERR) POERR("DFLG")=1,VALMBCK="Q" G END
18 D:$P($G(PSOPAR),"^",7)=1 AUTO^PSONRXN I $P($G(PSOPAR),"^",7)'=1 S PSOX=PSONEW("RX #") D CHECK^PSONRXN
19 I PSONEW("DFLG")!PSONEW("QFLG") D DEL S:$G(POERR) POERR("DFLG")=1,VALMBCK="R" G END
20 D NOOR I PSONEW("DFLG") D DEL G END
21 D ^PSONEW2 I PSONEW("DFLG") D DEL S:$G(POERR) POERR("DFLG")=1,VALMBCK="R" G END ; Asks if correct
22 G:$G(PSORX("FN")) END
23 D EN^PSON52(.PSONEW) ; Files entry in File 52
24 D NPSOSD^PSOUTIL(.PSONEW) ; Adds newly added rx to PSOSD array
25 S VALMBCK="R"
26END D EOJ ; Clean up
27 I '$G(PSORX("FN")) W ! K DIR,DIRUT,DUOUT,DTOUT S DIR(0)="Y",DIR("B")="YES",DIR("A")="Another New Order for "_PSORX("NAME") D ^DIR K DIR,DIRUT,DUOUT,DTOUT I Y K PSONEW,PSDRUG,ORD G AGAIN
28 D ^PSOBUILD,BLD^PSOORUT1 S X=PSODFN_";DPT(" D ULK^ORX2 D UL^PSSLOCK(PSODFN)
29 S VALMBCK="R" K PSORX("FN") Q
30 ;----------------------------------------------------------------
31DEL ;
32 W !,$C(7),"RX DELETED",!
33 I $P($G(PSOPAR),"^",7)=1 D
34 . S DIE="^PS(59,",DA=PSOSITE,PSOY=$O(PSONEW("OLD LAST RX#",""))
35 . S PSOX=PSONEW("OLD LAST RX#",PSOY)
36 . L +^PS(59,+PSOSITE,PSOY):$S(+$G(^DD("DILOCKTM"))>0:+^DD("DILOCKTM"),1:3)
37 . S DR=$S(PSOY=8:"2003////"_PSOX,PSOY=3:"1002.1////"_PSOX,1:"2003////"_PSOX)
38 . D:PSOX<$P(^PS(59,+PSOSITE,PSOY),"^",3) ^DIE K DIE,X,Y
39 . L -^PS(59,+PSOSITE,PSOY)
40 . K PSOX,PSOY Q
41EOJ ;
42 I $D(PSONEW("RX #")) L -^PSRX("B",PSONEW("RX #")) ; +Lock set in PSONRXN
43 K PSONOEDT,PSONEW,PSODRUG,ANQDATA,LSI,C,MAX,MIN,NDF,REF,SIG,SER,PSOFLAG,PSOHI,PSOLO,PSONOOR,PSOCOUU,PSOCOU,PSORX("EDIT")
44 D CLEAN^PSOVER1
45 K ^TMP("PSORXDC",$J),RORD,ACOM,ACNT,CRIT,DEF,F1,GG,I1,IEN,INDT,LAST,MSG,NIEN,STA,DUR,DRET,PSOPRC
46 S RXN=$O(^TMP("PSORXN",$J,0)) I RXN D
47 .S RXN1=^TMP("PSORXN",$J,RXN) D EN^PSOHLSN1(RXN,$P(RXN1,"^"),$P(RXN1,"^",2),"",$P(RXN1,"^",3))
48 .I $P(^PSRX(RXN,"STA"),"^")=5 D EN^PSOHLSN1(RXN,"SC","ZS","")
49 K RXN,RXN1,^TMP("PSORXN",$J)
50 I $G(PSONOTE) D FULL^VALM1,MAIN^TIUEDIT(3,.TIUDA,PSODFN,"","","","",1)
51 K PSONOTE
52 Q
53NOOR ;asks nature of order
54 N PSONOODF
55 S PSONOODF=0
56 I $G(OR0) D G NOORX ;front door
57 .S PSOI=$S($G(PSOSIGFL):1,$G(PSODRUG("OI"))'=$P(OR0,"^",8):1,1:0) I 'PSOI S PSONOOR="" D:$D(^XUSEC("PSORPH",DUZ)) COUN Q ;NoO $P(OR0,"^",7)
58 .S PSONOODF=1
59 .D DIR I $D(DIRUT) S PSONEW("DFLG")=1 Q
60 .S PSONOOR=Y D:$D(^XUSEC("PSORPH",DUZ)) COUN K DIR,DTOUT,DTOUT,DIRUT
61 ;backdoor order
62 D DIR I $D(DIRUT) S PSONEW("DFLG")=1 Q
63 S PSONOOR=Y K DIK,DA,DIE,DR,PSOI,DIR,DUOUT,DTOUT,DIRUT
64 G:'$D(^XUSEC("PSORPH",DUZ)) NOORX
65COUN ;patient counseling
66 G:$G(PSORX("EDIT"))&('$G(PSOSIGFL)) NOORX K DIR,DUOUT,DTOUT,DIRUT
67 S DIR("B")="NO",DIR(0)="52,41" D ^DIR S PSOCOU=$S(Y:Y,1:0)
68 I $D(DIRUT)!('PSOCOU) S PSOCOUU=0 D:'$G(SPEED) PRONTE Q
69 K:'$G(PSOCOU) PSOCOUU K DIR,DUOUT,DTOUT,DIRUT I Y S DIR(0)="52,42",DIR("B")="NO" D ^DIR S PSOCOUU=$S(Y:Y,1:0)
70PRONTE K PSONOTE,DIR,DIRUT,DUOUT
71 I $T(MAIN^TIUEDIT)]"",'$G(SPEED) D K DIR,DIRUT,DUOUT
72 .S DIR(0)="Y",DIR("B")="No",DIR("A")="Do you want to enter a Progress Note",DIR("A",1)="" D ^DIR K DIR
73 .S PSONOTE=+Y Q ;I 'Y!($D(DIRUT)) Q
74NOORX K X,Y,DIR,DUOUT,DTOUT,DIRUT
75 Q
76DIR ;ask nature of order
77 K DIR,DTOUT,DTOUT,DIRUT I $T(NA^ORX1)]"" D Q
78 .S PSONOOR=$$NA^ORX1($S($G(PSONOODF)!($G(PSONOBCK)):"S",1:"W"),0,"B","Nature of Order",0,"WPSDIVR"_$S(+$G(^VA(200,DUZ,"PS")):"E",1:""))
79 .I +PSONOOR S (Y,PSONOOR)=$P(PSONOOR,"^",3) Q
80 .S DIRUT=1 K PSONOOR
81 I $D(PSONOOR) S DF=PSONOOR,PSONODF=$S(DF="E":"PROVIDER ENTERED",DF="V":"VERBAL",DF="P":"TELEPHONE",DF="D":"DUPLICATE",DF="S":"SERVICE CORRECTED",DF="I":"POLICY",DF="R":"SERVICE REJECTED",1:"WRITTEN")
82 K DIR,DTOUT,DTOUT,DIRUT S DIR("A")="Nature of Order: ",DIR("B")=$S($D(PSONOOR):PSONODF,1:"WRITTEN")
83 S DIR(0)="SA^W:WRITTEN;V:VERBAL;P:TELEPHONE;S:SERVICE CORRECTED;D:DUPLICATE;I:POLICY;R:SERVICE REJECTED"_$S(+$G(^VA(200,DUZ,"PS")):";E:PROVIDER ENTERED",1:"")
84 D ^DIR K DF,PSONODF Q:$D(DIRUT) S PSONOOR=Y
85DIRX Q
86 ;
87NOORE(PSONEW) ;entry point for renew
88 D NOOR I $D(DIRUT) S PSONEW("DFLG")=1 Q
89 S PSONEW("NOO")=PSONOOR
90 Q
Note: See TracBrowser for help on using the repository browser.