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

BMCADDS.m

Go to the documentation of this file.
BMCADDS ;IHS/ITSC/FCJ - ADD SECONDARY REFERRAL;        [ 09/27/2006  1:31 PM ]
 ;;4.0;REFERRED CARE INFO SYSTEM;**1,2,3,8,12**;JAN 09, 2006;Build 101
 ;
 ; 4.0 ADD THE BMCMODE VAR AND CALLIN OPTION
 ; 4.0*1 IHS/OIT/FCJ SP BAR VAR
 ; 4.0*2 IHS/OIT/FCJ ADDED EP FOR API ROUTINE
 ; 4.0*2 8/15/06 IHS/OIT/FCJ ADDED AUTO POP POV
 ; 4.0*3 8.13.07 IHS.OIT.FCJ ADD BO/CHS COMMENTS
 ; 4.0*12 9.12.17 IHS.OIT.FCJ ADDED CALL IN NOTIFICATION
 ;
 ; See ^BMCVDOC for system wide variables set by main menu
 ; Subscripted BMCREC is EXTERNAL form.
 ;   BMCREC("PAT NAME")=patient name
 ;   BMCREC("REF DATE")=referral date
 ;   BMCDFN=patient ien
 ;   BMCRDATE=referral date in internal FileMan form
 ;   BMCRNUMB=referral number
 ;   BMCRIEN=referral ien
 ;   BMCSRIEN=Secondary referral ien
 ;   BMCMODE=A for add, M for modify
 ;   BMCRSTAT=referral status (.15 field)
 ;   BMCRTYPE=type of referral (.04 field)
 ;   BMCRIO=Inpatient or Outpatient (.14 field)
 ;   BMCVCT=Vist count
 ;   BMCCURFY=Restrict access to current fiscal year only
 ;
START ;
 D:'$D(BMCPARM) PARMCHK^BMC
 F  D MAIN Q:BMCQ  D HDR^BMC
 G EXIT
 Q
 ;
MAIN ;
 S BMCQ=0,BMCMODE="A",BMCSTRM="",BMCPROV="" ;BMC*4.0*8 ADDED BMCSTRM
 D GETREF ;             Select Prim referral
 Q:BMCQ
 D CALLIN Q:BMCQ
 D ADD Q:BMCQ  ;ADD NEW SEC REF
 I BMCPCC,'$G(BMCOUTR),'BMCCAL S BMCIEN=BMCRIEN,BMCRIEN=BMCSRIEN D DSPV^BMCADDP S BMCRIEN=BMCIEN I BMCQ D DELETE Q  ;BMC*4.0*8 TEST FOR PCC LINK AND GO TO REQUIRE A VST
 D EDIT I BMCQ D DELETE Q
 I BMCPCC,'$G(BMCCAL) S BMCIEN=BMCRIEN,BMCRIEN=BMCSRIEN D ADDVREF^BMCADD S BMCRIEN=BMCIEN        ;BMC*4.0*8 Add to V Ref file
 D MEDHX
 D SBCOM       ;BMC*4.0*3 8.13.07 IHS.OIT.FCJ ADD BO/CHS COMMENTS 
 Q
 ;
GETREF ;Screens out closed Referrals
 S BMCQ=1
 W !
 I $G(BMCRIEN) S DA=BMCRIEN
 ;S DIC="^BMCREF(",DIC("S")="I $$FILTER^BMCFLTR(0,BMCCURFY)",DIC(0)="AEMQ",DIC("A")="Select REFERRAL by Patient or by Referral Date or #: "
 S DIC="^BMCREF(",DIC(0)="AEMQ",DIC("A")="Select REFERRAL by Patient or by Referral Date or #: "
 ;S DIC("S")="I $$FILTER^BMCFLTR(0,BMCCURFY,0)"
 ;S DIC("S")="I $$FILTER^BMCFLTR(0,0,0)"
 S DIC("S")="I $$FILTER^BMCFLTR(3,0,0)"      ;*9 ALLOW CLOSED REF
 D DIC^BMCFMC
 Q:Y<1
 S BMCRIEN=+Y
 S BMCREC=^BMCREF(BMCRIEN,0)
 S BMCQ=0
 Q
