Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSJDIN

PSJDIN.m

Go to the documentation of this file.
  1. PSJDIN ;BIR/MV - National Formulary Indicator Utility ;4 MAR 2000/ 4:27 PM
  1. ;;5.0;INPATIENT MEDICATIONS;**50,56,76,227,289**;16 DEC 97;Build 2
  1. ;
  1. ; Reference to ^PSSDIN is supported by DBIA# 3166.
  1. ; Reference to ^PS(52.6 is supported by DBIA# 1231.
  1. ; Reference to ^PS(52.7 is supported by DBIA# 2173.
  1. ; Reference to ^PS(50.7 is supported by DBIA# 2180.
  1. ; Reference tp ^PSDRUG is supported by DBIA# 2192.
  1. ;
  1. DINIV(FIL,DRGTMP) ;
  1. ;*Find the DD & OI IEN for the additive or solution
  1. ;*FIL: 52.6 or 52.7
  1. ;*DRGTMP: Additive or Solution's IEN
  1. ;
  1. NEW PSJDRG,PSJOI,PSJDD,PSJDIN,PSJINDEX
  1. S PSJDRG=$P(^PS(FIL,+DRGTMP,0),U,2),PSJOI=$P(^PS(FIL,+DRGTMP,0),U,11)
  1. D DIN(PSJOI,PSJDRG)
  1. Q
  1. DIN(PSJOI,PSJDRG) ;
  1. ;*This will issue the Restriction/guideline prompt for both OI & DD
  1. ;*PSJOI: Orderable Item IEN
  1. ;*PSJDRG: Dispense drug IEN
  1. ;
  1. NEW PSJDIN,PSJDD,PSJINDEX,Y,X,XIT
  1. D EN^PSSDIN(PSJOI,PSJDRG)
  1. Q:$O(^TMP("PSSDIN",$J,""))=""
  1. S PSJDIN=$$PROMPT^PSSDIN
  1. W:"DOY"[Y @IOF
  1. I PSJDIN="D"!(PSJDIN="Y") D Q:XIT=U
  1. . W !!,"Dispense Drug Text:" W ! D TXD("DD") W !!
  1. I PSJDIN="O"!(PSJDIN="Y") D
  1. . W !!,"Orderable Item Text:" W ! D TXD("OI") W !!
  1. D PAUSE^VALM1,CLEAR^VALM1
  1. Q
  1. TXD(N1) ;
  1. ;N1 = "OI" or "DD"
  1. ;DISPLAY OI/DD DRUG TEXT
  1. N N2,N3,N4,NX S XIT="",NX="PSSDIN" ;
  1. S N2="" F S N2=$O(^TMP(NX,$J,N1,N2)) Q:'N2!(XIT=U) D
  1. .S N3="" F S N3=$O(^TMP(NX,$J,N1,N2,N3)) Q:'N3!(XIT=U) D
  1. ..S N4="" F S N4=$O(^TMP(NX,$J,N1,N2,N3,N4)) Q:'N4!(XIT=U) D
  1. ...W !?5,^TMP(NX,$J,N1,N2,N3,N4) I $Y>15 W ! D HLD S XIT=X
  1. Q
  1. HLD ;
  1. W !
  1. ;K DIR S DIR(0)="E",DIR("A")="Press Return to Continue" D ^DIR K DIR
  1. K DIR
  1. S DIR(0)="E",DIR("A")="Press Return to Continue or ""^"" to Exit: "
  1. D ^DIR K DIR
  1. W @IOF
  1. Q
  1. NFIV(FIL,PSJIVIEN,PSJNF) ;
  1. ;*Return N/F and msg display for ad/sol.
  1. ;*FIL: "AD" or "SOL"
  1. ;*PSIVIEN: Additive or Solution's IEN
  1. ;*PSJNF: 0 node from file 50
  1. ;*PSJNF("NF"): Only exist if it is a Non-formulary
  1. ;*PSJNF("MSG"): Return the message field to be displayed /w IV names
  1. ;
  1. S PSJNF=$G(^PSDRUG(+$P($G(^PS(FIL,+PSJIVIEN,0)),U,2),0))
  1. S PSJNF("NF")=$S($P(PSJNF,U,9)=1:" *N/F*",1:"")
  1. S PSJNF("MSG")=$P(PSJNF,U,10)
  1. Q
  1. DINFLIV(DRG) ;
  1. ;*This module will find all drug text that exist for the Orderable
  1. ;*Items & dispense drugs associated with the Additive(s) & Solution(s)
  1. ;*within the IV order. Once a drug text exist, return the <DIN>
  1. ;*indicator to be displayed within the order view.
  1. ;
  1. ;*DRG: Drug array from the IV order
  1. NEW PSJFIL,PSJND,PSJX,PSJFL
  1. F PSJFIL="AD","SOL" F PSJND=0:0 S PSJND=$O(DRG(PSJFIL,PSJND)) Q:'PSJND!$G(PSJFL) D
  1. . S PSJX=$G(^PS($S(PSJFIL="AD":52.6,1:52.7),+DRG(PSJFIL,PSJND),0)) D EN^PSSDIN($P(PSJX,U,11),$P(PSJX,U,2))
  1. . I $O(^TMP("PSSDIN",$J,""))]"" S PSJFL=1 Q
  1. I '$G(PSJFL),$G(PSJORD)["P" S PSJFL=$$DINFLUD(+P("PD")),PSJFL=$S(PSJFL]"":1,1:0)
  1. K ^TMP("PSSDIN",$J)
  1. Q $S($G(PSJFL):" <DIN>",1:"")
  1. ;
  1. DINFLUD(PSJOI,PSJDDA) ;
  1. ;*This module will find all drug text that exist for the Orderable
  1. ;*items & dispense drugs associated with the unit dose order. Once
  1. ;*a drug text exist, return the <DIN> indicator to be displayed with
  1. ;*the order view.
  1. ;*PSJOI: Orderable IEN (Require)
  1. ;*PSJDDA: Dispense drug array within the order (Optional)
  1. ;
  1. NEW PSJFL,PSJDD
  1. D EN^PSSDIN(PSJOI) I $O(^TMP("PSSDIN",$J,"OI",0)) K ^TMP("PSSDIN",$J) Q "<DIN>"
  1. F PSJDD=0:0 S PSJDD=$O(PSJDDA(PSJDD)) Q:'PSJDD D
  1. . D EN^PSSDIN(,PSJDD) I $O(^TMP("PSSDIN",$J,"DD",0)) S PSJFL=1 Q
  1. K ^TMP("PSSDIN",$J)
  1. Q $S($G(PSJFL):"<DIN>",1:"")
  1. ;
  1. DINHIDE(PSJDFN,PSJORD) ;
  1. ;*Display drug text from the hidden action.
  1. ;*PSJDFN: Patient IEN (Require)
  1. ;*PSJORD: Order #_"UVP" (Required)
  1. ;*DRG: IV DRG array (Required for IV but Optional for UD orders)
  1. ;
  1. D:PSJORD["V" IV
  1. D:PSJORD["U" UD
  1. I PSJORD["P" D
  1. . D @($S($P(^PS(53.1,+PSJORD,0),U,4)="U":"UD",1:"IV")) ;PSJ*5*227 - Unit Dose DIN fix
  1. I PSJORD="" D NEWUD
  1. K ^TMP("PSSDIN",$J)
  1. Q
  1. IV ;
  1. ;NEW DRG,DRGI,DRGT,ND,ON55,Y
  1. ;D:PSJORD["P" GT531^PSIVORFA(DFN,PSJORD)
  1. ;I PSJORD["V" S ON55=PSJORD D GTDRG^PSIVORFB
  1. ;*Loop thru IV DRG array to find OI & DD IEN from each AD & SOL.
  1. ;
  1. NEW FIL,NAME,PSJDD,PSJNF,PSJOI,PSJX,Y,X,PSJXY,STR,UNT,STRUN
  1. D FULL^VALM1 W @IOF
  1. W !,"Drug restriction/guideline info:"
  1. F FIL="AD","SOL" F PSJX=0:0 S PSJX=$O(DRG(FIL,PSJX)) Q:'PSJX D
  1. . NEW X
  1. . S PSJXY=1
  1. . SET NAME=$P(DRG(FIL,PSJX),U,2)
  1. . ;PSJ*5*289 - Add Additive Strength to display.
  1. . S STR=$$GET1^DIQ(52.6,$P(DRG(FIL,PSJX),U,1)_",",19) ; Get STRENGTH from IV Additives File
  1. . S UNT=$$GET1^DIQ(52.6,$P(DRG(FIL,PSJX),U,1)_",",2) ; Get DRUG UNIT from IV Additives File
  1. . S STRUN=$G(STR)_" "_$G(UNT) ; Append DRUG UNIT to STRENGTH
  1. . I STR="" S STRUN="N/A" ; Per Pharmacy User Group - put N/A if the STRENGTH field is not populated.
  1. . W !!,"IV "_$S(FIL="AD":"Additive",1:"Solution")_": "_NAME
  1. . D NFIV(FIL,+PSJX,.PSJNF) W $G(PSJNF("NF"))_$S(FIL="AD":" Additive Strength: "_$G(STRUN),1:""),! ;Put Additive Strength after *N/F*.
  1. . S X=$S(FIL="AD":$G(^PS(52.6,+DRG(FIL,PSJX),0)),1:$G(^PS(52.7,+DRG(FIL,PSJX),0)))
  1. . S PSJOI=$P(X,U,11),PSJDD=$P(X,U,2) D EN^PSSDIN(+PSJOI,+PSJDD)
  1. . D DINOI(PSJOI,3)
  1. . D DINDD(PSJDD,3)
  1. D:'$G(PSJXY) HLD
  1. K ^TMP("PSSDIN",$J)
  1. Q
  1. UD ;
  1. ;*Loop thru Unit dose order for Orderable Item & Dispense drug
  1. ;
  1. NEW F,PSJDD,PSJDDX,PSJOI,PSJXY
  1. D FULL^VALM1 W @IOF
  1. W !,"Drug restriction/guideline info:"
  1. S F=$S(PSJORD["U":"^PS(55,PSJDFN,5,+PSJORD,",1:"^PS(53.1,+PSJORD,")
  1. S PSJOI=+@(F_".2)") D EN^PSSDIN(PSJOI),DINOI(PSJOI,3)
  1. ;*Loop thru dispense drug array
  1. F PSJDDX=0:0 S PSJDDX=$O(@(F_"1,"_PSJDDX_")")) Q:'PSJDDX D
  1. . S PSJXY=1
  1. . S PSJDD=+@(F_"1,"_PSJDDX_",0)")
  1. . D EN^PSSDIN(PSJOI,PSJDD)
  1. . D DINDD(PSJDD,3)
  1. D:'$G(PSJXY) HLD
  1. K ^TMP("PSSDIN",$J)
  1. Q
  1. NEWUD ;*New backdoor order doesn't have an order# yet.
  1. ;*Loop thru Orderable Item & Dispense drug
  1. ;
  1. NEW F,PSJDD,PSJDDX,PSJOI,PSJXY
  1. D FULL^VALM1 W @IOF
  1. W !,"Drug restriction/guideline info:"
  1. S PSJOI=+$G(PSGPD) D EN^PSSDIN(PSJOI),DINOI(PSJOI,3)
  1. ;*Loop thru dispense drug array
  1. F PSJDDX=0:0 S PSJDDX=$O(^PS(53.45,PSJSYSP,2,PSJDDX)) Q:'PSJDDX D
  1. . S PSJXY=1
  1. . S PSJDD=+$G(^PS(53.45,PSJSYSP,2,PSJDDX,0))
  1. . D EN^PSSDIN(PSJOI,PSJDD)
  1. . D DINDD(PSJDD,3)
  1. D:'$G(PSJXY) HLD
  1. K ^TMP("PSSDIN",$J)
  1. Q
  1. DINOI(PSJOI,COL) ;
  1. ;*Display drug text for Orderable Item
  1. ;*OI: Orderable Item IEN
  1. ;*COl: Column to display the text in
  1. ;
  1. NEW X,XX
  1. W !!,?COL,"Orderable Item: "_$$OINAME^PSJLMUTL(PSJOI)_$$OINF(PSJOI),!
  1. I '$O(^TMP("PSSDIN",$J,"OI",PSJOI,0)) W !,?10,"No information available",! Q
  1. D TXD("OI") W !
  1. Q
  1. DINDD(PSJDD,COL) ;
  1. ;*Display drug text for Dispense drug
  1. ;*PSJDD: Dispense drug IEN
  1. ;*COL: Column to display the text in
  1. ;
  1. NEW X
  1. W !,?COL,"Dispense drug: "_$$DDNAME^PSJLMUTL(+PSJDD)_$$DDNF(PSJDD),!
  1. I '$O(^TMP("PSSDIN",$J,"DD",PSJDD,0)) W !?10,"No information available",! D HLD Q
  1. D TXD("DD"),HLD W @IOF
  1. Q
  1. OINF(PSJOI) ;
  1. ;*Return *N/F* if the orderable item is Non-formulary
  1. ;*PSJOI: Orderable item IEN
  1. ;
  1. Q $S($P($G(^PS(50.7,+PSJOI,0)),U,12)=1:" *N/F*",1:"")
  1. ;
  1. DDNF(PSJDD) ;
  1. ;**Return *N/F* if the dispense drug is Non-formulary
  1. ;*PSJDD: Dispense drug IEN
  1. ;
  1. Q $S($P($G(^PSDRUG(+PSJDD,0)),U,9)=1:" *N/F*",1:"")