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

BCHRL1.m

Go to the documentation of this file.
BCHRL1 ; IHS/CMI/LAB - PROCESS CHR RECORD LIST ; 
 ;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
 ;IHS/CMI/LAB - tmp to xtmp
 ;
 ;
 ;
START ;
 D XTMP^BCHUTIL("BCHRL","CHR GENERAL RETRIEVAL")
 S (BCHBT,BCHBTH)=$H,BCHJOB=$J,BCHRCNT=0
 S BCHPROC=BCHPTVS_BCHTYPE
 I $D(BCHRDTR),BCHPTVS="P" D VD,END Q
 D @BCHPROC,END
 Q
 ;
VS ;run by search template
 S BCHR=0 F  S BCHR=$O(^DIBT(BCHSEAT,1,BCHR)) Q:BCHR'=+BCHR  I $D(^BCHR(BCHR,0)),$P(^(0),U,9),'$P(^(0),U,11) S BCHR0=^BCHR(BCHR,0),DFN=$P(BCHR0,U,4) D PROC,EOJ
 Q
VD ; Run by visit date
 S X1=BCHBD,X2=-1 D C^%DTC S BCHSD=X
 S BCHODAT=BCHSD_".9999" F  S BCHODAT=$O(^BCHR("B",BCHODAT)) Q:BCHODAT=""!((BCHODAT\1)>BCHED)  D V1
 Q
 ;
PP ;
 S BCHR=0 F  S BCHR=$O(^DPT(BCHR)) Q:BCHR'=+BCHR  I '$P(^DPT(BCHR,0),U,19) S DFN=BCHR D PROC
 Q
 ;
PS ;
 S BCHR=0 F  S BCHR=$O(^DIBT(BCHSEAT,1,BCHR)) Q:BCHR'=+BCHR  I $D(^DPT(BCHR,0)),'$P(^(0),U,19) S DFN=BCHR D PROC,EOJ
 Q
 ;
 ;
END ;
 S BCHET=$H
 D EOJ
 Q
EOJ ;
 Q
V1 ;
 S BCHR="" F  S BCHR=$O(^BCHR("B",BCHODAT,BCHR)) Q:BCHR'=+BCHR  I $D(^BCHR(BCHR,0)),$P(^(0),U,2)]"",$P(^(0),U,3)]"" S BCHR0=^BCHR(BCHR,0),DFN=$P(BCHR0,U,4) D PROC,EOJ
 Q
PROC ;
 S BCHR11=$G(^BCHR(BCHR,11)),BCHR12=$G(^BCHR(BCHR,12)),BCHR13=$G(^BCHR(BCHR,13))
 I BCHPTVS="P",DFN="" Q
 D SCREENS
 Q:$D(BCHSKIP)
 K BCHSRT,BCHPRNT S BCHCRIT=BCHSORT,BCHX=0 X:$D(^BCHSORT(BCHSORT,5)) ^BCHSORT(BCHSORT,5) I '$D(BCHPRNT) D
 . I BCHPTVS="V" S Y=$P($P(BCHR0,U),".") D DD^%DT S BCHPRNT=Y Q
 . S BCHPRNT=$P(^DPT(DFN,0),U)
 . Q
 S BCHSRT=BCHPRNT I BCHSRT="" S BCHSRT="??"
 I '$D(BCHRDTR) S ^XTMP("BCHRL",BCHJOB,BCHBTH,"DATA HITS",BCHSRT,BCHR)="",BCHRCNT=BCHRCNT+1
 I $D(BCHRDTR) S ^XTMP("BCHRL",BCHJOB,BCHBTH,"DATA HITS",BCHSRT,DFN)="",BCHRCNT=BCHRCNT+1
 Q:'$G(DFN)
 Q:$D(^XTMP("BCHRL",BCHJOB,BCHBTH,"PATIENTS",DFN))
 S ^XTMP("BCHRL",BCHJOB,BCHBTH,"PATIENTS",DFN)="",BCHPTCT=BCHPTCT+1
 Q
SCREENS ;
 K BCHSKIP
 S BCHI=0 F  S BCHI=$O(^BCHTRPT(BCHRPT,11,BCHI)) Q:BCHI'=+BCHI!($D(BCHSKIP))  D
 .I '$P(^BCHSORT(BCHI,0),U,8) D SINGLE Q
 .D MULT
 .Q
 Q
SINGLE ;
 K X,BCHSPEC S X="",BCHX=0
 X:$D(^BCHSORT(BCHI,1)) ^(1)
 I X="" S BCHSKIP="" Q
 I '$D(BCHSPEC),'$D(^BCHTRPT(BCHRPT,11,BCHI,11,"B",X)) S BCHSKIP="" Q
 Q
MULT ;
 K BCHFOUN,BCHSKIP,BCHSPEC,X S BCHX=0,X=""
 X:$D(^BCHSORT(BCH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