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

PSJLMGUD.m

Go to the documentation of this file.
PSJLMGUD ;BIR/MLM - INITIALIZE UNIT DOSE ORDER FIELDS FOR DISPLAY ;Nov 10, 2020@14:21:01
 ;;5.0;INPATIENT MEDICATIONS;**25,58,85,116,110,111,267,275,315,256,373,366,319,399**;16 DEC 97;Build 64
 ;
 ;;Per VHA Directive 2004-038, this routine should not be modified.
 ; Reference to ^PS(51.2 is supported by DBIA 2178
 ; Reference to ^PSDRUG( is supported by DBIA 2192
 ; Reference to ^PS(55   is supported by DBIA 2191
 ; Reference to ES^ORX8 is supported by DBIA 3632
 ;
GETUD(DFN,PSGORD) ;
 ;
EN2 ;
 N %X,%Y,ND2,ND2P1,DO,DRGI,FD,FL,FQC,NF,ND,PRI,SD,SIG,ST,STD,X,Y,ESIG ;*315
 K GMRAL,P
 S NF=$S(PSGORD["U":0,PSGORD["A":0,PSGORD["O":0,1:1) I NF,$D(^PS(53.1,+PSGORD,0)),$P(^(0),"^",19),$D(^PS(55,DFN,5,$P(^(0),"^",19))),(+$P(^(0),"^",19)'=+$P(^(0),"^",25)) S PSGORD=+$P(^PS(53.1,+PSGORD,0),"^",19)_"U",NF=0
 S (FL,Y)="",$P(FL,"-",71)="",PSGOEEWF="^PS("_$S(NF:"53.1,",1:"55,"_DFN_",5,")_+PSGORD_","
 ; The naked reference on the line below refers to the full reference created by indirect reference to F, where F may refer to ^PS(53.1 or the IV or UD multiple ^PS(55
 S ND=$G(@(PSGOEEWF_"0)")),ND2=$G(^(2)),ND2P1=$G(^(2.1)),PSGEB=$P($G(^(4)),"^",7),PSGOSI=$G(^(6)),SIG=$G(^(6.5)),DO=$G(^(.2)),PSGOINST=$G(^(.3)),ESIG=$P(DO,U,3),PSG14=$P($G(^(14,0)),"^",3) ;*315
 I PSG14 S PSGLRN=$G(@(PSGOEEWF_"14,"_PSG14_",0)"))
 S PSGOPD=+DO,PSGODO=$P(DO,U,2),PSGOPDN=$$OINAME^PSJLMUTL(+DO),X=$P(DO,U,4),PSGPRIO=$P("STAT^ASAP^ROUTINE^PREOP^TIME CRITICAL^DONE",U,$F("SARPTD",X)-1),PSJPRI=X
 S PSGOPR=$P(ND,"^",2),PSGOMR=$P(ND,"^",3),PSGOSM=$P(ND,"^",5),PSGOHSM=$P(ND,"^",6),(PSGOST,ST)=$P(ND,"^",7),STT=$P(ND,"^",9),PSGOMRN=$S('PSGOMR:"",1:$P($G(^PS(51.2,PSGOMR,0)),"^")) S:PSGOMRN="" PSGOMRN=PSGOMR
 S PSGLI=$P(ND,U,16),PSGOSCH=$P(ND2,"^"),(PSGOSD,SD)=$P(ND2,"^",2),(FD,PSGOFD)=$P(ND2,"^",4),(FQC,PSGS0XT)=$P(ND2,"^",6),(PSGOAT,PSGS0Y)=$P(ND2,"^",5)
 S:ND2P1]"" PSGDUR=$P(ND2P1,U,1),PSGRMVT=$P(ND2P1,U,2),PSGRMV=$P(ND2P1,U,3),PSGRF=$P(ND2P1,U,4) ;*315
 S PSGLIN=$$ENDD^PSGMI(PSGLI)_U_$$ENDTC^PSGMI(PSGLI)
 ;*366 - check provider credentials
 S PRI=$S('PSGOPR:0,1:'$$ACTPRO^PSGOE1(PSGOPR)),DRGI=$S(PSGOPD'=+PSGOPD:0,1:+$G(^PSDRUG(+PSGOPD,"I"))) S:DRGI DRGI=DT'<DRGI
 S PSGOPRN=$S('PSGOPR:"",1:$P($G(^VA(200,PSGOPR,0)),"^")) S:PSGOPRN="" PSGOPRN=PSGOPR I PSGOSI]"" S PSGOSI=$$ENSET^PSGSICHK(PSGOSI)
 I $L($T(ES^ORX8)) N ESIG1 S ESIG1=$$ES^ORX8(+$P(ND,U,21)_";1") S:ESIG1=1 ESIG="ES"
 S PSGOPRN=PSGOPRN_$S(ESIG]"":" ["_$$LOW^XLFSTR(ESIG)_"]",1:"")
 S PSGEBN=$$ENNPN^PSGMI(PSGEB) S:$P(ND,U,27)="R" STT="R"
 S X=STT,PSGSTAT=$S(X="":"NOT FOUND",X="DE":"DISCONTINUED (EDIT)",X="DR":"DISCONTINUED (RENEWAL)",X="RE":"REINSTATED",1:$P(X_"^ACTIVE^DISCONTINUED^EXPIRED^HOLD^INCOMPLETE^NON-VERIFIED^PENDING^RENEWED^UNRELEASED","^",$F("ADEHINPRU",X)))
 S (PSGIND,PSGOIND)=$G(@(PSGOEEWF_"18)"))  ;*399-IND
 ;*p319 clinic order
 K PSJCLAPP
 N CLNOR S CLNOR=$S(PSGOEEWF[53.1:$G(@(PSGOEEWF_"""DSS"")")),1:$G(@(PSGOEEWF_"8)"))) I +CLNOR D
 .S PSJCMO=1,PSJCLAPP=CLNOR,(P("CLIN"),P("CLINO"))=$P(PSJCLAPP,"^")
 .S (P("APPT"),P("APPTO"))=$P(PSJCLAPP,"^",2)
 ;
SET ;
 I STT="P" S (FD,SD,ST)=""
 S PSGOSTN=$$ENSTN^PSGMI(ST),(PSGOFDN,PSGOSDN)="" I SD S PSGOSDN=$$ENDD^PSGMI(SD)_"^"_$$ENDTC2^PSGMI(SD) ;#373
 I FD S PSGOFDN=$$ENDD^PSGMI(FD)_"^"_$$ENDTC2^PSGMI(FD) ;#373
 F X="PD","PDN","MR","MRN","ST","STN","SCH","SI","SD","SDN","FD","FDN","SM","HSM","PR","PRN","DO","AT" S @("PSG"_X)=@("PSGO"_X)
 K ^PS(53.45,PSJSYSP,1),^(2),^(5),^(6) S %X=PSGOEEWF_"3,",%Y="^PS(53.45,"_PSJSYSP_",1," D %XY^%RCR S %X=PSGOEEWF_"1,",%Y="^PS(53.45,"_PSJSYSP_",2," D %XY^%RCR
 S $P(^PS(53.45,PSJSYSP,2,0),"^",2)="53.4502P"
 K PSJNSS I $G(PSGSCH)'="" D  K PSJNSS
 . N PSGS0XTO,Y,PSGOES S X=PSGSCH S PSGS0XTO=PSGS0XT N PSGOSCH S PSGOSCH=PSGSCH S PSGSCH="",PSGOES=1
 . D ENOS^PSGS0 S:$G(X)="" PSGS0XT=PSGS0XTO S PSGSCH=PSGOSCH
 Q
 ;
FINISH ;
 I '$G(PSGS0XT),PSGOSCH]"" D  S $P(^PS(53.1,+PSGORD,2),"^",6)=PSGS0XT
 .N PSGOES,PSGS0Y S X=PSGOSCH,PSGOES=1 D ENOS^PSGS0
 S PSGOEFF=PSGOSCH=""+('$O(^PS(53.45,PSJSYSP,2,0))*10) I PSGOEFF S X=$S(PSGOEFF#2:" a SCHEDULE",1:"")_$S(PSGOEFF=11:" and",1:"")_$S(PSGOEFF>9:" at least one DISPENSE DRUG",1:"")_" before it can be finished."
 I PSGOEFF W $C(7),!!,"PLEASE NOTE: This order must have" F Q=1:1:$L(X," ") S Y=$P(X," ",Q) W:$L(Y)+$X>78 ! W Y," "
 I PSGOEFF#2 S F1=53.1,MSG=0,Y=$T(35),@("PSGFN(35)="_$P(Y,";",7)),PSGOEEF(+$P(Y,";",3))=1,(PSGOEE,PSGOEEF)=1 W ! D @$P($T(35),";",3) G:'PSGOEE DONE
 I PSGOEFF>9 S CHK=7 D ENDRG^PSGOEF1(PSGOPD,0) G:CHK DONE
 I $G(MSG) K DIR S DIR(0)="E" W !! D ^DIR
 I PSGOEFF D:PSGST="" GTST^PSGOE6(+PSGORD) N XQORM D EN^VALM("PSJ LM OE DISPLAY") G DONE
 ;
ACCEPT ;
 D UPD^PSGOEF1 G DONE
BYPASS ;
 S PSGCANFL=1 G DONE
 ;
EDIT ;
 S PSGPDRG=PSGOPD,PSGPDRGN=PSGOPDN K PSGOEEND D ENF^PSGOEE I PSGCANFL=-1 D UPD^PSGOEF1
 ;
DONE ;
 K CHK,DA,DIE,DR,DRG,MSG,ORETURN,ORIFN,PSGEB,PSGEFN,PSGND,PSGOEE,PSGOEEF,PSGOEEND,PSGOEEG,PSGOEF,PSGOEFF,PSGOES,PSGOPD,PSGOPDN,PSGOPR,PSGOSCH,PSGPDRG,PSGDRGN,PSG0XT,PSGS0Y,OSGSD,Q1,Q2
 K PSGDUR,PSGRMV,PSGRMVT ;*315
 Q
 ;
 ;
31 ;;101^PSGOE8;PSGOPD;PSGPD;101;1
32 ;;109^PSGOE8;PSGODO;PSGDO;102;PSGODO]""
33 ;;3^PSGOE8;PSGOMR;PSGMR;3;1
34 ;;7^PSGOE8;PSGOST;PSGST;7;0
35 ;;26^PSGOE8;PSGOSCH;PSGSCH;26;1
36 ;;39^PSGOE81;PSGOAT;PSGAT;39;0
37 ;;1^PSGOE82;PSGOPR;PSGPR;1;1
38 ;;8^PSGOE81;PSGOSI;PSGSI;8;0
39 ;;2^PSGOE82;;;2;0
310 ;;40^PSGOE82;;;40;0
311 ;;66^PSGOE82;;;66;1
312 ;;10^PSGOE81;PSGOSD;PSGSD;10;0
313 ;;25^PSGOE81;PSGOFD;PSGFD;25;0
314 ;;5^PSGOE82;PSGOSM;PSGSM;5;0
 ;
AH ;
 W !!?2,"Answer 'YES' to accept this order as a NON-VERIFIED UNIT DOSE order.  Answer",!,"'NO' to edit this order now.  Enter '^' to BYPASS this order, leaving it as",!,"a PENDING INPATIENT order."
 Q