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

APCLNJ21.m

Go to the documentation of this file.
APCLNJ21 ; IHS/CMI/LAB - PRINT CLINIC VISITS (CALC) ;
 ;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
 ;
 ;cmi/anch/maw 9/10/2007 code set versioning in POV
 ;
CALC ;find visits by date then store by patient name
 D XTMP^APCLOSUT("APCLNJ2","PCC INJURY REPORT 2")
 ;
 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,U,5)=""
 G VST1:$P(APCLSTR,U,6)=""
 G VST1:$P(APCLSTR,U,7)=""
 G VST1:$P(APCLSTR,U,3)=""
 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 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  S %=$P(^AUPNVPOV(X,0),U) I $$INJ^APCDAPOV(%,1)!($$INJ^APCDAPOV(%,30)) D  ;cmi/anch/maw 9/10/2007 csv
 .S APCLGOT=0
 .S APCLCIEN=$P($G(^AUPNVPOV(X,0)),U,9)
 .Q:'$D(APCLCIEN)
 .S APCLALC=$P($G(^AUPNVPOV(X,0)),U,7)
 .F APCLX=1:1:18 S Y="TAX"_APCLX S APCLY=$T(@Y) Q:APCLGOT  D  S:'$D(APCLCNTR(APCLX,APCLZ)) APCLCNTR(APCLX,APCLZ)="0^0"
 ..S APCLTXN=$P(APCLY,";;",3)
 ..S APCLZ=$P(APCLY,";;",2)
 ..S APCLTAX=$O(^ATXAX("B",APCLTXN,0))
 ..S %=$$ICD^ATXAPI(APCLCIEN,APCLTAX,9)
 ..Q:'%
 ..S APCLGOT=1
 ..S:'$D(APCLCNTR(APCLX,APCLZ)) APCLCNTR(APCLX,APCLZ)="0^0"
 ..S $P(APCLCNTR(APCLX,APCLZ),U)=$P(APCLCNTR(APCLX,APCLZ),U)+1
 ..I APCLALC=2 S $P(APCLCNTR(APCLX,APCLZ),U,2)=$P(APCLCNTR(APCLX,APCLZ),U,2)+1
 ..I '$D(APCLGTOT) S APCLGTOT=0
 ..S APCLGTOT=APCLGTOT+1
 ..I '$D(APCLATOT) S APCLATOT=0
 ..I APCLALC=2 S APCLATOT=APCLATOT+1
 ..Q
 .Q
 ;I APCLGOT=0 S APCLNONE=1
 Q
 ;
TAX1 ;;MOTOR VEHICLE;;APCL INJ MOTOR
TAX2 ;;WATER TRANSPORT;;APCL INJ WATER TRANSPORT
TAX3 ;;AIR TRANSPORT;;APCL INJ AIR TRANSPORT
TAX4 ;;ACCIDENTAL POISONING;;APCL INJ POISONING
TAX5 ;;ACCIDENTAL FALLS;;APCL INJ FALLS
TAX6 ;;FIRES/FLAMES;;APCL INJ FIRE
TAX7 ;;ENVIRONMENTAL FACTORS;;APCL INJ ENVIRONMENTAL FACTORS
TAX8 ;;STINGS/VENOMS;;APCL INJ STINGS VENOMS
TAX9 ;;ANIMAL RELATED;;APCL INJ ANIMAL RELATED
TAX10 ;;DROWN/SUBMERGE;;APCL INJ DROWNING
TAX11 ;;CUT PIERCING OBJ;;APCL INJ CUT
TAX12 ;;FIREARMS;;APCL INJ FIREARMS
TAX13 ;;SPORTS INJURY;;APCL INJ SPORTS
TAX14 ;;SUICIDE ATTEMPTS;;APCL INJ SUICIDE
TAX15 ;;ASSAULTS;;APCL INJ ASSAULTS
TAX16 ;;BATTERED CHILD;;APCL INJ BATTERED CHILD
TAX17 ;;UNDETERMINED;;APCL INJ UNDETERMINED
TAX18 ;;OTHER CAUSES;;APCL INJ OTHER CAUSES