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

APCL2AP.m

Go to the documentation of this file.
  1. APCL2AP ; IHS/CMI/LAB - print apc report 1A ;
  1. ;;2.0;IHS PCC SUITE;;MAY 14, 2009
  1. ;CMI/TUCSON/LAB - patch 3
  1. START ;
  1. S APCL132="__________________________________________________________________________________________________________________________________"
  1. S APCLMOL="OCT.,NOV.,DEC.,JAN.,FEB.,MAR.,APR.,MAY ,JUNE,JULY,AUG.,SEPT"
  1. ;beginning Y2K
  1. ;S Y=$E(APCLFYE,1,3)_"0000" D DD^%DT S APCLFYD=Y S Y=DT D DD^%DT S APCLDT=Y ;Y2000
  1. S APCLFYD=APCL("FY") S Y=DT D DD^%DT S APCLDT=Y ;Y2000
  1. ;end Y2K
  1. D START1
  1. Q:$D(APCLQUIT)
  1. D DONE
  1. Q
  1. START1 ;
  1. S APCLLOC=0 F S APCLLOC=$O(APCLLOCS(APCLLOC)) Q:APCLLOC'=+APCLLOC!($D(APCLQUIT)) D
  1. .S APCLLOCC=$P(^AUTTLOC(APCLLOC,0),U,10),APCLLOCP=$P(^DIC(4,APCLLOC,0),U)
  1. .S APCLAREA=$P(^AUTTLOC(APCLLOC,0),U,4) I APCLAREA="" S (APCLAREA,APCLAREC)="???" G SU
  1. .I '$D(^AUTTAREA(APCLAREA,0)) S (APCLAREA,APCLAREC)="???" G SU
  1. .S APCLAREC=$P(^AUTTAREA(APCLAREA,0),U,2),APCLAREA=$P(^AUTTAREA(APCLAREA,0),U)
  1. .D SU
  1. .Q
  1. Q
  1. SU ;
  1. S APCLSU=$P(^AUTTLOC(APCLLOC,0),U,5) I APCLSU="" S (APCLSU,APCLSUC)="???" G START2
  1. I '$D(^AUTTSU(APCLSU,0)) S (APCLSU,APCLSUC)="999" G START2
  1. S APCLSUC=$P(^AUTTSU(APCLSU,0),U,3),APCLSU=$P(^AUTTSU(APCLSU,0),U)
  1. START2 ;
  1. S (APCLPG,APCLDISC,APCLPRIT)=0,APCLPDC="" D HEAD
  1. K APCLQUIT
  1. I APCLGRAN(APCLLOC)=0 W !!,"NO VISITS FOR THIS FISCAL YEAR",! G DONE
  1. F S APCLPDC=$O(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"MODISC",APCLPDC)) Q:APCLPDC=""!($D(APCLQUIT)) D P
  1. G:$D(APCLQUIT) DONE
  1. I $Y>(IOSL-8) D HEAD G:$D(APCLQUIT) DONE
  1. W !!," T O T A L",?21,$J(APCLGRAN(APCLLOC),7),?30,"100.0"
  1. S APCLMON="",APCLTAB=36 F APCLJ=10,11,12,1,2,3,4,5,6,7,8,9 S APCLMON=$S($D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"MONTOTALL",APCLJ)):^(APCLJ),1:0) W ?APCLTAB,$J(APCLMON,6) S APCLTAB=APCLTAB+8
  1. W !!,"*TOTAL PRIMARY PVDR",?21,$J(APCLPRIT,7) S APCLP=(((APCLPRIT/APCLGRAN(APCLLOC))*100.00)+.05),APCLP=$P(APCLP,".")_"."_$E($P(APCLP,".",2))
  1. W ?30,$J(APCLP,5) S APCLMON="",APCLTAB=36 F APCLJ=10,11,12,1,2,3,4,5,6,7,8,9 S APCLMON=$S($D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"MONTOTPCP",APCLJ)):^(APCLJ),1:0) W ?APCLTAB,$J(APCLMON,6) S APCLTAB=APCLTAB+8
  1. I $D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"NO EXPORT")) D I 1
  1. .I $D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"IN XREF")) W !!!,^("IN XREF")," visits were not exported to the National Data Warehouse because they ",!,"were posted or modified after the last NDW export was generated.",!
  1. .W !,($S($D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"NO EXPORT")):^("NO EXPORT"),1:0)-$S($D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"IN XREF")):^("IN XREF"),1:0))
  1. .W " visits were not exported because of missing or invalid data. To see a list"
  1. .W !,"of these visits so that they may be resubmitted use the option ",!,"called 'List APC-1A Visits Not Exported.",!
  1. ;I $D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"DUPLICATE")) D I 1
  1. ;.W !,"There were ",^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"DUPLICATE")," instances of 2 or more visits"
  1. ;.W " by a patient to the same clinic, same provider in the same day. These ",^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"DUPLICATE")," will not be",!,"counted in the report produced at the Data Center, but are counted in the report above.",!
  1. ;I $D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"DUPLICATE"))!($D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"NO EXPORT"))) D I 1
  1. ;.W !,"This accounts for a total of ",($S($D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"NO EXPORT")):^("NO EXPORT"),1:0)+$S($D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"DUPLICATE")):^("DUPLICATE"),1:0))
  1. ;W " visits that will be counted in this report but not in the 1A report from the Data Center.",!
  1. W !
  1. Q
  1. DONE D DONE^APCLOSUT
  1. K ^XTMP("APCL2A",APCLJOB,APCLBT)
  1. Q
  1. P ;
  1. S APCLDISC="" F S APCLDISC=$O(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"MODISC",APCLPDC,APCLDISC)) Q:APCLDISC=""!($D(APCLQUIT)) D P1
  1. Q
  1. ;
  1. P1 ;
  1. I $Y>(IOSL-5) D HEAD Q:$D(APCLQUIT)
  1. S (APCLP,APCLT)=^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"DISCTOT",APCLPDC,APCLDISC),APCLP=(((APCLP/APCLGRAN(APCLLOC))*100.00)+.05),APCLP=$P(APCLP,".")_"."_$E($P(APCLP,".",2))
  1. I APCLDISC="??" S APCLDISN="NO PROVIDER CLASS" G W
  1. S APCLDISN=$P($G(^DIC(7,APCLDISC,9999999)),U)_" "_$E($P(^DIC(7,APCLDISC,0),U),1,17) K APCLPRIM D CHKPRIM I $D(APCLPRIM) S APCLDISN=$E(APCLDISN,1,19)_"*"
  1. W W !,APCLDISN,?22,$J(APCLT,6),?30,$J(APCLP,5)
  1. S APCLMON="",APCLTAB=36 F APCLJ=10,11,12,1,2,3,4,5,6,7,8,9 S APCLMON=$S($D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"MODISC",APCLPDC,APCLDISC,APCLJ)):^(APCLJ),1:0) W ?APCLTAB,$J(APCLMON,6) S APCLTAB=APCLTAB+8 D MONTOT
  1. Q
  1. ;
  1. MONTOT ;set up month totals for all visits and pcp visits
  1. S ^(APCLJ)=$S($D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"MONTOTALL",APCLJ)):^(APCLJ)+APCLMON,1:APCLMON)
  1. I $D(APCLPRIM) S ^(APCLJ)=$S($D(^XTMP("APCL2A",APCLJOB,APCLBT,APCLLOC,"MONTOTPCP",APCLJ)):^(APCLJ)+APCLMON,1:APCLMON)
  1. Q
  1. CHKPRIM ;
  1. ;I $D(^APCLCNTL(1,11,"B",$P(^DIC(7,APCLDISC,9999999),U))) S APCLPRIM=1,APCLPRIT=APCLPRIT+APCLT
  1. I $P($G(^DIC(7,APCLDISC,9999999)),U,3)="Y" S APCLPRIM=1,APCLPRIT=APCLPRIT+APCLT
  1. Q
  1. I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S APCLQUIT="" Q
  1. HEAD1 ;
  1. W:$D(IOF) @IOF S APCLPG=APCLPG+1
  1. W APCL132,!
  1. W !?5,"AREA: ",APCLAREC," ",APCLAREA,?50,"PCC-AMBULATORY PATIENT CARE REPORT 1A",?95,APCLDT,?110,"Page ",APCLPG
  1. W !?5,"S.U.: ",APCLSUC," ",APCLSU,?58,"FISCAL YEAR ",APCLFYD
  1. W !?5,"FAC.: ",APCLLOCC," ",APCLLOCP
  1. W !?24,"AMBULATORY CARE VISITS TO SERVICE LOCATION BY PRIMARY PROVIDER AND MONTH OF SERVICE",!
  1. W APCL132,!
  1. W "PRIMARY PROVIDER",?23,"YR-TO",?30,"% OF"
  1. W !," OF SERVICE",?23,"DATE",?30,"TOTAL"
  1. S APCLTAB=38 F APCLX=1:1:12 W ?APCLTAB,$P(APCLMOL,",",APCLX) S APCLTAB=APCLTAB+8
  1. W !,APCL132
  1. Q
  1. ;