source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSGMAR.m@ 1306

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

initial load of WorldVistAEHR

File size: 5.5 KB
Line 
1PSGMAR ;BIR/CML3-24 HOUR MAR - MAIN DRIVER ;14 Oct 98 / 4:27 PM
2 ;;5.0; INPATIENT MEDICATIONS ;**8,15,20,111,131,145**;16 DEC 97;Build 17
3 ;
4EN ;
5 ;
6 NEW PSGOP
7 D ENCV^PSGSETU G:$D(XQUIT) DONE
8 D MARFORM^PSGMUTL G:PSGMARB=0 DONE S:PSGMARB'=1 PSGMARS=3
9 G:PSGMARB'=1 ENDATE F R !!,"Print (C)ontinuous sheets, (P)RN sheets, or (B)oth? B// ",X:DTIME W:'$T $C(7) S:'$T X="^" Q:"^CPB"[X&($L(X)<2) W:X'?1."?" $C(7)," ??" D:X?1."?" SHTH
10 G:X="^" DONE I X="" W " (Both)" S PSGMARS=3
11 E W $S(X="C":"ontinuous",X="P":"RN",1:"oth") S PSGMARS=$F("CPB",X)-1
12 ;
13ENDATE ; get start date
14 S %DT="ETX",Y=-1 F W !!,"Enter START DATE/TIME for 24 hour MAR: " R X:DTIME W:'$T $C(7) S:'$T X="^" Q:"^"[X D:X?1."?" DH D ^%DT Q:Y>0
15 I Y'>0 W $C(7),!!?5,"(No date selected for MAR run.)" G DONE
16 S PSGMARDT=+$E(Y,1,10) D:$P(PSGMARDT,".",2)
17 .S PSGPLS=PSGMARDT,PSGPLF=$$EN^PSGCT(PSGPLS,-1),ST=$P(PSGPLS_0,".",2),FT=$P(PSGPLF_0,".",2)
18 .S PSGMARSD=$E(ST,1,2),PSGMARFD=$E(FT,1,2) S:'PSGMARSD PSGMARSD="01" S PSGMARFD=$S(+PSGMARSD=1:24,PSGMARSD=PSGMARFD:PSGMARSD-1,1:PSGMARFD) S:$L(PSGMARFD)<2 PSGMARFD=0_PSGMARFD
19 .I ST>1 S X1=$P(PSGPLF,"."),X2=1 D C^%DTC S PSGPLF=X
20 .S PSGPLS=+(PSGPLS_"."_ST),PSGPLF=+(PSGPLF_"."_FT)
21 .S PSGMARSP=$$ENDTC2^PSGMI(PSGPLS),PSGMARFP=$$ENDTC2^PSGMI(PSGPLF)
22 D NOW^%DTC S PSGDT=%,(PSGMARWG,PSJPWDO)=0,PSGMARWD=+$G(PSJPWD),PSGRBPPN=""
23 I '$D(PSGOENOF) S (PSGP,PSGPAT)=0,PSGSSH="MAR" D ^PSGSEL G:"^"[PSGSS OUT D @PSGSS G:$G(PSJSTOP) OUT
24 G:$$MEDTYPE^PSJMDIR(PSGMARWD) OUT S PSGMTYPE=Y
25 D DEV I POP!$D(IO("Q")) G DONE
26 ;
27ENQ ; when queued
28 N F,P,DRGI,DRGN,DRGT,PSIVUP,PSJORIFN,PSGMSORT
29 S PSJACNWP=1 U IO D ^PSGMAR0 I $D(^TMP($J))>9 D ^PSGMAR1
30 ;DAM 5-01-07
31 I $D(PSGREP) K ^XTMP(PSGREP)
32 ;END DAM
33 D ^%ZISC G DONE
34 ;
35OUT W $C(7),!!?5,"(No patient(s) selected for MAR run.)" K PSGPLF,PSGPLS
36DONE ;
37 I '$D(PSGOENOF) D ENKV^PSGSETU
38 K AD,ASTERS,BD,BLN,C,CNTR,DA1,DA2,DAO,DFN,DRG,DX,EXPIRE,FD,FT,HX,L,LN1,LN14,LN2,LN3,LN4,LN5,LN6,LN7,MOS,MSG1,MSG2,ND2,NG,OPST,PSJJORD,PAGE,PN,PND,PNN,PPN,PRB,PSEX,PSSN,PSGPLF,PSGPLS,PSGPLC,PSGPLO,QX,TMSTR,XX
39 K PSGADR,PSGALG,PSGD,PSGDW,PSGFORM,PSGMAR,PSGMARB,PSGMARDF,PSGMARDT,PSGMARED,PSGMARGD,PSGMARFD,PSGMARFP,PSGMAROC,PSGMARS,PSGMARSD,PSGL
40 K PSGMARSM,PSGMARSP,PSGMARTS,PSGMARWD,PSGMARWG,PSGMARWN,PSGMARWS,PSGMPG,PSGMPGN,PSGORD,PSGPAT,PSJDIET
41 K PSJSTOP,PSJPWDO,PSGMARO,ST,PSGSS,PSGSSH,PSTXDT,PST,PTM,PWDN,PSJACNWP,QST,R,RB,RCT,S,SD,SM,SPACES,TM,T,TD,TS,WD,WDN,WG,WGN,WS,WT,X1,X2,Y1,^TMP($J)
42 K PSGST,PSGTM,PSGTMALL,XTYPE,PSGLRPH,PSGMTYPE,PSGPG,PSGMFOR,PSGMTYPE,PSGPG,PSGRBPPN,PSGS0XT,PSGS0Y
43 K HT,ON,PSGOENOF,PSGOES,PSGRBPPN,PSGS0XT,PSGST,PSGTIR,PSGWD,XQUIT,ZTDES,ONHOLD
44 D ENKV^PSGLOI
45 Q
46 ;
47G ; get ward group
48 S DIC="^PS(57.5,",DIC(0)="QEAMI",DIC("A")="Select WARD GROUP: " W ! D ^DIC K DIC D I $G(PSJSTOP)=1 Q
49 . I X="^OTHER" S PSGMARWG="^OTHER" Q
50 . S PSGMARWG=+Y
51 . I +Y'>0 S PSJSTOP=1
52 D RBPPN^PSJMDIR
53 Q
54 ;
55W ; get ward
56 S DIC="^DIC(42,",DIC(0)="QEAMI",DIC("A")="Select WARD: " W ! D ^DIC K DIC S PSGMARWD=+Y I +Y'>0 S PSJSTOP=1 Q
57 S PSGWD=PSGMARWD D ADMTM^PSJMDIR
58 D:'PSJSTOP RBPPN^PSJMDIR
59 Q
60 ;
61P ; get patient
62 K PSGPAT S PSGPAT=0 F CNTR=0:1 S:CNTR PSGDICA="another" D ENP^PSGGAO:'PSGMARB,ENDPT^PSGP:PSGMARB Q:PSGP'>0 D
63 . S PSGPAT(PSGP)="",PSGPAT=PSGP
64 . ;*** PSGMARWD=1 when all patients are select from the same ward.
65 . S:'$G(PSJPWDO) (PSGMARWD,PSJPWDO)=PSJPWD S PSGMARWD=$S('$G(PSGMARWD):0,PSJPWDO=PSJPWD:PSJPWD,1:0)
66 S Y=PSGPAT S:Y'>0 PSJSTOP=1 K PSGDICA
67 Q
68 ;
69C ;
70 ;DAM Add new variable to hold numerical value of CLINIC 5-01-07
71 S PSGCLNC=""
72 K DIR S DIR(0)="FAO",DIR("A")="Select CLINIC: "
73 S DIR("?")="^D CDIC^PSGVBW" W ! D ^DIR
74CDIC ;
75 K DIC S DIC="^SC(",DIC(0)="QEMIZ" D ^DIC K DIC S:+Y>0 CL=+Y S PSGCLNC=+Y I +Y<0 S PSJSTOP=1 Q
76 W:X["?" !!,"Enter the clinic you want to use to select patients for processing.",!
77 Q
78L ;
79 K DIR S DIR(0)="FAO",DIR("A")="Select CLINIC GROUP: "
80 S DIR("?")="^D LDIC^PSGVBW" W ! D ^DIR
81LDIC ;
82 K DIC S DIC="^PS(57.8,",DIC(0)="QEMI" D ^DIC K DIC S:+Y>0 CG=+Y I +Y<0 S PSJSTOP=1 Q
83 W:X["?" !!,"Enter the name of the clinic group you want to use to select patients for processing."
84 Q
85DEV ; ask print device and queue if asked to
86 K ZTSAVE S PSGTIR="ENQ^PSGMAR",ZTDESC="24 HOUR MAR" S:PSGMARB ZTSAVE("PSGMARS")="" D
87 . F X="PSGMARWG","PSGMARWD","PSGP","PSGPAT(","PSGDT","PSGMARDT","PSGSS","PSGMARB","PSGMARDF","PSGMTYPE","PSGRBPPN","^TMP($J,","PSGINCL","PSGINCLG","PSGINWD","PSGINWDG" S ZTSAVE(X)=""
88 I $P(PSGMARDT,".",2) F X="PSGPLS","PSGPLF","PSGMARSD","PSGMARFD","PSGMARSP","PSGMARFP" S ZTSAVE(X)=""
89 I PSGSS="W" F X="PSGTMALL","PSGTM","PSGTM(" S ZTSAVE(X)=""
90 D ENDEV^PSGTI W:POP !!?3,"No device selected for 24 hour MAR run." W:$D(ZTSK) !?3,"24 hour MAR Queued!" K ZTSK Q
91 I 'IO("Q") U IO
92 ;
93BH ;
94 W !!," Enter a 'Y' to print BLANK (no data) MARs for the patient(s) you select.",!,"Enter an 'N' (or press the RETURN key) to print MARs complete with orders.",!,"Enter an '^' to exit this option now." Q
95 ;
96DH ;
97 W !!?2,"Enter the START DATE of the 24 hour period for which this MAR is to print.",!,"Unless the BLANK MARs are selected, all orders for the patient(s) selected that",!,"are (or were) active during the date range selected will print."
98 W !?2,"Time is not required. If time is not entered, the default time is used (if",!,"found in the site parameters). If the default time is not found, the start of",!,"the day is used." Q
99 ;
100SHTH ;
101 W !!?2,"Enter 'C' to print ONLY CONTINUOUS blank sheets for the patients selected.",!,"Enter 'P' to print ONLY PRN sheets. Enter 'B' (or press RETURN) to print BOTH",!,"sheets for each patient." Q
102 ;
103ENLM ;
104 S PSGOENOF=1,PSGPAT(PSGP)="",PSGSS="P" G EN
Note: See TracBrowser for help on using the repository browser.