source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGMSTR1.m@ 1722

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

initial load of WorldVistAEHR

File size: 5.3 KB
Line 
1DGMSTR1 ;ALB/GRR - GENERATE AND PRINT SUMMARY REPORT ; Jan 6, 1999
2 ;;5.3;Registration;**195**; Aug 13, 1993
3 ;DGMST("M") - Total Males
4 ;DGMST("F") - Total Females
5 ;DGMST("T") - Total Males and Females
6 ;DGMST("M","Y") - Total Males seen for MST
7 ;DGMST("M","N") - Total Males seen not related to MST
8 ;DGMST("M","U") - Total Males seen with MST status of 'Unknown'
9 ;DGMST("M","D") - Total Males seen with MST status of 'Declined to answer'
10 ;DGMST("F", - Same totals as above four except for Females
11 ;DGMST("%M", - Same breakdown as above except totals are percentages of Males
12 ;DGMST("%F", - Same breakdown as above except totals are percentages of Females
13 ;DGMST("%", - Same breakdown as above except totals are total percentages
14 ;DGMST("Y") - Total number seen for MST
15 ;DGMST("N") - Total seen not related to MST
16 ;DGMST("U") - Total seen with MST status of 'Unknown'
17 ;DGMST("D") - Total seen with MST status of 'Declined to answer'
18 ;DGSDAT - Start Date of selected range
19 ;DGEDAT - End Date of selected range
20 ;DGPSDT - Start Date formatted for print
21 ;DGPEDT - End Date formatted for print
22 ;DGMSTST - Patient's MST Status
23 ;
24EN ;ENTRY POINT FOR ROUTINE
25 N DGMST,DGSDAT,DGPSDT,DGEDAT,DGPEDT,ZTSAVE,X,Y,DGSTAT,DTOUT,DUOUT
26 K DGMST
27 D DT^DICRW
28 F DGSTAT="Y","N","D","U" S DGMST("M",DGSTAT)=0,DGMST("F",DGSTAT)=0 ;INITIALIZE CUMULATORS BY SEX AND MST STATUS
29 S DGMST("M")=0,DGMST("F")=0 ;INITIALIZE SEX COUNTERS
30 ;GET DATE RANGE
31SDAT S DIR(0)="D^:"_DT_":EX",DIR("A")="Start Date"
32 D ^DIR K DIR
33 Q:$D(DTOUT)!($D(DUOUT))
34 S DGSDAT=+Y,Y=+Y D DD^%DT S DGPSDT=Y
35TDAT S DIR(0)="D^"_DGSDAT_":"_DT_":EX",DIR("A")="End Date"
36 D ^DIR K DIR
37 Q:$D(DTOUT)!($D(DUOUT))
38 S DGEDAT=+Y_.9999,Y=+Y D DD^%DT S DGPEDT=Y
39 F X="DGMST(","DGSDAT","DGPSDT","DGEDAT","DGPEDT" S ZTSAVE(X)=""
40 W !!,"This may take long to print, queue the report to free-up your terminal!",!
41 D EN^XUTMDEVQ("RPT^DGMSTR1","MST Summary Report",.ZTSAVE)
42 D HOME^%ZIS
43 Q
44RPT ;LOOP THROUGH PATIENT FILE TO CALCULATE UNKNOWN STATUSES
45 N DFN,DGMSTST,DGMIFN,SEX
46 S DFN=0 F S DFN=$O(^DPT(DFN)) Q:DFN'>0 D
47 .Q:$$EXCLUDE(DFN)
48 .S SEX=$P($G(^DPT(DFN,0)),"^",2) Q:SEX'="M"&(SEX'="F")
49 .I '$D(^DGMS(29.11,"C",DFN)) S DGMST(SEX,"U")=DGMST(SEX,"U")+1,DGMST(SEX)=DGMST(SEX)+1
50 ;
51 ;LOOP THROUGH MST HISTORY FILE TO TABULATE STATUS COUNTS
52 ;
53 S DFN=0 F S DFN=$O(^DGMS(29.11,"C",DFN)) Q:DFN'>0 D
54 .S Y=$$GETSTAT^DGMSTAPI(DFN,DGEDAT)
55 .Q:+Y=0
56 .Q:$P(Y,"^",3)<DGSDAT
57 .S DGMSTST=$P(Y,"^",2) Q:DGMSTST=""
58 .S DGMIFN=$P(Y,"^")
59 .S SEX=$P($G(^DPT(DFN,0)),"^",2)
60 .Q:SEX'="M"&(SEX'="F")
61 .S DGMST(SEX,DGMSTST)=DGMST(SEX,DGMSTST)+1
62 .S DGMST(SEX)=DGMST(SEX)+1
63 ;COMPUTE REMAINING TOTALS
64 S DGMST("T")=DGMST("M")+DGMST("F") ;ADD TOTAL MALES AND TOTAL FEMALES FOR GRAND TOTAL COUNT
65 F S="Y","N","D","U" D
66 .S DGMST(S)=DGMST("M",S)+DGMST("F",S) ;ADD TOTAL MALE AND FEMALE FOR EACH MST STATUS FOR TOTAL COUNT FOR EACH STATUS
67 .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
68 .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
69 .S DGMST("%",S)=0 I DGMST(S)>0 S DGMST("%",S)=DGMST(S)/DGMST("T")*100 ;CALCULATE TOTAL PERCENT FOR EACH STATUS
70 ;PRINT REPORT
71 ;
72 I $E(IOST,1,2)="C-" W @IOF
73 W !,?20,"MST Summary Report"
74 W !,?20,"Date Range: ",DGPSDT," - ",DGPEDT
75 S Y=DT D DD^%DT S DGPCDT=Y
76 W !,?20,"Date report Printed: ",DGPCDT,!!
77 W !,"Total Male with a MST Status",?78-$L(DGMST("M")),DGMST("M")
78 W !,"Total Female with a MST Status",?78-$L(DGMST("F")),DGMST("F")
79 W !,"Total Patients with a MST Status",?78-$L(DGMST("T")),DGMST("T")
80 W !!,"MST STATUS",?47,"Y",?57,"N",?67,"D",?77,"U"
81 W !!,"Total Male"
82 W ?48-$L(DGMST("M","Y")),DGMST("M","Y")
83 W ?58-$L(DGMST("M","N")),DGMST("M","N")
84 W ?68-$L(DGMST("M","D")),DGMST("M","D")
85 W ?78-$L(DGMST("M","U")),DGMST("M","U")
86 W !,"Total Female"
87 W ?48-$L(DGMST("F","Y")),DGMST("F","Y")
88 W ?58-$L(DGMST("F","N")),DGMST("F","N")
89 W ?68-$L(DGMST("F","D")),DGMST("F","D")
90 W ?78-$L(DGMST("F","U")),DGMST("F","U")
91 W !!,"Total Patients with MST Status"
92 W ?48-$L(DGMST("Y")),DGMST("Y")
93 W ?58-$L(DGMST("N")),DGMST("N")
94 W ?68-$L(DGMST("D")),DGMST("D")
95 W ?78-$L(DGMST("U")),DGMST("U")
96 W !!,"Percent of Male"
97 W ?48-$L($J(DGMST("%M","Y"),3,1)),$J(DGMST("%M","Y"),3,1)
98 W ?58-$L($J(DGMST("%M","N"),3,1)),$J(DGMST("%M","N"),3,1)
99 W ?68-$L($J(DGMST("%M","D"),3,1)),$J(DGMST("%M","D"),3,1)
100 W ?78-$L($J(DGMST("%M","U"),3,1)),$J(DGMST("%M","U"),3,1)
101 W !,"Percent of Female"
102 W ?48-$L($J(DGMST("%F","Y"),3,1)),$J(DGMST("%F","Y"),3,1)
103 W ?58-$L($J(DGMST("%F","N"),3,1)),$J(DGMST("%F","N"),3,1)
104 W ?68-$L($J(DGMST("%F","D"),3,1)),$J(DGMST("%F","D"),3,1)
105 W ?78-$L($J(DGMST("%F","U"),3,1)),$J(DGMST("%F","U"),3,1)
106 W !!,"Percent of all patients"
107 W ?48-$L($J(DGMST("%","Y"),3,1)),$J(DGMST("%","Y"),3,1)
108 W ?58-$L($J(DGMST("%","N"),3,1)),$J(DGMST("%","N"),3,1)
109 W ?68-$L($J(DGMST("%","D"),3,1)),$J(DGMST("%","D"),3,1)
110 W ?78-$L($J(DGMST("%","U"),3,1)),$J(DGMST("%","U"),3,1)
111 I $E(IOST,1,2)="C-" W ! S DIR(0)="E" D ^DIR K DIR Q:$D(DTOUT)!($D(DUOUT)) W @IOF
112 I $E(IOST,1,2)'="C-" W @IOF
113 W !!
114 W !,"----- LEGEND -----"
115 W !,"Y means Yes, Reports MST"
116 W !,"N means No, Does not Report MST"
117 W !,"D means Declined to Answer"
118 W !,"U means Unknown"
119 W !
120 K X,Y,S,DGPCDT,DGSTAT
121 Q
122 ;
123EXCLUDE(DFN) ;DETERMINE IF PATIENT SHOULD BE EXCLUDED FROM MST TRACKING
124 ;
125 I $G(^DPT(DFN,"VET"))="Y",'+$G(^(.35))>0!(+$G(^(.35))>0&(+$G(^(.35))'<2921001)) Q 0
126 Q 1
Note: See TracBrowser for help on using the repository browser.