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

BMCRL1.m

Go to the documentation of this file.
  1. BMCRL1 ; IHS/PHXAO/TMJ - PROCESS REFERRAL LIST ;
  1. ;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
  1. ;IHS/ITSC/FCJ ADDED TEST FOR BMCSORT="" WAS SET FOR TOT AND SUBTOT
  1. ; IN CANNED REPORTS ; ADDED VARS FOR COMMENTS SCREEN
  1. ; TEST FOR REF: PRIM, SEC OR BOTH AND TEST FOR CALL-INS ONLY
  1. ;
  1. START ;
  1. S (BMCBT,BMCBTH)=$H,BMCJOB=$J,BMCRCNT=0
  1. D PROCESS,END
  1. Q
  1. ;
  1. PROCESS ;
  1. S BMCREF=0 F S BMCREF=$O(^BMCREF(BMCREF)) Q:BMCREF'=+BMCREF D PROC
  1. Q
  1. ;
  1. END ;
  1. S BMCET=$H
  1. Q
  1. PROC ;
  1. K BMCSPEC
  1. I BMCPTVS="R" S BMCRREC=^BMCREF(BMCREF,0),DFN=$P(BMCRREC,U,3)
  1. I BMCPTVS="P" S DFN=BMCREF
  1. I $D(^BMCRTMP(BMCRPT,11,191)),$P(BMCRREC,U,6)'="" Q ;TEST FOR CALL-INS
  1. I '$D(^BMCRTMP(BMCRPT,11,150)),$P(BMCRREC,U,4)="N" Q
  1. ;4.0 IHS/ITSC/FCJ TEST FOR PRIM, SECONDARY OR BOTH......
  1. I BMCTYPR="P",$P($G(^BMCREF(BMCREF,1)),U)'="" Q
  1. I BMCTYPR="S",$P($G(^BMCREF(BMCREF,1)),U)="" Q
  1. D SCREENS
  1. Q:$D(BMCSKIP)
  1. K BMCSRT,BMCPRNT S BMCCRIT=BMCSORT,BMCX=0
  1. I BMCSORT'="" X:$D(^BMCTSORT(BMCSORT,4)) ^BMCTSORT(BMCSORT,4)
  1. I '$D(BMCPRNT) D
  1. . I BMCPTVS="R" S Y=$P(BMCRREC,U) S BMCPRNT=Y Q
  1. . S BMCPRNT=$P(^DPT(DFN,0),U)
  1. ;BMCSRT -If Null you can enter value in each sort field in lister
  1. S BMCSRT=BMCPRNT I BMCSRT="" S BMCSRT="NONE"
  1. S ^XTMP("BMCRL",BMCJOB,BMCBTH,"DATA HITS",BMCSRT,BMCREF)="",BMCRCNT=BMCRCNT+1
  1. NUMBER ;Numeric Output choice
  1. I BMCCTYP="N" D
  1. .I '$D(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS")) S ^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS")=0
  1. .S $P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS"),U)=$P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS"),U)+1
  1. .X ^BMCTSORT(BMCNSRT,1)
  1. .Q:$G(X)=""
  1. .S $P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS"),U,6)=$P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS"),U,6)+1
  1. .S $P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS"),U,2)=$P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS"),U,2)+X
  1. .S T=$P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS"),U,2),C=$P(^("STATS"),U,6),M=T/C
  1. .S $P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS"),U,3)=M
  1. .I $P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS"),U,4)="" S $P(^("STATS"),U,4)=X
  1. .I $P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS"),U,4)>X S $P(^("STATS"),U,4)=X
  1. .I X>$P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS"),U,5) S $P(^("STATS"),U,5)=X
  1. .Q:BMCSORT=6
  1. .I '$D(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS",BMCSRT)) S ^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS",BMCSRT)=0
  1. .S $P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS",BMCSRT),U)=$P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS",BMCSRT),U)+1
  1. .X ^BMCTSORT(BMCNSRT,1)
  1. .Q:$G(X)=""
  1. .S $P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS",BMCSRT),U,2)=$P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS",BMCSRT),U,2)+X
  1. .S $P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS",BMCSRT),U,6)=$P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS",BMCSRT),U,6)+1
  1. .S T=$P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS",BMCSRT),U,2),C=$P(^(BMCPRNT),U,6),M=T/C
  1. .S $P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS",BMCSRT),U,3)=M
  1. .I $P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS",BMCSRT),U,4)="" S $P(^(BMCPRNT),U,4)=X
  1. .I $P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS",BMCSRT),U,4)>X S $P(^(BMCPRNT),U,4)=X
  1. .I X>$P(^XTMP("BMCRL",BMCJOB,BMCBTH,"STATS",BMCSRT),U,5) S $P(^(BMCPRNT),U,5)=X
  1. Q:'$D(DFN)!(DFN="") ;10.22.04 IHS/ITSC/FCJ
  1. Q:$D(^XTMP("BMCRL",BMCJOB,BMCBTH,"PATIENTS",DFN))!($D(BMCSCNT))
  1. S ^XTMP("BMCRL",BMCJOB,BMCBTH,"PATIENTS",DFN)="",BMCPTCT=BMCPTCT+1
  1. Q
  1. SCREENS ;
  1. K BMCSKIP
  1. S BMCI=0 F S BMCI=$O(^BMCRTMP(BMCRPT,11,BMCI)) Q:BMCI'=+BMCI!($D(BMCSKIP)) D
  1. .I '$P(^BMCTSORT(BMCI,0),U,8) D SINGLE Q
  1. .D MULT
  1. S BMCI=""
  1. Q
  1. SINGLE ;
  1. Q:BMCI=150 ;special stuff for inhouse
  1. K X,BMCSPEC S X="",BMCX=0
  1. X:$D(^BMCTSORT(BMCI,1)) ^(1)
  1. I X="" S BMCSKIP="" Q
  1. I '$D(BMCSPEC),'$D(^BMCRTMP(BMCRPT,11,BMCI,11,"B",X)) S BMCSKIP="" Q
  1. Q
  1. MULT ;
  1. K BMCFOUN,BMCSKIP,BMCSPEC,X
  1. S BMCX=0,X=""
  1. S Y=0,Y1=BMCREF
  1. X:$D(^BMCTSORT(BMCI,1)) ^BMCTSORT(BMCI,1)
  1. I $O(X(""))="" S BMCSKIP="" Q
  1. I '$D(BMCSPEC) S Y="" F S Y=$O(X(Y)) Q:Y="" I $D(^BMCRTMP(BMCRPT,11,BMCI,11,"B",Y)) S BMCFOUN="" Q
  1. I $D(BMCSPEC),$G(X) S BMCFOUN=1 Q
  1. S:'$D(BMCFOUN) BMCSKIP=""
  1. Q