CALLIN ;EP;TEST FOR CALL-IN REF
 S BMCCAL=0
 S DIR(0)="Y",DIR("A")="Is this a Call-in Secondary Referral",DIR("B")="NO"
 D ^DIR K DIR
 ;S:Y=1 BMCCAL=1
 I Y=1 S BMCCAL=1 D CALLIN^BMCADD     ;BMC*4.0*12
 I $D(DUOUT) S BMCQ=1
 Q
 ;
ADD ;EP;FIND SUFFIX
 S (Y1,Y2,Y3)=0
 I '$D(^BMCREF("S",BMCRNUMB)) S Y1=0
 E  S Y="" F  S Y=$O(^BMCREF("S",BMCRNUMB,Y)) Q:Y=""  D
 .S Y3=$E(Y,2,$L(Y)),Y2=Y2+1
 .S:Y3>Y1 Y1=Y3
 S Y1=Y1+1,Y2=Y2+1,BMCSUF="A"_Y1
 ;VISTS REMAINING
 S BMCVCT=($P(^BMCREF(BMCRIEN,11),U,11)-Y2)
 S:BMCVCT<0 BMCVCT=0
 ;ADD SECONDARY REF ENTRY
 D ^XBFMK K DIADD,DINUM
 S X=DT,DIC="^BMCREF(",DIC(0)="L",DLAYGO=90001
 ;BMC*4.0*8 SPLIT NXT LINE AND ADDED TOC STATUS FIELD 1304
 S BMCPROV=$P(BMCREC,U,6)
 S DIC("DR")=".02////"_BMCRNUMB_";.03////"_BMCDFN_";.04////"_BMCRTYPE_";.25////"_DUZ_";1304////P"
 S DIC("DR")=DIC("DR")_";101////"_BMCSUF_";102////"_BMCRIEN_";1111////"_BMCVCT
 S DIC("DR")=DIC("DR")_";.11////"_$P(BMCREC,U,11)_";.14////"_$P(BMCREC,U,14)_";.15////A"_";.26////"_DT_";.32////"_$P(BMCREC,U,32)
 I BMCCAL=0 S DIC("DR")=DIC("DR")_";.06////"_$P(BMCREC,U,6)
 E  S DIC("DR")=DIC("DR")_";103////"_BMCCDT_";104////"_BMCCBY  ;BMC*4.0*12 OIT/IHS/FCJ CALL DATE AND BY
 ;BMC 4.0*2 8/15/06 IHS/OIT/FCJ ADDED NXT LINE TO AUTO POP POV 1.26.07 ADD $TR TO STR BECAUSE OF FM
 I $P($G(^BMCPARM(DUZ(2),4100)),U,6)="Y" S DIC("DR")=DIC("DR")_";1201////"_$TR($P(^BMCREF(BMCRIEN,12),U),";"," ")
 K DD,DO D FILE^DICN S BMCSRIEN=+Y D ^XBFMK K DIADD,DINUM
 Q  ;BMC*4.0*8 ADDED TO ADD CALL FOR VISIT
EDIT ; EDIT REFERRAL RECORD JUST ADDED
 S DDSFILE=90001,DA=BMCSRIEN,DDSPARM="C"
 S DR=$S(BMCCAL=1:"[BMC SEC REF ADD CI]",1:"[BMC SEC REF ADD]")
 D DDS^BMCFMC
 I '$G(DDSCHANG) D DELETE S BMCQ=1 Q
 S X=$S(BMCRTYPE="I":$P(^BMCREF(BMCSRIEN,0),U,8),BMCRTYPE="N":$P(^BMCREF(BMCSRIEN,0),U,23),1:$P(^BMCREF(BMCSRIEN,0),U,7))
 I 'X W !,"You must enter a Vendor or IHS Facility, depending on the Referral type.",! D PAUSE^BMC G EDIT
 Q
 ;
