DGMSTR1 ;ALB/GRR - GENERATE AND PRINT SUMMARY REPORT ; Jan 6, 1999
;;5.3;Registration;**195**; Aug 13, 1993
;DGMST("M") - Total Males
;DGMST("F") - Total Females
;DGMST("T") - Total Males and Females
;DGMST("M","Y") - Total Males seen for MST
;DGMST("M","N") - Total Males seen not related to MST
;DGMST("M","U") - Total Males seen with MST status of 'Unknown'
;DGMST("M","D") - Total Males seen with MST status of 'Declined to answer'
;DGMST("F", - Same totals as above four except for Females
;DGMST("%M", - Same breakdown as above except totals are percentages of Males
;DGMST("%F", - Same breakdown as above except totals are percentages of Females
;DGMST("%", - Same breakdown as above except totals are total percentages
;DGMST("Y") - Total number seen for MST
;DGMST("N") - Total seen not related to MST
;DGMST("U") - Total seen with MST status of 'Unknown'
;DGMST("D") - Total seen with MST status of 'Declined to answer'
;DGSDAT - Start Date of selected range
;DGEDAT - End Date of selected range
;DGPSDT - Start Date formatted for print
;DGPEDT - End Date formatted for print
;DGMSTST - Patient's MST Status
;
EN ;ENTRY POINT FOR ROUTINE
N DGMST,DGSDAT,DGPSDT,DGEDAT,DGPEDT,ZTSAVE,X,Y,DGSTAT,DTOUT,DUOUT
K DGMST
D DT^DICRW
F DGSTAT="Y","N","D","U" S DGMST("M",DGSTAT)=0,DGMST("F",DGSTAT)=0 ;INITIALIZE CUMULATORS BY SEX AND MST STATUS
S DGMST("M")=0,DGMST("F")=0 ;INITIALIZE SEX COUNTERS
;GET DATE RANGE
SDAT S DIR(0)="D^:"_DT_":EX",DIR("A")="Start Date"
D ^DIR K DIR
Q:$D(DTOUT)!($D(DUOUT))
S DGSDAT=+Y,Y=+Y D DD^%DT S DGPSDT=Y
TDAT S DIR(0)="D^"_DGSDAT_":"_DT_":EX",DIR("A")="End Date"
D ^DIR K DIR
Q:$D(DTOUT)!($D(DUOUT))
S DGEDAT=+Y_.9999,Y=+Y D DD^%DT S DGPEDT=Y
F X="DGMST(","DGSDAT","DGPSDT","DGEDAT","DGPEDT" S ZTSAVE(X)=""
W !!,"This may take long to print, queue the report to free-up your terminal!",!
D EN^XUTMDEVQ("RPT^DGMSTR1","MST Summary Report",.ZTSAVE)
D HOME^%ZIS
Q
RPT ;LOOP THROUGH PATIENT FILE TO CALCULATE UNKNOWN STATUSES
N DFN,DGMSTST,DGMIFN,SEX
S DFN=0 F S DFN=$O(^DPT(DFN)) Q:DFN'>0 D
.Q:$$EXCLUDE(DFN)
.S SEX=$P($G(^DPT(DFN,0)),"^",2) Q:SEX'="M"&(SEX'="F")
.I '$D(^DGMS(29.11,"C",DFN)) S DGMST(SEX,"U")=DGMST(SEX,"U")+1,DGMST(SEX)=DGMST(SEX)+1
;
;LOOP THROUGH MST HISTORY FILE TO TABULATE STATUS COUNTS
;
S DFN=0 F S DFN=$O(^DGMS(29.11,"C",DFN)) Q:DFN'>0 D
.S Y=$$GETSTAT^DGMSTAPI(DFN,DGEDAT)
.Q:+Y=0
.Q:$P(Y,"^",3)<DGSDAT
.S DGMSTST=$P(Y,"^",2) Q:DGMSTST=""
.S DGMIFN=$P(Y,"^")
.S SEX=$P($G(^DPT(DFN,0)),"^",2)
.Q:SEX'="M"&(SEX'="F")
.S DGMST(SEX,DGMSTST)=DGMST(SEX,DGMSTST)+1
.S DGMST(SEX)=DGMST(SEX)+1
;COMPUTE REMAINING TOTALS
S DGMST("T")=DGMST("M")+DGMST("F") ;ADD TOTAL MALES AND TOTAL FEMALES FOR GRAND TOTAL COUNT
F S="Y","N","D","U" D
.S DGMST(S)=DGMST("M",S)+DGMST("F",S) ;ADD TOTAL MALE AND FEMALE FOR EACH MST STATUS FOR TOTAL COUNT FOR EACH STATUS
.S DGMST("%M",S)=0 I DGMST(S)>0 S DGMST("%M",S)=DGMST("M",S)/DGMST(S)*100 ;CALCULATE PERCENT MALE FOR EACH STATUS
.S DGMST("%F",S)=0 I DGMST(S)>0 S DGMST("%F",S)=DGMST("F",S)/DGMST(S)*100 ;CALCULATE PERCENT FEMALE FOR EACH STATUS
.S DGMST("%",S)=0 I DGMST(S)>0 S DGMST("%",S)=DGMST(S)/DGMST("T")*100 ;CALCULATE TOTAL PERCENT FOR EACH STATUS
;PRINT REPORT
;
I $E(IOST,1,2)="C-" W @IOF
W !,?20,"MST Summary Report"
W !,?20,"Date Range: ",DGPSDT," - ",DGPEDT
S Y=DT D DD^%DT S DGPCDT=Y
W !,?20,"Date report Printed: ",DGPCDT,!!
W !,"Total Male with a MST Status",?78-$L(DGMST("M")),DGMST("M")
W !,"Total Female with a MST Status",?78-$L(DGMST("F")),DGMST("F")
W !,"Total Patients with a MST Status",?78-$L(DGMST("T")),DGMST("T")
W !!,"MST STATUS",?47,"Y",?57,"N",?67,"D",?77,"U"
W !!,"Total Male"
W ?48-$L(DGMST("M","Y")),DGMST("M","Y")
W ?58-$L(DGMST("M","N")),DGMST("M","N")
W ?68-$L(DGMST("M","D")),DGMST("M","D")
W ?78-$L(DGMST("M","U")),DGMST("M","U")
W !,"Total Female"
W ?48-$L(DGMST("F","Y")),DGMST("F","Y")
W ?58-$L(DGMST("F","N")),DGMST("F","N")
W ?68-$L(DGMST("F","D")),DGMST("F","D")
W ?78-$L(DGMST("F","U")),DGMST("F","U")
W !!,"Total Patients with MST Status"
W ?48-$L(DGMST("Y")),DGMST("Y")
W ?58-$L(DGMST("N")),DGMST("N")
W ?68-$L(DGMST("D")),DGMST("D")
W ?78-$L(DGMST("U")),DGMST("U")
W !!,"Percent of Male"
W ?48-$L($J(DGMST("%M","Y"),3,1)),$J(DGMST("%M","Y"),3,1)
W ?58-$L($J(DGMST("%M","N"),3,1)),$J(DGMST("%M","N"),3,1)
W ?68-$L($J(DGMST("%M","D"),3,1)),$J(DGMST("%M","D"),3,1)
W ?78-$L($J(DGMST("%M","U"),3,1)),$J(DGMST("%M","U"),3,1)
W !,"Percent of Female"
W ?48-$L($J(DGMST("%F","Y"),3,1)),$J(DGMST("%F","Y"),3,1)
W ?58-$L($J(DGMST("%F","N"),3,1)),$J(DGMST("%F","N"),3,1)
W ?68-$L($J(DGMST("%F","D"),3,1)),$J(DGMST("%F","D"),3,1)
W ?78-$L($J(DGMST("%F","U"),3,1)),$J(DGMST("%F","U"),3,1)
W !!,"Percent of all patients"
W ?48-$L($J(DGMST("%","Y"),3,1)),$J(DGMST("%","Y"),3,1)
W ?58-$L($J(DGMST("%","N"),3,1)),$J(DGMST("%","N"),3,1)
W ?68-$L($J(DGMST("%","D"),3,1)),$J(DGMST("%","D"),3,1)
W ?78-$L($J(DGMST("%","U"),3,1)),$J(DGMST("%","U"),3,1)
I $E(IOST,1,2)="C-" W ! S DIR(0)="E" D ^DIR K DIR Q:$D(DTOUT)!($D(DUOUT)) W @IOF
I $E(IOST,1,2)'="C-" W @IOF
W !!
W !,"----- LEGEND -----"
W !,"Y means Yes, Reports MST"
W !,"N means No, Does not Report MST"
W !,"D means Declined to Answer"
W !,"U means Unknown"
W !
K X,Y,S,DGPCDT,DGSTAT
Q
;
EXCLUDE(DFN) ;DETERMINE IF PATIENT SHOULD BE EXCLUDED FROM MST TRACKING
;
I $G(^DPT(DFN,"VET"))="Y",'+$G(^(.35))>0!(+$G(^(.35))>0&(+$G(^(.35))'<2921001)) Q 0
Q 1
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGMSTR1 5585 printed Dec 13, 2024@02:44:29 Page 2
DGMSTR1 ;ALB/GRR - GENERATE AND PRINT SUMMARY REPORT ; Jan 6, 1999
+1 ;;5.3;Registration;**195**; Aug 13, 1993
+2 ;DGMST("M") - Total Males
+3 ;DGMST("F") - Total Females
+4 ;DGMST("T") - Total Males and Females
+5 ;DGMST("M","Y") - Total Males seen for MST
+6 ;DGMST("M","N") - Total Males seen not related to MST
+7 ;DGMST("M","U") - Total Males seen with MST status of 'Unknown'
+8 ;DGMST("M","D") - Total Males seen with MST status of 'Declined to answer'
+9 ;DGMST("F", - Same totals as above four except for Females
+10 ;DGMST("%M", - Same breakdown as above except totals are percentages of Males
+11 ;DGMST("%F", - Same breakdown as above except totals are percentages of Females
+12 ;DGMST("%", - Same breakdown as above except totals are total percentages
+13 ;DGMST("Y") - Total number seen for MST
+14 ;DGMST("N") - Total seen not related to MST
+15 ;DGMST("U") - Total seen with MST status of 'Unknown'
+16 ;DGMST("D") - Total seen with MST status of 'Declined to answer'
+17 ;DGSDAT - Start Date of selected range
+18 ;DGEDAT - End Date of selected range
+19 ;DGPSDT - Start Date formatted for print
+20 ;DGPEDT - End Date formatted for print
+21 ;DGMSTST - Patient's MST Status
+22 ;
EN ;ENTRY POINT FOR ROUTINE
+1 NEW DGMST,DGSDAT,DGPSDT,DGEDAT,DGPEDT,ZTSAVE,X,Y,DGSTAT,DTOUT,DUOUT
+2 KILL DGMST
+3 DO DT^DICRW
+4 ;INITIALIZE CUMULATORS BY SEX AND MST STATUS
FOR DGSTAT="Y","N","D","U"
SET DGMST("M",DGSTAT)=0
SET DGMST("F",DGSTAT)=0
+5 ;INITIALIZE SEX COUNTERS
SET DGMST("M")=0
SET DGMST("F")=0
+6 ;GET DATE RANGE
SDAT SET DIR(0)="D^:"_DT_":EX"
SET DIR("A")="Start Date"
+1 DO ^DIR
KILL DIR
+2 if $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+3 SET DGSDAT=+Y
SET Y=+Y
DO DD^%DT
SET DGPSDT=Y
TDAT SET DIR(0)="D^"_DGSDAT_":"_DT_":EX"
SET DIR("A")="End Date"
+1 DO ^DIR
KILL DIR
+2 if $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+3 SET DGEDAT=+Y_.9999
SET Y=+Y
DO DD^%DT
SET DGPEDT=Y
+4 FOR X="DGMST(","DGSDAT","DGPSDT","DGEDAT","DGPEDT"
SET ZTSAVE(X)=""
+5 WRITE !!,"This may take long to print, queue the report to free-up your terminal!",!
+6 DO EN^XUTMDEVQ("RPT^DGMSTR1","MST Summary Report",.ZTSAVE)
+7 DO HOME^%ZIS
+8 QUIT
RPT ;LOOP THROUGH PATIENT FILE TO CALCULATE UNKNOWN STATUSES
+1 NEW DFN,DGMSTST,DGMIFN,SEX
+2 SET DFN=0
FOR
SET DFN=$ORDER(^DPT(DFN))
if DFN'>0
QUIT
Begin DoDot:1
+3 if $$EXCLUDE(DFN)
QUIT
+4 SET SEX=$PIECE($GET(^DPT(DFN,0)),"^",2)
if SEX'="M"&(SEX'="F")
QUIT
+5 IF '$DATA(^DGMS(29.11,"C",DFN))
SET DGMST(SEX,"U")=DGMST(SEX,"U")+1
SET DGMST(SEX)=DGMST(SEX)+1
End DoDot:1
+6 ;
+7 ;LOOP THROUGH MST HISTORY FILE TO TABULATE STATUS COUNTS
+8 ;
+9 SET DFN=0
FOR
SET DFN=$ORDER(^DGMS(29.11,"C",DFN))
if DFN'>0
QUIT
Begin DoDot:1
+10 SET Y=$$GETSTAT^DGMSTAPI(DFN,DGEDAT)
+11 if +Y=0
QUIT
+12 if $PIECE(Y,"^",3)<DGSDAT
QUIT
+13 SET DGMSTST=$PIECE(Y,"^",2)
if DGMSTST=""
QUIT
+14 SET DGMIFN=$PIECE(Y,"^")
+15 SET SEX=$PIECE($GET(^DPT(DFN,0)),"^",2)
+16 if SEX'="M"&(SEX'="F")
QUIT
+17 SET DGMST(SEX,DGMSTST)=DGMST(SEX,DGMSTST)+1
+18 SET DGMST(SEX)=DGMST(SEX)+1
End DoDot:1
+19 ;COMPUTE REMAINING TOTALS
+20 ;ADD TOTAL MALES AND TOTAL FEMALES FOR GRAND TOTAL COUNT
SET DGMST("T")=DGMST("M")+DGMST("F")
+21 FOR S="Y","N","D","U"
Begin DoDot:1
+22 ;ADD TOTAL MALE AND FEMALE FOR EACH MST STATUS FOR TOTAL COUNT FOR EACH STATUS
SET DGMST(S)=DGMST("M",S)+DGMST("F",S)
+23 ;CALCULATE PERCENT MALE FOR EACH STATUS
SET DGMST("%M",S)=0
IF DGMST(S)>0
SET DGMST("%M",S)=DGMST("M",S)/DGMST(S)*100
+24 ;CALCULATE PERCENT FEMALE FOR EACH STATUS
SET DGMST("%F",S)=0
IF DGMST(S)>0
SET DGMST("%F",S)=DGMST("F",S)/DGMST(S)*100
+25 ;CALCULATE TOTAL PERCENT FOR EACH STATUS
SET DGMST("%",S)=0
IF DGMST(S)>0
SET DGMST("%",S)=DGMST(S)/DGMST("T")*100
End DoDot:1
+26 ;PRINT REPORT
+27 ;
+28 IF $EXTRACT(IOST,1,2)="C-"
WRITE @IOF
+29 WRITE !,?20,"MST Summary Report"
+30 WRITE !,?20,"Date Range: ",DGPSDT," - ",DGPEDT
+31 SET Y=DT
DO DD^%DT
SET DGPCDT=Y
+32 WRITE !,?20,"Date report Printed: ",DGPCDT,!!
+33 WRITE !,"Total Male with a MST Status",?78-$LENGTH(DGMST("M")),DGMST("M")
+34 WRITE !,"Total Female with a MST Status",?78-$LENGTH(DGMST("F")),DGMST("F")
+35 WRITE !,"Total Patients with a MST Status",?78-$LENGTH(DGMST("T")),DGMST("T")
+36 WRITE !!,"MST STATUS",?47,"Y",?57,"N",?67,"D",?77,"U"
+37 WRITE !!,"Total Male"
+38 WRITE ?48-$LENGTH(DGMST("M","Y")),DGMST("M","Y")
+39 WRITE ?58-$LENGTH(DGMST("M","N")),DGMST("M","N")
+40 WRITE ?68-$LENGTH(DGMST("M","D")),DGMST("M","D")
+41 WRITE ?78-$LENGTH(DGMST("M","U")),DGMST("M","U")
+42 WRITE !,"Total Female"
+43 WRITE ?48-$LENGTH(DGMST("F","Y")),DGMST("F","Y")
+44 WRITE ?58-$LENGTH(DGMST("F","N")),DGMST("F","N")
+45 WRITE ?68-$LENGTH(DGMST("F","D")),DGMST("F","D")
+46 WRITE ?78-$LENGTH(DGMST("F","U")),DGMST("F","U")
+47 WRITE !!,"Total Patients with MST Status"
+48 WRITE ?48-$LENGTH(DGMST("Y")),DGMST("Y")
+49 WRITE ?58-$LENGTH(DGMST("N")),DGMST("N")
+50 WRITE ?68-$LENGTH(DGMST("D")),DGMST("D")
+51 WRITE ?78-$LENGTH(DGMST("U")),DGMST("U")
+52 WRITE !!,"Percent of Male"
+53 WRITE ?48-$LENGTH($JUSTIFY(DGMST("%M","Y"),3,1)),$JUSTIFY(DGMST("%M","Y"),3,1)
+54 WRITE ?58-$LENGTH($JUSTIFY(DGMST("%M","N"),3,1)),$JUSTIFY(DGMST("%M","N"),3,1)
+55 WRITE ?68-$LENGTH($JUSTIFY(DGMST("%M","D"),3,1)),$JUSTIFY(DGMST("%M","D"),3,1)
+56 WRITE ?78-$LENGTH($JUSTIFY(DGMST("%M","U"),3,1)),$JUSTIFY(DGMST("%M","U"),3,1)
+57 WRITE !,"Percent of Female"
+58 WRITE ?48-$LENGTH($JUSTIFY(DGMST("%F","Y"),3,1)),$JUSTIFY(DGMST("%F","Y"),3,1)
+59 WRITE ?58-$LENGTH($JUSTIFY(DGMST("%F","N"),3,1)),$JUSTIFY(DGMST("%F","N"),3,1)
+60 WRITE ?68-$LENGTH($JUSTIFY(DGMST("%F","D"),3,1)),$JUSTIFY(DGMST("%F","D"),3,1)
+61 WRITE ?78-$LENGTH($JUSTIFY(DGMST("%F","U"),3,1)),$JUSTIFY(DGMST("%F","U"),3,1)
+62 WRITE !!,"Percent of all patients"
+63 WRITE ?48-$LENGTH($JUSTIFY(DGMST("%","Y"),3,1)),$JUSTIFY(DGMST("%","Y"),3,1)
+64 WRITE ?58-$LENGTH($JUSTIFY(DGMST("%","N"),3,1)),$JUSTIFY(DGMST("%","N"),3,1)
+65 WRITE ?68-$LENGTH($JUSTIFY(DGMST("%","D"),3,1)),$JUSTIFY(DGMST("%","D"),3,1)
+66 WRITE ?78-$LENGTH($JUSTIFY(DGMST("%","U"),3,1)),$JUSTIFY(DGMST("%","U"),3,1)
+67 IF $EXTRACT(IOST,1,2)="C-"
WRITE !
SET DIR(0)="E"
DO ^DIR
KILL DIR
if $DATA(DTOUT)!($DATA(DUOUT))
QUIT
WRITE @IOF
+68 IF $EXTRACT(IOST,1,2)'="C-"
WRITE @IOF
+69 WRITE !!
+70 WRITE !,"----- LEGEND -----"
+71 WRITE !,"Y means Yes, Reports MST"
+72 WRITE !,"N means No, Does not Report MST"
+73 WRITE !,"D means Declined to Answer"
+74 WRITE !,"U means Unknown"
+75 WRITE !
+76 KILL X,Y,S,DGPCDT,DGSTAT
+77 QUIT
+78 ;
EXCLUDE(DFN) ;DETERMINE IF PATIENT SHOULD BE EXCLUDED FROM MST TRACKING
+1 ;
+2 IF $GET(^DPT(DFN,"VET"))="Y"
IF '+$GET(^(.35))>0!(+$GET(^(.35))>0&(+$GET(^(.35))'<2921001))
QUIT 0
+3 QUIT 1