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

APCDALD.m

Go to the documentation of this file.
APCDALD ; IHS/CMI/LAB - NO DESCRIPTION PROVIDED ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
 ;
EP ;
 D PCCCHECK
 I $G(APCDQUIT) D EOJ Q  ;something is wrong or don't want to pass  data
 K APCDV("VISIT"),APCDV("VFILES")
 X ^APCDLINK(APCDLINK,2)
 D EOJ
 Q
PCCCHECK ;check to see if link to pcc active, set BCHLPCC IF SO
 I '$D(^AUTTSITE(1,0)) S APCDQUIT=1 Q  ;no site file
 I $P(^AUTTSITE(1,0),U,8)'="Y" S APCDQUIT=2 Q  ;pcc not running 
 I '$D(^APCCCTRL(DUZ(2),0))#2 S APCDQUIT=3 Q  ;no pcc master control file entry
 I $G(APCDPKG)="" S APCDQUIT=4 Q  ;required variable not passed
 I 'APCDPKG S APCDQUIT=5 Q  ;no package entry
 S APCDPKG("NAME")=$P(^DIC(9.4,APCDPKG,0),U)
 I '$D(^APCCCTRL(DUZ(2),11,APCDPKG,0))#2 S APCDQUIT=6 Q  ;no pcc master control entry for package
 I '$P(^APCCCTRL(DUZ(2),11,APCDPKG,0),U,2) S APCDQUIT=7 Q  ;don't want to pass data
 S APCDLINK=$O(^APCDLINK("C",APCDPKG,""))
 I APCDLINK="" S APCDQUIT=8 Q  ;no module link control
 I $P(^APCDLINK(APCDLINK,0),U,3)="" S APCDQUIT=9 Q  ;don't know array passed
 I '$D(^APCDLINK(APCDLINK,2)) S APCDQUIT=10 Q  ;no code to execute
 Q
 ;
EOJ ;
 K APCDPKG,APCDLINK,APCDQUIT,APCDERR,XMB,APCDDUZ,APCDVL,APCDVI,APCDV("VISIT"),APCDV("VFILES")
 Q
LBULL ;EP - SEND BULLETIN - LINK FAILURE
 ;pass APCDERR as narrative
 ;APCDALVR("APCDPAT")=patient
 ;APCDDATK=date of encounter
 ;APCDIEN=package ien of entry
 K XMB
 S XMB(1)=APCDIEN,XMB(2)=$P(^DPT(APCDALVR("APCDPAT"),0),U)_" (IEN "_APCDALVR("APCDPAT")_")",Y=APCDDATK D DD^%DT
 S XMB(3)=Y,XMB(4)=APCDERR,XMB(5)=$G(APCDPKG("NAME")),XMB(6)=APCDFILE,XMB="APCD PCC PACKAGE LINK FAIL",APCDDUZ=DUZ,DUZ=.5
 D ^XMB S DUZ=APCDDUZ K XMB,APCDERR
 Q
COMPLETE ;EP complete visit protocol call
 S APCDV("VISIT","9000010")=APCDVSIT
 I '$D(APCDV("VFILES")) S APCDVFLE=9000010 F APCDVL=0:0 S APCDVFLE=$O(^DIC(APCDVFLE)) Q:APCDVFLE>9000010.99!(APCDVFLE'=+APCDVFLE)  D COMP2
 ;call protocol
 S X=+$O(^ORD(101,"B","APCD COMPLETE VISIT ADD",0))_";ORD(101,"
 D EN^XQOR
 K APCDV,X,Y,APCDVFLE,APCDVDG,APCDVIGR,APCDVDFN
 Q
COMP2 ;
 S APCDVDG=^DIC(APCDVFLE,0,"GL"),APCDVIGR=APCDVDG_"""AD"",APCDVSIT,APCDVDFN)"
 S APCDVDFN="" F APCDVI=1:1 S APCDVDFN=$O(@APCDVIGR) Q:APCDVDFN=""  S APCDV(APCDVFLE,APCDVDFN)=""
 Q
 ;
 ;