DELETE ; DELETE REFERRAL JUST ADDED BECAUSE OPERATOR DIDN'T FINISH
 W !!,"INCOMPLETE SECONDARY REFERRAL...BEING DELETED!",!!
 S DIK="^BMCREF(",DA=BMCSRIEN D ^DIK
 D PAUSE^BMC
 Q
MEDHX ;EP;DISPLAY MED HX COMMENTS IF ANY AND ADD NEW COMMENTS TO SEC REF
 S BMCV="COM",BMCTERM="Medical HX/Findings Comments",BMCATEMP="[BMC COMMENTS ADD]",BMCG="^BMCCOM(",BMCETEMP="[BMC COMMENTS EDIT]"
 ;BMC*4.0*3 12.14.07 IHS.OIT.FCJ ADDED S BMCRIEN IN NXT LINE
 S BMCCTYP="M",BMCRIEN=$P(^BMCREF(BMCSRIEN,1),U,2)
 W @IOF,!,$$CTR^BMC("MEDICAL COMMENTS FROM PRIMARY REFERRAL",80)
 W !,$$CTR^BMC("REFERRAL: "_BMCRNUMB_"   PATIENT: "_BMCREC("PAT NAME"),80),!
 F I=1:1:80 W "-"
 S BMCNONE=0 D DISPCOM^BMCMOD1
 I BMCNONE=1 W !,"THERE ARE NOT ANY MEDICAL COMMENTS FROM PRIMARY REFERRAL TO DISPLAY...",!
 W ! F I=1:1:80 W "-"
 W !,"Enter Comments for Secondary Referral..."
MEDCOM ;ADD MED HX COMMENTS
 W !
 S DIR("A")="Do you want to enter Medical History and Findings Comments"
 S BMCCTYP="M"
 S BMCTMPS=BMCSRIEN,BMCTMP=BMCRIEN,BMCRIEN=BMCSRIEN
 D COMMENTS^BMCADD
 S BMCRIEN=BMCTMP,BMCSRIEN=BMCTMPS
 Q
 ;
SBCOM ;ADD BO/CHS COMMENTS ;BMC*4.0*3 8.13.07 IHS.OIT.FCJ ADD BO/CHS COMMENTS
 S BMCV="COM",BMCTERM="Business Office/CHS Comments",BMCATEMP="[BMC COMMENTS ADD]",BMCG="^BMCCOM(",BMCETEMP="[BMC COMMENTS EDIT]"
 S BMCCTYP="S"
 S BMCTMPS=BMCSRIEN,BMCTMP=BMCRIEN,BMCRIEN=BMCSRIEN
 D ASK^BMCMOD
 S BMCRIEN=BMCTMP,BMCSRIEN=BMCTMPS
 ;
RECORD ;RECORD SECONDARY REFERRAL
 W !!,"Secondary Referral has been completed, "_BMCRNUMB_BMCSUF,!
 D PAUSE^BMC
 S ^DISV(DUZ,"^BMCREF(")=$P(^BMCREF(BMCSRIEN,1),U,2)  ;BMC*4.0*1 IHS/OIT/FCJ SP BAR VAR
 Q
 ;
BUSINESS ; EDIT BUSINESS OFFICE COMMENTS
 D 80^BMCMOD
 Q
EXIT ;EXIT PROGRAM
 D ^BMCKILL
 K DDSCHANG,DDSPARM,DILN,DISYS,DIWI,DIWTC,DIWX,DIC,DIE,DA,Y,Y1,Y2,W1
 K BMCMODE,BMCRSTAT,BMCRIEN,BMCSUF,BMCVCT,BMCTMP,BMCTMPS,BMCCAL
 Q