BEDDINJ ;GDIT/HS/BEE-BEDD Retrieve Injury Information ; 08 Nov 2011 12:00 PM
;;2.0;BEDD DASHBOARD;;Jun 04, 2014;Build 13
;
;This routine is included in the BEDD XML 2.0 install and is not in the KIDS
;
Q
ISINJ(VIEN) ;Return whether visit is injury related or not
;
NEW EXEC,ISINJ,INJ,OBJID
;
I $G(VIEN)="" Q 0
;
S EXEC="S OBJID=$O(^BEDD.EDVISITI(""ADIdx"",VIEN,""""))" X EXEC
I OBJID="" Q 0
;
;Check if it is an injury
S EXEC="S INJ=##CLASS(BEDD.EDVISIT).%OpenId("_OBJID_",0)" X EXEC
S EXEC="S ISINJ=INJ.Injury" X EXEC
S INJ=$S($G(ISINJ)="YES":1,1:0)
;
Q INJ
;
INJURY(VIEN,INJURY) ;Return injury related information entered on the dashboard
;
I $G(VIEN)="" Q
;
NEW OBJID,EXEC,INJ,ICIEN,INLOC,INSCO,INSPO,ISINJ,INDAT,MVLOC,INSET,INJEQ,WKREL
;
;Get the BEDD Object Id
S (ISINJ,ICIEN,OBJID,INLOC,INSCO,INSPO,INDAT,MVLOC,INSET,INJEQ,WKREL)=""
S EXEC="S OBJID=$O(^BEDD.EDVISITI(""ADIdx"",VIEN,""""))" X EXEC
I OBJID="" Q
;
S EXEC="S INJ=##CLASS(BEDD.EDVISIT).%OpenId("_OBJID_",0)" X EXEC
S EXEC="S ISINJ=INJ.Injury" X EXEC
S EXEC="S ICIEN=INJ.PtInjury.InjCauseIEN" X EXEC
S EXEC="S INLOC=INJ.PtInjury.InjLocat" X EXEC
S EXEC="S INSCO=INJ.PtInjury.AtFaultInsurance" X EXEC
S EXEC="S INSPO=INJ.PtInjury.AtFaultInsPolicy" X EXEC
S EXEC="S INDAT=INJ.PtInjury.InjDtTm" X EXEC
S EXEC="S MVLOC=INJ.PtInjury.MVCLoc" X EXEC
S EXEC="S INSET=INJ.PtInjury.InjSet" X EXEC
S EXEC="S INJEQ=INJ.PtInjury.SafetyEquip" X EXEC
S EXEC="S WKREL=INJ.PtInjury.WrkRel" X EXEC
S INJ=""
;
S INJURY("OBJID")=OBJID
S INJURY("ISINJ")=ISINJ
S INJURY("ICIEN")=ICIEN
S INJURY("INLOC")=$E(INLOC,1,100)
S INJURY("INSCO")=INSCO
S INJURY("INSPO")=INSPO
S INJURY("INDAT")=INDAT
S INJURY("MVLOC")=MVLOC
S INJURY("INSET")=INSET
S INJURY("INJEQ")=INJEQ
S INJURY("WKREL")=$S(WKREL="YES":1,1:0)
;
Q
;
UPDINJ(VIEN) ;Update the BEDD injury information
;
I $G(VIEN)="" Q
;
NEW OBJID,EXEC,INJ,ISINJ,STS,AUPNVSIT
;
;Get the BEDD Object Id
S (ISINJ,OBJID)=""
S EXEC="S OBJID=$O(^BEDD.EDVISITI(""ADIdx"",VIEN,""""))" X EXEC
I OBJID="" Q
;
;Format Injury
S ISINJ=$G(^TMP("AMER",$J,2,2)) S ISINJ=$S(ISINJ=1:"YES",1:"NO")
;
S EXEC="S INJ=##CLASS(BEDD.EDVISIT).%OpenId("_OBJID_",0)" X EXEC
;
;Injury YES/NO
S EXEC="S INJ.Injury=ISINJ" X EXEC
;
;Injury Cause
S EXEC="S INJ.PtInjury.InjCauseIEN=$G(^TMP(""AMER"",$J,2,33))" X EXEC
;
;Injury Town Location
S EXEC="I $G(^TMP(""AMER"",$J,2,31))]"""" S INJ.PtInjury.InjLocat=$G(^TMP(""AMER"",$J,2,31))" X EXEC
;S EXEC="S INSCO=INJ.PtInjury.AtFaultInsurance" X EXEC
;S EXEC="S INSPO=INJ.PtInjury.AtFaultInsPolicy" X EXEC
;
;Injury Date/Time
S EXEC="S INJ.PtInjury.InjDtTm=$G(^TMP(""AMER"",$J,2,32))" X EXEC
;
;Injury - MVC Location
S EXEC="S INJ.PtInjury.MVCLoc=$G(^TMP(""AMER"",$J,2,41))" X EXEC
;
;Injury - Driver Insurance Company
S EXEC="S INJ.PtInjury.AtFaultInsurance=$G(^TMP(""AMER"",$J,2,42))" X EXEC
;
;Injury - Driver Insurance Policy
S EXEC="S INJ.PtInjury.AtFaultInsPolicy=$G(^TMP(""AMER"",$J,2,43))" X EXEC
;
;Injury - Setting
S EXEC="S INJ.PtInjury.InjSet=$G(^TMP(""AMER"",$J,2,34))" X EXEC
;
;Injury - Safety Equipment
S EXEC="S INJ.PtInjury.SafetyEquip=$G(^TMP(""AMER"",$J,2,35))" X EXEC
;
;Save the entry
S EXEC="S STS=INJ.%Save()" X EXEC
S INJ=""
;
;Flag visit as updated
S AUPNVSIT=VIEN D MOD^AUPNVSIT
;
Q
;
INJFLD(VIEN,FIELD,VALUE) ;Update the specific BEDD injury field
;
I $G(VIEN)="" Q
;
NEW OBJID,EXEC,INJ,STS,AUPNVSIT
;
;Get the BEDD Object Id
S (OBJID)=""
S EXEC="S OBJID=$O(^BEDD.EDVISITI(""ADIdx"",VIEN,""""))" X EXEC
I OBJID="" Q
;
;Format Injury
I (FIELD="INJ.Injury")!(FIELD="INJ.PtInjury.WrkRel") S VALUE=$S(VALUE=1:"YES",1:"NO")
;
;Open the entry
S EXEC="S INJ=##CLASS(BEDD.EDVISIT).%OpenId("_OBJID_",0)" X EXEC
;
;Assemble the entry to save
S EXEC="S "_FIELD_"="""_VALUE_"""" X EXEC
;
;Save the entry
S EXEC="S STS=INJ.%Save()" X EXEC
S INJ=""
;
;Flag visit as updated
S AUPNVSIT=VIEN D MOD^AUPNVSIT
Q
BEDDINJ ;GDIT/HS/BEE-BEDD Retrieve Injury Information ; 08 Nov 2011 12:00 PM
+1 ;;2.0;BEDD DASHBOARD;;Jun 04, 2014;Build 13
+2 ;
+3 ;This routine is included in the BEDD XML 2.0 install and is not in the KIDS
+4 ;
+5 QUIT
ISINJ(VIEN) ;Return whether visit is injury related or not
+1 ;
+2 NEW EXEC,ISINJ,INJ,OBJID
+3 ;
+4 IF $GET(VIEN)=""
QUIT 0
+5 ;
+6 SET EXEC="S OBJID=$O(^BEDD.EDVISITI(""ADIdx"",VIEN,""""))"
XECUTE EXEC
+7 IF OBJID=""
QUIT 0
+8 ;
+9 ;Check if it is an injury
+10 SET EXEC="S INJ=##CLASS(BEDD.EDVISIT).%OpenId("_OBJID_",0)"
XECUTE EXEC
+11 SET EXEC="S ISINJ=INJ.Injury"
XECUTE EXEC
+12 SET INJ=$SELECT($GET(ISINJ)="YES":1,1:0)
+13 ;
+14 QUIT INJ
+15 ;
INJURY(VIEN,INJURY) ;Return injury related information entered on the dashboard
+1 ;
+2 IF $GET(VIEN)=""
QUIT
+3 ;
+4 NEW OBJID,EXEC,INJ,ICIEN,INLOC,INSCO,INSPO,ISINJ,INDAT,MVLOC,INSET,INJEQ,WKREL
+5 ;
+6 ;Get the BEDD Object Id
+7 SET (ISINJ,ICIEN,OBJID,INLOC,INSCO,INSPO,INDAT,MVLOC,INSET,INJEQ,WKREL)=""
+8 SET EXEC="S OBJID=$O(^BEDD.EDVISITI(""ADIdx"",VIEN,""""))"
XECUTE EXEC
+9 IF OBJID=""
QUIT
+10 ;
+11 SET EXEC="S INJ=##CLASS(BEDD.EDVISIT).%OpenId("_OBJID_",0)"
XECUTE EXEC
+12 SET EXEC="S ISINJ=INJ.Injury"
XECUTE EXEC
+13 SET EXEC="S ICIEN=INJ.PtInjury.InjCauseIEN"
XECUTE EXEC
+14 SET EXEC="S INLOC=INJ.PtInjury.InjLocat"
XECUTE EXEC
+15 SET EXEC="S INSCO=INJ.PtInjury.AtFaultInsurance"
XECUTE EXEC
+16 SET EXEC="S INSPO=INJ.PtInjury.AtFaultInsPolicy"
XECUTE EXEC
+17 SET EXEC="S INDAT=INJ.PtInjury.InjDtTm"
XECUTE EXEC
+18 SET EXEC="S MVLOC=INJ.PtInjury.MVCLoc"
XECUTE EXEC
+19 SET EXEC="S INSET=INJ.PtInjury.InjSet"
XECUTE EXEC
+20 SET EXEC="S INJEQ=INJ.PtInjury.SafetyEquip"
XECUTE EXEC
+21 SET EXEC="S WKREL=INJ.PtInjury.WrkRel"
XECUTE EXEC
+22 SET INJ=""
+23 ;
+24 SET INJURY("OBJID")=OBJID
+25 SET INJURY("ISINJ")=ISINJ
+26 SET INJURY("ICIEN")=ICIEN
+27 SET INJURY("INLOC")=$EXTRACT(INLOC,1,100)
+28 SET INJURY("INSCO")=INSCO
+29 SET INJURY("INSPO")=INSPO
+30 SET INJURY("INDAT")=INDAT
+31 SET INJURY("MVLOC")=MVLOC
+32 SET INJURY("INSET")=INSET
+33 SET INJURY("INJEQ")=INJEQ
+34 SET INJURY("WKREL")=$SELECT(WKREL="YES":1,1:0)
+35 ;
+36 QUIT
+37 ;
UPDINJ(VIEN) ;Update the BEDD injury information
+1 ;
+2 IF $GET(VIEN)=""
QUIT
+3 ;
+4 NEW OBJID,EXEC,INJ,ISINJ,STS,AUPNVSIT
+5 ;
+6 ;Get the BEDD Object Id
+7 SET (ISINJ,OBJID)=""
+8 SET EXEC="S OBJID=$O(^BEDD.EDVISITI(""ADIdx"",VIEN,""""))"
XECUTE EXEC
+9 IF OBJID=""
QUIT
+10 ;
+11 ;Format Injury
+12 SET ISINJ=$GET(^TMP("AMER",$JOB,2,2))
SET ISINJ=$SELECT(ISINJ=1:"YES",1:"NO")
+13 ;
+14 SET EXEC="S INJ=##CLASS(BEDD.EDVISIT).%OpenId("_OBJID_",0)"
XECUTE EXEC
+15 ;
+16 ;Injury YES/NO
+17 SET EXEC="S INJ.Injury=ISINJ"
XECUTE EXEC
+18 ;
+19 ;Injury Cause
+20 SET EXEC="S INJ.PtInjury.InjCauseIEN=$G(^TMP(""AMER"",$J,2,33))"
XECUTE EXEC
+21 ;
+22 ;Injury Town Location
+23 SET EXEC="I $G(^TMP(""AMER"",$J,2,31))]"""" S INJ.PtInjury.InjLocat=$G(^TMP(""AMER"",$J,2,31))"
XECUTE EXEC
+24 ;S EXEC="S INSCO=INJ.PtInjury.AtFaultInsurance" X EXEC
+25 ;S EXEC="S INSPO=INJ.PtInjury.AtFaultInsPolicy" X EXEC
+26 ;
+27 ;Injury Date/Time
+28 SET EXEC="S INJ.PtInjury.InjDtTm=$G(^TMP(""AMER"",$J,2,32))"
XECUTE EXEC
+29 ;
+30 ;Injury - MVC Location
+31 SET EXEC="S INJ.PtInjury.MVCLoc=$G(^TMP(""AMER"",$J,2,41))"
XECUTE EXEC
+32 ;
+33 ;Injury - Driver Insurance Company
+34 SET EXEC="S INJ.PtInjury.AtFaultInsurance=$G(^TMP(""AMER"",$J,2,42))"
XECUTE EXEC
+35 ;
+36 ;Injury - Driver Insurance Policy
+37 SET EXEC="S INJ.PtInjury.AtFaultInsPolicy=$G(^TMP(""AMER"",$J,2,43))"
XECUTE EXEC
+38 ;
+39 ;Injury - Setting
+40 SET EXEC="S INJ.PtInjury.InjSet=$G(^TMP(""AMER"",$J,2,34))"
XECUTE EXEC
+41 ;
+42 ;Injury - Safety Equipment
+43 SET EXEC="S INJ.PtInjury.SafetyEquip=$G(^TMP(""AMER"",$J,2,35))"
XECUTE EXEC
+44 ;
+45 ;Save the entry
+46 SET EXEC="S STS=INJ.%Save()"
XECUTE EXEC
+47 SET INJ=""
+48 ;
+49 ;Flag visit as updated
+50 SET AUPNVSIT=VIEN
DO MOD^AUPNVSIT
+51 ;
+52 QUIT
+53 ;
INJFLD(VIEN,FIELD,VALUE) ;Update the specific BEDD injury field
+1 ;
+2 IF $GET(VIEN)=""
QUIT
+3 ;
+4 NEW OBJID,EXEC,INJ,STS,AUPNVSIT
+5 ;
+6 ;Get the BEDD Object Id
+7 SET (OBJID)=""
+8 SET EXEC="S OBJID=$O(^BEDD.EDVISITI(""ADIdx"",VIEN,""""))"
XECUTE EXEC
+9 IF OBJID=""
QUIT
+10 ;
+11 ;Format Injury
+12 IF (FIELD="INJ.Injury")!(FIELD="INJ.PtInjury.WrkRel")
SET VALUE=$SELECT(VALUE=1:"YES",1:"NO")
+13 ;
+14 ;Open the entry
+15 SET EXEC="S INJ=##CLASS(BEDD.EDVISIT).%OpenId("_OBJID_",0)"
XECUTE EXEC
+16 ;
+17 ;Assemble the entry to save
+18 SET EXEC="S "_FIELD_"="""_VALUE_""""
XECUTE EXEC
+19 ;
+20 ;Save the entry
+21 SET EXEC="S STS=INJ.%Save()"
XECUTE EXEC
+22 SET INJ=""
+23 ;
+24 ;Flag visit as updated
+25 SET AUPNVSIT=VIEN
DO MOD^AUPNVSIT
+26 QUIT