Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ACHSDNS1

ACHSDNS1.m

Go to the documentation of this file.
ACHSDNS1 ; IHS/ITSC/PMF - DENIAL STATISTICS REPORT (2/2) ;     [ 10/31/2003  11:46 AM ]
 ;;3.1;CONTRACT HEALTH MGMT SYSTEM;**6**;JUNE 11, 2001
 ;ACHS*3.1*6 4.24.04 IHS/SET/FCJ MULTIPLE CHANGES TO PRINT 3 NEW REPORT
 ;                   REPORTS BY DOS, COMMUNITY AND PAYOR
 ;S $P(^TMP($J,"ACHSDNS",0),U,1,2)="^ACHSDNS1"
 D BRPT^ACHSFU
 K ^TMP($J,"ACHSDNS",0,"ACHSQIO")
 S ACHSRES="",ACHSPART=1,(ACHS(3),ACHS(4),ACHS(5))=0
 S Y=ACHSBDT X ^DD("DD") S ACHS("BDT")=Y,Y=ACHSEDT X ^DD("DD")
 S ACHS("EDT")=Y,ACHST1=$$C^XBFUNC("For the period "_ACHS("BDT")_" through "_ACHS("EDT"),80)
 D:ACHSRPT<3 HDR^ACHSDNS G:'$D(^DD(9002071.01,110,0)) END
 F I=1:1 Q:$P($P(^DD(9002071.01,110,0),U,3),";",I)=""  S ACHS=$P($P(^(0),U,3),";",I),ACHS($P(ACHS,":"))=$P(ACHS,":",2)
 S ACHSSUB=$S(ACHSRPT<3:"A1",ACHSRPT=3:"A3",ACHSRPT=4:"A4")
A ; Main loop.
 I ACHSRPT>2 S ACHSBM=ACHSBM+5 D @ACHSSUB G K
 S ACHSRES=$O(^TMP($J,"ACHSDNS",ACHSRES))
 I ACHSRES'="0" G TOTALS:+ACHSRES=0,A:'$D(^ACHSDENS(ACHSRES,0))
 S ACHSTYPE="",ACHSTOT1=+$P(^TMP($J,"ACHSDNS",ACHSRES,"TOTAL"),U),ACHSTOT2=+$P(^("TOTAL"),U,2)
 I ACHSRES'="0" W $P(^ACHSDENS(ACHSRES,0),U),! S ACHS(5)=ACHS(5)+1
 ;
A6 D @ACHSSUB
 W !,ACHS("-"),!
 I $Y>ACHSBM D RTRN^ACHS G K:$D(DUOUT)!$D(DTOUT) D HDR^ACHSDNS
 G A
 ;
TOTALS ;
 S ACHSPART=2
 I ACHS(5)<1 W !,"(No denials for standard reasons are on file for this time period.)" G NEED
 D RTRN^ACHS
 G K:$D(DUOUT)!$D(DTOUT)
 D HDR^ACHSDNS
 S ACHSTYPE="",ACHSRES="TOTAL" W !,"TOTALS.........",!! S ACHSTOT1=$P(^TMP($J,"ACHSDNS","TOTAL","TOTAL"),U),ACHSTOT2=$P(^("TOTAL"),U,2)
 D @ACHSSUB
 S ACHS(1)=$P(^TMP($J,"ACHSDNS","TOTAL","TOTAL"),U),ACHS(2)=$P(^("TOTAL"),U,2),X=ACHS(2),X2="2$" D COMMA^%DTC W !,ACHS("="),!,"GRAND TOTALS:",?42,$J(ACHS(1),6),?59,X,!,ACHS("="),!
 ;
NEED ;
 S ACHSPART=3
 D RTRN^ACHS
 G K:$D(DUOUT)!$D(DTOUT)
 D HDR^ACHSDNS S ACHSTYPE="",ACHSRES="SURG" W !,"UNMET NEED:  SURGICAL"
 I '$D(^TMP($J,"ACHSDNS",ACHSRES)) W "  (NONE)" G N1
 W !! S ACHSTOT1=$P(^TMP($J,"ACHSDNS","SURG","TOTAL"),U),ACHSTOT2=$P(^("TOTAL"),U,2),ACHS(3)=ACHSTOT1,ACHS(4)=ACHSTOT2
 D @ACHSSUB
 ;
