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

BMCFREQ1.m

Go to the documentation of this file.
BMCFREQ1 ; IHS/PHXAO/TMJ - TOP FPR PRCS ;  
 ;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
VISIT ;
 S BMCJOB=$J,BMCBT=$H
 K ^XTMP("BMCFPR",BMCJOB,BMCBT)
 D XTMP^BMCOSUT("BMCFPR","PCC - FREQ PROC")
 S %="^XTMP(""BMCFPR"",BMCJOB,BMCBT,",BMCA=%_"""PRC"",BMCPRC)",BMCD=%_"1)",BMCF=%_"3)",BMCTOT=0,BMCVTOT=0,BMCLINO=0,BMCGTOT=0
 S BMCDATE=BMCBD-.00001
 F  S BMCDATE=$O(^BMCREF("B",BMCDATE)) Q:'BMCDATE  Q:(BMCDATE\1)>BMCED  D
 .F BMCVIEN=0:0 S BMCVIEN=$O(^BMCREF("B",BMCDATE,BMCVIEN)) Q:'BMCVIEN  S BMCGTOT=BMCGTOT+1 I $D(^BMCREF(BMCVIEN,0)),$D(^BMCPX("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
 D SCREENS
 Q:$D(BMCSKIP)
PRC S BMCPRCN="",BMCVTOT=BMCVTOT+1,BMCC=0
 F  S BMCPRCN=$O(^BMCPX("AD",BMCVIEN,BMCPRCN)) Q:'BMCPRCN  Q:'$D(^BMCPX(BMCPRCN,0))  S BMCPRC=+^(0),BMCC=BMCC+1,BMCPREC=^(0) D PRCX
 Q
 ;
PRCX I '$D(^ICPT($P(BMCPREC,U))) Q
 S BMCTOT=BMCTOT+1
 F X=BMCA D UTL
 Q
 ;
UTL ;I X=B,'$D(BMCAPC) Q
 I '$D(@X) S @X=0
 S %=@X,%=%+1,@X=%
 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
SET F BMCPRC=0:0 S BMCPRC=$O(@BMCA) Q:'BMCPRC  S %=^(BMCPRC),@BMCD@(9999999-%,BMCPRC)=""
S1 S (X,I)=0 F  S X=$O(@BMCD@(X)) Q:'X  F Y=0:0 S Y=$O(@BMCD@(X,Y)) Q:'Y  S I=I+1,@BMCF@(I)=Y I I=BMCLNO G S3
S3 Q
 ;
 ;
FF I IOST["P-" W:$D(IOF) @IOF Q
 I $E(IOST)="C",IO=IO(0),$Y>(IOSL-4) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S X="^"
 W:$D(IOF) @IOF
 Q
 ;