source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGMAR2.m@ 1261

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

initial load of WorldVistAEHR

File size: 2.8 KB
RevLine 
[613]1PSGMAR2 ;BIR/CML3-PRINT 24 HOUR MAR(UD) ;14 Oct 98 / 4:28 PM
2 ;;5.0; INPATIENT MEDICATIONS ;**20,111,131,145**;16 DEC 97;Build 17
3 ;
4S1 I PSGMARB'=2 S:PSGMARS'=2 (PST,OPST)="C" D:PSGMARS'=2 HEADER^PSGMAR3,BOT^PSGMAR3 S:PSGMARS'=1 (PST,OPST)="P" D:PSGMARS'=1 HEADER^PSGMAR3,BOT^PSGMAR3 Q:PSGMARB=1
5 D NOW^%DTC S PSGDT=%,(PST,OPST)=""
6 S PSGMPG=0,PSGMPGN="PAGE: "
7 I PSGSS="P"!(PSGSS="C")!(PSGSS="L") D P Q
8 D W
9 Q
10 ;
11P ;***Print on Patient order
12 ;
13 ;
14 I $O(^TMP($J,PN,PWDN,0))'["C" S (PST,OPST)="C" D HEADER^PSGMAR3,BOT^PSGMAR3 S (PST,OPST)=""
15 F S PST=$O(^TMP($J,PN,PWDN,PST)) Q:PST="" D:$E(OPST)'=$E(PST) BOT^PSGMAR3:OPST]"",HEADER^PSGMAR3 S OPST=PST,DAO="" D
16 . F S DAO=$O(^TMP($J,PN,PWDN,PST,DAO)) Q:DAO="" S PSGMARTS=^TMP($J,PN,PWDN,PST,DAO) D PRT
17 I $O(^TMP($J,PN,PWDN,"CV6"))="" D BOT^PSGMAR3 S (PST,OPST)="O" D HEADER^PSGMAR3
18 S PSGMPGN="LAST PAGE: " D BOT^PSGMAR3
19 Q
20 ;
21W ;***Print Ward/Ward group
22 ;DAM 5-01-07 Utilize the XTMP global while reverses patient name and location
23 I $S(PSGRBPPN="P":$O(^XTMP(PSGREP,TM,PN,WDN,RB,0)),1:$O(^TMP($J,TM,WDN,RB,PN,0)))'["C" S (PST,OPST)="C" D HEADER^PSGMAR3,BOT^PSGMAR3 S (PST,OPST)=""
24 ;
25 D:PSGRBPPN="P" PPN D:PSGRBPPN="R" RB
26 Q
27 ;
28PPN ;***Sort by Patient
29 ;
30 ;DAM - 5-01-07 Utilize the XTMP global set up in PSGMAR0 when printing by WARD/PATIENT or WARD GROUP/PATIENT
31 F S PST=$O(^XTMP(PSGREP,TM,PN,WDN,RB,PST)) Q:PST="" D:$E(OPST)'=$E(PST) BOT^PSGMAR3:OPST]"",HEADER^PSGMAR3 S OPST=PST,DAO="" D
32 . F S DAO=$O(^XTMP(PSGREP,TM,PN,WDN,RB,PST,DAO)) Q:DAO="" S PSGMARTS=^(DAO) D PRT
33 I $O(^XTMP(PSGREP,TM,PN,WDN,RB,"CV6"))="" D BOT^PSGMAR3 S (PST,OPST)="O" D HEADER^PSGMAR3
34 S PSGMPGN="LAST PAGE: " D BOT^PSGMAR3
35 ;
36 Q
37 ;
38RB ;***Sort by Room bed
39 F S PST=$O(^TMP($J,TM,WDN,RB,PN,PST)) Q:PST="" D:$E(OPST)'=$E(PST) BOT^PSGMAR3:OPST]"",HEADER^PSGMAR3 S OPST=PST,DAO="" D
40 . F S DAO=$O(^TMP($J,TM,WDN,RB,PN,PST,DAO)) Q:DAO="" S PSGMARTS=^(DAO) D PRT
41 I $O(^TMP($J,TM,WDN,RB,PN,"CV6"))="" D BOT^PSGMAR3 S (PST,OPST)="O" D HEADER^PSGMAR3
42 S PSGMPGN="LAST PAGE: " D BOT^PSGMAR3
43 Q
44 ;
45PRT ; order info
46 NEW MARLB,DRUGNAME,NAME
47 S ON=$P(DAO,U,2) D ONHOLD^PSGMMAR2
48 I +PSGMSORT,$S(ON["V":1,ON["P":$P($G(^PS(53.1,+ON,0)),U,4)="F",1:0) D PRT^PSGMIV Q
49 D:PSGMAROC>5 ENB^PSGMAR3,HEADER^PSGMAR3 I PST["V" D PRT^PSGMIV Q
50 S TMSTR=$P(PSGMARTS,"^",2),PSGMARTS=$P(PSGMARTS,"^"),PSGORD=$P(DAO,U,2) S:PSGORD["P" PSJPSTO=PST,PST=$S(+PSGMSORT:"CZ",1:PST) D ^PSGLOI,TS^PSGMAR3(PSGMARTS),MARLB^PSGMUTL(47)
51 I (PSGMAROC>4&(MARLB>6))!(TS/6>6)!((TS/6+PSGMAROC)>6) D BOT^PSGMAR3,HEADER^PSGMAR3
52 S PSGMAROC=PSGMAROC+1
53 NEW PSGX F PSGX=1:1:MARLB W !,MARLB(PSGX) W:PST["C" ?48,"|",$G(TS(PSGX)) D PRT2
54 I $D(PSJPSTO) S PST=PSJPSTO K PSJPSTO
55 Q
56PRT2 ;
57 W ?55,"|"
58 I PSGX=3,(PST'["Z"),(PST["C") D TMSTR^PSGMAR3
59 I PSGMAROC>5,(TS/6>7) D
60 . S MSG1="*** CONTINUE ON NEXT PAGE ***"
61 . D BOT^PSGMAR3,HEADER^PSGMAR3
62 I PSGX#6=0 W:PSGMAROC<6 !?7,LN2 S:PSGX'=MARLB PSGMAROC=PSGMAROC+1
63 Q
Note: See TracBrowser for help on using the repository browser.