source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSIVUTL1.m@ 1271

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

revised back to 6/30/08 version

File size: 4.1 KB
Line 
1PSIVUTL1 ;BIR/MLM-IV UTILITIES ;21 MAY 96 / 10:37 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**58,81,111**;16 DEC 97
3 ;
4 ; Reference to ^PS(50.7 is supported by DBIA 2180
5 ; Reference to ^PS(51.2 is supported by DBIA 2178
6 ; Reference to ^PS(52.6 is supported by DBIA 1231
7 ; Reference to ^PS(55 is supported by DBIA 2191
8 ;
9DRGSC(Y,PSJSCT) ; Called to set DIC("S") when selecting orderable item.
10 N OK,ND,NDU,NDI S OK=0 ;* I '$D(^PSDRUG("AP",+Y)) K PSJSCT Q 0
11 S ND=$G(^PS(50.7,+Y,0))
12 I $P(ND,U,3) S OK=$S('$P(ND,U,4):1,$P(ND,U,4)>DT:1,1:0)
13 Q OK
14 ;
15IVDRGSC(Y) ; Set DIC("S") for IV additive/solution selection.
16 N Y S Y="S X(1)=$G(^(0)),X(2)=$G(^(""I"")) I $S('X(2):1,X(2)>DT:1,1:0),$D(^PSDRUG(+$P(X(1),U,2),0)) S X(2)=$G(^(""I"")) I $S('X(2):1,X(2)>DT:1,1:0)"
17 Q Y
18 ;
19ENU(Y) ;Get IV additive strength.
20 N X S X=$P(^PS(52.6,+Y,0),U,3),Y=$$CODES^PSIVUTL(X,52.6,2)
21 Q Y
22 ;
23CODES(X,Y) ; Get name from code.
24 S Y=$P($P(";"_$P(Y,U,3),";"_X_":",2),";")
25 Q Y
26 ;
27GTPCI(Y) ; Set up "work" area for provider comments.
28 N DIC,DINUM,DLAYGO,X S DIC="^PS(53.45,",DIC(0)="LNZ",DLAYGO=53.45,(DINUM,X)=+DUZ D ^DIC
29 Q Y
30 ;
31WDTE(Y) ; Format and print date.
32 I 'Y S Y="******"
33 E X ^DD("DD") S Y=$P(Y,"@")_" "_$P($P(Y,"@",2),":",1,2)
34 Q Y
35GTOT(DFN,ON) ; Get order type for display.
36 N DRGT,DRGI,Y
37 S X=$P($G(^PS(55,DFN,"IV",ON,0)),U,4)
38 S Y=$S(X="A":"F",X="H":"H",1:"I")
39 I Y="F" F DRGT="AD","SOL" F DRGI=0:0 S DRGI=$O(^PS(55,DFN,"IV",+ON,DRGT,DRGI)) Q:'DRGI I '$P($G(^PS(55,DFN,"IV",+ON,DRGT,DRGI)),U,5) S Y="I" Q
40 Q Y
41 ;
42PIV(ON) ; Display IV orders.
43 N DRG,ON55,P,PSJORIFN,TYP,X,Y S TYP="?" I ON["V" D
44 .S Y=$G(^PS(55,DFN,"IV",+ON,0)) F X=2,3,4,5,8,9,17,23 S P(X)=$P(Y,U,X)
45 .S TYP=$$ONE^PSJBCMA(DFN,ON,P(9),P(2),P(3)) I TYP'="O" S TYP="C"
46 .S ON55=ON,P("OT")=$S(P(4)="A":"F",P(4)="H":"H",1:"I") D GTDRG^PSIVORFB,GTOT^PSIVUTL(P(4))
47 I ON'["V" S (P(2),P(3))="",P(17)=$P($G(^PS(53.1,+ON,0)),U,9),Y=$G(^(8)),P(4)=$P(Y,U),P(8)=$P(Y,U,5),P(9)=$P($G(^(2)),U) D GTDRG^PSIVORFA,GTOT^PSIVUTL(P(4)) I $E(P("OT"))="I" D Q
48 .S P("PD")=$P($$DRUGNAME^PSJLMUTL(PSGP,ON),"^"),P("DO")=$S($P(DN,"^",2)=.2:$P($G(^PS(55,PSGP,5,+PSJO,.2)),"^",2),1:$G(^PS(55,PSGP,5,+PSJO,.3))),P("DO")=$P(P("DO"),"^")
49 .S Y=$G(^PS(53.1,+ON,.2)),P("MR")=$P($G(^PS(53.1,+ON,0)),U,3)_U_$P($G(^PS(51.2,+$P($G(^PS(53.1,+ON,0)),U,3),0)),U,3)
50 .W ?9,P("PD") D PIV1 W !?11,"Give: ",P("DO")," ",$P(P("MR"),U,2)," ",$S(P(9)]"":P(9),1:P(8))
51 S DRG=0 F S DRG=$O(DRG("AD",DRG)) Q:'DRG D PIVAD
52SOL ;
53 NEW NAME
54 S DRG=0 F S DRG=$O(DRG("SOL",DRG)) Q:'DRG D
55 . D NAME(DRG("SOL",DRG),39,.NAME,0)
56 . W ! W:DRG=1 ?9,"in "
57 . F X=0:0 S X=$O(NAME(X)) Q:'X W ?12 W NAME(X) I X=1,DRG=1,'$D(DRG("AD",1)) D PIV1
58 Q
59PIVAD ; Print IV Additives.
60 NEW NAME
61 D NAME(DRG("AD",DRG),39,.NAME,1)
62 F X=0:0 S X=$O(NAME(X)) Q:'X W:DRG'=1 ! W ?9,NAME(X) I X=1,DRG=1 D PIV1
63 Q
64 ;
65PIV1 ; Print Sched type, start/stop dates, and status.
66 F X=2,3 S P(X)=$E($$ENDTC^PSGMI(P(X)),1,$S($D(PSJEXTP):8,1:5))
67 I '$D(PSJEXTP) W ?50,TYP,?53,P(2),?60,P(3),?67,P(17) Q
68 W ?50,TYP,?53,P(2),?63,P(3),?73,P(17)
69 Q
7059 ; Validate the Infusion rate entered using IV Quick order code.
71 N I F I=2,3,5,7,8,9,11,15,23 S P(I)=""
72 S P(4)="A",P(8)=$P($G(^PS(57.1,PSJQO,1)),U,5)
73 I $G(^PS(57.1,PSJQO,4,1,0)) S DRG("SOL",1)=^(0),DRG("SOL",0)=1
74 I X["?" S F1=53.1,F2=59 D ENHLP^PSIVORC1 G 59
75 I X]"" D ENI^PSIVSP S:$D(X) P(8)=X
76 Q
77WRTDRG(X,L) ; Format and print drug name, strength and bottle no.
78 N Y S Y=" "_$P(X,U,3) S:$P(X,U,4) Y=Y_" ("_$P(X,U,4)_")"
79 Q $E($P(X,U,2),1,(L-$L(Y)))_Y
80 ;Q $E($$ENPDN^PSGMI($P(X,U,6)),1,(L-$L(Y)))_Y
81NAME(X,L,NAME,AD) ; Format Additive display.
82 ;INPUT : X=DRG("AD",DRG) L=Display length AD=for Addtive(1/0)
83 ;OUTPUT: AD(X) if X=2 that means there is a second line to display
84 K NAME
85 NEW Y S Y=$P(X,U,3) S:(AD&$P(X,U,4)) Y=Y_" ("_$P(X,U,4)_")"
86 S:'AD Y=Y_" "_$S(P(4)="P"!($G(P(23))="P")!$G(P(5)):P(9),1:$P(P(8),"@"))
87 I ($L($P(X,U,2))+$L(Y)+1)>L S NAME(1)=$P(X,U,2),NAME(2)=" "_Y Q
88 S NAME(1)=$P(X,U,2)_" "_Y
89 Q
90 ;
91CNVTOM(RATE,TVOL) ; Convert volume to minutes
92 N DAYS,ML,MLSHR
93 ; Get rate in terms of mils per hour
94 I 'RATE Q 0
95 S TVOL=$S($E(TVOL)="m":$E(TVOL,2,9),$E(TVOL)="l":$E(TVOL,2,9)*1000,1:0) Q:'TVOL 0
96 ; Find IV duration in minutes
97 S MINS=(TVOL/RATE)*60 S MINS=MINS+1
98 Q MINS
Note: See TracBrowser for help on using the repository browser.