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

APCDEWHA.m

Go to the documentation of this file.
APCDEWHA ; IHS/CMI/LAB - DISPLAY PATIENT & VISIT INFO ;
 ;;2.0;IHS PCC SUITE;**22**;MAY 14, 2009;Build 6
 ;CALLED FROM THE TEMPLATE APCD WHAT (WHA)
START ;EP
 K APCDVREC
 S:$D(APCDVDSP) APCDVREC=^AUPNVSIT(APCDVDSP,0)
 W !!,"You are currently processing the following Patient",$S($D(APCDVDSP):" Visit",1:""),":",!!
 S APCDH="Patient Name",APCDV=$E($P(^DPT(AUPNPAT,0),U),1,20) D WRITE
 S APCDH="Chart #",APCDV=$S($D(^AUPNPAT(AUPNPAT,41,DUZ(2),0)):$P(^(0),U,2),1:"None") D WRITE
 S APCDH="Date of Birth" S Y=AUPNDOB D DD^%DT S APCDV=Y D WRITE
 S APCDH="Sex",APCDV=AUPNSEX D WRITE
 G:'$D(APCDVREC) XIT
 S APCDH="Visit Date" S Y=$P(APCDVREC,U) D DD^%DT S APCDV=Y D WRITE
 S APCDH="Location",APCDV=$E($P(^DIC(4,$P(APCDVREC,U,6),0),U),1,25) D WRITE
 S APCDH="Type",APCDV=$P(APCDVREC,U,3) D WRITE
 S APCDH="Service Category",APCDV=$P(APCDVREC,U,7) D WRITE
 S APCDH="Clinic",APCDV=$S($P(APCDVREC,U,8)="":"None Entered",1:$P(^DIC(40.7,$P(APCDVREC,U,8),0),U)) D WRITE
 S APCDH="Hospital Location",APCDV=$$VAL^XBDIQ1(9000010,APCDVDSP,.22)
 I $P(^AUPNVSIT(APCDVDSP,0),U,34)]"" S APCDH="DRG",APCDV=$$VAL^XBDIQ1(9000010,APCDVDSP,.34) D WRITE
 I $P(^AUPNVSIT(APCDVDSP,0),U,35)]"" S APCDH="HCFA WT",APCDV=$$VAL^XBDIQ1(9000010,APCDVDSP,.35) D WRITE
 I $P($G(^AUPNVSIT(APCDVDSP,12)),U,11)]"" S APCDH="Ext Acct #",APCDV=$P($G(^AUPNVSIT(APCDVDSP,12)),U,11) D WRITE
 I $P($G(^AUPNVSIT(APCDVDSP,11)),U,3)]"" S APCDH="VCN",APCDV=$P($G(^AUPNVSIT(APCDVDSP,11)),U,3) D WRITE
 I $G(^AUPNVSIT(APCDVDSP,21))]"" S APCDV=$P(^AUPNVSIT(APCDVDSP,21),U),APCDH="Outside Location" W ! D WRITE
 I $P(APCDVREC,U,9) D DSPLY
 ;
XIT ; XIT CLEANUP
 K APCDVDFN,APCDVDG,APCDVDSH,APCDVFLE,APCDVI,APCDVIGR,APCDVL,APCDVNM,X,Y,APCDVREC,APCDV,APCDH,APCDZ,APCDX,APCDY,APCDT
 Q
