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

BCHRP31.m

Go to the documentation of this file.
BCHRP31 ; IHS/CMI/LAB - PROCESS REPORT ; 
 ;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
 ;IHS/CMI/LAB - tmp to xtmp
 ;
 ;
 ;
 ;
START ;
 D XTMP^BCHUTIL("BCHRP3","CHR ACTIVITY REPORT")
 S (BCHBT,BCHBTH)=$H,BCHJOB=$J
 D D,END
 Q
 ;
D ; Run by date of service
 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 D1
 Q
 ;
END ;
 S BCHET=$H
 D EOJ
 Q
EOJ ;
 Q
D1 ;
 S (BCHR,BCHRCNT)=0 F  S BCHR=$O(^BCHR("B",BCHODAT,BCHR)) Q:BCHR'=+BCHR  I $D(^BCHR(BCHR,0)),$P(^(0),U,2)]"",$P(^(0),U,3)]"",$D(^BCHRPROB("AD",BCHR)) S BCHR0=^BCHR(BCHR,0) D PROC
 Q
PROC ;
 S BCHPAT=$P(BCHR0,U,4)
 S BCHNRPAT=$P($G(^BCHR(BCHR,11)),U,12)
 ;I 'BCHPAT,'BCHNRPAT Q   ;no patient
 I BCHREG="R",BCHPAT="" Q
 I BCHREG="N",BCHNRPAT="" Q
 I BCHPAT,BCHNRPAT S BCHNRPAT=""
 I BCHPAT Q:'$D(^DPT(BCHPAT,0))
 S BCHPROG=$P(BCHR0,U,2),BCHPROGN=$P(^BCHTPROG(BCHPROG,0),U)_" ("_$P(^(0),U,5)_")"
 I BCHPRG,BCHPRG'=BCHPROG Q  ;not correct program
 S BCHLOC=$P(BCHR0,U,6) Q:BCHLOC=""  S BCHLOCN=$P(^BCHTACTL(BCHLOC,0),U)
 S BCHPROV=$P(BCHR0,U,3) Q:BCHPROV=""  S BCHPNAME=$P(^VA(200,BCHPROV,0),U)
 S BCHX=0 F  S BCHX=$O(^BCHRPROB("AD",BCHR,BCHX)) Q:BCHX'=+BCHX  S BCHACT=$P(^BCHRPROB(BCHX,0),U,4),BCHPROB=$P(^(0),U) I BCHACT]""  D
 .S BCHACTN=$P(^BCHTSERV(BCHACT,0),U)_" ("_$P(^(0),U,3)_")"
 .S BCHPROB=$P(^BCHTPROB(BCHPROB,0),U)_" ("_$P(^(0),U,2)_")"
 .S $P(^(BCHPROB),U)=$S($D(^XTMP("BCHRP3",BCHJOB,BCHBT,"RECORDS",BCHPROGN,BCHLOCN,BCHPNAME,BCHACTN,BCHPROB)):$P(^(BCHPROB),U)+1,1:1)
 .S $P(^XTMP("BCHRP3",BCHJOB,BCHBT,"RECORDS",BCHPROGN,BCHLOCN,BCHPNAME,BCHACTN,BCHPROB),U,2)=$P(^XTMP("BCHRP3",BCHJOB,BCHBT,"RECORDS",BCHPROGN,BCHLOCN,BCHPNAME,BCHACTN,BCHPROB),U,2)+$P(^BCHRPROB(BCHX,0),U,5)
 Q