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

BMCRR201.m

Go to the documentation of this file.
BMCRR201 ; IHS/PHXAO/TMJ - PROCESS REFERRAL LIST ;   
 ;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
 ;IHS/ITSC/FCJ ADDED TEST FOR COMMENT TYPE
 ;IHS/ITSC/FCJ ADDED TEST FOR SR
 ;
START ;
 S (BMCBT,BMCBTH)=$H,BMCJOB=$J,BMCRCNT=0
 D PROCESS,END
 Q
 ;
PROCESS ;
 S BMCODAT=$O(^BMCCOM("B",BMCSD)) I BMCODAT="" S BMCET=$H Q
 S BMCODAT=BMCSD_".9999" F  S BMCODAT=$O(^BMCCOM("B",BMCODAT)) Q:BMCODAT=""!((BMCODAT\1)>BMCED)  D R1
 Q
 ;
R1 ;
 S BMCRDT="" F  S BMCRDT=$O(^BMCCOM("B",BMCODAT,BMCRDT)) Q:BMCRDT'=+BMCRDT  S BMCRREC=^BMCCOM(BMCRDT,0) D PROC
 Q
END ;
 S BMCET=$H
 Q
PROC ;
 Q:'$D(^BMCCOM(BMCRDT,0))
 Q:$P(^BMCCOM(BMCRDT,0),U,5)'="C"
 S BMCRREC=^BMCCOM(BMCRDT,0),DFN=$P(BMCRREC,U,2),BMCDATE=$P(BMCRREC,U,1)
 S BMCREF=$P(BMCRREC,U,3)
 S BMCREVP=$P(BMCRREC,U,4)
 ;
 Q:$P(^BMCREF(BMCREF,0),U,4)="N"
 Q:$P(^BMCREF(BMCREF,0),U,5)'=BMCFAC
 Q:$P($G(^BMCREF(BMCREF,1)),U)'=""  ;TEST FOR SR
 I BMCCREV'=0,(BMCCREV'=BMCREVP) Q
 S ^XTMP("BMCRR20",BMCJOB,BMCBTH,"DATA HITS",BMCDATE,$P(^DPT(DFN,0),U),BMCRDT)="",BMCRCNT=BMCRCNT+1
 Q