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

BMCFDR2.m

Go to the documentation of this file.
BMCFDR2 ; IHS/ITSC/FCJ - DRIVER TO PRINT SECONDARY REFERRAL LETTER ;       [ 09/26/2006  4:01 PM ]
 ;;4.0;REFERRED CARE INFO SYSTEM;**2,3**;JAN 09, 2006;Build 101
 ;IHS/OIT/FCJ ADD LINE TO TEST FOR CLOSING SLAVE DEVICE
 ;ALSO ADDED CHECK FOR CHS STATUS AND UPDATE OPTION
 ;4.0*2 9-21-06 IHS/OIT/FCJ ASK TO PRNT CONSULT LETTER
 ;4.0*3 4.19.07 IHS/OIT/FCJ BMCCHSA IS A PARM VAR CHG TO BMCCHSAS
 ;
 ;This is the Main Driver Routine -
 ;RCIS REPORT OUTPUT DEFINITION - SECONDARY PROVIDER LETTER
 ;Calls PRINT ROUTINE BMCFPRN2
 ;Rewrote from original version no longer requires data entry
 ;4.0 All call now to BMCREF instead of BMCPROV, ask for prining of
 ;    Prim ref HX and findings
 ;    Added option to update CHS status
 ;
START ;
 S BMCCPRV="",BMCAPDT="",BMCAPUR="",BMCDDT="",BMCDPUR=""
 W:$D(IOF) @IOF
 W "**********  REFERRAL FORM PRINT-SECONDARY PROVIDER  **********",!!
 W "This report will produce a hard copy computer generated",!,"Secondary Provider Letter",!
 S BMCQUIT=0
 S BMCCPRV="" ;Secondary Provider Name
 S BMCCPRVS="" ;Secondary Provider Specific
 S BMCAPPDT="" ;Secondary Provider Appointment Date
 S BMCAPUR="" ;Secondary Provider Purpose of Appointment
GETREF ;get referral entry
 S BMCKIND=0 ; Determines If Type = IHS
 S DIR(0)="S^1:STANDARD;2:AHCCCS",DIR("A")="Enter Secondary Letter Type",DIR("B")="STANDARD",DIR("?")="Enter Letter Form Output Choice" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) G XIT
 S BMCHOICE=Y
 S BMCFTYPE=$S(BMCHOICE=1:4,BMCHOICE=2:6,1:4)
 W ! S DIR(0)="Y",DIR("A")="Do you want to include Primary referral History and Findings",DIR("B")="Y" D ^DIR K DIR Q:$D(DUOUT)
 S BMCPHX=+Y
 W !! S BMCREF=""
 S DIC="^BMCREF(",DIC(0)="AEMQ",DIC("A")="Select REFERRAL by Patient or by Referral Date or #: "
 S DIC("S")="I $$FILTER^BMCFLTR(0,0,1)"
 D DIC^BMCFMC
 G:Y=-1 XIT
 S (BMCREF,BMCDTIEN,BMCSRIEN)=+Y
 I $D(^BMCTFORM(BMCFTYPE,11)) X ^BMCTFORM(BMCFTYPE,11) G:BMCQUIT GETREF
CHS I $P($G(^BMCREF(BMCSRIEN,0)),U,4)="C" D
 .;BMC*4.0 4.19.07 IHS/OIT/FCJ BMCCHSA IS A PARM VAR CHG NXT 3 LNS TO BMCCHSAS
 .S BMCCHSAS=$P($G(^BMCREF(BMCSRIEN,11)),U,12)
 .S BMCCHSAP=$$EXTSET^XBFUNC(90001,1112,BMCCHSAS)
 .I BMCCHSAS="" S BMCCHSAP="UNKNOWN"
 .W !!,?10,"**CHS APPROVAL STATUS**: ",BMCCHSAP,!!
 .;Ask if Edit CHS Approval Status
 .S DIR(0)="Y",DIR("A")="Do you wish to Change the Existing CHS Approval Status",DIR("?")="Enter Y for Yes or N for NO",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
 .Q:$D(DIRUT)
 .Q:Y=0
 .D CHSSTAT^BMCFDRC
 G:$D(DIRUT) XIT
 S (BMCRIEN,BMCREF)=$P(^BMCREF(BMCSRIEN,1),U,2)
 ;
