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

BMCTEN1.m

Go to the documentation of this file.
BMCTEN1 ; IHS/PHXAO/TMJ - TOP TEN POVS ;  
 ;;4.0;REFERRED CARE INFO SYSTEM;**3,9**;JAN 09, 2006;Build 101
 ;4.0*3 10.30.2007 IHS/OIT/FCJ ADDED CSV CHANGES
 ;4.0*9 11.6.2012 IHS.OIT.FCJ ADDED ICD-10 CHANGE
 ;
VISIT ;
 S BMCJOB=$J,BMCBT=$H
 K ^XTMP("BMCTEN",BMCJOB,BMCBT)
 D XTMP^BMCOSUT("BMCTEN","RCIS TOP TEN DX REPORT")
 S %="^XTMP(""BMCTEN"",BMCJOB,BMCBT,",BMCA=%_"""POV"",BMCPOV)",BMCB=%_"""APC"",BMCAPC)",BMCC=%_"1)",BMCE=%_"2)",BMCF=%_"3)",BMCG=%_"4)",BMCTOT=0,BMCVTOT=0,BMCLINO=0
 S BMCBD=BMCBD-.00001
 F BMCDATE=BMCBD:0 S BMCDATE=$O(^BMCREF("B",BMCDATE)) Q:'BMCDATE  Q:(BMCDATE\1)>BMCED  F BMCVIEN=0:0 S BMCVIEN=$O(^BMCREF("B",BMCDATE,BMCVIEN)) Q:'BMCVIEN  I $D(^BMCREF(BMCVIEN,0)),$D(^BMCDX("AD",BMCVIEN)) D CK
 D SET
 S BMCET=$H
 Q
 ;
CK ;
 S BMCRREC=^BMCREF(BMCVIEN,0),DFN=$P(BMCRREC,U,3)
 Q:$P($G(^BMCREF(BMCVIEN,1)),U)'=""  ;IHS/OIT/FCJ SEC REF NOT INCLUDED
 S BMCREF=BMCVIEN D SCREENS ;IHS/OIT/FCJ SCREENS USE BMCREF AS REF IEN
 Q:$D(BMCSKIP)
POV S BMCPOVN="",BMCVTOT=BMCVTOT+1,BMCCC=0
 F  S BMCPOVN=$O(^BMCDX("AD",BMCVIEN,BMCPOVN)) Q:'BMCPOVN  Q:'$D(^BMCDX(BMCPOVN,0))  S BMCPOV=+^(0),BMCCC=BMCCC+1,BMCPREC=^(0) D POVX
 Q
 ;
POVX I '$D(^ICD9($P(BMCPREC,U))) Q
 I $D(BMCPRIM),$P(BMCPREC,U,5)'="P" Q
 I $D(BMCPRIM),BMCCC>1 Q
 S BMCTOT=BMCTOT+1
 S BMCDOS=$$AVDOS^BMCRLU(BMCVIEN,"N")            ;BMC*4.0*9
 ;4.0*3 10.30.2007 IHS/OIT/FCJ ADDED CSV CHANGES NXT 2 LINES;4.0*9 11.6.2012 IHS.OIT.FCJ CHG FOR ICD-10
 ;S %=$P(^ICD9(BMCPOV,0),U,5) K BMCAPC I % S BMCAPC=%
 ;S %=$P($$ICDDX^ICDCODE(BMCPOV,0),U,6) K BMCAPC I % S BMCAPC=%
 S %=$P($$ICDDX^ICDEX(BMCPOV,BMCDOS,,"I"),U,6) K BMCAPC I % S BMCAPC=%
 F X=BMCA,BMCB D UTL
 Q
 ;
SCREENS ;
 K BMCSKIP
 S BMCI=0 F  S BMCI=$O(^BMCRTMP(BMCRPT,11,BMCI)) Q:BMCI'=+BMCI!($D(BMCSKIP))  D
 .I '$P(^BMCTSORT(BMCI,0),U,8) D SINGLE Q
 .D MULT
 .Q
 Q
SINGLE ;
 K X,BMCSPEC S X="",BMCX=0
 X:$D(^BMCTSORT(BMCI,1)) ^(1)
 I X="" S BMCSKIP="" Q
 I '$D(BMCSPEC),'$D(^BMCRTMP(BMCRPT,11,BMCI,11,"B",X)) S BMCSKIP="" Q
 Q
MULT ;
 K BMCFOUN,BMCSKIP,BMCSPEC,X S BMCX=0,X=""
 X:$D(^BMCTSORT(BMCI,1)) ^(1)
 I $O(X(""))="" S BMCSKIP="" Q
 I '$D(BMCSPEC) S Y="" F  S Y=$O(X(Y)) Q:Y=""  I $D(^BMCRTMP(BMCRPT,11,BMCI,11,"B",Y)) S BMCFOUN="" Q
 I $D(BMCSPEC),$D(X) S BMCFOUN=1 Q
 S:'$D(BMCFO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