N1 ;
 S ACHSRES="NONSURG",ACHSTYPE="" W !,ACHS("-"),!!,"UNMET NEED:  NON-SURGICAL"
 I '$D(^TMP($J,"ACHSDNS",ACHSRES)) W "  (NONE)" G NEEDTOT
 W !! S ACHSTOT1=$P(^TMP($J,"ACHSDNS","NONSURG","TOTAL"),U),ACHSTOT2=$P(^("TOTAL"),U,2),ACHS(3)=ACHS(3)+ACHSTOT1,ACHS(4)=ACHS(4)+ACHSTOT2
 D @ACHSSUB
 ;
NEEDTOT ;
 W !,ACHS("="),!
 I ACHS(3) S X=ACHS(4),X2="2$" D COMMA^%DTC W "GRAND TOTALS:",?42,$J(ACHS(3),6),?59,X,!,ACHS("="),!
 ;
END ; Kill vars, do ERPT, quit. 
 D RTRN^ACHS W @IOF
K ;
 K ACHSQUIT,ACHSCOM,ACHSINS,ACHSST,ACHSSUB,ACHSRPT
 K A,ACHSISDT,ACHSPART,ACHSRES,ACHSTOT1,ACHSTOT2,ACHSTYPE,DA,ZTSK
 D ERPT^ACHS
 Q
 ;
A1 ;PRINT DATE OF SERVICE OR DATE OF ISSUE REPORT
 ;
 S ACHSTYPE=$O(^TMP($J,"ACHSDNS",ACHSRES,ACHSTYPE)) Q:ACHSTYPE=""!(ACHSTYPE="TOTAL")  S ACHS(1)=+$P(^(ACHSTYPE),U),ACHS(2)=+$P(^(ACHSTYPE),U,2)
 S ACHS(ACHSTYPE)=$G(ACHS(ACHSTYPE)) I ACHS(ACHSTYPE)="" S ACHS(ACHSTYPE)="UNKNOWN TYPE"
 W ?41-$L(ACHS(ACHSTYPE)),ACHS(ACHSTYPE),":",?42,$J(ACHS(1),6),$J(ACHS(1)/$S(ACHSTOT1:ACHSTOT1,1:1)*100,6,1),"%"
 S ACHSTOT2=$G(ACHSTOT2)
 S X=ACHS(2),X2=2 D COMMA^%DTC W ?59,X,$J(ACHS(2)/$S(ACHSTOT2:ACHSTOT2,1:1)*100,6,1),"%",!
 G A1
A3 ;PRINT COMMUNITY REPORT     
 S ACHSCOM="",ACHSQUIT=0
 F  S ACHSCOM=$O(^TMP($J,"ACHSDNS","X",ACHSCOM)) Q:ACHSCOM=""  D  Q:ACHSQUIT=1
 .Q:(ACHSCOM="TOTAL")!(ACHSCOM="TOTALD")
 .S ACHSST=""
 .F  S ACHSST=$O(^TMP($J,"ACHSDNS","X",ACHSCOM,ACHSST)) Q:ACHSST'?1N.N  D  Q:ACHSQUIT=1
 ..D HDR^ACHSDNS
 ..S ACHSRES=""
 ..F  S ACHSRES=$O(^TMP($J,"ACHSDNS","X",ACHSCOM,ACHSST,ACHSRES)) Q:ACHSRES'?1N.N  D  Q:ACHSQUIT=1
 ...S ACHSTYPE="" F  S ACHSTYPE=$O(^TMP($J,"ACHSDNS","X",ACHSCOM,ACHSST,ACHSRES,ACHSTYPE)) Q:ACHSTYPE=""  D
 ....S ACHS(ACHSTYPE)=$G(ACHS(ACHSTYPE)) I ACHS(ACHSTYPE)="" S ACHS(ACHSTYPE)="UNKNOWN TYPE"
 ....S ACHS(1)=+$P(^TMP($J,"ACHSDNS",ACHSRES,ACHSCOM,ACHSST,ACHSTYPE),U),ACHS(2)=+$P(^(ACHSTYPE),U,2)
 ....D PRT
 ..Q:ACHSQUIT=1
 ..S ACHSTYPE=""
 ..F  S ACHSTYPE=$O(^TMP($J,"ACHSDNS","TOTAL",ACHSCOM,ACHSST,ACHSTYPE)) Q:ACHSTYPE=""  D
 ...S ACHS(1)=$P(^TMP($J,"ACHSDNS","TOTAL",ACHSCOM,ACHSST,ACHSTYPE),U),ACHS(2)=$P(^(ACHSTYPE),U,2)
 ...S ACHS(ACHSTYPE)=$G(ACHS(ACHSTYPE)) I ACHS(ACHSTYPE)="" S ACHS(ACHSTYPE)="UNKNOWN TYPE"
 ...D PRTOT
 ..D GRNDTOT
 Q
