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

BMCRCHS4.m

Go to the documentation of this file.
BMCRCHS4 ; IHS/ITSC/FCJ - STATUS REPORT FOR CHS REFERRALS;      [ 09/27/2006  2:21 PM ]
 ;;4.0;REFERRED CARE INFO SYSTEM;**2,9**;JAN 09, 2006;Build 101
 ;4.0 IHS/ITSC/FCJ ADDED SUFFIX AND REF#
 ;
 ; This routine lists CHS referrals, User can select date range
 ; and status of referral: Pending, Approved, Denied or All and
 ; select if document is closed, active or both.
 ;
START ;
 W !!,"This report prints out a list of all Active CHS referrals. ",!,"The user can select a date range by Date initiated, and Status of Referral.",!,"and CHS status of Referral.",!
 W "Report will include Primary and Secondary referrals.",!
 D INIT
 Q:BMCQ
 D GETDATES^BMCRUTL Q:$D(DIRUT)!$D(DTOUT)
 D STATUS Q:$D(DIRUT)!$D(DTOUT)
 D DBQUE
 Q
 ;
INIT ; INITIALIZAION
 S BMCQ=0
 D:$G(BMCPARM)="" PARMSET^BMC
 S BMCJOB=$J
 F  D  Q:BMCBT]""
 . S BMCBT=$H
 . LOCK +^XTMP("BMCRCHS4",BMCJOB,BMCBT):1
 . E  S BMCBT=""
 K ^XTMP("BMCRCHS4",BMCJOB,BMCBT)
 Q
 ;
DBQUE ;call to XBDBQUE
 K BMCOPT
 W ! S DIR(0)="S^P:PRINT Output;B:BROWSE Output on Screen",DIR("A")="Do you wish to",DIR("B")="P" K DA D ^DIR K DIR
 I $D(DIRUT) S BMCQUIT=1 Q
 S BMCOPT=Y
 I $G(BMCOPT)="B" D BROWSE Q
 S XBRP="REFPRT^BMCRCHS4",XBRC="REFCHK^BMCRCHS4",XBRX="EOJ^BMCRCHS4",XBNS="BMC"
 D ^XBDBQUE
 Q
 ;
BROWSE ;
 S XBRP="VIEWR^XBLM(""REFPRT^BMCRCHS4"")"
 S XBRC="REFCHK^BMCRCHS4",XBRX="EOJ^BMCRCHS4",XBNS="BMC",XBIOP=0
 D ^XBDBQUE
 Q
 ;
STATUS ;CHS STATUS AND STATUS OF REFERRAL
 S DIR(0)="S^P:Pending;A:Approved;D:Denied;AL:All"
 S DIR("A")="Enter the CHS status of the Referral for the Report",DIR("B")="P"
 D ^DIR K DIR Q:$D(DIRUT)
 S BMCCST=Y
 S BMCRTYP=$S(Y="P":"PENDING APPROVAL",Y="A":"APPROVED",Y="D":"DENIED",Y="AL":"PENDING, APPROVED AND DENIED",1:"")
 ;DOCUMENT STATUS ACTIVE/CLOSED OR BOTH
 S DIR(0)="S^A:Active;C:Closed;B:Both"
 S DIR("A")="Enter the Status of the Referral for the Report",DIR("B")="A"
 D ^DIR K DIR Q:$D(DIRUT)
 S BMCSTA=Y
 S BMCRTYPS=$S(Y="A":"ACTIVE",Y="C":"CLOSED",Y="B":"ACTIVE AND CLOSED",1:"")
 Q
