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

PSGOE82.m

Go to the documentation of this file.
  1. PSGOE82 ;BIR/CML - NON-VERIFIED ORDER EDIT (CONT.) ;Oct 14, 2020@16:44:24
  1. ;;5.0;INPATIENT MEDICATIONS ;**2,35,50,67,58,81,127,168,181,276,317,366,327,319,411,372**;DEC 97;Build 153
  1. ;
  1. ; Reference to ^DD(53.1 is supported by DBIA #2256.
  1. ; Reference to ^VA(200 is supported by DBIA #10060.
  1. ; Reference to ^DIE is supported by DBIA #10018.
  1. ; Reference to ^DIC is supported by DBIA #10006.
  1. ; Reference to ^DICN is supported by DBIA #10009.
  1. ; Reference to $$GET^XPAR is supported by DBIA #2263
  1. ; Reference to $$SDEA^XUSER supported by DBIA #2343
  1. ;
  1. 1 ; provider
  1. S MSG=0,PSGF2=1 S:PSGOEEF(PSGF2) BACK="1^PSGOE82"
  1. A1 I $G(PSGORD)["P",$G(PSGP) I $$LASTREN^PSJLMPRI(PSGP,PSGORD) D Q
  1. . W !?5,"This order has been renewed. Provider may not be edited at this point. " D PAUSE^VALM1
  1. ;*366 - check provider credentials
  1. I PSGPR N PSJACT,BKP,BKPN S PSJACT=$$ACTPRO^PSGOE1(PSGPR) I 'PSJACT D
  1. . S BKP=$S($G(PSGPR):$G(PSGPR),1:$G(PSGOPR)),BKPN=$S($L($G(PSGPRN)):$G(PSGPRN),1:$G(PSGOPRN)),PSGPR=0,PSGPRN="",PSJACT="Z"
  1. ;; START NCC T4 MODS >> 327*RJS
  1. S PSTMPI=PSGPR,PSTMPN=PSGPRN
  1. A01 ;
  1. W !,"PROVIDER: ",$S(PSGPR:PSGPRN_"// ",1:"") R X:DTIME
  1. I X="^"!'$T W:'$T $C(7) S PSGOEE=0 S:PSJACT="Z" PSGPR=$S($G(BKP):BKUP,1:$G(PSTMPI)),PSGPRN=$S($L($G(BKPN)):BKPN,1:$G(PSTMPN)) G DONE
  1. I $S(X="":'PSGPR,1:X="@") W $C(7)," (Required)" S X="?" D ENHLP^PSGOEM(53.1,1) G A1
  1. I X="",PSGPR S X=PSGPRN I PSGPR'=PSGPRN,$$GET1^DIQ(200,PSGPR,53.1,"I") G:'$G(ANQX) DONE
  1. I +$G(ANQX) G A2
  1. I X?1."?" D ENHLP^PSGOEM(53.1,1)
  1. I $E(X)="^" D ENFF G:Y>0 @Y G A1
  1. K DIC S DIC="^VA(200,",DIC(0)="EMQZ",DIC("S")="I $$ACTPRO^PSGOE1(+Y)" D ^DIC K DIC I Y'>0 G A1
  1. A2 S ANQX=0 D CLOZPRV
  1. I $G(ANQX) S PSGPR=PSTMPI,PSGPRN=PSTMPN K PSTMPN,PSTMPI,ANQX G A1
  1. ;; END NCC T4 MODS << 327*RJS
  1. S PSGPR=+Y,PSGPRN=Y(0,0)
  1. ;*372
  1. N PSJDEA,PSDEA,PDEA,PSPPKG
  1. I $G(PSGPDRG)]"" D
  1. .S PSPPKG=$S(PSJPROT=1:"U",PSJPROT=3:"UI",1:"") Q:PSPPKG=""
  1. .S PSJDEA=$$OIDEA^PSSOPKI(PSGPDRG,PSPPKG),PSDEA=$P(PSJDEA,";",2) I +PSDEA>=2,+PSDEA<=5 S PDEA=$$SDEA^XUSER(,+PSGPR,PSDEA,,"I")
  1. I ($G(PDEA)=2)!($G(PDEA)=1)!(+$G(PDEA)=4) S PSJACT="Z" D G A01
  1. .W !,"Provider not authorized to prescribe medications in Federal Schedule "_PSDEA_".",!,"Please contact the provider.",!
  1. .S PSGPR=$G(PSTMPI),PSGPRN=$G(PSTMPN)
  1. G DONE
  1. ;
  1. 5 ; self med
  1. S MSG=0,PSGF2=5 S:PSGOEEF(PSGF2) BACK="5^PSGOE82" K PSGOEEF(6) S:PSGSM PSGOEEF(6)=1
  1. A5 W !,"SELF MED: " W $P("NO^YES","^",PSGSM+1),"// " R X:DTIME I X="^"!'$T W:'$T $C(7) S PSGOEE=0 G DONE
  1. ;I "01"[X,$L(X)<2 S:PSGSM=""&(X]"") PSGSM=X W:PSGSM]"" " (",$P("NO^YES","^",PSGSM+1),")" G:'PSGSM DONE S PSGOEEF(6)=1 G 6
  1. I "01"[X,$L(X)<2 S:X]"" PSGSM=+X W:PSGSM]"" " (",$P("NO^YES","^",PSGSM+1),")" G:'PSGSM DONE S PSGOEEF(6)=1 G 6
  1. I X="@" W $C(7)," (Required)" G A5
  1. I X?1"^".E D ENFF G:Y>0 @Y G A5
  1. I X?1."?" D ENHLP^PSGOEM(53.1,5) G A5
  1. D YN I S PSGSM=$E(X)="Y" K PSGOEEF(6) G:'PSGSM DONE S PSGOEEF(6)=1 G 6
  1. W $C(7) D ENHLP^PSGOEM(53.1,5) G A5
  1. ;
  1. 6 ; hospital supplied self med
  1. S MSG=0,PSGF2=6 S:PSGOEEF(PSGF2) BACK="6^PSGOE82"
  1. A6 W !,"HOSPITAL SUPPLIED SELF MED: " W:PSGHSM]"" $P("NO^YES","^",PSGHSM+1),"// " R X:DTIME I X="^"!'$T W:'$T $C(7) S PSGOEE=0 G DONE
  1. I "01"[X,$L(X)=1 S:X]"" PSGHSM=+X W " (",$P("NO^YES","^",PSGHSM+1),")" S MSG=0,PSGF2=5 G DONE
  1. I X="@" W $C(7)," (Required)" G A6
  1. I X?1"^".E D ENFF G:Y>0 @Y G A6
  1. I X?1."?" D ENHLP^PSGOEM(53.1,6) G A6
  1. D YN I S PSGHSM=$E(X)="Y" S MSG=0,PSGF2=5 G DONE
  1. W $C(7) D ENHLP^PSGOEM(53.1,6) G A6
  1. ;
  1. 2 ; dispense drug multiple
  1. ;*276 - Disallow unauthorized nurses from editing Dispense Drug
  1. I '$P($G(PSJSYSU),";",4) W !,"You are not authorized to edit Dispense Drugs." D PAUSE^VALM1 Q
  1. S MSG=0,PSGF2=2,BACK="2^PSGOE82" K PSGOEEND
  1. N PSGX,ARRAY D LIST^DIC(53.4502,","_PSJSYSP_",",,"I",,,,,,,"ARRAY") S PSGX=+ARRAY("DILIST",0)
  1. N PSJPNDRN I $G(PSGORD) I $E(PSGORD,$L(PSGORD))="P",$$GET1^DIQ(53.1,+PSGORD,103,"I")="R" S PSJPNDRN=1 D
  1. .S $P(PSJPNDRN,"^",2)="Dispense drugs for renewal orders cannot be deleted, but can be given an INACTIVE DATE. "
  1. ; PSJ*5*317 - If PSJ PADE OE BALANCES parameter is YES, PADE balances should display as identifier.
  1. N PSJPADLK S PSJPADLK=0 ; Flag indicating PADE drug lookup was done, don't do drug lookup twice - PSJ*5*317
  1. I $$GET^XPAR("SYS","PSJ PADE OE BALANCES") D
  1. .N DA,DIC,DIE,DR,DIR,PSJLOC,PSJDRG,PSJDDC,DFN,PSJORD,PSJPOI,PSJORCL,PSJCLNK,PSJCLND
  1. .; If clinic order, quit if clinic location is not linked to PADE
  1. .S PSJORCL=$S($G(PSGORD)["P":$$GET1^DIQ(53.1,+$G(PSGORD),113,"I")_"^"_$$GET1^DIQ(53.1,+$G(PSGORD),126,"I"),1:"")
  1. .I PSJORCL,$P(PSJORCL,"^",2) S PSJCLNK=$$PADECL^PSJPAD50(+$G(PSJORCL)) Q:'PSJCLNK
  1. .I '$G(PSJCLNK) Q:'$$PADEWD^PSJPAD50(+$G(VAIN(4)))
  1. .I $G(PSGORD) S PSJPOI=$$GET1^DIQ(53.1,PSGORD,108,"I")
  1. .S DFN=$G(PSGP),PSJORD=$G(PSGORD)
  1. .N ARRAY D LIST^DIC(53.4502,","_+$G(PSJSYSP)_",",,"I",,,,,,,"ARRAY")
  1. .F I=1:1 Q:'$D(ARRAY("DILIST",2,I)) S PSJDDC=ARRAY("DILIST",2,I),PSJDRG(PSJDDC)=$$GET1^DIQ(53.4502,PSJDDC_","_PSJSYSP,.01,"I") I '$G(PSJPOI) D
  1. ..S PSJPOI=+$$GET1^DIQ(50,+$G(PSJDRG(PSJDDC)),2.1,"I")
  1. ..I '$G(PSJPOI),$G(PSGPD),($$GET1^DIQ(50.7,+$G(PSGPD),.01)]"") S PSJPOI=+PSGPD
  1. .S PSJCLND=$S($G(PSJORD)["U":$$GET1^DIQ(55.06,+PSJORD_","_DFN,28,"I"),$G(PSJORD)["P":$$GET1^DIQ(53.1,+PSGORD,113,"I")_"^"_$$GET1^DIQ(53.1,+PSGORD,126,"I"),1:"")
  1. .S PSJLOC=$S(PSJCLND&$P(PSJCLND,"^",2):+PSJCLND_"C",1:"")
  1. .;S PSJLOC=$S($G(PSJORD)["U":+$G(^PS(55,DFN,5,+PSJORD,8))_"C",$G(PSJORD)["P":+$G(^PS(53.1,+PSJORD,"DSS"))_"C",1:"")
  1. .S:'PSJLOC PSJLOC=+$G(VAIN(4)) I '$G(PSJLOC) D
  1. ..N VAIN D INP^VADPT S PSJLOC=$G(VAIN(4))
  1. .S PSJPADLK=1
  1. .D READDD^PSJPAD50(.PSJDRG,$S($G(PSGPD):+$G(PSGPD),1:+$G(PSJPOI)),PSJLOC,PSJORD,$G(PSGORD))
  1. ; PSJ*5*317 - If PSJ PADE OE BALANCES parameter is NO, PADE balances should NOT display as identifer.
  1. I '$G(PSJPADLK) N DA,DIC,DIE,DR,DIR S DIE="^PS(53.45,",DA=PSJSYSP,DR=2,DR(2,53.4502)=".01;.02"_$S($G(PSJPNDRN):";.03",1:"") D ^DIE
  1. I '$O(^PS(53.45,PSJSYSP,2,0)) W $C(7),!!,"WARNING: This order must have at least one dispense drug before pharmacy can",!?9,"verify it!",! S MSG=1
  1. D DDOC(PSGX)
  1. NEW PSJDOSE
  1. D DOSECHK^PSJDOSE
  1. I +$G(PSJDSFLG) D DSPWARN^PSJDOSE S PSGOEEF(109)=1
  1. G DONE
  1. ;
  1. 40 ; comments
  1. S MSG=0,PSGF2=40,BACK="40^PSGOE82",DA=PSJSYSP,DR=1,DIE="^PS(53.45," D ^DIE W ! G DONE
  1. ;
  1. 66 ; provider comments
  1. ;S MSG=0,PSGF2=66,BACK="66^PSGOE82",DA=PSJSYSP,DR=4,DIE="^PS(53.45," D ^DIE W ! G DONE
  1. ;
  1. DONE ;
  1. I PSGOEE G:'PSGOEEF(PSGF2) @BACK S PSGOEE=PSGOEEF(PSGF2)
  1. K F,F0,PSGF2,F3,PSG,SDT Q
  1. ;
  1. ENFF ; up-arrow to another field
  1. S Y=-1 I '$D(PSGOEEF)!(X?1"^"1.9N) W $C(7)," ??" Q
  1. S X=$E(X,2,99) I X=+X S Y=$S($D(PSGOEEF(X)):X,1:-1) W " " W:Y>0 $$CODES2^PSIVUTL(53.1,X) W:Y'>0 $C(7),"??" Q
  1. K DIC S DIC="^DD(53.1,",DIC(0)="QEM",DIC("S")="I $D(PSGOEEF(+Y))" D ^DIC K DIC S Y=+Y S:Y>0 Y=$P($T(@("F"_Y)),";",3) Q
  1. ;
  1. DEL ; delete entry
  1. W !?3,"SURE YOU WANT TO DELETE" S %=0 D YN^DICN I %'=1 W $C(7)," <NOTHING DELETED>"
  1. Q
  1. ;
  1. CLOZPRV ;; START NCC T4 MODS >> 327*RJS
  1. N CLOZFLG I $G(PSGORD)["P",$$GET1^DIQ(53.1,+PSGORD,.01) S CLOZFLG=$$ISCLOZ^PSJCLOZ(+PSGORD) I 1
  1. E I $G(PSGORD),$$GET1^DIQ(55.06,+PSGORD_","_PSGP,.01) S CLOZFLG=$$ISCLOZ^PSJCLOZ(,,PSGP,+PSGORD) I 1
  1. E S CLOZFLG=$$ISCLOZ^PSJCLOZ(,,,+$G(PSGDRG))
  1. I CLOZFLG D
  1. .I PSGPR'=+Y S PSGPR=+Y,PSGPRN=Y(0,0)
  1. .S ANQX=0 D PROVCHK^PSJCLOZ(PSGPR)
  1. .I ANQX=0 K PSTMPN,PSTMPI
  1. ;; END NCC T4 MODS << 327*RJS
  1. Q
  1. ;
  1. YN ; yes/no as a set of codes
  1. I X'?.U F Y=1:1:$L(X) I $E(X,Y)?1L S X=$E(X,1,Y-1)_$C($A(X,Y)-32)_$E(X,Y+1,$L(X))
  1. F Y="NO","YES" I $P(Y,X)="" W $P(Y,X,2) Q
  1. Q
  1. DDOC(PSGX) ; Order check on additional dispense drug for allergy and adv. reactions.
  1. N PSGY,PSGND1,PSGND3,PSJALLGY
  1. S PSGY=0 F S PSGX=$O(^PS(53.45,PSJSYSP,2,PSGX)) Q:'PSGX S PSGY=$P($G(^PS(53.45,PSJSYSP,2,PSGX,0)),"^") Q:PSGY="" D
  1. . N INTERVEN,PSJDDI,PSJIREQ,PSJRXREQ,PSJDD,PSGORQF,PSJPDRG S PSJDD=PSGY
  1. . S Y=1,(PSJIREQ,PSJRXREQ,INTERVEN,X)=""
  1. . I '$G(PSJALGY1) S PSJALLGY(PSJDD)="" D ALLERGY^PSJOC
  1. . ;D IVSOL^PSGSICHK
  1. . I ($D(PSGORQF)) D
  1. .. K ^PS(53.45,PSJSYSP,2,PSGX),^PS(53.45,PSJSYSP,2,"B",PSGY)
  1. Q
  1. ;
  1. 50 N DIR,X,Y,CLN
  1. S MSG=0,PSGF2=50 S:$G(PSGOEEF(PSGF2)) BACK="50^PSGOE82"
  1. S DIR(0)="P^44:EMZ",DIR("A")="Visit Location",DIR("S")="I $P($G(^SC(Y,0)),U,3)=""C"",$$ACTLOC^PSJOE1(Y),$$IMOLOC^PSJOE1(Y,$G(PSGP))>-1"
  1. S CLN=$S($G(PSJCLAPP):+PSJCLAPP,$G(P("CLIN")):P("CLIN"),1:0) I CLN S DIR("B")=$P(^SC(CLN,0),U)
  1. D ^DIR
  1. I $D(DIRUT) S PSGOEE=0 G DONE
  1. S $P(PSJCLAPP,"^")=+Y,P("CLIN")=+Y
  1. I '$G(PSGOEEF(+PSGF2)) S PSGOEE=0
  1. G DONE
  1. ;
  1. 51 N %DT,X,Y,CLNDT
  1. S MSG=0,PSGF2=51 S:$G(PSGOEEF(PSGF2)) BACK="51^PSGOE82"
  1. K %DT
  1. S %DT("A")="Date/Time of Visit: ",%DT="AER"
  1. S Y=$S($P($G(PSJCLAPP),"^",2):$P(PSJCLAPP,"^",2),$G(P("APPT")):P("APPT"),1:"")
  1. I Y'="" X ^DD("DD") S %DT("B")=Y
  1. X ^DD("DD")
  1. D ^%DT
  1. I Y<0!($D(DTOUT)) S PSGOEE=0 G DONE
  1. S $P(PSJCLAPP,"^",2)=+Y,P("APPT")=+Y
  1. K %DT
  1. I '$G(PSGOEEF(+PSGF2)) S PSGOEE=0
  1. G DONE
  1. ;
  1. F101 ;;101^PSGOE8
  1. F109 ;;109^PSGOE8
  1. F3 ;;3^PSGOE8
  1. F7 ;;7^PSGOE8
  1. PSGF26 ;;26^PSGOE8
  1. F39 ;;39^PSGOE81
  1. F8 ;;8^PSGOE81
  1. F10 ;;10^PSGOE81
  1. PSGF25 ;;25^PSGOE81
  1. F1 ;;1^PSGOE82
  1. F5 ;;5^PSGOE82
  1. PSGF2 ;;2^PSGOE82