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

BMCCLOS1.m

Go to the documentation of this file.
BMCCLOS1 ; IHS/PHXAO/TMJ - CLOSE REFERRALS AUTOMATICALLY ; 
 ;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
POV ;EP
 S BMCFILE=90001 D SETDEF G PROCESS
 ;
SETDEF ;SET DEFAULT OF ACTIVE REFERRALS ONLY
 S BMCCLOS=$O(^BMCREF("AB","A",""))
 Q
XIT ;
 K BMCFILE,BMCDFN,BMCVDG,BMCVIGR,BMCCONT,BMCTEMP,BMCCLOS,BMCG,BMCL,BMCHRN,BMCDOB,BMCVSIT,AUPNSEX,AUPNPAT,AUPNDOB,AUPNDAYS,BMCEIN,AUPNDOD,BMCCAT
 Q
PROCESS ;
 I BMCCLOS="" W !!,"ERROR -- NO ACTIVE REFERRALS ON FILE, NOTIFY YOUR SUPERVISOR" G XIT
 S BMCEIN="",BMCDFN="",U="^"
 I '$D(^DIC(BMCFILE)) W !!,"FILE DOES NOT EXIST -- NOTIFY YOUR SUPERVISOR" G XIT
 S BMCVDG=$P(^DIC(BMCFILE,0),U) I BMCVDG="" W !,"ERROR IN ^DIC -- NOTIFY PROGRAMMER" G XIT
 S BMCVDG=^DIC(BMCFILE,0,"GL")
 ;S BMCG=BMCVDG_"""B"",BMCCLOS)"
 ;S BMCG=BMCVDG_"B"_","_BMCCLOS
 ;I '$D(@BMCG) W ?10,!!,"***There are no .9999 codes to change.***" H 3 Q
 S BMCVIGR=BMCVDG_BMCCLOS_","_0_")"
 W !!,"Searching the ",$P(^DIC(BMCFILE,0),U)," File",!
 S BMCDFN=0,BMCCONT=1 F BMCL=0:0 S BMCDFN=$O(@BMCVIGR) Q:BMCDFN'=+BMCDFN  D CONT Q:'BMCCONT  D BMCDIE
 S BMCDFN=BMCCLOS Q:BMCCLOS'=+BMCDFN  D CONT Q:'BMCCONT  D BMCDIE
 W !!,"All done with the ",$P(^DIC(BMCFILE,0),U)," file",!
 D XIT
 Q
CONT ;
 W !!
 S DIR("A")="Continue",DIR("B")="Y",DIR(0)="Y" D ^DIR
 I $D(DIRUT) S X="N"
 S:"Nn"[X BMCCONT=""
 W !
 K DIR,DIRUT,DUOUT,DTOUT,DIROUT
 Q
BMCDIE ;
 S BMCG=BMCVIGR S Y=$P(@BMCG,U,3),BMCVSIT=$P(@BMCG,U,2) I Y=""!(BMCVSIT="") W !,"ERROR IN GLOBAL -- NOTIFY PROGRAMMER - PATIENT OR VISIT DFN MISSING" Q
 D ^AUPNPAT
 I $L(BMCFILE)>7,AUPNDOB]"" S X2=AUPNDOB,X1=$P(^BMCREF(BMCVSIT,0),U)\1 D ^%DTC S AUPNDAYS=X ; re-set days of age to visit date-dob
 S Y=AUPNDOB X ^DD("DD") S BMCDOB=Y
 S BMCHRN="" I $D(^AUPNPAT(AUPNPAT,41,DUZ(2),0)) S BMCHRN=$P(^AUPNPAT(AUPNPAT,41,DUZ(2),0),U,2)
 W !,"NAME: ",$P(^DPT(AUPNPAT,0),U),"  DOB: ",BMCDOB,"  SEX: ",AUPNSEX,"  HRN: ",$S(BMCHRN]"":BMCHRN,1:"NONE")
 ;I $L(BMCFILE)>7 S BMCCAT=$P(^BMCREF(BMCVSIT,0),U,7) W !,"DATE OF VISIT: " S Y=$P(^AUPNVSIT(BMCVSIT,0),U) D DT^DIO2 S Y=""
 ;
 ;
 ;NOTE TO TONI----DECIDE WHAT REFERRAL INFOR TO DISPLAY
 ;W !!,"HELLO",!!
 ;S BMCRNUM=$$VALI^XBDIQ1(90001,BMCVDG,.02) I $D(BMCRNUM) W !,"REFERRAL NUMBER: ",BMCRNUM
 ;
 ;
 ;S DA=BMCCLOS,DIE=BMCVDG,DR=.27///"C1" D ^DIE K DA,DIE,DR
 ;
 ;I $L(BMCFILE)>7 S AUPNVSIT=BMCVSIT D MOD^AUPNVSIT
 S DA=BMCVSIT,DIE="^BMCREF(",DR=".27////"_DT D ^DIE K DA,DIE,DIU,DIV,DR
 ;Stuff Todays's Date in field .27 Date Last Modified in BMCREF(
 ;
 S DA=BMCCLOS,DIE="^BMCREF(",DR=".15///"_"C1" D ^DIE K DA,DIE,DIU,DIV,DR
 ;
 Q