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

BMCSEL.m

Go to the documentation of this file.
BMCSEL ; IHS/PHXAO/TMJ - FY PO COST ANALYSIS PROCESS ROUTINE ;  
 ;;4.0;REFERRED CARE INFO SYSTEM;**3**;JAN 09, 2006;Build 101
 ;4.0*3 10.30.2007 IHS/OIT/FCJ ADDED CSV CHANGES
 ;
VISIT ;
 S BMCJOB=$J,BMCBT=$H
 K ^XTMP("BMCFY",BMCJOB,BMCBT)
 D XTMP^BMCOSUT("BMCFY","PCC TOP FY DX REPORT")
 S %="^XTMP(""BMCFY"",BMCJOB,BMCBT,",BMCA=%_"""POV"",BMCPOV)",BMCB=%_"""APC"",BMCAPC)",BMCC=%_"1)",BMCE=%_"2)",BMCF=%_"3)",BMCG=%_"4)",BMCTOT=0,BMCRTOT=0,BMCLINO=0
 ;S BMCBD=BMCBD-.00001
 F BMCDATE=BMCBD:0 S BMCDATE=$O(^BMCREF("B",BMCDATE)) Q:'BMCDATE  Q:(BMCDATE\1)>BMCED  F BMCRIEN=0:0 S BMCRIEN=$O(^BMCREF("B",BMCDATE,BMCRIEN)) Q:'BMCRIEN  I $D(^BMCREF(BMCRIEN,0)),$D(^BMCREF(BMCRIEN,41,0)) D CK
 D SET
 S BMCET=$H
 Q
 ;
CK ;
 S BMCRREC=^BMCREF(BMCRIEN,0),DFN=$P(BMCRREC,U,5)
 Q:$P(BMCRREC,U,4)'="C"  ;Quit if NOT a CHS Type Referral
 ;Q:$P(^BMCREF(BMCRIEN,11,BMCPOVN),U,11)'=BMCLNO
 ;Q:'$P(BMCRREC,U,9)
 ;Q:$P(BMCRREC,U,11)
 D SCREENS
 Q:$D(BMCSKIP)
POV S BMCPOVN="",BMCRTOT=BMCRTOT+1,BMCCC=0
 F  S BMCPOVN=$O(^BMCREF(BMCRIEN,41,0)) Q:'BMCPOVN  Q:'$D(^BMCREF(BMCRIEN,41,BMCPOVN,0))  S BMCPOV=+^(0),BMCCC=BMCCC+1,BMCPREC=^(0) D POVX
 Q
 ;
POVX Q  ;Quit - This isn't DX Code Conversion
 I $D(BMCPRIM),$P(BMCRREC,U,7)="H",$P(BMCPREC,U,12)'="P" Q
 I $D(BMCPRIM),BMCCC>1 Q
 S BMCTOT=BMCTOT+1
 ;4.0*3 10.30.2007 IHS/OIT/FCJ ADDED CSV CHANGES NXT 2 LINES
 ;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=%
 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(BMCFOUN) BMCSKIP=""
 Q
UTL I X=BMCB,'$D(BMCAPC) Q
 I '$D(@X) S @X=0
 S %=@X,%=%+1,@X=%
 Q
 ;
SET F BMCPOV=0:0 S BMCPOV=$O(@BMCA) Q:'BMCPOV  S %=^(BMCPOV),@BMCC@(9999999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