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

BGOVCPT.m

Go to the documentation of this file.
BGOVCPT ; IHS/BAO/TMD - Manage V CPT ;31-Mar-2016 04:49;du
 ;;1.1;BGO COMPONENTS;**1,3,4,5,6,8,9,11,13,14,16,17,18,20**;Mar 20, 2007;Build 2
 ;---------------------------------------------
TIUSTR() ;EP
 N X,Y
 S X=$$GETVAR^CIANBUTL("ENCOUNTER.ID.ALTERNATEVISITID",,"CONTEXT.ENCOUNTER")
 Q:X="" " "
 S X=$$VSTR2VIS^BEHOENCX(DFN,X)
 Q:X<1 " "
 D GET(.X,DFN_"^^"_X_"^^1")
 S Y=$G(@X@(1))
 K @X
 Q $S(Y<0:"",1:Y)
 ; Return IEN of a CPT code
GETIEN(RET,CPT) ;EP
 S RET=$O(^ICPT("BA",$G(CPT)_" ",0))
 Q
 ; Return vaccine IEN associated with specified CPT IEN
IMMCK(RET,CPTIEN) ;EP
 N X
 S RET="",X=0
 F  S X=$O(^AUTTIMM(X)) Q:'X  I $P(^(X,0),U,11)=CPTIEN,'$P(^(0),U,7) Q
 S:X RET=X_U_$P(^AUTTIMM(X,0),U,2)
 Q
 ; Return VCPT entries by patient or by visit
 ;   INP = Patient IEN ^ Max ^ Visit IEN ^ Type ^ Format (0-detailed,1-tiu list)
 ;   Returned as a list of records in the format:
 ;     Visit Date [1] ^ Fac IEN [2] ^ Fac Name [3] ^ CPT [4] ^ CPT name [5] ^ Narrative [6] ^ Dx [7] ^
 ;     Prim [8] ^ Mod1 [9] ^ Mod2 [10] ^ V File IEN [11] ^ Visit IEN [12] ^ CPT IEN [13] ^ Quantity [14] ^
 ;     Provider Name [15] ^ Tran Code IEN [16] ^ ICD0 IEN [17] ^ Visit Locked [18] ^ V File [19]
GET(RET,INP) ;EP
 N CNT,BGO,REC,COD,TRANIEN,ICD0IEN,QTY,DX,IEN,DFN,VISITIEN,FORMAT,TYP,MAX,VIEN,MOD1,MOD2
 N CPT,CPTIEN,ITEMNAME,PNAR,TAX,PRIM,PRV,CODE,VF,ICDCNT,SCODE,ICDARRY,V2,V3,MATCH,X,Z,BHSCPT2
 S RET=$$TMPGBL^BGOUTL
 S CNT=0,ICDCNT=0
 S DFN=+INP
 Q:'DFN
 S MAX=$P(INP,U,2)
 S:'MAX MAX=9999
 S VISITIEN=+$P(INP,U,3)
 S TYP=$$UP^XLFSTR($P(INP,U,4))
 S FORMAT=+$P(INP,U,5)
 S IEN=0
 D G1:VISITIEN,G0:'VISITIEN
 Q
 ; By patient
G0 I TYP'="DENTAL" D
 .F  S IEN=$O(^AUPNVCPT("C",DFN,IEN)) Q:'IEN  Q:CNT>MAX  D CPTBLD(1)
 I TYP="DENTAL" D
 .F  S IEN=$O(^AUPNVDEN("AC",DFN,IEN)) Q:'IEN  Q:CNT>MAX  D DENBLD
 I TYP="SURGICAL"!(TYP="ALL") D
 .F  S IEN=$O(^AUPNVPRC("AC",DFN,IEN)) Q:'IEN  Q:CNT>MAX  D PRCBLD(1)
 Q
 ; By visit
G1 I TYP="DENTAL" D
 .F  S IEN=$O(^AUPNVDEN("AD",VISITIEN,IEN)) Q:'IEN  Q:CNT>MAX  D DENBLD
 F  S IEN=$O(^AUPNVCPT("AD",VISITIEN,IEN)) Q:'IEN  Q:CNT>MAX  D CPTBLD(0)
 F  S IEN=$O(^AUPNVTC("AD",VISITIEN,IEN)) Q:'IEN  Q:CNT>MAX  D TRANBLD
 F  S IEN=$O(^AUPNVPRC("AD",VISITIEN,IEN)) Q:'IEN  Q:CNT>MAX  D PRCBLD(0)
 Q
 ; VCPT
