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

APCLER2P.m

Go to the documentation of this file.
  1. APCLER2P ; IHS/CMI/LAB - PRINT CLINIC VISITS ;
  1. ;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
  1. ;
  1. ;
  1. INIT ;
  1. S APCLDT=$$FMTE^XLFDT(DT)
  1. S Y=APCLBD D DD^%DT S APCLBDD=Y S Y=APCLED D DD^%DT S APCLEDD=Y
  1. S APCLPG=0
  1. I '$D(^XTMP("APCLER2",APCLJOB,APCLBTH)) D HEAD W !,"No visits to report." G END
  1. ;
  1. SET ;
  1. D HEAD
  1. S APCLVDFN=0
  1. F S APCLVDFN=$O(^XTMP("APCLER2",APCLJOB,APCLBTH,APCLVDFN)) Q:APCLVDFN=""!($D(APCLQUIT)) D SET2
  1. END ;
  1. D DONE^APCLOSUT
  1. K ^XTMP("APCLER2",APCLJOB,APCLBTH)
  1. Q
  1. SET2 ;
  1. S APCLVER=^XTMP("APCLER2",APCLJOB,APCLBTH,APCLVDFN)
  1. S APCLVREC=^AUPNVSIT(APCLVDFN,0)
  1. S APCLHRCN=$S($D(^AUPNPAT($P(APCLVREC,U,5),41,DUZ(2),0)):$J($P(^AUTTLOC(DUZ(2),0),U,7),4)_" "_$P(^AUPNPAT($P(APCLVREC,U,5),41,DUZ(2),0),U,2),1:"<NONE>")
  1. PRN ;
  1. S APCLNAME=$E($P(^DPT($P(APCLVREC,U,5),0),U),1,15)
  1. K ^UTILITY("DIQ1",$J) S DIC=9000001,DA=$P(APCLVREC,U,5),DR=1102.99 D EN^DIQ1
  1. S APCLAGE=$G(^UTILITY("DIQ1",$J,9000001,$P(APCLVREC,U,5),1102.99)) K ^UTILITY("DIQ1",$J)
  1. S APCLVD=$E($P(APCLVREC,U),4,5)_"/"_$E($P(APCLVREC,U),6,7)_"/"_$E($P(APCLVREC,U),2,3) S Y=$P(APCLVREC,U) D DD^%DT S APCLVD=APCLVD_" "_$P(Y,"@",2)
  1. S APCLFAC=$P(^AUTTLOC($P(APCLVREC,U,6),0),U,7)
  1. PRINT1 ;
  1. I $Y>(IOSL-5) D HEAD Q:$D(APCLQUIT)
  1. W !,APCLNAME,?16,APCLHRCN,?28,APCLVD,?45,?49,APCLFAC S APCLFRST=0,APCLP=0
  1. F S APCLP=$O(^AUPNVPOV("AD",APCLVDFN,APCLP)) Q:APCLP'=+APCLP D
  1. .W:APCLFRST !
  1. .S APCLFRST=APCLFRST+1
  1. .W ?54,$P($$ICDDX^ICDEX($P(^AUPNVPOV(APCLP,0),U)),U,2) W:$P(^AUPNVPOV(APCLP,0),U,4)]"" ?64,$E($$VAL^XBDIQ1(9000010.07,APCLP,.04),1,16)
  1. PRINT2 ;
  1. S APCLVD=$E($P(^AUPNVSIT(APCLVER,0),U),4,5)_"/"_$E($P(^AUPNVSIT(APCLVER,0),U),6,7)_"/"_$E($P(^AUPNVSIT(APCLVER,0),U),2,3) S Y=$P(^AUPNVSIT(APCLVER,0),U) D DD^%DT S APCLVD=APCLVD_" "_$P(Y,"@",2)
  1. S APCLCLN=$S($P(^AUPNVSIT(APCLVER,0),U,8):$P(^DIC(40.7,$P(^AUPNVSIT(APCLVER,0),U,8),0),U,2),1:"--")
  1. S APCLFAC=$S($P(^AUPNVSIT(APCLVER,0),U,6):$P(^AUTTLOC($P(^AUPNVSIT(APCLVER,0),U,6),0),U,7),1:"--")
  1. I $Y>(IOSL-5) D HEAD Q:$D(APCLQUIT)
  1. W !?3,"ER Visit Information =>",?28,APCLVD,?45,APCLCLN,?49,APCLFAC S (APCLFRST,APCLP)=0
  1. F S APCLP=$O(^AUPNVPOV("AD",APCLVER,APCLP)) Q:APCLP'=+APCLP D
  1. .W:APCLFRST !
  1. .S APCLFRST=APCLFRST+1
  1. .W ?54,$P($$ICDDX^ICDEX($P(^AUPNVPOV(APCLP,0),U),0),U,2) W:$P(^AUPNVPOV(APCLP,0),U,4)]"" ?64,$E($$VAL^XBDIQ1(9000010.07,APCLP,.04),1,16)
  1. .Q
  1. W !
  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 !
  1. S X=$P(^DIC(4,DUZ(2),0),U)
  1. W !!,$P(^VA(200,DUZ,0),"^",2),?(80-$L(X)/2),X,?70,"Page ",APCLPG
  1. W !?25,"HOSPITAL ADMISSIONS AFTER ER VISIT"
  1. W !?18,"VISITS DATES: ",APCLBDD," TO ",APCLEDD
  1. W !!?5,"NAME",?17,"HRCN",?28,"VISIT DATE&TIME",?45,"CLN",?49,"FAC",?54,"ICD",?64,"PROV NARRATIVE"
  1. W !,$TR($J("",80)," ","-")
  1. W !
  1. Q
  1. ;