source: FOIAVistA/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSJMPEND.m@ 1806

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

initial load of FOIAVistA 6/30/08 version

File size: 2.9 KB
Line 
1PSJMPEND ;BIR/CML3-MD MARS - GATHER ACK ORDERS INFO (MDWS) ; 6/18/07 12:11pm
2 ;;5.0; INPATIENT MEDICATIONS ;**191**;16 DEC 97;Build 9
3 ;
4PEND ;*** Only select orders that were acknowledged by nurses and are
5 ;*** still having pending status.
6 NEW X S X=$O(^PS(59.6,"B",+PSJPWD,0)) Q:'+$P($G(^PS(59.6,+X,0)),U,6)
7 NEW ND,ON,TYPE,QST
8 F ON=0:0 S ON=$O(^PS(53.1,"AV",PSGP,ON)) Q:'ON D
9 . S ND=$G(^PS(53.1,ON,0)),TYPE=$P(ND,U,4)
10 . S ND2=$G(^PS(53.1,ON,2)),PSGLSD=$P(ND2,U,2),PSGLFD=$P(ND2,U,4)
11 . I $P(ND,U,7)="P"!($P($G(^PS(53.1,ON,2)),U)["PRN") S QST="PZ"_$S($P(ND,U,4)="F":"V",1:"A")
12 . E S QST="CZ"_$S($P(ND,U,4)="F":"V",1:"A")
13 . I PSGMTYPE[1 D:TYPE'="F" SETTMP D:TYPE="F" IV
14 . I PSGMTYPE'[1 D
15 .. I PSGMTYPE[2,(TYPE="U") D SETTMP Q
16 .. I PSGMTYPE'[2,(TYPE="I") D SETTMP Q
17 .. I PSGMTYPE[4,(TYPE="F") D IV
18 Q
19 ;
20SETTMP ;*** Setup ^tmp for pending U/D and Inpatient med IVs.
21 ;*** PZ_(V/A) = PRN/One time orders (V=IV).
22 ;*** CZ_(V/A) = Continuous orders (A=U/D).
23 I 'PSJMPRN,(QST["PZ") Q
24 NEW MARX
25 D DRGDISP^PSJLMUT1(PSGP,+ON_"P",20,0,.MARX,1) S DRG=MARX(1)_U_ON
26 ;*** Set up ^TMP for sort by patients
27 S PSJDOS=$P(^PS(53.1,ON,.2),U,2),PSJMR=$E($S($P(ND,U,3)]"":$P(ND,U,3),1:$P(ND,U)),1,5),PSJSCHE=$P($G(^PS(53.1,ON,2)),U)
28 S PSJHOLD=$S($P(ND,U,9)["H":1,1:0),PSGLOD=$P(ND,U,14),PSJATME=9999,PSJADT=$S(QST["C":"8999999",1:"9999999")
29 D SI
30 I PSGSS="P" D Q
31 . S ^TMP($J,PSJADT,PPN_U_PSGP,PSJATME,QST,DRG)=PSGP_U_ON_U_PSJPPID_U_PSJPWDN_U_PSJPRB
32 . S ^TMP($J,QST,PSGP,ON)=PSJDOS_U_PSJMR_U_PSJSCHE_U_PSJHOLD_U_PSGLOD
33 . S ^TMP($J,QST,PSGP,ON,1)=PSJSI
34 ;*** Set up ^TMP when listing by ward
35 S:PSGRBADM="A" ^TMP($J,PSJADT,TM,PSJATME,PSJPRB,PPN,QST,DRG)=PSGP_U_ON_U_PSJPPID_U_PSGWN_U_PSJPRB
36 S:PSGRBADM="R" ^TMP($J,PSJADT,TM,PSJPRB,PPN,PSJATME,QST,DRG)=PSGP_U_ON_U_PSJPPID_U_PSGWN_U_PSJPRB
37 S:PSGRBADM="P" ^TMP($J,PSJADT,TM,PPN_U_PSGP,PSJATME,QST,DRG)=PSGP_U_ON_U_PSJPPID_U_PSGWN_U_PSJPRB
38 S ^TMP($J,QST,PSGP,ON)=PSJDOS_U_PSJMR_U_PSJSCHE_U_PSJHOLD_U_PSGLOD_U_PSGLSD_U_PSGLFD
39 S ^TMP($J,QST,PSGP,ON,1)=PSJSI
40 Q
41SI ;*** Find the Special instructions.
42 S X=0,PSJSI="" F S X=$O(^PS(53.1,ON,12,X)) Q:'X S Z=$G(^(X,0)),Y=$L(PSJSI) S:Y+$L(Z)'>179 PSJSI=PSJSI_Z_" " I Y+$L(Z)>179 S PSJSI="SEE PROVIDER COMMENTS" Q
43 Q
44 ;
45IV ;*** Sort IV pending orders for 24 Hrs, 7/14 Day MAR.
46 K DRG,P NEW X,ON55,P,PSJLABEL
47 S DFN=PSGP,PSJLABEL=1 D GT531^PSIVORFA(DFN,ON)
48 S X=$P(P("MR"),U,2)
49 S QST=QST_4
50 S PSJADT=$S(QST["C":"8999999",1:"9999999")
51 I DRG S X=$S($G(DRG("AD",1)):DRG("AD",1),1:$G(DRG("SOL",1))),X=$E($P(X,U,2),1,20)_U_ON D
52 . I PSGSS="P" S ^TMP($J,PSJADT,PPN_U_PSGP,"9999",QST,X)=PSGP_U_ON_U_PSJPPID_U_PSJPWDN_U_PSJPRB Q
53 . S:PSGRBADM="A" ^TMP($J,PSJADT,TM,"9999",PSJPRB,PPN,QST,DRG)=PSGP_U_ON_U_PSJPPID_U_PSGWN_U_PSJPRB
54 . S:PSGRBADM="R" ^TMP($J,PSJADT,TM,PSJPRB,PPN,"9999",QST,DRG)=PSGP_U_ON_U_PSJPPID_U_PSGWN_U_PSJPRB
55 . S:PSGRBADM="P" ^TMP($J,PSJADT,TM,PPN_U_PSGP,"9999",QST,DRG)=PSGP_U_ON_U_PSJPPID_U_PSGWN_U_PSJPRB
56 Q
Note: See TracBrowser for help on using the repository browser.