CPTBLD(SRCH) ;EP- Find CPTs
 D INIT("CPT")
 S REC=$G(^AUPNVCPT(IEN,0))
 Q:REC=""
 I FORMAT D  Q
 .S CPTIEN=$P(REC,U) Q:CPTIEN=""
 .I CPTIEN>99200,CPTIEN<99500 Q
 .S PNAR=$P($G(^ICPT(CPTIEN,0)),U,2)
 .I $P(REC,U,4) S PNAR=$P($G(^AUTNPOV($P(REC,U,4),0)),U)
 .S CNT=CNT+1
 .S ^TMP("BGOVCPT",$J,1)=$S(CNT=1:"",1:^TMP("BGOVCPT",$J,1)_"; ")_PNAR
 S CPTIEN=$P(REC,U) Q:CPTIEN=""
 S VIEN=$P(REC,U,3)
 S V2=$P($G(^AUPNVSIT(VIEN,0)),U)
 S PNAR=$P(REC,U,4)
 S DX=$P(REC,U,5)
 S QTY=$P(REC,U,16)
 S PRIM=$P(REC,U,7)
 I $G(DUZ("AG"))="I" D  ;P6
 .S MOD1=$P(REC,U,8)
 .S MOD2=$P(REC,U,9)
 E  D
 .N X
 .S X=+$O(^AUPNVCPT(IEN,1,0)),MOD1=$P($G(^(X,0)),U)
 .S X=+$O(^AUPNVCPT(IEN,1,X)),MOD2=$P($G(^(X,0)),U)
 S PRV=$P($G(^AUPNVCPT(IEN,12)),U,4)
 S CODE=$P($G(^ICPT(CPTIEN,0)),U)
 Q:CODE=""
 ;IHS/MSC/MGH Added check for taxonomy to display surgical procedures Patch 11
 S TAX=$O(^ATXAX("B","APCH HS MAJOR PROCEDURE CPTS",0))
 I TYP="SURGICAL",((CODE<10000)&(CODE'="00099"))!(CODE>69999) Q
 ;IHS/MSC/MGH Patch 18
 I TYP="SURGICAL",SRCH=1,'$$ICD^ATXAPI(CODE,TAX,1) Q  ;Not a CPT on this component
 I TYP="MEDICAL",CODE<90000!(CODE>99999) Q
 I TYP="ANESTHESIA",CODE>9999!(+CODE=0)!(CODE="00099") Q
 I TYP="RADIOLOGY",CODE<70000!(CODE>79999) Q
 I TYP="LABORATORY",CODE<80000!(CODE>89999) Q
 I TYP="MISCELLANEOUS",CODE'?1A4N Q
 S ITEMNAME=$P($G(^ICPT(CPTIEN,0)),U,2)
 D ARRAY
 ;MSC/IHS/MGH If there is a corresponding ICD0 code, save it for lookup later
 I $D(^ICPT(CPTIEN,"ICD",0)) D
 .S SCODE=0 F  S SCODE=$O(^ICPT(CPTIEN,"ICD",SCODE)) Q:SCODE=""!(SCODE="B")  D
 ..S ICDARRY(SCODE)=CODE_"^"_V2
 Q
 ; Build dental history
DENBLD N ADA
 D INIT("DEN")
 S REC=$G(^AUPNVDEN(IEN,0))
 Q:REC=""
 S ADA=$P(^AUTTADA(+REC,0),U)
 Q:'ADA
 S CPTIEN=$O(^ICPT("B",ADA,0))
 Q:'CPTIEN
 S CODE=$P($G(^ICPT(CPTIEN,0)),U)
 Q:CODE=""
 S ITEMNAME=$P($G(^ICPT(CPTIEN,0)),U,2)
 S VIEN=$P(REC,U,3)
 Q:VIEN=""
 S PRV=$P($G(^AUPNVDEN(IEN,12)),U,4)
 D ARRAY
 Q
 ; Interface with V TRANSACTION CODE file
TRANBLD D INIT("TC")
 S REC=$G(^AUPNVTC(IEN,0))
 Q:REC=""
 S TRANIEN=$P(REC,U)
 Q:TRANIEN=""
 S CODE=$P($G(^BCMTCF(TRANIEN,0)),U)
 S VIEN=$P(REC,U,3)
 S ITEMNAME=$P($G(^BCMTCF(TRANIEN,0)),U,7)
 S MOD1=$P(REC,U,8)
 S PRV=$P($G(^AUPNVTC(IEN,12)),U,4)
 D ARRAY
 Q
 ; Interface with V PROCEDURE file
PRCBLD(SRCH) N SKIP,X,Y,ICODE
 D INIT("PRC")
 S REC=$G(^AUPNVPRC(IEN,0))
 Q:REC=""
 S ICD0IEN=$P(REC,U)
 Q:ICD0IEN=""
 S VIEN=$P(REC,U,3)
 S V3=$P($G(^AUPNVSIT(VIEN,0)),U)
 S DX=$P(REC,U,5)
 S PNAR=$P(REC,U,4)
 S PRV=$P($G(^AUPNVPRC(IEN,12)),U,4)
 ;IHS/MSC/MGH Changed the 2 to a 1 to return the proper field Patch 17
 I $$AICD^BGOUTL2 S CODE=$P($$ICDOP^ICDEX(ICD0IEN,V3,"","I"),U,2)
 E  S CODE=$P($G(^ICD0(ICD0IEN,0)),U)
 Q:CODE=""
 ; Do not include ICD procedures that correspond to CPT procedures
 S (X,SKIP)=0
 ;IHS/MSC/MGH Use the saved array to check for matching codes and dates
 I 'VISITIEN D
 .S ICODE=0 F  S ICODE=$O(ICDARRY(ICODE)) Q:ICODE=""  D
 ..I ICD0IEN=ICODE&($P($G(ICDARRY(ICODE)),U,2)=V3) S SKIP=1 Q
 E  D
 .F  S X=$O(^ICPT("I",ICD0IEN,X)) Q:'X  D  Q:SKIP
 ..S Y=0
 ..F  S Y=$O(^AUPNVCPT("AD",VISITIEN,Y)) Q:'Y  I +^AUPNVCPT(Y,0)=X S SKIP=1 Q
 Q:SKIP
 I TYP="SURGICAL" D  Q:SKIP
 .S SKIP=1
 .;Patch 16 changed lookup
 .I SRCH,$$ICD^ATXAPI(ICD0IEN,$O(^ATXAX("B","APCH MINOR SURGICAL PROCS",0)),0) Q
 .;Q:CODE\1>85
 .;Q:CODE=69.7
 .;Q:CODE\1=23
 .;Q:CODE\1=24
 .S SKIP=0
 I $$AICD^BGOUTL2 S ITEMNAME=$P($$ICDOP^ICDEX(ICD0IEN,V3,"","I"),U,5)
 E  S ITEMNAME=$P($$ICDOP^ICDCODE(ICD0IEN,V3),U,5)
 ;S ITEMNAME=$P($G(^ICD0(ICD0IEN,0)),U,4)
 D ARRAY
 Q
INIT(X) S (CPT,ITEMNAME,PNAR,DX,PRIM,MOD1,MOD2,VIEN,CPTIEN,QTY,PRV,TRANIEN,ICD0IEN)="",VF=X
 Q
ARRAY N F,V,VDATE,FAC,FACNAM
 S F=$P($G(^AUPNVSIT(VIEN,0)),U,6)
 S FAC=$P($G(^AUTTLOC(+F,0)),U,10)
 S FACNAM=$P($G(^AUTTLOC(+F,0)),U)
 S FACNAM=$P($G(^DIC(4,+FACNAM,0)),U)
 S:$P($G(^AUPNVSIT(VIEN,21)),U)'="" FACNAM=$P(^(21),U)
 S V=$P($G(^AUPNVSIT(VIEN,0)),U)
 Q:V=""
 S VDATE=$$FMTDATE^BGOUTL(V)
 S:PNAR PNAR=$P($G(^AUTNPOV(PNAR,0)),U)
 S:PNAR="" PNAR=ITEMNAME
 ;S:DX DX=$P($G(^ICD9(DX,0)),U,3) ;DKA Patch 13
 I DX D
 .I $$AICD^BGOUTL2 S DX=$P($$ICDDX^ICDEX(DX,VDATE,"","I"),U,4)
 .E  S DX=$P($$ICDDX^ICDCODE(DX,VDATE),U,4)
 S:PRV PRV=$P($G(^VA(200,PRV,0)),U)
 S:MOD1 MOD1=MOD1_"~"_$P($G(@$$MODGBL@(MOD1,0)),U,2)
 S:MOD2 MOD2=MOD2_"~"_$P($G(@$$MODGBL@(MOD2,0)),U,2)
 S CNT=CNT+1
 S @RET@(CNT)=VDATE_U_FAC_U_FACNAM_U_CODE_U_ITEMNAME_U_PNAR_U_DX_U_PRIM_U_MOD1_U_MOD2_U_IEN_U_VIEN_U_CPTIEN_U_QTY_U_PRV_U_TRANIEN_U_ICD0IEN_U_$$ISLOCKED^BEHOENCX(VIEN)_U_VF
 Q
 ; Returns CPT modifier global reference
 ;IHS/MSC/MGH Changed for code set versioning
MODGBL() Q $S($$CSVACT^BGOUTL2():"^DIC(81.3)",$G(DUZ("AG"))="I":"^AUTTCMOD",1:"^DIC(81.3)")  ;P6
 ; Delete a V CPT, V Procedure, or V Transaction Code entry.
 ;  INP = IEN ^ Type
DEL(RET,INP) ;EP
 N IEN,TYP,FNUM
 S IEN=+INP,RET=""
 I 'IEN S RET=$$ERR^BGOUTL(1008) Q
 S TYP=$P(INP,U,2)
 S:TYP="" TYP="CPT"
 I TYP="CPT" D  Q:RET<0
 .N CPTIEN,ICD0IEN,VIEN,PRCIEN,X
 .S X=$G(^AUPNVCPT(IEN,0)),CPTIEN=+X,VIEN=+$P(X,U,3),ICD0IEN=0
 .F  S ICD0IEN=$O(^ICPT(CPTIEN,"ICD",ICD0IEN)) Q:'ICD0IEN  D
 ..S PRCIEN=0
 ..F  S PRCIEN=$O(^AUPNVPRC("AD",VIEN,PRCIEN)) Q:'PRCIEN  D  Q:RET<0
 ...D:+$G(^AUPNVPRC(PRCIEN,0))=ICD0IEN DEL(.RET,PRCIEN_"^PRC")
 S FNUM=+$P($G(@("^AUPNV"_TYP_"(0)")),U,2)
 I 'FNUM S RET=$$ERR^BGOUTL(1072,TYP)
 E  D VFDEL^BGOUTL2(.RET,FNUM,IEN)
 Q
 ; Set VCPT quantity
 ;  INP = VCPT IEN ^ Quantity
SETQTY(RET,INP) ;EP
 D SETVAL(.RET,+INP,$P(INP,U,2),.16)
 Q
 ; Set VCPT diagnosis
 ;  INP = VCPT IEN ^ Diagnosis IEN
SETDX(RET,INP) ;EP
 D SETVAL(.RET,+INP,"`"_$P(INP,U,2),.05)
 Q
 ; Set a value
SETVAL(RET,IEN,VAL,FLD) ;
 N FDA
 S FDA($$FNUM,IEN_",",FLD)=VAL
 S RET=$$UPDATE^BGOUTL(.FDA,"E")
 D:'RET VFEVT^BGOUTL2($$FNUM,IEN,1)
 Q
 ; Checks CPT code for validity
 ;  CPTIEN = CPT IEN
 ;  ACTDT  = Active Date
 ;  Returns null if OK, or -n^error text
CHKCPT(CPTIEN,ACTDT,IEN) ;EP
 N RET,X
 S RET="",IEN=$G(IEN)
 S ACTDT=$G(ACTDT,DT)
 I $$CSVACT^BGOUTL2("ICPTCOD") D
 .;IHS/MSC/MGH Added for HOTFIX to make sure we have the IEN and not the code
 .I +IEN S CPTIEN=$$CODEN^ICPTCOD(CPTIEN)
 .S X=$$CPT^ICPTCOD(CPTIEN,ACTDT)
 .I X<0 S RET=$$ERR^BGOUTL(1073)
 .E  I '$P(X,U,7) S RET=$$ERR^BGOUTL(1074)
 E  D
 .N DELDT
 .S X=$G(^ICPT(CPTIEN,0))
 .I X="" S RET=$$ERR^BGOUTL(1073) Q
 .I $P(X,U,4) S RET=$$ERR^BGOUTL(1074) Q
 .S DELDT=$P(X,U,7)
 .I DELDT D
 ..S:'ACTDT ACTDT=DT
 ..S:$$FMDIFF^XLFDT(ACTDT,DELDT)>-1 RET=$$ERR^BGOUTL(1075)
 Q RET
 ; Add/edit a VCPT entry
 ;  INP = Visit IEN [1] ^ CPT IEN [2] ^ Patient IEN [3] ^ Event Date [4] ^ Quantity [5] ^ Diagnosis [6] ^
 ;        Modifier #1 [7] ^ Provider IEN [8] ^ Principal [9] ^ V File IEN [10] ^ Narrative [11] ^ Modifier #2 [12] ^
 ;        Location IEN [13] ^ Outside Location [14] ^ Historical [15] ^ ICD Procedure Flag [16] ^ No Dups [17]
 ; .RET = VCPT IEN or -n^error text if not successful
SET(RET,INP) ;EP
 N VIEN,X,APCDALVR,DFN,TYPE,VFIEN,QTY,DX,MOD1,PRV,PRIN,NARR,MOD2,EVNTDT,LOCIEN,OUTLOC,HIST
 N DELDT,ICD0FLG,NODUP,VCAT,FDA,FNUM,VFNEW,IEN,CHKDT,APCDOVR
 S RET="",FNUM=$$FNUM
 S VIEN=+INP
 S TYPE=$P(INP,U,2)
 S DFN=$P(INP,U,3)
 S EVNTDT=$$CVTDATE^BGOUTL($P(INP,U,4))
 I EVNTDT="" S EVNTDT=$P($G(^AUPNVSIT(VIEN,0)),U,1)
 I EVNTDT="" S EVNTDT=$$NOW^XLFDT
 S QTY=$P(INP,U,5)
 S DX=$P(INP,U,6)
 S MOD1=$P(INP,U,7)
 S PRV=$P(INP,U,8)
 S PRIN=$P(INP,U,9)
 S VFIEN=$P(INP,U,10)
 S VFNEW='VFIEN
 S RET=$$FNDNARR^BGOUTL2($P(INP,U,11))
 Q:RET<0
 S NARR=$S(RET:"`"_RET,1:""),RET=""
 S MOD2=$P(INP,U,12)
 S LOCIEN=$P(INP,U,13)
 S OUTLOC=$P(INP,U,14)
 S HIST=$P(INP,U,15)
 ;IHS/MSC/MGH per Susan Richards this lookup is no longer supported
 ;S ICD0FLG=$P(INP,U,16)
 S NODUP=$P(INP,U,17)
 I 'VIEN,'HIST S RET=$$ERR^BGOUTL(1002) Q
 S VCAT=$P($G(^AUPNVSIT(VIEN,0)),U,7)
 S:VCAT="E" HIST=1
 S:'TYPE TYPE=+$O(^ICPT("B","00099",0))
 ;IHS/MSC/MGH Dealing with old data, setting to first date
 ;CHANGE DATE TO 2900101 PATCH 9
 I EVNTDT<2890101 S CHKDT=2890101
 E  S CHKDT=EVNTDT
 S RET=$$CHKCPT(TYPE,CHKDT)
 Q:RET<0
 I HIST D  Q:RET<0
 .S RET=$$MAKEHIST^BGOUTL(DFN,EVNTDT,$S($L(OUTLOC):OUTLOC,1:LOCIEN),VIEN)
 .S:RET>0 VIEN=RET
 S RET=$$CHKVISIT^BGOUTL(VIEN,DFN)
 Q:RET
 I 'VFIEN D  Q:RET
 .I EVNTDT<DT S APCDOVR=1   ;IHS/MSC/MGH auto store if old data, Patch 9
 .D VFNEW^BGOUTL2(.RET,FNUM,TYPE,VIEN,$S(NODUP:"CPT",1:""))
 .S:RET>0 VFIEN=RET,RET=""
 I PRIN="X"!(PRIN="") D
 .S X=$$GETPRIN(VIEN)
 .S PRIN=$S('X:"Y",X=VFIEN:"Y",1:"N")
 S FDA=$NA(FDA(FNUM,VFIEN_","))
 S @FDA@(.01)="`"_TYPE
 S @FDA@(.04)=NARR
 S @FDA@(.05)=$S(DX:"`"_DX,1:"@")
 S @FDA@(.07)=PRIN
 I $G(DUZ("AG"))="I" D  ;P6
 .S @FDA@(.08)=$S(MOD1:"`"_MOD1,1:"@")
 .S @FDA@(.09)=$S(MOD2:"`"_MOD2,1:"@")
 E  D
 .;IHS/MSC/MGH changes added patch 8
 .I MOD1 I '$D(^AUPNVCPT(VFIEN,1,"B",MOD1)) D
 ..S:MOD1 FDA(9000010.181,"?+1,"_VFIEN_",",.01)="`"_MOD1
 .I MOD2 I '$D(^AUPNVCPT(VFIEN,2,"B",MOD2)) D
 ..S:MOD2 FDA(9000010.181,"?+1,"_VFIEN_",",.01)="`"_MOD2
 .S IEN(2)=1,IEN(3)=2
 S @FDA@(.16)=$S(QTY>0:QTY,1:1)
 S @FDA@(1201)="N"
 ;S @FDA@(1204)="`"_$S(PRV:PRV,1:DUZ)  ;  PATCH 5
 S @FDA@(1204)="`"_DUZ  ;PATCH 5
 ;Patch 11 Set date entered
 I VFNEW D
 .S @FDA@(1216)="N"
 .S @FDA@(1217)="`"_DUZ
 ;Patch 11 Set last modified
 S @FDA@(1218)="N"
 S @FDA@(1219)="`"_DUZ
 S RET=$$UPDATE^BGOUTL(.FDA,"E",.IEN)
 I RET,VFNEW,$$DELETE^BGOUTL(FNUM,VFIEN)
 Q:RET
 S:PRIN="Y" RET=$$SETPRIN(VIEN,VFIEN)
 ;MSC/IHS/MGH Call to create entry in procedure file is removed in patch 5
 ;I 'RET,ICD0FLG D
 ;.N VFIEN,PRCIEN,FNUM
 ;.S PRCIEN=$O(^ICPT(TYPE,"ICD",0))
 ;.Q:'PRCIEN
 ;.S FNUM=9000010.08,VFIEN=0
 ;.D VFNEW^BGOUTL2(.RET,FNUM,PRCIEN,VIEN)
 ;.S:RET>0 VFIEN=RET,RET=""
 ;.Q:RET
 ;.S FDA=$NA(FDA(FNUM,VFIEN_","))
 ;.S @FDA@(.04)=NARR
 ;.S @FDA@(1201)=$S(EVNTDT:EVNTDT,1:"N")
 ;.;S @FDA@(1204)="`"_$S(PRV:PRV,1:DUZ)  ;PATCH 5
 ;.S @FDA@(1204)="`"_DUZ
 ;.S RET=$$UPDATE^BGOUTL(.FDA,"E")
 D:'RET VFEVT^BGOUTL2(FNUM,VFIEN,'VFNEW)
 S:'RET RET=VFIEN
 Q
 ; Return IEN of principal VCPT entry
GETPRIN(VIEN) ;
 N VCPT
 S VCPT=0
 F  S VCPT=$O(^AUPNVCPT("AD",VIEN,VCPT)) Q:'VCPT  Q:$P($G(^AUPNVCPT(VCPT,0)),U,7)="Y"
 Q VCPT
 ; Set principal flag for specified entry, clearing all others
SETPRIN(VIEN,VCPTIEN) ;
 N VCPT,FDA
 S VCPT=0
 F  S VCPT=$O(^AUPNVCPT("AD",VIEN,VCPT)) Q:'VCPT  D
 .S FDA($$FNUM,VCPT_",",.07)=$S(VCPT=VCPTIEN:"Y",1:"N")
 Q $$UPDATE^BGOUTL(.FDA)
 ; Add CPT code
ADDCPT(CPT,ICD,VSIT,DFN,PRV) ;EP
 N FDA,IEN,RET
 S FDA=$NA(FDA($$FNUM,"+1,"))
 S @FDA@(.01)=CPT
 S @FDA@(.02)=DFN
 S @FDA@(.03)=VSIT
 S:$G(ICD) @FDA@(.05)=ICD
 S @FDA@(.16)=1
 S @FDA@(1201)=$$NOW^XLFDT
 S @FDA@(1204)=$S(PRV:PRV,1:DUZ)
 S RET=$$UPDATE^BGOUTL(.FDA,,.IEN)
 D:'RET VFEVT^BGOUTL2($$FNUM,IEN(1),0)
 Q RET
 ; Return V File #
FNUM() Q 9000010.18