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

APCLCH2S.m

Go to the documentation of this file.
APCLCH2S ; IHS/CMI/LAB - community health profile print ;
 ;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
 ;
 ;cmi/anch/maw 9/10/2007 code set versioning in IL, IS ,IT
 ;
INPT ;EP
PRINT ;
 D HEAD^APCLCH2P Q:$D(APCLQUIT)
IDX ;
 S APCLTYPE="DX"
 D IDXSUB
IL ;
 K APCLL S (APCLX,C)=0 F  S APCLX=$O(^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLLFAC,"INDXC",APCLX)) Q:APCLX=""!(C>14)  D
 .S APCLY=0 F  S APCLY=$O(^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLLFAC,"INDXC",APCLX,APCLY)) Q:APCLY'=+APCLY  D
 ..;S C=C+1,APCLL(C)=$E($P(^ICD9(APCLY,0),U,3),1,20)_"^"_^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLLFAC,"INDXC",APCLX,APCLY)_"^"_$P(^ICD9(APCLY,0),U)  ;cmi/anch/maw 9/10/2007 orig line
 ..S C=C+1,APCLL(C)=$E($P($$ICDDX^ICDEX(APCLY),U,4),1,20)_"^"_^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLLFAC,"INDXC",APCLX,APCLY)_"^"_$P($$ICDDX^ICDEX(APCLY),U,2)  ;cmi/anch/maw 9/10/2007 csv
 S M=C
IS ;
 K APCLS S (APCLX,C)=0 F  S APCLX=$O(^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLSFAC,"INDXC",APCLX)) Q:APCLX=""!(C>14)  D
 .S APCLY=0 F  S APCLY=$O(^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLSFAC,"INDXC",APCLX,APCLY)) Q:APCLY'=+APCLY  D
 ..;S C=C+1,APCLS(C)=$E($P(^ICD9(APCLY,0),U,3),1,20)_"^"_^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLSFAC,"INDXC",APCLX,APCLY)_"^"_$P(^ICD9(APCLY,0),U)  ;cmi/anch/maw 9/10/2007 orig line
 ..S C=C+1,APCLS(C)=$E($P($$ICDDX^ICDEX(APCLY),U,4),1,20)_"^"_^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLSFAC,"INDXC",APCLX,APCLY)_"^"_$P($$ICDDX^ICDEX(APCLY),U,2)  ;cmi/anch/maw 9/10/2007 csv
 S M=C
 S:C>M M=C
IT ;
 K APCLT S (APCLX,C)=0 F  S APCLX=$O(^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLTFAC,"INDXC",APCLX)) Q:APCLX=""!(C>14)  D
 .S APCLY=0 F  S APCLY=$O(^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLTFAC,"INDXC",APCLX,APCLY)) Q:APCLY'=+APCLY  D
 ..;S C=C+1,APCLT(C)=$E($P(^ICD9(APCLY,0),U,3),1,20)_"^"_^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLTFAC,"INDXC",APCLX,APCLY)_"^"_$P(^ICD9(APCLY,0),U)  ;cmi/anch/maw 9/10/2007 orig line
 ..S C=C+1,APCLT(C)=$E($P($$ICDDX^ICDEX(APCLY),U,4),1,20)_"^"_^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLTFAC,"INDXC",APCLX,APCLY)_"^"_$P($$ICDDX^ICDEX(APCLY),U,2)  ;cmi/anch/maw 9/10/2007 csv
 S M=C
 S:C>M M=C
WIDX ;write inpatient diagnoses/pov's
 F APCLI=1:1:M D  Q:$D(APCLQUIT)
 .I $Y>(IOSL-4) D HEAD^APCLCH2P Q:$D(APCLQUIT)  D IDXSUB
 .W !
 .I $D(APCLL(APCLI)) W ?3,$E($P(APCLL(APCLI),U),1,20),?30,"(",$P(APCLL(APCLI),U,3),")",?35,$J($P(APCLL(APCLI),U,2),6)
 .I $D(APCLS(APCLI)) W ?46,$E($P(APCLS(APCLI),U),1,20),?68,"(",$P(APCLS(APCLI),U,3),")",?78,$J($P(APCLS(APCLI),U,2),6)
 .I $D(APCLT(APCLI)) W ?89,$E($P(APCLT(APCLI),U),1,20),?111,"(",$P(APCLT(APCLI),U,3),")",?121,$J($P(APCLT(APCLI),U,2),6)
