source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSIVRD.m@ 1365

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

initial load of WorldVistAEHR

File size: 4.6 KB
RevLine 
[613]1PSIVRD ;BIR/PR,MLM-HANDLE QUICK RET/DES ENTRY ;29 SEP 97 / 11:17 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**38,58,88**;16 DEC 97
3 ; ;
4 ; Reference to ^PS(55 is supported by DBIA 2191
5 ;
6EN ; Entry point to enter returns/destroyed items.
7 D ^PSIVXU Q:$D(XQUIT) F D ENGETP^PSIV Q:DFN<0 D EN1
8Q K ACTION,D,DFN,DIC,DIR,DRG,DRGI,DRGN,E,E1,HELP,I,I1,JJ,LABELS,MXMN,ON,ON55,ONCNT,P,PS,PSGDT,PSGID,PSGP,PSGLMT,PSGODDD,PSIVAC,PSIVC,PSIVNOL,PSIVNOW,PSIVON
9 K PSIVPL,PSIVPR,PSIVSITE,PSIVUP,PSIVX,PSJORIFN,PSJORL,PSJHT,PSJPWT,PSJSYSL,PSJSYSU,PSJSYSW,PSJSYSW0,Q,UL80,VA,VADM,VAIN,VAERR,PSIVNU,PSIVOV1,PSIVOV2,PSIVSN,RDFLAG,RDWARD,X,XQUIT,Y
10 Q
11 ;
12EN1 ;
13 S PSIVBR="D PROCESS^PSIVRD" D ENCHS1^PSIV
14 Q
15EN1OLD ;
16 ;S PSIVAC="RD" D ENNB^PSIVACT I P("PT")'="N" D GTORDRS Q
17ORDNO ;
18 F R !!,"Enter the order number(s) to be processed: ",PSIVNU:DTIME Q:"^"[PSIVNU D READ
19 Q
20 ;
21READ ; Read order no.s, no profile.
22 N DONE I '$T!(PSIVNU="^")!(PSIVNU="") S PSIVNU="" Q
23 I PSIVNU["?" W !!,"Enter order number(s) separated by a comma e.g. 2,4,5,6.",! Q
24 I PSIVNU[" " W $C(7),$C(7),"??",!! Q
25 F I=1:1:$L(PSIVNU,",") S ON=$P(PSIVNU,",",I) D
26 .I $L(ON)'>0 W $C(7),$C(7),"??",!! S DONE=1
27 .F JJ=1:1:$L(ON) Q:$G(DONE) I $A($E(ON,JJ))<48!($A($E(ON,JJ))>57) W !!,$C(7),$C(7),"Order ",ON," is invalid.",!! S DONE=1
28 I '$G(DONE) F I=1:1:$L(PSIVNU,",") S ON=$P(PSIVNU,",",I) I '$D(^PS(55,DFN,"IV",+ON,0)) W !!,$C(7),$C(7),"Order number ",+ON," does not exist for this patient.",! S DONE=1
29 I '$G(DONE) D NOW^%DTC S PSIVNOW=% F ONCNT=1:1:$L(PSIVNU,",") D S ON=9999999999-$P(PSIVNU,",",ONCNT) D OV1
30 .S X=$G(^PS(55,DFN,"IV",+ON,0)) I $P(X,U,3)<PSIVNOW,("AR"[$P(X,U,17)) S $P(^PS(55,DFN,"IV",+ON,0),U,17)="E" D EXPIR^PSIVOE
31 Q
32 ;**********************************************************
33 ;* GTORDRS, ASK, OV subroutines are no longer use in 5.0. *
34 ;**********************************************************
35GTORDRS ;Needs PSIVBR (Branch point)
36 S IOP="HOME" D ^%ZIS K %ZIS,IOP Q:P("PT")="N"
37 D ^PSIVPRO Q:X="^" I X]"" G OV
38ASK Q:PS<1 W !!,"Choose 1-",PS,": " R X:DTIME S:'$T X="^" Q:"^"[X
39 I X?1."?" S HELP="CHSE" D ^PSIVHLP D:X?2."?" H2^PSGON G ASK
40 S PSGLMT=PS D ^PSGON G:'$D(X) ASK
41OV ;
42 W ! F PSIVOV1=1:1:PSGODDD F PSIVOV2=1:1:$L(PSGODDD(PSIVOV1),",")-1 S ON=+$P(PSGODDD(PSIVOV1),",",PSIVOV2),ON=$S($D(^TMP("PSIV",$J,"AB",ON)):^(ON),$D(^TMP("PSIV",$J,"NB",ON)):^(ON),$D(^TMP("PSIV",$J,"XB",ON)):^(ON),1:"") Q:'ON D OV1
43 Q
44OV1 ;
45 S (ON,ON55,P("PON"))=9999999999-ON_"V" K PSIVNUM D GT55^PSIVORFB,ENNONUM^PSIVORV2(DFN,ON)
46 D PROCESS1
47 Q
48 ;
49PROCESS ;
50 D FULL^VALM1
51 S PSJORD=ON D ENNH^PSIVORV2(ON)
52PROCESS1 ;
53 I '$D(^PS(55,DFN,"IV",+ON,9)) W !!,$C(7),$C(7),"No labels have been dispensed for this order." N DIR S DIR(0)="E" D ^DIR Q
54 I $P(^PS(55,DFN,"IV",+ON,2),U,2)'=PSIVSN W !!,"WARNING ",$C(7),$C(7),$C(7),"This order is in a different IV room",!," from the one in which you are entering returned/destroyed!" S E1=$P(^(2),U,2),E=PSIVSN
55 D PAUSE^VALM1
56 S PSIVLBTP=2,PSJMORE=0,RDFLAG="ON" D EN^VALM("PSJ LM IV RETURN LABELS")
57 Q
58 ;
59 ;S RDFLAG="ON",X="Was this bottle RECYCLED or DESTROYED or CANCELLED ?^R^^RECYCLED,DESTROYED,CANCELLED" D ENQ^PSIV Q:X=U I X["?" S HELP="RTDS" D ^PSIVHLP1 G PROCESS1
60 ;W ! S Y=$E(X),PSIVC=$S(Y="R":2,Y="D":3,1:4)
61 ;
62WARD ;Get the ward to associate returns or destroyed with.
63 I '$D(PSJIDLST) W !,"No labels are available" D PAUSE^VALM1 Q
64 K DIC I $D(^DPT(DFN,.1)) S DIC("B")=^DPT(DFN,.1)
65 S DIC("A")="Enter ward or ^OUTPATIENT: ",DIC(0)="AEQ",DIC=42,D="B" D IX^DIC G:X="^"!(X="") KILL I $P("^OUTPATIENT",X)="" W $P("^OUTPATIENT",X,2) S RDWARD=.5 G WARD1
66 S:Y>0 RDWARD=+Y I Y<0 G WARD
67 ;
68WARD1 ;
69 NEW PSIVCTD S PSIVCTD=""
70 S PSJY=$$PROMPT^PSIVLBRP()
71 Q:PSJY=""
72 S PSIVNOL=0
73 F PSJSEL=1:1 S PSJSEL1=$P(PSJY,",",PSJSEL) Q:PSJSEL1="" S PSIVNOL=PSIVNOL+1
74 F PSJSEL=1:1 S PSJSEL1=$P(PSJY,",",PSJSEL) Q:PSJSEL1="" D
75 . S PSJID=$G(PSJIDLST(PSJSEL1)) Q:PSJID=""
76 . S PSJIDNO=$P(PSJID,"V",2) D NOW^%DTC
77 . K DA,DR,DIE,DIC
78 . S DA=PSJIDNO,DA(1)=DFN,DIE="^PS(55,"_DA(1)_",""IVBCMA"","
79 . S DR="4////"_%_";5////"_$S(PSIVC=2:"RC",PSIVC=3:"DT",1:"CA") D ^DIE
80 . K DA,DR,DIE,DIC
81 S LABELS=PSIVNOL,ACTION=$S(PSIVC=2:2,PSIVC=3:3,1:4) D ^PSIVLTR,^PSIVSTAT W "...Done."
82 Q
83NRD ;Ask number of bottles/bags
84 Q
85 ;NO LONGER USE
86 S MXMN=$P(^PS(55,DFN,"IV",+ON,9),U,3)
87NRD1 ;
88 Q
89 ;NO LONGER USE
90 R !,"Number of bottles: ",X:DTIME W:'$T $C(7) S:'$T X="^" G:"^"[X KILL I X?1."?" S HELP="REDT" D ^PSIVHLP G NRD1
91 I $S($E(X,$E(X)="-"+1,$L(X))'?1.N:1,X<-50:1,X>MXMN:1,1:'X) W $C(7)," ??" G NRD1
92 ;
93 S PSIVNOL=+X,LABELS=PSIVNOL,ACTION=$S(PSIVC=2:2,PSIVC=3:3,1:4) D ^PSIVLTR,^PSIVSTAT W "...Done."
94 ;
95KILL ;
96 Q
97 ;NO LONGER USE
98 W:"^"[X $C(7),"NO ACTION TAKEN" K D,LABELS,MXMN,X,Y,PSIVNOL,HELP,DIC,RDFLAG,PSIVC
99 S VALMBCK="R"
100 Q
Note: See TracBrowser for help on using the repository browser.