BTIUVAMI ; IHS/MSC/JS - AMI TOOL OBJECT ;28-Mar-2014 17:04;DU
;;1.0;TEXT INTEGRATION UTILITIES;**1012,1013**;MAR 20, 2013;Build 33
;
Q
;
VAMI(DFN,TARGET,VIEN) ; EHR p12
;
; -- check environment variables --
I $T(GETVAR^CIAVMEVT)="" S @TARGET@(1,0)="Invalid context variables" Q "~@"_$NA(@TARGET)
I $G(TARGET)="" Q " "
K @TARGET
; -- get patient visit --
S VIEN=$G(VIEN)
I VIEN'="" G GETAMI
NEW VST
S VST=$$GETVAR^CIAVMEVT("ENCOUNTER.ID.ALTERNATEVISITID",,"CONTEXT.ENCOUNTER")
I VST="" S @TARGET@(1,0)="Invalid visit" Q "~@"_$NA(@TARGET)
S VIEN=+$$VSTR2VIS^BEHOENCX(DFN,VST) I VST<1 S @TARGET@(1,0)="Invalid context variables" Q "~@"_$NA(@TARGET)
I $G(VIEN)="" S @TARGET@(1,0)="Invalid visit" Q "~@"_$NA(@TARGET)
;
GETAMI ; -- check/get V AMI file #9000010.62 visit entry --
NEW AMIEN,CNT,FNUM,VAMIARR,VAMIERR
S AMIEN=""
S CNT=0
F S AMIEN=$O(^AUPNVAMI("AD",VIEN,AMIEN)) Q:AMIEN="" D
.D GETS
I 'CNT S @TARGET@(1,0)="No AMI data found for this visit"
Q "~@"_$NA(@TARGET)
;
GETS ; -- check/retrieve file entry(s) --
I AMIEN="" S @TARGET@(1,0)="No V AMI entry for patient visit" Q "~@"_$NA(@TARGET)
I '$D(^AUPNVAMI(AMIEN)) S @TARGET@(1,0)="No V AMI entry for patient visit" Q "~@"_$NA(@TARGET)
I $P($G(^AUPNVAMI(AMIEN,5)),U,1) Q ; EIE
S FNUM=$$FNUM
I FNUM=0 S @TARGET@(1,0)="Server error: "_$G(FILERR("DIERR",1))_U_$G(FILERR("DIERR",1,"TEXT",1)) K FILERR Q "~@"_$NA(@TARGET)
D GETS^DIQ(FNUM,AMIEN_",","**","IE","VAMIARR","VAMIERR") ; retrieve file entry data
I $D(VAMIERR) D Q "~@"_$NA(@TARGET)
.S @TARGET@(1,0)="Server error occurred: "_$G(VAMIERR("DIERR",1))_U_$G(VAMIERR("DIERR",1,"TEXT",1))
D PRINT(AMIEN)
I CNT=0 S @TARGET@(1,0)="No V AMI visit record"
Q
;
; -- print/display the AMI TOOL entry data --
PRINT(AMIEN) ;
NEW SPACE,ARRIVED,PATNAME,ONSETDT,PROVNAME,ONSETBY,ARRCOM,FIBCOM,EKGCOM,FINDCOM
N FIBBY,SYMCOM,EKGDONE,STRPAD,Z
S $P(SPACE," ",1)=""
S $P(STRPAD," ",3)=""
S ARRIVED=$G(VAMIARR(FNUM,AMIEN_",",".01","E")) ;.01 ARRIVAL DATE/TIME (RD), [0;1]
S PATNAME=$G(VAMIARR(FNUM,AMIEN_",",".02","E")) ;.02 PATIENT NAME (RP9000001'I), [0;2]
S ONSETDT=$G(VAMIARR(FNUM,AMIEN_",",".04","E")) ;.04 ONSET SYMPTOMS (D), [0;4]
S ONSETBY=$G(VAMIARR(FNUM,AMIEN_",",".06","E")) ;.06 ONSET SYMPTOMS BY (P200'), [0;6]
S EKGDONE=$G(VAMIARR(FNUM,AMIEN_",",".07","E")) ;.07 EKG DONE (DATE/TIME), [0;7]
S PROVNAME=$G(VAMIARR(FNUM,AMIEN_",","1202","E")) ;1202 ORDERING PROVIDER (*P200'X), [12;2]
S CNT=CNT+1
S @TARGET@(CNT,0)="--- Chest Pain ---"
S CNT=CNT+1
S @TARGET@(CNT,0)=SPACE
S CNT=CNT+1
S @TARGET@(CNT,0)="Arrived at: "_$G(ARRIVED)
;SYMPTOMS #9000010.622 - ONSET SYMPTOMS TEXT SUB-FILE FIELD #2.01
NEW NODE,STRING,SSY
S CNT=CNT+1
S @TARGET@(CNT,0)="Onset of symptoms: "_$G(ONSETDT)
S CNT=CNT+1
S @TARGET@(CNT,0)="Onset of symptoms entered by: "_$G(ONSETBY)
S CNT=CNT+1
S @TARGET@(CNT,0)=SPACE
S CNT=CNT+1
I $D(^AUPNVAMI(AMIEN,15))>1 S @TARGET@(CNT,0)="Symptoms:"
S STRING="",NODE=0
S NODE=0 F S NODE=$O(^AUPNVAMI(AMIEN,15,NODE)) Q:'+NODE D
.S SSY=NODE_","_AMIEN
.S STRING=$$GET1^DIQ(9000010.6215,SSY,.019)
.S CNT=CNT+1
.S @TARGET@(CNT,0)=STRPAD_STRING
.Q
;I $D(VAMIARR(FNUM,AMIEN_",","2")) D ; 2 ONSET SYMPTOMS TEXT
I $D(^AUPNVAMI(AMIEN,2))>1 D
.S CNT=CNT+1
.S @TARGET@(CNT,0)=SPACE
.S CNT=CNT+1
.S @TARGET@(CNT,0)="Onset Symptoms Comments:"
.N NUM S NUM=""
.F S NUM=$O(VAMIARR(FNUM,AMIEN_",","2",NUM)) Q:NUM="" D
..Q:NUM'?1N.N
..S SYMCOM=$G(VAMIARR(FNUM,AMIEN_",","2",NUM))
..I $G(SYMCOM)]"" D
...S CNT=CNT+1
...S @TARGET@(CNT,0)=SYMCOM
.S CNT=CNT+1
.S @TARGET@(CNT,0)=SPACE
I $G(EKGDONE)]"" D
.S CNT=CNT+1
.S @TARGET@(CNT,0)="EKG done (Date/Time): "_$G(EKGDONE)
;
;EKG #9000010.6214 - EKG FINDINGS SUB-FILE FIELD #1400
NEW NODE,STRING,NARR,EIEN
S STRING="",NODE=""
S NODE=0 F S NODE=$O(^AUPNVAMI(AMIEN,14,NODE)) Q:'+NODE D
.S EIEN=NODE_","_AMIEN
.S STRING=$$GET1^DIQ(9000010.6214,EIEN,.07) ; .07 EVENT DATE/TIME (D), [0;7]
.I $G(STRING)]"" D
..S CNT=CNT+1
..S @TARGET@(CNT,0)="EKG Findings Date/Time: "_$G(STRING)
.S STRING=$$GET1^DIQ(9000010.6214,EIEN,.02) ; .01 EKG FINDINGS CONCEPT ID (F), [0;1]
.S NARR=$$GET1^DIQ(9000010.6214,EIEN,.03)
.I NARR="" S NARR=$P($$DESC^BSTSAPI(STRING_"^^1"),U,2)
.I NARR'="" S NARR=NARR_" ("_STRING_")" D
..S CNT=CNT+1
..S @TARGET@(CNT,0)="Interpretation:"
..S CNT=CNT+1
..S @TARGET@(CNT,0)=$G(NARR)
.S STRING=$$GET1^DIQ(9000010.6214,EIEN,.06) ; .06 INTERPRETED BY (P200'), [0;6]
.I $G(STRING)]"" D
..S CNT=CNT+1
..S @TARGET@(CNT,0)="Interpreted by: "_$G(STRING)
.S Z=0 F S Z=$O(^AUPNVAMI(AMIEN,14,NODE,1,Z)) Q:'+Z D
..S STRING=$G(^AUPNVAMI(AMIEN,14,NODE,1,Z,0))
..S CNT=CNT+1
..S @TARGET@(CNT,0)=STRING
.S CNT=CNT+1
.S @TARGET@(CNT,0)=SPACE
.Q
I $D(VAMIARR(FNUM,AMIEN_",","3")) I $G(VAMIARR(FNUM,AMIEN_",","3",1))]"" D ; 3 EKG COMMENT
.S CNT=CNT+1
.S @TARGET@(CNT,0)="EKG Comments:"
.N NUM S NUM=""
.F S NUM=$O(VAMIARR(FNUM,AMIEN_",","3",NUM)) Q:NUM="" D
..Q:NUM'?1N.N
..S EKGCOM=$G(VAMIARR(FNUM,AMIEN_",","3",NUM))
..I $G(EKGCOM)]"" D
...S CNT=CNT+1
...S @TARGET@(CNT,0)=EKGCOM
.S CNT=CNT+1
.S @TARGET@(CNT,0)=SPACE
;PROTOCOLS #9000010.6213 - PROTOCOL STANDING ORDERS SUB-FILE FIELD #1300
I $D(VAMIARR(9000010.6213)) D
.NEW STRING,NODE,PROTO,PROTODT,PROTOBY,PROCOM
.S CNT=CNT+1
.S @TARGET@(CNT,0)="Standing Orders/Protocols Initiated:"
.S STRING="",NODE=""
.F S NODE=$O(VAMIARR(9000010.6213,NODE)) Q:NODE="" D
..S CNT=CNT+1
..S PROTO=$G(VAMIARR(9000010.6213,NODE,".01","E")) ; .01 PROTOCOL STANDING ORDERS (F), [0;1]
..S PROTODT=$G(VAMIARR(9000010.6213,NODE,".02","E")) ; .02 EVENT DATE/TIME (D), [0;2]
..S PROTOBY=$G(VAMIARR(9000010.6213,NODE,".04","E")) ; .04 ENTERED BY (P200'), [0;4]
..S CNT=CNT+1
..S @TARGET@(CNT,0)=$G(PROTO)_" "_$G(PROTODT)_" by "_$G(PROTOBY)
..I $D(VAMIARR(9000010.6213,NODE,1)) D ; 1 STANDING ORDER COMMENT
...S CNT=CNT+1
...S @TARGET@(CNT,0)="Standing Order Comments:"
...N NUM S NUM=0
...F S NUM=$O(VAMIARR(9000010.6213,NODE,NUM)) Q:NUM="" D
....Q:NUM'?1N.N
....N PNUM S PNUM=0
....F S PNUM=$O(VAMIARR(9000010.6213,NODE,NUM,PNUM)) Q:PNUM="" D
.....Q:PNUM'?1N.N
.....S PROCOM=$G(VAMIARR(9000010.6213,NODE,NUM,PNUM)) Q:$G(PROCOM)="" D
......S CNT=CNT+1
......S @TARGET@(CNT,0)=PROCOM
;FIBRINOLYTIC THERAPY INITIATED FIELD .11
NEW FIBSTDT,FIBNOT,FIBREA,FIBCOM,FIBTXT
S FIBSTDT=$G(VAMIARR(FNUM,AMIEN_",",".11","E")) ; .11 FIBRINOLYTIC THERAPY INITIATED (D), [0;11]
S FIBBY=$G(VAMIARR(FNUM,AMIEN_",",".13","E"))
I FIBSTDT="" D
.S FIBNOT=$G(VAMIARR(FNUM,AMIEN_",",".14","E")) ; .14 DID NOT DO
.I FIBNOT'="" D
..S CNT=CNT+1
..S @TARGET@(CNT,0)=SPACE
..S CNT=CNT+1
..S @TARGET@(CNT,0)="Fibrinolytic therapy Not chosen at "_FIBNOT
..S FIBREA=$G(VAMIARR(FNUM,AMIEN_",",".17","I")) ; .17 NO FIB REASON (REF REASON FILE IEN STORED 12.6.13)
..I $L(FIBREA)<4 S FIBTXT=FIBREA
..E S FIBTXT=$P($$CONC^BSTSAPI(FIBREA),U,4)
..I FIBTXT]"" D
...S CNT=CNT+1
...S @TARGET@(CNT,0)="Reason: "_FIBTXT
E D
.S CNT=CNT+1
.S @TARGET@(CNT,0)=SPACE
.S CNT=CNT+1
.S @TARGET@(CNT,0)="Fibrinolytic therapy started at "_FIBSTDT
I FIBBY'="" D
.S CNT=CNT+1
.S @TARGET@(CNT,0)="Fibrinolytic documented by "_FIBBY
S FIBCOM=$G(VAMIARR(FNUM,AMIEN_",","4","E"))
I $G(FIBCOM)]"" D
.S CNT=CNT+1
.S @TARGET@(CNT,0)=SPACE
I $D(VAMIARR(FNUM,AMIEN_",","4")) I $G(VAMIARR(FNUM,AMIEN_",","4",1))]"" D ; 4 FIBRINOLYTIC THERAPY COMMENT
.S CNT=CNT+1
.S @TARGET@(CNT,0)="Fibrinolytic Therapy Comments:"
.N NUM S NUM=""
.F S NUM=$O(VAMIARR(FNUM,AMIEN_",","4",NUM)) Q:NUM="" D
..Q:NUM'?1N.N
..S FIBCOM=$G(VAMIARR(FNUM,AMIEN_",","4",NUM))
..I $G(FIBCOM)]"" D
...S CNT=CNT+1
...S @TARGET@(CNT,0)=FIBCOM
.S CNT=CNT+1
.S @TARGET@(CNT,0)=SPACE
Q
;
; -- V AMI file number --
FNUM() ; returns 0/invalid file ref number, 9000010.62/valid file ref number
NEW FILEN,ATTRIB,TAROOT,MSGROOT,FILEINFO
S FILEN=9000010.62,ATTRIB="NAME;GLOBAL NAME",TAROOT="FILEINFO",MSGROOT="FILERR"
K FILERR D FILE^DID(FILEN,,ATTRIB,TAROOT,MSGROOT)
I $D(FILERR) Q 0
Q 9000010.62
BTIUVAMI ; IHS/MSC/JS - AMI TOOL OBJECT ;28-Mar-2014 17:04;DU
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**1012,1013**;MAR 20, 2013;Build 33
+2 ;
+3 QUIT
+4 ;
VAMI(DFN,TARGET,VIEN) ; EHR p12
+1 ;
+2 ; -- check environment variables --
+3 IF $TEXT(GETVAR^CIAVMEVT)=""
SET @TARGET@(1,0)="Invalid context variables"
QUIT "~@"_$NAME(@TARGET)
+4 IF $GET(TARGET)=""
QUIT " "
+5 KILL @TARGET
+6 ; -- get patient visit --
+7 SET VIEN=$GET(VIEN)
+8 IF VIEN'=""
GOTO GETAMI
+9 NEW VST
+10 SET VST=$$GETVAR^CIAVMEVT("ENCOUNTER.ID.ALTERNATEVISITID",,"CONTEXT.ENCOUNTER")
+11 IF VST=""
SET @TARGET@(1,0)="Invalid visit"
QUIT "~@"_$NAME(@TARGET)
+12 SET VIEN=+$$VSTR2VIS^BEHOENCX(DFN,VST)
IF VST<1
SET @TARGET@(1,0)="Invalid context variables"
QUIT "~@"_$NAME(@TARGET)
+13 IF $GET(VIEN)=""
SET @TARGET@(1,0)="Invalid visit"
QUIT "~@"_$NAME(@TARGET)
+14 ;
GETAMI ; -- check/get V AMI file #9000010.62 visit entry --
+1 NEW AMIEN,CNT,FNUM,VAMIARR,VAMIERR
+2 SET AMIEN=""
+3 SET CNT=0
+4 FOR
SET AMIEN=$ORDER(^AUPNVAMI("AD",VIEN,AMIEN))
IF AMIEN=""
QUIT
Begin DoDot:1
+5 DO GETS
End DoDot:1
+6 IF 'CNT
SET @TARGET@(1,0)="No AMI data found for this visit"
+7 QUIT "~@"_$NAME(@TARGET)
+8 ;
GETS ; -- check/retrieve file entry(s) --
+1 IF AMIEN=""
SET @TARGET@(1,0)="No V AMI entry for patient visit"
QUIT "~@"_$NAME(@TARGET)
+2 IF '$DATA(^AUPNVAMI(AMIEN))
SET @TARGET@(1,0)="No V AMI entry for patient visit"
QUIT "~@"_$NAME(@TARGET)
+3 ; EIE
IF $PIECE($GET(^AUPNVAMI(AMIEN,5)),U,1)
QUIT
+4 SET FNUM=$$FNUM
+5 IF FNUM=0
SET @TARGET@(1,0)="Server error: "_$GET(FILERR("DIERR",1))_U_$GET(FILERR("DIERR",1,"TEXT",1))
KILL FILERR
QUIT "~@"_$NAME(@TARGET)
+6 ; retrieve file entry data
DO GETS^DIQ(FNUM,AMIEN_",","**","IE","VAMIARR","VAMIERR")
+7 IF $DATA(VAMIERR)
Begin DoDot:1
+8 SET @TARGET@(1,0)="Server error occurred: "_$GET(VAMIERR("DIERR",1))_U_$GET(VAMIERR("DIERR",1,"TEXT",1))
End DoDot:1
QUIT "~@"_$NAME(@TARGET)
+9 DO PRINT(AMIEN)
+10 IF CNT=0
SET @TARGET@(1,0)="No V AMI visit record"
+11 QUIT
+12 ;
+13 ; -- print/display the AMI TOOL entry data --
PRINT(AMIEN) ;
+1 NEW SPACE,ARRIVED,PATNAME,ONSETDT,PROVNAME,ONSETBY,ARRCOM,FIBCOM,EKGCOM,FINDCOM
+2 NEW FIBBY,SYMCOM,EKGDONE,STRPAD,Z
+3 SET $PIECE(SPACE," ",1)=""
+4 SET $PIECE(STRPAD," ",3)=""
+5 ;.01 ARRIVAL DATE/TIME (RD), [0;1]
SET ARRIVED=$GET(VAMIARR(FNUM,AMIEN_",",".01","E"))
+6 ;.02 PATIENT NAME (RP9000001'I), [0;2]
SET PATNAME=$GET(VAMIARR(FNUM,AMIEN_",",".02","E"))
+7 ;.04 ONSET SYMPTOMS (D), [0;4]
SET ONSETDT=$GET(VAMIARR(FNUM,AMIEN_",",".04","E"))
+8 ;.06 ONSET SYMPTOMS BY (P200'), [0;6]
SET ONSETBY=$GET(VAMIARR(FNUM,AMIEN_",",".06","E"))
+9 ;.07 EKG DONE (DATE/TIME), [0;7]
SET EKGDONE=$GET(VAMIARR(FNUM,AMIEN_",",".07","E"))
+10 ;1202 ORDERING PROVIDER (*P200'X), [12;2]
SET PROVNAME=$GET(VAMIARR(FNUM,AMIEN_",","1202","E"))
+11 SET CNT=CNT+1
+12 SET @TARGET@(CNT,0)="--- Chest Pain ---"
+13 SET CNT=CNT+1
+14 SET @TARGET@(CNT,0)=SPACE
+15 SET CNT=CNT+1
+16 SET @TARGET@(CNT,0)="Arrived at: "_$GET(ARRIVED)
+17 ;SYMPTOMS #9000010.622 - ONSET SYMPTOMS TEXT SUB-FILE FIELD #2.01
+18 NEW NODE,STRING,SSY
+19 SET CNT=CNT+1
+20 SET @TARGET@(CNT,0)="Onset of symptoms: "_$GET(ONSETDT)
+21 SET CNT=CNT+1
+22 SET @TARGET@(CNT,0)="Onset of symptoms entered by: "_$GET(ONSETBY)
+23 SET CNT=CNT+1
+24 SET @TARGET@(CNT,0)=SPACE
+25 SET CNT=CNT+1
+26 IF $DATA(^AUPNVAMI(AMIEN,15))>1
SET @TARGET@(CNT,0)="Symptoms:"
+27 SET STRING=""
SET NODE=0
+28 SET NODE=0
FOR
SET NODE=$ORDER(^AUPNVAMI(AMIEN,15,NODE))
IF '+NODE
QUIT
Begin DoDot:1
+29 SET SSY=NODE_","_AMIEN
+30 SET STRING=$$GET1^DIQ(9000010.6215,SSY,.019)
+31 SET CNT=CNT+1
+32 SET @TARGET@(CNT,0)=STRPAD_STRING
+33 QUIT
End DoDot:1
+34 ;I $D(VAMIARR(FNUM,AMIEN_",","2")) D ; 2 ONSET SYMPTOMS TEXT
+35 IF $DATA(^AUPNVAMI(AMIEN,2))>1
Begin DoDot:1
+36 SET CNT=CNT+1
+37 SET @TARGET@(CNT,0)=SPACE
+38 SET CNT=CNT+1
+39 SET @TARGET@(CNT,0)="Onset Symptoms Comments:"
+40 NEW NUM
SET NUM=""
+41 FOR
SET NUM=$ORDER(VAMIARR(FNUM,AMIEN_",","2",NUM))
IF NUM=""
QUIT
Begin DoDot:2
+42 IF NUM'?1N.N
QUIT
+43 SET SYMCOM=$GET(VAMIARR(FNUM,AMIEN_",","2",NUM))
+44 IF $GET(SYMCOM)]""
Begin DoDot:3
+45 SET CNT=CNT+1
+46 SET @TARGET@(CNT,0)=SYMCOM
End DoDot:3
End DoDot:2
+47 SET CNT=CNT+1
+48 SET @TARGET@(CNT,0)=SPACE
End DoDot:1
+49 IF $GET(EKGDONE)]""
Begin DoDot:1
+50 SET CNT=CNT+1
+51 SET @TARGET@(CNT,0)="EKG done (Date/Time): "_$GET(EKGDONE)
End DoDot:1
+52 ;
+53 ;EKG #9000010.6214 - EKG FINDINGS SUB-FILE FIELD #1400
+54 NEW NODE,STRING,NARR,EIEN
+55 SET STRING=""
SET NODE=""
+56 SET NODE=0
FOR
SET NODE=$ORDER(^AUPNVAMI(AMIEN,14,NODE))
IF '+NODE
QUIT
Begin DoDot:1
+57 SET EIEN=NODE_","_AMIEN
+58 ; .07 EVENT DATE/TIME (D), [0;7]
SET STRING=$$GET1^DIQ(9000010.6214,EIEN,.07)
+59 IF $GET(STRING)]""
Begin DoDot:2
+60 SET CNT=CNT+1
+61 SET @TARGET@(CNT,0)="EKG Findings Date/Time: "_$GET(STRING)
End DoDot:2
+62 ; .01 EKG FINDINGS CONCEPT ID (F), [0;1]
SET STRING=$$GET1^DIQ(9000010.6214,EIEN,.02)
+63 SET NARR=$$GET1^DIQ(9000010.6214,EIEN,.03)
+64 IF NARR=""
SET NARR=$PIECE($$DESC^BSTSAPI(STRING_"^^1"),U,2)
+65 IF NARR'=""
SET NARR=NARR_" ("_STRING_")"
Begin DoDot:2
+66 SET CNT=CNT+1
+67 SET @TARGET@(CNT,0)="Interpretation:"
+68 SET CNT=CNT+1
+69 SET @TARGET@(CNT,0)=$GET(NARR)
End DoDot:2
+70 ; .06 INTERPRETED BY (P200'), [0;6]
SET STRING=$$GET1^DIQ(9000010.6214,EIEN,.06)
+71 IF $GET(STRING)]""
Begin DoDot:2
+72 SET CNT=CNT+1
+73 SET @TARGET@(CNT,0)="Interpreted by: "_$GET(STRING)
End DoDot:2
+74 SET Z=0
FOR
SET Z=$ORDER(^AUPNVAMI(AMIEN,14,NODE,1,Z))
IF '+Z
QUIT
Begin DoDot:2
+75 SET STRING=$GET(^AUPNVAMI(AMIEN,14,NODE,1,Z,0))
+76 SET CNT=CNT+1
+77 SET @TARGET@(CNT,0)=STRING
End DoDot:2
+78 SET CNT=CNT+1
+79 SET @TARGET@(CNT,0)=SPACE
+80 QUIT
End DoDot:1
+81 ; 3 EKG COMMENT
IF $DATA(VAMIARR(FNUM,AMIEN_",","3"))
IF $GET(VAMIARR(FNUM,AMIEN_",","3",1))]""
Begin DoDot:1
+82 SET CNT=CNT+1
+83 SET @TARGET@(CNT,0)="EKG Comments:"
+84 NEW NUM
SET NUM=""
+85 FOR
SET NUM=$ORDER(VAMIARR(FNUM,AMIEN_",","3",NUM))
IF NUM=""
QUIT
Begin DoDot:2
+86 IF NUM'?1N.N
QUIT
+87 SET EKGCOM=$GET(VAMIARR(FNUM,AMIEN_",","3",NUM))
+88 IF $GET(EKGCOM)]""
Begin DoDot:3
+89 SET CNT=CNT+1
+90 SET @TARGET@(CNT,0)=EKGCOM
End DoDot:3
End DoDot:2
+91 SET CNT=CNT+1
+92 SET @TARGET@(CNT,0)=SPACE
End DoDot:1
+93 ;PROTOCOLS #9000010.6213 - PROTOCOL STANDING ORDERS SUB-FILE FIELD #1300
+94 IF $DATA(VAMIARR(9000010.6213))
Begin DoDot:1
+95 NEW STRING,NODE,PROTO,PROTODT,PROTOBY,PROCOM
+96 SET CNT=CNT+1
+97 SET @TARGET@(CNT,0)="Standing Orders/Protocols Initiated:"
+98 SET STRING=""
SET NODE=""
+99 FOR
SET NODE=$ORDER(VAMIARR(9000010.6213,NODE))
IF NODE=""
QUIT
Begin DoDot:2
+100 SET CNT=CNT+1
+101 ; .01 PROTOCOL STANDING ORDERS (F), [0;1]
SET PROTO=$GET(VAMIARR(9000010.6213,NODE,".01","E"))
+102 ; .02 EVENT DATE/TIME (D), [0;2]
SET PROTODT=$GET(VAMIARR(9000010.6213,NODE,".02","E"))
+103 ; .04 ENTERED BY (P200'), [0;4]
SET PROTOBY=$GET(VAMIARR(9000010.6213,NODE,".04","E"))
+104 SET CNT=CNT+1
+105 SET @TARGET@(CNT,0)=$GET(PROTO)_" "_$GET(PROTODT)_" by "_$GET(PROTOBY)
+106 ; 1 STANDING ORDER COMMENT
IF $DATA(VAMIARR(9000010.6213,NODE,1))
Begin DoDot:3
+107 SET CNT=CNT+1
+108 SET @TARGET@(CNT,0)="Standing Order Comments:"
+109 NEW NUM
SET NUM=0
+110 FOR
SET NUM=$ORDER(VAMIARR(9000010.6213,NODE,NUM))
IF NUM=""
QUIT
Begin DoDot:4
+111 IF NUM'?1N.N
QUIT
+112 NEW PNUM
SET PNUM=0
+113 FOR
SET PNUM=$ORDER(VAMIARR(9000010.6213,NODE,NUM,PNUM))
IF PNUM=""
QUIT
Begin DoDot:5
+114 IF PNUM'?1N.N
QUIT
+115 SET PROCOM=$GET(VAMIARR(9000010.6213,NODE,NUM,PNUM))
IF $GET(PROCOM)=""
QUIT
Begin DoDot:6
+116 SET CNT=CNT+1
+117 SET @TARGET@(CNT,0)=PROCOM
End DoDot:6
End DoDot:5
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+118 ;FIBRINOLYTIC THERAPY INITIATED FIELD .11
+119 NEW FIBSTDT,FIBNOT,FIBREA,FIBCOM,FIBTXT
+120 ; .11 FIBRINOLYTIC THERAPY INITIATED (D), [0;11]
SET FIBSTDT=$GET(VAMIARR(FNUM,AMIEN_",",".11","E"))
+121 SET FIBBY=$GET(VAMIARR(FNUM,AMIEN_",",".13","E"))
+122 IF FIBSTDT=""
Begin DoDot:1
+123 ; .14 DID NOT DO
SET FIBNOT=$GET(VAMIARR(FNUM,AMIEN_",",".14","E"))
+124 IF FIBNOT'=""
Begin DoDot:2
+125 SET CNT=CNT+1
+126 SET @TARGET@(CNT,0)=SPACE
+127 SET CNT=CNT+1
+128 SET @TARGET@(CNT,0)="Fibrinolytic therapy Not chosen at "_FIBNOT
+129 ; .17 NO FIB REASON (REF REASON FILE IEN STORED 12.6.13)
SET FIBREA=$GET(VAMIARR(FNUM,AMIEN_",",".17","I"))
+130 IF $LENGTH(FIBREA)<4
SET FIBTXT=FIBREA
+131 IF '$TEST
SET FIBTXT=$PIECE($$CONC^BSTSAPI(FIBREA),U,4)
+132 IF FIBTXT]""
Begin DoDot:3
+133 SET CNT=CNT+1
+134 SET @TARGET@(CNT,0)="Reason: "_FIBTXT
End DoDot:3
End DoDot:2
End DoDot:1
+135 IF '$TEST
Begin DoDot:1
+136 SET CNT=CNT+1
+137 SET @TARGET@(CNT,0)=SPACE
+138 SET CNT=CNT+1
+139 SET @TARGET@(CNT,0)="Fibrinolytic therapy started at "_FIBSTDT
End DoDot:1
+140 IF FIBBY'=""
Begin DoDot:1
+141 SET CNT=CNT+1
+142 SET @TARGET@(CNT,0)="Fibrinolytic documented by "_FIBBY
End DoDot:1
+143 SET FIBCOM=$GET(VAMIARR(FNUM,AMIEN_",","4","E"))
+144 IF $GET(FIBCOM)]""
Begin DoDot:1
+145 SET CNT=CNT+1
+146 SET @TARGET@(CNT,0)=SPACE
End DoDot:1
+147 ; 4 FIBRINOLYTIC THERAPY COMMENT
IF $DATA(VAMIARR(FNUM,AMIEN_",","4"))
IF $GET(VAMIARR(FNUM,AMIEN_",","4",1))]""
Begin DoDot:1
+148 SET CNT=CNT+1
+149 SET @TARGET@(CNT,0)="Fibrinolytic Therapy Comments:"
+150 NEW NUM
SET NUM=""
+151 FOR
SET NUM=$ORDER(VAMIARR(FNUM,AMIEN_",","4",NUM))
IF NUM=""
QUIT
Begin DoDot:2
+152 IF NUM'?1N.N
QUIT
+153 SET FIBCOM=$GET(VAMIARR(FNUM,AMIEN_",","4",NUM))
+154 IF $GET(FIBCOM)]""
Begin DoDot:3
+155 SET CNT=CNT+1
+156 SET @TARGET@(CNT,0)=FIBCOM
End DoDot:3
End DoDot:2
+157 SET CNT=CNT+1
+158 SET @TARGET@(CNT,0)=SPACE
End DoDot:1
+159 QUIT
+160 ;
+161 ; -- V AMI file number --
FNUM() ; returns 0/invalid file ref number, 9000010.62/valid file ref number
+1 NEW FILEN,ATTRIB,TAROOT,MSGROOT,FILEINFO
+2 SET FILEN=9000010.62
SET ATTRIB="NAME;GLOBAL NAME"
SET TAROOT="FILEINFO"
SET MSGROOT="FILERR"
+3 KILL FILERR
DO FILE^DID(FILEN,,ATTRIB,TAROOT,MSGROOT)
+4 IF $DATA(FILERR)
QUIT 0
+5 QUIT 9000010.62