183 lines
7.4 KiB
Mathematica
183 lines
7.4 KiB
Mathematica
|
SPNAGGU ;SD/CM- AGGREGATE OUTCOME REPORT UTILITIES; 2-21-2003
|
||
|
;;2.0;Spinal Cord Dysfunction;**20,21**;01/02/97
|
||
|
;
|
||
|
INPT ;SPNLSTDT=Last date of ASIA HIGHEST NEURO LEVEL (most recent)
|
||
|
;SPNSEVC =Count of unique pts in diag category of 'severe'
|
||
|
;SPNMODC = " " " " " " " " 'moderate'
|
||
|
;SPNPARC = " " " " " " " " 'para'
|
||
|
;SPNLOWC = " " " " " " " " 'low'
|
||
|
;SPNDIAGC=Total count of unique pts over all diag categories
|
||
|
;SPNDCS =Set to 1 if diag category criteria for 'severe' are met
|
||
|
;SPNDCM =Set to 1 if diag category criteria for 'moderate' are met
|
||
|
;SPNDCP =Set to 1 if diag category criteria for 'para' are met
|
||
|
;SPNDCL =Set to 1 if diag category criteria for 'low' are met
|
||
|
;SPNAGES =Cumulative Age in Severe, SPNAGEM=Cum. Age in Moderate, etc
|
||
|
;BMAS =Base Minimum Age Severe, BMAM=Base Minimum Age Moderate, etc
|
||
|
;AGESC =Age Range Severe Count, AGEMC=Age Range Moderate Count, etc
|
||
|
;MINAGES =Minimum Age Severe, MINAGEM=Minimum Age Moderate, etc
|
||
|
;BHAS =Base Maximum Age Severe, BHAM=Base Maximum Age Moderate, etc
|
||
|
;MAXAGES =Maximum Age Severe, MAXAGEM=Maximum Age Moderate, etc
|
||
|
;AGEL =Low value of Age range, AGEH=High value of Age range
|
||
|
;SPNSEXS =No. of Male pts in Severe, SPNSEXM=No. Male in Moderate, etc
|
||
|
;SPNLORS =Cumulative Length of Rehab Severe, SPNLORM=Cum. LOR Mod, etc
|
||
|
;BMLS =Base Minimum LOR Severe, BMLM=Base Minimum LOR Moderate, etc
|
||
|
;LORSC =Length of Rehab Severe Count, LORMC=LOR Moderate Count, etc
|
||
|
;MINLORS =Minimum LOR Severe, MINLORM=Minimum LOR Moderate, etc
|
||
|
;BHLS =Base Maximum LOR Severe, BHLM=Base Maximum LOR Moderate, etc
|
||
|
;MAXLORS =Maximum LOR Severe, MAXLORM=Maximum LOR Moderate, etc
|
||
|
;LORRN =Length of Rehab record number (node w/ Rehab Finish data)
|
||
|
;LORL =Low value of LOR range, LORH=High value of LOR range
|
||
|
;TFSRN =Total FIM Start record number
|
||
|
;TFS =Total FIM Start score, TFF=Total FIM Finish score
|
||
|
;TFCUMS =Total FIM cumulative change Severe, TFCUMM=Tot FIM ch Mod,etc
|
||
|
;TFCS =Total FIM Count Severe, TFCM=Total FIM Count Moderate, etc
|
||
|
;TFGRN =Total FIM Goal record number
|
||
|
;TFG =Total FIM Goal score
|
||
|
;TFGCUMS =Total FIM Goal cumul change Severe,TFGCUMM=TF Goal ch Mod,etc
|
||
|
;TFGCS =Total FIM Goal Count Severe,TFGCM=Tot FIM Goal Count Mod, etc
|
||
|
;COMDISS =No. of Severe pts w/ DISPOSITION<5, COMDISM=No. Mod pts, etc
|
||
|
;TFURN =Total FIM Follow-Up record number
|
||
|
;TFU =Total FIM Follow-Up score
|
||
|
;TFUCUMS =Total FIM F/U cumul change Severe,TFUCUMM=TF F/U ch Mod, etc
|
||
|
;TFUCS =Total FIM F/U Count Severe,TFUCM=Tot FIM F/U Count Mod, etc
|
||
|
;SLSRN =SWLS Start record number, SLFRN=SWLS Finish record number
|
||
|
;SLS =SWLS Start score
|
||
|
;SLF =SWLS Finish score
|
||
|
;SLCUMS =SWLS cumul change Severe,SLCUMM=SWLS cumul change Mod, etc
|
||
|
;SLCS =SWLS Count Severe,SLCM=Count Moderate, etc
|
||
|
;SLURN =SWLS Follow-Up record number
|
||
|
;SLU =SWLS Follow-Up score
|
||
|
;SLUCUMS =SWLS F/U cumul change Severe,SLUCUMM=SWLS F/U Chng Mod, etc
|
||
|
;SLUCS =SWLS F/U Count Severe,SLUCM=SWLS F/U Count Mod, etc
|
||
|
S U="^"
|
||
|
S SPNDIAGC=0,SPNSEVC=0,SPNMODC=0,SPNPARC=0,S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=0,SLS=0,SLF=0,SLCUMS=0,SLCUMM=0,SLCUMP=0,SLCUML=0
|
||
|
S SLCS=0,SLCM=0,SLCP=0,SLCL=0
|
||
|
S SLU=0,SLURN=0,SLUCUMS=0,SLUCUMM=0,SLUCUMP=0,SLUCUML=0
|
||
|
S SLUCS=0,SLUCM=0,SLUCP=0,SLUCL=0
|
||
|
Q
|
||
|
PARAMS ;
|
||
|
CT ;Care Type
|
||
|
CED ;date range for Care End Date
|
||
|
OIEN ;
|
||
|
DIAGCAT ;
|
||
|
;
|
||
|
MINLORS(SPNPD1) ;
|
||
|
S MAX1=LORCALL
|
||
|
S X=0 F S X=$O(^TMP($J,"SPNLRNS",X)) Q:'+X D
|
||
|
.Q:'$D(^TMP($J,"SPNLRNS",X))
|
||
|
.S MAX2=$P(^TMP($J,"SPNLRNS",X),U,1)
|
||
|
.I MAX2<MAX1 S MAX1=MAX2
|
||
|
.Q
|
||
|
Q MAX1
|
||
|
MAXLORS(SPNPD1) ;
|
||
|
S MAX1=0
|
||
|
S X=0 F S X=$O(^TMP($J,"SPNLRXS",X)) Q:'+X D
|
||
|
.Q:'$D(^TMP($J,"SPNLRXS",X))
|
||
|
.S MAX2=$P(^TMP($J,"SPNLRXS",X),U,1)
|
||
|
.I MAX2>MAX1 S MAX1=MAX2
|
||
|
.Q
|
||
|
Q MAX1
|
||
|
MINLORM(SPNPD1) ;
|
||
|
S MAX1=LORCALL
|
||
|
S X=0 F S X=$O(^TMP($J,"SPNLRNM",X)) Q:'+X D
|
||
|
.Q:'$D(^TMP($J,"SPNLRNM",X))
|
||
|
.S MAX2=$P(^TMP($J,"SPNLRNM",X),U,1)
|
||
|
.I MAX2<MAX1 S MAX1=MAX2
|
||
|
.Q
|
||
|
Q MAX1
|
||
|
MAXLORM(SPNPD1) ;
|
||
|
S MAX1=0
|
||
|
S X=0 F S X=$O(^TMP($J,"SPNLRXM",X)) Q:'+X D
|
||
|
.Q:'$D(^TMP($J,"SPNLRXM",X))
|
||
|
.S MAX2=$P(^TMP($J,"SPNLRXM",X),U,1)
|
||
|
.I MAX2>MAX1 S MAX1=MAX2
|
||
|
.Q
|
||
|
Q MAX1
|
||
|
MINLORP(SPNPD1) ;
|
||
|
S MAX1=LORCALL
|
||
|
S X=0 F S X=$O(^TMP($J,"SPNLRNP",X)) Q:'+X D
|
||
|
.Q:'$D(^TMP($J,"SPNLRNP",X))
|
||
|
.S MAX2=$P(^TMP($J,"SPNLRNP",X),U,1)
|
||
|
.I MAX2<MAX1 S MAX1=MAX2
|
||
|
.Q
|
||
|
Q MAX1
|
||
|
MAXLORP(SPNPD1) ;
|
||
|
S MAX1=0
|
||
|
S X=0 F S X=$O(^TMP($J,"SPNLRXP",X)) Q:'+X D
|
||
|
.Q:'$D(^TMP($J,"SPNLRXP",X))
|
||
|
.S MAX2=$P(^TMP($J,"SPNLRXP",X),U,1)
|
||
|
.I MAX2>MAX1 S MAX1=MAX2
|
||
|
.Q
|
||
|
Q MAX1
|
||
|
MINLORL(SPNPD1) ;
|
||
|
S MAX1=LORCALL
|
||
|
S X=0 F S X=$O(^TMP($J,"SPNLRNL",X)) Q:'+X D
|
||
|
.Q:'$D(^TMP($J,"SPNLRNL",X))
|
||
|
.S MAX2=$P(^TMP($J,"SPNLRNL",X),U,1)
|
||
|
.I MAX2<MAX1 S MAX1=MAX2
|
||
|
.Q
|
||
|
Q MAX1
|
||
|
MAXLORL(SPNPD1) ;
|
||
|
S MAX1=0
|
||
|
S X=0 F S X=$O(^TMP($J,"SPNLRXL",X)) Q:'+X D
|
||
|
.Q:'$D(^TMP($J,"SPNLRXL",X))
|
||
|
.S MAX2=$P(^TMP($J,"SPNLRXL",X),U,1)
|
||
|
.I MAX2>MAX1 S MAX1=MAX2
|
||
|
.Q
|
||
|
Q MAX1
|
||
|
STATS ;finds record with Rehab Finish, so Length of Rehab can be obtained
|
||
|
S LORRN=0,TFSRN=0,TFGRN=0
|
||
|
S V=SPNPD1 F S V=$O(^SPNL(154.1,"B",SPNPD0,V)) Q:'+V D GETLOR
|
||
|
Q
|
||
|
GETLOR ;gets Rec No. for LOR, TFS (TFF is same rec no. as LOR), and TFG
|
||
|
Q:'$D(^SPNL(154.1,V,0))
|
||
|
Q:'+$P(^SPNL(154.1,V,2),U,17)
|
||
|
Q:$P($G(^SPNL(154.1,V,8)),U,3)'=CARETYP
|
||
|
;Q:$P($G(^SPNL(154.1,V,8)),U,2)<BDATE!($P($G(^SPNL(154.1,V,8)),U,2)>EDATE)
|
||
|
I $P(^SPNL(154.1,V,2),U,17)=1,($P(^SPNL(154.1,V,0),U,2)=2) S TFSRN=V
|
||
|
I $P(^SPNL(154.1,V,2),U,17)=2,($P(^SPNL(154.1,V,0),U,2)=2) S TFGRN=V
|
||
|
I $P($G(^SPNL(154.1,V,8)),U,4)'="" S LORRN=V
|
||
|
Q
|
||
|
EXIT ;
|
||
|
K BDATE,EDATE,I,SPNLEXIT,SPNPD0,SPNPD1,SPNLSTDT,SPNDIAGC,SPNSEVC,SPNMODC,SPNPARC,SPNLOWC,SPNSDATE,SPNMDATE,SPNPDATE,SPNLDATE,SPNNODUP,SPNSEXS,SPNSEXM,SPNSEXP,SPNSEXL
|
||
|
K SPNT1,SPNT2,SPNT3,SPNT4,SPNT5,SPNDCS,SPNDCM,SPNDCP,SPNDCL,SPNAGROU
|
||
|
K SPNAGES,SPNAGEM,SPNAGEP,SPNAGEL
|
||
|
K BMAS,BMAM,BMAP,BMAL,BHAS,BHAM,BHAP,BHAL
|
||
|
K AGESC,AGEMC,AGEPC,AGELC,MINAGES,MINAGEM,MINAGEP,MINAGEL
|
||
|
K MAXAGES,MAXAGEM,MAXAGEP,MAXAGEL,CARETYP,LINE
|
||
|
K SPNLORS,SPNLORM,SPNLORP,SPNLORL
|
||
|
K BMLS,BMLM,BMLP,BMLL,BHLS,BHLM,BHLP,BHLL
|
||
|
K LORSC,LORMC,LORPC,LORLC,MINLORS,MINLORM,MINLORP,MINLORL
|
||
|
K MAXLORS,MAXLORM,MAXLORP,MA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