source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORWDPS1.m@ 1757

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

initial load of FOIAVistA 6/30/08 version

File size: 5.6 KB
Line 
1ORWDPS1 ; SLC/KCM/JLI - Pharmacy Calls for Windows Dialog ; 10/04/2005
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**85,132,141,163,215,255**;Dec 17, 1997
3 ;
4ODSLCT(LST,PSTYPE,DFN,LOC) ; return default lists for dialog
5 ; PSTYPE: pharmacy type (U=unit dose, F=IV fluids, O=outpatient)
6 N ILST S ILST=0
7 S ILST=ILST+1,LST(ILST)="~Priority" D PRIOR
8 S ILST=ILST+1,LST(ILST)="~DispMsg"
9 S ILST=ILST+1,LST(ILST)="d"_$$DISPMSG
10 ;
11 ; I PSTYPE="F" D Q ; IV Fluids
12 ; . S ILST=ILST+1,LST(ILST)="~ShortList" D SHORT
13 ;
14 I PSTYPE="O" D ; Outpatient
15 . S ILST=ILST+1,LST(ILST)="~Refills"
16 . S ILST=ILST+1,LST(ILST)="d0^0"
17 . S ILST=ILST+1,LST(ILST)="~Pickup"
18 . S ILST=ILST+1,LST(ILST)="d"_$$DEFPICK($G(LOC))
19 . ; S ILST=ILST+1,LST(ILST)="~Supply"
20 . ; S ILST=ILST+1,LST(ILST)="d^"_$$DEFSPLY(DFN)
21 Q
22PKI(ORY,OI,PSTYPE,ORVP,PKIACTIV) ; return DEA Schedule for drug
23 N ILST,ORDOSE,ORWPSOI,ORWDOSES,X1,X2,X
24 K ^TMP("PSJINS",$J),^TMP("PSJMR",$J),^TMP("PSJNOUN",$J),^TMP("PSJSCH",$J),^TMP("PSSDIN",$J)
25 S ILST=0
26 S ORWPSOI=0
27 S:+OI ORWPSOI=+$P($G(^ORD(101.43,+OI,0)),U,2)
28 D START^PSSJORDF(ORWPSOI,$S(PSTYPE="U":"I",1:"O")) ; dflt route, schedule, etc.
29 I '$L($T(DOSE^PSSOPKI1)) D DOSE^PSSORUTL(.ORDOSE,ORWPSOI,PSTYPE,ORVP) ; dflt doses
30 I $L($T(DOSE^PSSOPKI1)) D DOSE^PSSOPKI1(.ORDOSE,ORWPSOI,PSTYPE,ORVP) ; dflt doses NEW PKI CODE from pharmacy
31 D EN^PSSDIN(ORWPSOI) ; nfi text
32 S ORY="" ;PKI
33 I $D(ORDOSE("DEA")) S X="",X1=$P(ORDOSE("DEA"),";"),X2=$P(ORDOSE("DEA"),";",2) D
34 . I '$L(X2) Q
35 . I $G(PKIACTIV) S X=X2
36 S ORY=X
37 K ^TMP("PSJINS",$J),^TMP("PSJMR",$J),^TMP("PSJNOUN",$J),^TMP("PSJSCH",$J),^TMP("PSSDIN",$J)
38 Q
39PRIOR ; from DLGSLCT, get list of allowed priorities
40 N X,XREF
41 S XREF=$S(PSTYPE="O":"S.PSO",1:"S.PSJ")
42 S X="" F S X=$O(^ORD(101.42,XREF,X)) Q:'$L(X) D
43 . I XREF["PSJ",X'="ASAP",X'="ROUTINE",X'="STAT" Q
44 . S ILST=ILST+1,LST(ILST)="i"_$O(^ORD(101.42,XREF,X,0))_U_X
45 S ILST=ILST+1,LST(ILST)="d"_$O(^ORD(101.42,"B","ROUTINE",0))_U_"ROUTINE"
46 Q
47DEFPICK(LOC) ; return default routing
48 N X,DLG,PRMT
49 S DLG=$O(^ORD(101.41,"AB","PSO OERR",0)),X=""
50 S PRMT=$O(^ORD(101.41,"AB","OR GTX ROUTING",0))
51 I $D(^TMP("ORECALL",$J,+DLG,+PRMT,1)) S X=^(1)
52 I X'="" S EDITONLY=1 Q X ; EDITONLY used by default action
53 ;
54 ;S X=$$GET^XPAR("ALL^"_"LOC.`"_LOC,"ORWDPS ROUTING DEFAULT",1,"I")
55 S X=$$GET^XPAR("LOC.`"_LOC_"^SYS","ORWDPS ROUTING DEFAULT",1,"I")
56 I X="C" S X="C^in Clinic" G XPICK
57 I X="M" S X="M^by Mail" G XPICK
58 I X="W" S X="W^at Window" G XPICK
59 I X="N" S X="" G XPICK
60 I X="" S X=$S($D(^PSX(550,"C")):"M^by Mail",1:"W^at Window")
61XPICK Q X
62 ;
63DEFSPLY(DFN) ; return default days supply for this patient
64 N ORWX
65 S ORWX("PATIENT")=DFN
66 D DSUP^PSOSIGDS(.ORWX)
67 Q $G(ORWX("DAYS SUPPLY"))
68 ;
69DFLTSPLY(VAL,UPD,SCH,PAT,DRG) ; return days supply given quantity
70 ; VAL: default days supply
71 N ORWX,I
72 S ORWX("PATIENT")=PAT
73 I DRG S ORWX("DRUG")=DRG
74 F I=1:1:$L(UPD,U)-1 D
75 . S ORWX("DOSE ORDERED",I)=$P(UPD,U,I)
76 . S ORWX("SCHEDULE",I)=$P(SCH,U,I)
77 D DSUP^PSOSIGDS(.ORWX)
78 S VAL=$G(ORWX("DAYS SUPPLY"))
79 Q
80DISPMSG() ; return 1 to suppress dispense message
81 Q +$$GET^XPAR("ALL","ORWDPS SUPPRESS DISPENSE MSG",1,"I")
82 ;
83SCHALL(LST) ; return all schedules
84 N ILST,SCH,IEN,EXP,TYP,X0
85 S ILST=0,SCH=""
86 F S SCH=$O(^PS(51.1,"APPSJ",SCH)) Q:SCH="" D
87 . S IEN=0,EXP=""
88 . F S IEN=$O(^PS(51.1,"APPSJ",SCH,IEN)) Q:'IEN D Q:$L(EXP)
89 . . S X0=$G(^PS(51.1,IEN,0)),EXP=$P(X0,U,8),TYP=$P(X0,U,5)
90 . S ILST=ILST+1,LST(ILST)=SCH_U_EXP_U_TYP
91 Q
92FORMALT(ORLST,ORIEN,PSTYPE) ; return a list of formulary alternatives
93 N PSID,I
94 S ORIEN=+$P(^ORD(101.43,ORIEN,0),U,2)
95 D EN1^PSSUTIL1(.ORIEN,PSTYPE)
96 S PSID=0,I=0
97 F S PSID=$O(ORIEN(PSID)) Q:'PSID D
98 . S OI=+$O(^ORD(101.43,"ID",PSID_";99PSP",0))
99 . I OI S I=I+1,ORLST(I)=OI,$P(ORLST(I),U,2)=$P(^ORD(101.43,OI,0),U)
100 Q
101DOSEALT(LST,DDRUG,CUROI,PSTYPE) ; return a list of formulary alternatives for dose
102 N I,OI,ORWLST,ILST S ILST=0
103 D ENRFA^PSJORUTL(DDRUG,PSTYPE,.ORWLST)
104 S I=0 F S I=$O(ORWLST(I)) Q:'I D
105 . S OI=+$O(^ORD(101.43,"ID",+$P(ORWLST(I),U,4)_";99PSP",0))
106 . I OI,OI'=CUROI S ILST=ILST+1,LST(ILST)=OI_U_$P(^ORD(101.43,OI,0),U)
107 Q
108FAILDEA(FAIL,OI,ORNP,PSTYPE) ; return 1 if DEA check fails for this provider
109 N DEAFLG,PSOI,TPKG
110 S FAIL=0,TPKG=$P($G(^ORD(101.43,+$G(OI),0)),U,2)
111 Q:TPKG'["PS"
112 S PSOI=+TPKG Q:PSOI'>0
113 I '$L($T(OIDEA^PSSUTLA1)) Q
114 S DEAFLG=$$OIDEA^PSSUTLA1(PSOI,PSTYPE) Q:DEAFLG'>0
115 I '$L($$DEA^XUSER(,+$G(ORNP))) S FAIL=1
116 Q
117FDEA1(FAIL,OI,OITYPE,ORNP) ; only be called for an outpaitent and IV dialog
118 ;OI: IV Orderable Item
119 ;OITYPE: A:ADDITIVE S:SOLUTION
120 N DEAFLG,PSOI,TKPG
121 S FAIL=0,TPKG=$P($G(^ORD(101.43,+$G(OI),0)),U,2)
122 Q:TPKG'["PS"
123 S PSOI=+TPKG Q:PSOI'>0
124 I '$L($T(IVDEA^PSSUTIL1)) Q
125 S DEAFLG=$$IVDEA^PSSUTIL1(PSOI,OITYPE) Q:DEAFLG'>0
126 I '$L($P($G(^VA(200,+$G(ORNP),"PS")),U,2)),'$L($P($G(^("PS")),U,3)) S FAIL=1
127 Q
128 ;
129CHK94(VAL) ; return 1 if patch 94 has been installed
130 S VAL=0
131 I $O(^ORD(101.41,"B","PS MEDS",0)) S VAL=1
132 Q
133LOCPICK(Y,LOC) ; return default Location level routing
134 S Y=""
135 S Y=$$GET^XPAR("LOC.`"_LOC_"^SYS","ORWDPS ROUTING DEFAULT",1,"I")
136 I Y="C" S Y="C^in Clinic"
137 I Y="M" S Y="M^by Mail"
138 I Y="W" S Y="W^at Window"
139 I Y="N" S Y=""
140 Q
141HASOIPI(Y,QOID) ; Check if QO put orderable item's PI into Sig
142 N PIIEN,OIX
143 S Y=0
144 Q:'$D(^ORD(101.41,QOID,0))
145 S PIIEN=$O(^ORD(101.41,"B","OR GTX PATIENT INSTRUCTIONS",0))
146 Q:'PIIEN
147 S OIX=0
148 Q:'$D(^ORD(101.41,QOID,6,"D"))
149 F S OIX=$O(^ORD(101.41,+QOID,6,"D",OIX)) Q:'OIX D
150 . I OIX=PIIEN S Y=1 Q
151 Q
152HASROUTE(Y,QOID) ;Check if QO has a ROUTE defined
153 N ROUTID
154 S Y=0,ROUTID=0
155 S ROUTID=$O(^ORD(101.41,"B","OR GTX ROUTING",0))
156 Q:'ROUTID
157 Q:'$D(^ORD(101.41,+QOID))
158 I $D(^ORD(101.41,+QOID,6,"D",ROUTID)) S Y=1
159 Q
Note: See TracBrowser for help on using the repository browser.