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

APCDEF.m

Go to the documentation of this file.
APCDEF ; IHS/CMI/LAB - APCD Auto Print PCC Encounter Form Sort ;
 ;;2.0;IHS PCC SUITE;**4**;MAY 14, 2009
 ;
 ;This routine will print out an automated PCC encounter form for
 ;a particular visit.  The visit IEN needs to be passed in for it
 ;to run.  This will typically be called after data entry.
 ;
 ;
ASK ;-- ask the visit and either call this routine or visit display
 D XIT
 D GETPAT^APCDDISP
 I APCDPAT="" W !,"No Patient Selected!" D XIT Q
 D GETVISIT^APCDDISP
 I APCDVSIT="" W !,"No Visit Selected!" D XIT Q
 S DIR(0)="SB^D:Display Mode;F:Form Mode"
 S DIR("A")="Would you like to see the visit in Display or Form Mode: "
 S DIR("B")="F"
 D ^DIR
 G XIT:$D(DIRUT)
 S APCDFD=Y
 K DIR,Y
 I APCDFD="D" D ^APCDVD,EOJ^APCDDISP Q
 D EN(APCDVSIT)
 Q
 ;
EN(APCDVIEN) ;-- this is the entry point from external packages
 I '$G(APCDVIEN) W !,"No Visit Selected for PCC Encounter Form Print" Q
 D VST,VFL,ZIS
 Q
 ;
VST ;EP -- get the visit information
 S APCDVREC=$G(^AUPNVSIT(APCDVIEN,0))
 S APCDPAT=$$VAL^XBDIQ1(9000010,APCDVIEN,.05)
 S APCDVDT=$$FMTE^XLFDT($$VALI^XBDIQ1(9000010,APCDVIEN,.01))
 S APCDVCLN=$S($P(APCDVREC,U,8)'="":$$VAL^XBDIQ1(9000010,APCDVIEN,.08),1:"Not Specified")
 S APCDVLOC=$$VAL^XBDIQ1(9000010,APCDVIEN,.06)
 S APCDVEM=$$VAL^XBDIQ1(9000010,APCDVIEN,.17)
 S APCDVSC=$$VAL^XBDIQ1(9000010,APCDVIEN,.07)
 S APCDVHL=$$VAL^XBDIQ1(9000010,APCDVIEN,.22)
 S APCDVDP=$$VAL^XBDIQ1(9000010,APCDVIEN,.33)
 S APCDVCC=$$VAL^XBDIQ1(9000010,APCDVIEN,1401)
 S APCDVFLG=$$VAL^XBDIQ1(9000010,APCDVIEN,1601)
 Q
 ;
VFL ;EP -- let's loop through the v files and get the info     
 NEW DA,D0,DIC,DIQ,DR,DI
 S APCDJ=$J,APCDH=$H
 S APCDTMP="^XTMP(APCDJ,APCDH,""APCDEF"",APCDCTR,APCDVFA)"
 S APCDCNT=1
 S APCDVFLE=9000010 F  S APCDVFLE=$O(^DIC(APCDVFLE)) Q:APCDVFLE>9000010.99  D
 . S APCDCTR=""
 . I APCDVFLE=9000010.01 S APCDCTR=1
 . I APCDVFLE=9000010.13 S APCDCTR=2
 . I APCDVFLE=9000010.07 S APCDCTR=3
 . I APCDVFLE=9000010.14 S APCDCTR=4
 . I APCDCTR="" S APCDCTR=$P(APCDVFLE,".",2)+10000
 . S APCDVNM=$P(^DIC(APCDVFLE,0),U)
 . S APCDVDG=^DIC(APCDVFLE,0,"GL")
 . S APCDVDGA=$P(APCDVDG,"(")
 . S APCDVFA=$E(APCDVDGA,6,9)
 . S APCDVIGR=APCDVDG_"""AD"",APCDVIEN,APCDVDFN)"
 . S APCDVDFN=""
 . F APCDVI=1:1 S APCDVDFN=$O(@APCDVIGR) Q:APCDVDFN=""  D
 .. I APCDVFLE=9000010.01 Q:$P($G(^AUPNVMSR(APCDVDFN,2)),U,1)  ;skip measurements entered in error
 .. I APCDVFLE=9000010.04 D  Q
 ... K @APCDTMP@(APCDCNT)
 ... S @APCDTMP@(APCDCNT)=$G(@APCDVDGA@(APCDVDFN,19))
 ... S APCDCNT=APCDCNT+1
 .. I APCDVFLE=9000010.13!(APCDVFLE=9000010.07)!(APCDVFLE=9000010.16)!(APCDVFLE=9000010.01) D  Q
 ... S @APCDTMP@(APCDCNT)=APCDVDFN
 ... S APCDCNT=APCDCNT+1
 .. I APCDVFLE=9000010.32 D  Q
 ... S @APCDTMP@(APCDCNT)=APCDVDFN
 ... S APCDCNT=APCDCNT+1
 .. I APCDVFLE=9000010.34 D  Q
 ... S @APCDTMP@(APCDCNT)=APCDVDFN
 ... S APCDCNT=APCDCNT+1
 .. S @APCDTMP@(APCDCNT)=$G(@APCDVDGA@(APCDVDFN,0))
 .. S APCDCNT=APCDCNT+1
 Q
 ;
ZIS ;-- device call
 S XBRC="^APCDEFC",XBRP="^APCDEFP",XBNS="APCD",XBRX="XIT^APCDEF"
 D ^XBDBQUE
 ;
XIT ;-- kill the variables and quit
 D EN^XBVK("APCD")
 Q
 ;