source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGOESF.m@ 1154

Last change on this file since 1154 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.6 KB
Line 
1PSGOESF ;BIR/MLM-SPEED FINISH ORDERS ENTERED THROUGH OE/RR ;10 Mar 98 / 2:35 PM
2 ;;5.0; INPATIENT MEDICATIONS ;**7,11,29,35,127,133**;16 DEC 97
3 ;
4 ; Reference to ^PS(55 is supported by DBIA 2191
5 ; Reference to ^TMP is supported by DBIA 2190
6 ; Reference to ^PSSLOCK is supported by DBIA #2789
7 ;
8EN ;
9 I '$$HIDDEN^PSJLMUTL("SPEED") S VALMBCK="R" Q
10 N CODE,ST,DRG,ON,PSGONF,PSGONF2,PSGSFD
11 D FULL^VALM1 S PSGLMT=PSJOCNT,(PSGONF,PSGONF2)=0
12 S CODE="" F S CODE=$O(^TMP("PSJ",$J,CODE)) Q:CODE="" D
13 .S ST="" F S ST=$O(^TMP("PSJ",$J,CODE,ST)) Q:ST="" D
14 ..S DRG="" F S DRG=$O(^TMP("PSJ",$J,CODE,ST,DRG)) Q:DRG="" D
15 ...S ON="" F S ON=$O(^TMP("PSJ",$J,CODE,ST,DRG,ON)) Q:ON="" S PSGONF=PSGONF+1 D
16 ....I CODE="CC" S:$G(PSGONF2)=0 PSGONF2=PSGONF S PSGRLAST=PSGONF ;gets first renewal #
17 I PSGONF2'>0 W !,"There are no orders which can be Speed Finished at this time.",!,"Only PENDING RENEWALS can be Speed Finished." D PAUSE^VALM1 Q
18 S PSGONF=PSGONF2_"^"_PSGRLAST
19 N DIR,L1,L2 S L1=+PSGONF,L2=$P(PSGONF,U,2),DIR(0)="LAO^"_L1_":"_L2,DIR("A")="FINISH which orders ("_L1_"-"_L2_"): ",DIR("?",1)="Select order"_$E("s",L1'=L2)_"to finish: ",DIR("??")="^D HELP^PSGOESF"
20 D ^DIR K DIR I $D(DIRUT) K X G DONE
21 I X?1N1"-" Q:$P(PSGONF,U,2)<X S Y="" F L1=+X:1 S Y=Y_L1_"," Q:L1=$P(PSGONF,U,2)
22 I 'Y W $C(7),!!,"??" G EN
23ENCHK ;
24 S PSJSPEED=1
25 K PSGODDD S PSGODDD=1,PSGODDD(1)="" F Q=1:1:$L(Y,",") S X1=$P(Y,",",Q) D SET^PSGON Q:'$D(X)
26 S PSGOSD=0 F PSGOERS=1:1:PSGODDD F PSGOERS1=1:1 S PSGOERS2=$P(PSGODDD(PSGOERS),",",PSGOERS1) Q:'PSGOERS2 S Y=+^TMP("PSJON",$J,PSGOERS2),F=$G(^PS(53.1,Y,0)),D=$G(^(.2)) D HMSG^PSGOERS I F G EN
27 I $P(PSJSYSP0,"^",3) D I '$D(PSGFOK) S X="" G DONE
28 .S PSGORD=^TMP("PSJON",$J,+PSGODDD(1)),PSGOFD=$P($G(^PS(53.1,+PSGORD,2)),U,4),DA=+PSGORD,DA(1)=PSGP,PSGSFD=$P($G(^PS(53.1,+PSGORD,0)),U,16)
29 .S PSGORD=$P(^PS(53.1,+PSGORD,0),U,25)
30 .S PSGWLL=$S($P(PSJSYSW0,"^",4):+$G(^PS(55,PSGP,5.1)),1:0),PSGOEE="R" W ! D DATE^PSGOER0(PSGP,PSGORD,PSGSFD)
31 .I '$D(PSGFOK(1)) W $C(7),!,"...order",$E("s",$L(PSGODDD(1),",")>2)," NOT finished..." K PSGFOK Q
32 .I 'PSGNEDFD,$P(PSJSYSW0,"^",4) D ENWALL^PSGNE3(PSGSD,PSGFD,PSGP)
33 W ! F PSGOERS=1:1:PSGODDD F PSGOERS1=1:1 S PSGOERS2=$P(PSGODDD(PSGOERS),",",PSGOERS1) Q:'PSGOERS2 S PSGORD=^TMP("PSJON",$J,PSGOERS2),PSGOEFF=0 D
34 .I '$$LS^PSSLOCK(PSGP,PSGORD) W !," ",PSGOERS2,". ",$P($$DRUGNAME^PSJLMUTL(PSGP,PSGORD),"^")," ",$P($G(^PS(53.1,+PSGORD,.2)),"^",2),!,"...No action taken on this order...",! H 1 Q
35 .;K PSGORQF D ENDDC^PSGSICHK(PSGP,+$G(^PS(53.1,+PSGORD,1,1,0)))
36 .;I '$D(PSGORQF) K PSGORQF,^TMP($J,"DI") D
37 .;. F PSGDDI=1:0 S PSGDDI=$O(^PS(53.1,+PSGORD,1,PSGDDI)) Q:'PSGDDI S PSJDD=+$G(^PS(53.1,+PSGORD,1,PSGDDI,0)) D IVSOL^PSGSICHK
38 .D OC531
39 .I 'PSGOEFF&($D(PSGORQF)) W !!," ",PSGOERS2,". ",$P($$DRUGNAME^PSJLMUTL(PSGP,PSGORD),"^")," ",$P($G(^PS(53.1,+PSGORD,.2)),"^",2),!,"...No action taken on this order...",! H 1 Q
40 .S X=$G(^PS(53.1,+PSGORD,.2)),PSGPDRGN=$$ENPDN^PSGMI(+X),PSGDO=$P(X,U,2),X=$G(^PS(53.1,+PSGORD,0)),PSGMRN=$$ENMRN^PSGMI($P(X,U,3)),PSGST=$P(X,U,7)
41 .S PSGSCH=$P($G(^PS(53.1,+PSGORD,2)),U),PSGSI=$G(^(6))
42 .S $P(^PS(53.1,+PSGORD,2),U,2)=PSGSD,$P(^(2),U,4)=PSGFD,X=+$P($G(^PS(53.1,+PSGORD,0)),U,25)
43 .I $P($G(^PS(55,PSGP,5,+X,2)),U,4)>PSGSD S $P(^(2),U,3)=$P(^(2),U,4) K DA,DIE,DR S DA(1)=PSGP,DA=X,DR="34////"_PSGSD,DIE="^PS(55,"_DA(1)_",5," D ^DIE
44 .W !," ",PSGOERS2,". ",$P($$DRUGNAME^PSJLMUTL(PSGP,PSGORD),"^")," "
45 .W $P($G(^PS(53.1,+PSGORD,.2)),"^",2)
46 .D UPDATE
47 .D EN^PSGOEV(PSGORD)
48 .D UNL^PSSLOCK(PSGP,PSGORD)
49 ;
50DONE ; Kill and exit.
51 S DIR(0)="E" D ^DIR K DIR
52 I $G(PSGPXN) D ^PSGPER1
53 K PSJSPEED,PSGODDD,PSGOERS,PSGORD,PSGOERS2,PSGPDRGN,PSGDO,PSGSCH,PSGSI,NF,Y,PSGRLAST
54 Q
55HELP ; Display help text for select order to be finished prompt."
56 W !!," Select the orders to be speed finished. Only orders listed under the PENDING",!,"RENEWALS heading are selectable. The start and stop date/times specified will"
57 W !,"be used for all orders selected to be finished using this function.",!
58 Q
59UPDATE ;
60 N LOOP K ^PS(53.45,PSJSYSP,2)
61 F LOOP=0:0 S LOOP=$O(^PS(53.1,+PSGORD,1,LOOP)) Q:'LOOP D
62 .S ^PS(53.45,PSJSYSP,2,LOOP,0)=^PS(53.1,+PSGORD,1,LOOP,0)
63 .S PSJJDRUG=$P(^PS(53.1,+PSGORD,1,LOOP,0),"^")
64 .S ^PS(53.45,PSJSYSP,2,"B",PSJJDRUG,LOOP)=""
65 .S ^PS(53.45,PSJSYSP,2,0)="^53.4502P"_"^"_LOOP_"^"_LOOP K PSJJDRUG
66 Q
67OC531 ;* Order checks for Speed finish and regular finish
68 N INTERVEN,PSJDDI,PSJIREQ,PSJRXREQ,PSJPDRG
69 S Y=1,(PSJIREQ,PSJRXREQ,INTERVEN,X)=""
70 K PSGORQF D ENDDC^PSGSICHK(PSGP,+$G(^PS(53.1,+PSGORD,1,1,0)))
71 I '$D(PSGORQF) K PSGORQF,^TMP($J,"DI") D
72 . F PSGDDI=1:0 S PSGDDI=$O(^PS(53.1,+PSGORD,1,PSGDDI)) Q:'PSGDDI S PSJDD=+$G(^PS(53.1,+PSGORD,1,PSGDDI,0)) K PSJPDRG D IVSOL^PSGSICHK
73 Q
Note: See TracBrowser for help on using the repository browser.