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

IBDFOSG4.m

Go to the documentation of this file.
IBDFOSG4 ;ALB/MAF/AAS - NUMBER OF ENCOUNTERS WITH CPT'S AND DX'S CONT. ; 3/18/96
 ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
 ;
START ;  -- Loop thru MONTHS
 N IBQUIT
 S IBQUIT=0
 S ^TMP("GTOT",$J)="0^0^0"
BLD ; -- scan ENCOUNTERS
 F IBDDT=IBDFBEG:0 S IBDDT=$O(^SCE("B",IBDDT)) Q:'IBDDT!($P(IBDDT,".",1)>IBDFEND)  D
 .F IBIFN=0:0 S IBIFN=$O(^SCE("B",IBDDT,IBIFN)) Q:'IBIFN  S IBNODE=$G(^SCE(IBIFN,0)) D
 ..S IBDIV=$P(IBNODE,"^",11)  ;division
 ..S IBDIVNM=$P($$SITE^VASITE(,+IBDIV),"^",3)
 ..I VAUTD=0 Q:'$D(VAUTD(+IBDIV))
 ..S IBDFN=$P(IBNODE,"^",2)  ;patient
 ..S IBSTOP=$P(IBNODE,"^",3)  ;stop code
 ..S IBCLIN=$P(IBNODE,"^",4)  ;clinic
 ..S IBPARNT=$P(IBNODE,"^",6)  ;parent
 ..S IBPROC=$P(IBNODE,"^",8)  ;process
 ..S IBMNTH=$E($P(IBNODE,"^"),1,3)_$E($P(IBNODE,"^"),4,5)  ;number of month
 ..Q:'IBDFN
 ..D PROC I $D(IBXY) S IBPIECE=2 D SET
 ..D SET^SDCO4(IBIFN) I $D(SDDXY) S IBPIECE=3 D SET
 ..Q
 Q
 ;
 ;
SET ;  -- Set totals
 I '$D(^TMP("DTOT",$J,IBDIVNM)) S ^TMP("DTOT",$J,IBDIVNM)="0^0^0"
 I '$D(^TMP("MNTH",$J,IBDIVNM,IBMNTH)) S ^TMP("MNTH",$J,IBDIVNM,IBMNTH)="0^0^0"
 S $P(^TMP("MNTH",$J,IBDIVNM,IBMNTH),"^",IBPIECE)=$P(^TMP("MNTH",$J,IBDIVNM,IBMNTH),"^",IBPIECE)+1
 S $P(^TMP("DTOT",$J,IBDIVNM),"^",IBPIECE)=$P(^TMP("DTOT",$J,IBDIVNM),"^",IBPIECE)+1
 S $P(^TMP("GTOT",$J),"^",IBPIECE)=$P(^TMP("GTOT",$J),"^",IBPIECE)+1
 Q
PROC ;  -- Check to see if there is at least one procedure for the encounter.
 N IBCNT S IBCNT=0
 K IBXY
 S IBDDT1=$P(IBDDT,"."),IBI=IBDDT1-.000001
 F  S IBI=$O(^SDV("C",IBDFN,IBI)) Q:'IBI!(IBI>(IBDDT1+.25))  D
 .S IBCS=0 F  S IBCS=$O(^SDV(IBI,"CS",IBCS)) Q:'IBCS  I $D(^SDV(IBI,"CS",IBCS,0)) I $P(^SDV(IBI,"CS",IBCS,0),"^",8)=IBIFN,$D(^SDV(IBI,"CS",IBCS,"PR")) S IBPR=^("PR") D  Q:$D(IBXY)
 ..F IBJ=1:1:5 I $P(IBPR,"^",IBJ) S IBCNT=IBCNT+1,IBXY(IBCNT)=$P(IBPR,"^",IBJ)_"^"_IBI Q:$D(IBXY(IBCNT))
 Q
 ;