BGOVSTR ; MSC/JS - Manage V STROKE ;30-Apr-2014 14;38;DKA
;;1.1;BGO COMPONENTS;**13,14**;Mar 20, 2007
;12.30.13 - MSC/JS add translation for Midnight, test in both pxiijs and pfrteen
;01.08.14 - MSC/DKA Send "@" to filer to delete comments when they are blank in the SET call.
;01.09.14 - MSC/JS delete fibrinolytic fields for fibrin therapy initiated or fibrin therapy refused.
;01.09.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.13.14 - MSC/JS moved GETVFIEN and NARR code to BGOVSTR1, reduce comments
;01.17.14 - MSC/JS - p13 update fixes added (IHS CCB items from Monday IHS call 1/13)
;01.24.14 - MSC/JS - moved SET code to BGOVSTR2 to keep routine size within 15k limit
;04.30.14 - MSC/DKA Corrected the order of the Scores (N) and their comments (MA,ML,LA,DY)
;
;Get STROKE by individual entry, visit, or patient
; INP = Patient IEN [1] ^ V File IEN [2] ^ Visit IEN [3]
GET(RET,INP) ;EP
N COUNT,FNUM,FN,FNS,FX,DIDNOT,Z2,INDX,IENARR,VFARR,VFDATA,VFFLD,VFMSG,VFSTR,VIEN,VFDEL,DNIR,ARRDT,EVTDT,RETMID
S RET=$$TMPGBL^BGOUTL,FNUM=$$FNUM,COUNT=0
; Get the V file IEN value(s)
; The number of values returned in IENARR
D GETVFIEN^BGOVSTR1(.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 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 ARRDT=VFDATA(FNUM,FX,.01,"I")
..S $P(VFSTR,U,2)=ARRDT ;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,.04,"I") ;Handedness
..S $P(VFSTR,U,6)=VFDATA(FNUM,FX,1203,"I") ;Clinic
..S $P(VFSTR,U,7)=VFDATA(FNUM,FX,1204,"I") ;EncounterProvider
..S EVTDT=VFDATA(FNUM,FX,1201,"I")
..S $P(VFSTR,U,8)=EVTDT ;EventDateTime
..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="F"
..S $P(VFSTR,U,2)=$G(VFDATA(FNUM,FX,.11,"I")) ;FibrinolyticTherapyInitiated
..S $P(VFSTR,U,3)=VFDATA(FNUM,FX,.12,"I") ;FibDateEntered
..S $P(VFSTR,U,4)=VFDATA(FNUM,FX,.13,"I") ;FibEnteredBy
..S $P(VFSTR,U,5)=$G(VFDATA(FNUM,FX,.14,"I")) ;DidNotInit
..S $P(VFSTR,U,6)=VFDATA(FNUM,FX,.15,"I") ;DidnotInitDateTime
..S $P(VFSTR,U,7)=VFDATA(FNUM,FX,.16,"I") ;DidnotInitEnteredBy
..S DIDNOT=$G(VFDATA(FNUM,FX,.17,"I")) ;DidnotInitReason
..I $L(DIDNOT)<4 S $P(VFSTR,U,8)=DIDNOT
..E S Z2=$O(^AUTTREFR("B",DIDNOT,"")) S $P(VFSTR,U,8)=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
..;For NIH STROKE SCALE, create a separate set of N records for each multiple
..S FNUM=$$FNUM_15
..S FX="" F S FX=$O(VFDATA(FNUM,FX)) Q:FX="" D
...S VFSTR="N"_U_$P(FX,",")
...S $P(VFSTR,U,3)=$G(VFDATA(FNUM,FX,.01,"I")) ;NihStrokeScale
...S $P(VFSTR,U,4)=$G(VFDATA(FNUM,FX,.02,"I")) ;EventDateTime
...S $P(VFSTR,U,5)=$G(VFDATA(FNUM,FX,.03,"I")) ;EnteredBy
...S $P(VFSTR,U,6)=$G(VFDATA(FNUM,FX,.04,"I")) ;LOC
...S $P(VFSTR,U,7)=$G(VFDATA(FNUM,FX,.05,"I")) ;LOCquestions
...S $P(VFSTR,U,8)=$G(VFDATA(FNUM,FX,.06,"I")) ;LOCcommands
...S $P(VFSTR,U,9)=$G(VFDATA(FNUM,FX,.07,"I")) ;StrokeScale2BestGaze
...S $P(VFSTR,U,10)=$G(VFDATA(FNUM,FX,.08,"I")) ;Visual
...S $P(VFSTR,U,11)=$G(VFDATA(FNUM,FX,.09,"I")) ;StrokeScaleFacialPalsy
...S $P(VFSTR,U,12)=$G(VFDATA(FNUM,FX,.1,"I")) ;MotorArmLeft
...S $P(VFSTR,U,13)=$G(VFDATA(FNUM,FX,.11,"I")) ;MotorArmRight
...S $P(VFSTR,U,14)=$G(VFDATA(FNUM,FX,.12,"I")) ;MotorLegRight
...S $P(VFSTR,U,15)=$G(VFDATA(FNUM,FX,.13,"I")) ;MotorLegLeft
...S $P(VFSTR,U,16)=$G(VFDATA(FNUM,FX,.14,"I")) ;LimbAtaxia
...S $P(VFSTR,U,17)=$G(VFDATA(FNUM,FX,.15,"I")) ;Sensory
...S $P(VFSTR,U,18)=$G(VFDATA(FNUM,FX,.16,"I")) ;BestLanguage
...S $P(VFSTR,U,19)=$G(VFDATA(FNUM,FX,.17,"I")) ;Dysarthria
...S $P(VFSTR,U,20)=$G(VFDATA(FNUM,FX,.18,"I")) ;ExtinctionInattention
...S $P(VFSTR,U,21)=$G(VFDATA(FNUM,FX,.19,"I")) ;TotalStrokeScore
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
...;For NIH STROKE SCALE MOTOR ARM COMMENTS, create a separate MA record
...S VFSTR="MA"_U_$P(FX,",")
...S $P(VFSTR,U,2)=$G(VFDATA(FNUM,FX,1.01,"I")) ;Motor Arm Left Comment
...S $P(VFSTR,U,3)=$G(VFDATA(FNUM,FX,1.02,"I")) ;Motor Arm Right Comment
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
...;For NIH STROKE SCALE MOTOR LEG COMMENTS, create a separate ML record
...S VFSTR="ML"_U_$P(FX,",")
...S $P(VFSTR,U,2)=$G(VFDATA(FNUM,FX,2.01,"I")) ;Motor Leg Right Comment
...S $P(VFSTR,U,3)=$G(VFDATA(FNUM,FX,2.02,"I")) ;Motor Leg Left Comment
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
...;For NIH STROKE SCALE LIMB ATAXIA COMMENT, create a separate LA record
...S VFSTR="LA"_U_$P(FX,",")
...S $P(VFSTR,U,2)=$G(VFDATA(FNUM,FX,3.01,"I")) ;Limb Ataxia Comment
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
...;For NIH STROKE SCALE DYSARTHRIA COMMENT, create a separate DY record
...S VFSTR="DY"_U_$P(FX,",")
...S $P(VFSTR,U,2)=$G(VFDATA(FNUM,FX,3.02,"I")) ;Dysarthria Comment
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
..;For PROTOCOL STANDING ORDERS, create 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)=$G(VFDATA(FNUM,FX,.01,"I")) ;ProtocolStandingOrders
...S $P(VFSTR,U,4)=$G(VFDATA(FNUM,FX,.02,"I")) ;EventDateTime
...S $P(VFSTR,U,5)=$G(VFDATA(FNUM,FX,.03,"I")) ;Date/Time Entered
...S $P(VFSTR,U,6)=$G(VFDATA(FNUM,FX,.04,"I")) ;Entered By
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
...; Add comment lines for "PT" record
...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 STROKE SYMPTOMS, create S and ST records for each multiple
..S FNUM=$$FNUM_14
..S FX="" F S FX=$O(VFDATA(FNUM,FX)) Q:FX="" D
...S VFSTR="SS"_U_$P(FX,",")
...S $P(VFSTR,U,3)=$G(VFDATA(FNUM,FX,.01,"I")) ;ConceptID
...S $P(VFSTR,U,4)=$G(VFDATA(FNUM,FX,.019,"I")) ;SnomedPreferredTerm
...S $P(VFSTR,U,5)=$G(VFDATA(FNUM,FX,.02,"I")) ;DescriptionID
...S $P(VFSTR,U,6)=$P($G(VFDATA(FNUM,FX,.03,"E")),"|",1) ;ProviderText
...S $P(VFSTR,U,7)=$G(VFDATA(FNUM,FX,.04,"I")) ;DateTimeEntered
...S $P(VFSTR,U,8)=$G(VFDATA(FNUM,FX,.05,"I")) ;EnteredBy
...S $P(VFSTR,U,9)=$G(VFDATA(FNUM,FX,.06,"I")) ;Witnessed?
...S $P(VFSTR,U,10)=$G(VFDATA(FNUM,FX,.07,"I")) ;WitnessedBy
...S $P(VFSTR,U,11)=$G(VFDATA(FNUM,FX,.08,"I")) ;DateTimeWitnessed
...S $P(VFSTR,U,12)=$G(VFDATA(FNUM,FX,.09,"I")) ;BaselineStateLoinc
...S $P(VFSTR,U,13)=$G(VFDATA(FNUM,FX,.1,"I")) ;BaselineStateDateTime
...S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
...; Add the STROKE SYMPTOMS COMMENT lines on "ST" records
...S FNS=0 F S FNS=$O(VFDATA(FNUM,FX,1,FNS)) Q:'FNS D
....S VFSTR="ST"_U_$P(FX,",")
....S $P(VFSTR,U,3)=$G(VFDATA(FNUM,FX,1,FNS))
....S VFARR=VFARR+1,VFARR(VFARR)=VFSTR
..; For HANDEDNESS SNOMED CT, create a separate set of HS records for each multiple
..S FNUM=$$FNUM_2
..S FX="" F S FX=$O(VFDATA(FNUM,FX)) Q:FX="" D
...S VFSTR="HS"_U_$P(FX,",")
...S $P(VFSTR,U,3)=$G(VFDATA(FNUM,FX,.01,"I")) ; HandednessSnomedCode
...S $P(VFSTR,U,4)=$G(VFDATA(FNUM,FX,.019,"I")) ;HandednessPreferredTerm
...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 value to include the Visit File IEN
..K VFARR
Q RET
SET(RET,INP) ;EP
;Add/edit V STROKE entry
;The first string is the VFIEN^NumberOfLines^VisitIsLocked, check BGOVSTR2 for input string descriptions
S RET=""
D SET^BGOVSTR2(.RET,.INP)
Q
; Logically Delete a STROKE entry
; INP = V File IEN ^ DELETE REASON ^ OTHER
; Flag the entry as Entered in Error
; Specify the Reason and Comment (if Reason is Other)
; Update V Measurement file LKW and NSST entries EIE
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
I '$D(^AUPNVSTR(VFIEN)) S RET=$$ERR^BGOUTL(1035) Q
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
N REFREA
S REFREA=$$GET1^DIQ(9000010.63,VFIEN,.17)
I $G(REFREA)]"" D
.N RET S RET=$$DELREF^BGOVSTR1(VFIEN)
D EIEVM^BGOVSTR1(.RET2,VFIEN)
Q
; Return V File #
FNUM(RET,INP) S RET=9000010.63
Q RET
BGOVSTR ; MSC/JS - Manage V STROKE ;30-Apr-2014 14;38;DKA
+1 ;;1.1;BGO COMPONENTS;**13,14**;Mar 20, 2007
+2 ;12.30.13 - MSC/JS add translation for Midnight, test in both pxiijs and pfrteen
+3 ;01.08.14 - MSC/DKA Send "@" to filer to delete comments when they are blank in the SET call.
+4 ;01.09.14 - MSC/JS delete fibrinolytic fields for fibrin therapy initiated or fibrin therapy refused.
+5 ;01.09.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.13.14 - MSC/JS moved GETVFIEN and NARR code to BGOVSTR1, reduce comments
+9 ;01.17.14 - MSC/JS - p13 update fixes added (IHS CCB items from Monday IHS call 1/13)
+10 ;01.24.14 - MSC/JS - moved SET code to BGOVSTR2 to keep routine size within 15k limit
+11 ;04.30.14 - MSC/DKA Corrected the order of the Scores (N) and their comments (MA,ML,LA,DY)
+12 ;
+13 ;Get STROKE by individual entry, visit, or patient
+14 ; INP = Patient IEN [1] ^ V File IEN [2] ^ Visit IEN [3]
GET(RET,INP) ;EP
+1 NEW COUNT,FNUM,FN,FNS,FX,DIDNOT,Z2,INDX,IENARR,VFARR,VFDATA,VFFLD,VFMSG,VFSTR,VIEN,VFDEL,DNIR,ARRDT,EVTDT,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 returned in IENARR
+5 DO GETVFIEN^BGOVSTR1(.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 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 SET ARRDT=VFDATA(FNUM,FX,.01,"I")
+23 ;ArrivalDateTime
SET $PIECE(VFSTR,U,2)=ARRDT
+24 ;PatientName
SET $PIECE(VFSTR,U,3)=VFDATA(FNUM,FX,.02,"I")
+25 ;Visit
SET (VIEN,$PIECE(VFSTR,U,4))=VFDATA(FNUM,FX,.03,"I")
+26 ;Handedness
SET $PIECE(VFSTR,U,5)=VFDATA(FNUM,FX,.04,"I")
+27 ;Clinic
SET $PIECE(VFSTR,U,6)=VFDATA(FNUM,FX,1203,"I")
+28 ;EncounterProvider
SET $PIECE(VFSTR,U,7)=VFDATA(FNUM,FX,1204,"I")
+29 SET EVTDT=VFDATA(FNUM,FX,1201,"I")
+30 ;EventDateTime
SET $PIECE(VFSTR,U,8)=EVTDT
+31 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+32 ; Add the comment lines from field 1 on separate "AT" records
+33 SET FNS=0
+34 FOR
SET FNS=$ORDER(VFDATA(FNUM,FX,1,FNS))
IF 'FNS
QUIT
Begin DoDot:3
+35 SET VFSTR="AT"
+36 SET $PIECE(VFSTR,U,2)=$GET(VFDATA(FNUM,FX,1,FNS))
+37 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
End DoDot:3
+38 SET VFSTR="F"
+39 ;FibrinolyticTherapyInitiated
SET $PIECE(VFSTR,U,2)=$GET(VFDATA(FNUM,FX,.11,"I"))
+40 ;FibDateEntered
SET $PIECE(VFSTR,U,3)=VFDATA(FNUM,FX,.12,"I")
+41 ;FibEnteredBy
SET $PIECE(VFSTR,U,4)=VFDATA(FNUM,FX,.13,"I")
+42 ;DidNotInit
SET $PIECE(VFSTR,U,5)=$GET(VFDATA(FNUM,FX,.14,"I"))
+43 ;DidnotInitDateTime
SET $PIECE(VFSTR,U,6)=VFDATA(FNUM,FX,.15,"I")
+44 ;DidnotInitEnteredBy
SET $PIECE(VFSTR,U,7)=VFDATA(FNUM,FX,.16,"I")
+45 ;DidnotInitReason
SET DIDNOT=$GET(VFDATA(FNUM,FX,.17,"I"))
+46 IF $LENGTH(DIDNOT)<4
SET $PIECE(VFSTR,U,8)=DIDNOT
+47 IF '$TEST
SET Z2=$ORDER(^AUTTREFR("B",DIDNOT,""))
SET $PIECE(VFSTR,U,8)=Z2
+48 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+49 ; Add the comment lines from field 4 on separate "FT" records
+50 SET FNS=0
FOR
SET FNS=$ORDER(VFDATA(FNUM,FX,4,FNS))
IF 'FNS
QUIT
Begin DoDot:3
+51 SET VFSTR="FT"
+52 SET $PIECE(VFSTR,U,2)=$GET(VFDATA(FNUM,FX,4,FNS))
+53 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
End DoDot:3
+54 ;For NIH STROKE SCALE, create a separate set of N records for each multiple
+55 SET FNUM=$$FNUM_15
+56 SET FX=""
FOR
SET FX=$ORDER(VFDATA(FNUM,FX))
IF FX=""
QUIT
Begin DoDot:3
+57 SET VFSTR="N"_U_$PIECE(FX,",")
+58 ;NihStrokeScale
SET $PIECE(VFSTR,U,3)=$GET(VFDATA(FNUM,FX,.01,"I"))
+59 ;EventDateTime
SET $PIECE(VFSTR,U,4)=$GET(VFDATA(FNUM,FX,.02,"I"))
+60 ;EnteredBy
SET $PIECE(VFSTR,U,5)=$GET(VFDATA(FNUM,FX,.03,"I"))
+61 ;LOC
SET $PIECE(VFSTR,U,6)=$GET(VFDATA(FNUM,FX,.04,"I"))
+62 ;LOCquestions
SET $PIECE(VFSTR,U,7)=$GET(VFDATA(FNUM,FX,.05,"I"))
+63 ;LOCcommands
SET $PIECE(VFSTR,U,8)=$GET(VFDATA(FNUM,FX,.06,"I"))
+64 ;StrokeScale2BestGaze
SET $PIECE(VFSTR,U,9)=$GET(VFDATA(FNUM,FX,.07,"I"))
+65 ;Visual
SET $PIECE(VFSTR,U,10)=$GET(VFDATA(FNUM,FX,.08,"I"))
+66 ;StrokeScaleFacialPalsy
SET $PIECE(VFSTR,U,11)=$GET(VFDATA(FNUM,FX,.09,"I"))
+67 ;MotorArmLeft
SET $PIECE(VFSTR,U,12)=$GET(VFDATA(FNUM,FX,.1,"I"))
+68 ;MotorArmRight
SET $PIECE(VFSTR,U,13)=$GET(VFDATA(FNUM,FX,.11,"I"))
+69 ;MotorLegRight
SET $PIECE(VFSTR,U,14)=$GET(VFDATA(FNUM,FX,.12,"I"))
+70 ;MotorLegLeft
SET $PIECE(VFSTR,U,15)=$GET(VFDATA(FNUM,FX,.13,"I"))
+71 ;LimbAtaxia
SET $PIECE(VFSTR,U,16)=$GET(VFDATA(FNUM,FX,.14,"I"))
+72 ;Sensory
SET $PIECE(VFSTR,U,17)=$GET(VFDATA(FNUM,FX,.15,"I"))
+73 ;BestLanguage
SET $PIECE(VFSTR,U,18)=$GET(VFDATA(FNUM,FX,.16,"I"))
+74 ;Dysarthria
SET $PIECE(VFSTR,U,19)=$GET(VFDATA(FNUM,FX,.17,"I"))
+75 ;ExtinctionInattention
SET $PIECE(VFSTR,U,20)=$GET(VFDATA(FNUM,FX,.18,"I"))
+76 ;TotalStrokeScore
SET $PIECE(VFSTR,U,21)=$GET(VFDATA(FNUM,FX,.19,"I"))
+77 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+78 ;For NIH STROKE SCALE MOTOR ARM COMMENTS, create a separate MA record
+79 SET VFSTR="MA"_U_$PIECE(FX,",")
+80 ;Motor Arm Left Comment
SET $PIECE(VFSTR,U,2)=$GET(VFDATA(FNUM,FX,1.01,"I"))
+81 ;Motor Arm Right Comment
SET $PIECE(VFSTR,U,3)=$GET(VFDATA(FNUM,FX,1.02,"I"))
+82 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+83 ;For NIH STROKE SCALE MOTOR LEG COMMENTS, create a separate ML record
+84 SET VFSTR="ML"_U_$PIECE(FX,",")
+85 ;Motor Leg Right Comment
SET $PIECE(VFSTR,U,2)=$GET(VFDATA(FNUM,FX,2.01,"I"))
+86 ;Motor Leg Left Comment
SET $PIECE(VFSTR,U,3)=$GET(VFDATA(FNUM,FX,2.02,"I"))
+87 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+88 ;For NIH STROKE SCALE LIMB ATAXIA COMMENT, create a separate LA record
+89 SET VFSTR="LA"_U_$PIECE(FX,",")
+90 ;Limb Ataxia Comment
SET $PIECE(VFSTR,U,2)=$GET(VFDATA(FNUM,FX,3.01,"I"))
+91 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+92 ;For NIH STROKE SCALE DYSARTHRIA COMMENT, create a separate DY record
+93 SET VFSTR="DY"_U_$PIECE(FX,",")
+94 ;Dysarthria Comment
SET $PIECE(VFSTR,U,2)=$GET(VFDATA(FNUM,FX,3.02,"I"))
+95 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
End DoDot:3
+96 ;For PROTOCOL STANDING ORDERS, create P and PT records for each multiple
+97 SET FNUM=$$FNUM_13
+98 SET FX=""
FOR
SET FX=$ORDER(VFDATA(FNUM,FX))
IF FX=""
QUIT
Begin DoDot:3
+99 SET VFSTR="P"_U_$PIECE(FX,",")
+100 ;ProtocolStandingOrders
SET $PIECE(VFSTR,U,3)=$GET(VFDATA(FNUM,FX,.01,"I"))
+101 ;EventDateTime
SET $PIECE(VFSTR,U,4)=$GET(VFDATA(FNUM,FX,.02,"I"))
+102 ;Date/Time Entered
SET $PIECE(VFSTR,U,5)=$GET(VFDATA(FNUM,FX,.03,"I"))
+103 ;Entered By
SET $PIECE(VFSTR,U,6)=$GET(VFDATA(FNUM,FX,.04,"I"))
+104 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+105 ; Add comment lines for "PT" record
+106 SET FNS=0
FOR
SET FNS=$ORDER(VFDATA(FNUM,FX,1,FNS))
IF 'FNS
QUIT
Begin DoDot:4
+107 SET VFSTR="PT"_U_$PIECE(FX,",")
+108 SET $PIECE(VFSTR,U,3)=$GET(VFDATA(FNUM,FX,1,FNS))
+109 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
End DoDot:4
End DoDot:3
+110 ;For STROKE SYMPTOMS, create S and ST records for each multiple
+111 SET FNUM=$$FNUM_14
+112 SET FX=""
FOR
SET FX=$ORDER(VFDATA(FNUM,FX))
IF FX=""
QUIT
Begin DoDot:3
+113 SET VFSTR="SS"_U_$PIECE(FX,",")
+114 ;ConceptID
SET $PIECE(VFSTR,U,3)=$GET(VFDATA(FNUM,FX,.01,"I"))
+115 ;SnomedPreferredTerm
SET $PIECE(VFSTR,U,4)=$GET(VFDATA(FNUM,FX,.019,"I"))
+116 ;DescriptionID
SET $PIECE(VFSTR,U,5)=$GET(VFDATA(FNUM,FX,.02,"I"))
+117 ;ProviderText
SET $PIECE(VFSTR,U,6)=$PIECE($GET(VFDATA(FNUM,FX,.03,"E")),"|",1)
+118 ;DateTimeEntered
SET $PIECE(VFSTR,U,7)=$GET(VFDATA(FNUM,FX,.04,"I"))
+119 ;EnteredBy
SET $PIECE(VFSTR,U,8)=$GET(VFDATA(FNUM,FX,.05,"I"))
+120 ;Witnessed?
SET $PIECE(VFSTR,U,9)=$GET(VFDATA(FNUM,FX,.06,"I"))
+121 ;WitnessedBy
SET $PIECE(VFSTR,U,10)=$GET(VFDATA(FNUM,FX,.07,"I"))
+122 ;DateTimeWitnessed
SET $PIECE(VFSTR,U,11)=$GET(VFDATA(FNUM,FX,.08,"I"))
+123 ;BaselineStateLoinc
SET $PIECE(VFSTR,U,12)=$GET(VFDATA(FNUM,FX,.09,"I"))
+124 ;BaselineStateDateTime
SET $PIECE(VFSTR,U,13)=$GET(VFDATA(FNUM,FX,.1,"I"))
+125 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
+126 ; Add the STROKE SYMPTOMS COMMENT lines on "ST" records
+127 SET FNS=0
FOR
SET FNS=$ORDER(VFDATA(FNUM,FX,1,FNS))
IF 'FNS
QUIT
Begin DoDot:4
+128 SET VFSTR="ST"_U_$PIECE(FX,",")
+129 SET $PIECE(VFSTR,U,3)=$GET(VFDATA(FNUM,FX,1,FNS))
+130 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
End DoDot:4
End DoDot:3
+131 ; For HANDEDNESS SNOMED CT, create a separate set of HS records for each multiple
+132 SET FNUM=$$FNUM_2
+133 SET FX=""
FOR
SET FX=$ORDER(VFDATA(FNUM,FX))
IF FX=""
QUIT
Begin DoDot:3
+134 SET VFSTR="HS"_U_$PIECE(FX,",")
+135 ; HandednessSnomedCode
SET $PIECE(VFSTR,U,3)=$GET(VFDATA(FNUM,FX,.01,"I"))
+136 ;HandednessPreferredTerm
SET $PIECE(VFSTR,U,4)=$GET(VFDATA(FNUM,FX,.019,"I"))
+137 SET VFARR=VFARR+1
SET VFARR(VFARR)=VFSTR
End DoDot:3
End DoDot:2
+138 IF 'VFDEL
Begin DoDot:2
+139 SET COUNT=COUNT+1
+140 MERGE @RET@(COUNT)=VFARR
+141 ; Reset value to include the Visit File IEN
SET @RET@(COUNT)=VFIEN_U_VFARR_U_$$ISLOCKED^BEHOENCX(VIEN)
+142 KILL VFARR
End DoDot:2
End DoDot:1
+143 QUIT RET
SET(RET,INP) ;EP
+1 ;Add/edit V STROKE entry
+2 ;The first string is the VFIEN^NumberOfLines^VisitIsLocked, check BGOVSTR2 for input string descriptions
+3 SET RET=""
+4 DO SET^BGOVSTR2(.RET,.INP)
+5 QUIT
+6 ; Logically Delete a STROKE entry
+7 ; INP = V File IEN ^ DELETE REASON ^ OTHER
+8 ; Flag the entry as Entered in Error
+9 ; Specify the Reason and Comment (if Reason is Other)
+10 ; Update V Measurement file LKW and NSST entries EIE
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 IF VFIEN=""
SET RET=$$ERR^BGOUTL(1008)
QUIT
+6 IF '$DATA(^AUPNVSTR(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 NEW REFREA
+16 SET REFREA=$$GET1^DIQ(9000010.63,VFIEN,.17)
+17 IF $GET(REFREA)]""
Begin DoDot:1
+18 NEW RET
SET RET=$$DELREF^BGOVSTR1(VFIEN)
End DoDot:1
+19 DO EIEVM^BGOVSTR1(.RET2,VFIEN)
+20 QUIT
+21 ; Return V File #
FNUM(RET,INP) SET RET=9000010.63
+1 QUIT RET