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

APCDPE2.m

Go to the documentation of this file.
APCDPE2 ; IHS/CMI/LAB - DATA ENTRY ENTER CONT. ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;   Generate VISIT, then process MNEMONICS/TEMPLATE
 ;
START ;
 S Y=APCDPAT D ^AUPNPAT
 S APCDCLN=APCDPECL
 K APCDALVR D ^APCDALV
 I $D(APCDAFLG)#2,APCDAFLG=2 W $C(7),!,"VISIT date not valid for current patient!",! S APCDFLG=1 Q
 Q:APCDVSIT=""
 S APCDLVST=APCDVSIT
 S DIE="^AUPNPAT(",DR=".16///TODAY",DA=APCDPAT D ^DIE
 S AUPNVSIT=APCDVSIT D MOD^AUPNVSIT
 I AUPNDOB]"" S X2=AUPNDOB,X1=APCDDATE D ^%DTC S AUPNDAYS=X
 K DR
 I $P($G(APCDPARM),U,18)'="N" S APCDVDSP=APCDVSIT D:$D(APCDVSIT("NEW")) ^APCDVDSP D:'$D(APCDVSIT("NEW")) ^APCDEWHA K APCDVDSP
 I APCDTYPE'="C","TC"'[APCDCAT,'$D(APCDVSIT("NEW")) S X="TM" D GET1
 I $P($G(APCDPARM),U,16)="Y",$E($P(^AUTTLOC(APCDLOC,0),U,10),5,6)>49 S X="OLOC" D GET1
 I APCDCAT="H",APCDTYPE'="C",'$D(^AUPNVINP("AD",APCDVSIT)) S X="IP" D GET1
 S APCDPEH=0 F  S APCDPEH=$O(APCDCSEL(APCDPEH)) Q:APCDPEH'=+APCDPEH  S X=APCDCSEL(APCDPEH),X=$P(^APCDTKW(X,0),U) D GET1
 W !!,"You may now enter other data using any of the data entry mnemonics.",!,"To display the visit type DISP, to display a health summary type DHS.",!,"Press enter to exit.",!
 D MNEPROC
 Q
 ;
MNEPROC ; PROCESS MNEMONICS UNTIL DONE
 S APCDMPQ=0
 F  D GETMNE Q:APCDMPQ
 I $G(APCDVSIT) D EP^APCDKDE
 D GETMNEK
 K APCDMPQ,APCDREGU
 W !
 Q
 ;
GETMNE ; GET MNEMONIC
 W !
 S DIC="^APCDTKW(",DIC(0)="AEMQ",DIC("A")="MNEMONIC: ",DIC("S")="I $L($P(^(0),U))<5" 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",APCDVSIT=APCDLVST,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,APCDREGU
 Q
 ;
CHECK ; SEE IF PV AND PRO ENTERED CORRECTLY
 Q:$D(APCDMOD)
 S APCDMPQ=1
 K APCDNOCL D ^APCDVCHK
 Q:"EX"[$P(^AUPNVSIT(APCDVSIT,0),U,7)
 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
 Q:'APCDMPQ
 D DEDT^APCDEA2(APCDLVST) I $P(APCDPARM,U,5)="Y",'$D(^APCDFORM("AB",APCDLVST)) S APCDFV=APCDLVST 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 added this line to do tc tracking
 Q
 ;
GET1 ;
 W !!
 S DIC="^APCDTKW(",DIC(0)="EMQX" D ^DIC K DIC
 I Y<0 W !!,$C(7),$C(7),X," Mnemonic is Missing - Notify your Supervisor!" K DIC,X Q
 S APCDMNE=+Y,APCDMNE("NAME")=$P(Y,U,2)
 D ^APCDEA3
 Q
 ;