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

APCLOSP3.m

Go to the documentation of this file.
APCLOSP3 ; IHS/CMI/LAB - AMB PRINT ;
 ;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
 ;
 ;
POV ;
 I $Y>(IOSL-15) D HEAD^APCLOSP Q:$D(APCLQUIT)
 S APCL1="AMBPOV",APCL2="AMBPOVC",APCLMAX=10,APCLGLOB="^ICD9(",APCLPIEC=3
 W !!,"The ten leading purposes of ambulatory visits by individual ICD Code are listed",!,"below.  Both primary and secondary diagnoses are included in the counts.",!
 ;I APCLEXCL,$O(APCLDXT(0)) W "NOTE:  These ICD-9 diagnoses have been excluded from this list" S X=0 F  S X=$O(APCLDXT(X)) Q:X'=+X  W ":",$P(^ICD9(X,0),U)  ;cmi/anch/maw 9/10/2007 orig line
 I APCLEXCL,$O(APCLDXT(0)) W "NOTE:  These ICD diagnoses have been excluded from this list" S X=0 F  S X=$O(APCLDXT(X)) Q:X'=+X  W ":",$P($$ICDDX^ICDEX(X),U,2)  ;cmi/anch/maw 9/10/2007 csv
 W !?11,"By ICD Diagnosis"
 D PROC
APC ;
 G CHART  ;no longer do apc groupings
 I $Y>(IOSL-12) D HEAD^APCLOSP Q:$D(APCLQUIT)
 S APCL1="AMBAPC",APCL2="AMBAPCC",APCLMAX=10,APCLGLOB="^AUTTRCD(",APCLPIEC=3
 W !!?11,"By APC Code"
 D PROC
CHART ;
 I $Y>(IOSL-7) D HEAD^APCLOSP Q:$D(APCLQUIT)
 W !!,"CHART REVIEWS"
 I '$D(^XTMP("APCLOS",APCLJOB,APCLBTH,"CHART REVIEWS")),'$D(^XTMP("APCLOSP",APCLJOB,APCLBTH,"CHART REVIEWS")) W !?10,"[ NO CHART REVIEWS TO REPORT ]",! G INJURY
 S X=$S($D(^XTMP("APCLOS",APCLJOB,APCLBTH,"CHART REVIEWS")):^("CHART REVIEWS"),1:0),Y=$S($D(^XTMP("APCLOSP",APCLJOB,APCLBTH,"CHART REVIEWS")):^("CHART REVIEWS"),1:0) D CALC^APCLOSUT
 W !!,"There were ",X," (",Z,") chart reviews performed during this time period.",!
INJURY ;
 I $Y>(IOSL-8) D HEAD^APCLOSP Q:$D(APCLQUIT)
 S APCL1="AMBINJCAUSE",APCL2="AMBINJCAUSEC",APCLMAX=5,APCLGLOB="^ICD9(",APCLPIEC=3
 W !!!,"INJURIES"
 I '$D(^XTMP("APCLOS",APCLJOB,APCLBTH,"INJCOUNT")) W !?10,"[ NO INJURY DATA TO REPORT ]",! G ER
 S X=$S($D(^XTMP("APCLOS",APCLJOB,APCLBTH,"INJCOUNT")):^("INJCOUNT"),1:0),Y=$S($D(^XTMP("APCLOSP",APCLJOB,APCLBTH,"INJCOUNT")):^("INJCOUNT"),1:0) D CALC^APCLOSUT
 I $Y>(IOSL-9) D HEAD^APCLOSP Q:$D(APCLQUIT)
 W !!,"There were ",X," visits for injuries (",Z,") reported during this period.",!,"Of these, "
 S X=$S($D(^XTMP("APCLOS",APCLJOB,APCLBTH,"INJFIRST")):^XTMP("APCLOS",APCLJOB,APCLBTH,"INJFIRST"),1:0),Y=$S($D(^XTMP("APCLOSP",APCLJOB,APCLBTH,"INJFIRST")):^("INJFIRST"),1:0) D CALC^APCLOSUT
 W X," were new injuries (",Z,").  The five leading causes were:"
 D PROC
ER ;
 I $Y>(IOSL-6) D HEAD^APCLOSP Q:$D(APCLQUIT)
 W !!!,"EMERGENCY ROOM"
 I '$D(^XTMP("APCLOS",APCLJOB,APCLBTH,"ERCOUNT")) W !?10,"[ NO EMERGENCY ROOM VISITS TO REPORT ]",! G DENTAL
 S X=$S($D(^XTMP("APCLOS",APCLJOB,APCLBTH,"ERCOUNT")):^("ERCOUNT"),1:0),Y=$S($D(^XTMP("APCLOSP",APCLJOB,APCLBTH,"ERCOUNT")):^("ERCOUNT"),1:0) D CALC^APCLOSUT
 W !!,"There were ",X," visits (",Z,") to the ER (Clinic Code=30).  Of these "
 S X=$S($D(^XTMP("APCLOS",APCLJOB,APCLBTH,"ERINJCOUNT")):^("ERINJCOUNT"),1:0),Y=$S($D(^XTMP("APCLOSP",APCLJOB,APCLBTH,"ERINJCOUNT")):^("ERINJCOUNT"),1:0) D CALC^APCLOSUT
 W !,X," had an injury diagnosis (",Z,") and "
 S X=$S($D(^XTMP("APCLOS",APCLJOB,APCLBTH,"ERALCHCOUNT")):^("ERALCHCOUNT"),1:0),Y=$S($D(^XTMP("APCLOSP",APCLJOB,APCLBTH,"ERALCHCOUNT")):^("ERALCHCOUNT"),1:0) D CALC^APCLOSUT
 W X," had an alcohol-related",!,"diagnosis (",Z,")."
DENTAL ;
 D DENTAL^APCLOSP4
 I '$D(^XTMP("APCLOS",APCLJOB,APCLBTH,"DENTPATCOUNT")) Q
 D PROC
 Q
PROC S (APCLC,APCLN)=0 F  S APCLN=$O(^XTMP("APCLOS",APCLJOB,APCLBTH,APCL2,APCLN)) Q:APCLN=""!(APCLC=APCLMAX)  D PROC1
 Q
PROC1 ;
 S APCLD=0 F  S APCLD=$O(^XTMP("APCLOS",APCLJOB,APCLBTH,APCL2,APCLN,APCLD)) Q:APCLD=""!(APCLC=APCLMAX)  D PROC2
 Q
PROC2 ;
 S APCLC=APCLC+1
 S X=^XTMP("APCLOS",APCLJOB,APCLBTH,APCL2,APCLN,APCLD)
 S APCLPD=0 F  S APCLPD=$O(^XTMP("APCLOSP",APCLJOB,APCLBTH,APCL1,APCLPD)) Q:APCLD=APCLPD!(APCLPD="")
 S Y=$S(APCLPD]"":^XTMP("APCLOSP",APCLJOB,APCLBTH,APCL1,APCLPD),1:0) D CALC^APCLOSUT
 S G=APCLGLOB_APCLD_")"
 I APCL2'="AMBPOVC",APCL2'="AMBINJCAUSEC" W !?5,APCLC,").  ",?10,$E($P(@G@(0),U,APCLPIEC),1,35),?45,$J(X,7),?56,"(",Z,")" Q
 W !?5,APCLC,").  ",?10,$E($P($$ICDDX^ICDEX(APCLD),U,4),1,35),?45,$J(X,7),?56,"(",Z,")"
 Q