A4 ;PRINT OTHER RESOURCE REPORT....
 S ACHSINS="",ACHSQUIT=0
 F  S ACHSINS=$O(^TMP($J,"ACHSDNS","X",ACHSINS)) Q:ACHSINS="TOTAL"  D  Q:ACHSQUIT=1
 .D HDR^ACHSDNS
 .S ACHSRES=""
 .F  S ACHSRES=$O(^TMP($J,"ACHSDNS","X",ACHSINS,ACHSRES)) Q:ACHSRES'?1N.N  D  Q:ACHSQUIT=1
 ..S ACHSTYPE=""
 ..F  S ACHSTYPE=$O(^TMP($J,"ACHSDNS","X",ACHSINS,ACHSRES,ACHSTYPE)) Q:ACHSTYPE=""  D
 ...S ACHS(ACHSTYPE)=$G(ACHS(ACHSTYPE)) I ACHS(ACHSTYPE)="" S ACHS(ACHSTYPE)="UNKNOWN TYPE"
 ...S ACHS(1)=+$P(^TMP($J,"ACHSDNS",ACHSRES,ACHSINS,ACHSTYPE),U),ACHS(2)=+$P(^(ACHSTYPE),U,2)
 ...D PRT
 .;PRINT TOTALS
 .S ACHSTYPE=0
 .F  S ACHSTYPE=$O(^TMP($J,"ACHSDNS","TOTAL",ACHSINS,ACHSTYPE)) Q:ACHSTYPE=""  D  Q:ACHSQUIT=1
 ..S ACHS(1)=$P(^TMP($J,"ACHSDNS","TOTAL",ACHSINS,ACHSTYPE),U),ACHS(2)=$P(^(ACHSTYPE),U,2)
 ..S ACHS(ACHSTYPE)=$G(ACHS(ACHSTYPE)) I ACHS(ACHSTYPE)="" S ACHS(ACHSTYPE)="UNKNOWN TYPE"
 ..D PRTOT
 .Q:ACHSQUIT=1
 .D GRNDTOT
 Q
PRTOT ;PRINT TOTALS FOR COMMUNITY AND PAYOR REPORT
 W !,"TOTAL "
 S ACHSTOT1=$P(^TMP($J,"ACHSDNS","TOTAL","TOTAL"),U),ACHSTOT2=$P(^("TOTAL"),U,2)
 S:ACHSRPT=4 ACHSTOT1=$P(^TMP($J,"ACHSDNS","X","TOTALD"),U)
 ;W ?41-$L(ACHS(ACHSTYPE)),ACHS(ACHSTYPE),$J(ACHS(1),6),$J(ACHS(1)/$S(ACHSTOT1:ACHSTOT1,1:1)*100,6,1),"%"
 W ?41-$L(ACHS(ACHSTYPE)),ACHS(ACHSTYPE),":",?42,$J(ACHS(1),6),$J(ACHS(1)/$S(ACHSTOT1:ACHSTOT1,1:1)*100,6,1),"%"
 S X=ACHS(2),X2="2$" D COMMA^%DTC
 W ?59,X,$J(ACHS(2)/$S(ACHSTOT2:ACHSTOT2,1:1)*100,6,1),"%",!
 Q
GRNDTOT ;
 S X=ACHSTOT2,X2="2$" D COMMA^%DTC
 W ACHS("="),!,"GRAND TOTALS:"
 W ?42,$J(ACHSTOT1,6)
 W ?59,X,!,ACHS("="),!
 D RTRN^ACHS Q:$D(DUOUT)!$D(DTOUT)
 Q
PRT ;PRINT TOTALS
 S ACHSTOT1=+$P(^TMP($J,"ACHSDNS",ACHSRES,"TOTAL"),U),ACHSTOT2=+$P(^("TOTAL"),U,2)
 W !,$P(^ACHSDENS(ACHSRES,0),U),!
 W ?41-$L(ACHS(ACHSTYPE)),ACHS(ACHSTYPE),":",?42,$J(ACHS(1),6),$J(ACHS(1)/$S(ACHSTOT1:ACHSTOT1,1:1)*100,6,1),"%"
 S ACHSTOT2=$G(ACHSTOT2)
 S X=ACHS(2),X2=2 D COMMA^%DTC W ?59,X,$J(ACHS(2)/$S(ACHSTOT2:ACHSTOT2,1:1)*100,6,1),"%",!
 W !,ACHS("-"),!
 I $Y>ACHSBM D RTRN^ACHS Q:$D(DUOUT)!$D(DTOUT)  D HDR^ACHSDNS
 Q