BGOVER ; IHS/BAO/TMD - Manage V EMERGENCY ROOM ;20-Mar-2007 13:52;DKM
;;1.1;BGO COMPONENTS;**1,3**;Mar 20, 2007
;---------------------------------------------
; Get V Emergency Visit entries for individual entry, visit, or patient
; INP = Patient IEN [1] ^ V File IEN [2] ^ Visit IEN [3]
GET(RET,INP) ;EP
D VFGET^BGOUTL2(.RET,INP,$$FNUM,".03;.04;.05;.06;.07;.08;.09;.11;.12;.13;.14;.15;.16;1201;1204")
Q
; Add/edit V ER Visit entry
; INP = V File IEN [1] ^ Visit IEN [2] ^ Urgency [3] ^ Ambulation Mode [4] ^ Transport Mode [5] ^ Other Means [6] ^
; Notified [7] ^ Informant [8] ^ Disposition [9] ^ Other Disposition [10] ^ Depart Date/Time [11] ^
; Left Area Date/Time [12] ^ Condition on Departure [13] ^ Transferred To [14]
SET(RET,INP) ;
N VIEN,VFIEN,VFNEW,FNUM,FDA
S RET="",FNUM=$$FNUM
S VFIEN=+INP
S VFNEW='VFIEN
S VIEN=+$P(INP,U,2)
I $P($G(^AUPNVSIT(VIEN,0)),U,8)'=30 S RET=$$ERR^BGOUTL(1076) Q
S RET=$$CHKVISIT^BGOUTL(VIEN)
Q:RET
S:'VFIEN VFIEN=$O(^AUPNVER("AD",VIEN,0))
I 'VFIEN D Q:'VFIEN
.D VFNEW^BGOUTL2(.RET,FNUM,"IHS-114 ER",VIEN)
.S:RET>0 VFIEN=RET,RET=""
S FDA=$NA(FDA(FNUM,VFIEN_","))
S @FDA@(.04)=$P(INP,U,3)
S @FDA@(.07)=$P(INP,U,4)
S @FDA@(.05)=$P(INP,U,5)
S @FDA@(.06)=$P(INP,U,6)
S @FDA@(.09)=$P(INP,U,7)
S @FDA@(.08)=$P(INP,U,8)
S @FDA@(.11)=$P(INP,U,9)
S @FDA@(.12)=$P(INP,U,10)
S @FDA@(.13)=$P(INP,U,11)
S @FDA@(.14)=$P(INP,U,12)
S @FDA@(.15)=$P(INP,U,13)
S @FDA@(.16)=$P(INP,U,14)
S RET=$$UPDATE^BGOUTL(.FDA,"E")
D:'RET VFEVT^BGOUTL2(FNUM,VFIEN,'VFNEW)
S:'RET RET=VFIEN
Q
; Delete a V ER Visit entry
DEL(RET,VFIEN) ;EP
D VFDEL^BGOUTL2(.RET,$$FNUM,VFIEN)
Q
; Return V File #
FNUM() Q 9000010.29
BGOVER ; IHS/BAO/TMD - Manage V EMERGENCY ROOM ;20-Mar-2007 13:52;DKM
+1 ;;1.1;BGO COMPONENTS;**1,3**;Mar 20, 2007
+2 ;---------------------------------------------
+3 ; Get V Emergency Visit entries for individual entry, visit, or patient
+4 ; INP = Patient IEN [1] ^ V File IEN [2] ^ Visit IEN [3]
GET(RET,INP) ;EP
+1 DO VFGET^BGOUTL2(.RET,INP,$$FNUM,".03;.04;.05;.06;.07;.08;.09;.11;.12;.13;.14;.15;.16;1201;1204")
+2 QUIT
+3 ; Add/edit V ER Visit entry
+4 ; INP = V File IEN [1] ^ Visit IEN [2] ^ Urgency [3] ^ Ambulation Mode [4] ^ Transport Mode [5] ^ Other Means [6] ^
+5 ; Notified [7] ^ Informant [8] ^ Disposition [9] ^ Other Disposition [10] ^ Depart Date/Time [11] ^
+6 ; Left Area Date/Time [12] ^ Condition on Departure [13] ^ Transferred To [14]
SET(RET,INP) ;
+1 NEW VIEN,VFIEN,VFNEW,FNUM,FDA
+2 SET RET=""
SET FNUM=$$FNUM
+3 SET VFIEN=+INP
+4 SET VFNEW='VFIEN
+5 SET VIEN=+$PIECE(INP,U,2)
+6 IF $PIECE($GET(^AUPNVSIT(VIEN,0)),U,8)'=30
SET RET=$$ERR^BGOUTL(1076)
QUIT
+7 SET RET=$$CHKVISIT^BGOUTL(VIEN)
+8 IF RET
QUIT
+9 IF 'VFIEN
SET VFIEN=$ORDER(^AUPNVER("AD",VIEN,0))
+10 IF 'VFIEN
Begin DoDot:1
+11 DO VFNEW^BGOUTL2(.RET,FNUM,"IHS-114 ER",VIEN)
+12 IF RET>0
SET VFIEN=RET
SET RET=""
End DoDot:1
IF 'VFIEN
QUIT
+13 SET FDA=$NAME(FDA(FNUM,VFIEN_","))
+14 SET @FDA@(.04)=$PIECE(INP,U,3)
+15 SET @FDA@(.07)=$PIECE(INP,U,4)
+16 SET @FDA@(.05)=$PIECE(INP,U,5)
+17 SET @FDA@(.06)=$PIECE(INP,U,6)
+18 SET @FDA@(.09)=$PIECE(INP,U,7)
+19 SET @FDA@(.08)=$PIECE(INP,U,8)
+20 SET @FDA@(.11)=$PIECE(INP,U,9)
+21 SET @FDA@(.12)=$PIECE(INP,U,10)
+22 SET @FDA@(.13)=$PIECE(INP,U,11)
+23 SET @FDA@(.14)=$PIECE(INP,U,12)
+24 SET @FDA@(.15)=$PIECE(INP,U,13)
+25 SET @FDA@(.16)=$PIECE(INP,U,14)
+26 SET RET=$$UPDATE^BGOUTL(.FDA,"E")
+27 IF 'RET
DO VFEVT^BGOUTL2(FNUM,VFIEN,'VFNEW)
+28 IF 'RET
SET RET=VFIEN
+29 QUIT
+30 ; Delete a V ER Visit entry
DEL(RET,VFIEN) ;EP
+1 DO VFDEL^BGOUTL2(.RET,$$FNUM,VFIEN)
+2 QUIT
+3 ; Return V File #
FNUM() QUIT 9000010.29