DSPLY ;
 NEW DA,D0,DIC,DIQ,DR,DI
 S APCDVFLE=9000010 F APCDVL=0:0 S APCDVFLE=$O(^DIC(APCDVFLE)) Q:APCDVFLE>9000010.99!(APCDVFLE'=+APCDVFLE)  D DSPLY2
 D XIT
 Q
 ;
DSPLY2 ;
 S APCDVNM=$P(^DIC(APCDVFLE,0),U),APCDVDG=^DIC(APCDVFLE,0,"GL"),APCDVIGR=APCDVDG_"""AD"",APCDVDSP,APCDVDFN)",APCDVDFN=""
 F APCDVI=1:1 S APCDVDFN=$O(@APCDVIGR) Q:APCDVDFN=""  D DSPLY3
 Q
 ;
DSPLY3 ;
 I APCDVFLE=9000010.01 Q:$P($G(^AUPNVMSR(APCDVDFN,2)),U,1)  ;measurements entered in error
 I APCDVFLE=9000010.54 Q:$P($G(^AUPNVRUP(APCDVDFN,2)),U,1)  ;V updated/reviewed entered in error
 I APCDVFLE=9000010.62 Q:$P($G(^AUPNVAMI(APCDVDFN,5)),U,1)  ;V AMI entered in error
 I APCDVFLE=9000010.63 Q:$P($G(^AUPNVSTR(APCDVDFN,5)),U,1)  ;V STROKE entered in error
 I APCDVFLE=9000010.51 Q:$P($G(^AUPNVACG(APCDVDFN,1)),U,1)  ;V ANTICOAG entered in error
 I APCDVFLE=9000010.58 Q:$P($G(^AUPNVVI(APCDVDFN,0)),U,6)   ;V VISIT INSTRUCTIONS entered in error
 I APCDVFLE=9000010.43 Q:$P($G(^AUPNVOB(APCDVDFN,0)),U,6)   ;V OB entered in error
 I APCDVFLE=9000010.64 Q:$P($G(^AUPNVDLV(APCDVDFN,5)),U,1)  ;V DELIVERY entered in error   PATCH 22
 I APCDVI<2 S APCDX=20-$L($P(APCDVNM,"V ",2)_"'s"),APCDY=APCDX\2,APCDZ=APCDX-APCDY W !!,"==============",$J("",APCDZ),$P(APCDVNM,"V ",2)_"'s",$J("",APCDY),"=============="
 I APCDVI>1 W !
 K ^UTILITY("DIQ1",$J)
 I APCDVFLE'=9000010.09 S DIC=APCDVDG,DR=".01;.04:99999",(DA,D0)=APCDVDFN D EN^DIQ1 ;IHS/CMI/LAB
 I APCDVFLE=9000010.09 S DIC=APCDVDG,DR=".01;.04;1202",(DA,D0)=APCDVDFN D EN^DIQ1 ;IHS/CMI/LAB
 D DSPLY4
 Q
 ;
DSPLY4 ;
 W !
 F APCDY=0:0 S APCDY=$O(^UTILITY("DIQ1",$J,APCDVFLE,APCDVDFN,APCDY)) Q:'APCDY  D
 .I $G(^UTILITY("DIQ1",$J,APCDVFLE,APCDVDFN,APCDY))]""  S APCDX=$P(^DD(APCDVFLE,APCDY,0),U)_": "_^UTILITY("DIQ1",$J,APCDVFLE,APCDVDFN,APCDY) D DSPLY41 Q
 .I $O(^UTILITY("DIQ1",$J,APCDVFLE,APCDVDFN,APCDY,0)) D
 ..S F=0 F  S F=$O(^UTILITY("DIQ1",$J,APCDVFLE,APCDVDFN,APCDY,F)) Q:F'=+F  S APCDX=^UTILITY("DIQ1",$J,APCDVFLE,APCDVDFN,APCDY,F) D DSPLY41
 K APCDT,APCDX,APCDY
 Q
DSPLY41 ;
 W:$X>39 ! S APCDT=$S($X<2:$X,1:$X+5) W:(APCDT+$L(APCDX))>79 ! S:(APCDT+$L(APCDX))>79 APCDT=0 W ?APCDT,APCDX
 Q
WRITE ;
 S APCDV=" "_APCDV_" "
 S APCDX=APCDH_": "_APCDV W:$X>39 ! S APCDT=$S($X>1:41,1:1) W:(APCDT+$L(APCDX))>79 ! W ?APCDT,APCDH,": ",@APCDRVON,APCDV,@APCDRVOF
 K APCDT,APCDX
 Q