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

ABMKIDS.m

Go to the documentation of this file.
ABMKIDS ; IHS/SD/SDR - Kidscare Report ;    
 ;;2.6;IHS Third Party Billing;**1**;NOV 12, 2009
 ;IHS/SD/SDR - abm*2.6*1 - HEAT5296 - NEW ROUTINE to report KIDSCARE
 ;
EN ;
 K ^TMP("ABM-KIDS",$J)
 K ABMTOT
 K DIR,DIC,DIE,DA,X,Y
 S DIR(0)="DAO"
 S DIR("A")="Enter eligibility date: "
 D ^DIR K DIR
 Q:X=""
 S ABMDT=Y
 ;
 K DIR,DIC,DIE,DA,X,Y
 S DIR(0)="YAO"
 S DIR("A")="Include detail? "
 S DIR("B")="N"
 D ^DIR K DIR
 Q:X=""
 S ABMDET=Y
 ;
 K ABM,ABMY
 S ABM("HD",0)="SCHIP ELIGIBILITY COUNTS BY AGE for "_$P($G(^AUTTLOC(DUZ(2),0)),U,2)
 S Y=ABMDT
 D DD^%DT
 S ABM("HD",1)="Eligible on "_Y
 S ABM("HD",2)="Report generated by "_$P($G(^VA(200,DUZ,0)),U)
 S ABM("PG")=1
 S ABMQ("RC")="COMPUTE^ABMKIDS",ABMQ("RX")="POUT^ABMDRUTL",ABMQ("NS")="ABM"
 S ABMQ("RP")="WRITE^ABMKIDS"
 D ^ABMDRDBQ
 ;