IDXCAT ;
 S APCLTYPE="CAT"
 I $Y>(IOSL-4) D HEAD^APCLCH2P Q:$D(APCLQUIT)
 W !!! D IDXSUB
ILCAT ;
 K APCLL S (APCLX,C)=0 F  S APCLX=$O(^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLLFAC,"INCATC",APCLX)) Q:APCLX=""!(C>14)  D
 .S APCLY=0 F  S APCLY=$O(^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLLFAC,"INCATC",APCLX,APCLY)) Q:APCLY'=+APCLY  D
 ..S C=C+1,APCLL(C)=$E($P(^ICM(APCLY,0),U),1,30)_"^"_^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLLFAC,"INCATC",APCLX,APCLY)
 S M=C
ISCAT ;
 K APCLS S (APCLX,C)=0 F  S APCLX=$O(^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLSFAC,"INCATC",APCLX)) Q:APCLX=""!(C>14)  D
 .S APCLY=0 F  S APCLY=$O(^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLSFAC,"INCATC",APCLX,APCLY)) Q:APCLY'=+APCLY  D
 ..S C=C+1,APCLS(C)=$E($P(^ICM(APCLY,0),U),1,30)_"^"_^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLSFAC,"INCATC",APCLX,APCLY)
 S:C>M M=C
ITCAT ;
 K APCLT S (APCLX,C)=0 F  S APCLX=$O(^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLTFAC,"INCATC",APCLX)) Q:APCLX=""!(C>14)  D
 .S APCLY=0 F  S APCLY=$O(^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLTFAC,"INCATC",APCLX,APCLY)) Q:APCLY'=+APCLY  D
 ..S C=C+1,APCLT(C)=$E($P(^ICM(APCLY,0),U),1,30)_"^"_^XTMP("APCLCH2",APCLJOB,APCLBTH,"DATA",APCLCOM,APCLTFAC,"INCATC",APCLX,APCLY)
 S:C>M M=C
WOCAT ;write inpatient diagnoses/pov's
 F APCLI=1:1:M D  Q:$D(APCLQUIT)
 .I $Y>(IOSL-4) D HEAD^APCLCH2P Q:$D(APCLQUIT)  D IDXSUB
 .W !
 .I $D(APCLL(APCLI)) W ?3,$E($P(APCLL(APCLI),U),1,30),?35,$J($P(APCLL(APCLI),U,2),6)
 .I $D(APCLS(APCLI)) W ?46,$E($P(APCLS(APCLI),U),1,30),?78,$J($P(APCLS(APCLI),U,2),6)
 .I $D(APCLT(APCLI)) W ?89,$E($P(APCLT(APCLI),U),1,30),?121,$J($P(APCLT(APCLI),U,2),6)
 Q
IDXSUB ;
 S X="INPATIENT "_$S(APCLTYPE="DX":"DIAGNOSES",1:"MAJOR DIAGNOSTIC CATEGORIES") W !,?(132-$L(X)/2),X,!
 W !?8,$P(^DIC(4,APCLLFAC,0),U),?51,$P(^DIC(4,APCLSFAC,0),U),?94,$P(^DIC(4,APCLTFAC,0),U),!
 I APCLTYPE="DX" W !?3,"DIAGNOSIS/POV  (ICD CODES)",?46,"DIAGNOSIS/POV  (ICD CODES)",?89,"DIAGNOSIS/POV  (ICD CODES)",!?3,"-------------",?46,"------------",?89,"------------"
 I APCLTYPE="CAT" W !?3,"DIAGNOSTIC CATEGORY",?46,"DIAGNOSTIC CATEGORY",?89,"DIAGNOSTIC CATEGORY",!?3,"-------------------",?46,"-------------------",?89,"-------------------"
 Q