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

PSGVBW0.m

Go to the documentation of this file.
PSGVBW0 ;BIR/CML3,MV - SHOW NON-VERFIED ORDERS GATHERED IN PSGVBW ;09/17/97 1:41 PM
 ;;5.0;INPATIENT MEDICATIONS;**29,39,53,56,95,80,110,127,124,243,304**;DEC 16, 1997;Build 22
 ;
 ; Reference to ^PSSLOCK is supported by DBIA #2789
 ; Reference to ^DIR is supported by DBIA 10026
 ; Reference to ^VALM is supported by DBIA 10118
 ;
START ;
 S (LINE,PSGOEA,PSGOEAV)="",$P(LINE,"-",81)="" S PSGPXN=$G(PSGPXN)
 K ^TMP("PSJLIST",$J) D:PSGSS'="P" DISPLAYW Q:'$O(^TMP("PSJSELECT",$J,0))
PROCESS ; Loop through selected patients and display profile/orders.
 K DIR,PSJPNV S PSJPNV=1
 I $P(PSJSYSU,";")=3 S X=$O(^TMP("PSJSELECT",$J,1)),DIR(0)="Y",DIR("A")="Do you want to print a profile for the"_$S(X:"se",1:"")_" patient"_$S(X:"s",1:""),DIR("B")="NO" D
 .D ^DIR K DIR I Y D ^PSJHVARS,^PSGVBWP,RESTORE^PSJHVARS
 .W !!,"Select profile type for order processing.",!!
 D ENL^PSGOU Q:"SNL"'[PSGOL
 F PSJCNT=0:0 S PSJCNT=$O(^TMP("PSJSELECT",$J,PSJCNT)) Q:'PSJCNT  D PROCESS1 S PSGOP=PSGP D ENQL^PSGLW:$P(PSJSYSL,"^",2)]"" Q:$G(PSJGOTO)="E"  I $D(^TMP("PSJSELECT",$J,+$G(PSJGOTO))) S PSJCNT=PSJGOTO-1
 Q
PROCESS1 ;
 S PSJPN=$G(^TMP("PSJSELECT",$J,PSJCNT)) K PSJGOTO
 S PSJLK=$$L^PSSLOCK($P(PSJPN,U,2),1) I 'PSJLK W !,$C(7),$P(PSJLK,U,2) Q
 K PSJGOTO D:PSJPN]"" GTORDERS
 I PSJLK D UL^PSSLOCK($P(PSJPN,U,2))
 I $G(PSGPXN),$$DEFON^PSGPER1 D  K PSGPXPT S PSGPXN=0
 .S PSGPXPT=PSGP
 .N DFN,PSGP S (PSGP,DFN)=PSGPXPT D ^PSGPER,ENCV^PSGSETU,^PSIVXU
 S PSGPXN=$G(PSGPXN)
 Q
 ;
DISPLAYW ; Allow selection of patients on each ward selected.
 K ^TMP("PSJSELECT",$J) S PSJCNT=1,PSGWORP1="" F  S PSGWORP1=$O(^TMP("PSGVBW",$J,PSGWORP1)) Q:PSGWORP1=""  D DISPLAYP
 Q
 ;
DISPLAYP ; Display WORP1 (Ward or Priority)
 N PSGPICK
 S PSGVBWN=PSGWORP1
 D HEADER
 S PSGWORP2="" F  S PSGWORP2=$O(^TMP("PSGVBW",$J,PSGWORP1,PSGWORP2)) Q:PSGWORP2=""  S PSGPRIN=PSGWORP2 D DISPLAYT
 I $G(PSJASK),(PSGVBY>0) D ASK
 Q
 ;
DISPLAYT ;
 ;NEW PSGPICK  ;PSGPICK=1-->user selected order, stop display the profile
 S PSGPRIN=PSGWORP2
 S:$G(PSGPRIF) PSGVBWN=PSGWORP2,PSGPRIN=PSGWORP1
 S PSGVBTM="" F  S PSGVBTM=$O(^TMP("PSGVBW",$J,PSGWORP1,PSGWORP2,PSGVBTM))  Q:(PSGVBTM=""!$G(PSGPICK))  D V2
 I $G(PSJPRIF),$G(PSJASK),(PSGVBY>0) D ASK
 Q
 ;
GTORDERS ;
 S (PSGP,DFN)=$P(PSJPN,U,2) K PSJACNWP D ^PSJAC
 I PSGOL'="N" D PROFILE Q
 D ENGORD^PSGVBWU
 S PSJPRIO="" F  S PSJPRIO=$O(^TMP("PSJON",$J,PSJPRIO)) Q:PSJPRIO=""  S PSJON="" D
 . F  S PSJON=$O(^TMP("PSJON",$J,PSJPRIO,PSJON)) Q:PSJON=""  D
 .. I $P(PSJON,U,2)=+$P(PSJON,U,2) Q:'$$LOCK^PSJOEA(DFN,$P(PSJON,U,2))  D GTORDER2 Q
 .. I '$$LS^PSSLOCK(DFN,$P(PSJON,U,2)) D DISPORD(DFN,$P(PSJON,U,2)) Q
 .. D DISACTIO^PSJOE(DFN,$P(PSJON,U,2),1) Q:$D(PSJGOTO)  D UNL^PSSLOCK(DFN,$P(PSJON,U,2))
 Q
 ;
GTORDER2 ;
 N PSJO S PSJO=0 F  S PSJO=$O(^PS(53.1,"ACX",$P(PSJON,U,2),PSJO)) Q:'PSJO  D
 .D DISACTIO^PSJOE(DFN,PSJO_"P",1) Q:$D(PSJGOTO)
 I $D(^TMP("PSJCOM",$J)) N PSJORD S PSJORD=$P(PSJON,U,2) D CHK^PSJOEA1
 N PSJO S PSJO=0 F  S PSJO=$O(^PS(53.1,"ACX",$P(PSJON,U,2),PSJO)) Q:'PSJO  D
 .D UNL^PSSLOCK(DFN,PSJO_"P") Q:$G(Y)<0
 Q
 ;
