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

ACKQDWLP.m

Go to the documentation of this file.
  1. ACKQDWLP ;AUG/JLTP BIR/PTD HCIOFO/BH - Print A&SP Capitation Report ;19 Nov 2013 9:53 AM
  1. ;;3.0;QUASAR;**1,22,21**;Feb 11, 2000;Build 40
  1. ;Per VHA Directive 2004-038, this routine SHOULD NOT be modified.
  1. ;
  1. ; Developed within V.3, works at Div level rather than site level -
  1. ; - pre v.3
  1. ;
  1. ;
  1. ; Reference/ICR
  1. ; $$CODEC^ICDEX - 5747
  1. ;
  1. ;
  1. K ^TMP("ACKQDWLP",$J)
  1. OPTN ; Introduce option
  1. W @IOF,!,"This option produces a four-part Capitation Report.",!,"It includes Demographic, Diagnostic and Procedure data.",!
  1. ;
  1. DIV ; select Div (user may select one/many/ALL)
  1. S ACKDIV=$$DIV^ACKQUTL2(3,.ACKDIV,"IA") G:'ACKDIV EXIT
  1. D GETDT^ACKQWL G:$D(DIRUT) EXIT D INIT^ACKQWL
  1. ;
  1. DEV W !!,"The right margin for this report is 80.",!,"You can queue it to run at a later time.",!
  1. K %ZIS,IOP S %ZIS="QM",%ZIS("B")="" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED." G EXIT
  1. I $D(IO("Q")) K IO("Q") S ZTRTN="DQ^ACKQDWLP",ZTDESC="QUASAR - Print A&SP Capitation Report",ZTSAVE("ACK*")="" D ^%ZTLOAD D HOME^%ZIS K ZTSK G EXIT
  1. DQ ; Entry point when queued.
  1. U IO
  1. D NOW^%DTC S ACKCDT=$$NUMDT^ACKQUTL(%)_" at "_$$FTIME^ACKQUTL(%),ACKPG=0 K ^TMP("ACKQWLD",$J)
  1. D COMPILE,PRINT
  1. ;
  1. EXIT ; ALWAYS EXIT HERE
  1. K %I,ACKBFY,ACKCDT,ACKDA,ACKEM,ACKM,ACKPG,AS,CDR,CPT,DIR,DIRUT,DTOUT
  1. K ACKDIV,DUOUT,I,ICD,LN,T,X,XAS,Y,ZIP,^TMP("ACKQDWLP",$J)
  1. W:$E(IOST)="C" @IOF D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
  1. Q
  1. ;
  1. COMPILE ; Comp properly sorted data in ^TMP
  1. N ACK1,ACKVDVN,ACK6,ACKREC,ACKAUD,ACKSPE
  1. ;
  1. S ACK1=""
  1. F S ACK1=$O(ACKDIV(ACK1)) Q:ACK1="" D
  1. . S ACKVDVN=$P(ACKDIV(ACK1),U,1)
  1. . D ZIPSTAT,ICDSTAT,CPTSTAT,ECSTAT^ACKQDWLU
  1. Q
  1. ;
  1. ZIPSTAT ; ZIP stats
  1. N ACKCODE
  1. S ACK6=0
  1. F S ACK6=$O(^ACK(509850.7,ACKDA,5,ACKVDVN,3,ACK6)) Q:ACK6=""!(ACK6'?.N) D
  1. . S ACKREC=^ACK(509850.7,ACKDA,5,ACKVDVN,3,ACK6,0)
  1. . S ACKAUD=$P(ACKREC,U,2,5),ACKSPE=$P(ACKREC,U,6,9)
  1. . S ACKCODE=$P(ACKREC,U,1)
  1. . I $TR(ACKAUD,"^","")'="" D
  1. . . S ^TMP("ACKQDWLP",$J,"R",ACKVDVN,3,"A",ACKCODE)=ACKAUD
  1. . . S ^TMP("ACKQDWLP",$J,"S",3,"A",ACKCODE,ACKVDVN)=ACKAUD
  1. . I $TR(ACKSPE,"^","")'="" D
  1. . . S ^TMP("ACKQDWLP",$J,"R",ACKVDVN,3,"S",ACKCODE)=ACKSPE
  1. . . S ^TMP("ACKQDWLP",$J,"S",3,"S",ACKCODE,ACKVDVN)=ACKSPE
  1. Q
  1. ;
  1. ICDSTAT ; ICD stats
  1. N ACKCODE
  1. S ACK6=0
  1. F S ACK6=$O(^ACK(509850.7,ACKDA,5,ACKVDVN,1,ACK6)) Q:ACK6=""!(ACK6'?.N) D
  1. . S ACKREC=^ACK(509850.7,ACKDA,5,ACKVDVN,1,ACK6,0)
  1. . S ACKAUD=$P(ACKREC,U,2,4),ACKSPE=$P(ACKREC,U,5,7)
  1. . S ACKCODE=$P(ACKREC,U,1)
  1. . ;ACKQ*3.0*22 updated api
  1. . S ACKCODE=$$CODEC^ICDEX(80,ACKCODE)
  1. . S ACKCODE=($S(ACKCODE?.NP:+ACKCODE,1:ACKCODE))
  1. . I $TR(ACKAUD,"^","")'="" D
  1. . . S ^TMP("ACKQDWLP",$J,"R",ACKVDVN,1,"A",ACKCODE)=ACKAUD
  1. . . S ^TMP("ACKQDWLP",$J,"S",1,"A",ACKCODE,ACKVDVN)=ACKAUD
  1. . I $TR(ACKSPE,"^","")'="" D
  1. . . S ^TMP("ACKQDWLP",$J,"R",ACKVDVN,1,"S",ACKCODE)=ACKSPE
  1. . . S ^TMP("ACKQDWLP",$J,"S",1,"S",ACKCODE,ACKVDVN)=ACKSPE
  1. Q
  1. ;
  1. CPTSTAT ; CPT Stats
  1. N ACKCODE
  1. S ACK6=0
  1. F S ACK6=$O(^ACK(509850.7,ACKDA,5,ACKVDVN,2,ACK6)) Q:ACK6=""!(ACK6'?.N) D
  1. . S ACKREC=^ACK(509850.7,ACKDA,5,ACKVDVN,2,ACK6,0)
  1. . S ACKAUD=$P(ACKREC,U,2,4),ACKSPE=$P(ACKREC,U,5,7)
  1. . S ACKCODE=$P(ACKREC,U,1)
  1. . I $TR(ACKAUD,"^","")'="" D
  1. . . S ^TMP("ACKQDWLP",$J,"R",ACKVDVN,2,"A",ACKCODE)=ACKAUD
  1. . . S ^TMP("ACKQDWLP",$J,"S",2,"A",ACKCODE,ACKVDVN)=ACKAUD
  1. . I $TR(ACKSPE,"^","")'="" D
  1. . . S ^TMP("ACKQDWLP",$J,"R",ACKVDVN,2,"S",ACKCODE)=ACKSPE
  1. . . S ^TMP("ACKQDWLP",$J,"S",2,"S",ACKCODE,ACKVDVN)=ACKSPE
  1. Q
  1. ;
  1. PRINT ; Display results
  1. N ACKDNME,ACKK1,ACKDIEN
  1. ;
  1. S ACKDNME=""
  1. N ACKK1,ACKDIEN,ACKPASS
  1. S ACKPASS=0,ACKK1=""
  1. F S ACKK1=$O(ACKDIV(ACKK1)) Q:ACKK1="" D
  1. . S ACKDIEN=$P(ACKDIV(ACKK1),U,1)
  1. . I $D(^TMP("ACKQDWLP",$J,"R",ACKDIEN)) S ACKPASS=1
  1. I 'ACKPASS D DHD,LINE W !!,"No Capitation data found for selected Divisions." D:$E(IOST)="C" PAUSE^ACKQUTL Q
  1. ;
  1. S ACKK1=""
  1. F S ACKK1=$O(ACKDIV(ACKK1)) Q:ACKK1=""!($D(DIRUT)) D
  1. . S ACKDIEN=$P(ACKDIV(ACKK1),U,1)
  1. . S ACKDNME=$P(ACKDIV(ACKK1),U,3)
  1. . ;
  1. . I '$O(^TMP("ACKQDWLP",$J,"R",ACKDIEN,0)) D Q
  1. .. D DHD,LINE
  1. .. W !!,"No data found for this Division."
  1. .. D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT)
  1. . ;
  1. . I $D(^TMP("ACKQDWLP",$J,"R",ACKDIEN,3)) D DHD,HD1,ZIP Q:$D(DIRUT)
  1. . I $D(^TMP("ACKQDWLP",$J,"R",ACKDIEN,1)) D DHD,HD2,ICD Q:$D(DIRUT)
  1. . I $D(^TMP("ACKQDWLP",$J,"R",ACKDIEN,2)) D DHD,HD3,CPT Q:$D(DIRUT)
  1. . I $D(^TMP("ACKQDWLP",$J,"R",ACKDIEN,5)) D DHD,HD4,EC Q:$D(DIRUT)
  1. . ;
  1. Q:$D(DIRUT)
  1. D SUMZIP^ACKQDWLR Q:$D(DIRUT)
  1. D SUMICD^ACKQDWLR Q:$D(DIRUT)
  1. D SUMCPT^ACKQDWLR Q:$D(DIRUT)
  1. D SUMEC^ACKQDWLR Q:$D(DIRUT)
  1. Q
  1. ;
  1. ZIP ; For all visits
  1. N ACKZCT,ACKZTT,ACKZUT,ACKZCPT
  1. S AS=""
  1. F S AS=$O(^TMP("ACKQDWLP",$J,"R",ACKDIEN,3,AS)) Q:AS=""!($D(DIRUT)) D
  1. .S ACKZCT=0,ACKZTT=0,ACKZUT=0,ACKZCPT=0
  1. .I $Y>(IOSL-5) D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT) D DHD,HD1
  1. .S XAS=$S(AS="A":"Audiology",1:"Speech Pathology")
  1. .W !," "_XAS,":"
  1. .S (ZIP,T)="" F S ZIP=$O(^TMP("ACKQDWLP",$J,"R",ACKDIEN,3,AS,ZIP)) Q:ZIP=""!($D(DIRUT)) D
  1. ..I $Y>(IOSL-5) D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT) D DHD,HD1 W !," "_XAS,":"
  1. ..S X=^TMP("ACKQDWLP",$J,"R",ACKDIEN,3,AS,ZIP)
  1. ..; Print Zip data
  1. ..W !," "_ZIP ; Write zero's instead of nulls
  1. ..W ?25,$S($P(X,U,1):$P(X,U,1),1:"0")
  1. ..W ?39,$S($P(X,U,2):$P(X,U,2),1:"0")
  1. ..W ?55,$S($P(X,U,3):$P(X,U,3),1:"0")
  1. ..W ?69,$S($P(X,U,4):$P(X,U,4),1:"0")
  1. ..;
  1. ..; Calculate Totals
  1. ..S ACKZCT=ACKZCT+$P(X,U,1),ACKZTT=ACKZTT+$P(X,U,2)
  1. ..S ACKZUT=ACKZUT+$P(X,U,3),ACKZCPT=ACKZCPT+$P(X,U,4)
  1. ..;
  1. .Q:$D(DIRUT)
  1. .S $P(LN,"-",80)="" W !,LN
  1. .W !," "_XAS," Total: ",?25,ACKZCT,?39,ACKZTT,?55,ACKZUT,?69,ACKZCPT,!
  1. Q:$D(DIRUT)
  1. D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT)
  1. Q
  1. ;
  1. ICD ; ICD stats
  1. N ACKICT,ACKITT,ACKIUT
  1. ; D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT) D DHD,HD2
  1. S AS=0 F S AS=$O(^TMP("ACKQDWLP",$J,"R",ACKDIEN,1,AS)) Q:AS=""!($D(DIRUT)) D
  1. .S ACKICT=0,ACKITT=0,ACKIUT=0
  1. .I $Y>(IOSL-5) D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT) D DHD,HD2
  1. .S XAS=$S(AS="A":"Audiology",1:"Speech Pathology")
  1. .W !," "_XAS,":"
  1. .S ICD="" F S ICD=$O(^TMP("ACKQDWLP",$J,"R",ACKDIEN,1,AS,ICD)) Q:ICD=""!($D(DIRUT)) D
  1. ..I $Y>(IOSL-5) D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT) D DHD,HD2
  1. ..S ACKSTR=^TMP("ACKQDWLP",$J,"R",ACKDIEN,1,AS,ICD)
  1. ..; Display data
  1. ..W !," "_ICD
  1. ..W ?25,$S($P(ACKSTR,U,1):$P(ACKSTR,U,1),1:"0")
  1. ..W ?39,$S($P(ACKSTR,U,2):$P(ACKSTR,U,2),1:"0")
  1. ..W ?55,$S($P(ACKSTR,U,3):$P(ACKSTR,U,3),1:"0")
  1. ..; Calculate Totals
  1. ..S ACKICT=ACKICT+$P(ACKSTR,U,1),ACKITT=ACKITT+$P(ACKSTR,U,2)
  1. ..S ACKIUT=ACKIUT+$P(ACKSTR,U,3)
  1. ..;
  1. .Q:$D(DIRUT)
  1. .S $P(LN,"-",80)="" W !,LN
  1. .W !," "_XAS," Total: ",?25,ACKICT,?39,ACKITT,?55,ACKIUT,!
  1. .Q:$D(DIRUT)
  1. Q:$D(DIRUT)
  1. D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT)
  1. Q
  1. ;
  1. CPT ; CPT stats
  1. N ACKCCT,ACKCTT,ACKCUT
  1. ;
  1. S AS=0 F S AS=$O(^TMP("ACKQDWLP",$J,"R",ACKDIEN,2,AS)) Q:AS=""!($D(DIRUT)) D
  1. .S ACKCCT=0,ACKCTT=0,ACKCUT=0
  1. .I $Y>(IOSL-5) D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT) D DHD,HD3
  1. .S XAS=$S(AS="A":"Audiology",1:"Speech Pathology")
  1. .W !," "_XAS,":"
  1. .S CPT="" F S CPT=$O(^TMP("ACKQDWLP",$J,"R",ACKDIEN,2,AS,CPT)) Q:CPT=""!($D(DIRUT)) D
  1. ..I $Y>(IOSL-5) D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT) D DHD,HD3
  1. ..S ACKSTR=^TMP("ACKQDWLP",$J,"R",ACKDIEN,2,AS,CPT)
  1. ..; Display data
  1. ..W !," "_$$GET1^DIQ(509850.4,CPT_",",.01)
  1. ..W ?25,$S($P(ACKSTR,U,1):$P(ACKSTR,U,1),1:"0")
  1. ..W ?39,$S($P(ACKSTR,U,2):$P(ACKSTR,U,2),1:"0")
  1. ..W ?55,$S($P(ACKSTR,U,3):$P(ACKSTR,U,3),1:"0")
  1. ..; Calculate Totals
  1. ..S ACKCCT=ACKCCT+$P(ACKSTR,U,1),ACKCTT=ACKCTT+$P(ACKSTR,U,2)
  1. ..S ACKCUT=ACKCUT+$P(ACKSTR,U,3)
  1. ..;
  1. .Q:$D(DIRUT)
  1. .S $P(LN,"-",80)="" W !,LN
  1. .W !," "_XAS," Total: ",?25,ACKCCT,?39,ACKCTT,?55,ACKCUT,!
  1. .Q:$D(DIRUT)
  1. Q:$D(DIRUT)
  1. D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT)
  1. Q
  1. ;
  1. EC ; EC stats
  1. N ACKCCT,ACKCTT,ACKCUT
  1. ;
  1. S AS=0 F S AS=$O(^TMP("ACKQDWLP",$J,"R",ACKDIEN,5,AS)) Q:AS=""!($D(DIRUT)) D
  1. .S ACKCCT=0,ACKCTT=0,ACKCUT=0
  1. .I $Y>(IOSL-5) D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT) D DHD,HD4
  1. .S XAS=$S(AS="A":"Audiology",1:"Speech Pathology")
  1. .W !," "_XAS,":"
  1. .S EC="" F S EC=$O(^TMP("ACKQDWLP",$J,"R",ACKDIEN,5,AS,EC)) Q:EC=""!($D(DIRUT)) D
  1. ..I $Y>(IOSL-5) D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT) D DHD,HD4
  1. ..S ACKSTR=^TMP("ACKQDWLP",$J,"R",ACKDIEN,5,AS,EC)
  1. ..; Display data
  1. ..W !," "_$$GET1^DIQ(725,EC_",",1,"I")
  1. ..W ?25,$S($P(ACKSTR,U,1):$P(ACKSTR,U,1),1:"0")
  1. ..W ?39,$S($P(ACKSTR,U,2):$P(ACKSTR,U,2),1:"0")
  1. ..W ?55,$S($P(ACKSTR,U,3):$P(ACKSTR,U,3),1:"0")
  1. ..; Calculate Totals
  1. ..S ACKCCT=ACKCCT+$P(ACKSTR,U,1),ACKCTT=ACKCTT+$P(ACKSTR,U,2)
  1. ..S ACKCUT=ACKCUT+$P(ACKSTR,U,3)
  1. ..;
  1. .Q:$D(DIRUT)
  1. .S $P(LN,"-",80)="" W !,LN
  1. .W !," "_XAS," Total: ",?25,ACKCCT,?39,ACKCTT,?55,ACKCUT,!
  1. .Q:$D(DIRUT)
  1. Q:$D(DIRUT)
  1. D:$E(IOST)="C" PAUSE^ACKQUTL Q:$D(DIRUT)
  1. Q
  1. ;
  1. DHD ;
  1. N X
  1. W:($E(IOST)="C")!(ACKPG>0) @IOF
  1. S ACKPG=ACKPG+1
  1. W "Printed: ",ACKCDT,?(IOM-8),"Page: ",ACKPG
  1. W ! D CNTR^ACKQUTL("Audiology & Speech Pathology")
  1. W ! D CNTR^ACKQUTL("Capitation Report")
  1. I ACKPASS W ! D CNTR^ACKQUTL("for DIVISION: "_ACKDNME)
  1. W ! D CNTR^ACKQUTL($$XDAT^ACKQUTL(ACKM)) W !
  1. Q
  1. ;
  1. HD1 ; Header for all visits
  1. N X
  1. W !,?23,"CLINIC",?36,"TELEPHONE",?53,"UNIQUE"
  1. W !," ZIP CODE",?23,"VISITS",?37,"VISITS",?52,"PATIENTS",?68,"C&P"
  1. D LINE Q
  1. ;
  1. HD2 ; Head for ICD stats
  1. N X W !,?23,"CLINIC",?36,"TELEPHONE"
  1. W !," ICD",?23,"VISITS",?37,"VISITS",?53,"UNIQUE" D LINE Q
  1. ;
  1. HD3 ; Head for CPT stats
  1. N X W !,?23,"CLINIC",?36,"TELEPHONE"
  1. W !," CPT",?23,"VISITS",?37,"VISITS",?53,"UNIQUE" D LINE Q
  1. ;
  1. HD4 ; Head for EC stats
  1. N X W !,?23,"CLINIC",?36,"TELEPHONE"
  1. W !," EC",?23,"VISITS",?37,"VISITS",?53,"UNIQUE" D LINE Q
  1. ;
  1. LINE S X="",$P(X,"-",IOM)="-" W !,X Q
  1. ;