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

APCDPE1.m

Go to the documentation of this file.
APCDPE1 ; IHS/CMI/LAB - DATA ENTRY ENTER MODE ;
 ;;2.0;IHS PCC SUITE;**2**;MAY 14, 2009
 ;PATCH 2 commented out writing of date
 ;
 ; APCDFLG=0 ... RUN
 ; APCDFLG=1 ... ERROR
 ;
 ; APCDMODE=A ... ADD
 ; APCDMODE=M ... MOD
 ;
HDR ; Write Header
 W:$D(IOF) @IOF
 W !!
 W "The following PCC Data Items will be prompted for for each visit created:"
 S X=0 F  S X=$O(APCDCSEL(X)) Q:X'=+X  W !?10,$P(^APCDTKW(APCDCSEL(X),0),U),?16,$S($P(^APCDTKW(APCDCSEL(X),0),U,12)]"":$P(^APCDTKW(APCDCSEL(X),0),U,12),1:$P(^APCDTKW(APCDCSEL(X),0),U,6))
 D ^APCDEIN
 Q:APCDFLG
GETLOC ; GET LOCATION OF ENCOUNTER
 W !!
 S APCDLOC="" I $D(APCDDEFL),APCDDEFL]"" S DIC("B")=$P(^DIC(4,APCDDEFL,0),U)
 S DIC="^AUTTLOC(",DIC(0)="AEMQ" D ^DIC K DIC
 G:Y<0 EOJ
 S APCDLOC=+Y
 ;
GETTYPE ; GET TYPE OF ENCOUNTER
 S APCDTYPE=""
 K DTOUT,DUOUT,DIRUT,DIROUT,DIR,DA
 I $D(APCDDEFT),APCDDEFT]"" S DIR("B")=APCDDEFT
 S DIR(0)="9000010,.03O",DIR("A")="TYPE" D ^DIR K DIR
 I $D(DIRUT) S X="" G GETLOC
 S APCDTYPE=Y
 ;
GETCAT ; GET SERVICE CATEGORY
 S APCDCAT=""
 K DTOUT,DUOUT,DIRUT,DIROUT,DIR,DA
 I $D(APCDDEFS),APCDDEFS]"" S DIR("B")=APCDDEFS
 S DIR(0)="9000010,.07O",DIR("A")="SERVICE CATEGORY" D ^DIR K DIR
 I $D(DIRUT) S X="" G GETTYPE
 S APCDCAT=Y
 ;
 I APCDCAT'="A" G PROC1
 ;
GETCLIN ;
 S APCDPECL=""
 K DTOUT,DUOUT,DIRUT,DIROUT,DIR,DA,DIC
 I $D(APCDDEFC),APCDDEFC]"" S DIC("B")=$P(^DIC(40.7,APCDDEFC,0),U)
 S DIC=40.7,DIC(0)="AEMQ",DIC("A")="Enter CLINIC: " D ^DIC K DIC
 I Y<0 G GETCAT
 S APCDPECL=+Y
PROC1 ;********* loop through patients
 ;get template or individual patient names
 S APCDPEPP=""
 S DIR(0)="SO^C:Enter a COHORT (template) of Patient Names;I:Be prompted for Individual Patient Names",DIR("A")="Would you like to",DIR("B")="I" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) G EOJ
 I Y="C" D  G EOJ
 .D GETTEMP G:APCDTEMP="" EOJ  S APCDPEX=0 F  S APCDPEX=$O(^DIBT(APCDTEMP,1,APCDPEX)) Q:APCDPEX=""  S APCDPAT=APCDPEX D
 ..D INAC^APCDEA(APCDPAT,.X)
 ..I 'X S APCDPAT="" Q
 ..D PROCESS
 .Q
 S APCDPAT="" F  D GETPAT Q:APCDPAT=""  D PROCESS
 D EOJ
 Q
GETDATE ; GET DATE OF ENCOUNTER
 S APCDDATE=""
 W !!,"VISIT/ADMIT DATE: " R X:$S($D(DTIME):DTIME,1:300) S:'$T X=""
 Q:X=""!(X="^")
 S %DT="ET" D ^%DT G:Y<0 GETDATE
 I Y>DT W "  <Future dates not allowed>",$C(7),$C(7) K X G GETDATE
 K APCDODAT
 S APCDDATE=X
GETTIME ;
 S APCDTIME=""
 I APCDTYPE="C"!("CNT"[APCDCAT) S APCDTIME="12:00"
 W !,"TIME OF VISIT: ",$S(APCDTIME]"":APCDTIME_"// ",1:"") R X:$S($D(DTIME):DTIME,1:300) S:'$T X="^" S:X="" X=APCDTIME
 S APCDTIME=""
 I X="^" S APCDDATE="" Q
 I X="" W APCDBEEP,"  Time Required!" G GETTIME
 I X["?" W !,"Enter time of visit, or 'D' for default." G GETTIME
 I X="D" S X="12:00" W "  ",X
EDTIME S APCDTIME=X,X=APCDDATE_"@"_APCDTIME
 X ^TMP("APCD",$J,"APCDDATE")
 I '$D(X) W APCDBEEP G GETDATE
 I X="-1" W ! G GETDATE
 S APCDDATE=X
 Q
GETPAT ; GET PATIENT
 D GETPAT^APCDEA
 Q
 ;
PROCESS ; PROCESS PATIENT
 W:$D(IOF) @IOF W !!,"Generating PCC Visit for ",$P(^DPT(APCDPAT,0),U),"  DOB:  ",$$FMTE^XLFDT($P(^DPT(APCDPAT,0),U,3)),!!
 D GETDATE
 I APCDDATE="" Q
 D ^APCDPE2
 Q
 ;
GETTEMP ;
 ;
 W ! S DIC("S")="I $P(^(0),U,4)=9000001!($P(^(0),U,4)=2)" S DIC="^DIBT(",DIC("A")="Enter Patient SEARCH TEMPLATE name: ",DIC(0)="AEMQ" D ^DIC K DIC,DA,DR,DICR
 I Y=-1 S APCDTEMP="" Q
 S APCDTEMP=+Y
 Q
EOJ ; END OF JOB
 D ^APCDEKL
 Q