GMTSPP ;SLC/KER - Define HS Print-by-Location Parameters ; 09/21/2001
;;2.7;Health Summary;**2,30,47**;Oct 20, 1995
;
; External References
; DBIA 10003 DD^%DT
; DBIA 10006 ^DIC
; DBIA 2051 FIND^DIC
; DBIA 10018 ^DIE
; DBIA 2056 $$GET1^DIQ
; DBIA 10026 ^DIR
;
MAIN ; Print by Location
K DIC,DIE,DIR
S DIC=19.2,DIC(0)="F",X="GMTS TASK STARTUP" S Y=$$SDT(X)
I Y<0 D ALERT K X,Y G MAIN1
I Y>DT D QUEOK K Y G MAIN1
D ALERT
MAIN1 ; Controls Branching
F D GETDATA Q:$D(PPQIT)!$D(DTOUT)
K CLINIC,DIROUT,DIRUT,DTOUT,DUOUT,GMTSIFN,GMTSLOC,J1,J2,NEWTYP,PPQIT,X,B,C,D0,DI,DIJ,DISYS,DP,DQ,P
Q
QUEOK ; Informs user of print time if queued to print
D DD^%DT S QTIM=Y K Y
W !!,"For your information:",!
W "Health Summary Batches are queued to print nightly at ",QTIM,!
W "and should be available for distribution by early morning.",!
K QTIM
Q
ALERT ; Warns user that summaries have not been queued
W !!," ***Alert***",!!
W "Health Summary batches have not been queued to print or date is not current.",!
W "Please ask your IRM SERVICE to queue option GMTS TASK STARTUP",!
W "to run nightly. Parameters may be set now but will not produce",!
W "Health Summaries until option is queued."
Q
GETDATA ; Selects Location/Health Summary Type and Edits parameters
S DIC=44,DIC(0)="AEMQZ",DIC("A")="Select Hospital Location: ",DIC("S")="I ""WCOR""[$P(^(0),U,3)" W ! D ^DIC K DIC
I Y=-1 K X,Y S PPQIT=1 Q
S GMTSLOC=+Y,GMTSLNM=$P(Y,U,2),CLINIC=$S("COR"[$P(Y(0),U,3):1,1:0) K X,Y
I $O(^GMT(142,"D",GMTSLOC,0)) D DISPLAY
K GMTSLNM
S DIC=142,DIC(0)="AEQ",DIC("A")="Select Health Summary Type: " S Y=$$TYPE^GMTSULT K DIC
I X="" K X,Y Q
I Y=-1 K X,Y S PPQIT=1 Q
S GMTSIFN=+Y,NEWTYP=1,TYP1=0
F S TYP1=$O(^GMT(142,"D",GMTSLOC,TYP1)) Q:TYP1="" I GMTSIFN=TYP1 S NEWTYP=0 Q
S GMTSUM=$P(Y,U,2),GMTSNEW=0,EXISTS=1,GMTSQIT=0 K X,Y D LIST^GMTSRM
K GMTSNEW,EXISTS,GMTSQIT,GMTSUM,TYP1
Q:$D(DUOUT) I $D(DIRUT) S PPQIT=1 Q
I NEWTYP=1 D NEW Q
S DIR(0)="Y",DIR("A")="Do you wish to delete this Health Summary Type from the nightly print",DIR("B")="NO"
W ! D ^DIR K DIR
Q:$D(DUOUT) I $D(DIRUT) S PPQIT=1 Q
S DIE="^GMT(142,"_GMTSIFN_",20,",DIE("NO^")="OUTOK",DA(1)=GMTSIFN
S DA=$O(^GMT(142,"D",GMTSLOC,GMTSIFN,0)),DEL=0
I Y=1 S DR=".01///@",DEL=1
K X,Y
E S:CLINIC DR=".02;I $P($G(^GMT(142.99,1,0)),U,2)'=""Y"" S Y=""@1"";.03;@1;.04//0" S:'CLINIC DR=".02;I $P($G(^GMT(142.99,1,0)),U,2)'=""Y"" S Y=0;.03" W !
D ^DIE
I DEL W !!,"**Print for Health Summary Type deleted**"
K DIE,DA,DR,X,Y,DEL
Q
DISPLAY ; Displays Health Summary Types associated with Location
W !!,"At present the following Health Summary Types are printed for ",GMTSLNM,":"
W !?70,"Action",!?2,"Type",?32,"Device" W:CLINIC ?54,"Days Ahead" W ?70,"Profile",!
S DEVFLG=0
S TYP=0 F J1=1:1 S TYP=$O(^GMT(142,"D",GMTSLOC,TYP)) Q:TYP="" D WRITE
I DEVFLG W !!,"*This Type will not print since Device is invalid or has not been entered"
W !!,"You may edit a Health Summary Type from the list or enter a new Type",!
K TYP,DEVFLG
Q
WRITE ; Writes Health Summary Type with parameters
S TYPNM=$P(^GMT(142,TYP,0),U),LOCIFN=$O(^GMT(142,"D",GMTSLOC,TYP,0))
S DATA=^GMT(142,TYP,20,LOCIFN,0),DEV=$P(DATA,U,2)
S X="`"_DEV,DIC=3.5,DIC(0)="" D ^DIC
I +Y'>0 S DEVFLG=1
S DEVNM=$S(+Y>0:$P(Y,U,2),DEV="":"None",1:DEV_" (Invalid)")
W !,$S(+Y'>0:"*",1:" "),TYPNM,?32,$E(DEVNM,1,21),?59,$P(DATA,U,4),?72,$S($P(DATA,U,3)="Y":"Yes",1:"No") K DIC,X,Y
K DATA,DAYS,DEV,DEVNM,LOCIFN,TYPNM
Q
NEW ; Sets parameters for new Health Summary Type
S (NI,LI)=0 I $D(^GMT(142,GMTSIFN,20,0)) F S NI=$O(^GMT(142,GMTSIFN,20,NI)) Q:NI'>0 S LI=NI
S:'$D(^GMT(142,GMTSIFN,20,0)) ^(0)="^142.2P^^"
S DIE="^GMT(142,"_GMTSIFN_",20,",DA(1)=GMTSIFN,DA=LI+1,DIE("NO^")="OUTOK"
I CLINIC S DR=".01////"_GMTSLOC_";.02;I $P($G(^GMT(142.99,1,0)),U,2)'=""Y"" S Y=""@1"";.03;@1;.04//0"
E S DR=".01////"_GMTSLOC_";.02;I $P($G(^GMT(142.99,1,0)),U,2)'=""Y"" S Y=0;.03"
W ! D ^DIE K DIE,DA,DR,X,Y,NI,LI,J3
Q
SDT(X) ; Get the last schedule date/time
N GMTSM,GMTSR,GMTSI,GMTSE,GMTSDA S (GMTSI,GMTSM)=0
D FIND^DIC(19.2,,,"X",X,5,,,,"GMTSDA")
F S GMTSI=$O(GMTSDA("DILIST",2,GMTSI)) Q:GMTSI'>0 D
. S GMTSE=GMTSDA("DILIST",2,GMTSI) Q:+GMTSE'>0
. S GMTSR=$$GET1^DIQ(19.2,(GMTSE_","),2,"I")
. S:+GMTSR>GMTSM GMTSM=+GMTSR
S X=$S(+($G(GMTSM))>0:+($G(GMTSM)),1:-1) Q X
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSPP 4478 printed Nov 22, 2024@17:09:35 Page 2
GMTSPP ;SLC/KER - Define HS Print-by-Location Parameters ; 09/21/2001
+1 ;;2.7;Health Summary;**2,30,47**;Oct 20, 1995
+2 ;
+3 ; External References
+4 ; DBIA 10003 DD^%DT
+5 ; DBIA 10006 ^DIC
+6 ; DBIA 2051 FIND^DIC
+7 ; DBIA 10018 ^DIE
+8 ; DBIA 2056 $$GET1^DIQ
+9 ; DBIA 10026 ^DIR
+10 ;
MAIN ; Print by Location
+1 KILL DIC,DIE,DIR
+2 SET DIC=19.2
SET DIC(0)="F"
SET X="GMTS TASK STARTUP"
SET Y=$$SDT(X)
+3 IF Y<0
DO ALERT
KILL X,Y
GOTO MAIN1
+4 IF Y>DT
DO QUEOK
KILL Y
GOTO MAIN1
+5 DO ALERT
MAIN1 ; Controls Branching
+1 FOR
DO GETDATA
if $DATA(PPQIT)!$DATA(DTOUT)
QUIT
+2 KILL CLINIC,DIROUT,DIRUT,DTOUT,DUOUT,GMTSIFN,GMTSLOC,J1,J2,NEWTYP,PPQIT,X,B,C,D0,DI,DIJ,DISYS,DP,DQ,P
+3 QUIT
QUEOK ; Informs user of print time if queued to print
+1 DO DD^%DT
SET QTIM=Y
KILL Y
+2 WRITE !!,"For your information:",!
+3 WRITE "Health Summary Batches are queued to print nightly at ",QTIM,!
+4 WRITE "and should be available for distribution by early morning.",!
+5 KILL QTIM
+6 QUIT
ALERT ; Warns user that summaries have not been queued
+1 WRITE !!," ***Alert***",!!
+2 WRITE "Health Summary batches have not been queued to print or date is not current.",!
+3 WRITE "Please ask your IRM SERVICE to queue option GMTS TASK STARTUP",!
+4 WRITE "to run nightly. Parameters may be set now but will not produce",!
+5 WRITE "Health Summaries until option is queued."
+6 QUIT
GETDATA ; Selects Location/Health Summary Type and Edits parameters
+1 SET DIC=44
SET DIC(0)="AEMQZ"
SET DIC("A")="Select Hospital Location: "
SET DIC("S")="I ""WCOR""[$P(^(0),U,3)"
WRITE !
DO ^DIC
KILL DIC
+2 IF Y=-1
KILL X,Y
SET PPQIT=1
QUIT
+3 SET GMTSLOC=+Y
SET GMTSLNM=$PIECE(Y,U,2)
SET CLINIC=$SELECT("COR"[$PIECE(Y(0),U,3):1,1:0)
KILL X,Y
+4 IF $ORDER(^GMT(142,"D",GMTSLOC,0))
DO DISPLAY
+5 KILL GMTSLNM
+6 SET DIC=142
SET DIC(0)="AEQ"
SET DIC("A")="Select Health Summary Type: "
SET Y=$$TYPE^GMTSULT
KILL DIC
+7 IF X=""
KILL X,Y
QUIT
+8 IF Y=-1
KILL X,Y
SET PPQIT=1
QUIT
+9 SET GMTSIFN=+Y
SET NEWTYP=1
SET TYP1=0
+10 FOR
SET TYP1=$ORDER(^GMT(142,"D",GMTSLOC,TYP1))
if TYP1=""
QUIT
IF GMTSIFN=TYP1
SET NEWTYP=0
QUIT
+11 SET GMTSUM=$PIECE(Y,U,2)
SET GMTSNEW=0
SET EXISTS=1
SET GMTSQIT=0
KILL X,Y
DO LIST^GMTSRM
+12 KILL GMTSNEW,EXISTS,GMTSQIT,GMTSUM,TYP1
+13 if $DATA(DUOUT)
QUIT
IF $DATA(DIRUT)
SET PPQIT=1
QUIT
+14 IF NEWTYP=1
DO NEW
QUIT
+15 SET DIR(0)="Y"
SET DIR("A")="Do you wish to delete this Health Summary Type from the nightly print"
SET DIR("B")="NO"
+16 WRITE !
DO ^DIR
KILL DIR
+17 if $DATA(DUOUT)
QUIT
IF $DATA(DIRUT)
SET PPQIT=1
QUIT
+18 SET DIE="^GMT(142,"_GMTSIFN_",20,"
SET DIE("NO^")="OUTOK"
SET DA(1)=GMTSIFN
+19 SET DA=$ORDER(^GMT(142,"D",GMTSLOC,GMTSIFN,0))
SET DEL=0
+20 IF Y=1
SET DR=".01///@"
SET DEL=1
+21 KILL X,Y
+22 IF '$TEST
if CLINIC
SET DR=".02;I $P($G(^GMT(142.99,1,0)),U,2)'=""Y"" S Y=""@1"";.03;@1;.04//0"
if 'CLINIC
SET DR=".02;I $P($G(^GMT(142.99,1,0)),U,2)'=""Y"" S Y=0;.03"
WRITE !
+23 DO ^DIE
+24 IF DEL
WRITE !!,"**Print for Health Summary Type deleted**"
+25 KILL DIE,DA,DR,X,Y,DEL
+26 QUIT
DISPLAY ; Displays Health Summary Types associated with Location
+1 WRITE !!,"At present the following Health Summary Types are printed for ",GMTSLNM,":"
+2 WRITE !?70,"Action",!?2,"Type",?32,"Device"
if CLINIC
WRITE ?54,"Days Ahead"
WRITE ?70,"Profile",!
+3 SET DEVFLG=0
+4 SET TYP=0
FOR J1=1:1
SET TYP=$ORDER(^GMT(142,"D",GMTSLOC,TYP))
if TYP=""
QUIT
DO WRITE
+5 IF DEVFLG
WRITE !!,"*This Type will not print since Device is invalid or has not been entered"
+6 WRITE !!,"You may edit a Health Summary Type from the list or enter a new Type",!
+7 KILL TYP,DEVFLG
+8 QUIT
WRITE ; Writes Health Summary Type with parameters
+1 SET TYPNM=$PIECE(^GMT(142,TYP,0),U)
SET LOCIFN=$ORDER(^GMT(142,"D",GMTSLOC,TYP,0))
+2 SET DATA=^GMT(142,TYP,20,LOCIFN,0)
SET DEV=$PIECE(DATA,U,2)
+3 SET X="`"_DEV
SET DIC=3.5
SET DIC(0)=""
DO ^DIC
+4 IF +Y'>0
SET DEVFLG=1
+5 SET DEVNM=$SELECT(+Y>0:$PIECE(Y,U,2),DEV="":"None",1:DEV_" (Invalid)")
+6 WRITE !,$SELECT(+Y'>0:"*",1:" "),TYPNM,?32,$EXTRACT(DEVNM,1,21),?59,$PIECE(DATA,U,4),?72,$SELECT($PIECE(DATA,U,3)="Y":"Yes",1:"No")
KILL DIC,X,Y
+7 KILL DATA,DAYS,DEV,DEVNM,LOCIFN,TYPNM
+8 QUIT
NEW ; Sets parameters for new Health Summary Type
+1 SET (NI,LI)=0
IF $DATA(^GMT(142,GMTSIFN,20,0))
FOR
SET NI=$ORDER(^GMT(142,GMTSIFN,20,NI))
if NI'>0
QUIT
SET LI=NI
+2 if '$DATA(^GMT(142,GMTSIFN,20,0))
SET ^(0)="^142.2P^^"
+3 SET DIE="^GMT(142,"_GMTSIFN_",20,"
SET DA(1)=GMTSIFN
SET DA=LI+1
SET DIE("NO^")="OUTOK"
+4 IF CLINIC
SET DR=".01////"_GMTSLOC_";.02;I $P($G(^GMT(142.99,1,0)),U,2)'=""Y"" S Y=""@1"";.03;@1;.04//0"
+5 IF '$TEST
SET DR=".01////"_GMTSLOC_";.02;I $P($G(^GMT(142.99,1,0)),U,2)'=""Y"" S Y=0;.03"
+6 WRITE !
DO ^DIE
KILL DIE,DA,DR,X,Y,NI,LI,J3
+7 QUIT
SDT(X) ; Get the last schedule date/time
+1 NEW GMTSM,GMTSR,GMTSI,GMTSE,GMTSDA
SET (GMTSI,GMTSM)=0
+2 DO FIND^DIC(19.2,,,"X",X,5,,,,"GMTSDA")
+3 FOR
SET GMTSI=$ORDER(GMTSDA("DILIST",2,GMTSI))
if GMTSI'>0
QUIT
Begin DoDot:1
+4 SET GMTSE=GMTSDA("DILIST",2,GMTSI)
if +GMTSE'>0
QUIT
+5 SET GMTSR=$$GET1^DIQ(19.2,(GMTSE_","),2,"I")
+6 if +GMTSR>GMTSM
SET GMTSM=+GMTSR
End DoDot:1
+7 SET X=$SELECT(+($GET(GMTSM))>0:+($GET(GMTSM)),1:-1)
QUIT X