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

APCLYV12.m

Go to the documentation of this file.
  1. APCLYV12 ; IHS/CMI/LAB - CO VISITS REPORT (PRINT) ;
  1. ;;2.0;IHS PCC SUITE;;MAY 14, 2009
  1. ;
  1. INIT ;
  1. S APCLFAC=$P(^DIC(4,DUZ(2),0),"^")
  1. I '$D(^XTMP("APCLYV1",APCLJOB,APCLBT)) D HEAD W !!,"No visits to report" G END
  1. S APCLTOT=0,APCLSTOP=""
  1. S X=132 X ^%ZOSF("RM")
  1. S APCLBD=$E(APCLBD,4,5)_"/"_$E(APCLBD,6,7)_"/"_$E(APCLBD,2,3)
  1. S APCLED=$E(APCLED,4,5)_"/"_$E(APCLED,6,7)_"/"_$E(APCLED,2,3)
  1. S APCLCHMP=$O(^AUTNINS("B","CHAMPUS",0))
  1. I 'APCLCHMP S APCLCHMP=$O(^AUTNINS("B","TRICARE",0))
  1. ;
  1. MAIN I $D(APCLOP) S APCLII="O" D PRINT,TOTALS G END:APCLSTOP="^"
  1. I $D(APCLIP) S APCLII="I" D PRINT,TOTALS G END:APCLSTOP="^"
  1. I $D(APCLDEN) S APCLII="D" D PRINT,TOTALS
  1. ;
  1. END ;
  1. D DONE^APCLOSUT
  1. K APCLBD,APCLED,APCLPAT,APCLNAME,APCLHRCN,APCLBEN,APCLII,APCLSTOP,APCLTOT,APCLSUB,Y,APCLRET,APCLRETD,APCLCHMP
  1. K APCLVDT,APCLVDFN,APCLSSN,APCLFAC,J,APCLDSCH,X,APCLIP,APCLOP,APCLBENP,APCLIDFN,APCLSTR,APCLCFLG
  1. K APCLDEN,^XTMP("APCLYV1",APCLJOB,APCLBT)
  1. ;
  1. Q
  1. PRINT ;
  1. D HEAD S APCLBEN=0
  1. P1 S APCLBEN=$O(^XTMP("APCLYV1",APCLJOB,APCLBT,APCLII,APCLBEN)) Q:APCLBEN="" S APCLNAME=0
  1. P2 S APCLNAME=$O(^XTMP("APCLYV1",APCLJOB,APCLBT,APCLII,APCLBEN,APCLNAME)) G P1:APCLNAME="" S (APCLPAT,APCLSUB)=0
  1. P3 S APCLPAT=$O(^XTMP("APCLYV1",APCLJOB,APCLBT,APCLII,APCLBEN,APCLNAME,APCLPAT)) I APCLPAT="" W:APCLII'="I" ?114,APCLSUB G P2
  1. ;
  1. S APCLVDT=0
  1. P4 S APCLVDT=$O(^XTMP("APCLYV1",APCLJOB,APCLBT,APCLII,APCLBEN,APCLNAME,APCLPAT,APCLVDT)) G P3:APCLVDT="" S APCLVDFN=0
  1. P5 S APCLVDFN=$O(^XTMP("APCLYV1",APCLJOB,APCLBT,APCLII,APCLBEN,APCLNAME,APCLPAT,APCLVDT,APCLVDFN)) G P4:APCLVDFN="" S APCLSTR=^(APCLVDFN)
  1. S APCLHRCN=$P(APCLSTR,"^") S:APCLII="I" APCLDSCH=$P(APCLSTR,"^",2)
  1. S APCLBENP=$P(^AUTTBEN(APCLBEN,0),"^",2) I APCLBENP="03",'$D(APCLCFLG) S APCLCFLG=""
  1. I APCLBENP'="03",$D(APCLCFLG) D TOTALS K APCLCFLG D HEAD
  1. S APCLBENP=$S(APCLBENP="03":"CO",APCLBENP="04":"DEP",APCLBENP="30":"APCLRET",1:"APCLRETD")
  1. S APCLSSN=$P(^DPT(APCLPAT,0),"^",9)
  1. S:APCLSSN]"" APCLSSN=$E(APCLSSN,1,3)_"-"_$E(APCLSSN,4,5)_"-"_$E(APCLSSN,6,9)
  1. ;
  1. WRITE ;print line
  1. D PAGE:$Y>(IOSL-4) Q:APCLSTOP="^" ;check for end of page
  1. W:APCLSUB=0 !,$E(APCLNAME,1,20),?23,$J(APCLHRCN,6),?33,APCLSSN,?48,APCLBENP
  1. I APCLII'="I",(APCLSUB'=0) W !
  1. D PRVTINS
  1. S X=$E(APCLVDT,4,5)_"/"_$E(APCLVDT,6,7)_"/"_$E(APCLVDT,2,3) W ?97,X
  1. I APCLII'="I" S APCLTOT=APCLTOT+1,APCLSUB=APCLSUB+1 G P5
  1. S X=$S(APCLDSCH="":"",1:$E(APCLDSCH,4,5)_"/"_$E(APCLDSCH,6,7)_"/"_$E(APCLDSCH,2,3))
  1. W ?110,X S X1=APCLDSCH,X2=APCLVDT D ^%DTC S:X=0 X=1 W ?123,X
  1. S APCLTOT=APCLTOT+X G P5
  1. ;
  1. W:$D(IOF) @IOF,!?11,"*****Confidential Patient Data Covered by Privacy Act*****",!
  1. W !?132-$L(APCLFAC)/2,APCLFAC
  1. W !?45,"COMMISSIONED OFFICERS & DEPENDENTS VISITS"
  1. W !?55,APCLBD," to ",APCLED
  1. S X=$S(APCLII="O":"OUTPATIENT VISITS",APCLII="I":"INPATIENT VISITS",1:"DENTAL VISITS")
  1. W !?132-$L(X)/2,X,!
  1. F J=1:1:132 W "-"
  1. W !,"Patient Name",?23,"Chart #",?36,"SSN",?45,"CO or Dep"
  1. W ?58,"Sponsor",?80,"SSN"
  1. W ?97,$S(APCLII="I":"Admit Date",1:"Visit Date")
  1. W ?110,$S(APCLII="I":"Dsch Date",1:"No. of Visits")
  1. I APCLII="I" W ?122,"# of Days"
  1. W ! F J=1:1:132 W "-"
  1. W ! Q
  1. ;
  1. PAGE ;form feed to new page
  1. I IOST'?1"C-".E D HEAD Q
  1. I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="E" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S APCLSTOP="^" Q
  1. D HEAD
  1. Q
  1. ;
  1. PRVTINS ;does patient have co dep info in prvt ins file?
  1. G PRV9:APCLCHMP=""
  1. G PRV9:APCLBENP="CO",PRV9:APCLBENP="APCLRET"
  1. S INS=$O(^AUPNPRVT("I",APCLCHMP,APCLPAT,0)) G PRV9:INS=""
  1. S APCLSTR1=^AUPNPRVT(APCLPAT,11,INS,0) W ?58,$P(APCLSTR1,"^",4)
  1. S X=$P(APCLSTR1,"^",2) W ?80,$E(X,1,3),"-",$E(X,4,5),"-",$E(X,6,9)
  1. PRV9 Q
  1. ;
  1. TOTALS ;print visit totals
  1. Q:APCLSTOP="^"
  1. I $Y>(IOSL-6) D PAGE
  1. I APCLII="O" W !!?80,"TOTAL OUTPATIENT VISITS:",?112,$J(APCLTOT,3)
  1. I APCLII="I" W !!?95,"TOTAL INPATIENT DAYS:",?121,$J(APCLTOT,3)
  1. I APCLII="D" W !!?80,"TOTAL DENTAL VISITS:",?112,$J(APCLTOT,3)
  1. S APCLTOT=0 ;reset for next category
  1. I IOST?1"C-".E R !!,"Enter <return> to continue or '^' to stop",APCLSTOP:DTIME S:'$T APCLSTOP="^" Q
  1. Q