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

BWGRVL1.m

Go to the documentation of this file.
BWGRVL1 ; IHS/CMI/LAB - PROCESS VISIT LIST ;15-Feb-2003 21:52;PLS
 ;;2.0;WOMEN'S HEALTH;**6,8**;MAY 16, 1996
 ;
 ;
 ;
START ;
 S (BWGRBT,BWGRBTH)=$H,BWGRJOB=$J,BWGRRCNT=0
 D XTMP^BWGRVLU("BWGRVL","WH GENERAL RETRIEVAL")
 D @BWGRTYPE,END
 Q
 ;
RP ;run with search template of patients, visit gen
 S X1=BWGRBD,X2=-1 D C^%DTC S BWGRSD=X
 S BWGRODAT=BWGRSD_".9999" F  S BWGRODAT=$O(^BWPCD("D",BWGRODAT)) Q:BWGRODAT=""!((BWGRODAT\1)>BWGRED)  D VP1
 Q
VP1 ;
 S BWGRVIEN="" F  S BWGRVIEN=$O(^BWPCD("D",BWGRODAT,BWGRVIEN)) Q:BWGRVIEN'=+BWGRVIEN  I $D(^BWPCD(BWGRVIEN,0)) S DFN=$P(^BWPCD(BWGRVIEN,0),U,2) D
 .Q:'$D(^DIBT(BWGRSEAT,1,DFN))  ;quit if patient not in search template
 .D PROC
 .Q
 Q
VV ;run by search template
 S BWGRVIEN=0 F  S BWGRVIEN=$O(^DIBT(BWGRSEAT,1,BWGRVIEN)) Q:BWGRVIEN'=+BWGRVIEN  I $D(^BWPCD(BWGRVIEN,0)) D
 .S X=$P($P(^BWPCD(BWGRVIEN,0),U),".")
 .Q:X>BWGRED
 .Q:X<BWGRBD
 .D PROC
 .Q
 Q
RS ; Run by visit date
 S X1=BWGRBD,X2=-1 D C^%DTC S BWGRSD=X
 S BWGRODAT=BWGRSD_".9999" F  S BWGRODAT=$O(^BWPCD("D",BWGRODAT)) Q:BWGRODAT=""!((BWGRODAT\1)>BWGRED)  D V1
 Q
 ;
PP ;
 S BWGRVIEN=0 F  S BWGRVIEN=$O(^BWP(BWGRVIEN)) Q:BWGRVIEN'=+BWGRVIEN  D PROC
 Q
 ;
PS ;
 S BWGRVIEN=0 F  S BWGRVIEN=$O(^DIBT(BWGRSEAT,1,BWGRVIEN)) Q:BWGRVIEN'=+BWGRVIEN  I $D(^BWP(BWGRVIEN,0)) D PROC
 Q
 ;
 ;
END ;
 S BWGRET=$H
 Q
V1 ;
 S BWGRVIEN="" F  S BWGRVIEN=$O(^BWPCD("D",BWGRODAT,BWGRVIEN)) Q:BWGRVIEN'=+BWGRVIEN  I $D(^BWPCD(BWGRVIEN,0)) D PROC
 Q
PROC ;
 K BWGRSPEC,BWGRVREC,BWGRPREC,DFN
 I BWGRPTVS="R" S BWGRVREC=^BWPCD(BWGRVIEN,0),DFN=$P(BWGRVREC,U,2)
 I BWGRPTVS="P" S DFN=BWGRVIEN,BWGRVREC=""
 S BWGRPREC=^BWP(DFN,0)
 D SCREENS
 Q:$D(BWGRSKIP)
 K BWGRSRT,BWGRPRNT S BWGRCRIT=BWGRSORT,BWGRX=0
 X:$D(^BWGRI(BWGRSORT,4)) ^BWGRI(BWGRSORT,4) I '$D(BWGRPRNT) D
 . I BWGRPTVS="R" S Y=$P($P(BWGRVREC,U),".") S BWGRPRNT=Y Q
 . S BWGRPRNT=$P(^DPT(DFN,0),U)
 .Q
 S BWGRSRT=BWGRPRNT
 D SUBPAT
 S ^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"DATA HITS",BWGRSRT,BWGRVIEN)="",BWGRRCNT=BWGRRCNT+1
 Q:$D(^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"PATIENTS",DFN))
 S ^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"PATIENTS",DFN)="",BWGRPTCT=BWGRPTCT+1
 Q
SUBPAT ;tally # of patients by sort value on detailed/subtotal
 Q:BWGRCTYP="C"
 Q:BWGRCTYP="F"
 Q:BWGRCTYP="T"
 S:$G(BWGRSRT)="" BWGRSRT="????"
 Q:$D(^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"SUB PATIENT HIT",BWGRSRT,DFN))
 S:'$D(^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"SUB PAT COUNT",BWGRSRT)) ^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"SUB PAT COUNT",BWGRSRT)=0
 S ^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"SUB PAT COUNT",BWGRSRT)=^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"SUB PAT COUNT",BWGRSRT)+1
 Q:$D(^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"SUB PATIENT HIT",BWGRSRT,DFN))
 S ^XTMP("BWGRVL",BWGRJOB,BWGRBTH,"SUB PATIENT HIT",BWGRSRT,DFN)=""
 Q
SCREENS ;
 K BWGRSKIP
 S BWGRI=0 F  S BWGRI=$O(^BWGRTRPT(BWGRRPT,11,BWGRI)) Q:BWGRI'=+BWGRI!($D(BWGRSKIP))  D
 .I '$P(^BWGRI(BWGRI,0),U,8) D SINGLE Q
 .D MULT
 .Q
 Q
SINGLE ;
 K X,BWGRSPEC S X="",BWGRX=0
 X:$D(^BWGRI(BWGRI,1)) ^(1)
 I X="" S BWGRSKIP="" Q
 I '$D(BWGRSPEC),'$D(^BWGRTRPT(BWGRRPT,11,BWGRI,11,"B",X)) S BWGRSKIP="" Q
 Q
MULT ;
 K BWGRFOUN,BWGRSKIP,BWGRSPEC,X S BWGRX=0,X=""
 X:$D(^BWGRI(BWGRI,1)) ^(1)
 I $O(X(""))="" S BWGRSKIP="" Q
 I '$D(BWGRSPEC) S Y="" F  S Y=$O(X(Y)) Q:Y=""  I $D(^BWGRTRPT(BWGRRPT,11,BWGRI,11,"B",Y)) S BWGRFOUN="" Q
 I $D(BWGRSPEC),$G(X) S BWGRFOUN=1 Q
 S:'$D(BWGRFOUN) BWGRSKIP=""
 Q
XIT ;EP - CALLED FROM BWGRVL
 D EN^XBVK("BWGR"),EN^XBVK("AMQQ"),EN^XBVK("AUPN")
XIT1 ;EP
 K BW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