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

APCDEAP.m

Go to the documentation of this file.
APCDEAP ; IHS/CMI/LAB - APPEND MODE ;
 ;;2.0;IHS PCC SUITE;**17**;MAY 14, 2009;Build 18
 ;
 ; APCDFLG=0 ... RUN
 ; APCDFLG=1 ... ERROR
 ;
 ; APCDMODE=A ... ADD
 ; APCDMODE=M ... MOD
 ;
HDR ; Write Header
 W:$D(IOF) @IOF
 F APCDJ=1:1:5 S APCDX=$P($T(TEXT+APCDJ),";;",2) W !?80-$L(APCDX)\2,APCDX
 K APCDX,APCDJ
 W !!
 D ^APCDEIN
 Q:APCDFLG
 I '$D(APCDPARM) D ^APCDVAR
 S APCDPAT="",APCDNOXV=""
 F  D GETPAT Q:APCDPAT=""  D GETVISIT I APCDVSIT D MNEPROC
 D EOJ
 Q
 ;
GETPAT ;EP - GET PATIENT
 W !
 S APCDPAT=""
 S DIC="^AUPNPAT(",DIC(0)="AEMQ" D ^DIC K DIC
 Q:Y<0
 S APCDPAT=+Y
 I APCDPAT S DIE="^AUPNPAT(",DR=".16///TODAY",DA=APCDPAT D ^DIE
 I DUZ("AG")="I" D ^APCDEMDI
 Q
 ;
GETVISIT ;EP - GET VISIT
 K APCDCAT,APCDTYPE,APCDTLOC,APCDTTYP,APCDTCAT,APCDTVST
 S APCDVSIT=""
 D ^APCDVLK
 ;I APCDVSIT S DA=APCDVSIT,DIE="^AUPNVSIT(",DR=".13////"_DT D ^DIE K DA,DIE,DR
 I APCDVSIT S AUPNVSIT=APCDVSIT D MOD^AUPNVSIT
 I APCDVSIT,AUPNDOB]"" S X2=AUPNDOB,X1=APCDDATE D ^%DTC S AUPNDAYS=X ; re-set days of age to visit date-dob
 I APCDVSIT K DR S APCDVDSP=APCDVSIT D ^APCDEWHA K APCDVDSP
 Q
 ;
MNEPROC ;EP - PROCESS MNEMONICS UNTIL DONE
 S APCDMPQ=0
 F  D GETMNE D:$D(APCDEQX) CHKEHR2^APCDVCHK I APCDMPQ Q
 D EP^APCDKDE
 D GETMNEK
 K APCDMPQ
 Q
 ;
GETMNE ; GET MNEMONIC
 W !
 S DIC="^APCDTKW(",DIC(0)="AEMQ",DIC("A")="MNEMONIC: ",DIC("S")="I $L($P(^APCDTKW(+Y,0),U))<5,'$P(^(0),U,7)" D ^DIC K DIC("A"),DIC("S")
 I Y<0 D CHECK Q
 S APCDMNE=+Y,APCDMNE("NAME")=$P(Y,U,2)
 K APCDMOD
 D ^APCDEA3
 I $D(APCDEQX) D ^APCDEQX I $D(APCDEQX) S APCDMPQ=1 Q
 I $D(APCDMOD) W !!,"Switching to Modify Mode for ONE Mnemonic ONLY!" S APCDMODE="M",APCDVLK=APCDVSIT D GETMNE K APCDVLK,APCDMOD S APCDMODE="A" W !!,"Switching back to ENTER Mode!" Q
 Q
 ;
GETMNEK ; KILL GETMNE SPECIFIC VARIABLES
 K APCDVSIT,APCDX,APCDEQX
 Q
 ;
CHECK ; SEE IF PV AND PRO ENTERED CORRECTLY
 Q:$D(APCDMOD)
 S APCDMPQ=1
 I $P(^AUPNVSIT(APCDVSIT,0),U,7)="E" Q
 K APCDNOCL D ^APCDVCHK
 I APCDMODE'="M",'$D(^AUPNVPOV("AD",APCDVSIT)),'$D(^AUPNVPRN("AD",APCDVSIT)) W !,"PV mnemonic required!",!,APCDBEEP S:'$D(DTOUT) APCDMPQ=0 Q
 I APCDMODE'="M",'$D(^AUPNVPRV("AD",APCDVSIT)) W !,"PRV mnemonic required!",!,APCDBEEP S:'$D(DTOUT) APCDMPQ=0 Q
 I APCDMODE'="M",$D(APCDNOCL) W !,"CL mnemonic required!",!,$C(7) S:'$D(DTOUT) APCDMPQ=0 K APCDNOCL Q
 I APCDMODE'="M",$P(^AUPNVSIT(APCDVSIT,0),U,7)="H",$P(^(0),U,3)'="C",'$D(^AUPNVINP("AD",APCDVSIT)) W !,"IP Mnemonic required on Hospitalizations!",$C(7) S:'$D(DTOUT) APCDMPQ=0 Q
 I APCDMODE'="M",$P(^AUPNVSIT(APCDVSIT,0),U,3)="C",'$D(^AUPNVCHS("AD",APCDVSIT)) W !,"CHA, CHH or CHI mnemonic required with Contract Visits!",$C(7) S:'$D(DTOUT) APCDMPQ=0 Q
 D DEDT^APCDEA2(APCDVSIT) I $P(APCDPARM,U,5)="Y",'$D(^APCDFORM("AB",APCDVSIT)) S APCDFV=APCDVSIT D ^APCDFORM K APCDFV
 I $P(APCDPARM,U,5)="Y",$D(^AUPNVTC("AD",APCDVSIT)) S APCDFV=APCDVSIT D ^APCDFCTC K APCDFV ;IHS/CMI/LAB - patch 2,4 added this line for tc tracking
 Q
 ;
EOJ ; END OF JOB
 D ^APCDEKL
 K DX,S,A,POP,IOY,%,%DT,X,Y,DI,DIGG,DIPGM,DISYS,DI,%1,DQ
 K APCDEQX,APCDMPQ,APCDNOXV
 Q
TEXT ;
 ;;PCC Data Entry Module
 ;;
 ;;***************
 ;;* APPEND Mode *
 ;;***************
 Q