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

APCLNJ11.m

Go to the documentation of this file.
APCLNJ11 ; IHS/CMI/LAB - PRINT CLINIC VISITS (CALC) ;
 ;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
 ;
CALC ;find visits by date then store by patient name
 D XTMP^APCLOSUT("APCLNJ1","PCC INJURY REPORT 1")
 ;
 S APCLJOB=$J,APCLBT=$H
 S APCLVDT=APCLBD-.0001
VST S APCLVDT=$O(^AUPNVSIT("B",APCLVDT))
 G NEXT:APCLVDT="",NEXT:APCLVDT>(APCLED+.2359) S APCLVDFN=0
VST1 S APCLVDFN=$O(^AUPNVSIT("B",APCLVDT,APCLVDFN)) G VST:APCLVDFN=""
 ;
 G VST1:'$D(^AUPNVSIT(APCLVDFN,0)) S APCLSTR=^(0)
 G VST1:$P(APCLSTR,"^",11) ;screen out deleted visits
 G VST1:$P(APCLSTR,"^",6)=""  ;no location
 G VST1:$P(APCLSTR,"^",7)=""
 G VST1:$$DEMO^APCLUTL($P(APCLSTR,U,5),$G(APCLDEMO))
 I $D(APCLLOCT),'$D(APCLLOCT($P(APCLSTR,U,6))) G VST1
 I $D(APCLSCT),'$D(APCLSCT($P(APCLSTR,U,7))) G VST1
 I $D(APCLTYPT),'$D(APCLTYPT($P(APCLSTR,U,3))) G VST1
 I $D(APCLCLNT),$P(APCLSTR,U,8)="" G VST1
 I $D(APCLCLNT),'$D(APCLCLNT($P(APCLSTR,U,8))) G VST1
 I $D(APCLAGET),$$AGE^AUPNPAT($P(APCLSTR,U,5))>$P(APCLAGET,"-",2) G VST1
 I $D(APCLAGET),$$AGE^AUPNPAT($P(APCLSTR,U,5))<$P(APCLAGET,"-",1) G VST1
 ;
 S APCLDFN=$P(APCLSTR,"^",5) G:APCLDFN="" VST1 ;IHS/CMI/LAB
 G VST1:'$D(^DPT(APCLDFN,0))
 S APCLNAME=$P(^DPT(APCLDFN,0),"^")
 D POV
 G VST1
 ;
NEXT ;
 S APCLET=$H
 Q
 ;
POV ;check to see if pov is injury
 ;IHS/CMI/LAB - patched line below
 ;NEW X S X=0 F  S X=$O(^AUPNVPOV("AD",APCLVDFN,X)) Q:X'=+X  I $P(^ICD9(+^AUPNVPOV(X,0),0),U)>799.999 D  ;cmi/anch/maw 9/10/2007 orig line
 ;NEW X S X=0 F  S X=$O(^AUPNVPOV("AD",APCLVDFN,X)) Q:X'=+X  I $P($$ICDDX^ICDEX(+^AUPNVPOV(X,0)),U,2)>799.999 D  ;cmi/anch/maw 9/10/2007 csv
 NEW X S X=0 F  S X=$O(^AUPNVPOV("AD",APCLVDFN,X)) Q:X'=+X  I $$INJ^APCDAPOV($$CODEC^ICDEX(80,+^AUPNVPOV(X,0)),$$CSI^ICDEX(80,+^AUPNVPOV(X,0))) D
 .I $D(APCLALCH),APCLALCH="L",$P(^AUPNVPOV(X,0),U,7)'=2 Q
 .S ^XTMP("APCLNJ1",APCLJOB,APCLBT,APCLNAME,APCLDFN,APCLVDT,APCLVDFN,X)=""
 .Q
 Q