| 1 | PSGVBW0 ;BIR/CML3,MV-SHOW NON-VERFIED ORDERS GATHERED IN PSGVBW ;17 SEP 97 / 1:41 PM
|
---|
| 2 | ;;5.0; INPATIENT MEDICATIONS ;**29,39,53,56,95,80,110,127,124**;16 DEC 97
|
---|
| 3 | ;
|
---|
| 4 | ; Reference to ^PSSLOCK is supported by DBIA #2789
|
---|
| 5 | ; Reference to ^DIR is supported by DBIA 10026
|
---|
| 6 | ; Reference to ^VALM is supported by DBIA 10118
|
---|
| 7 | ;
|
---|
| 8 | START ;
|
---|
| 9 | S (LINE,PSGOEA,PSGOEAV)="",$P(LINE,"-",81)="" S PSGPXN=$G(PSGPXN)
|
---|
| 10 | K ^TMP("PSJLIST",$J) D:PSGSS'="P" DISPLAYW Q:'$O(^TMP("PSJSELECT",$J,0))
|
---|
| 11 | PROCESS ; Loop through selected patients and display profile/orders.
|
---|
| 12 | K DIR,PSJPNV S PSJPNV=1
|
---|
| 13 | 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
|
---|
| 14 | .D ^DIR K DIR I Y D ^PSJHVARS,^PSGVBWP,RESTORE^PSJHVARS
|
---|
| 15 | .W !!,"Select profile type for order processing.",!!
|
---|
| 16 | D ENL^PSGOU Q:"SNL"'[PSGOL
|
---|
| 17 | 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
|
---|
| 18 | Q
|
---|
| 19 | PROCESS1 ;
|
---|
| 20 | S PSJPN=$G(^TMP("PSJSELECT",$J,PSJCNT)) K PSJGOTO
|
---|
| 21 | S PSJLK=$$L^PSSLOCK($P(PSJPN,U,2),1) I 'PSJLK W !,$C(7),$P(PSJLK,U,2) Q
|
---|
| 22 | K PSJGOTO D:PSJPN]"" GTORDERS
|
---|
| 23 | I PSJLK D UL^PSSLOCK($P(PSJPN,U,2))
|
---|
| 24 | I $G(PSGPXN),$$DEFON^PSGPER1 D K PSGPXPT S PSGPXN=0
|
---|
| 25 | .S PSGPXPT=PSGP
|
---|
| 26 | .N DFN,PSGP S (PSGP,DFN)=PSGPXPT D ^PSGPER,ENCV^PSGSETU,^PSIVXU
|
---|
| 27 | S PSGPXN=$G(PSGPXN)
|
---|
| 28 | Q
|
---|
| 29 | ;
|
---|
| 30 | DISPLAYW ; Allow selection of patients on each ward selected.
|
---|
| 31 | K ^TMP("PSJSELECT",$J) S PSJCNT=1,PSGVBWN="" F S PSGVBWN=$O(^TMP("PSGVBW",$J,PSGVBWN)) Q:PSGVBWN="" D DISPLAYT
|
---|
| 32 | Q
|
---|
| 33 | ;
|
---|
| 34 | DISPLAYT ;
|
---|
| 35 | NEW PSGPICK ;PSGPICK=1-->user selected order, stop display the profile
|
---|
| 36 | D HEADER S PSGVBTM="",PSGVBY=0 F S PSGVBTM=$O(^TMP("PSGVBW",$J,PSGVBWN,PSGVBTM)) Q:(PSGVBTM=""!$G(PSGPICK)) D V2
|
---|
| 37 | I PSJASK,(PSGVBY>0) D ASK
|
---|
| 38 | Q
|
---|
| 39 | ;
|
---|
| 40 | GTORDERS ;
|
---|
| 41 | S (PSGP,DFN)=$P(PSJPN,U,2) K PSJACNWP D ^PSJAC
|
---|
| 42 | I PSGOL'="N" D PROFILE Q
|
---|
| 43 | D ENGORD^PSGVBWU
|
---|
| 44 | S PSJPRIO="" F S PSJPRIO=$O(^TMP("PSJON",$J,PSJPRIO)) Q:PSJPRIO="" S PSJON="" D
|
---|
| 45 | . F S PSJON=$O(^TMP("PSJON",$J,PSJPRIO,PSJON)) Q:PSJON="" D
|
---|
| 46 | .. I $P(PSJON,U,2)=+$P(PSJON,U,2) Q:'$$LOCK^PSJOEA(DFN,$P(PSJON,U,2)) D GTORDER2 Q
|
---|
| 47 | .. I '$$LS^PSSLOCK(DFN,$P(PSJON,U,2)) D DISPORD(DFN,$P(PSJON,U,2)) Q
|
---|
| 48 | .. D DISACTIO^PSJOE(DFN,$P(PSJON,U,2),1) Q:$D(PSJGOTO) D UNL^PSSLOCK(DFN,$P(PSJON,U,2))
|
---|
| 49 | Q
|
---|
| 50 | ;
|
---|
| 51 | GTORDER2 ;
|
---|
| 52 | N PSJO S PSJO=0 F S PSJO=$O(^PS(53.1,"ACX",$P(PSJON,U,2),PSJO)) Q:'PSJO D
|
---|
| 53 | .D DISACTIO^PSJOE(DFN,PSJO_"P",1) Q:$D(PSJGOTO)
|
---|
| 54 | I $D(^TMP("PSJCOM",$J)) N PSJORD S PSJORD=$P(PSJON,U,2) D CHK^PSJOEA1
|
---|
| 55 | N PSJO S PSJO=0 F S PSJO=$O(^PS(53.1,"ACX",$P(PSJON,U,2),PSJO)) Q:'PSJO D
|
---|
| 56 | .D UNL^PSSLOCK(DFN,PSJO_"P") Q:$G(Y)<0
|
---|
| 57 | Q
|
---|
| 58 | ;
|
---|
| 59 | PROFILE ; Display the patient's profile and allow order selection.
|
---|
| 60 | S PSGP=DFN,PSJOL=PSGOL F D EN^VALM("PSJ LM PNV") Q:'$G(PSJORD)&'$G(PSJNEWOE) S PSJNEWOE=0
|
---|
| 61 | Q
|
---|
| 62 | ;
|
---|
| 63 | DONE ;
|
---|
| 64 | K ^TMP("PSGVBW",$J),^TMP("PSJON",$J)
|
---|
| 65 | K CF,DA,LINE,NP,POP,PPN,PR,PSGCANFL,PSGION,PSGOL,PSGOEAV,PSGOENOF,PSGON,PSGONC,PSGONR,PSGLMT,PSGORD,PSGPRF,PSGVBA,PSGVBAF,PSGVBON,PSGVBPN,PSGVBQ,PSGVBQ1,PSGVBSD,PSGVBSS,PSGVBST,PSGVBTM,PSGVBW,PSGVBWN,PSGVBY,QQ,Z
|
---|
| 66 | Q
|
---|
| 67 | ;
|
---|
| 68 | V2 ;
|
---|
| 69 | S PSGVBPN="" F S PSGVBPN=$O(^TMP("PSGVBW",$J,PSGVBWN,PSGVBTM,PSGVBPN)) Q:(PSGVBPN=""!$G(PSGPICK)) S PSGP=$P(PSGVBPN,"^",2),PPN=$P(PSGVBPN,"^") S:PPN="" PPN=PSGP_";DPT(" D WRT
|
---|
| 70 | Q
|
---|
| 71 | ;
|
---|
| 72 | WRT ;
|
---|
| 73 | S PSGVBY=PSGVBY+1,PSJASK=1
|
---|
| 74 | W !,$J(PSGVBY,4),?6,$S(PSGVBTM'="zz":PSGVBTM,1:"Not Found"),?27,PPN," (",$P(PSGVBPN,U,3),")" S ^TMP("PSJLIST",$J,PSGVBY)=PSGVBWN_U_PSGVBTM_U_PPN_U_PSGP
|
---|
| 75 | I $Y+1>IOSL,(PSGVBY>0) NEW DIR S DIR(0)="EA",DIR("A")=" '^' TO QUIT " D ^DIR D
|
---|
| 76 | . I X="^" S PSGPICK=1 Q
|
---|
| 77 | . S PSJASK=0 W @IOF
|
---|
| 78 | Q
|
---|
| 79 | ;
|
---|
| 80 | ASK ;
|
---|
| 81 | 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
|
---|
| 82 | S:Y]"" PSGPICK=1
|
---|
| 83 | F PSJINDEX=1:1:$L(Y,",")-1 D
|
---|
| 84 | . S PSGASKX=$G(^TMP("PSJLIST",$J,$P(Y,",",PSJINDEX))),PSGDFN=$P(PSGASKX,"^",4)_"^"_$P(PSGASKX,"^",3)
|
---|
| 85 | . D CHK^PSJDPT(.PSGDFN,1) I PSGDFN=-1 Q
|
---|
| 86 | . S:PSGASKX]"" ^TMP("PSJSELECT",$J,PSJCNT)=$P(PSGASKX,U,3,4),^TMP("PSJSELECT",$J,"B",$P(PSGASKX,U,3),PSJCNT)="",PSJCNT=PSJCNT+1
|
---|
| 87 | Q
|
---|
| 88 | ;
|
---|
| 89 | H2 ;
|
---|
| 90 | 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"
|
---|
| 91 | 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,"
|
---|
| 92 | W !,"only the first selection is used. (Entering '1,2,1' would return '1,2'.)" Q
|
---|
| 93 | ;
|
---|
| 94 | HEADER ;
|
---|
| 95 | W:$Y @IOF W !,"ORDERS NOT VERIFIED BY A ",$S($P(PSJSYSU,";",3)>1:"PHARMACIST",1:"NURSE")," - ",$S(PSGVBWN="ZZ":"^OTHER",1:PSGVBWN)
|
---|
| 96 | W !!," No.",?7,"TEAM",?32,"PATIENT",!,LINE K PSGVBY S PSGVBY=0 Q
|
---|
| 97 | Q
|
---|
| 98 | ;
|
---|
| 99 | NP ;
|
---|
| 100 | W $C(7) R !!,"ENTER AN '^' TO SELECT ORDERS NOW, OR PRESS THE RETURN KEY TO CONTINUE. ",NP:DTIME E S NP="^"
|
---|
| 101 | Q
|
---|
| 102 | DISPORD(DFN,ON) ;Display the order that being lock by another user
|
---|
| 103 | NEW PSJLINE,PSJOC,X
|
---|
| 104 | S PSJLINE=1
|
---|
| 105 | D DSPLORDU^PSJLMUT1(DFN,ON)
|
---|
| 106 | W ! F X=0:0 S X=$O(PSJOC(ON,X)) Q:'X W !,PSJOC(ON,X)
|
---|
| 107 | Q
|
---|
| 108 |
|
---|