BGOVAMI ; IHS/MSC/DKA - Manage V AMI ;16-May-2018 12:43;DU
;;1.1;BGO COMPONENTS;**13,14,24**;Mar 20, 2007;Build 1
;12.26.13 - MSC/JS add translation for Midnight and blank 'E' input string check.
;01.08.14 - MSC/DKA Send "@" to filer to delete comments when they are blank in the SET call.
;01.08.14 - MSC/JS delete fibrinolytic fields for fibrin therapy initiated or fibrin therapy refused.
;01.10.14 - MSC/DKA Remove calls to MIDGET() and MIDSET() because GUI got changed.
; Added code to change date only values to midnight (<Date-1>.24),
; and code to delete dates when they are blank.
;01.17.14 - MSC/JS - p13 update fixes added (IHS CCB items from Monday IHS call 1/13)
;01.22.14 - MSC/JS EHR will send a blank 'E' for 'EKG DONE' box unchecked
;01.23.14 - MSC/JS - move SET to BGOVAMI2 to keep within 15k routine size limits
;03.19.14 - MCS/DKA - Added FIBRINOLYTIC THER D/T ENTERED to "F" string in GET().
;05.14.18 - MSC/MGH - Added PCI data for eCQM
;
; Get Chest Pain (AMI) by individual entry, visit, or patient
; INP = Patient IEN [1] ^ V File IEN [2] ^ Visit IEN [3]
GET(RET,INP) ;EP
N COUNT,PNAR,FN,FNS,FNUM,FX,DIDNOT,Z2,INDX,IENARR,VFARR,VFDATA,VFDEL,VFFLD,VFIEN,VFMSG,VFSTR,VIEN,DNIR,RETMID
S RET=$$TMPGBL^BGOUTL,FNUM=$$FNUM,COUNT=0
; Get the V file IEN value(s)
; The number of values is returned in IENARR
D GETVFIEN^BGOVAMI1(.IENARR,INP)
I +$G(IENARR)=0 S @RET@(0)=$$ERR^BGOUTL(1035) Q ; Indicate there's an unexplained error (Item not found)
I IENARR<0 S @RET@(0)=IENARR Q
F INDX=1:1:IENARR D
.S FNUM=$$FNUM ; Reset this for each iteration
.S VFIEN=IENARR(INDX)
.K VFDATA,VFMSG
.S VFDEL=0
.D GETS^DIQ($$FNUM,VFIEN,"**","IE","VFDATA","VFMSG")
.I $D(VFMSG("DIERR")) D
..S VFARR=0_U_$G(VFMSG("DIERR",1))_U_$G(VFMSG("DIERR",1,"TEXT",1))
..S VIEN=0 ; So $$ISLOCKED returns -1
.E D
..S FX=$O(VFDATA(FNUM,"")) ; Take the first subscript
..I VFDATA(FNUM,FX,5.01,"I") S VFDEL=1 Q ; Ignore Deleted Records
..S @RET@(0)=$G(@RET@(0))+1 ; Increment the top-level counter for active records
..S VFARR=0,VFSTR="A"
..S $P(VFSTR,U,2)=VFDATA(FNUM,FX,.01,"I") ;ArrivalDateTime
..S $P(VFSTR,U,3)=VFDATA(FNUM,FX,.02,"I") ;PatientName
..S (VIEN,$P(VFSTR,U,4))=VFDATA(FNUM,FX,.03,"I") ;Visit
..;S $P(VFSTR,U,5)=VFDATA(FNUM,FX,1203,"I") ;clinic
..S $P(VFSTR,U,5)=VFDATA(FNUM,FX,1204,"I") ;EncounterProvider
..S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
..; Add the comment lines from field 1 on separate "AT" records
..S FNS=0
..F S FNS=$O(VFDATA(FNUM,FX,1,FNS)) Q:'FNS D
...S VFSTR="AT"
...S $P(VFSTR,U,2)=$G(VFDATA(FNUM,FX,1,FNS))
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
..S VFSTR="E"
..S $P(VFSTR,U,2)=VFDATA(FNUM,FX,.07,"I") ;EKGDoneDateTime
..S $P(VFSTR,U,3)=VFDATA(FNUM,FX,1201,"I") ;EventDateTime
..S $P(VFSTR,U,4)=VFDATA(FNUM,FX,1202,"I") ;OrderingProvider
..S $P(VFSTR,U,5)=VFDATA(FNUM,FX,1210,"I") ;OutsideProviderName
..S $P(VFSTR,U,6)=VFDATA(FNUM,FX,1215,"I") ;OrderingLocation
..S $P(VFSTR,U,7)=VFDATA(FNUM,FX,1101,"I") ;EKG done SNOMED P24
..S $P(VFSTR,U,8)=VFDATA(FNUM,FX,1101.019,"E") ;EKG done SNOMED text P24
..S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
..; Add the comment lines from field 3 on separate "ET" records
..S FNS=0 F S FNS=$O(VFDATA(FNUM,FX,3,FNS)) Q:'FNS D
...S VFSTR="ET"
...S $P(VFSTR,U,2)=$G(VFDATA(FNUM,FX,3,FNS))
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
..S VFSTR="F"
..S $P(VFSTR,U,2)=VFDATA(FNUM,FX,.11,"I") ;FibrinolyticTherapyInitiated
..S $P(VFSTR,U,3)=VFDATA(FNUM,FX,.12,"I") ;FibrinolyticTherapyDateTimeEntered
..S $P(VFSTR,U,4)=VFDATA(FNUM,FX,.14,"I") ;DidNotInit
..S DIDNOT=VFDATA(FNUM,FX,.17,"I") ;DidnotInitReason
..I $L(DIDNOT)<4 S $P(VFSTR,U,5)=DIDNOT
..E S Z2=$O(^AUTTREFR("B",DIDNOT,"")) S $P(VFSTR,U,5)=Z2
..S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
..; Add the comment lines from field 4 on separate "FT" records
..S FNS=0 F S FNS=$O(VFDATA(FNUM,FX,4,FNS)) Q:'FNS D
...S VFSTR="FT"
...S $P(VFSTR,U,2)=$G(VFDATA(FNUM,FX,4,FNS))
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
..S VFSTR="PC"
..;IHS/MSC/MGH PCD done data included patch 24
..S $P(VFSTR,U,2)=VFDATA(FNUM,FX,1102,"I") ;PCI done
..S $P(VFSTR,U,3)=VFDATA(FNUM,FX,1103,"I") ;Date/time PCI done
..S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
..S VFSTR="O"
..S $P(VFSTR,U,2)=VFDATA(FNUM,FX,.04,"I") ;OnsetSymptoms
..S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
..; Add the comment lines from field 2 on separate "OT" records
..S FNS=0
..F S FNS=$O(VFDATA(FNUM,FX,2,FNS)) Q:'FNS D
...S VFSTR="OT"
...S $P(VFSTR,U,2)=$G(VFDATA(FNUM,FX,2,FNS))
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
..;For the Protocol Standing Orders, create a separate set of P and PT records for each multiple
..S FNUM=$$FNUM_13
..S FX="" F S FX=$O(VFDATA(FNUM,FX)) Q:FX="" D
...S VFSTR="P"_U_$P(FX,",")
...S $P(VFSTR,U,3)=VFDATA(FNUM,FX,.01,"I") ;ProtocolStandingOrders
...S $P(VFSTR,U,4)=VFDATA(FNUM,FX,.02,"I") ;EventDateTime
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
...; Add the comment lines
...S FNS=0 F S FNS=$O(VFDATA(FNUM,FX,1,FNS)) Q:'FNS D
....S VFSTR="PT"_U_$P(FX,",")
....S $P(VFSTR,U,3)=$G(VFDATA(FNUM,FX,1,FNS))
....S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
..;For the EKGFindings, create a separate set of EF and EFT records for each multiple
..S FNUM=$$FNUM_14
..S FX="" F S FX=$O(VFDATA(FNUM,FX)) Q:FX="" D
...S VFSTR="EF"_U_$P(FX,",")
...S $P(VFSTR,U,3)=VFDATA(FNUM,FX,.01,"I") ;EkgFindingsConceptId
...;S $P(VFSTR,U,4)=VFDATA(FNUM,FX,.02,"I") ;Description ID
...S PNAR=VFDATA(FNUM,FX,.03,"I")
...I +PNAR S $P(VFSTR,U,4)=$P($P($G(^AUTNPOV(PNAR,0)),U,1),"|",1) ;Provider text
...;S $P(VFSTR,U,6)=VFDATA(FNUM,FX,.04,"I") ;ICD9 Mapping
...;S $P(VFSTR,U,6)=VFDATA(FNUM,FX,.05,"I") ;ICD10 Mapping
...S $P(VFSTR,U,5)=VFDATA(FNUM,FX,.06,"I") ;Interpreted By
...S $P(VFSTR,U,6)=VFDATA(FNUM,FX,.07,"I") ;Event Date/Time
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
...; Add the comment lines
...S FNS=0 F S FNS=$O(VFDATA(FNUM,FX,1,FNS)) Q:'FNS D
....S VFSTR="EFT"_U_$P(FX,",")
....S $P(VFSTR,U,3)=$G(VFDATA(FNUM,FX,1,FNS))
....S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
..;For the Symptoms, create a separate set of S records for each multiple
..S FNUM=$$FNUM_15
..S FX="" F S FX=$O(VFDATA(FNUM,FX)) Q:FX="" D
...S VFSTR="S"_U_$P(FX,",")
...S $P(VFSTR,U,3)=VFDATA(FNUM,FX,.01,"I") ;Symptoms
...S $P(VFSTR,U,4)=VFDATA(FNUM,FX,.019,"I") ;Symptom Preferred Text
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
.I 'VFDEL D
..S COUNT=COUNT+1
..M @RET@(COUNT)=VFARR
..S @RET@(COUNT)=VFIEN_U_VFARR_U_$$ISLOCKED^BEHOENCX(VIEN) ; Reset scalar value to include the Visit File IEN
..K VFARR
Q
; Add/edit V AMI entry
SET(RET,INP) ;EP
; This is the exact opposite of the GET call.
; INP is an array of strings.
; The first string is the VFIEN^NumberOfLines^VisitIsLocked, check BGOVAMI2 for input string descriptions
S RET=""
D SET^BGOVAMI2(.RET,.INP)
Q
; Delete a Chest Pain (AMI) entry
; INP = V File IEN ^ DELETE REASON ^ OTHER
; Logically Delete a Chest Pain (AMI) entry
; Flag the entry as Entered in Error
; Specify the Reason and Comment (if Reason is Other)
DEL(RET,INP) ;EP
N COMMENT,FDA,REASON,VFIEN
S VFIEN=$P(INP,U)
S REASON=$P(INP,U,2)
S COMMENT=$P(INP,U,3)
I VFIEN="" S RET=$$ERR^BGOUTL(1008) Q ; Missing input data
I '$D(^AUPNVAMI(VFIEN)) S RET=$$ERR^BGOUTL(1035) Q ; Item not found
S FDA=$NA(FDA($$FNUM,VFIEN_","))
S @FDA@(5.01)=1
S @FDA@(5.02)=DUZ
S @FDA@(5.03)=$$NOW^XLFDT()
S @FDA@(5.04)=REASON
S @FDA@(5.05)=COMMENT
S RET=$$UPDATE^BGOUTL(.FDA,,VFIEN)
S:RET="" RET=1
;Check/Delete entry in PATIENT REFUSALS FOR SERVICE/NMI file #9000022
N REFREA
S REFREA=$$GET1^DIQ(9000010.62,VFIEN,.17)
I $G(REFREA)]"" D
.N RET S RET=$$DELREF^BGOVAMI1(VFIEN)
Q
; Return V File #
; This method signature allows this to be called as a Remote Procedure.
FNUM(RET,INP) S RET=9000010.62
Q RET
BGOVAMI ; IHS/MSC/DKA - Manage V AMI ;16-May-2018 12:43;DU
+1 ;;1.1;BGO COMPONENTS;**13,14,24**;Mar 20, 2007;Build 1
+2 ;12.26.13 - MSC/JS add translation for Midnight and blank 'E' input string check.
+3 ;01.08.14 - MSC/DKA Send "@" to filer to delete comments when they are blank in the SET call.
+4 ;01.08.14 - MSC/JS delete fibrinolytic fields for fibrin therapy initiated or fibrin therapy refused.
+5 ;01.10.14 - MSC/DKA Remove calls to MIDGET() and MIDSET() because GUI got changed.
+6 ; Added code to change date only values to midnight (<Date-1>.24),
+7 ; and code to delete dates when they are blank.
+8 ;01.17.14 - MSC/JS - p13 update fixes added (IHS CCB items from Monday IHS call 1/13)
+9 ;01.22.14 - MSC/JS EHR will send a blank 'E' for 'EKG DONE' box unchecked
+10 ;01.23.14 - MSC/JS - move SET to BGOVAMI2 to keep within 15k routine size limits
+11 ;03.19.14 - MCS/DKA - Added FIBRINOLYTIC THER D/T ENTERED to "F" string in GET().
+12 ;05.14.18 - MSC/MGH - Added PCI data for eCQM
+13 ;
+14 ; Get Chest Pain (AMI) by individual entry, visit, or patient
+15 ; INP = Patient IEN [1] ^ V File IEN [2] ^ Visit IEN [3]
GET(RET,INP) ;EP
+1 NEW COUNT,PNAR,FN,FNS,FNUM,FX,DIDNOT,Z2,INDX,IENARR,VFARR,VFDATA,VFDEL,VFFLD,VFIEN,VFMSG,VFSTR,VIEN,DNIR,RETMID
+2 SET RET=$$TMPGBL^BGOUTL
SET FNUM=$$FNUM
SET COUNT=0
+3 ; Get the V file IEN value(s)
+4 ; The number of values is returned in IENARR
+5 DO GETVFIEN^BGOVAMI1(.IENARR,INP)
+6 ; Indicate there's an unexplained error (Item not found)
IF +$GET(IENARR)=0
SET @RET@(0)=$$ERR^BGOUTL(1035)
QUIT
+7 IF IENARR<0
SET @RET@(0)=IENARR
QUIT
+8 FOR INDX=1:1:IENARR
Begin DoDot:1
+9 ; Reset this for each iteration
SET FNUM=$$FNUM
+10 SET VFIEN=IENARR(INDX)
+11 KILL VFDATA,VFMSG
+12 SET VFDEL=0
+13 DO GETS^DIQ($$FNUM,VFIEN,"**","IE","VFDATA","VFMSG")
+14 IF $DATA(VFMSG("DIERR"))
Begin DoDot:2
+15 SET VFARR=0_U_$GET(VFMSG("DIERR",1))_U_$GET(VFMSG("DIERR",1,"TEXT",1))
+16 ; So $$ISLOCKED returns -1
SET VIEN=0
End DoDot:2
+17 IF '$TEST
Begin DoDot:2
+18 ; Take the first subscript
SET FX=$ORDER(VFDATA(FNUM,""))
+19 ; Ignore Deleted Records
IF VFDATA(FNUM,FX,5.01,"I")
SET VFDEL=1
QUIT
+20 ; Increment the top-level counter for active records
SET @RET@(0)=$GET(@RET@(0))+1
+21 SET VFARR=0
SET VFSTR="A"
+22 ;ArrivalDateTime
SET $PIECE(VFSTR,U,2)=VFDATA(FNUM,FX,.01,"I")
+23 ;PatientName
SET $PIECE(VFSTR,U,3)=VFDATA(FNUM,FX,.02,"I")
+24 ;Visit
SET (VIEN,$PIECE(VFSTR,U,4))=VFDATA(FNUM,FX,.03,"I")
+25 ;S $P(VFSTR,U,5)=VFDATA(FNUM,FX,1203,"I") ;clinic
+26 ;EncounterProvider
SET $PIECE(VFSTR,U,5)=VFDATA(FNUM,FX,1204,"I")
+27 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+28 ; Add the comment lines from field 1 on separate "AT" records
+29 SET FNS=0
+30 FOR
SET FNS=$ORDER(VFDATA(FNUM,FX,1,FNS))
IF 'FNS
QUIT
Begin DoDot:3
+31 SET VFSTR="AT"
+32 SET $PIECE(VFSTR,U,2)=$GET(VFDATA(FNUM,FX,1,FNS))
+33 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
End DoDot:3
+34 SET VFSTR="E"
+35 ;EKGDoneDateTime
SET $PIECE(VFSTR,U,2)=VFDATA(FNUM,FX,.07,"I")
+36 ;EventDateTime
SET $PIECE(VFSTR,U,3)=VFDATA(FNUM,FX,1201,"I")
+37 ;OrderingProvider
SET $PIECE(VFSTR,U,4)=VFDATA(FNUM,FX,1202,"I")
+38 ;OutsideProviderName
SET $PIECE(VFSTR,U,5)=VFDATA(FNUM,FX,1210,"I")
+39 ;OrderingLocation
SET $PIECE(VFSTR,U,6)=VFDATA(FNUM,FX,1215,"I")
+40 ;EKG done SNOMED P24
SET $PIECE(VFSTR,U,7)=VFDATA(FNUM,FX,1101,"I")
+41 ;EKG done SNOMED text P24
SET $PIECE(VFSTR,U,8)=VFDATA(FNUM,FX,1101.019,"E")
+42 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+43 ; Add the comment lines from field 3 on separate "ET" records
+44 SET FNS=0
FOR
SET FNS=$ORDER(VFDATA(FNUM,FX,3,FNS))
IF 'FNS
QUIT
Begin DoDot:3
+45 SET VFSTR="ET"
+46 SET $PIECE(VFSTR,U,2)=$GET(VFDATA(FNUM,FX,3,FNS))
+47 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
End DoDot:3
+48 SET VFSTR="F"
+49 ;FibrinolyticTherapyInitiated
SET $PIECE(VFSTR,U,2)=VFDATA(FNUM,FX,.11,"I")
+50 ;FibrinolyticTherapyDateTimeEntered
SET $PIECE(VFSTR,U,3)=VFDATA(FNUM,FX,.12,"I")
+51 ;DidNotInit
SET $PIECE(VFSTR,U,4)=VFDATA(FNUM,FX,.14,"I")
+52 ;DidnotInitReason
SET DIDNOT=VFDATA(FNUM,FX,.17,"I")
+53 IF $LENGTH(DIDNOT)<4
SET $PIECE(VFSTR,U,5)=DIDNOT
+54 IF '$TEST
SET Z2=$ORDER(^AUTTREFR("B",DIDNOT,""))
SET $PIECE(VFSTR,U,5)=Z2
+55 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+56 ; Add the comment lines from field 4 on separate "FT" records
+57 SET FNS=0
FOR
SET FNS=$ORDER(VFDATA(FNUM,FX,4,FNS))
IF 'FNS
QUIT
Begin DoDot:3
+58 SET VFSTR="FT"
+59 SET $PIECE(VFSTR,U,2)=$GET(VFDATA(FNUM,FX,4,FNS))
+60 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
End DoDot:3
+61 SET VFSTR="PC"
+62 ;IHS/MSC/MGH PCD done data included patch 24
+63 ;PCI done
SET $PIECE(VFSTR,U,2)=VFDATA(FNUM,FX,1102,"I")
+64 ;Date/time PCI done
SET $PIECE(VFSTR,U,3)=VFDATA(FNUM,FX,1103,"I")
+65 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+66 SET VFSTR="O"
+67 ;OnsetSymptoms
SET $PIECE(VFSTR,U,2)=VFDATA(FNUM,FX,.04,"I")
+68 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+69 ; Add the comment lines from field 2 on separate "OT" records
+70 SET FNS=0
+71 FOR
SET FNS=$ORDER(VFDATA(FNUM,FX,2,FNS))
IF 'FNS
QUIT
Begin DoDot:3
+72 SET VFSTR="OT"
+73 SET $PIECE(VFSTR,U,2)=$GET(VFDATA(FNUM,FX,2,FNS))
+74 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
End DoDot:3
+75 ;For the Protocol Standing Orders, create a separate set of P and PT records for each multiple
+76 SET FNUM=$$FNUM_13
+77 SET FX=""
FOR
SET FX=$ORDER(VFDATA(FNUM,FX))
IF FX=""
QUIT
Begin DoDot:3
+78 SET VFSTR="P"_U_$PIECE(FX,",")
+79 ;ProtocolStandingOrders
SET $PIECE(VFSTR,U,3)=VFDATA(FNUM,FX,.01,"I")
+80 ;EventDateTime
SET $PIECE(VFSTR,U,4)=VFDATA(FNUM,FX,.02,"I")
+81 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+82 ; Add the comment lines
+83 SET FNS=0
FOR
SET FNS=$ORDER(VFDATA(FNUM,FX,1,FNS))
IF 'FNS
QUIT
Begin DoDot:4
+84 SET VFSTR="PT"_U_$PIECE(FX,",")
+85 SET $PIECE(VFSTR,U,3)=$GET(VFDATA(FNUM,FX,1,FNS))
+86 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
End DoDot:4
End DoDot:3
+87 ;For the EKGFindings, create a separate set of EF and EFT records for each multiple
+88 SET FNUM=$$FNUM_14
+89 SET FX=""
FOR
SET FX=$ORDER(VFDATA(FNUM,FX))
IF FX=""
QUIT
Begin DoDot:3
+90 SET VFSTR="EF"_U_$PIECE(FX,",")
+91 ;EkgFindingsConceptId
SET $PIECE(VFSTR,U,3)=VFDATA(FNUM,FX,.01,"I")
+92 ;S $P(VFSTR,U,4)=VFDATA(FNUM,FX,.02,"I") ;Description ID
+93 SET PNAR=VFDATA(FNUM,FX,.03,"I")
+94 ;Provider text
IF +PNAR
SET $PIECE(VFSTR,U,4)=$PIECE($PIECE($GET(^AUTNPOV(PNAR,0)),U,1),"|",1)
+95 ;S $P(VFSTR,U,6)=VFDATA(FNUM,FX,.04,"I") ;ICD9 Mapping
+96 ;S $P(VFSTR,U,6)=VFDATA(FNUM,FX,.05,"I") ;ICD10 Mapping
+97 ;Interpreted By
SET $PIECE(VFSTR,U,5)=VFDATA(FNUM,FX,.06,"I")
+98 ;Event Date/Time
SET $PIECE(VFSTR,U,6)=VFDATA(FNUM,FX,.07,"I")
+99 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+100 ; Add the comment lines
+101 SET FNS=0
FOR
SET FNS=$ORDER(VFDATA(FNUM,FX,1,FNS))
IF 'FNS
QUIT
Begin DoDot:4
+102 SET VFSTR="EFT"_U_$PIECE(FX,",")
+103 SET $PIECE(VFSTR,U,3)=$GET(VFDATA(FNUM,FX,1,FNS))
+104 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
End DoDot:4
End DoDot:3
+105 ;For the Symptoms, create a separate set of S records for each multiple
+106 SET FNUM=$$FNUM_15
+107 SET FX=""
FOR
SET FX=$ORDER(VFDATA(FNUM,FX))
IF FX=""
QUIT
Begin DoDot:3
+108 SET VFSTR="S"_U_$PIECE(FX,",")
+109 ;Symptoms
SET $PIECE(VFSTR,U,3)=VFDATA(FNUM,FX,.01,"I")
+110 ;Symptom Preferred Text
SET $PIECE(VFSTR,U,4)=VFDATA(FNUM,FX,.019,"I")
+111 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
End DoDot:3
End DoDot:2
+112 IF 'VFDEL
Begin DoDot:2
+113 SET COUNT=COUNT+1
+114 MERGE @RET@(COUNT)=VFARR
+115 ; Reset scalar value to include the Visit File IEN
SET @RET@(COUNT)=VFIEN_U_VFARR_U_$$ISLOCKED^BEHOENCX(VIEN)
+116 KILL VFARR
End DoDot:2
End DoDot:1
+117 QUIT
+118 ; Add/edit V AMI entry
SET(RET,INP) ;EP
+1 ; This is the exact opposite of the GET call.
+2 ; INP is an array of strings.
+3 ; The first string is the VFIEN^NumberOfLines^VisitIsLocked, check BGOVAMI2 for input string descriptions
+4 SET RET=""
+5 DO SET^BGOVAMI2(.RET,.INP)
+6 QUIT
+7 ; Delete a Chest Pain (AMI) entry
+8 ; INP = V File IEN ^ DELETE REASON ^ OTHER
+9 ; Logically Delete a Chest Pain (AMI) entry
+10 ; Flag the entry as Entered in Error
+11 ; Specify the Reason and Comment (if Reason is Other)
DEL(RET,INP) ;EP
+1 NEW COMMENT,FDA,REASON,VFIEN
+2 SET VFIEN=$PIECE(INP,U)
+3 SET REASON=$PIECE(INP,U,2)
+4 SET COMMENT=$PIECE(INP,U,3)
+5 ; Missing input data
IF VFIEN=""
SET RET=$$ERR^BGOUTL(1008)
QUIT
+6 ; Item not found
IF '$DATA(^AUPNVAMI(VFIEN))
SET RET=$$ERR^BGOUTL(1035)
QUIT
+7 SET FDA=$NAME(FDA($$FNUM,VFIEN_","))
+8 SET @FDA@(5.01)=1
+9 SET @FDA@(5.02)=DUZ
+10 SET @FDA@(5.03)=$$NOW^XLFDT()
+11 SET @FDA@(5.04)=REASON
+12 SET @FDA@(5.05)=COMMENT
+13 SET RET=$$UPDATE^BGOUTL(.FDA,,VFIEN)
+14 IF RET=""
SET RET=1
+15 ;Check/Delete entry in PATIENT REFUSALS FOR SERVICE/NMI file #9000022
+16 NEW REFREA
+17 SET REFREA=$$GET1^DIQ(9000010.62,VFIEN,.17)
+18 IF $GET(REFREA)]""
Begin DoDot:1
+19 NEW RET
SET RET=$$DELREF^BGOVAMI1(VFIEN)
End DoDot:1
+20 QUIT
+21 ; Return V File #
+22 ; This method signature allows this to be called as a Remote Procedure.
FNUM(RET,INP) SET RET=9000010.62
+1 QUIT RET