COMPUTE ;
 ;medicaid
 S ABMTYP="MCD"
 S ABMI=0
 F  S ABMI=$O(^AUPNMCD(ABMI)) Q:'ABMI  D
 .Q:($P($G(^AUPNMCD(ABMI,0)),U,10)="")
 .Q:($P($G(^AUTNINS($P($G(^AUPNMCD(ABMI,0)),U,10),2)),U)'="K")  ;Kidscare only
 .S ABMIM=0
 .F  S ABMIM=$O(^AUPNMCD(ABMI,11,ABMIM)) Q:'ABMIM  D
 ..Q:ABMIM>ABMDT  ;start date after search date
 ..;end date and it is before search date
 ..I $P($G(^AUPNMCD(ABMI,11,ABMIM,0)),U,2)'="",($P($G(^AUPNMCD(ABMI,11,ABMIM,0)),U,2)<ABMDT) Q
 ..S ABMAGE=$$GET1^DIQ(9000001,$P($G(^AUPNMCD(ABMI,0)),U),1102.99,"")
 ..D AGE
 ..D:ABMDET DETAIL
 ;private
 S ABMTYP="PI"
 S ABMI=0
 F  S ABMI=$O(^AUPNPRVT(ABMI)) Q:'ABMI  D
 .S ABMMIEN=0
 .F  S ABMMIEN=$O(^AUPNPRVT(ABMI,11,ABMMIEN)) Q:'ABMMIEN  D
 ..S ABMINS=$P($G(^AUPNPRVT(ABMI,11,ABMMIEN,0)),U)
 ..Q:($P($G(^AUTNINS(ABMINS,2)),U)'="K")
 ..Q:$P($G(^AUPNPRVT(ABMI,11,ABMMIEN,0)),U,6)>ABMDT
 ..I $P($G(^AUPNPRVT(ABMI,11,ABMMIEN,0)),U,7)'="",($P($G(^AUPNPRVT(ABMI,11,ABMMIEN,0)),U,7)<ABMDT) Q
 ..S ABMAGE=$$GET1^DIQ(9000001,ABMI,1102.99,"")
 ..D AGE
 ..D:ABMDET DETAIL
 Q
AGE ;
 I ABMTYP="MCD" D
 .S ABMPT=$P($G(^AUPNMCD(ABMI,0)),U)
 I ABMTYP="PI" S ABMPT=ABMI
 Q:$D(^TMP("ABM-KIDS",$J,ABMAGE,ABMTYP,ABMPT))  ;counted pt once; don't count again
 S ABMTOT=+$G(ABMTOT)+1
 I ABMAGE<5 S ABM("0-4")=+$G(ABM("0-4"))+1,ABMFLG="0-4" Q
 I ABMAGE>4,(ABMAGE<10) S ABM("5-9")=+$G(ABM("5-9"))+1,ABMFLG="5-9" Q
 I ABMAGE>9,(ABMAGE<15) S ABM("10-14")=+$G(ABM("10-14"))+1,ABMFLG="10-14" Q
 I ABMAGE>14,(ABMAGE<19) S ABM("15-18")=+$G(ABM("15-18"))+1,ABMFLG="15-18" Q
 I ABMAGE>18,(ABMAGE<22) S ABM("19-21")=+$G(ABM("19-21"))+1,ABMFLG="19-21" Q
 I ABMAGE>21 S ABM("OVER 21")=+$G(ABM("OVER 21"))+1,ABMFLG="OVER 21"
 Q
DETAIL ;
 S ^TMP("ABM-KIDS",$J,ABMAGE,ABMTYP,ABMPT)=ABMI_"^"_$S(ABMTYP="MCD":ABMIM,1:ABMMIEN)
 Q
WRITE ;
 D WHD^ABMDRHD
 W !,"RANGE",?10,"COUNT"
 W !,"0-4",?10,$J(+$G(ABM("0-4")),"6R")
 W !,"5-9",?10,$J(+$G(ABM("5-9")),"6R")
 W !,"10-14",?10,$J(+$G(ABM("10-14")),"6R")
 W !,"15-18",?10,$J(+$G(ABM("15-18")),"6R")
 W !,"19-21",?10,$J(+$G(ABM("19-21")),"6R")
 W !,"OVER 21",?10,$J(+$G(ABM("OVER 21")),"6R")
 W !,"=====",?10,"======"
 W !,"TOTAL",?9,$J(+$G(ABMTOT),"7R")
 ;
 I $D(^TMP("ABM-KIDS",$J)) D
 .D HD
 .S ABMAGE=""
 .F  S ABMAGE=$O(^TMP("ABM-KIDS",$J,ABMAGE)) Q:ABMAGE=""  D
 ..S ABMTYP=""
 ..F ABMTYP=$O(^TMP("ABM-KIDS",$J,ABMAGE,ABMTYP)) Q:ABMTYP=""  D
 ...S ABMPT=0
 ...F  S ABMPT=$O(^TMP("ABM-KIDS",$J,ABMAGE,ABMTYP,ABMPT)) Q:'ABMPT  D
 ....S ABMI=$P($G(^TMP("ABM-KIDS",$J,ABMAGE,ABMTYP,ABMPT)),U)
 ....S ABMMI=$P($G(^TMP("ABM-KIDS",$J,ABMAGE,ABMTYP,ABMPT)),U,2)
 ....I ABMTYP="MCD" D
 .....S ABMPLAN=$P($G(^AUTNINS($P($G(^AUPNMCD(ABMI,0)),U,10),0)),U)
 .....S ABMEFFDT=$P($G(^AUPNMCD(ABMI,11,ABMMI,0)),U)
 .....S ABMENDDT=$P($G(^AUPNMCD(ABMI,11,ABMMI,0)),U,2)
 .....S ABMCTYP=$P($G(^AUPNMCD(ABMI,11,ABMMI,0)),U,3)
 ....;
 ....I ABMTYP="PI" D
 .....S ABMPLAN=$P($G(^AUTNINS($P($G(^AUPNPRVT(ABMPT,11,ABMMI,0)),U),0)),U)
 .....S ABMEFFDT=$P($G(^AUPNPRVT(ABMPT,11,ABMMI,0)),U,6)
 .....S ABMCTYP="",ABMPH=""
 .....S ABMPH=$P($G(^AUPNPRVT(ABMPT,11,ABMMI,0)),U,8)
 .....S:ABMPH'=""&($P($G(^AUPN3PPH(ABMPH,0)),U,5)'="") ABMCTYP=$P($G(^AUTTPIC($P($G(^AUPN3PPH(ABMPH,0)),U,5),0)),U,3)
 .....S ABMENDDT=$P($G(^AUPNPRVT(ABMPT,11,ABMMI,0)),U,7)
 ....;
 ....W !,ABMAGE
 ....W ?4,$P($G(^AUPNPAT(ABMPT,41,DUZ(2),0)),U,2)
 ....W ?11,$E($P($G(^DPT(ABMPT,0)),U),1,29)
 ....W ?42,$E(ABMTYP,1)
 ....W ?44,$E(ABMPLAN,1,14)
 ....W ?60,$$SDTO^ABMDUTL(ABMEFFDT)
 ....W ?69,ABMCTYP
 ....W ?74,$$SDTO^ABMDUTL(ABMENDDT)
 ....I $Y>(IOSL-5) D WHD^ABMDRHD Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)  D HD W " (cont)"
 Q
HD ;
 S ABM("PG")=+ABM("PG")+1
 W !!,"AGE",?4,"PT HRN",?11,"PT NAME",?42,"I",?44,"PLAN NAME",?60,"EFF DT",?69,"CTYP",?74,"END DT"
 Q