source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSIVPRO.m@ 1270

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

initial load of WorldVistAEHR

File size: 5.2 KB
Line 
1PSIVPRO ;BIR/PR,MLM-PROFILE AN ORDER ;01 OCT 96 / 9:48 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**38,58,85,110**;16 DEC 97
3 ;
4 ; Reference to ^PS(55 is supported by DBIA 2191
5 ;
6 ;Needs DFN and ^TMP("PSIV",$J) array
7 S PSJLN=1,PSIVX2=0
8 S PSIVST=$O(^TMP("PSIV",$J,0)),X="",(PSIVON,PS)=0 D REACT I PSIVST]"" F PSIVX1=1:1 D PSIVST Q:'PSIVON D PR
9 S ^TMP("PSJPRO",$J,0)=PSIVX2,VALMCNT=PSJLN-1
10 I $G(PSIVBR)="D ^PSIVOPT" S VALM("TITLE")="IV Order Entry"
11 E S VALM("TITLE")="IV Profile"
12QUIT ; Kill and exit.
13 S ON=X K ADM,AL,DRG,GMRA,GMRAL,PSIVST,PSIVX1,PSIVX2,Y,NAD,N0,X3,X4,X5
14 Q
15 ;
16PSIVST ;
17 S PSIVON=$O(^TMP("PSIV",$J,PSIVST,PSIVON)) I 'PSIVON S PSIVST=$O(^TMP("PSIV",$J,PSIVST_"Z")) I PSIVST]"" S PSIVON=$O(^TMP("PSIV",$J,PSIVST,0)) D HDL
18 Q
19REACT ;
20 S PSJL="# Additive",PSJL=$$SETSTR^VALM1("Last fill",PSJL,32,9)
21 S PSJL=$$SETSTR^VALM1("Type",PSJL,49,4),PSJL=$$SETSTR^VALM1(" Start Stop Stat",PSJL,54,19)
22 S PSJL=$$SETSTR^VALM1("Renew",PSJL,74,5)
23 D SETTMP^PSJLMPRI
24HDL ; Display type heading.
25 S PSJL=""
26 D ACL:PSIVST="A",POL:PSIVST="P",POCL:PSIVST="PD",NVL:PSIVST="N",NVCL:PSIVST="ND",NOL:PSIVST="X",NOC:PSIVST="" S X=""
27 S PSJL=$E(PSJL,1,79) D SETTMP^PSJLMPRI
28 Q
29 ;
30PR ; Get & display order.
31 S (ON,ON55)=9999999999-($S(PSIVST["P":$E(PSIVON,2,11),PSIVST["N":$E(PSIVON,2,11),1:PSIVON))_$S(PSIVST["P":"P",PSIVST["N":"P",1:"V") D @$S(PSIVST["P":"GT531^PSIVORFA(DFN,ON)",PSIVST["N":"GT531^PSIVORFA(DFN,ON)",1:"GT55^PSIVORFB")
32 S X="",PS=PSIVX1 K ^TMP("PSIV",$J,PSIVST,PSIVON) S ^TMP("PSIV",$J,PSIVST_"B",PSIVX1)=$S(PSIVST["P":$E(PSIVON,2,11),PSIVST["N":$E(PSIVON,2,11),1:PSIVON)_$S(PSIVST["P":"P",PSIVST["N":"P",1:"V")
33 I PSIVST["D" N PSJO,PSIVX3 S PSIVX3=PSIVX1,PSJO=0 F S PSJO=$O(^PS(53.1,"ACX",PSJCOM,PSJO)) Q:'PSJO S ON=PSJO_"P" D GT531^PSIVORFA(DFN,ON),ENPL S PSIVX1=""
34 I PSIVST["D" S PSIVX1=PSIVX3 Q
35 ;
36ENPL ;
37 NEW MARX,DRUGNAME,X,XX
38 S PSJL=$J(PSIVX1,4) I ON["P",(P("OT")'="F"),P(4)'="H" D Q
39 . I $D(VALMEVL) D
40 .. N PSJFLAG
41 .. S PSJFLAG=$P($S(ON["V":$G(^PS(55,DFN,"IV",+ON,.2)),1:$G(^PS(53.1,+ON,.2))),U,7)
42 .. I PSJFLAG D CNTRL^VALM10(PSJLN,1,4,IORVON,IORVOFF,0)
43 . D DRGDISP^PSJLMUT1(DFN,ON,34,59,.DRUGNAME,0)
44 . NEW X F X=0:0 S X=$O(DRUGNAME(X)) Q:'X S:X>1 PSJL="" S PSJL=$$SETSTR^VALM1(DRUGNAME(X),PSJL,$S(X=1:6,1:7),$S(X=1:34,1:65)) D:X=1 V D SETTMP^PSJLMPRI
45 S X=$J(PSIVX1,4)_$S(P("PRY")="D":" d",1:" ")
46 I ON["V" S XX=$G(^PS(55,DFN,"IV",+ON,4)) D
47 . I +PSJSYSU=1,'+XX S X=X_"->"
48 . I +PSJSYSU=3,'+$P(XX,U,4) S X=X_"->"
49 S PSJL=X
50 I $D(VALMEVL) D
51 . N PSJFLAG
52 . S PSJFLAG=$P($S(ON["V":$G(^PS(55,DFN,"IV",+ON,.2)),1:$G(^PS(53.1,+ON,.2))),U,7)
53 . I PSJFLAG D CNTRL^VALM10(PSJLN,1,4,IORVON,IORVOFF,0)
54 D AD,SOL
55 Q
56SOL ;
57 NEW NAME,PSJNOAD,L ;S PSJNOAD=0,L=34
58 S NAD=0 F S NAD=$O(DRG("SOL",NAD)) Q:'NAD D
59 . K NAME S L=34,PSJNOAD=0
60 . I '$D(DRG("AD",1)),NAD=1 S PSJNOAD=1,L=27
61 . S:NAD=1 PSJL=$$SETSTR^VALM1("in",PSJL,6,11)
62 . D NAME^PSIVUTL(DRG("SOL",NAD),L,.NAME,0)
63 . F X=0:0 S X=$O(NAME(X)) Q:'X S:(NAD>1!(X>1)) PSJL="" S PSJL=$$SETSTR^VALM1(NAME(X),PSJL,9,34) D:X=1&PSJNOAD V D SETTMP^PSJLMPRI
64 . S PSJL=""
65 Q
66AD ;
67 NEW NAME
68 S NAD=0 F S NAD=$O(DRG("AD",NAD)) Q:'NAD D
69 . K NAME
70 . D NAME^PSIVUTL(DRG("AD",NAD),30,.NAME,1)
71 . F X=0:0 S X=$O(NAME(X)) Q:'X S:(NAD>1!(X>1)) PSJL="" S PSJL=$$SETSTR^VALM1(NAME(X),PSJL,6,34) D:(NAD=1&(X=1)) V D SETTMP^PSJLMPRI
72 . S PSJL=""
73 Q
74 ;
75V S Y=$S(ON["V":$P($G(^PS(55,DFN,"IV",+ON,9)),U),1:"")
76 I +Y>0 X ^DD("DD") S Y=$P(Y,",")_" "_$P($P(Y,"@",2),":",1,2)
77 E S Y="** N/P **"
78 S PSJL=$$SETSTR^VALM1(Y,PSJL,33,12)
79 S PSJL=$$SETSTR^VALM1(" #"_$S(ON["V":+$P($G(^PS(55,DFN,"IV",+ON,9)),U,2),1:0),PSJL,46,3)
80 S:PSIVX1]"" PSIVX2=PSIVX2+1
81 D REST
82 Q
83ACL ;
84 F X3=1:1:71 S PSJL=PSJL_"-" S:X3=34 PSJL=PSJL_" A c t i v e "
85 Q
86NVL ;
87 F X3=1:1:71 S PSJL=PSJL_"-" S:X3=34 PSJL=PSJL_" N o n - V e r i f i e d "
88 Q
89NVCL ;
90 F X3=1:1:71 S PSJL=PSJL_"-" S:X3=34 PSJL=PSJL_" N o n - V e r i f i e d C o m p l e x "
91 Q
92POL ;
93 F X3=1:1:71 S PSJL=PSJL_"-" S:X3=34 PSJL=PSJL_" P e n d i n g "
94 Q
95POCL ;
96 F X3=1:1:66 S PSJL=PSJL_"-" S:X3=34 PSJL=PSJL_" P e n d i n g C o m p l e x "
97 Q
98NOL ;
99 F X3=1:1:66 S PSJL=PSJL_"-" S:X3=34 PSJL=PSJL_" N o t A c t i v e "
100 Q
101NOC ;
102 F X3=1:1:66 S PSJL=PSJL_"-" S:X3=34 PSJL=PSJL_" No current IV information "
103 ;
104 S PSJL=""
105 Q
106REST ;
107 S PSJL=$$SETSTR^VALM1(P(4),PSJL,52,1)
108 S PSJL=$$SETSTR^VALM1($E($$ENDTC^PSGMI(P(2)),1,5),PSJL,55,5)
109 S PSJL=$$SETSTR^VALM1($E($$ENDTC^PSGMI(P(3)),1,5),PSJL,62,5)
110 S PSJL=$$SETSTR^VALM1($S(P(17)="R"&(ON'["V"):"R/I",1:P(17)),PSJL,69,1)
111 S PSJL=$$SETSTR^VALM1($S(ON["P":P("PRY"),1:""),PSJL,71,1)
112 N PSJLRN S PSJLRN=$$LASTREN^PSJLMPRI(DFN,ON55) I PSJLRN S PSJLRN=$E($$ENDTC^PSGMI(PSJLRN),1,5) S PSJL=$$SETSTR^VALM1(PSJLRN,PSJL,74,5)
113 Q
114XCHK ;
115 I $E(X)="?" W !!?2,"Select order",$E("s",PS'=1)," (1" W:PS>1 "-",PS W ")."
116 I $E(X)="?" W:$S($O(^TMP("PSIV",$J,PSIVST,ON)):1,1:$O(^TMP("PSIV",$J,PSIVST))]"") " Press RETURN to view more orders, or enter '^' to abort",!,"the profile, or 'A' to view Allergies." D:$E(X,1,2)="??" H2^PSGON K X Q
117 S PSGLMT=PS D ^PSGON Q
118 ;
119PSPD S Y=$S(PSIVST'="P":$P($G(^PS(55,DFN,"IV",+ON,9)),U),1:"")
120 X ^DD("DD") S:Y="" PSJL=$$SETSTR^VALM1("** N/P **",PSJL,36,12)
121 S:Y'="" PSJL=$$SETSTR^VALM1($P(Y,","),PSJL,36,7),PSJL=$$SETSTR^VALM1($P($P(Y,"@",2),":",1,2),PSJL,43,45)
122 S PSJL=PSJL_" #"_$S(Y="":0,1:$P(^PS(55,DFN,"IV",+ON,9),U,2))
123 D REST
124 Q
Note: See TracBrowser for help on using the repository browser.