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

PSODOSUT.m

Go to the documentation of this file.
  1. PSODOSUT ;BIR/RTR - PRE Dose Check Utility routine ;11/18/08
  1. ;;7.0;OUTPATIENT PHARMACY;**251,375,372,416,436,402,518**;DEC 1997;Build 3
  1. ;External reference to ^PSSDSAPI supported by DBIA 5425
  1. ;
  1. ;DOSE expect PSODLQT to be defined prior to calling it.
  1. ; PSODLQT=1 means no data will be written to the screen, but a value will be returned.
  1. ; PSODLQT=0 means data will be written to the screen and a value is returned
  1. ;
  1. ;EVAL(PSODLINS,PSODLINR) ;
  1. ;Q $S($G(PSODLINS)&($G(PSODLINR)):"MAX SINGLE DOSE & DAILY DOSE RANGE",$G(PSODLINS):"MAX SINGLE DOSE",$G(PSODLINR):"DAILY DOSE RANGE",1:"UNKNOWN")
  1. ;
  1. SUMM ;
  1. I 'PSODLQT W !," DOSING CHECK SUMMARY:",!!
  1. S PSOCPXF=1
  1. Q
  1. ;
  1. SUB ;Write sub header; called from PSODOSUN
  1. D HD^PSODOSU2 Q:$G(PSODLQTC) I 'PSODLQT,'$G(PSODLEXR) D
  1. .I '$G(PSOINTRO),$G(PSODLEXR) W ! Q
  1. .S PSODLEXR=1
  1. I 'PSODLQT W " DOSE SEQ "_PSOCPXG_":"
  1. S PSOCPXRR(PSOCPXG)=1
  1. Q
  1. ;
  1. DAILY ;
  1. Q ;;removed for Mocha 2.1, might add back for 2.2
  1. Q:'$G(PSOCPXC)
  1. I 'PSODLQT W:'$G(PSORENW)!($G(PSOCOPY))!($G(PSORXED)) ! W " DAILY DOSE RANGE WARNING:"
  1. S PSODAILY=1
  1. Q
  1. ;
  1. COMPLEX ;called from DOSEZ^PSODOSUN
  1. I 'PSOCPXF&(PSOCPXC) S PSOCPXG=$P(PSODLNN1,";",4) D SUMM K PSODAILY S:PSOCPXC&(PSOCPXG=PSOCPXB) PSOCPXH=1
  1. I PSOCPXC S PSOCPXG=$P(PSODLNN1,";",4) D HD D
  1. .I $G(PSOCPXRR(PSOCPXG))&$P(PSODLNN1,";",5)'="" K PSODAILY
  1. .I '$G(PSOCPXRR(PSOCPXG))&('$G(PSOCPXH)) D SUB I $G(PSOCOPY)!($G(PSORENW)) S:PSOCPXC&(PSOCPXG=PSOCPXB) PSOCPXH=1
  1. .;I PSODLPL="2_RANGE"&PSODLINR&'$G(PSODAILY) D DAILY ;removed for Mocha 2.1, might add back for 2.2
  1. .;I PSODLPL="1_SINGLE_RANGE"&PSODLINX&'$G(PSODAILY) D DAILY ;removed for Mocha 2.1, might add back for 2.2
  1. .D HD W:'PSODLQT ! N X,DIWL,DIWR,DIWF S X=PSODLMSG,DIWL=1,DIWR=76 K ^UTILITY($J,"W") D ^DIWP
  1. .N PSODELXF,PSODELXR S PSODELXF=0 F PSODELXR=0:0 S PSODELXR=$O(^UTILITY($J,"W",DIWL,PSODELXR)) Q:'PSODELXR D HD W:PSODELXF&('PSODLQT) ! D HD W:'PSODLQT " "_$G(^UTILITY($J,"W",DIWL,PSODELXR,0)) S PSODELXF=1
  1. .K ^UTILITY($J,"W")
  1. .D HD I 'PSODLQT S PSODELNX=$O(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1)) I '$P($G(PSODELNX),";",5)!($P($G(PSODELNX),";",4)'=PSOCPXG) W !
  1. Q
  1. ;
  1. HD ;
  1. I $G(PSODLQT)!(($Y+5)<IOSL)!($G(PSORX("DFLG"))) Q
  1. N DIR,DTOUT,DUOUT,DIRUT,DIROUT,X,Y
  1. W ! K DIR,Y S DIR(0)="E",DIR("A")="Press Return to continue,'^' to exit" D ^DIR K DIR I 'Y!($D(DTOUT))!($D(DUOUT))!($G(DIRUT)) S PSODLQT=1,PSONEW("DFLG")=1,PSORX("DFLG")=1 Q
  1. W @IOF
  1. Q
  1. ;
  1. SFD ;
  1. S PSODELXF=1 S:PSODLERX="TEXT" PSODLERZ=1
  1. Q
  1. ;
  1. SBAD ;Set Bad Drug flag just in case not set in enhanced check, possibly because Dosage edits are done first
  1. N PSODLBD1,PSODLBD3
  1. I PSODLERB["GCNSEQNO"!(PSODLERB["Drug not matched to NDF") D
  1. .S PSODLBD1=$O(^TMP($J,"PSOPDOSA","OUT","EXCEPTIONS","DOSE",PSODSEQ,PSODLNN1,"")) I PSODLBD1 D
  1. ..S PSODLBD3=$P($G(^TMP($J,"PSOPDOSA","OUT","EXCEPTIONS","DOSE",PSODSEQ,PSODLNN1,PSODLBD1)),"^",3) I PSODLBD3 S PSODRUG("BAD",PSODLBD3)=1
  1. Q
  1. ;
  1. EXCEPT ;don't show "not matched to NDF" or "no GCNSEQNO" errors for dosing - when dosage is edited enhanced order checks are performed again so we don't want to display these type messages for dosing.
  1. N PSODLER1,PSODLER2,PSODLER3
  1. F PSODLER1=0:0 S PSODLER1=$O(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"EXCEPTIONS",PSODLER1)) Q:'PSODLER1 D
  1. .S PSODLER2=$G(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"EXCEPTIONS",PSODLER1))
  1. .I PSODLER2["Drug not matched to NDF"!(PSODLER2["GCNSEQNO") D
  1. .. S PSODLER3="" F PSODLER3=PSODLER1-1:1:PSODLER1 K ^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"EXCEPTIONS",PSODLER3)
  1. Q
  1. ;
  1. FEED() ; Write Line feed after Exceptions if no message globals follow, and next order has no errors or exceptions, only a message
  1. I PSODLQT Q 0
  1. N PSODLNN2
  1. I $D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1,"MESSAGE")) Q 0
  1. S PSODLNN2=$O(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN1))
  1. I PSODLNN2="" Q 0
  1. I $D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN2,"ERROR")) Q 0
  1. I $D(^TMP($J,"PSOPDOSN","OUT",PSODSEQ,PSODLNN2,"EXCEPTIONS")) Q 0
  1. Q 1
  1. ;
  1. DCHKN ;Called from PSOORNEW, PSOORNE1 & PSOORNEW; Dose Check for Copying an Order
  1. N PSOGENF
  1. S PSOGENF=0
  1. F PSOCPXA=0:0 S PSOCPXA=$O(PSONEW("DOSE",PSOCPXA)) Q:'PSOCPXA S PSOCPXB=PSOCPXB+1
  1. D FIN^PSODOSCL(.PSODLBS1,.PSONEW,.PSODRUG)
  1. S PSODLNVL=$$DOSE^PSODOSUN K ^TMP($J,"PSOPDOSN") K ^TMP($J,"PSOPDOSA")
  1. I $P($G(PSODLNVL),"^")=1 S PSORX("DFLG")=1 Q
  1. I '$G(PSODLNVL) Q
  1. I '$D(^XUSEC("PSORPH",DUZ)) S:$P($G(PSODLNVL),"^") ^TMP("PSODOSF",$J,0)=1 Q
  1. S PSODLNVT=$P(PSODLNVL,"^",2)
  1. I +PSODLNVL=3 S PSORX("DFLG")=1 Q
  1. ;I +PSODLNVL=3 D CANCEL(PSONEW("OIRXN")) Q ;CR2724
  1. I +$G(PSOGENF) Q ;Do not do intervention on a single General Dose message.
  1. I $$EN3^PSORXI(PSODLNVT) W !!,"Unable to log intervention, cannot find intervention type.",! K DIR S DIR(0)="E",DIR("?")="Press Return to continue",DIR("A")="Press Return to continue" D ^DIR K DIR
  1. Q
  1. ;
  1. DCHKR ;Renewal Dose Check; Called from PSORENW0
  1. N PSOGENF
  1. S PSOGENF=0
  1. F PSOCPXA=0:0 S PSOCPXA=$O(PSORENW("DOSE",PSOCPXA)) Q:'PSOCPXA S PSOCPXB=PSOCPXB+1
  1. D FIN^PSODOSCL(.PSODLBS1,.PSORENW,.PSODRUG)
  1. S PSODLNVL=$$DOSE^PSODOSUN
  1. I '$D(^XUSEC("PSORPH",DUZ)) S:$P($G(PSODLNVL),"^") ^TMP("PSODOSF",$J,0)=1
  1. K ^TMP($J,"PSOPDOSN") K ^TMP($J,"PSOPDOSA") I $P($G(PSODLNVL),"^")=1 S PSORX("DFLG")=1 Q
  1. D DOSIV
  1. Q
  1. ;
  1. DCHKC ;Dose Check on reinstate; Called from PSOCAN2
  1. N PSODCAN,PSOGENF
  1. S PSOGENF=0
  1. I '$D(PSODRUG("IEN")) S:$D(PSORENW("OIRXN")) PSODRUG("IEN")=$$GET1^DIQ(52,PSORENW("OIRXN"),6,"I")
  1. S PSOCPXB=0 F PSOCPXA=0:0 S PSOCPXA=$O(^PSRX(PSORENW("OIRXN"),6,PSOCPXA)) Q:'PSOCPXA I $P($G(^PSRX(PSORENW("OIRXN"),6,PSOCPXA,0)),"^")'="" S PSOCPXB=PSOCPXB+1
  1. D RX^PSODOSCL(.PSODLBS1,PSORENW("OIRXN"))
  1. S PSODLNNN=PSORENW("OIRXN"),PSODCAN=1
  1. S PSODLNVL=$$DOSE^PSODOSUN K ^TMP($J,"PSOPDOSN"),^TMP($J,"PSOPDOSA")
  1. I $P($G(PSODLNVL),"^")=1 S PSORX("DFLG")=1 Q
  1. D DOSIV
  1. I +PSODLNVL=3 S PSORX("DFLG")=1
  1. Q
  1. ;
  1. DCHK() ;Dose check after entering Null at the conjunction prompt
  1. ;For complex Dosing, they will eventually enter null too, so change to call if it was not a complex order, and null was entered
  1. N PSODONOF S PSODONOF="" D DOSEOFF Q:'+PSODONOF 0
  1. Q:$G(PSORX("DFLG")) 0
  1. ;D HD:(($Y+5)>IOSL) Q:$G(PSORX("DFLG")) 0
  1. N PSODLNNN,PSODLENT,PSODLNVL,PSODLNVT,X,Y,DIR,DTOUT,DUOUT,DIRUT,DIROUT,PSODLBS1,PSODLENT,PSOCPXA,PSOCPXV,PSOTOF,PSOCPXB,PSOGENF,PSOEDDOS
  1. S PSOGENF=0
  1. I $G(PSOEDIT) S PSOEDDOS=1
  1. ;Need to make sure Drug Name is what you set in the API
  1. ;Either pass in name here, or set in PSODOSCL to array name that PSSDSAPD uses, which is still the .01 of File 50
  1. I $$EXMT^PSSDSAPI(PSODRUG("IEN")) Q 0
  1. I $G(PSODRUG("BAD",PSODRUG("IEN"))) Q 0
  1. ;Currently only one prospective drug at a time for Outpatient Dose Check
  1. ;S PSODLNNN="O;1;PROSPECTIVE;1"
  1. K ^TMP("PSODOSF",$J)
  1. K ^TMP($J,"PSOPDOSA") K ^TMP($J,"PSOPDOSN") S PSODLBS1(1)="PSOPDOSA",PSODLBS1(3)="PSOPDOSN"
  1. D FIN^PSODOSCL(.PSODLBS1,.PSORXED,.PSODRUG)
  1. S PSODLENT=ENT,PSOCPXV=1,PSOCPXB=0
  1. S PSOCPXB=0 F PSOCPXA=0:0 S PSOCPXA=$O(PSORXED("DOSE",PSOCPXA)) Q:'PSOCPXA S PSOCPXB=PSOCPXB+1
  1. S PSODLNVL=$$DOSEX^PSODOSUN(PSODLENT) S PSOTOF=1 I '$D(^XUSEC("PSORPH",DUZ)) S:$P($G(PSODLNVL),"^") ^TMP("PSODOSF",$J,0)=1
  1. I $G(PSOEDDOS) D HD:(($Y+5)>IOSL) Q:$G(PSORX("DFLG")) 0
  1. I $P($G(PSODLNVL),"^")=1 K ^TMP($J,"PSOPDOSA") K ^TMP($J,"PSOPDOSN") Q 1 ;turn of general dosing flag because Intervention is needed
  1. DCHK2 ;Finishing of a complex order
  1. N PSOCPXC,PSOCPXD
  1. K PSODLNVL
  1. S PSOCPXD=1 ;flag for MOCHA 2.0, used to not display enter to continue prompt after errors/exceptions list which displays just after last dose sequence. MOCHA 2.0 does not display errors or exceptions.
  1. ;S (PSOCPXB)=0 ;setting PSOCPXB=0 makes dosing summery not display when cycling through individual doses of a complex order. Dose summary should only show after accept of order.
  1. S PSODLNVL=$$DOSEZ^PSODOSUN K ^TMP($J,"PSOPDOSA") K ^TMP($J,"PSOPDOSN")
  1. I $G(PSOEDDOS) D HD:(($Y+5)>IOSL) Q:$G(PSORX("DFLG")) 0
  1. I $P($G(PSODLNVL),"^")=1 Q 1
  1. I '$D(^XUSEC("PSORPH",DUZ)) S:$P($G(PSODLNVL),"^")=2 ^TMP("PSODOSF",$J,0)=$$CONVMSG($P(PSODLNVL,"^",2)) W ! Q 0
  1. I '$G(PSODLNVL) Q 0
  1. S PSODLNVT=$P(PSODLNVL,"^",2)
  1. I $D(PSORX("EDIT"))!($G(PSORXED)&$G(PSORXED)&$G(PSOEDDOS))!($G(PSOCOPY)&$G(PSODLBD4)) Q 0
  1. I +$G(PSOGENF) Q 0 ;Do not do intervention on a single General Dose message.
  1. I $$EN3^PSORXI(PSODLNVT) W !!,"Unable to log intervention, cannot find intervention type.",! K DIR S DIR(0)="E",DIR("?")="Press Return to continue",DIR("A")="Press Return to continue" D ^DIR K DIR
  1. W !
  1. Q 0
  1. ;
  1. DCHK1 ;Dose check after entering a value at the Conjunction prompt
  1. Q:$G(PSORX("DFLG"))!($G(PSODLQT))
  1. N PSODONOF S PSODONOF="" D DOSEOFF Q:'+PSODONOF
  1. ;D HD:(($Y+5)>IOSL) Q:$G(PSORX("DFLG"))
  1. N PSODLNNN,PSODLNVL,PSODLNVT,X,Y,DIR,DTOUT,DUOUT,DIRUT,DIROUT,PSODLBS1,PSODLENT,PSOCPXB,PSOGENF
  1. S PSOGENF=0
  1. ;Need to make sure Drug Name is what you set in the API
  1. ;Either pass in name here, or set in PSODOSCL to array name that PSSDSAPD uses, which is still the .01 of File 50
  1. I $$EXMT^PSSDSAPI(PSODRUG("IEN")) Q
  1. I $G(PSODRUG("BAD",PSODRUG("IEN"))) Q
  1. ;Currently only one prospective drug at a time for Outpatient Dose Check
  1. ;S PSODLNNN="O;1;PROSPECTIVE;1"
  1. K ^TMP($J,"PSOPDOSA") K ^TMP($J,"PSOPDOSN") S PSODLBS1(1)="PSOPDOSA",PSODLBS1(3)="PSOPDOSN"
  1. D FIN^PSODOSCL(.PSODLBS1,.PSORXED,.PSODRUG)
  1. S PSODLENT=ENT,PSOCPXB=0
  1. F PSOCPXA=0:0 S PSOCPXA=$O(PSORXED("DOSE",PSOCPXA)) Q:'PSOCPXA S PSOCPXB=PSOCPXB+1
  1. S PSODLNVL=$$DOSEX^PSODOSUN(PSODLENT)
  1. D HD:(($Y+5)>IOSL) Q:$G(PSORX("DFLG"))
  1. K ^TMP($J,"PSOPDOSA") K ^TMP($J,"PSOPDOSN") I $P($G(PSODLNVL),"^")=1 S PSORXED("DFLG")=1 Q
  1. I '$G(PSODLNVL) Q
  1. I '$D(^XUSEC("PSORPH",DUZ)) S:$P($G(PSODLNVL),"^")=2 ^TMP("PSODOSF",$J,0)=$$CONVMSG($P(PSODLNVL,"^",2)) W ! Q
  1. S PSODLNVT=$P(PSODLNVL,"^",2)
  1. I +$G(PSOGENF) Q ;Do not do intervention on a single General Dose message.
  1. I $$EN3^PSORXI(PSODLNVT) W !!,"Unable to log intervention, cannot find intervention type.",! K DIR S DIR(0)="E",DIR("?")="Press Return to continue",DIR("A")="Press Return to continue" D ^DIR K DIR
  1. W !
  1. Q
  1. ;
  1. CONVMSG(MESS) ;Convert DOSE CHECK message to numeric value for field 8 of ^PS(52.4
  1. ;For MOCHA 2.0, only returning "DOSAGE EXCEEDS MAX SINGLE DOSE" when a dosing error is present.
  1. N PSODOSF
  1. S MESS="DOSAGE EXCEEDS MAX SINGLE DOSE AND/OR MAX DAILY DOSE"
  1. S PSODOSF=$S(MESS="DOSAGE EXCEEDS MAX SINGLE DOSE AND/OR MAX DAILY DOSE":4,MESS="MAX SINGLE DOSE & MAX DAILY DOSE":3,MESS="MAX SINGLE DOSE":2,MESS="MAX DAILY DOSE":1,1:"")
  1. Q PSODOSF
  1. ;
  1. DCHKV ;Dose check when verifying an order
  1. N PSODOSF,PSOLINE,PSOVERFL,PSOVCAN,PSOGENF
  1. S PSOVERFL=1
  1. S PSOGENF=0
  1. F PSOCPXA=0:0 S PSOCPXA=$O(^PSRX(PSONV,6,PSOCPXA)) Q:'PSOCPXA I $P($G(^PSRX(PSONV,6,PSOCPXA,0)),"^")'="" S PSOCPXB=PSOCPXB+1
  1. D RX^PSODOSCL(.PSODLBS1,PSONV)
  1. S $P(PSOLINE,"-",79)="-"
  1. S PSODLNNN=PSONV
  1. S PSODLNVL=$$DOSE^PSODOSUN K ^TMP($J,"PSOPDOSN") K ^TMP($J,"PSOPDOSA") I $P($G(PSODLNVL),"^")=1 S PSORX("DFLG")=1 Q
  1. I '$D(^XUSEC("PSORPH",DUZ)) S:$P($G(PSODLNVL),"^")=2 ^TMP("PSODOSF",$J,0)=$$CONVMSG($P(PSODLNVL,"^",2))
  1. I '$G(PSODLNVL) Q
  1. I +PSODLNVL=3 D Q:PSOVCAN
  1. . D SIG^XUSESIG I X1="" S (PSORX("DFLG"),PSVERFLG)=1 Q
  1. . D NOOR^PSOCAN4
  1. . I $G(DIRUT) D UPOUT^PSODGDG1,KILL^PSODGDG1 K PSONORR,PSORX("INTERVENE") Q
  1. . S PSOVCAN=1
  1. . S DA=PSONV D RXV^PSODGDG1 S DA=PSONV D INV^PSODGDG1 S DA=PSONV D PSDEL^PSODGDG1,DEL^PSODGDG1
  1. . K DIK,LST,PSONOOR S PSVERFLG=1
  1. S PSODLNVT=$P(PSODLNVL,"^",2),PSODOSF=1
  1. I +PSODLNVL=3 S PSORX("DFLG")=1 Q
  1. S DA=PSONV,RX=$G(^PSRX(PSONV,0)) D DOSIV ;CRI^PSODGDG1
  1. Q
  1. ;
  1. DOSIV ;DOSE INTERVENTION
  1. I PSOFROM="C",'$D(^XUSEC("PSORPH",DUZ)) Q
  1. I '$D(^XUSEC("PSORPH",DUZ)) S:$P($G(PSODLNVL),"^")=2 ^TMP("PSODOSF",$J,0)=$$CONVMSG($P(PSODLNVL,"^",2)) Q
  1. I '$G(PSODLNVL) Q
  1. S PSODLNVT=$P(PSODLNVL,"^",2)
  1. DOSIV1 ;
  1. I +$G(PSOGENF) Q ;Do not do intervention on a single General Dose message.
  1. I $$EN3^PSORXI(PSODLNVT) D
  1. . W !!,"Unable to log intervention, cannot find intervention type.",!
  1. . K DIR S DIR(0)="E",DIR("?")="Press Return to continue",DIR("A")="Press Return to continue" D ^DIR K DIR
  1. Q
  1. ;
  1. CANCEL(PSONV) ;CR2724 - where PSONV = RXIEN
  1. D SIG^XUSESIG I X1="" S PSORX("DFLG")=1 Q
  1. D NOOR^PSOCAN4
  1. I $G(DIRUT) D UPOUT^PSODGDG1,KILL^PSODGDG1 K PSONORR,PSORX("INTERVENE") Q
  1. S DA=PSONV D INV^PSODGDG1 S DA=PSONV D PSDEL^PSODGDG1,DEL^PSODGDG1
  1. K DIK,LST,PSONOOR
  1. Q
  1. ;
  1. DOSCK(PSOFROM,MSG) ;
  1. ;D HD
  1. N PSODONOF S PSODONOF="" D DOSEOFF Q:'+PSODONOF
  1. I $G(PSORX("DFLG"))!($G(PSODOSD)) S PSORX("DFLG")=1 K PSODOSD Q
  1. N PSODLNNN,PSODLNVL,PSODLNVT,X,Y,DIR,DTOUT,DUOUT,DIRUT,DIROUT,PSODLBS1,PSOCPXA,PSOCPXB,PSOCPXC
  1. Q:$$EXMT^PSSDSAPI(PSODRUG("IEN"))
  1. Q:$G(PSODRUG("BAD",PSODRUG("IEN")))
  1. K ^TMP($J,"PSOPDOSN"),^TMP($J,"PSOPDOSA"),^TMP("PSODOSF",$J) S PSODLBS1(1)="PSOPDOSA",PSODLBS1(3)="PSOPDOSN"
  1. I ($D(DTOUT))!($D(DUOUT))!($G(DIRUT))!($G(PSODLQT)) K PSODLQT,DTOUT,DUOUT,DIRUT,PSORX("DFLG") Q
  1. ;D CLEAR^VALM1
  1. S PSOCPXB=0
  1. I PSOFROM="V" D DCHKV Q ;PSOVER1 - verification
  1. I PSOFROM="N" D DCHKN Q ;PSOORNE1 & PSOORNEW - new & copy
  1. I PSOFROM="R" D DCHKR Q ;PSORENW0 - renewal
  1. I PSOFROM="C" D DCHKC Q ;PSOCAN2 - cancel
  1. Q
  1. ;
  1. RCONVMS(MESS) ;Convert DOSE CHECK from numeric to alpha
  1. N PSODOSF
  1. S MESS=4 ;For MOCHA 2.0, only returning "DOSAGE EXCEEDS MAX SINGLE DOSE" when a dosing error is present.
  1. S PSODOSF=$S(MESS=4:"DOSAGE EXCEEDS MAX SINGLE DOSE AND/OR MAX DAILY DOSE",MESS=3:"MAX SINGLE DOSE & DAILY DOSE RANGE",MESS=2:"MAX SINGLE DOSE",MESS=1:"DAILY DOSE RANGE",1:"")
  1. Q PSODOSF
  1. ;
  1. DOSEOFF ;
  1. S PSODONOF=$$DS^PSSDSAPI
  1. DOSEOFF2 ;
  1. I $G(PSORX("DOSING OFF")),+PSODONOF K PSORX("DOSING OFF"),PSOREINF,PSOONOFC Q
  1. Q:+PSODONOF
  1. I ($G(PSOONOFC)!$G(PSOREINF)),'+PSODONOF S PSORX("DOSING OFF")=1 ;Reinstate news PSORX array so have to work around it
  1. Q:$G(PSORX("DOSING OFF")) ;only display 'dosing off' message once per patient
  1. N PSODOFFC
  1. I '+PSODONOF&($P(PSODONOF,"^",2)'="") D
  1. .S X=$P(PSODONOF,"^",2),DIWL=1,DIWR=73 K ^UTILITY($J,"W") D ^DIWP W !
  1. .S PSODOFFC=0 F PSODOFFC=0:0 S PSODOFFC=$O(^UTILITY($J,"W",DIWL,PSODOFFC)) Q:'PSODOFFC W !?5,$G(^UTILITY($J,"W",DIWL,PSODOFFC,0))
  1. .N DIR,DIRUT,DUOUT,X,Y S DIR(0)="E"
  1. .S DIR("A")="Press Return to continue...",DIR("?")="Press Return to continue"
  1. .W ! D ^DIR K DIRUT,DUOUT,DIR,X,Y W !
  1. .K ^UTILITY($J,"W")
  1. .S PSORX("DOSING OFF")=1 S:$G(PSOREINS) (PSOREINF,PSOONOFC)=1 ;set this flag to only display 'dosing off' message once per session.
  1. Q