PROFILE ; Display the patient's profile and allow order selection.
 S PSGP=DFN,PSJOL=PSGOL F  D EN^VALM("PSJ LM PNV") Q:'$G(PSJORD)&'$G(PSJNEWOE)  S PSJNEWOE=0
 Q
 ;
DONE ;
 K ^TMP("PSGVBW",$J),^TMP("PSJON",$J)
 K PSGWORP1,PSGWORP2,CF,DA,LINE,NP,POP,PPN,PR,PSGCANFL,PSGION,PSGOL,PSGOEAV,PSGOENOF,PSGON,PSGONC,PSGONR,PSGLMT,PSGPRIF
 K PSGORD,PSGPRF,PSGVBA,PSGVBAF,PSGVBON,PSGVBPN,PSGVBQ,PSGVBQ1,PSGVBSD,PSGVBSS,PSGVBST,PSGVBTM,PSGVBW,PSGVBWN,PSGVBY,QQ,Z
 K LIDT,ND,ORDT,PPN,PRD,PRDNS,PSGINCL,PSGINWD,PSGODT,PSGOEA,PSGOEAV,PSGP,PSGPRD,PSGPRIN,PSGPTMP,PSGSS,PSGVBPN,PSGVBTM,PSGVBWN
 Q
 ;
V2 ;
 S PSGVBPN="" F  S PSGVBPN=$O(^TMP("PSGVBW",$J,PSGWORP1,PSGWORP2,PSGVBTM,PSGVBPN)) Q:(PSGVBPN=""!$G(PSGPICK))  S PSGP=$P(PSGVBPN,"^",2),PPN=$P(PSGVBPN,"^") S:PPN="" PPN=PSGP_";DPT(" D WRT
 Q
 ;
WRT ;
 S PSGVBY=PSGVBY+1,PSJASK=1
 S PSGVBWN=PSGWORP1,PSGPRD=PSGWORP2
 W !,$J(PSGVBY,4),?6,$S(PSGVBTM'="zz":PSGVBTM,1:"Not Found"),?25,$S(PSGPRD="zz":"Not Found",PSGPRD=1:"STAT",PSGPRD=2:"ASAP",PSGPRD=3:"ROUTINE",1:PSGPRD),?38,PPN," (",$P(PSGVBPN,U,3),")" S ^TMP("PSJLIST",$J,PSGVBY)=PSGVBWN_U_PSGVBTM_U_PPN_U_PSGP
 I $Y+1>IOSL,(PSGVBY>0) NEW DIR S DIR(0)="EA",DIR("A")=" '^' TO QUIT " D ^DIR D
 . I X="^" S PSGPICK=1  Q
 . W @IOF
 Q
 ;
ASK ;
 N DIR,PSGDFN,PSGASKX S DIR(0)="LOA^1:"_PSGVBY,DIR("A")="Select 1 - "_PSGVBY_": " D ^DIR I $D(DUOUT)!$D(DTOUT) K ^TMP("PSGVBW",$J) Q
 S:Y]"" PSGPICK=1
 F PSJINDEX=1:1:$L(Y,",")-1 D
 . S PSGASKX=$G(^TMP("PSJLIST",$J,$P(Y,",",PSJINDEX))),PSGDFN=$P(PSGASKX,"^",4)_"^"_$P(PSGASKX,"^",3)
 . D CHK^PSJDPT(.PSGDFN,1) I PSGDFN=-1 Q
 . S:PSGASKX]"" ^TMP("PSJSELECT",$J,PSJCNT)=$P(PSGASKX,U,3,4),^TMP("PSJSELECT",$J,"B",$P(PSGASKX,U,3),PSJCNT)="",PSJCNT=PSJCNT+1
 Q
 ;
H2 ;
 W !!?2,"Select patients either singularly separated by commas (1,2,3), by a range of",!,"patients separated by a dash (1-3), or a combination (1,2,4-6).  To select all",!,"patients, enter 'ALL' or a dash ('-').  You can also enter '-n' to"
 W " select the",!,"first patient through the 'nth' patient or enter 'n-' to select the 'nth'",!,"patient through the last patient.  If a patient is selected more than once,"
 W !,"only the first selection is used.  (Entering '1,2,1' would return '1,2'.)" Q
 ;
 W:$Y @IOF W !,"ORDERS NOT VERIFIED BY A ",$S($P(PSJSYSU,";",3)>1:"PHARMACIST",1:"NURSE")," - "
 I $G(PSGPRIF) W $S(PRD=1:"STAT",PRD=2:"ASAP",1:"ROUTINE")
 I '$G(PSGPRIF) W $S(PSGVBWN="ZZ":"^OTHER",1:PSGVBWN)
 W !!," No.",?7,"TEAM",?25,"PRIORITY",?38,"PATIENT",!,LINE K PSGVBY S PSGVBY=0 Q
 Q
 ;
NP ;
 W $C(7) R !!,"ENTER AN '^' TO SELECT ORDERS NOW, OR PRESS THE RETURN KEY TO CONTINUE. ",NP:DTIME E  S NP="^"
 Q
DISPORD(DFN,ON)     ;Display the order that being lock by another user
 NEW PSJLINE,PSJOC,X
 S PSJLINE=1
 D DSPLORDU^PSJLMUT1(DFN,ON)
 W ! F X=0:0 S X=$O(PSJOC(ON,X)) Q:'X  W !,PSJOC(ON,X)
 Q