source: FOIAVistA/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGPER0.m@ 1274

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

initial load of FOIAVistA 6/30/08 version

File size: 4.3 KB
Line 
1PSGPER0 ;BIR/CML3-PRINTS PRE-EXCHANGE NEEDS REPORT ;24 JAN 94 / 11:14 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**58,82,95,115**;16 DEC 97
3 ;
4 ; Reference to ^PS(55 is supported by DBIA 2191.
5 ;
6ENQ ;
7 D ENP:'$G(PSGPXPT),ENPAT:$G(PSGPXPT) S DIK="^PS(53.4,",DA=PSGPXN D ^DIK K DA,DIK,PSGPXN Q
8 ;
9ENPAT ;
10 Q:'$G(DFN)
11 K ^TMP("PSGPER",$J) U IO D PAT,DONE
12 Q
13 ;
14ENP ;
15 K ^TMP("PSGPER",$J) U IO
16 F DFN=0:0 S DFN=$O(^PS(53.4,PSGPXN,1,DFN)) Q:'DFN D PAT,DONE
17 Q
18 ;
19PAT ;
20 D PID^VADPT,GWR F ON=0:0 S ON=$O(^PS(53.4,PSGPXN,1,DFN,1,ON)) Q:'ON D ONI F DD=0:0 S DD=$O(^PS(53.4,PSGPXN,1,DFN,1,ON,1,DD)) Q:'DD I $D(^(DD,0)) S ND=^(0) D DDS
21 D NOW^%DTC S %=$$ENDTC^PSGMI(%),(BORD,F,L)="",$P(L,"-",81)="",$P(BORD,"#",25)="",T=IO'=IO(0)!($E(IOST)'="C"),RF=$S(T:0,1:0) D:'RF HEADER S (DN,DDN,NP,WD)=""
22 F S WD=$O(^TMP("PSGPER",$J,WD)) Q:WD="" S PI="" F S F=0,PI=$O(^TMP("PSGPER",$J,WD,PI)) Q:PI="" S RB=^(PI) D
23 . D PPI F S F=1,DN=$O(^TMP("PSGPER",$J,WD,PI,DN)) Q:DN="" S PX=^(DN) D OP F S DDN=$O(^TMP("PSGPER",$J,WD,PI,DN,DDN)) Q:DDN="" S PX=^(DDN) D PRT
24 . I $O(^TMP("PSGPER",$J,WD,PI))]"" S F="" D NP
25 W:T&($Y) @IOF,@IOF D ^%ZISC
26 Q
27 ;
28DONE ;
29 K ^TMP("PSGPER",$J),BORD,DN,DD,DO,DRG,DRGS,F,L,MR,ND,ND0,ND2,ND4,NP,ON,PI,PDN,PN,PX,RB,RF,SCH,SDN,SN,SND1,SPN,STOP,STRT,T,UD,VD,VU,W,WD,X,XL,Y,DDN,I2,ND1,PSG25,PSG26,PSGEB,PSGEBN,PSGNODE,PSGOAT,PSGSTAT
30 K DONE,FIL,NF,PDM,PDRG,PSGACTO,PSGDA,PSGNEFDO,PSGNESDO,PSGPEN,PSGPENWS,PSGY,PSIVAC,PSIVCT,PSIVE,PSIVEXAM,PSIVUP,PSIVWAT,PSJH,PSJNOO,PSJNOON
31 Q
32 ;
33NP ;
34 I 'T K DIR S DIR(0)="E" W ! D ^DIR S:'Y WD="zzz" W:Y $C(13),# Q
35 ;
36HEADER ;
37 W:$Y @IOF W !?20,"PRE-EXCHANGE UNITS REPORT - ",%
38 W !!,"Ward",?32,"Room-bed",!,"Patient",!?5,"Order",!?20,"Dispense Drug",?64,"U/D",?72,"Needs",!,L
39 W:F !!,$S(WD'="zz":WD,1:"NOT FOUND"),?32,RB,!,PN_" ("_SN_")" Q
40 ;
41GWR ;
42 S WD=$G(^DPT(DFN,.1)),RB=$G(^(.101)),PN=$P($G(^(0)),"^") S:WD="" WD="zz" S:RB="" RB="NOT FOUND" S:PN="" PN=DFN_";DPT("
43 S SPN=$E(PN,1,20)_"^"_DFN,^TMP("PSGPER",$J,WD,SPN)=PN_"^"_RB_"^"_VA("BID") Q
44 ;
45ONI ;
46 S ND=$G(^PS(55,DFN,5,ON,0)),DN=$G(^(.2)),SCH=$P($G(^(2)),"^"),MR=$P(ND,"^",3),ND=$$ENNPN^PSGMI($P(ND,"^",2)),DO=$P(DN,"^",2),DN=$P(DN,"^") I DN="" S DN="zz"
47 E S DN=$$ENPDN^PSGMI(DN)
48 S:MR]"" MR=$$ENMRN^PSGMI(MR) S SDN=$E(DN,1,20)_"^"_ON,^TMP("PSGPER",$J,WD,SPN,SDN)=DN_"^"_DO_"^"_MR_"^"_SCH_"^"_$P(ND,"^",2) Q
49 ;
50DDS ;
51 S ND1=$G(^PS(55,DFN,5,ON,1,+ND,0)),UD=$P(ND1,"^",2),ND1=$$ENDDN^PSGMI(+ND1),SND1=$E(ND1,1,20)_"^"_+ND,ND=$P(ND,"^",2)
52 I ND#1 S ND=(ND\1)+1
53 S ^TMP("PSGPER",$J,WD,SPN,SDN,SND1)=ND1_"^"_UD_"^"_ND
54 Q
55 ;
56PPI ;
57 S DFN=$P(PI,"^",2),PN=$P(RB,"^"),SN=$P(RB,"^",3),RB=$P(RB,"^",2) I 'RF,$Y+6>IOSL D NP Q:NP["^"
58 W !!,$S(WD'="zz":WD,1:"NOT FOUND"),?32,RB,!,PN," ("_SN_")" Q
59 ;
60OP ;
61 S PDN=$P(PX,"^"),DO=$P(PX,"^",2),MR=$P(PX,"^",3),SCH=$P(PX,"^",4)
62 W !?5,PDN," ",DO," ",MR,$S(MR]"":" ",1:""),SCH
63 Q
64PRT ; find order info and print same
65 I 'RF,$Y+4>IOSL D NP Q:NP="^"
66 I 1 S PDN=$P(PX,"^"),UD=$P(PX,"^",2),PX=$P(PX,"^",3) W !?20,PDN,?62,$J($S('UD:1,$E(UD)=".":0_UD,1:UD),5),?72,$J(PX,5) Q
67 S ON=$P(DN,"^",2),ND=$G(^PS(55,DFN,5,ON,0)),ND2=$G(^(2)),ND4=$G(^(4)),Y=$P($G(^(6)),"^"),ND0=$G(^(.1)),DO=$P(ND0,"^",2)
68 S DRG=$$ENDDN^PSGMI($P(ND0,"^")),MR=$$ENMRN^PSGMI(MR) ; ,DRGS=$P($G(^(+$O(^PS(55,DFN,5,ON,1,0)),0)),"^")
69 I 'RF W !?5,DRG,?47,DO,?65,$J($S('UD:1,UD=.5:"1/2",UD=.25:"1/4",UD?1".".N:0_UD,1:UD),5),?75,$J(+PX,5) Q
70 ;
71 S SCH=$P(ND2,"^"),STRT=$P(ND2,"^",2),STOP=$P(ND2,"^",4),VU=$P(ND4,"^",3),VD=$P(ND4,"^",4),VU=$P($G(^VA(200,+VU,0)),"^",2) S:VU="" VU=$P(ND4,"^",3)
72 F Q="STRT","STOP","VD" S @Q=$$ENDTC^PSGMI(@Q)
73 W:$Y @IOF W !!?6,BORD_" PRE-EXCHANGE MED "_BORD,!?6,"#",?73,"#",!?6,"# ",PN,?50,"Ward: ",WD,?73,"#",!?6,"# ("_SN_")",?52,"RB: "_RB,?73,"#",!?6,"#",?73,"#"
74 W !?6,"# "_DRG,?46,"START: "_STRT,?73,"#",!?6,"# "_$S(DRGS]"":"("_DRGS_")",1:""),?47,"STOP: "_STOP,?73,"#",!?6,"# GIVE: "_$S(DO]"":" "_DO,1:"")_$S(MR]"":" "_MR,1:"")_$S(SCH]"":" "_SCH,1:""),?73,"#"
75 S XL=0 I Y="" W !?6,"#",?73,"#",!?6,"# (NO SPECIAL INSTRUCTIONS)"
76 E W !?6,"#",?73,"#",!?6,"# " S Y=$$ENSET^PSGSICHK(Y) F Q=1:1:$L(Y," ") S X=$P(Y," ",Q) S:$X+$L(X)>72 XL=XL+1 W:$X+$L(X)>72 ?73,"#",!?6,"# " W X_" "
77 W ?73,"#",!?6,"#",?73,"#",!,?6,"#",?43,"VERIFIED: "_VD,?73,"#",!?6,"#",?49,"BY: "_VU,?73,"#",!?6,"#",?38,"SEND TO FLOOR: "_PX,?73,"#"
78 S XL=2-XL I XL>0 F Q=1:1:XL W !?6,"#",?73,"#"
79 W !?6,"#",?73,"#",!?6,"#",?36,"_______________ _______________ #",!?6,"#",?36,"FILLED BY",?56,"CHECKED BY",?73,"#",!?6,BORD_BORD_$E(BORD,1,20) Q
Note: See TracBrowser for help on using the repository browser.