REFCHK ; CHECK EACH ACTIVE/CHS REFERRAL
 S BMCBDT=BMCBD-1
 F  S BMCBDT=$O(^BMCREF("B",BMCBDT)) Q:('BMCBDT)!(BMCBDT>BMCED)  D
 .S BMCRIEN=0
 .F  S BMCRIEN=$O(^BMCREF("B",BMCBDT,BMCRIEN)) Q:'BMCRIEN  D
 .. S X=^BMCREF(BMCRIEN,0)
 ..;I BMCSTA'="B",BMCSTA="A",$P(X,U,15)'="A" Q  ;BMC*4.0*9 IHS.OIT.FCJ 
 ..I BMCSTA'="B",BMCSTA="A",(($P(X,U,15)="C1")!($P(X,U,15)="X")) Q   ;BMC*4.0*9 IHS.OIT.FCJ
 ..;I BMCSTA'="B",BMCSTA="C",$P(X,U,15)="A" Q   ;BMC*4.0*9 IHS.OIT.FCJ
 ..I BMCSTA'="B",BMCSTA="C",(($P(X,U,15)="A")!($P(X,U,15)="A1")) Q   ;BMC*4.0*9 IHS.OIT.FCJ
 .. I $P(X,U,4)="C" D
 ... I BMCCST="AL" D HIT Q
 ... I $P($G(^BMCREF(BMCRIEN,11)),U,12)=BMCCST D HIT Q
 Q
HIT S ^XTMP("BMCRCHS4",BMCJOB,BMCBT,"DATA HITS",BMCRIEN)=""
 Q
 ;
REFPRT ; PRINT REFERRALS SELECTED
 S $P(BMC80E,"=",80)=""
 S $P(BMC80D,"-",80)=""
 D REFPRT2
 K ^XTMP("BMCRCHS4",BMCJOB,BMCBT)
 Q
 ;
REFPRT2 ;
 S BMCPG=0 D @("HEAD"_(2-($E(IOST,1,2)="C-"))) I '$D(^XTMP("BMCRCHS4",BMCJOB,BMCBT)) W !,"No referrals to report",! D PAUSE^BMC Q
 S BMCRIEN=0 K BMCQUIT
 F  S BMCRIEN=$O(^XTMP("BMCRCHS4",BMCJOB,BMCBT,"DATA HITS",BMCRIEN)) Q:BMCRIEN=""!($D(BMCQUIT))  D PRINT
 Q:$D(BMCQUIT)
 D PAUSE^BMC
 Q
 ;
PRINT ;print one referral
 S BMCRREC=^BMCREF(BMCRIEN,0)
 S Y=BMCRIEN
 D ^BMCREF
 I $Y>(IOSL-5) D HEAD Q:$D(BMCQUIT)
 W $$FMTE^XLFDT($P(BMCRREC,U),"5D")
 W ?11,$E(BMCREC("PAT NAME"),1,18)
 ;4.0*2 9-21-06 IHS/OIT/FCJ CHNGD $G TO $D IN NXT LINE
 W ?30,$P(BMCRREC,U,2) W:$D(^BMCREF(BMCRIEN,1)) $P(^BMCREF(BMCRIEN,1),U)
 W ?46,$P(^BMCREF(BMCRIEN,11),U,12)_"/"_$P(BMCRREC,U,15)
 W ?51,$S($P(BMCRREC,U,6):$$PROVINI^XBFUNC1($P(BMCRREC,U,6)),1:"--")
 W ?55,$E($$TOFAC^BMC(BMCRIEN),1,25)
 W !
 I $P($G(^BMCREF(BMCRIEN,12)),U)="" Q  ;no purpose of referral
 S X=$P(^BMCREF(BMCRIEN,12),U),DIWF="",DIWL=10,DIWR=70 D ^DIWP
 S Z=0 F  S Z=$O(^UTILITY($J,"W",DIWL,Z)) Q:Z'=+Z  W ?10,^UTILITY($J,"W",DIWL,Z,0),!
 K DIWL,DIWR,DIWF,Z
 K ^UTILITY($J,"W")
 W !
 Q
 ;
 D PAUSE^BMC
 I $D(DIRUT) S BMCQUIT="" Q
 D HEAD1
 Q
 ;
HEAD1 ;
 W:$D(IOF) @IOF
HEAD2 ; WRITE HEADER
 S BMCPG=BMCPG+1
 W !?13,"********** CONFIDENTIAL PATIENT INFORMATION **********"
 W !?(80-$L($P(^DIC(4,DUZ(2),0),U))/2),$P(^DIC(4,DUZ(2),0),U),?72,"Page ",BMCPG,!
 S Y=BMCBD D DD^%DT W ?17,"BEG DATE: "_Y
 S Y=BMCED D DD^%DT W ?40,"END DATE: "_Y,!
 W $$CTR^BMC("CHS REFERRALS: "_BMCRTYP,80),!
 W $$CTR^BMC("REFERRALS STATUS: "_BMCRTYPS,80),!
 W !,"REF DATE",?11,"PATIENT NAME",?32," REF #",?44,"STATUS",?51,"PRV",?55,"FACILITY REF TO"
 W !,BMC80D
 W !
 Q
 ;
EOJ ; END OF JOB
 LOCK -^XTMP("BMCRCHS4",BMCJOB,BMCBT)
 K ^XTMP("BMCRCHS4",BMCJOB,BMCBT)
 D ^BMCKILL
 K BMC80E,BMC80D,BMCBD,BMCBDD,BMCBDT,BMCBT,BMCHRN,BMCOPT,BMCPG,BMCJOB
 K BMCCST,BMCED,BMCEDD,BMCREC,BMCSD,BMCRREC,BMCRSTAT,BMCRTYP,BMCRTYPS
 K BMCSTA
 Q