IHS ;IHS Type - Get IHS Facility
 I $P($G(^BMCREF(BMCSRIEN,0)),U,4)="I" D
 .S BMCCPRV=$P($G(^BMCREF(BMCSRIEN,0)),U,8) D
 .S BMCCPRVP=$P($G(^DIC(4,BMCCPRV,0)),U)
 .S BMCKIND=1
 ;
 ;
GETPROV ;CHS Secondary Provider/Vendor
 S BMCCPRV=$P($G(^BMCREF(BMCSRIEN,0)),U,7)
 S:BMCCPRV BMCCPRVP=$P($G(^AUTTVNDR(BMCCPRV,0)),U)
 I $P(^BMCREF(BMCSRIEN,0),U,9) S BMCCPRVS=$$VAL^XBDIQ1(90001.53,$P(^BMCREF(BMCSRIEN,0),U,9),.01)
 ;
APPTDT ;Appointment Date
 S BMCAPPDT=$P(^BMCREF(BMCSRIEN,11),U,6)
 ;
PUR ;Purpose of Appointment
 S BMCAPUR=$P(^BMCREF(BMCSRIEN,12),U)
 ;
ASKCON ;ASK TO PRINT CONSULT LETTER ;BMC*4.0*2 IHS/OIT/FCJ
 D ASKCON^BMCFDR
ZIS ;
 W !! S XBRC="COMP^BMCFDR2",XBRP="PRINT^BMCFDR2",XBNS="BMC",XBRX="XIT^BMCFDR2"
 D ^XBDBQUE
 Q
 ;
PRINT ;EP
 X:$D(^BMCTFORM(BMCFTYPE,12)) ^BMCTFORM(BMCFTYPE,12)
 Q
XIT ;
 K BMCCAP,BMCCHSR,BMCDA,BMCFILE,BMCFTYPE,BMCIOM,BMCKPDA,BMCNODE,BMCPG,BMCQUIT,BMCR0,BMCREF,BMCRNS,BMCV,BMCWP,BMCX,BMCY,BMCI,BMCDFN
 K A,C,D,D0,D1,DA,DD,DDSFILE,DI,DIADD,DIC,DICR,DIE,DIK,DINUM,DIPGM,DIQ,DIR,DIWF,DIWL,DIWR,DLAYGO,DO,DQ,DR,DTOUT,F,G,I,J,N,P,T,X,Y,Z
 K BMCPROUT,BMCN,BMCNUM,BMCAGE,BMCFIRST,BMCLAST,BMCLTYP,BMCDTIEN,BMCCPRV,BMCAPPDT,BMCAPUR,BMCDTIEN,BMCCHSAP,BMCCHSAS
 K BMCAPDT,BMCHOICE,BMCKIND,BMCTYPE,BMCDDT,BMCDPUR,BMCCMT,BMCCPRVP,BMCCPRVS,BMCDT,BMCRIEN,BMCSRIEN,BMCR1,BMCPHX
 I $D(IO("S")) S IOP="`"_IOS D ^%ZIS
 Q
COMP ;
 Q
WP ;EP - Entry point to print wp fields pass node in BMCWP
 ;PASS FILE IN BMCFILE, ENTRY IN BMCREF
 NEW G,P,BMCX
 K BMCWP
 K ^UTILITY($J,"W")
 S BMCX=0,P=0
 S G=$S($G(G)]"":G,1:^DIC(BMCFILE,0,"GL")),G=G_BMCDA_","_BMCNODE_",BMCX)"
 S DIWR=$S($G(BMCIOM):BMCIOM,1:IOM),DIWL=0 F  S BMCX=$O(@G) Q:BMCX'=+BMCX  D
 .S Y=$P(G,")")_",0)"
 .S X="" I $G(BMCCAP)]"",BMCX=1 S X=BMCCAP
 .S X=X_@Y D ^DIWP
 .Q
WPS ;EP
 S Z=0 F  S Z=$O(^UTILITY($J,"W",DIWL,Z)) Q:Z'=+Z  S P=P+1,BMCWP(P)=^UTILITY($J,"W",DIWL,Z,0)
 K DIWL,DIWR,DIWF,Z
 K ^UTILITY($J,"W"),BMCNODE,BMCFILE,BMCDA,G,BMCCOL,BMCCAP
 Q